Search in sources :

Example 1 with OWLObjectPropertyData

use of edu.stanford.bmir.protege.web.shared.entity.OWLObjectPropertyData 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);
}
Also used : OWLObjectPropertyData(edu.stanford.bmir.protege.web.shared.entity.OWLObjectPropertyData) OBOTermRelationships(edu.stanford.bmir.protege.web.shared.obo.OBOTermRelationships) OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) OBORelationship(edu.stanford.bmir.protege.web.shared.obo.OBORelationship) HashSet(java.util.HashSet)

Example 2 with OWLObjectPropertyData

use of edu.stanford.bmir.protege.web.shared.entity.OWLObjectPropertyData in project webprotege by protegeproject.

the class ObjectPropertyFrameEditor method getValue.

@Override
public Optional<LabelledFrame<ObjectPropertyFrame>> getValue() {
    if (!previouslySetValue.isPresent()) {
        return previouslySetValue;
    }
    Set<PropertyAnnotationValue> annotationValueSet = new HashSet<PropertyAnnotationValue>();
    annotationValueSet.addAll(annotations.getValue().get().getAnnotationPropertyValues());
    final ObjectPropertyFrame previousFrame = previouslySetValue.get().getFrame();
    OWLObjectPropertyData subject = previousFrame.getSubject();
    List<OWLClassData> editedDomains = Lists.newArrayList();
    for (OWLPrimitiveData data : domains.getValue().get()) {
        editedDomains.add((OWLClassData) data);
    }
    List<OWLClassData> editedRanges = Lists.newArrayList();
    for (OWLPrimitiveData data : ranges.getValue().get()) {
        editedRanges.add((OWLClassData) data);
    }
    ObjectPropertyFrame frame = new ObjectPropertyFrame(subject, annotationValueSet, new HashSet<>(editedDomains), new HashSet<>(editedRanges), Collections.emptySet(), characteristics);
    return Optional.of(new LabelledFrame<>(previouslySetValue.get().getDisplayName(), frame));
}
Also used : OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) OWLObjectPropertyData(edu.stanford.bmir.protege.web.shared.entity.OWLObjectPropertyData) OWLPrimitiveData(edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)

Example 3 with OWLObjectPropertyData

use of edu.stanford.bmir.protege.web.shared.entity.OWLObjectPropertyData 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);
}
Also used : OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) OBORelationship(edu.stanford.bmir.protege.web.shared.obo.OBORelationship) OWLObjectPropertyData(edu.stanford.bmir.protege.web.shared.entity.OWLObjectPropertyData) Nonnull(javax.annotation.Nonnull)

Aggregations

OWLClassData (edu.stanford.bmir.protege.web.shared.entity.OWLClassData)3 OWLObjectPropertyData (edu.stanford.bmir.protege.web.shared.entity.OWLObjectPropertyData)3 OBORelationship (edu.stanford.bmir.protege.web.shared.obo.OBORelationship)2 OWLPrimitiveData (edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)1 OBOTermRelationships (edu.stanford.bmir.protege.web.shared.obo.OBOTermRelationships)1 HashSet (java.util.HashSet)1 Nonnull (javax.annotation.Nonnull)1