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

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 in mappings

The target triple template is written like an RDF subject-predicate-object (SPO) graph. 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. Column variable: typed or untyped (e.g., {id}^^xsd:integer, {id})

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. URI template (e.g., <http://www.example.org/Author-{pid}>)

Vocabulary Restrictions and TBoxes through mappings. 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 
Type from the database.. 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.

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 .

Table of Contents

Clone this wiki locally