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);
}
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));
}
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()));
}
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);
}
Aggregations