Picker: Description Logic Query Engine for RDF Triples
1 Abstract
Picker is a command line query tool for RDF data, which returns complex concepts in description logics for an inputed query. You can generate more logical data from RDF data than SPARQL.
2 Download
3 System requirement
- Java 8 or later
4 Usage
$ java -jar picker.jar --data DATA_FILE --query QUERY_FILE
5 Example
$ java -jar picker.jar --data train.ttl --query train.dq
@PREFIX : <http://example.org/> . @PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> . LANG (atom some) SELECT ?x[3] WHERE { :TrainToEast rdfs:subClassOf ?x[3] . ?x[3] rdfs:subClassOf :TrainToEast . }
----------------------------------------------------------------------------------------------------------- | ?x[3] | =========================================================================================================== | (and http://example.org/TrainToEast (some http://example.org/has http://example.org/Long)) | | (and http://example.org/TrainToEast (some http://example.org/has http://example.org/Rectangle)) | | (and http://example.org/TrainToEast (some http://example.org/has http://example.org/Short)) | | (some http://example.org/has (and http://example.org/Closed http://example.org/Short)) | | http://example.org/TrainToEast | | (and http://example.org/TrainToEast (some http://example.org/has http://example.org/Open)) | | (and http://example.org/TrainToEast (some http://example.org/has http://example.org/Closed)) |
6 Query syntax
Concepts in the Description Logic SROIQ
Concept constant
Picker supports the following syntax for concepts in the description logic SROIQ.
- Concept
- C, D ::= TOP | BOT | <URI> | (not C) | (and C D) | (or C D) | (all R C) | (some R C) | (at-most n R C) | (at-least n R C) | (exactly n R C) (filler R i) | (self R) | (one-of i1 i2 … in)
- Role
- R ::= <URI> | (inverse R)
- Individual
- i ::= <URI>
Concept variable
Picker supports the following syntax for roles in the description logic SROIQ.
- ?x[n]
Here, n is the max length of concepts bound for x. The length of concepts is defined as follows:
- |<URI>| = |TOP| = |BOT| = 1
- |(not C)| = |C|
- |(and C D)| = |(or C D)| = |C| + |D|
- |(all R C)| = |(some R C>| = |R| + |C|
- |R| = 1
Picker supports SPARQL-like queries such that
- rdfs:subClassOf is only permitted as predicates in each triple.
- Concept constants and concept variables can be used where the max length for each concept variable must be specified
Query syntax:
Query ::= Prologue SelectQuery Prologue ::= PrefixDecl∗ PrefixDecl ::= 'PREFIX' PNAME_NS '<' URI '> .' SelectQuery ::= 'SELECT' Var+ WhereClause WhereClause ::= 'WHERE' '{' (Triple '.')+ '}' Triple ::= Term ' ' rdfs:subClassOf ' ' Term Term ::= ConceptCon | ConceptVar
The occurence of variables in the query has the following restriction:
- If your query contains a triple with two variables, e.g., ?x[n] rdfs:subClassOf ?y[m], ?x[n] and/or ?y[m] must occur the previous triple.
Example of valid query
SELECT ?x[2] ?y[3] WHERE { ?x[2] rdfs:subClassOf :Man . # (1) ?x[2] rdfs:subClassOf ?y[3] . # <= An concept constant is bound for ?x[2] in (1) }
Example of invalid query
SELECT ?x[2] ?y[3] WHERE { ?x[2] rdfs:subClassOf ?y[3] . # Neither ?x[2] nor ?y[3] is solved. ?x[2] rdfs:subClassOf :Man . }