phenoscape / owlery

Owlery is a set of REST web services which allow querying of an OWL reasoner containing a configured set of ontologies.
MIT License
16 stars 11 forks source link

Enhancement: Fully generic class expression parser (low prio) #24

Closed matentzn closed 3 years ago

matentzn commented 6 years ago

I once wrote a generic syntax parser; Not sure what it does anymore, but maybe you could consider it (man is OWLOntologyManager man, and o is OWLOntology o):

public OWLClassExpression parseClassExpression(String sClassExpression) {
        OWLEntityChecker entityChecker = new ShortFormEntityChecker(
                new BidirectionalShortFormProviderAdapter(man, o.getImportsClosure(), new SimpleShortFormProvider()));
        ManchesterOWLSyntaxParser parser = OWLManager.createManchesterParser();
        parser.setOWLEntityChecker(entityChecker);
        parser.setStringToParse(sClassExpression);
        // j
        OWLClassExpression exp = parser.parseClassExpression();
        return exp;
    }
balhoff commented 6 years ago

I've never noticed that method on OWLManager! My issue with the OWL API Manchester parser is that with the way I used it, it required an entity checker which knew which things were classes vs. properties. I think according to the grammar this can be figured out just from the syntax. I'll try out the method you suggest.

matentzn commented 6 years ago

Cool! Let me know how it works out :)

balhoff commented 4 years ago

@matentzn I now switched to a Manchester parser using the OWL API implementation: https://github.com/phenoscape/owlet/pull/22

There is one problem I am aware of though; it doesn't seem possible to provide an entity checker that can allow any IRI for any entity; you can't allow an object property and a data property for the same IRI. This is a true restriction in OWL, however in principle I think the grammar ought to allow parsing just based on the syntax. So at the moment the parser here won't parse data properties. That's actually no different from the previous situation though (it was unimplemented).

balhoff commented 3 years ago

Fixed by #150.