On 19/08/14 21:45, Vincent Emonet wrote:
Hi,

I'm actually using Jena Libraries to convert from a RDF language to another.

Here is my test code :
String rdfInput = "<http://example.org/1> <
http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://example.org/resource> . <http://example.org/2> <
http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://example.org/resource> .";
Reader reader = new StringReader(rdfInput);
Model model = ModelFactory.createDefaultModel();
model.read(reader,  "http://example_graph";, "N-TRIPLE");

RDFDataMgr.write(System.out, model, Lang.NQUADS);


But the returned RDF is in N-triple lang:
<http://example.org/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://example.org/resource> .
<http://example.org/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://example.org/resource> .

That is N-quads when there is no graph name.

N-triples is a the subset of N-Qyads when there is no graph name.

> Model model = ModelFactory.createDefaultModel();

create a graph - no name.

> model.read(reader,  "http://example_graph";, "N-TRIPLE");

reads into the model - "http://example_graph"; is the base URI and does not name the model.

When writing, triples get written with no 4th field.

        Andy



Tried converting to Lang.JSONLD, Lang.N3, Lang.TRIG, Lang.RDFXML : it
worked perfectly

But when I'm asking for Lang.NQUADS or Lang.NQ it's generating N-Triples
and not N-Quads.


Is anyone having a clue on the source of this problem? Is it the way I'm
creating the Model or maybe the way I'm writting the RDF into the model ?


For you information I'm using Eclipse Luna on Ubuntu and
http://mvnrepository.com/artifact/org.apache.jena/apache-jena-libs/2.12.0


Thankfully,


Vincent Emonet.


Reply via email to