I tried one SPARQL query in two different engines:
- Protege 4.3 - SPARQL query tab
- Jena 2.11.0
While the query is the same the results returned by these two tools are different.
I tried a DESCRIBE
query like the following:
DESCRIBE ?x
WHERE { ?x :someproperty "somevalue"}
Results from protege give me tuples that take ?x
as subject/object; while the ones from jena are that take ?x
as subject only.
My questions are:
- Is the syntax of SPARQL uniform?
- If I want
DESCRIBE
to work as in protege, what should I do in Jena?
To answer your first question yes the SPARQL syntax is uniform since you've used the same query in both tools. However what I think you are actually asking is should the results for the two tools be different or not? i.e. are the semantics of SPARQL uniform
In the case of
DESCRIBE
then yes the results are explicitly allowed to be different by the SPARQL specification i.e. no the semantics of SPARQL are not uniform but this is only in the case ofDESCRIBE
.See Section 16.4 DESCRIBE (Informative) of the SPARQL Specification which states the following:
The important part of this is the last couple of sentences that say the description is determined by the query service. This means that both Protege's and Jena's answers are correct since they are allowed to choose how they form the description.
Changing Jena DESCRIBE handling
To answer the second part of your question you can change how Jena processes
DESCRIBE
queries by implementing a custom DescribeHandler and an associated DescribeHandlerFactory. You then need to register your factory like so: