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

Enhanced the use of namespaces #195

Merged
merged 24 commits into from
Mar 16, 2024
Merged

Conversation

jesper-friis
Copy link
Contributor

@jesper-friis jesper-friis commented Mar 10, 2024

Description

Simplified and improved the usability of namespaces

  • Added persistent cache to Namespace. Loading a large namespace like EMMO from cache is now almost instant.
  • Added extend_namespace() utility function.
  • Simplified the implementation of Namespace, including:
    • replaced cachemode argument with the simple boolean argument reload
    • removed triplestore_url argument
    • added format argument for supporting loading ontologies in formats other than turtle
  • Updated the Triplestore.bind() method to make it simpler to use.
  • Updated the tutorial and improved the description of how namespaces can be used.
  • Added and improved tests. Added example for simplified SPARQL queries using tripper Namespace.

Closes #194

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?

Added extend_namespace() utility function and more tests.
@jesper-friis jesper-friis linked an issue Mar 10, 2024 that may be closed by this pull request
Copy link

codecov bot commented Mar 10, 2024

Codecov Report

Attention: Patch coverage is 87.85047% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 78.43%. Comparing base (6500dca) to head (d3bc81a).

Files Patch % Lines
tripper/namespace.py 83.54% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #195      +/-   ##
==========================================
+ Coverage   78.42%   78.43%   +0.01%     
==========================================
  Files          18       18              
  Lines        1599     1651      +52     
==========================================
+ Hits         1254     1295      +41     
- Misses        345      356      +11     

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

@jesper-friis jesper-friis changed the title Added persistent cache to Namespace and simplified the implementation Enhanced the use of namespaces Mar 11, 2024
docs/tutorial.md Outdated Show resolved Hide resolved
docs/tutorial.md Outdated Show resolved Hide resolved
Copy link
Contributor

@francescalb francescalb left a comment

Choose a reason for hiding this comment

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

Nice, I especially like to better introduction. However, there are quite a few lines not tested. I think these should be added.

jesper-friis and others added 3 commits March 12, 2024 22:52
Co-authored-by: Francesca L. Bleken <48128015+francescalb@users.noreply.github.com>
Co-authored-by: Francesca L. Bleken <48128015+francescalb@users.noreply.github.com>
Co-authored-by: Francesca L. Bleken <48128015+francescalb@users.noreply.github.com>
@jesper-friis
Copy link
Contributor Author

Nice, I especially like to better introduction. However, there are quite a few lines not tested. I think these should be added.

Added some more tests, but:

  • No tests are added for the deprecated arguments in Namespace.init() (they would have to be removed soon again).
  • Windows- and Mac-specific stuff in get_cachedir() are not testet either.

Comment on lines -75 to -76
if base_iri:
warnings.warn("base_iri", UnusedArgumentWarning, stacklevel=3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove this warning?

Copy link
Contributor

@francescalb francescalb left a comment

Choose a reason for hiding this comment

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

Nice, but please explain in the Docstring why base_iri is a valid Argument

@jesper-friis jesper-friis merged commit 350038b into master Mar 16, 2024
16 checks passed
@jesper-friis jesper-friis deleted the 194-namespace-cache-and-extension branch March 16, 2024 08:19
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.

Add caching and extension to tripper.Namespace
2 participants