-
Notifications
You must be signed in to change notification settings - Fork 555
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
Trig serialisation handling prefixes incorrectly #428
Comments
hi @dschallis, Inasmuch as that test was from my own data, I got curious. It seems like back then I didn't notice the problem you found. I tried it again with my development clone and got the same effect you did. But then things got weird and I don't have sufficient experience to interpret what I'm seeing. With an updated version of 4.2.dev (and Python 2.7.1), I did exactly the experiment you did and got the same result, the list of namespaces was this:
so I tried this:
and thought, "that's odd, there's ns2 right there, and it is defined properly." Baffled, I did this again:
and got this:
I'm able to reproduce this effect reliably, but I have no idea what might cause this behavior. It appears that I hope someone with more experience than I will be able to explain why this happens. |
Hi @jjon, |
@dschallis - are there any updates on this? we have run into this with trying to serialize/deserialize the w3c prov model as trig. |
@satra unfortunately not, I looked into the issue, and found some deeper problems regarding rdflib's trig handling (#432 and #433), which make it hard to use/test the fix I'd originally intended. I'm still planning to look into these when I get a chance, but I'll need to spend some time understanding more about some of rdflib's internals first. |
I just stumbled upon the same problem, and the problem occurs when the TurtleSerializer serializes a IRI that does not belong to a known namespace. This namespace is then created based on some guesswork, but because the TrigSerializer has by that point already serialized the namespace declaration (the turtle serializer is essentially called for every graph in the store), the newly added namespace is not picked up properly. For now my workaround is just to serialize the graph twice in succession. |
I was running into something like this. These patches may help: I don't remember why I was doing these or why I stopped trying to get them merged back. |
Regarding the workaround of @RinkeHoekstra still the issue is, that qnames are generated, but printed in Edit: I've checked this on the current master branch again and patches of @drewp seem to be integrated/merged. Can this issue be closed? |
this works fine in master now. |
* master: (44 commits) quote cleanup OCD serializer/parser alias for 'ntriples' serializer/parser alias for 'ttl' cleanup remove outdated always skipped test a bit of changelog add a NTSerializer sub-class for nt11 (#700) Restrict normalization to unicode-compatible values (#674) fixes for turtle/trig namespace handling skip serialising empty default graph skip round-trip test, unfixable until 5.0 prefix test for #428 Added additional trig unit tests to highlight some currently occurring issues. remove ancient and broken 2.3 support code. (#681) updating deprecated testing syntax (#697) docs: clarify the use of an identifier when persisting a triplestore (#654) removing pyparsing version requirement (#696) made min/max aggregate functions support all literals (#694) actually fix projection from sub-queries added dawg tests for #607 ...
In version 4.1.2 (under python 2.7), running the Trig test detailed at #317 produces invalid Trig output.
Running the code:
produces the invalid Trig output:
The Trig output contains the prefix "ns2" for graphs, but this prefix isn't defined anywhere. In addition, the prefixed graph name shouldn't be enclosed within angle brackets, e.g. the correct output for each named graph should be either:
Or:
The text was updated successfully, but these errors were encountered: