Closed rwynne closed 2 years ago
Something like this:
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
OWLDataFactory f = man.getOWLDataFactory();
OWLClass cls = f.getOWLClass(IRI.create(":108601004"));
OWLObjectProperty p = f.getOWLObjectProperty(IRI.create(":738774007"));
List<OWLClassExpression> result = new ArrayList<>(); // the list of all fillers for the property
for (OWLSubClassOfAxiom ax : ont.getSubClassAxiomsForSubClass(cls)) {
OWLClassExpression sup = ax.getSuperClass();
if (sup instanceof OWLObjectIntersectionOf) {
OWLObjectIntersectionOf inters = (OWLObjectIntersectionOf) sup;
for (OWLClassExpression conj : inters.getOperands()) {
if (conj instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom exist = (OWLObjectSomeValuesFrom) conj;
if (exist.getProperty().equals(p)) {
result.add(exist.getFiller());
}
}
}
}
}
Note: the inferred information is only shown with the yellow background. Since you do not need to consider this part, you do not need to use the reasoner.
Exactly what I needed. Thanks @ykazakov !
Below is an inferred view of subclasses for SNOMED class
Atorvastatin calcium (substance)
Class
Pyrrole (substance)
is displayed twice, however would like to get the classAtorvastatin (substance)
for predicateIs modification of (attribute)
from the "first" Pyrrole class.How would I do this with the API? Should it be handled like an OWLNaryBooleanClassExpression as if it were an EquivalentClass? My dependencies are currently the ELK reasoner 0.5.0-SNAPSHOT and owlapi-distribution 5.1.10.
syntax:
SubClassOf(:108601004 ObjectIntersectionOf(:115667008 :373267003 ObjectSomeValuesFrom(:726542003 :734592007) ObjectSomeValuesFrom(:738774007 :373444002)))
Wishing you all a Happy New Year.