use of edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData in project webprotege by protegeproject.
the class DataPropertyFrameEditor method getValue.
@Override
public Optional<LabelledFrame<DataPropertyFrame>> getValue() {
if (!lastDataPropertyFrame.isPresent()) {
return Optional.empty();
}
final Set<OWLClassData> domainsClasses = Sets.newHashSet();
if (domains.getValue().isPresent()) {
for (OWLPrimitiveData primitiveData : domains.getValue().get()) {
domainsClasses.add(((OWLClassData) primitiveData));
}
}
final Set<OWLDatatypeData> rangeTypes = Sets.newHashSet();
if (ranges.getValue().isPresent()) {
for (OWLPrimitiveData primitiveData : ranges.getValue().get()) {
rangeTypes.add(((OWLDatatypeData) primitiveData));
}
}
DataPropertyFrame frame = new DataPropertyFrame(lastDataPropertyFrame.get().getFrame().getSubject(), annotations.getValue().get(), domainsClasses, rangeTypes, functionalCheckBox.getValue());
return Optional.of(new LabelledFrame<>(lastDataPropertyFrame.get().getDisplayName(), frame));
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData 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.OWLDatatypeData 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;
}
Aggregations