-
Notifications
You must be signed in to change notification settings - Fork 0
ObdaQueryFileFormat
Starting from version 1.7 (build 1599), -ontop- introduces a new format of query text file with the extension .q.
This section is used to group a set of query items. The header keyword: [QueryGroup=<group name>]
For example:
[QueryGroup="Basic Query"] @collection [[ [QueryItem="Get all books"] PREFIX : select distinct ?book ?title where {?book a :Book; :title ?title } [QueryItem="Get all authors"] PREFIX : select distinct ?author ?fname ?lname where {?author a :Author; :firstName ?fname; :lastName ?lname . } ]] [QueryGroup="Another Queries"] @collection [[ [QueryItem="Get all borrowers which are students"] PREFIX : select distinct ?borrower ?book where { ?borrower :hasBorrowed ?book; :type ?type filter ( ?type = 'STUD' ) . } ]]
Notice that the @collection ... tag is used to indicate the collection of query items. Also it is possible to create multiple query groups in the same file as shown by the example above.
This section is used to write the SPARQL query. The header keyword: [QueryItem=<query name>]
For example:
[QueryItem="Get all books"] PREFIX : select distinct ?book ?title where {?book a :Book; :title ?title } [QueryItem="Get all authors"] PREFIX : select distinct ?author ?fname ?lname where { ?author a :Author; :firstName ?fname; :lastName ?lname . } [QueryGroup="Another Queries"] @collection [[ [QueryItem="Get all borrowers which are students"] PREFIX : select distinct ?borrower ?book where { ?borrower :hasBorrowed ?book; :type ?type filter ( ?type = 'STUD' ) . } ]]
Notice that after the [QueryItem=<...>] header keyword, users are free to write the query and the system will read the input using exactly the same words, including empty spaces and newlines (in verbatim). The example above shows two individual queries and one query group with one member.
Go to OBDA and Q File Formats to learn more about file formats employed by -ontop-.
- Quick Start Guide
- Easy-Tutorials
- More Tutorials
- Examples
- FAQ
- Using Ontop
- Learning more
- Troubleshooting
- Developer Guides
- Links