use of edu.stanford.bmir.protege.web.shared.obo.OBORelationship in project webprotege by protegeproject.
the class TermRelationshipsManager method getRelationships.
public OBOTermRelationships getRelationships(OWLClass term) {
OWLClass cls = dataFactory.getOWLClass(term.getIRI());
Set<OWLSubClassOfAxiom> subClassOfAxioms = rootOntology.getSubClassAxiomsForSubClass(cls);
Set<OBORelationship> rels = new HashSet<>();
for (OWLSubClassOfAxiom ax : subClassOfAxioms) {
Set<OWLObjectSomeValuesFrom> relationships = new HashSet<>();
Set<OWLClassExpression> conjuncts = ax.getSuperClass().asConjunctSet();
for (OWLClassExpression conjunct : conjuncts) {
if (conjunct instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom) conjunct;
if (!svf.getProperty().isAnonymous() && !svf.getFiller().isAnonymous()) {
relationships.add((OWLObjectSomeValuesFrom) conjunct);
}
}
}
if (relationships.size() == conjuncts.size()) {
for (OWLObjectSomeValuesFrom rel : relationships) {
OWLObjectPropertyData property = renderingManager.getRendering(rel.getProperty().asOWLObjectProperty());
OWLClassData filler = renderingManager.getRendering(rel.getFiller().asOWLClass());
OBORelationship oboRel = new OBORelationship(property, filler);
rels.add(oboRel);
}
}
}
return new OBOTermRelationships(rels);
}
use of edu.stanford.bmir.protege.web.shared.obo.OBORelationship in project webprotege by protegeproject.
the class TermCrossProductsManager method setCrossProduct.
public void setCrossProduct(@Nonnull UserId userId, @Nonnull OWLClass term, @Nonnull OBOTermCrossProduct crossProduct) {
Set<OWLClassExpression> intersectionOperands = new HashSet<>();
Optional<OWLClassData> genus = crossProduct.getGenus();
if (genus.isPresent()) {
OWLClass cls = genus.get().getEntity();
intersectionOperands.add(cls);
}
for (OBORelationship relationship : crossProduct.getRelationships().getRelationships()) {
OWLObjectSomeValuesFrom someValuesFrom = relationshipConverter.toSomeValuesFrom(relationship);
intersectionOperands.add(someValuesFrom);
}
OWLObjectIntersectionOf intersectionOf = df.getOWLObjectIntersectionOf(intersectionOperands);
OWLEquivalentClassesAxiom newXPAxiom = df.getOWLEquivalentClassesAxiom(term, intersectionOf);
Optional<OWLEquivalentClassesAxiom> existingXPAxiom = getCrossProductEquivalentClassesAxiom(term);
List<OWLOntologyChange> changes = new ArrayList<>();
changes.add(new AddAxiom(rootOntology, newXPAxiom));
existingXPAxiom.ifPresent(ax -> changes.add(new RemoveAxiom(rootOntology, ax)));
changeManager.applyChanges(userId, new FixedChangeListGenerator<>(changes, term, "Set cross product values"));
}
use of edu.stanford.bmir.protege.web.shared.obo.OBORelationship in project webprotege by protegeproject.
the class RelationshipConverter method toOboRelationship.
@Nonnull
public OBORelationship toOboRelationship(@Nonnull OWLObjectSomeValuesFrom someValuesFrom) {
OWLObjectPropertyData property = renderingManager.getRendering(someValuesFrom.getProperty().asOWLObjectProperty());
OWLClassData filler = renderingManager.getRendering(someValuesFrom.getFiller().asOWLClass());
return new OBORelationship(property, filler);
}
Aggregations