Hi Joeli,

This isn't a URN issue.
Turtle does not allow / in the local part of a prefixed name.

nbn:ex/ample

It does allow it with an an escape:

nbn:ex\/ample


----
PREFIX : <http://example/>

:s/a :p 123 .
----
is also bad syntax.


> <http://urn.fi/URN:NBN:fi:au::ex/ample>

That is not a URN - it's an HTTP URI.

    Andy

On 11/05/2022 18:03, Takala, Joeli A wrote:
Hello,


I have a problem with processing prefixed URNs in RDF when their 
namespace-specific string contains a slash.

This is kind of awkward, as the prefixes have been designed with URNs in mind 
(https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName) and since 2017 
the NSS part of URN should allow slashes 
(https://datatracker.ietf.org/doc/html/rfc8141#page-11). I checked the specs 
and implemented URNs with slashes in the NSS part (actually ISO 8601 time 
intervals), and promptly got myself into trouble.

I originally ran in this problem using jena fuseki's s-put, but the effect can 
be reproduced with various tools - I'm using riot below for the sake of brevity:

* We can parse RDF with an URN that has a "/" in the NSS 
(<http://urn.fi/URN:NBN:fi:au::ex/ample>):

That is not a URN - it's an HTTP URI.

echo -e "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix schema: <http://schema.org/> 
.\n@prefix nbn: <http://urn.fi/URN:NBN:fi:au:> .\n\n<http://urn.fi/URN:NBN:fi:au::ex/ample> rdf:type 
schema:Organization ." > ex1.ttl && riot --validate ex1.ttl

* And we can parse RDF with a prefixed URN (nbn:example):
echo -e "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix schema: 
<http://schema.org/> .\n@prefix nbn: <http://urn.fi/URN:NBN:fi:au:> .\n\nnbn:example rdf:type 
schema:Organization ." > ex2.ttl && riot --validate ex2.ttl

* But we cannot parse RDF with a prefixed URN that has a "/" in the NSS 
(nbn:ex/ample):
echo -e "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix schema: 
<http://schema.org/> .\n@prefix nbn: <http://urn.fi/URN:NBN:fi:au:> .\n\nnbn:ex/ample rdf:type 
schema:Organization ." > ex3.ttl && riot --validate ex3.ttl

The last one would give an error "Not a valid token for an RDF term: [SLASH]". 
So far, it hasn't been a big issue as it's easy to drop any prefix declarations for 
something that looks like an URN. I'm using Jena 4.5.0.



Joeli

Reply via email to