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

rdflib is encoding local names in Turtle incorrectly #553

Open
jgonggrijp opened this issue Sep 6, 2022 · 1 comment
Open

rdflib is encoding local names in Turtle incorrectly #553

jgonggrijp opened this issue Sep 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@jgonggrijp
Copy link
Member

When I go to my landing page in development, the tally of my items never updates:

Schermafbeelding 2022-09-06 om 12 02 51

Looking into the dev console, they are properly fetched from the backend, but notice the parentheses on line 106:

Schermafbeelding 2022-09-06 om 12 03 35

The frontend parser is rejecting this:

Schermafbeelding 2022-09-06 om 12 03 57

According to the Turtle specification, the parser is right; those parentheses should be escaped.

Consequence: anyone who has created an item with an ontology class that contains parentheses in the IRI, will not be able to load their own items (or the tally of those items). So far, not many people have created items, so hopefully nobody is suffering from this yet. Still, it seems somewhat urgent to fix.

I can currently think of four non-ideal solutions:

  • Forward BlazeGraph query result as-is #307 is arguably the most "correct" solution, if BlazeGraph does a better job at Turtle encoding, but is quite involved.
  • Edit the ontology again, so none of the IRIs contain reserved characters. This seems somewhat defensible, but is also cumbersome, as it will require another migration and there many classes and properties with parentheses in their IRIs.
  • Somehow monkeypatch rdflib in order to fix the Turtle encoding. This is the ugliest possible solution, but might be the only remaining option if the others turn out to be infeasible.
  • Don't include the ontology prefix: in the frontend query, so the backend hopefully also doesn't abbreviate the ontology IRI's and writes them full-on between angle brackets instead. The frontend parser seems to be fine with it that way. This is probably the fastest solution, but also the least certain and the least robust, because we already know that rdflib will occasionally create ad hoc prefixes when it feels like it (ns1:, ns2:, etcetera), and future encoders such as BlazeGraph might do the same.

For now, I have worked around this in my local development database by simply deleting the affect item and the annotation it was linked to.

@jgonggrijp jgonggrijp added the bug Something isn't working label Sep 6, 2022
@jgonggrijp
Copy link
Member Author

Update: I just noticed that if any annotation in a source has an affected class or property, then no annotation will be visible in the explorer, neither in the source panel nor in the annotation list panel next to it. This makes the bug extra urgent.

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

No branches or pull requests

1 participant