Menu

#348 ManchesterOWLSyntax round trip problem with disjoint classes

3.4.4
closed-fixed
None
5
2013-05-19
2012-11-05
No

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

SubClassOf:
piz:FruitTopping

DisjointWith:
piz:PineappleTopping

DisjointClasses:
piz:CheeseTopping,piz:FishTopping,piz:FruitTopping,piz:HerbSpiceTopping,piz:MeatTopping,piz:NutTopping,piz:SauceTopping,piz:VegetableTopping

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

I have attached a program demonstrating the problem.

Discussion

  • Timothy Redmond

    Timothy Redmond - 2012-11-05
     
  • Ignazio Palmisano

    Related problem: troubles roundtripping disjoint union axioms.

    @Test
    public void shouldRoundtripDisjointUnion() throws Exception {
    OWLDataFactory df = Factory.getFactory();
    OWLOntology o = Factory.getManager().createOntology();
    Set<OWLClass> disjoint = new HashSet<OWLClass>();
    disjoint.add(df.getOWLClass(IRI.create("http://iri/#b")));
    disjoint.add(df.getOWLClass(IRI.create("http://iri/#c")));
    disjoint.add(df.getOWLClass(IRI.create("http://iri/#d")));
    OWLDisjointUnionAxiom axiom = df.getOWLDisjointUnionAxiom(
    df.getOWLClass(IRI.create("http://iri/#a")), disjoint);
    o.getOWLOntologyManager().addAxiom(o, axiom);
    StringDocumentTarget target = new StringDocumentTarget();
    o.getOWLOntologyManager().saveOntology(o,
    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:

    Diff:

    --- 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.