Sorry if these are trivial questions. I’m trying to add a statement to a model and I seem to be having issues with the Boolean datatype.
The following works fine String objectval = “myname”; String objecttype = “http://www.w3.org/2001/XMLSchema#string”; com.hp.hpl.jena.rdf.model.Resource subject = model.createResource(“ http://me.org#myresource”);com.hp.hpl.jena.rdf.model.Property property = model.createProperty(“http://me.org#myproperty”); com.hp.hpl.jena.rdf.model.Literal object = model.createTypedLiteral(objectval,objecttype); Model.add(subject, property, object); Writing the model to a file shows the correct triple <http://me.org#myresource> <http://me.org#myproperty> "myname"^^< http://www.w3.org/2001/XMLSchema#string> ; This also works for String objectval = “1234”; String objecttype = “http://www.w3.org/2001/XMLSchema#int”; giving the triple <http://me.org#myresource> <http://me.org#myproperty> “1234"^^< http://www.w3.org/2001/XMLSchema#int> ; But if I use the following String objectval = “false”; String objecttype = “http://www.w3.org/2001/XMLSchema#boolean”; The triple written to the file is <http://me.org#myresource> <http://me.org#myproperty> false ; For boolean I don’t see the data type written out i.e. I was expecting <http://me.org#myresource> <http://me.org#myproperty> “false”^^< http://www.w3.org/2001/XMLSchema#boolean> ; Am I missing something? One further question on this (sorry) In the above examples can String objecttype = “http://www.w3.org/2001/XMLSchema#string”; Be Shortened to String objecttype = “xsd:string”; Thanks Phil
