Reputation: 157
In RDF-Turtle, what is the difference between using a @base
prefix and empty prefix (with just :
)?
Upvotes: 12
Views: 2770
Reputation: 22052
@base
is not a prefix declaration, but a... well, a base declaration. It declares a document's base location, against which all relative IRIs are resolved. @prefix :
is a prefix declaration (in this case for the default or empty prefix), against which all prefixed names with an empty prefix are resolved.
Even though they are both ways to write down an IRI, a relative IRI is not the same thing as a prefixed name. They follow different syntactical rules.
For example:
@base <http://example.org/base/>
@prefix : <http://example.org/prefix/>
<name> rdf:type rdf:Property .
:phone rdf:type rdf:Property .
In this example name
is a relative IRI. The base declaration will be used to resolve it to the absolute IRI http://example.org/base/name
.
:phone
is not a relative IRI, but a prefixed name (with an empty prefix). The (empty) prefix declaration will be used to resolve it to the absolute IRI http://example.org/prefix/phone
.
Easy way to tell the difference between an IRI and a prefixed name in Turtle: the former has <>
brackets around it.
Upvotes: 13