On 06/02/12 21:55, Andy Seaborne wrote:
On 06/02/12 18:05, Dick Murray wrote:
On 06/02/12 17:31, Dave Reynolds wrote:
Hi Dick,
On 06/02/12 16:49, Dick Murray wrote:
Why's the checkLocalName() called in some constructors but not
others..?
I can't authoritatively answer that, it does seem inconsistent and may
be just historic anomaly.
Though the fundamental lesson here is to stick to Property URIs which
are legal within the normative RDF syntax (RDF/XML) otherwise
something will bite you eventually :)
Also the Util.splitNamespace starts at the end goes back to the last /
(i.e. before the 99) then winds forwards to the end and returns 31.
Hence the localName is "".
Correct.
The notion of localName here is precisely that of XML QNames, i.e. it
must be a trailing NCName (which can't start with a digit), which
means that your URIs have an empty local name, which is why they can't
be used for properties in RDF/XML syntax, which is why they are best
avoided.
Dave
Hi Dave.
Thanks for the reply and after I bit of digging I found the following;
Practical restrictions of an NCName
The practical restrictions of NCName are that it cannot contain several
symbol characters like |:|, |@|, |$|, |%|, |&|, |/|, |+|, |,|, |;|,
whitespace characters or different parenthesis. Furthermore an NCName
cannot begin with a number, dot or minus character although they can
appear later in an NCName.
And even a RegEx to check for NCName validity;
|[\i-[:]][\c-[:]]*|
Specifically for me it's the "cannot begin with a number" as I was
aiming to create predicates based on a column index.
Though the fundamental lesson here is to stick to Property URIs
which are legal within the normative RDF syntax (RDF/XML) otherwise
something will bite you eventually :)
It's definitely the RDF/XML which isn't happy! If you create a statement
with the #99 property from the model it can output in Turtle but throws
an exception for RDF/XML.
Thanks again.
It can get more confusing ... :-)
http://example/property/12a813
can be used in RDF/XML as a property with a namespace of
"http://example/property/123" leaving "a813" as the local part. Jena
will choose a namespace if it can - it split the final segment of the
URI to do that.
Andy
Hi Andy and thanks for the added confusion! :-)
So Jena will actively generate namespaces (xmlns:j.x) where it can? It
works backwards through the property until it hits a non valid NCName
char and that's the namespace/localname split. The writer must keep
track of the j.n entries for RDF/XML...
i.e. your example gives;
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:j.0="http://example/property/12" >
<rdf:Description rdf:about="http://id.example.org/fred">
<j.0:a813>bob</j.0:a813>
</rdf:Description>
</rdf:RDF>
and adding;
"http://example/property/12b813"
"http://example/d/property/12b813"
gives;
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:j.0="http://example/d/property/12"
xmlns:j.1="http://example/property/12" >
<rdf:Description rdf:about="http://id.example.org/fred">
<j.0:b813>bob</j.0:b813>
<j.1:b813>bob</j.1:b813>
<j.1:a813>bob</j.1:a813>
</rdf:Description>
</rdf:RDF>
As an aside is this to reduce the RDF/XML file sizes or a XML
"normalisation" standard?