use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class TermRelationshipsManager method getRelationships.
public OBOTermRelationships getRelationships(OWLClass term) {
OWLClass cls = dataFactory.getOWLClass(term.getIRI());
Set<OWLSubClassOfAxiom> subClassOfAxioms = rootOntology.getSubClassAxiomsForSubClass(cls);
Set<OBORelationship> rels = new HashSet<>();
for (OWLSubClassOfAxiom ax : subClassOfAxioms) {
Set<OWLObjectSomeValuesFrom> relationships = new HashSet<>();
Set<OWLClassExpression> conjuncts = ax.getSuperClass().asConjunctSet();
for (OWLClassExpression conjunct : conjuncts) {
if (conjunct instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom) conjunct;
if (!svf.getProperty().isAnonymous() && !svf.getFiller().isAnonymous()) {
relationships.add((OWLObjectSomeValuesFrom) conjunct);
}
}
}
if (relationships.size() == conjuncts.size()) {
for (OWLObjectSomeValuesFrom rel : relationships) {
OWLObjectPropertyData property = renderingManager.getRendering(rel.getProperty().asOWLObjectProperty());
OWLClassData filler = renderingManager.getRendering(rel.getFiller().asOWLClass());
OBORelationship oboRel = new OBORelationship(property, filler);
rels.add(oboRel);
}
}
}
return new OBOTermRelationships(rels);
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class DataPropertyFrameTranslator method getFrame.
@Override
public DataPropertyFrame getFrame(OWLDataPropertyData subject) {
Set<OWLAxiom> propertyValueAxioms = new HashSet<>();
Set<OWLClassData> domains = new HashSet<>();
Set<OWLDatatypeData> ranges = new HashSet<>();
boolean functional = false;
for (OWLOntology ontology : rootOntology.getImportsClosure()) {
propertyValueAxioms.addAll(ontology.getAnnotationAssertionAxioms(subject.getEntity().getIRI()));
for (OWLDataPropertyDomainAxiom ax : ontology.getDataPropertyDomainAxioms(subject.getEntity())) {
if (!ax.getDomain().isAnonymous()) {
domains.add(renderingManager.getRendering(ax.getDomain().asOWLClass()));
}
}
for (OWLDataPropertyRangeAxiom ax : ontology.getDataPropertyRangeAxioms(subject.getEntity())) {
if (ax.getRange().isDatatype()) {
ranges.add(renderingManager.getRendering(ax.getRange().asOWLDatatype()));
}
}
if (EntitySearcher.isFunctional(subject.getEntity(), ontology)) {
functional = true;
}
}
Set<PropertyValue> propertyValues = new HashSet<>();
AxiomPropertyValueTranslator translator = new AxiomPropertyValueTranslator();
for (OWLAxiom ax : propertyValueAxioms) {
propertyValues.addAll(translator.getPropertyValues(subject.getEntity(), ax, rootOntology, State.ASSERTED, renderingManager));
}
PropertyValueList pvl = new PropertyValueList(propertyValues);
return new DataPropertyFrame(subject, pvl, domains, ranges, functional);
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class DataPropertyFrameTranslator method getAxioms.
@Override
public Set<OWLAxiom> getAxioms(DataPropertyFrame frame, Mode mode) {
Set<OWLAxiom> result = new HashSet<>();
for (PropertyAnnotationValue pv : frame.getAnnotationPropertyValues()) {
AxiomPropertyValueTranslator translator = new AxiomPropertyValueTranslator();
result.addAll(translator.getAxioms(frame.getSubject().getEntity(), pv, mode));
}
for (OWLClassData domain : frame.getDomains()) {
OWLAxiom ax = DataFactory.get().getOWLDataPropertyDomainAxiom(frame.getSubject().getEntity(), domain.getEntity());
result.add(ax);
}
for (OWLDatatypeData range : frame.getRanges()) {
OWLAxiom ax = DataFactory.get().getOWLDataPropertyRangeAxiom(frame.getSubject().getEntity(), range.getEntity());
result.add(ax);
}
if (frame.isFunctional()) {
result.add(DataFactory.get().getOWLFunctionalDataPropertyAxiom(frame.getSubject().getEntity()));
}
return result;
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class ObjectPropertyFrameEditor method getValue.
@Override
public Optional<LabelledFrame<ObjectPropertyFrame>> getValue() {
if (!previouslySetValue.isPresent()) {
return previouslySetValue;
}
Set<PropertyAnnotationValue> annotationValueSet = new HashSet<PropertyAnnotationValue>();
annotationValueSet.addAll(annotations.getValue().get().getAnnotationPropertyValues());
final ObjectPropertyFrame previousFrame = previouslySetValue.get().getFrame();
OWLObjectPropertyData subject = previousFrame.getSubject();
List<OWLClassData> editedDomains = Lists.newArrayList();
for (OWLPrimitiveData data : domains.getValue().get()) {
editedDomains.add((OWLClassData) data);
}
List<OWLClassData> editedRanges = Lists.newArrayList();
for (OWLPrimitiveData data : ranges.getValue().get()) {
editedRanges.add((OWLClassData) data);
}
ObjectPropertyFrame frame = new ObjectPropertyFrame(subject, annotationValueSet, new HashSet<>(editedDomains), new HashSet<>(editedRanges), Collections.emptySet(), characteristics);
return Optional.of(new LabelledFrame<>(previouslySetValue.get().getDisplayName(), frame));
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class ClassFrameEditor method getValue.
@Override
public Optional<LabelledFrame<ClassFrame>> getValue() {
if (currentSubject == null) {
return Optional.empty();
} else {
Set<OWLClassData> classesData = new HashSet<>();
for (OWLPrimitiveData cls : classes.getValue().get()) {
classesData.add((OWLClassData) cls);
}
Set<PropertyValue> propertyValues = new TreeSet<>();
propertyValues.addAll(annotations.getValue().get().getPropertyValues());
propertyValues.addAll(properties.getValue().get().getPropertyValues());
ClassFrame cf = new ClassFrame(currentSubject, classesData, propertyValues);
LabelledFrame<ClassFrame> labelledClassFrame = new LabelledFrame<>(lastClassFrame.getDisplayName(), cf);
return Optional.of(labelledClassFrame);
}
}
Aggregations