On Tue, 2012-06-05 at 12:02 +0200, Pierre-Yves Chibon wrote:
> 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: 

Following the principle of "Keep hitting to wall until you find the
door", I think I found the cause of the problem:

Indeed, when I use:
  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 + "a0000003"),
          "Name3");
  model.write(System.out);
(ie: Added a 'a' at the beginning of the string)

I get the almost correct RDF:
<rdf:RDF
    xmlns:j.0="http://www.cropontology.org/rdf/CO_020:";
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; > 
  <rdf:Description rdf:about="http://test/accession#Id3";>
    <j.0:a0000003>Name3</j.0:a0000003>
  </rdf:Description>
</rdf:RDF>

So the problem seems to rely on the fact that my string "0000003"
contains only number.

Is there a way to fix this or got around it ?


Thanks,
Pierre

Reply via email to