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

nquads parser creates one context per triple in the default graph #535

Closed
pchampin opened this issue Oct 29, 2015 · 6 comments
Closed

nquads parser creates one context per triple in the default graph #535

pchampin opened this issue Oct 29, 2015 · 6 comments
Labels
bug Something isn't working fix-in-progress parsing Related to a parsing.
Milestone

Comments

@pchampin
Copy link
Contributor

In nquads, the 4th component (graph id) of each line can be omitted, meaning that the triple belongs to the default graph.

Currently, the nquads parser puts every such triple in a different context, identified by a fresh BNode, which is clearly wrong.

E.g.:

from rdflib import ConjunctiveGraph, Dataset
from rdflib.parser import StringInputSource

ds = ConjunctiveGraph()

src = StringInputSource("""
<http://example.org/s1> <http://example.org/p1> <http://example.org/o1> .
<http://example.org/s2> <http://example.org/p2> <http://example.org/o2> .
<http://example.org/s3> <http://example.org/p3> <http://example.org/o3> <http://example.org/g3> .
""")

ds.parse(src, format="nquads")

assert len(ds) == 3, len(g)
assert len(list(ds.contexts())) == 2, len(list(ds.contexts()))
pchampin added a commit to pchampin/rdflib that referenced this issue Oct 29, 2015
@niklasl
Copy link
Member

niklasl commented Oct 29, 2015

Closely related to #436. We should coordinate solutions.

@pchampin
Copy link
Contributor Author

You are right, those issues related.
The reason I opened a new one is that, regardless of the chosen solution for handling the default graph,
it is clear that those triples should not end up in different contexts.

So those are two different problems, fixing one requires fixing the other. Indeed, we should coordinate.

@niklasl
Copy link
Member

niklasl commented Oct 29, 2015

Yes, I agree, this issue for the nquads parser is distinct.

(I'll also look into coordinating a solution for RDFLib/rdflib-jsonld#34 with this. I wrote down #436 when I originally hit that. But attempting to resolve all parsing and serializing of datasets at once might have been too much.)

@joernhees joernhees added bug Something isn't working fix-in-progress parsing Related to a parsing. labels Oct 29, 2015
@joernhees
Copy link
Member

hmm, one question wrt. the version in which this will be fixed, e.g. by merging #536 :

as we use http://semver.org, is this a bug fix only (so 4.2.2) or an actual backwards incompatible change (5.x.x)?

@pchampin
Copy link
Contributor Author

The current behaviour of the nquads parser is wrong, to a point that no one
could reasonably rely on it.
So I would go for a bug fix.

On Thu, Oct 29, 2015 at 3:43 PM, Jörn Hees notifications@github.com wrote:

hmm, one question wrt. the version in which this will be fixed, e.g. by
merging #536 #536 :

as we use http://semver.org, is this a bug fix only (so 4.2.2) or an
actual backwards incompatible change (5.x.x)?


Reply to this email directly or view it on GitHub
#535 (comment).

@joernhees joernhees added this to the rdflib 4.2.2 milestone Oct 30, 2015
joernhees added a commit that referenced this issue Nov 28, 2015
@joernhees
Copy link
Member

fixed in #536

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix-in-progress parsing Related to a parsing.
Projects
None yet
Development

No branches or pull requests

3 participants