Search in sources :

Example 1 with PropertyAnnotationValue

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

the class AnnotationsViewImpl method setValue.

@Override
public void setValue(Set<PropertyAnnotationValue> object) {
    List<PropertyAnnotationValue> values = new ArrayList<>();
    for (PropertyAnnotationValue annotation : object) {
        values.add(new PropertyAnnotationValue(annotation.getProperty(), annotation.getValue(), State.ASSERTED));
    }
    editor.setValue(new PropertyValueList(values));
}
Also used : PropertyValueList(edu.stanford.bmir.protege.web.shared.frame.PropertyValueList) PropertyAnnotationValue(edu.stanford.bmir.protege.web.shared.frame.PropertyAnnotationValue)

Example 2 with PropertyAnnotationValue

use of edu.stanford.bmir.protege.web.shared.frame.PropertyAnnotationValue 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 3 with PropertyAnnotationValue

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

the class GetOntologyAnnotationsActionHandler method execute.

@Nonnull
@Override
public GetOntologyAnnotationsResult execute(@Nonnull GetOntologyAnnotationsAction action, @Nonnull ExecutionContext executionContext) {
    List<OWLAnnotation> result = new ArrayList<>(rootOntology.getAnnotations());
    ImmutableList.Builder<PropertyAnnotationValue> annotationValues = ImmutableList.builder();
    result.stream().map(annotation -> new PropertyAnnotationValue(renderingManager.getRendering(annotation.getProperty()), renderingManager.getRendering(annotation.getValue()), State.ASSERTED)).sorted(propertyValueComparator).forEach(annotationValues::add);
    return new GetOntologyAnnotationsResult(annotationValues.build());
}
Also used : GetOntologyAnnotationsResult(edu.stanford.bmir.protege.web.shared.dispatch.actions.GetOntologyAnnotationsResult) OWLAnnotation(org.semanticweb.owlapi.model.OWLAnnotation) ImmutableList(com.google.common.collect.ImmutableList) ArrayList(java.util.ArrayList) PropertyAnnotationValue(edu.stanford.bmir.protege.web.shared.frame.PropertyAnnotationValue) Nonnull(javax.annotation.Nonnull)

Example 4 with PropertyAnnotationValue

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

the class AnnotationsViewImpl method getValue.

@Override
public Optional<Set<PropertyAnnotationValue>> getValue() {
    Optional<PropertyValueList> valueList = editor.getValue();
    if (!valueList.isPresent()) {
        return Optional.empty();
    }
    Set<PropertyAnnotationValue> result = new HashSet<PropertyAnnotationValue>();
    for (PropertyAnnotationValue value : valueList.get().getAnnotationPropertyValues()) {
        result.add(value);
    }
    return Optional.of(result);
}
Also used : PropertyValueList(edu.stanford.bmir.protege.web.shared.frame.PropertyValueList) PropertyAnnotationValue(edu.stanford.bmir.protege.web.shared.frame.PropertyAnnotationValue)

Example 5 with PropertyAnnotationValue

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

the class OntologyAnnotationsPortletPresenter method updateView.

private void updateView() {
    dispatchServiceManager.execute(new GetOntologyAnnotationsAction(getProjectId()), result -> {
        LinkedHashSet<PropertyAnnotationValue> object = new LinkedHashSet<>(result.getAnnotations());
        if (!lastSet.isPresent() || !annotationsView.getValue().equals(Optional.of(object))) {
            lastSet = Optional.of(new ArrayList<>(object));
            annotationsView.setValue(object);
        }
    });
}
Also used : GetOntologyAnnotationsAction(edu.stanford.bmir.protege.web.shared.dispatch.actions.GetOntologyAnnotationsAction) PropertyAnnotationValue(edu.stanford.bmir.protege.web.shared.frame.PropertyAnnotationValue)

Aggregations

PropertyAnnotationValue (edu.stanford.bmir.protege.web.shared.frame.PropertyAnnotationValue)6 PropertyValueList (edu.stanford.bmir.protege.web.shared.frame.PropertyValueList)2 ArrayList (java.util.ArrayList)2 ImmutableList (com.google.common.collect.ImmutableList)1 FixedChangeListGenerator (edu.stanford.bmir.protege.web.server.change.FixedChangeListGenerator)1 RenameMap (edu.stanford.bmir.protege.web.server.owlapi.RenameMap)1 GetOntologyAnnotationsAction (edu.stanford.bmir.protege.web.shared.dispatch.actions.GetOntologyAnnotationsAction)1 GetOntologyAnnotationsResult (edu.stanford.bmir.protege.web.shared.dispatch.actions.GetOntologyAnnotationsResult)1 OWLEntityData (edu.stanford.bmir.protege.web.shared.entity.OWLEntityData)1 AnnotationPropertyFrame (edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Nonnull (javax.annotation.Nonnull)1 OWLAnnotation (org.semanticweb.owlapi.model.OWLAnnotation)1