Hi,

I am working with named graphs in TRIG format and using Dataset structure for 
that. I noticed that if I write from Dataset into TRIG format, I am loosing the 
information about blank nodes that are shared between the named graphs. 
Internally though, I can see that Dataset does correctly assign the same id to 
the shared blank nodes. How can I preserve the information about shared blank 
node when writing into TRIG?

Kind regards,
Yana

The example input/code/output:
INPUT:
    @prefix :      <http://www.example.com#> .
    :G1 {
      _:subj :pred1 :obj1 .
    }
    :G2 {
      _:subj :pred2 :obj2 .
    }

CODE:
    InputStream is = this.getClass().getResourceAsStream(RESOURCE_FILE);
    Dataset dataset = DatasetFactory.createMem();
    RDFDataMgr.read(dataset, is, RDFFormat.TRIG.getLang());
    is.close();

    File outFile = File.createTempFile("ng", ".trig");
    System.out.println(outFile);
    OutputStream os = new FileOutputStream(outFile);
    RDFDataMgr.write(os, dataset, RDFFormat.TRIG.getLang());
    os.close();

OUTPUT:
    @prefix :      <http://www.example.com#> .
    { 
    }
    :G1 {
        [ :pred1  :obj1 ] .
    }
    :G2 {
        [ :pred2  :obj2 ] .
    }

Reply via email to