Create teh query and clear its prefix map:

    Query query = ... ;
    query.getPrologue().getPrefixMapping().clearNsPrefixMap();
    System.out.println(query);



On 23/11/17 13:14, Mohammad Noorani Bakerally wrote:
Suppose I have a query like:

PREFIX  :     <http://opensensingcity.emse.fr/LDPDesignVocabulary/>
PREFIX  data: <http://opensensingcity.emse.fr/LDPDesign/data/>
PREFIX  dcat: <http://www.w3.org/ns/dcat#>\n\nCONSTRUCT \n  { \n    <
https://bistrotdepays.opendatasoft.com/api/v2/catalog/datasets/animations_bistrots_de_pays>
?p ?o .\n  }\nWHERE\n  { <
https://bistrotdepays.opendatasoft.com/api/v2/catalog/datasets/animations_bistrots_de_pays>\n
              ?p  ?o\n    FILTER ( ?p NOT IN (dcat:distribution) )\n  }


Is it possible to obtain a query where all prefixes have been expanded ? is
it not possible to load the query, expand it and serialize it ?

  I have tried the following which isn't working:

Query gq = QueryFactory.create(Global.prefixes + graphQuery);
gq.setPrefixMapping(Global.prefixMap);
Global.prefixMap.getNsPrefixMap().entrySet().stream().forEach(prefixEntry->{
     gq.expandPrefixedName(prefixEntry.getKey());
});


‌

Reply via email to