In RDF-Turtle, what is the difference between using a @base
prefix and empty prefix (with just :
)?
@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.
In computing, Terse RDF Triple Language (Turtle) is a syntax and file format for expressing data in the Resource Description Framework (RDF) data model. Turtle syntax is similar to that of SPARQL, an RDF query language. It is a common data format for storing RDF data, along with N-Triples, JSON-LD and RDF/XML.
@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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With