W3C home > Mailing lists > Public > public-rdfa-wg@w3.org > February 2011

Problem(s) .. Prefix, colon, CURIE and term

From: Nathan <nathan@webr3.org>
Date: Sat, 05 Feb 2011 16:59:42 +0000
Message-ID: <4D4D81FE.6010600@webr3.org>
To: RDFA Working Group <public-rdfa-wg@w3.org>
Hi Guys,

I was double checking Turtle and N3

In Turtle [editors draft], the map is Map[PNAME_NS -> IRI], PNAME_NS 
includes the ":". In the TeamSubmission of Turtle the same is true, for 
example the following is valid:

   :bar : foo:bar .

Likewise in N3, the prefix includes the ":".

Do forgive me not even going in to RDF/XML and the namespace territory!

I'm asking because I was going to suggest that we could develop a simple 
media type just for profiles that was turtle/n3 compatible, like the 
following:

   @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
   @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
   @term name <http://xmlns.com/foaf/0.1/name> .

But then realize that this would be a map of:

   "rdf:" -> <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   "rdfs:" -> <http://www.w3.org/2000/01/rdf-schema#>
   "name" -> <http://xmlns.com/foaf/0.1/name>

and RDFa would require a map of (or so it seems):

   "rdf" -> <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   "rdfs" -> <http://www.w3.org/2000/01/rdf-schema#>
   "name" -> <http://xmlns.com/foaf/0.1/name>

Which also leads me to say that I'm now confused by the definition of 
CURIE in rdfa-core, because "prefix" is an NCName ( an XML Name minus 
the ":" ), but the default prefix is ":", which means the default prefix 
is an invalid prefix (it's not a valid NCName).

And further, the definition of @prefix in rdfa core is:

   a white space separated list of prefix-name URI pairs of the form
   NCName ':' ' '+ xs:anyURI

So, "A CURIE is comprised of two components, a prefix and a reference. 
The prefix is separated from the reference by a colon (:)"

   "" (an empty string) is not a valid prefix (NCName)
   ":" (a single colon) is not a valid prefix (NCName)

Which I read as saying that the following:

   <div prefix=": http://example.org">

is invalid (since there's no valid NCName), and that:

   <div prefix="foaf: http://xmlns.com/foaf/0.1/">

Would produce a "prefix-name URI pair" of:

   "foaf:" -> <http://xmlns.com/foaf/0.1/>

But that too would be an invalid prefix according to CURIE syntax, since 
it's got a trailing colon. So a mapping of the following would need to 
be created:

   "foaf" -> <http://xmlns.com/foaf/0.1/>

Which in the context of the RDF API gives me a problem because that's an 
invalid Turtle/n3 Map[PNAME_NS -> IRI].

Now, just to make things even more "interesting", all of the following 
are valid CURIEs

  ""
  ":"
  "#"
  ":#"
  "me"
  ":me"
  "#me"

So, we've got all kinds of problems because a prefix doesn't include a 
colon, not only interop with Turtle/N3, impossibility to create a turtle 
like profile type, problems in the RDF API, but also if I quote the 
following (snipped) example (and common usage) from the spec:

   <div vocab="http://xmlns.com/foaf/0.1/" about="#me">
     My name is <span property="name">John Doe</span> and ..
   </div>

the following triples will be generated:

   @prefix foaf: <http://xmlns.com/foaf/0.1/> .
    <#me> foaf:name "John Doe" .

which is wrong, it'll produce:

   @prefix foaf <http://xmlns.com/foaf/0.1/> .
   ..

well it should but that's invalid (no colon in the prefix), so I'll 
patch and ignore that to create:

   @prefix foaf: <http://xmlns.com/foaf/0.1/> .
   foaf:#me foaf:name "John Doe" .

spot the error?

"It's also possible to omit both the prefix and the colon, and so create 
a CURIE that contains just a reference which makes use of the 'no 
prefix' mapping. This specification does not define a default 'no 
prefix' mapping. However, Host Languages may define a default. This 
mapping may be changed via @vocab."

so the 'no mapping' prefix was changed with @vocab to be the foaf URI, 
and "#me" is a valid reference (irealtive-ref as defined in RFC3987) 
thus a valid CURIE; and yes I followed the processing rules:

about
a SafeCURIEorCURIEorURI, used for stating what the data is about (a 
'subject' in RDF terminology);

SafeCURIEorCURIEorURI
When the value is surrounded by square brackets, then the content within 
the brackets is evaluated as a CURIE according to the CURIE Syntax 
definition. If it is not a valid CURIE, the value must be ignored.
Otherwise, the value is evaluated as a CURIE. If it is a valid CURIE, 
the resulting URI is used; otherwise, the value is processed as a URI.


Apologies guys, but we've got some issues here..

Best,

Nathan
Received on Saturday, 5 February 2011 17:02:02 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:19:50 UTC