Search in sources :

Example 1 with AnnotationPropertyFrame

use of edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame in project webprotege by protegeproject.

the class AnnotationPropertyFrameTranslator method getFrame.

@Override
public AnnotationPropertyFrame getFrame(OWLAnnotationPropertyData subject) {
    Set<PropertyAnnotationValue> propertyValues = new HashSet<>();
    Set<OWLEntityData> domains = new HashSet<>();
    Set<OWLEntityData> ranges = new HashSet<>();
    for (OWLOntology ont : rootOntology.getImportsClosure()) {
        for (OWLAnnotationAssertionAxiom ax : ont.getAnnotationAssertionAxioms(subject.getEntity().getIRI())) {
            if (!(ax.getValue() instanceof OWLAnonymousIndividual)) {
                propertyValues.add(new PropertyAnnotationValue(renderingManager.getRendering(ax.getProperty()), renderingManager.getRendering(ax.getValue()), State.ASSERTED));
            }
        }
        for (OWLAnnotationPropertyDomainAxiom ax : ont.getAnnotationPropertyDomainAxioms(subject.getEntity())) {
            rootOntology.getEntitiesInSignature(ax.getDomain(), Imports.INCLUDED).stream().map(renderingManager::getRendering).forEach(domains::add);
        }
        for (OWLAnnotationPropertyRangeAxiom ax : ont.getAnnotationPropertyRangeAxioms(subject.getEntity())) {
            rootOntology.getEntitiesInSignature(ax.getRange(), Imports.INCLUDED).stream().map(renderingManager::getRendering).forEach(ranges::add);
        }
    }
    return new AnnotationPropertyFrame(renderingManager.getRendering(subject.getEntity()), propertyValues, domains, ranges);
}
Also used : OWLEntityData(edu.stanford.bmir.protege.web.shared.entity.OWLEntityData) PropertyAnnotationValue(edu.stanford.bmir.protege.web.shared.frame.PropertyAnnotationValue) AnnotationPropertyFrame(edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame) HashSet(java.util.HashSet)

Example 2 with AnnotationPropertyFrame

use of edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame in project webprotege by protegeproject.

the class AnnotationPropertyFrameEditor method getValue.

@Override
public Optional<LabelledFrame<AnnotationPropertyFrame>> getValue() {
    if (!lastFrame.isPresent()) {
        return Optional.empty();
    }
    final Set<OWLEntityData> domainsClasses = Sets.newHashSet();
    for (OWLPrimitiveData data : domains.getValue().get()) {
        domainsClasses.add((OWLClassData) data);
    }
    final Set<OWLEntityData> rangeTypes = Sets.newHashSet();
    for (OWLPrimitiveData data : ranges.getValue().get()) {
        rangeTypes.add((OWLEntityData) data);
    }
    AnnotationPropertyFrame frame = new AnnotationPropertyFrame(lastFrame.get().getFrame().getSubject(), annotations.getValue().get().getAnnotationPropertyValues(), domainsClasses, rangeTypes);
    return Optional.of(new LabelledFrame<>(lastFrame.get().getDisplayName(), frame));
}
Also used : OWLEntityData(edu.stanford.bmir.protege.web.shared.entity.OWLEntityData) OWLPrimitiveData(edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData) AnnotationPropertyFrame(edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame)

Example 3 with AnnotationPropertyFrame

use of edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame in project webprotege by protegeproject.

the class AnnotationPropertyFrameEditor method setValue.

@Override
public void setValue(LabelledFrame<AnnotationPropertyFrame> object) {
    dirty = false;
    lastFrame = Optional.of(object);
    entityDisplay.setDisplayedEntity(java.util.Optional.of(object.getFrame().getSubject()));
    final AnnotationPropertyFrame frame = object.getFrame();
    String decodedIri = URL.decode(object.getFrame().getSubject().getEntity().getIRI().toString());
    iriField.setValue(decodedIri);
    annotations.setValue(frame.getPropertyValueList());
    domains.setValue(new ArrayList<>(frame.getDomains()));
    ranges.setValue(new ArrayList<>(frame.getRanges()));
}
Also used : AnnotationPropertyFrame(edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame)

Example 4 with AnnotationPropertyFrame

use of edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame in project webprotege by protegeproject.

the class GetAnnotationPropertyFrameActionHandler method execute.

@Nonnull
@Override
public GetAnnotationPropertyFrameResult execute(@Nonnull GetAnnotationPropertyFrameAction action, @Nonnull ExecutionContext executionContext) {
    AnnotationPropertyFrameTranslator translator = new AnnotationPropertyFrameTranslator(renderingManager, rootOntology);
    AnnotationPropertyFrame frame = translator.getFrame(renderingManager.getRendering(action.getSubject()));
    String label = renderingManager.getBrowserText(action.getSubject());
    LabelledFrame<AnnotationPropertyFrame> labelledFrame = new LabelledFrame<>(label, frame);
    logger.info(BROWSING, "{} {} retrieved AnnotationProperty frame for {} ({})", action.getProjectId(), executionContext.getUserId(), action.getSubject(), labelledFrame.getDisplayName());
    return new GetAnnotationPropertyFrameResult(labelledFrame);
}
Also used : LabelledFrame(edu.stanford.bmir.protege.web.shared.frame.LabelledFrame) GetAnnotationPropertyFrameResult(edu.stanford.bmir.protege.web.shared.frame.GetAnnotationPropertyFrameResult) AnnotationPropertyFrame(edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame) Nonnull(javax.annotation.Nonnull)

Aggregations

AnnotationPropertyFrame (edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame)4 OWLEntityData (edu.stanford.bmir.protege.web.shared.entity.OWLEntityData)2 OWLPrimitiveData (edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)1 GetAnnotationPropertyFrameResult (edu.stanford.bmir.protege.web.shared.frame.GetAnnotationPropertyFrameResult)1 LabelledFrame (edu.stanford.bmir.protege.web.shared.frame.LabelledFrame)1 PropertyAnnotationValue (edu.stanford.bmir.protege.web.shared.frame.PropertyAnnotationValue)1 HashSet (java.util.HashSet)1 Nonnull (javax.annotation.Nonnull)1