-
Notifications
You must be signed in to change notification settings - Fork 19
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
Reintroduce Property paths forms {x,y} syntax dropped in draft of sparql 1.1 https://www.w3.org/TR/2012/WD-sparql11-query-20120724 #101
Comments
Interestingly we actually implemented something like this in one of our query engines. We never bothered to do proper property path support rather we just optionally emulated queries using property paths with their expanded versions similar to the above applying a max limit on path length for unbounded operators (e.g. The main problem from an implementors perspective is the potential complexity introduced by this. Yes expanding the query may seem like it makes the implementation simpler the reality is that you end up with very large There is also a potential scoping problem introduced when the property path occurs as part of a larger graph pattern. Injecting the appropriate path expansion as a child graph pattern effectively breaks up the pattern potentially introducing scoping issues with other elements in the same graph pattern. |
The first decision is counting vs non-counting. Originally, they were counting. If put in, my preference is for the non-counting (distinct) form and add an operator into the path evaluation to handle them. There are also the forms There are other equivances (original counting form):
The UNION expansion, if done purely as syntax, introduces changes of BGPs which matter for blank node label rules. |
fwiw, Support for this syntax was never removed from Virtuoso. |
We at Stardog do not support the |
Responding to @JervenBolleman's email to the list:
My recollection is that under time pressure we couldn't reach consensus on whether the semantics should be counting (which works nicely as a shorthand for repeated SequencePaths and equivalent to an expanded BGP) or non-counting (which avoids performance problems with large values of |
+1 on recalling that we couldn't reach consensus on the precise semantics. In RDF4J (or Sesame, at the time), this was first implemented, and then removed for the 2.7.4 release. See https://openrdf.atlassian.net/browse/SES-1706. I believe we only removed the code from the actual parser, but the logic in the algebra would still support it - so if we re-added this construct to the parser it would support it again. The implementation had its bugs but for most "regular" cases it worked well enough. From the top of my head our implementation was a counting (non-distinct) one. I also remember writing a blog post about our implementation of it. That blog is no longer online but I'll see if I can dig it up from my local archive somewhere. |
This is a bit late reply, but I'd like to propose a function of counting how many times a predicate is passed from a subject to an object. It may be expressed as follows:
The reason why is that we often want to know the distance between a pair of nodes, for example, two concepts in an ontology where they are connected by I think this can be an extension to the forms of this proposal |
How about the paper Counting Beyond a Yottabyte, or how SPARQL 1.1 Property Paths will Prevent Adoption of the Standard?
Are these conclusions not relevant anymore? Has something changed since 2012? |
It is relevant for the counting semantics. But not for the path existence semantics, i.e. the same that's used for property paths in the current version of the spec. If the latter is adopted, then |
As for the use case of counting paths, there is it when we want to sort the order of results based on the subClassOf hierarchy depth while it is assumed that the graph structure is tree. |
So far, I've figured that if you want counting semantics, you can't use property paths, which is OK 'cause you can easily expand them into triple patterns with fresh variables. Property paths with {m,n} would make such a translation hard enough that humans would have to screw around for a long time with subqueries and would probably get it right 1% of the time. This is not to argue against {m,n} but instead introduce it with some keyword like |
I've implemented this in Ruby SPARQL, essentially along the re-write direction suggested by @afs in #101 (comment). The one case that isn't handled natively is For those implemented, I created some tests, which can be found here. |
Why?
We see in our work quite a demand for finding nodes within x steps of another node in a path.
Previous work
This was sugessted in sparql1.1 working group but was removed in the W3C Working Draft 24 July 2012 in response to the paper Counting beyond a yottabyte, or how SPARQL 1.1. property paths will prevent adoption of the Standard
Proposed solution
Reintroduce the syntax, and solve the solve-ability issues in queries with path queries.
Problem is that to make path queries tractable they where changed to connectivity queries instead of the earlier counting ones. I believe that if the property path syntax is merely a syntactic convenience the SPARQL 1.1. complexity is not increased.
would be equivalent to
Of course it could be a non counting solution either
Considerations for backward compatibility
None, for standard SPARQL 1.1. However different implementations have not removed their implementation of the draft from their engines. Introducing a standard might lead to subtle bugs to users of the old format.
The text was updated successfully, but these errors were encountered: