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

Grammar incorrectly defined for non-negative integers #4

Closed
GoogleCodeExporter opened this issue Oct 16, 2015 · 3 comments
Closed

Grammar incorrectly defined for non-negative integers #4

GoogleCodeExporter opened this issue Oct 16, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

The grammar for non-negative integers is incorrectly defined. Line 265 of 
Owl2FunctionalStyleParser.jj reads:

< NON_NEGATIVE_INTEGER: ["1"-"9"] (<DIGIT>)* >

when (I believe) it should read:

< NON_NEGATIVE_INTEGER: ["0"-"9"] (<DIGIT>)* >

The effect of this is that a line such as:

ObjectExactCardinality(0 
<http://lsdis.cs.uga.edu/projects/glycomics/propreo#has_units>)

throws a org.semanticweb.elk.owl.parsing.javacc.ParseException when in-fact 
this is valid.

Hence ProPreo.owl, which contains the above example, fails with the following 
stack trace:

Exception in thread "main" 
org.semanticweb.elk.owl.parsing.javacc.ParseException: Encountered " <PN_LOCAL> 
"0 "" at line 313, column 528.
Was expecting:
    <NON_NEGATIVE_INTEGER> ...

        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.generateParseException(Owl2FunctionalStyleParser.java:2408)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.jj_consume_token(Owl2FunctionalStyleParser.java:2348)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.objectExactCardinality(Owl2FunctionalStyleParser.java:1145)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.classExpression(Owl2FunctionalStyleParser.java:911)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.classExpressionList(Owl2FunctionalStyleParser.java:1472)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.objectIntersectionOf(Owl2FunctionalStyleParser.java:947)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.classExpression(Owl2FunctionalStyleParser.java:881)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.subClassOf(Owl2FunctionalStyleParser.java:1420)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.classAxiom(Owl2FunctionalStyleParser.java:1393)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.axiom(Owl2FunctionalStyleParser.java:1318)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.axioms(Owl2FunctionalStyleParser.java:418)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.ontology(Owl2FunctionalStyleParser.java:334)
        at org.semanticweb.elk.owl.parsing.javacc.Owl2FunctionalStyleParser.ontologyDocument(Owl2FunctionalStyleParser.java:293)
        at org.semanticweb.elk.reasoner.Reasoner.loadOntologyFromStream(Reasoner.java:82)
        at org.semanticweb.elk.reasoner.Reasoner.loadOntologyFromFile(Reasoner.java:99)
        at org.semanticweb.elk.reasoner.Reasoner.loadOntologyFromFile(Reasoner.java:110)
        at org.semanticweb.elk.cli.Main.main(Main.java:90)

If that part of the file is changed to:

ObjectExactCardinality(1 
<http://lsdis.cs.uga.edu/projects/glycomics/propreo#has_units>)

then the file is successfully parsed.

Original issue reported on code.google.com by andy...@hotmail.co.uk on 10 Oct 2011 at 7:16

@GoogleCodeExporter
Copy link
Author

The definition

< NON_NEGATIVE_INTEGER: ["0"-"9"] (<DIGIT>)* >

or, equivalently,

< NON_NEGATIVE_INTEGER: (<DIGIT>)+ >

would also capture strings like

00123

I am not sure it is intended, but it seems to agree with the OWL 2 specs, which 
define here:
http://www.w3.org/TR/owl2-syntax/#General_Definitions

nonNegativeInteger := a nonempty finite sequence of digits between 0 and 9

Alternatively, one can use

< NON_NEGATIVE_INTEGER: "0" | ["1"-"9"] (<DIGIT>)* >

to exclude numbers like 0XXX




Original comment by ykazako...@gmail.com on 10 Oct 2011 at 7:54

@GoogleCodeExporter
Copy link
Author

This has been fixed in r367. The grammar for NON_NEGATIVE_INTEGERS is now 
according to OWL 2 specs.

Original comment by frantise...@gmail.com on 12 Oct 2011 at 8:29

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by frantise...@gmail.com on 12 Oct 2011 at 8:41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant