Here is a query that we think is returning correct results with Fuseki 2.3.0 but not with Fuseki 2.3.1.
Steps to reproduce:
1. Download and unpack this archive:
2. Copy the contents of the resulting directory, fuseki-incorrect-query-results, into the apache-jena-fuseki-2.3.0 directory created by unpacking the Fuseki 2.3.0 distribution.
3. Start Fuseki with ./fuseki-server, then run the script ./fuseki-load-test-data.sh.
4. Run this query in the Fuseki web app at http://localhost:3030/dataset.html?tab=query&ds=/knora-test :
You should get 85 entries, including many containing true in one or more of the columns isCardinality, isKnoraValueProp, isLinkProp, and isLinkValueProp. The query should execute in about 500 ms.
5. Stop the Fuseki server, and repeat steps 2-4 using the Fuseki 2.3.1 distribution. You should get only 41 entries, none of which contain true in any of the columns isCardinality, isKnoraValueProp, isLinkProp, or isLinkValueProp. The query is also much slower with Fuseki 2.3.1 (4.5 seconds).
What this query is intended to do:
The query gets information about an OWL class, in this example incunabula:page. It returns all predicates and objects of that class, all its cardinalities, and all the cardinalities of its superclasses. The idea here is that we treat an OWL class as inheriting the cardinalities of its superclasses.
The nested OPTIONAL clauses that BIND boolean values are intended to flag cardinalities on certain types of properties that the application needs to handle in different ways.
The MINUS clause allows a subclass to override a cardinality in a superclass. For example:
- knora-base:Representation has a cardinality for knora-base:hasFileValue.
- knora-base:StillImageRepresentation is a subclass of knora-base:Representation and has a cardinality for knora-base:hasStillImageFileValue, which is a subproperty of knora-base:hasFileValue.
- incunabula:page is a subclass of knora-base:StillImageRepresentation.
- Therefore, the cardinalities returned for incunabula:page should include knora-base:hasStillImageFileValue, but not knora-base:hasFileValue.
This is implemented in the MINUS clause as follows: we were given ?s (incunabula:page), and we are looking at one of its superclasses ?class (knora-base:Representation). We find that ?class has some ?cardinalityProp (knora-base:hasFileValue). We then find that there exists ?otherClass (knora-base:StillImageRepresentation), located somewhere between ?s and ?class in the class hierarchy, and that it has a cardinality for ?otherProperty (knora-base:hasStillImageFileValue), which is a subproperty of ?cardinalityProp. Therefore we exclude the cardinality on ?cardinalityProp from the results.