use of edu.stanford.bmir.protege.web.shared.obo.OBOTermCrossProduct in project webprotege by protegeproject.
the class TermCrossProductsManager method getCrossProduct.
@Nonnull
public OBOTermCrossProduct getCrossProduct(@Nonnull OWLClass term) {
Optional<OWLEquivalentClassesAxiom> axiom = getCrossProductEquivalentClassesAxiom(term);
if (!axiom.isPresent()) {
return OBOTermCrossProduct.emptyOBOTermCrossProduct();
}
Set<OWLObjectSomeValuesFrom> relationships = new HashSet<>();
Optional<OWLClass> genus = Optional.empty();
for (OWLClassExpression operand : axiom.get().getClassExpressionsMinus(term)) {
Set<OWLClassExpression> conjuncts = operand.asConjunctSet();
for (OWLClassExpression conjunct : conjuncts) {
if (conjunct instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom) conjunct;
if (!svf.getProperty().isAnonymous() && !svf.getFiller().isAnonymous()) {
relationships.add((OWLObjectSomeValuesFrom) conjunct);
}
} else if (conjunct instanceof OWLClass) {
genus = Optional.of((OWLClass) conjunct);
}
}
}
Optional<OWLClassData> visualCls = genus.map(renderingManager::getRendering);
Set<OBORelationship> discriminatingRelationships = relationships.stream().map(relationshipConverter::toOboRelationship).collect(toSet());
return new OBOTermCrossProduct(visualCls, new OBOTermRelationships(discriminatingRelationships));
}
use of edu.stanford.bmir.protege.web.shared.obo.OBOTermCrossProduct in project webprotege by protegeproject.
the class OBOTermCrossProductEditorImpl method getValue.
@Override
public java.util.Optional<OBOTermCrossProduct> getValue() {
if (!genusField.getValue().isPresent()) {
return java.util.Optional.empty();
}
if (!relationshipsField.getValue().isPresent()) {
return java.util.Optional.empty();
}
final OWLClassData genus = (OWLClassData) genusField.getValue().get();
final OBOTermRelationships relationships = new OBOTermRelationships(new HashSet<OBORelationship>(relationshipsField.getValue().get()));
return java.util.Optional.of(new OBOTermCrossProduct(Optional.of(genus), relationships));
}
Aggregations