Hi all,

I am running in a small problem URI wise using jena 2.6.4.

When I run the following code:
  String PPCO_URI = "http://www.cropontology.org/rdf/CO_020";;
  String ACCESSION_URI = "http://test/accession/";;
  Model model = ModelFactory.createDefaultModel();
  Resource acces = model.createResource(ACCESSION_URI + "Id3");
  acces.addProperty(model.createProperty(PPCO_URI + "0000003"),
      "Name3");
  model.write(System.out);

I end up with the RDF:
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
    xmlns:j.0="http://www.cropontology.org/rdf/"; > 
  <rdf:Description rdf:about="http://localhost:8080/rdf/accession/3";>
    <j.0:CO_0200000003>3</j.0:CO_0200000003>
  </rdf:Description>
</rdf:RDF>

That's incorrect since the correct URI for the crop-ontology is not:
http://www.cropontology.org/rdf/CO_0200000003 but
http://www.cropontology.org/rdf/CO_020:0000003

So I tried to fix the code using:
  String PPCO_URI = "http://www.cropontology.org/rdf/CO_020:";;
  String ACCESSION_URI = "http://test/accession/";;
  Model model = ModelFactory.createDefaultModel();
  Resource acces = model.createResource(ACCESSION_URI + "Id3");
  acces.addProperty(model.createProperty(PPCO_URI + "0000003"),
      "Name3");
  model.write(System.out);

But it gives me the following backtrace:
SEVERE: com.hp.hpl.jena.shared.InvalidPropertyURIException:
http://www.cropontology.org/rdf/CO_020:0000011 
at ...hpl.jena.xmloutput.impl.BaseXMLWriter.splitTag(BaseXMLWriter.java:393)
at ...hpl.jena.xmloutput.impl.BaseXMLWriter.tag(BaseXMLWriter.java:405)
at 
...hpl.jena.xmloutput.impl.BaseXMLWriter.startElementTag(BaseXMLWriter.java:364)
at com.hp.hpl.jena.xmloutput.impl.Basic.writePredicate(Basic.java:93)
at ...hpl.jena.xmloutput.impl.Basic.writeRDFStatements(Basic.java:77)
at ...hpl.jena.xmloutput.impl.Basic.writeRDFStatements(Basic.java:66)
at com.hp.hpl.jena.xmloutput.impl.Basic.writeBody(Basic.java:40)
at ...hpl.jena.xmloutput.impl.BaseXMLWriter.writeXMLBody(BaseXMLWriter.java:500)
at ...hpl.jena.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:472)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.write(ModelCom.java:253)
at nl.wur.plantbreeding.rdf.RdfOutput.service(RdfOutput.java:150)
(I remove the com.hp where the lines were too long for easier reading).

Has anyone an idea ?
Google seems to say that the problem comes from the URI, but even if I
replace the ':' by a '#', which I used elsewhere fine, it doesn't work.

Regards,
Pierre

Reply via email to