order of operations in SPARQL eval and execution #3567
-
Hey folks, I'm trying to use SAIL (3.7.4) against Janusgraph (lpg) and seeing an oddity wrt an order of operations. Perhaps I'm just misunderstanding... If I write:
I notice that the second statement is executed first inside the code (effectively: ?c rdfs:subClassOf ?i). I'm using the StrictEvaluationStrategy if that matters. If I rewrite the SPARQL as:
I can control the ordering. The reason this matters is b/c I'm storing predicates as edges in JG and running a query like ?s rdfs:subClassOf ?i translates to a full scan of the edges in JG and thus very slow. Anything I can do? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The order in which the elements of a graph pattern are evaluated is determined by the query planner, which uses statistics and cost estimates provided by the underlying store implementation. Try running a query explanation, this will tell you what numbers the planner uses for your particular query, and may give you a clue as to why it chooses the execution order it does. I'm not very familiar with JanusGraph and don't know how you've been able to use RDF4J on top of it but at a guess I'd say that it lacks a store-specific extension of the |
Beta Was this translation helpful? Give feedback.
The order in which the elements of a graph pattern are evaluated is determined by the query planner, which uses statistics and cost estimates provided by the underlying store implementation.
Try running a query explanation, this will tell you what numbers the planner uses for your particular query, and may give you a clue as to why it chooses the execution order it does.
I'm not very familiar with JanusGraph and don't know how you've been able to use RDF4J on top of it but at a guess I'd say that it lacks a store-specific extension of the
EvaluationStatistics
class which calculates these kinds of statistics. By default, a single pattern like that?s subclassOf ?i
will be considered cheape…