#348 ManchesterOWLSyntax round trip problem with disjoint classes


This bug was originally reported by Philip Lord. The Manchester OWL syntax parser seems to add the last declared class to the disjoint classes axioms (with more than three class expressions). Thus for the snippet

Class: piz:SultanaTopping




the SultanaTopping gets added to the disjoint classes axiom when it is parsed.

I have attached a program demonstrating the problem.


  • Ignazio Palmisano

    Related problem: troubles roundtripping disjoint union axioms.

    public void shouldRoundtripDisjointUnion() throws Exception {
    OWLDataFactory df = Factory.getFactory();
    OWLOntology o = Factory.getManager().createOntology();
    Set<OWLClass> disjoint = new HashSet<OWLClass>();
    OWLDisjointUnionAxiom axiom = df.getOWLDisjointUnionAxiom(
    df.getOWLClass(IRI.create("http://iri/#a")), disjoint);
    o.getOWLOntologyManager().addAxiom(o, axiom);
    StringDocumentTarget target = new StringDocumentTarget();
    new ManchesterOWLSyntaxOntologyFormat(), target);
    OWLOntology roundtripped = Factory.getManager().loadOntologyFromOntologyDocument(
    new StringDocumentSource(target.toString()));
    assertEquals(o.getLogicalAxioms(), roundtripped.getLogicalAxioms());

    java.lang.AssertionError: expected:<[DisjointUnion(<http://iri/#a> <http://iri/#b> <http://iri/#c> <http://iri/#d> )]> but was:<[]>

  • Ignazio Palmisano

    • assigned_to: nobody --> ignazio1977
  • Ignazio Palmisano

    There are multiple issues at work here:

    • a bug on parsing DisjointClasses axioms: they were being parsed as if they have a subject, thus adding an entity. When the entity appears inside an anonymous construct, this 'adds' an element to the disjoint. Fixed and tested for.

    • a general bug in Manchester syntax: the DisjointWith and DisjointClasses sections both parse as part of a class definition, if the DisjointClasses appears after a class declaration. Does not happen if the DisjointClasses are rendered first in the file.
      This could be worked around by rendering all n-ary axioms before entities and their definitions, but it's fragile at best. Cannot be fixed easily, as far as I can tell.

    • an apparent misunderstanding between the fragment and the expected rendering of unions: the renderer renders unions in infix syntax, i.e., 'a or b', while the fragment expects to be able to say 'or a, b'. I'm not sure which is right, and picking either would break existing code one way or the other.

    • a bug in the renderer: no parentheses around union of, although there are parentheses around nested anonymous constructs - which breaks the parser. Fixed and tested.

    • a bug with DisjointUnionOf axioms: they were not rendered at all. Fixed and tested.

  • Ignazio Palmisano

    • Description has changed:


    --- old
    +++ new
    @@ -1,4 +1,3 @@
     This bug was originally reported by Philip Lord.  The Manchester OWL syntax parser seems to add the last declared class to the disjoint classes axioms \(with more than three class expressions\).  Thus for the snippet 
     Class: piz:SultanaTopping
    • status: open --> closed-fixed
    • Group: --> v1.0_(example)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks