I need to parse some axioms represended as strings in functional syntax in order to add to an existing ontology or compare with its axioms. (i.e. convert the string like 'ObjectPropertyAssertion(:crosses :flow :line)' to an OWLAxiom object).
I know it is possible for the machester syntax by the ManchesterOWLSyntaxParserImpl class with the setStringToParse() and parseAxiom() methods.
Has the functional parser got the simular feature? Or is there third-part implementation or an example that allows to easily parse inline strings above existing ontology?
That feature is unique to Manchester syntax, the other OWLAPI parsers do not support it.
However, if the axiom you wish to parse is self contained (i.e., no prefixes and no declarations required to disambiguate entities) a workaround would be to wrap it in an empty ontology and parse that.
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Ontology(<http://example.com/temp>
# add your axiom string here
)
Then just retrieve all axioms and discard the ontology.