Closed tfrancart closed 5 months ago
Protege deals with this with its own classes:
(from OWLClassAxiomChecker)
parser.setOWLEntityChecker(new ProtegeOWLEntityChecker(mngr.getOWLEntityFinder()));
The use of '' to escape annotation values with spaces is managed in OWLEntityFinderImpl, it's not part of the manchester syntax implementation in OWL API.
These classes are all part of the protege UI project, so it might be difficult for you to reuse them directly; they also rely on Protege specific ontology manager classes, so not easy to extract as is.
Licence is BSD, which, as far as I understand it, means you could copy and tweak those classes in your own project, provided you include the same licence notice for the new files. I'm not sure if this is compatible with your project licence.
ROBOT also has some short form providers (also open source), in case those are easier to borrow and modify than the Protege ones:
https://github.com/ontodev/robot/tree/master/robot-core/src/main/java/org/obolibrary/robot/providers
Thanks ! I am actually doing an integration one level above, by an implementing my own ShortFormEntityChecker instead of my own ShortFormProvider. Much easier. I need to know in theory if an identifier is an identifier of a Class, ObjectProp or DatatypeProp, but I can deal with that.
Below is a reproductible test case showing that it is not possible to parse class expressions with labels that contain quotes, e.g.
A_Pizza and hasTopping some 'Meat topping'"
It shows that the
AnnotationValueShortFormProvider
does work and can successfully resolve IRIs from their labels, then shows that the parsing of class expressions with labels fails. If we debug the code we see that the ManchesterOWLSyntaxParser passes the labels with quotes included to the ShortFormProvider (e.g. "'Meat Topping'").See also https://stackoverflow.com/questions/76951595/how-to-parse-manchester-syntax-with-rdfs-labels-like-in-prot%c3%a9g%c3%a9?noredirect=1#comment135661024_76951595