Skip to content
ebotoeva edited this page Mar 6, 2015 · 2 revisions

Table of Contents

This is a short introduction to the Turtle syntax used in the target of mapping axioms, which are part of OBDA Model.

Turtle syntax for target

The target triple template is written like an RDF subject-predicate-object (SPO) graph. The triples must be separated by space followed by period s p o .. We adapt the Turtle syntax to represent the target in mapping assertions.

target        <http://www.example.org/library#BID_{id}> rdf:type :Book .
                                  [S]                     [P]     [O] 
target        <http://www.example.org/library#BID_{id}> :title {title} .
                                  [S]                     [P]    [O] 

The specification is as follows:

Subject node. The subject node can be one of the following terms:

  1. URI reference (e.g., <http://www.example.org/library#BID_FF125>) or
  2. URI template (e.g., <http://www.example.org/library#BID_{id}>)

Predicate node. The predicate node only accept URI reference (e.g., <http://www.example.org/library#title>)

Object node. The object node can be one of the following terms:

  1. URI reference (e.g., <http://www.example.org/library#Book>),
  2. URI template (e.g., <http://www.example.org/Author-{pid}>)
  3. Literal: typed literal or plain literal (e.g., "John"^^xsd:string, "123"^^xsd:int, "Il Trono di Spade"@it (literal with language), "John", 123)
  4. Literal template (e.g., {id}^^xsd:integer, {id})

Mapping restrictions

Note that currently -ontop- does not allow mappings that generate TBox axioms. For that reason, RDFS or OWL vocabulary is not allowed in mappings, with the exception of rdf:type. For example, the following mapping is invalid:

?x rdfs:subClassOf ?y
SELECT x, y FROM subclass 
Since v1.9, Ontop allows to obtain the class names from the database. For example, the following is valid. See MetaMapping for more details
?x rdf:type ?y
SELECT x, y FROM table

Compact form

Turtle syntax allows writing down an RDF graph in a compact textual form. A set of triples sharing the same subject can be written as a predicate list, where the pairs predicate-object are separated using semicolon :, while a set of triples sharing the same subject and predicate can be written as an object list, where objects are separated using comma ,.

Predicate list

These two examples are equivalent ways of writing the triple template about Author. Notice that the predicate rdf:type can be written shortly as predicate a.

:Author-{ID} a :Author .
:Author-{ID} :firstName {FNAME} .
:Author-{ID} :lastName {LNAME} .
:Author-{ID} :writes :Book-{ID} .
:Author-{ID} a :Author; :firstName {FNAME}; :lastName {LNAME}; :writes :Book-{ID} .

Object list

These two examples are equivalent ways of writing the triple template about 'A Game of Thrones' book.

:A_Game_of_Thrones :title "A Game of Thrones"@en-US .
:A_Game_of_Thrones :title "Il Trono di Spade"@it .
:A_Game_of_Thrones :title "A Game of Thrones"@en-US, "Il Trono di Spade"@it .
Clone this wiki locally