-
Notifications
You must be signed in to change notification settings - Fork 565
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
DESCRIBE query not working #479
Comments
As the exception says Without checking, but I think the first query should be |
describe needs CBDs, so should be based on the solution to #123 |
Hello, I am using rdflib version 6.0.2, and for describe queries, I get the following error: Is this issue fixed or describe the queries are still not implemented in rdflib? Best regards, |
Hey! |
See also:
|
Hey , I would also like to work on this issue. |
One of the possible for this could be use of the multiple Select queries to find the solution for the Describe Query. Now here we can use first Select Query to find the exact values of ?x. PREFIX foaf: http://xmlns.com/foaf/0.1/ Lets suppose we get ?x as "www.example.org/Alice" now can breakdown this? x into the prefix and corresponding value let's say : prefix: Alice in this case Now run the query This will return all the results related to the Alice and then this result can be formatted to produce the result . |
That approach could work but an implementation that aims to conform to SPARQL 1.1 spec would also have to observe SolutionModifier constraints:
|
This adds an implementation for SPARQL DESCRIBE queries, using the built-in `cbd` method. I see there are several issues and PRs for DESCRIBE implementation. I believe this should close #479 and should resolve #1913, or at least pick up where it left off. It should also resolve #1096. This implementation should support the full SPARQL specification for DESCRIBE; either explicit IRIs can be provided (with no WHERE clause), or variables projected from a WHERE clause can be provided, or variables projected from a WHERE clause AND explicit IRIs can be provided. If a WHERE clause is provided, it should be evaluated the same way as it would for a SELECT DISTINCT query (including dataset specifications). The expected results for the test cases provided match the behaviour seen when running the same queries against the same data using ARQ. A possible future extension would be to add a global option (similar to `rdflib.plugins.sparql.SPARQL_LOAD_GRAPHS`) to change the method used to describe resources instead of always using CBD.
Apparently DESCRIBE queries are not fully implemented yet? This is what I get with two different queries:
...
/usr/lib/python2.7/site-packages/rdflib/plugins/sparql/algebra.pyc in translate(q)
530
531 # all query types have a where part
--> 532 M = translateGroupGraphPattern(q.where)
533
534 aggregate = False
/usr/lib/python2.7/site-packages/rdflib/plugins/sparql/algebra.pyc in translateGroupGraphPattern(graphPattern)
261 """
262
--> 263 if graphPattern.name == 'SubSelect':
264 return ToMultiSet(translate(graphPattern)[0])
265
AttributeError: 'NoneType' object has no attribute 'name'
...
/usr/lib/python2.7/site-packages/rdflib/plugins/sparql/evaluate.pyc in evalPart(ctx, part)
260
261 elif part.name == 'DescribeQuery':
--> 262 raise Exception('DESCRIBE not implemented')
263
264 else:
Exception: DESCRIBE not implemented
The graph is created via this sequence:
import rdflib
from rdflib import RDF
ex = rdflib.Namespace('http://www.example.org/')
g = rdflib.Graph()
g.add((ex['a'], RDF['type'], ex['Cl']))
The text was updated successfully, but these errors were encountered: