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
Namespace shortening and invalid RDF outputs #115
Comments
Yes, I like the idea of making sure the most specific namespace is matched. I think I need to read the CURIE specification in detail: And check that my implementation is compliant. The serialiser implementations probably need different rules to ensure that the local part is valid for the serialisation. |
any news on this one? I just got output with slashes in "local" part too. |
This issue is causing the RDFa test 0316 from the official RDFa test suite to fail. I initially filed #156 which is a duplicate of this one. |
I implemented simple fix in |
Looks good to me :) Can you add a test to EasyRdf_NamespaceTest too please? |
@njh done |
Thanks @indeyets! @njh let me know when you deploy that to http://www.easyrdf.org/converter and I'll test the RDFa test which was failing, it should work now... |
A more robust fix for closed problem easyrdf#115: "Namespace shortening and invalid RDF outputs" easyrdf#115
See easyrdf#115 I ran into this problem last month. Here is my solution.
In some instances the in-built turtle serialiser can output invalid documents due to incorrect namespace shortening.
Consider four types of animal
Then take the following example, which parses some triples and outputs them as turtle.
Note we also have also defined a namespace prefix for animals.
This will produce the following output, which contains the invalid animals:reptiles/snake
In the last triple, the namespace shortening has been applied, but only matched against part of the URI.
There is a simple fix for the turtle parser, in changing line 62 and line 141 to be
However, this problem still persists in the RDF/XML serialiser, as if I had say
http://example.com/ns/property
andhttp://example.com/ns/property/subproperty
then output such as the following would be produced
So probably a better fix is required within EasyRdf_Namespace ??
Also, in attempting to fix the "snake" issue, I discovered that the namespace shortenings are applied in the order in which they are declared. In the above example code, if you declare reptiles before animals then all is fine
however if you add reptiles after animals...
then you will never get reptile as animal will match first, causing the problem I discovered at the outset.
I suggest that probably each time a new namespace is declared/generated the internal map of prefixes and namespaces should be sorted by length of namespace?
thanks, and sorry this is so long!
Ian
The text was updated successfully, but these errors were encountered: