Kevin said: > First of all - I am new to Jena, so apologies in advance if I'm missing > anything obvious. > > My problem - I think Resource.getNameSpace() is returning an incorrect > value in certain cases. I'm using SUMO as my test case against Jena 2.6.4. > > Summary: Resource.getNameSpace() returns an incorrect value (I think) when > called on the object of a statement which is referenced as <namespace > prefix>#<name>. The key bit is the <namespace prefix> - this seems to be > resolved to an incorrect namespace URL. > > I've attached a very short program which demonstrates what I'm talking > about. Note that there's nothing special about the class/statement used in > the example - just instances that are known to demonstrate my issue. Any > help is greatly appreciated.
As Damian said, the attachment didn't make it through -- but there are a couple of things to watch out for. getNameSpace works *just* on the URI of the resource in a context- independant way. It does not know how the URI was constructed, so prefixes, base URIs, and all that are irrelevant to its operation. The splitting rule that Jena used is based on the requirements of the RDF/XML serialisation: it cuts the URI into two parts, NS and L, such that NS + L = the URI and L is the longest legal NCName that will fit. This means, for example, that a URI like http://example.com/numberic/1066 will not split the way many people expect, since the NS = the whole URI and the local name = "", because NCNames can't start with digits. Tell us how/why you're using getNameSpace and we may be able to help further. Chris -- "It is seldom good news." ~Crystal Ball~, /The Tough Guide to Fantasyland/ Epimorphics Ltd, http://www.epimorphics.com Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT Epimorphics Ltd. is a limited company registered in England (number 7016688)
