SPARQL-DL Syntax
Our variant of the SPARQL-DL language is fully aligned to OWL 2.
Query Types
SPARQL-DL supports two different types of queries: ASK and SELECT. An ASK-query returns a Boolean result whereas a SELECT-query returns all possible bindings of the provided variables.
ASK-queries:
ASK { [comma-separated list of atoms] }
SELECT-queries:
SELECT [DISTINCT] [space-separated list of variables]
[WHERE] { [comma-separated list of atoms] }
[OR WHERE { [comma-separated list of atoms] }]*
As within SPARQL, the DISTINCT keyword removes automatically all redundant bindings within the result set.
Primitives
In SPARQL-DL there are 3 different primitives for usage within query atoms: variables, URIs and literals. They have to follow the following syntax rules:
- Variable: ?[a-zA-Z]+ (for example ?a, ?myVar)
- Full IRI: <http://example.com>
- Prefixed IRI: [the prefix]:[the suffix]
- Literal: "this is a literal" (escape the character " inside a literal with \")
Prefixes
SPARQL-DL supports prefixes simmilar to those defined in SPARQL. Put the PREFIX definitions at the beginning of your SPARQL-DL-query:
PREFIX [some prefix]: <[some URI]>
PREFIX ...
...
OR WHERE
SPARQL-DL supports union-like statements called "OR WHERE". The results of the different where clauses are concatenated to one result.
...
WHERE { ... }
OR WHERE { ... }
OR WHERE { ... }
...
Supported Query Patterns
Class(a)
Property(a)
Individual(a)
Type(a, b)
PropertyValue(a, b, c)
EquivalentClass(a, b)
SubClassOf(a, b)
EquivalentProperty(a, b)
SubPropertyOf(a, b)
InverseOf(a, b)
ObjectProperty(a)
DataProperty(a)
Functional(a)
InverseFunctional(a)
Transitive(a)
Symmetric(a)
Reflexive(a)
Irreflexive(a)
SameAs(a, b)
DisjointWith(a, b)
DifferentFrom(a, b)
ComplementOf(a, b)
Annotation(a, b, c)
StrictSubClassOf(a, b)
DirectSubClassOf(a, b)
DirectType(a, b)
StrictSubPropertyOf(a, b)
DirectSubPropertyOf(a, b)
For the usage of those patterns in queries see the example queries.