Search in sources :

Example 1 with OWLClassData

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

Example 2 with OWLClassData

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

the class GetClassFrameActionHandler method execute.

@Nonnull
@Override
public GetClassFrameResult execute(@Nonnull GetClassFrameAction action, @Nonnull ExecutionContext executionContext) {
    OWLClass subject = action.getSubject();
    FrameActionResultTranslator<ClassFrame, OWLClassData> translator = new FrameActionResultTranslator<>(renderingManager, translatorProvider.get(), renderingManager.getRendering(subject));
    LabelledFrame<ClassFrame> f = translator.doIT();
    ProjectId projectId = action.getProjectId();
    logger.info(BROWSING, "{} {} retrieved Class frame for {} ({})", projectId, executionContext.getUserId(), subject, f.getDisplayName());
    return new GetClassFrameResult(f);
}
Also used : OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) GetClassFrameResult(edu.stanford.bmir.protege.web.shared.frame.GetClassFrameResult) ClassFrame(edu.stanford.bmir.protege.web.shared.frame.ClassFrame) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) OWLClass(org.semanticweb.owlapi.model.OWLClass) Nonnull(javax.annotation.Nonnull)

Example 3 with OWLClassData

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

the class NamedIndividualFrameTranslator method translateToAxioms.

private Set<OWLAxiom> translateToAxioms(OWLNamedIndividual subject, NamedIndividualFrame frame, Mode mode) {
    Set<OWLAxiom> result = new HashSet<>();
    for (OWLClassData cls : frame.getClasses()) {
        result.add(DataFactory.get().getOWLClassAssertionAxiom(cls.getEntity(), subject));
    }
    for (PropertyValue propertyValue : frame.getPropertyValues()) {
        AxiomPropertyValueTranslator translator = new AxiomPropertyValueTranslator();
        result.addAll(translator.getAxioms(subject, propertyValue, mode));
    }
    for (OWLNamedIndividualData individual : frame.getSameIndividuals()) {
        result.add(DataFactory.get().getOWLSameIndividualAxiom(subject, individual.getEntity()));
    }
    return result;
}
Also used : OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) PropertyValue(edu.stanford.bmir.protege.web.shared.frame.PropertyValue) OWLNamedIndividualData(edu.stanford.bmir.protege.web.shared.entity.OWLNamedIndividualData) HashSet(java.util.HashSet)

Example 4 with OWLClassData

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

the class NamedIndividualFrameEditor method getValue.

@Override
public Optional<LabelledFrame<NamedIndividualFrame>> getValue() {
    GWT.log("[NamedIndividualFrameEditor] Get value: Dirty: " + isDirty() + " Edited frame: " + editedFrame);
    if (!editedFrame.isPresent()) {
        return Optional.empty();
    }
    PropertyValueList propertyValueList = assertions.getValue().get();
    Set<OWLClassData> rawTypes = getRawTypes();
    Set<OWLNamedIndividualData> sameAs = getRawSameAs();
    NamedIndividualFrame reference = new NamedIndividualFrame(editedFrame.get().getFrame().getSubject(), rawTypes, propertyValueList, sameAs);
    return Optional.of(new LabelledFrame<>(editedFrame.get().getDisplayName(), reference));
}
Also used : OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) NamedIndividualFrame(edu.stanford.bmir.protege.web.shared.frame.NamedIndividualFrame) OWLNamedIndividualData(edu.stanford.bmir.protege.web.shared.entity.OWLNamedIndividualData) PropertyValueList(edu.stanford.bmir.protege.web.shared.frame.PropertyValueList)

Example 5 with OWLClassData

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

the class NamedIndividualFrameEditor method getRawTypes.

private Set<OWLClassData> getRawTypes() {
    Set<OWLClassData> rawTypes = new HashSet<>();
    Optional<List<OWLPrimitiveData>> typesList = types.getValue();
    if (typesList.isPresent()) {
        for (OWLPrimitiveData data : typesList.get()) {
            rawTypes.add((OWLClassData) data);
        }
    }
    return rawTypes;
}
Also used : OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) PropertyValueList(edu.stanford.bmir.protege.web.shared.frame.PropertyValueList) OWLPrimitiveData(edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)

Aggregations

OWLClassData (edu.stanford.bmir.protege.web.shared.entity.OWLClassData)20 HashSet (java.util.HashSet)6 OWLPrimitiveData (edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)5 OBORelationship (edu.stanford.bmir.protege.web.shared.obo.OBORelationship)5 Nonnull (javax.annotation.Nonnull)4 OWLDatatypeData (edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData)3 OWLNamedIndividualData (edu.stanford.bmir.protege.web.shared.entity.OWLNamedIndividualData)3 OWLObjectPropertyData (edu.stanford.bmir.protege.web.shared.entity.OWLObjectPropertyData)3 OBOTermRelationships (edu.stanford.bmir.protege.web.shared.obo.OBOTermRelationships)3 PropertyValue (edu.stanford.bmir.protege.web.shared.frame.PropertyValue)2 PropertyValueList (edu.stanford.bmir.protege.web.shared.frame.PropertyValueList)2 OBOTermCrossProduct (edu.stanford.bmir.protege.web.shared.obo.OBOTermCrossProduct)2 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)2 OWLAxiom (org.semanticweb.owlapi.model.OWLAxiom)2 OWLOntology (org.semanticweb.owlapi.model.OWLOntology)2 AccessManager (edu.stanford.bmir.protege.web.server.access.AccessManager)1 AbstractProjectActionHandler (edu.stanford.bmir.protege.web.server.dispatch.AbstractProjectActionHandler)1 ExecutionContext (edu.stanford.bmir.protege.web.server.dispatch.ExecutionContext)1 RootOntology (edu.stanford.bmir.protege.web.server.inject.project.RootOntology)1 BROWSING (edu.stanford.bmir.protege.web.server.logging.Markers.BROWSING)1