Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turtle difference between @base and empty prefix

Tags:

rdf

turtle-rdf

In RDF-Turtle, what is the difference between using a @base prefix and empty prefix (with just :)?

like image 826
Daniel Avatar asked Dec 08 '15 01:12

Daniel


People also ask

What's the difference between @base and @prefix?

@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.

What is Turtle notation?

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.


1 Answers

@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.

like image 122
Jeen Broekstra Avatar answered Oct 02 '22 12:10

Jeen Broekstra