-
Notifications
You must be signed in to change notification settings - Fork 560
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
Blank-nodes collisions #980
Comments
I think you understand it correctly. I think this is related to issue #892 . The rdflib uses the blank identifiers as they are. Changing this behavior now would break some things and as we are in the feature freeze for 5.x I moved it to the 6.0.0 milestone. Actually I have a use case where I need to parse multiple files within the same context of blank identifiers. When executing SPARQL queries I need to have individual contexts per query. Maybe it would be a good idea to introduce some blank context object which can be handed over to the parse method and the query method. We have to put this on the roadmap for 6.0.0. |
Thank you for your reply. However I don't really understand... does that mean that there is no graph merging mechanism currently implemented in rdflib ? This would be in contradiction with what is said in the doc :
|
but both the graph have common subject and predicate and object is different. |
we solve this issue as follows, |
@vikash18086 thank you for contributing to the RDFlib. I think this would not actually solve the issue. As I have mentioned earlier:
So we need some way to:
|
- Needed so you can access through Graph.parse which does not support passing args to Parser __init__
- Needed so you can access through Graph.parse which does not support passing args to Parser __init__
- Also making "py:obj" the default role for docs
…de-collisions Allow distinct blank node contexts from one NTriples parser to the next (#980)
- Also, updating the shared context so it works properly with Graph.parse
- Also, writing out BNode reference to avoid Sphinx warning - Deleting NTParser __init__ since it doesn't do anything
Cool thank you @mwatts15 for #1107 this is the interface as I have proposed it. I like it. We have to make sure that it also works across different serialization formats. I think it should not be a problem with Turtle, for RDF/XML the value of Also We need a similar solution for #892. |
@white-gecko I'm only really interested in the N-Triples and N-Quads formats. As far as other parsers, you already get distinct blank nodes between different documents for some. I don't know if sharing them across documents makes as much sense for other formats. Turtle/N3 has more complicated handling of blank nodes: formulas define their own nested blank node contexts. What's the use-case for something like the JSON-LD looks like it would be more annoying in general, but also for this. I have less than zero interest in that. |
That is fine. I'm actually also just interested in this feature for NTriples. But for the sake of consistency of the parsing interface I think it would be good to have the blank node/blank id support handled in the same way for all parsers. Maybe there will be somebody who needs it at some time … ;-) |
…ode-collisions BNode context dicts for NT and N-Quads parsers
Closing this Issue since PR #1495 includes a test that shows that this particular Issue is solved (due to PR #1108). Thanlks @gjhiggins! |
Hi.
If I understand correctly the graphs merging process explained here, the following piece of code should create a graph with two distinct blank nodes :
However, when executing the code, I get the following output :
(rdflib.term.BNode('Ne3fd8261b37741fca22d502483d88964'), rdflib.term.URIRef('http://purl.obolibrary.org/obo/RO_0002350'), rdflib.term.URIRef('http://www.gbif.org/species/0000002')) (rdflib.term.BNode('Ne3fd8261b37741fca22d502483d88964'), rdflib.term.URIRef('http://purl.obolibrary.org/obo/RO_0002350'), rdflib.term.URIRef('http://www.gbif.org/species/0000001'))
Am I missing something ? (versions : rdflib 4.2.2, python 3.7.5)
The text was updated successfully, but these errors were encountered: