The prefixes for serialization are taken from the default graph.

You can load the default graph just with prefixes, and no triples, to control the output from a named graph.

    Andy

On 05/03/16 11:57, Valerio Belcastro wrote:
Hi guys,

I launched Fuseki 2.3.1 as a standalone server on my local machine from
command line like this:

path-to-fuseki-folder>fuseki-server --update --mem /myData

Then I uploaded some data into the dataset default graph using this code
snippet:

    String personURI    = "http://somewhere/JohnSmith";;
    String malcolmURI   = "http://somewhere/MalcolmGraves";;
    String givenName    = "John";
    String familyName   = "Smith";
    String fullName     = givenName + " " + familyName;
    String fullName2    = "Malcolm Graves";
    String email        = givenName+familyName+"@gmail.com";
           // create an empty Model
    Model model = ModelFactory.createDefaultModel();
    // create the resource   //   and add the properties cascading style
    Resource johnSmith
        = model.createResource(personURI)
            .addProperty(VCARD.FN, fullName)
           .addProperty(VCARD.N,
               model.createResource()
                  .addProperty(VCARD.Given, givenName)
                  .addProperty(VCARD.Family, familyName));

    model.setNsPrefix("vcard", VCARD.getURI());
    DatasetAccessor dsa = DatasetAccessorFactory.createHTTP("http:/
/localhost:3030/myData/data");

    dsa.add(model);


After that, I retrieved the default graph and printed his prefix map:

    Iterator<Map.Entry<String, String>> nsIt = dsga.getModel().getN
sPrefixMap().entrySet().iterator();
    nsIt.forEachRemaining(ns -> {
      System.out.println(ns);   });


The output I obtained is the following:

    vcard=http://www.w3.org/2001/vcard-rdf/3.0#

    rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#


If I do the same thing loading the model into a named graph instead of
the defaultgraph nothing is printed on console, it is like the prefix
map is empty.

Do I need to configure something to make things work?

Thank you in advance


Reply via email to