Added argument ignore_unrecognised to tripper.convert()#247
Added argument ignore_unrecognised to tripper.convert()#247jesper-friis merged 7 commits intomasterfrom
ignore_unrecognised to tripper.convert()#247Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #247 +/- ##
==========================================
+ Coverage 78.35% 78.40% +0.05%
==========================================
Files 18 18
Lines 1723 1723
==========================================
+ Hits 1350 1351 +1
+ Misses 373 372 -1 ☔ View full report in Codecov by Sentry. |
|
I have trouble seeing how to use this function prperly. Could you add some examples? |
An example use case: from tripper import DCTERMS, Literal, Triplestore
from tripper.convert import load_container, save_container
ts = Triplestore("rdflib")
dataset = {"a": 1, "b": 2}
save_container(ts, dataset, ":data_indv")
# Add additional context to our data individual
ts.add((":data_indv", DCTERMS.title, Literal("My wonderful data")))
data = load_container(ts, ":data_indv") # <-- this will raise an exception complaining about DCTERMS.title is not a recognised key
data = load_container(ts, ":data_indv", ignore_unrecognised=True) # <-- this will works (ignores ECTERMS.title) |
|
The example is now added to module docstring. It is checked by doctest. |
Description
Added argument
ignore_unrecognisedto tripper.convert().Question: One could consider to set
ignore_unrecognised=Trueby default. It will be a small change in behavior, but more user friendly. I think that would be wise change.Type of change
Checklist for the reviewer
This checklist should be used as a help for the reviewer.