-
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
rdfpipe adds a graph name to triples in the default graph, consequently breaking round tripping #1804
Comments
The added graph name is a "feature" of RDFLib parsing, if you don't need to record the source of the data, just pipe the data into
Perhaps this is more of a documentation issue. |
As per discussion on gitter: https://gitter.im/RDFLib/rdflib?at=62586bb3e9cb3c52ae651573 I somewhat understand the idea behind what is happening here, but to me this still seems like it is a bug. The default graph should have no name [ref], and the example has triples outside of a graph statement, which according to TriG spec makes them part of the default graph [ref]. So to me, RDFLib is outputting something which is not the same as the input. It may be useful in some context, but I would say it should not be the default behaviour, or at the very least there should be a way to disable this behaviour, as the primary thing I want to be able to do with rdfpipe is graph preserving conversions. Not sure what others think about it though. |
Perhaps not of
You are correct, the default graph of a Dataset should have no name but, as a minor nitpick, I'm not sure that the RDF1.1 spec is relevant here as the current implementation of |
I'm still not convinced this is not a bug as IMO we should be targeting RDF 1.1 which is 6 years old by now. We can fix these things also without removing But if we are not targetting RDF 1.1. we should also clarify in our documentation that we are not. I fear then however we are essentially mothballing rdflib as what I want is an RDF 1.1 compatible library in python, and RDF 1.1 compatible tooling. |
Maybe the right solution is to re-look at how #130 works - however quite independently of this, rdfpipe/rdflib should ideally not be resolving relative URIs IMO. |
Alternatively, given that this change: diff --git a/rdflib/tools/rdfpipe.py b/rdflib/tools/rdfpipe.py
index 6b53cc8b..1a17b48c 100644
--- a/rdflib/tools/rdfpipe.py
+++ b/rdflib/tools/rdfpipe.py
@@ -49,6 +49,8 @@ def parse_and_serialize(
fpath = sys.stdin
elif not input_format and guess:
use_format = guess_format(fpath) or DEFAULT_INPUT_FORMAT
+ if fpath != sys.stdin:
+ kws["publicID"] = fpath if use_format != "trig" else ""
dataset.parse(fpath, format=use_format, **kws)
if outfile: yields
there may be an opportunity to set fwiw, using the unedited code:
|
Uh-huh, I'm not disagreeing in any way but RDFLib 6 is quite close to compliance according to David Wood's What’s New in RDF 1.1. The remaining significant issue is a compliant implementation of Dataset. However, the implications of the W3's bland statement that the “RDF Working Group did not standardize the semantics of RDF datasets” are pretty profound from an implementation perspective. I've posted further on this in the comments to #1814 |
Regarding relative uris: |
I don't think this is related to relative URIs or paths, this really is only related to what happens to triples in the default graph [ref]. In trying to address #2393 this issue came up again, as I'm having trouble detecting if named graphs are present, as the default graph is also named when loading from a file. |
Fix is more or less ready, please have a look: |
I would expect to be able to round-trip quads with rdfpipe, but this does not work because rdfpipe labels quads in the default graph with a graph name and then serializes them with the injected graph name.
The text was updated successfully, but these errors were encountered: