Question

I' m using jena, and get this exception when writing the model. I don' t know why it doesn' t tell you when you create the property URI.

 com.hp.hpl.jena.shared.InvalidPropertyURIException:     http://name.space/%E7%AB%A3%E5%B7%A5%E6%97%B6%E9%97%B4
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.splitTag(BaseXMLWriter.java:384)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.tag(BaseXMLWriter.java:396)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.startElementTag(BaseXMLWriter.java:355)
at com.hp.hpl.jena.xmloutput.impl.Basic.writePredicate(Basic.java:101)
at com.hp.hpl.jena.xmloutput.impl.Basic.writeRDFStatements(Basic.java:85)
at com.hp.hpl.jena.xmloutput.impl.Basic.writeRDFStatements(Basic.java:74)

Currently I use

DatatypeProperty datatypeProperty = model.createDatatypeProperty(nameSpace+URIref.encode(string));

to create the datatype property, using URIref.encode to encode the string, is it wrong?

Was it helpful?

Solution

The com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.splitTag does not accept this property URI. See also com.hp.hpl.jena.rdf.model.impl.splitNamespace and code examples http://www.programcreek.com/java-api-examples/index.php?api=com.hp.hpl.jena.vocabulary.XSD (search for createDatatypeProperty):

String ns = "http://www.example.org/test#"; DatatypeProperty p = model.createDatatypeProperty( ns + "p" );

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top