-
Notifications
You must be signed in to change notification settings - Fork 0
TurtleSyntax
This is a short introduction to the Turtle syntax used in the target of mapping axioms, which are part of OBDA Model.
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:
- URI reference (e.g.,
<http://www.example.org/library#BID_FF125>
) or -
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:
- URI reference (e.g.,
<http://www.example.org/library#Book>
), -
URI template (e.g.,
<http://www.example.org/Author-{pid}>
) - Literal: typed literal or plain literal (e.g.,
"John"^^xsd:string
,"123"^^xsd:int
,"Il Trono di Spade"@it
(literal with language),"John"
,123
) -
Literal template (e.g.,
{id}^^xsd:integer
,{id}
)
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
Predicate in the mappings are treated as data properties or object properties based on the definition given in the ontology and the term used in the `Object node`. If the term in the `Object node` is a literal we return a data property, if it is a uri an object property. Note Since v1.17, -ontop- support the use of annotation properties in mappings. An annotation property is treated as data property or object property based on the terms used in the Object node.
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 ,
.
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} .
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 .
- Quick Start Guide
- Easy-Tutorials
- More Tutorials
- Examples
- FAQ
- Using Ontop
- Learning more
- Troubleshooting
- Developer Guides
- Links