Skip to content

Corrected sparqlquery for removing triples#351

Merged
francescalb merged 3 commits intomasterfrom
flb/correct_remove_triples
Mar 4, 2025
Merged

Corrected sparqlquery for removing triples#351
francescalb merged 3 commits intomasterfrom
flb/correct_remove_triples

Conversation

@francescalb
Copy link
Contributor

Description

Removing triples in the sparqlwrapper was not done correctly.

Type of change

  • Bug fix and code cleanup
  • New feature
  • Documentation update
  • Testing

Checklist for the reviewer

This checklist should be used as a help for the reviewer.

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?
  • Is the code properly tested?

@francescalb francescalb linked an issue Feb 28, 2025 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Feb 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.77%. Comparing base (6ee92b1) to head (88661de).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #351      +/-   ##
==========================================
+ Coverage   77.49%   77.77%   +0.27%     
==========================================
  Files          22       22              
  Lines        2515     2515              
==========================================
+ Hits         1949     1956       +7     
+ Misses        566      559       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@jesper-friis jesper-friis Feb 28, 2025

Choose a reason for hiding this comment

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

Would it make sense to merge this file with sparqlwrapper.py?

If not, we should update the module docstring, since it now tests both graphdb and fuseki.

The graphdb_available() and fuseki_available() help functions can be merged to a single function taking the check URL as argument.

Possible to take these suggestions in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not think it makes sense to merge it with the test_sparqlwrapper.py as that is justy about trying out one sparql query on wikipedia. I renamed that test.

graphdb_available and fuseki_available have been merged to triplestore_available.

docstring updated.

for name, value in zip("spo", triple)
)
query = f"DELETE {{ {spec} }}"
query = f"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Very nice. Yes, this has clearly not been tested before.

We should also add support for general DELETE queries in the query() method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is not in agreement with the current documentation of query() in the base triplestore.py. It says:

        Note:
            This method is intended for SELECT, ASK, CONSTRUCT and
            DESCRIBE queries.  Use the update() method for INSERT and
            DELETE queries.

            Not all backends may support all types of queries.

Can be added as an issue, but I am not in favour of adding issues that we do not know if we want to prioritize. The issue list becomes too long...

Copy link
Contributor

@jesper-friis jesper-friis left a comment

Choose a reason for hiding this comment

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

I am happily approving this. But please take a look at the comments. Do you want to include them here or should we put them in a new issue?

Copy link
Contributor

@jesper-friis jesper-friis left a comment

Choose a reason for hiding this comment

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

Good work. Approved

@francescalb francescalb merged commit 2690d61 into master Mar 4, 2025
19 checks passed
@francescalb francescalb deleted the flb/correct_remove_triples branch March 4, 2025 13:26
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.

ts.remove does not work in sparqlwrapper.

2 participants