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

Escaping issue? #3

Closed
renefritze opened this issue Jan 13, 2022 · 4 comments
Closed

Escaping issue? #3

renefritze opened this issue Jan 13, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@renefritze
Copy link

I want to format a Turtle file that looks something like this:

@prefix dc:      <http://purl.org/spar/datacite/> .
@prefix doi:     <https://doi.org/> .
something a :publication ; rdfs:label "Paper title" ;
    dc:hasIdentifier doi:10.1137\/1.9781611970937 . 

The forward slash escaping is necessary for us to pass validation with riot from the Jena package. Inputting above text into
owl write I get (Where line/col matches the slash position)

Error: Encountered " "\\" "\\ "" at line 32, column 30.
Was expecting one of:
    ";" ...
    "," ...
    "." ...

Is this an issue with the input parser? Is riot wrong in validating this?

@atextor
Copy link
Owner

atextor commented Jan 14, 2022

Hi, the good news is: I can reproduce the problem with the following model:

@prefix dc:      <http://purl.org/spar/datacite/> .
@prefix doi:     <https://doi.org/> .
@prefix : <http://example.org#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:something a :publication ;
    rdfs:label "Paper title" ;
    dc:hasIdentifier doi:10.1137\/1.9781611970937 .

turtle-formatter and owl-cli also use Jena as an RDF library, which provides multiple ways to parse a file. As it did not use the same method as riot, I built a minimal project that tries to load the file using both ways. Both ways load the file as intended, so this is not an issue with either Jena's libraries or the riot tool. I'm not sure yet what the problem is, but it's most certainly a bug.

@atextor
Copy link
Owner

atextor commented Jan 17, 2022

After some investigation, it seems this is caused by Jena's internal RDF parsers handling escapes differently. The RIOT parser which handles this correctly is added automatically via service loading when jena-arq is added as a dependency. For turtle-formatter, this is the case, while for owl-cli it isn't, so this is actually an issue there: atextor/owl-cli#1.

@atextor
Copy link
Owner

atextor commented Jan 22, 2022

@renefritze The fix for the broken parsing is done. Furthermore, serialization of escapes was broken as well (see #4). Both fixes are in the just released owl-cli version 1.2.0.

@renefritze
Copy link
Author

Excellent, thank you.

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

2 participants