Hi,

I’ve just started learning Jena, so I’ve been doing the tutorials I've
found at “An Introduction to RDF and the Jena RDF API”
<http://jena.apache.org/tutorials/rdf_api.html>. Everything was working
fine until I got into Tutorial11. The last part of the code:

// create an empty graph
model = ModelFactory.createDefaultModel();

 // create the resource
Resource r = model.createResource();

// add the property
r.addProperty(RDFS.label, "11")
 .addLiteral(RDFS.label, 11);

// write out the graph
model.write( System.out, "N-TRIPLE");

It’s supposed to produce this output:

_:A... <http://www.w3.org/2000/01/rdf-schema#label> "11" .

But what I get after running it is:

_:B… <http://www.w3.org/2000/01/rdf-schema#label> "11"^^<
http://www.w3.org/2001/XMLSchema#long> .
_:B… <http://www.w3.org/2000/01/rdf-schema#label> "11" .

So they are different literals.

Did I misunderstood anything? Am I doing something different as expected?
I’m using IntelliJ IDEA 2018.2.2 Ultimate edition.

I don’t know if this is the right list to notify it but I think there is
also a typo in that part of the page “An Introduction to RDF and the Jena
RDF API” <http://jena.apache.org/tutorials/rdf_api.html>. The code that
appears there is:

// create the resource
Resource r = model.createResource();

// add the property
r.addProperty(RDFS.label, "11")
 .*addProperty*(RDFS.label, 11);

// write out the Model
model.write(system.out, "N-TRIPLE");

But in the Tutorial11.java the correspondent (working) code is:

 // create the resource
 r = model.createResource();

// add the property
r.addProperty(RDFS.label, "11")
 .*addLiteral*(RDFS.label, 11);

// write out the graph
model.write( System.out, "N-TRIPLE");

Thanks in advance!!
 Panian.

Reply via email to