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