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 SPARQL DESCRIBE query implementation #2221

Merged

Conversation

mgberg
Copy link
Contributor

@mgberg mgberg commented Feb 2, 2023

Summary of changes

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 behavior 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.

Checklist

  • Checked that there aren't other open pull requests for
    the same change.
  • Added tests for any changes that have a runtime impact.
  • Checked that all tests and type checking passes.
  • For changes that have a potential impact on users of this project:
    • Updated relevant documentation to avoid inaccuracies.
    • Considered adding additional documentation.
    • Considered adding an example in ./examples for new features.
    • Considered updating our changelog (CHANGELOG.md).
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

@mgberg mgberg force-pushed the sparql-describe-implementation branch from 93bae2a to 6566af3 Compare February 3, 2023 14:41
@coveralls
Copy link

coveralls commented Feb 3, 2023

Coverage Status

Coverage: 90.682% (+0.02%) from 90.662% when pulling 63755b8 on corning-incorporated:sparql-describe-implementation into 9625ed0 on RDFLib:main.

@mgberg mgberg force-pushed the sparql-describe-implementation branch from 6566af3 to 63755b8 Compare February 3, 2023 15:02
@aucampia
Copy link
Member

aucampia commented Feb 6, 2023

Copy link
Member

@aucampia aucampia left a comment

Choose a reason for hiding this comment

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

@mgberg thanks for the PR, it looks great as always, I just have a question regarding the change in rdflib/plugins/sparql/parser.py which I'm not entirely clear on.

The change should also be pretty safe as nothing should impact non-describe queries.

@aucampia aucampia requested a review from a team February 6, 2023 20:57
@aucampia
Copy link
Member

aucampia commented Feb 6, 2023

pre-commit.ci run

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

lgtm

@aucampia aucampia merged commit 2325b4a into RDFLib:main Feb 7, 2023
aucampia added a commit to aucampia/rdflib that referenced this pull request Mar 24, 2023
SPARQL DESCRIBE was implemented in
<RDFLib#2221> so there should be no xfail
on it tests for it. This change removes one such xfail that was in place.
aucampia added a commit that referenced this pull request Mar 25, 2023
SPARQL DESCRIBE was implemented in
<#2221> so there should be no `xfail`
on it tests for it. This change removes one such `xfail` that was in place.
@mgberg mgberg deleted the sparql-describe-implementation branch March 27, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DESCRIBE query not working
3 participants