Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add temporal relation filter to TREE link traversal #82

Open
constraintAutomaton opened this issue Oct 17, 2022 · 3 comments
Open

Add temporal relation filter to TREE link traversal #82

constraintAutomaton opened this issue Oct 17, 2022 · 3 comments

Comments

@constraintAutomaton
Copy link
Member

constraintAutomaton commented Oct 17, 2022

Issue type:

  • ➕ Feature request

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 properties tree:path, tree:value and by specifying a TREE comparison operators as a type for the tree: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.

@github-actions
Copy link

Thanks for the suggestion!

@pietercolpaert
Copy link
Member

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:

1. Path matching

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

2. Applying the relation

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.

@pietercolpaert
Copy link
Member

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants