Assumedly I have a data property named fooType
with 2 possible values {"Low", "High"}
:
<DataPropertyRange>
<DataProperty IRI="#fooType"/>
<DataOneOf>
<Literal datatypeIRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">Low</Literal>
<Literal datatypeIRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">High</Literal>
</DataOneOf>
</DataPropertyRange>
How can I use owlapi and a reasoner to:
So far I've tried and stucked:
// 1. How to get "Low" and "High" strings in the next step?
OWLDataProperty dataProperty = ...
Set<OWLDataPropertyRangeAxiom> dataPropertyRangeAxioms = ontology.getDataPropertyRangeAxioms(dataProperty);
// 2. How to get fooType's values in the next step?
OWLIndividual individual = ...
Set<OWLLiteral> literals = reasoner.getDataPropertyValues(individual, dataProperty);
A reasoner is not necessary to list all enumerated values - for example, it will not list values that are not used but allowed to be used in the enumeration.
To access all ranges and their components:
OWLOntology o = ...
OWLDataProperty p = ...
o.dataPropertyRangeAxioms(p)
.map(OWLDataPropertyRangeAxiom::getRange)
.forEach((OWLDataRange range) ->
// this is where you can visit all ranges
// using an OWLDataRangeVisitor
)
);