Hi Benson,

On 10/12/10 18:18, Benson Margulies wrote:
To be clearer, the resulting OWL RDF has
rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
  attributes, and then tdbdump shows ^^ suffixes.

On Fri, Dec 10, 2010 at 12:20 PM, Benson Margulies
<[email protected]>  wrote:
Andy,

I'm having trouble getting rid of all my ^^ noise.

I run Jena schemagen against an Ontology that has no type annotations,
I don't see any in the output of schemagen, but calls to

  entityRef = model.createIndividual(entityUri, oclass);
            entityRef.addLiteral(Rex.hasEntityDetectionSource, source);
            entityRef.addLiteral(Rex.hasNormalizedText, normalizedText);
            entityRef.addLiteral(Rex.hasOriginalText, rawText);

end up adding the ^^ and the string data type.
If you look at the Javadoc for Resource.addLiteral, there's no overloaded type signature for addLiteral( Property, String ). Which means that you're actually invoking this method:

http://openjena.org/javadoc/com/hp/hpl/jena/rdf/model/Resource.html#addLiteral(com.hp.hpl.jena.rdf.model.Property,%20java.lang.Object)

which says:

"""
Add the property p with the typed-literal value o to this resource, ie add (this, p, typed(o)) to this's model. Answer this resource. The typed literal is equal to one constructed by using this.getModel().createTypedLiteral(o).
"""

You want either:

entityRef.addProperty(Rex.hasEntityDetectionSource, source);

or

entityRef.addLiteral(Rex.hasEntityDetectionSource, model.createPlainLiteral( source ));

Ian

Reply via email to