Extended CURIE (prefix:localName:key)

In the post Assigning a URI to each node of an RDF graph, I described the mechanism that enables all nodes to get URIs. For example, the age of a person identified by the URI reference http://chucknorris.com/data_/chuck can be described by using a “classic” blank node as follows (using the Turtle syntax):

<http://chucknorris.com/data_/chuck> foaf:age [ rdf:value "30" ]

When the blank node gets a URI by adding the predicate CURIE on the subject URI, the example will look like this:

   foaf:age <http://chucknorris.com/data_/chuck/foaf_age>

   rdf:value "30" .

The blank node got the URI, but the initial elegance of the syntax is lost. If a single-valued property is used, like in this case, the URI of the object doesn’t contain additional (key) segments, so it can be derived automatically (http://chucknorris.com/data_/chuck + “/” + foaf_age). With that in mind, and the fact that the property rdf:value is assumed when it comes to a literal, the previous example can be expressed in a simpler way, using syntatic sugar:

<http://chucknorris.com/data_/chuck> foaf:age "30" .

.. which has exactly the same meaning as the syntax from the beginning of the post:

<http://chucknorris.com/data_/chuck> foaf:age [ rdf:value "30" ]

For multi-valued properties, as is the case with foaf:nick property for instance, the URI can’t be derived automatically. In that case, one can use the “extended” CURIE syntax. For example, if http://chucknorris.com/data_/chuck has two nicknames that are identified by http://chucknorris.com/data_/chuck/foaf_nick/1 and http://chucknorris.com/data_/chuck/foaf_nick/2, the Turtle syntax using extended CURIEs might look like this:

<http://chucknorris.com/data_/chuck> foaf:nick:1 "Chuck" .
<http://chucknorris.com/data_/chuck> foaf:nick:2 "Fatality" .

The key segments 1 and 2 are added on the existing CURIE using (an already used) : delimiter. The same principle is applied if used key segments are not numbers – for example, foaf:nick:byFriend and foaf:nick:byGirlfriend are valid as well. If the nickname is described by other properties besides the rdf:value, the Turtle syntax might look like this:

<http://chucknorris.com/data_/chuck> foaf:nick:byGirlfriend [
   rdf:value "Fatality" .
   foaf:maker <http://chucknorris.com/data_/chucksGirlfriend/1880341> .

This syntax is equivalent to the classic Turtle syntax:

   foaf:nick <http://chucknorris.com/data_/chuck/foaf_nick/byGirlfriend> .

   rdf:value "Fatality";
   foaf:maker <http://chucknorris.com/data_/chucksGirlfriend/1880341> .

A general form of the extended CURIE is the prefix:localName:key, in which one of the first two elements (prefix or localName) is mandatory. The table shows possible variations of the extended CURIE syntax along with their URI equivalents:

(extended CURIE)
URI segment(s)
prefix:localName /prefix_localName
:localName /_localName
prefix: /prefix_
prefix:localName:key /prefix_localName/key
:localName:key /_localName/key
prefix::key /prefix_/key

Based on information in the extended CURIE, an object’s URI of an RDF triple in all versions can be easily derived, and the syntax is free from long URIs and redundancy.

  • http://milicicvuk.com/blog/2011/09/30/getting-rid-of-typed-literals/ Getting rid of typed literals

    [...] rdfs:comment:en is an example of the extended CURIE described in an earlier [...]

  • http://milicicvuk.com/blog/2011/09/24/the-rdf-graph-uri-pattern/ The “RDF graph” URI pattern

    [...] the more concise syntax based on extended CURIEs, it will look as [...]

  • http://milicicvuk.com/blog/2011/12/22/turning-the-web-into-a-programming-language-with-hypernotation/ Turning the Web into a programming language with Hypernotation

    [...] extended CURIE, a syntatic sugar inspired by the flexible chained blank nodes syntax, this can be written much [...]