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

Update Algebra.py add DESCRIBE #1096

Closed
wants to merge 1 commit into from

Conversation

luckyagarwal
Copy link

@luckyagarwal luckyagarwal commented May 29, 2020

fixes #813

Describe query fix
@coveralls
Copy link

coveralls commented May 29, 2020

Coverage Status

Coverage decreased (-0.002%) to 75.763% when pulling 8dc7811 on luckyagarwal:luckyagarwal-patch-2 into 037ea51 on RDFLib:master.

Copy link
Contributor

@mwatts15 mwatts15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#831 has been closed. What's this change meant to correct?

@luckyagarwal
Copy link
Author

luckyagarwal commented May 29, 2020

#831 has been closed. What's this change meant to correct?

Sorry about that, 831 was accidentally mentioned for the corresponding pull request. It was 813 that was supposed to get addressed.

@nicholascar
Copy link
Member

Hi @luckyagarwal, thank you so much for addressing the issue of DESCRIBE queries not parsing. I'm really keen to see support for this added to RDFlib.

I see that this is passing all tests but can you please supply a test demonstrating that this PR handles DESCRIBE queries? Without a test, I can't instantly see that this improvement does solve #813. I think it does but general policy is that PRs need to supply tests... thanks!

@bgyori
Copy link

bgyori commented Sep 22, 2020

I bumped into this same issue and checked out this branch to solve it, but then I found that ultimately, DESCRIBE queries are not supported at all so I just got a different error saying so later.

@nicholascar
Copy link
Member

@bgyori are you keen to get DESCRIBE queries handled? They are the simplest of SPARQL queries so this shouldn't be too much of a problem I suppose - it just requires a bit of time for someone to read through algebra.py and actually line all the parts up since the functions of DESCRIBE can be fully implemented with other, existing, queries that already work or fairly simple Graph looping (looking for subject & object matches for the element DESCRIBEed)

@white-gecko
Copy link
Member

As I understand it, it should not just be all statements matching the resource-to-describe in subject and object possition, but the CBD of the resource with is implemented in #968 .

@nicholascar
Copy link
Member

Yes, that’s why I implemented cbd()! I’ve just not found the time to revisit this to finish off the DESCRIBE parsing part!

@white-gecko
Copy link
Member

Futher, I think it should not be implemented in algebra.py but in the evaluate.py.

elif part.name == "DescribeQuery":
raise Exception("DESCRIBE not implemented")

@nicholascar
Copy link
Member

@luckyagarwal are you interested in updating this PR in like with comments from @white-gecko?

@luckyagarwal
Copy link
Author

Hey, I am sorry to say but not now because I am swamped with other works.

@nicholascar
Copy link
Member

@luckyagarwal are you keen to readdress this PR?

@bpelakh
Copy link

bpelakh commented Nov 19, 2021

@nicholascar I was looking at resuming this effort - is work underway for DESCRIBE support in 6.x? I was also wondering why your cbd() implementation reverted in a subsequent checkin.

@ghost ghost added the SPARQL label Feb 12, 2022
@ghost ghost changed the title Update Algebra.py Update Algebra.py add DESCRIBE Jun 6, 2022
aucampia pushed a commit that referenced this pull request Feb 7, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error parsing simple DESCRIBE query
7 participants