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

predicateObjectList in Turtle documents are not parsed correctly #1151

Open
tobiaswjohn opened this issue Aug 27, 2024 · 1 comment
Open
Labels

Comments

@tobiaswjohn
Copy link

The following (valid) turtle document is not parsed correctly:

<iri1> <iri2> <iri3> ;
    ; 
    .

The problem is triggered by the second line with a semicolon without any verb and objectList, which is allowed based on the turtle grammar.

I assume the cause of the problem is the grammar in TurtleParser.jj line 264 were the rule for predicateObjectList looks different than the one from the standard.

The detailed error message when parsing the example on the top is the following:

Parser: org.semanticweb.owlapi.rdf.turtle.parser.TurtleOntologyParser@2cf3d63b
    Stack trace:
org.semanticweb.owlapi.rdf.turtle.parser.ParseException: Encountered unexpected token: ";" ";"
    at line 2, column 2.

Was expecting:

    "."
        org.semanticweb.owlapi.rdf.turtle.parser.TurtleOntologyParser.parse(TurtleOntologyParser.java:58)
        uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:195)
        uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.load(OWLOntologyManagerImpl.java:1105)
        uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1055)
        uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:1005)
        org.example.Main.loadTurtle(Main.java:87)
        org.example.Main.main(Main.java:23)
Encountered unexpected token: ";" ";"
    at line 2, column 2.

Was expecting:

    "."
        org.semanticweb.owlapi.rdf.turtle.parser.TurtleParser.generateParseException(TurtleParser.java:1034)
        org.semanticweb.owlapi.rdf.turtle.parser.TurtleParser.jj_consume_token(TurtleParser.java:902)
        org.semanticweb.owlapi.rdf.turtle.parser.TurtleParser.parseDocument(TurtleParser.java:160)
        org.semanticweb.owlapi.rdf.turtle.parser.TurtleOntologyParser.parse(TurtleOntologyParser.java:54)
        uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:195)
        uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.load(OWLOntologyManagerImpl.java:1105)
        uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1055)
        uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:1005)
        org.example.Main.loadTurtle(Main.java:87)
        org.example.Main.main(Main.java:23)



	at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:236)
	at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.load(OWLOntologyManagerImpl.java:1105)
	at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1055)
	at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:1005)
	at org.example.Main.loadTurtle(Main.java:87)
	at org.example.Main.main(Main.java:23)
@ignazio1977
Copy link
Contributor

Indeed, the standard allows for separators that don't separate anything. One could argue whether it was intentional or a typo. I wonder what's the history behind that.

@ignazio1977 ignazio1977 added the bug label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants