I'm using Jena to read an ontology and it's working really well so far. Unfortunately I haven't been able to figure out how to use compact uris that I've defined in the model. I've defined the prefixes using the model's setNSPrefix(String prefix, String uri)
method. When I try to retrieve statements using the prefix, I get nothing. Also, when I do successfully retrieve a Statement, it contains the full uri instead of the compact one that I defined. It will even do it for the xsd uri http://www.w3.org/2001/XMLSchema#
For example, I'm using the uri http://www.example.com#
, I've defined my prefix mapping as ex
, and my Statement is http://www.example.com#father http://www.example.com#parentOf http://www.example.com#child
where father is the subject, parentOf is the predicate, and child is the object. If I try to retrieve it using ex:father
I get no results, and when I do get the Statement back the full uri is there for the subject, predicate, and object. I've seen it use the prefix instead of the uri when I do model.write(OutputStream)
, but that isn't particularly helpful for me. Am I able to use the prefix as a substitute for the uri like I've been trying to do, or is that not something Jena will provide for me?