On 22/03/13 20:47, Pastrana, Rodrigo (RIS-BCT) wrote:
I'm new to Jena RDF API and I'm noticing some unexpected behavior regarding
statement namespaces...
I've noticed that URI resources such as
"http://www.govtrack.us/data/photos/412483.jpeg" in the below excerpt of the
congressional people graph(http://www.govtrack.us/data/rdf/people.rdf.gz)
Are reported to have namespace: " http://www.govtrack.us/data/photos/410069." And local
name "jpeg" using the com.hp.hpl.jena.rdf.model.Resource getLocalName(), and
getNameSpace().
Is this correct behavior? It looks to me like the dot is being used as a
delimiter between the NS and the local name. Is there a way to change that
behavior ? thanks!
<foaf:Person
rdf:about="http://www.rdfabout.com/rdf/usgov/congress/people/R000589">
<foaf:name>E. Rigell</foaf:name>
<usgov:name>E. Rigell</usgov:name>
<vcard:N>
<rdf:Description>
<vcard:Given>E.</vcard:Given>
<vcard:Other>Scott</vcard:Other>
<vcard:Family>Rigell</vcard:Family>
<vcard:Prefix>Rep.</vcard:Prefix>
</rdf:Description>
</vcard:N>
<foaf:gender>male</foaf:gender>
<vcard:BDAY>1960-05-28</vcard:BDAY>
<foaf:img rdf:resource="http://www.govtrack.us/data/photos/412483.jpeg"/>
<usgov:congressBioGuideID>R000589</usgov:congressBioGuideID>
<foaf:title>Rep.</foaf:title>
<foaf:homepage>http://rigell.house.gov/</foaf:homepage>
</foaf:Person>
Thanks, Rodrigo.
Jena is finding the maximal XML qname - the namespace mechanism can't be
sure that it isn't going to be used a property. Both properties (must)
and types (can be) qnames in RDF/XML. RDF does not distinguish
classes/properties/individuals.
http://www.govtrack.us/data/photos/412483.jpeg
An XML qname local part can't start with a digit or a "." so "jpeg" is
the longest local part.
> Is this correct behavior?
Yes
> Is there a way to change that behavior ?
No - the RDF/XML serializer is relying on it.
But what are you using the namespace/localname for ?
If it's display, then you are not bound by the XML restrictions and can
split it yourself. The resource is the URI - it does not carry it's
namespace with it.
In Turtle, the prefix names are not restricted, but then there is not a
requirement to split a URI ever anyway.
Andy