Open constraintAutomaton opened 1 year ago
Thanks for the suggestion!
Let’s say the data looks like this:
<C> a tree:Collection ;
tree:view <> ;
tree:member <A> .
<> a tree:Node ;
tree:relation <R1> .
<R1> a tree:GreaterThanRelation ;
tree:path dcterms:modified ;
tree:node
tree:value "2022-10-20"^^xsd:dateTIme .
<A> dcterms:modified "2022-10-19" .
An a query:
SELECT * WHERE {
?s dcterms:modified ?date .
FILTER (?date < "2022-10-20"^^xsd:dateTime )
}
We’ll need to do 2 things:
Based on the SPARQL query, we should automatically find the path, and check whether the path matches with the path documented in the relation.
tree:path
is based on SHACL property paths: https://www.w3.org/TR/shacl/#property-paths
Probably a big switch case that checks the relation, and executes a comparison function. The functionality might depend on the RDF.DataType. E.G., the implementation of tree:GreaterThanRelation is different for an xsd:dateTime than for a number.
Other links:
Previous implementation in Comunica v1:
Probably we also can use SPARQLEE to reuse things like FILTER functions: (e.G., https://github.com/comunica/sparqlee/blob/860775660d85664e1bec550dad8fb54f8a0a65d8/lib/functions/RegularFunctions.ts)
Issue type:
Description:
The TREE link traversal at the moment is pretty slow. One way to improve the performance would be to exploit the indexation of members provided by the TREE specification. Indeed the
tree:relation
can also define a constraint that the following nodes members must respect. This is done using the propertiestree:path
,tree:value
and by specifying a TREE comparison operators as a type for thetree:relation
.Approach Proposed
I proposed to create a new bus called
bus-optimize-link-traversal
that will provide actors related to query planning/traversal optimization. In the case of this filter, an actor will check if a SPAQL FILTER operator exists, if so it will provide a filter function that will be placed into the context. The TREE traversal will then use the function to reject links that doesn't respect the filter function.