Hi Rob, Thanks for your reply. I saw the errors with the uri/literal creation. Completely true!
And about the Nquad specification, yep, I think I understand my problem! Thanks! On 2 October 2013 14:13, Alejandro Rodríguez González < [email protected]> wrote: > Hi all, > > I'm trying to create a small program which convert an RDF file into quads > adding context. > > I've been looking at the examples in the API and some information on > Google, but I don't know exactly what I'm doing wrong. > > I create my quads in the following way: > > ArrayList<Quad> quads = new ArrayList<Quad>(); > quads.add(new Quad(this.assertionNode, this.rdfTypeNode, > this.nanoPubSchemaAssertionNode, this.nanoPubNode)); > quads.add(new Quad(this.nanoPubNode, this.purlCoverageNode, > getNodeFromString(coverageContent), this.provenanceNode)); > > The "nodes" are created using NodeFactory. Just an example with the nodes > used in the example presented before: > > this.assertionNode = NodeFactory.createLiteral(" > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/assertion/6bfba5c26cedaa3caf460d36d25ceef0 > "); > > this.nanoPubNode = NodeFactory.createLiteral(" > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/nanopublication/6bfba5c26cedaa3caf460d36d25ceef0 > "); > > this.provenanceNode = NodeFactory.createLiteral(" > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/provenance/1380725119158 > "); > > etc. > > Once I've created all my structure, I try to print it on screen and store > it on a .nq file using this code: > > Dataset ds = TDBFactory.createDataset(); > DatasetGraph dsg = ds.asDatasetGraph(); > for (int i = 0; i < quads.size(); i++) { > dsg.add(quads.get(i)); > } > RDFDataMgr.write(new FileOutputStream(new File("output/nquad2.nq")), > dsg, RDFFormat.NQUADS); > System.out.println(dsg.toString()); > > The output that I get in the console is the following: > > (dataset > (graph) > (graph " > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/assertion/6bfba5c26cedaa3caf460d36d25ceef0 > " > (triple "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" " > http://www.nanopub.org/nschema#Assertion" " > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/nanopublication/6bfba5c26cedaa3caf460d36d25ceef0 > ") > ) > (graph " > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/nanopublication/6bfba5c26cedaa3caf460d36d25ceef0 > " > (triple "http://purl.org/dc/elements/1.1/description" "\"Output from > SADI Service\"@en" " > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/provenance/1380725119158 > ") > )) > > > Which, it is the one that "I desire". However, in the file, I've the > following: > > "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" " > http://www.nanopub.org/nschema#Assertion" " > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/nanopublication/6bfba5c26cedaa3caf460d36d25ceef0" > " > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/assertion/6bfba5c26cedaa3caf460d36d25ceef0" > . > "http://purl.org/dc/elements/1.1/description" "\"Output from SADI > Service\"@en" " > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/provenance/1380725119158" > " > http://biordf.org:8080/cgi-bin/services/retrieveProteomeProtiens_sync.pl/nanopublication/6bfba5c26cedaa3caf460d36d25ceef0" > . > > My questions are: > > 1) Why is the order of the nodes different? I mean, I expect to have: > context, s, p, o (like when it is printed) > 2) Why, even using RDFFormat.NQUADS the serialization is between " " and > not between <> ? > > Probably I'm missing something ... > > Thanks for your time. > > Cheers, > > Alejandro > > -- > Dr. Alejandro Rodríguez González - PhD > > Bioinformatics at Centre for Plant Biotechnology and Genomics UPM-INIA > Polytechnic University of Madrid > http://www.alejandrorg.com > Phone: +34 914524900 . Ext: 25550 > > > *Once the game is over, the king and the pawn go back in the same box. - > Italian proverb* > -- Dr. Alejandro Rodríguez González - PhD Bioinformatics at Centre for Plant Biotechnology and Genomics UPM-INIA Polytechnic University of Madrid http://www.alejandrorg.com Phone: +34 914524900 . Ext: 25550 *Once the game is over, the king and the pawn go back in the same box. - Italian proverb*
