use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class ClassFrame method toString.
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("ClassFrame");
sb.append("(");
sb.append(subject);
sb.append(" Classes(");
for (Iterator<OWLClassData> it = classEntries.iterator(); it.hasNext(); ) {
OWLClassData entry = it.next();
sb.append(entry);
if (it.hasNext()) {
sb.append(" ");
}
}
sb.append(") ");
sb.append("PropertyValues(");
for (Iterator<PropertyValue> it = propertyValues.iterator(); it.hasNext(); ) {
PropertyValue pv = it.next();
sb.append(pv);
if (it.hasNext()) {
sb.append(" ");
}
}
sb.append(")");
sb.append(")");
return sb.toString();
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class ObjectPropertyFrameTranslator method getAxioms.
@Override
public Set<OWLAxiom> getAxioms(ObjectPropertyFrame 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().getOWLObjectPropertyDomainAxiom(frame.getSubject().getEntity(), domain.getEntity());
result.add(ax);
}
for (OWLClassData range : frame.getRanges()) {
OWLAxiom ax = DataFactory.get().getOWLObjectPropertyRangeAxiom(frame.getSubject().getEntity(), range.getEntity());
result.add(ax);
}
for (ObjectPropertyCharacteristic characteristic : frame.getCharacteristics()) {
OWLAxiom ax = characteristic.createAxiom(frame.getSubject().getEntity(), DataFactory.get());
result.add(ax);
}
return result;
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class GetIndividualsActionHandler method execute.
@Nonnull
@Override
public GetIndividualsResult execute(@Nonnull GetIndividualsAction action, @Nonnull ExecutionContext executionContext) {
Stream<OWLNamedIndividual> stream;
if (action.getType().isOWLThing()) {
stream = rootOntology.getIndividualsInSignature(Imports.INCLUDED).stream();
} else {
stream = rootOntology.getImportsClosure().stream().flatMap(o -> o.getClassAssertionAxioms(action.getType()).stream()).map(OWLClassAssertionAxiom::getIndividual).filter(OWLIndividual::isNamed).map(OWLIndividual::asOWLNamedIndividual);
}
Counter counter = new Counter();
List<OWLNamedIndividualData> individualsData = stream.peek(i -> counter.increment()).map(renderingManager::getRendering).filter(i -> {
String searchString = action.getFilterString();
return searchString.isEmpty() || StringUtils.containsIgnoreCase(i.getBrowserText(), searchString);
}).distinct().sorted().collect(toList());
PageRequest pageRequest = action.getPageRequest();
Pager<OWLNamedIndividualData> pager = Pager.getPagerForPageSize(individualsData, pageRequest.getPageSize());
Page<OWLNamedIndividualData> page = pager.getPage(pageRequest.getPageNumber());
OWLClassData type = renderingManager.getRendering(action.getType());
logger.info(BROWSING, "{} {} retrieved instances of {} ({})", projectId, executionContext.getUserId(), action.getType(), renderingManager.getRendering(action.getType()).getBrowserText());
return new GetIndividualsResult(type, page, counter.getCount(), individualsData.size());
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class TermCrossProductsManager method setCrossProduct.
public void setCrossProduct(@Nonnull UserId userId, @Nonnull OWLClass term, @Nonnull OBOTermCrossProduct crossProduct) {
Set<OWLClassExpression> intersectionOperands = new HashSet<>();
Optional<OWLClassData> genus = crossProduct.getGenus();
if (genus.isPresent()) {
OWLClass cls = genus.get().getEntity();
intersectionOperands.add(cls);
}
for (OBORelationship relationship : crossProduct.getRelationships().getRelationships()) {
OWLObjectSomeValuesFrom someValuesFrom = relationshipConverter.toSomeValuesFrom(relationship);
intersectionOperands.add(someValuesFrom);
}
OWLObjectIntersectionOf intersectionOf = df.getOWLObjectIntersectionOf(intersectionOperands);
OWLEquivalentClassesAxiom newXPAxiom = df.getOWLEquivalentClassesAxiom(term, intersectionOf);
Optional<OWLEquivalentClassesAxiom> existingXPAxiom = getCrossProductEquivalentClassesAxiom(term);
List<OWLOntologyChange> changes = new ArrayList<>();
changes.add(new AddAxiom(rootOntology, newXPAxiom));
existingXPAxiom.ifPresent(ax -> changes.add(new RemoveAxiom(rootOntology, ax)));
changeManager.applyChanges(userId, new FixedChangeListGenerator<>(changes, term, "Set cross product values"));
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLClassData in project webprotege by protegeproject.
the class RelationshipConverter method toOboRelationship.
@Nonnull
public OBORelationship toOboRelationship(@Nonnull OWLObjectSomeValuesFrom someValuesFrom) {
OWLObjectPropertyData property = renderingManager.getRendering(someValuesFrom.getProperty().asOWLObjectProperty());
OWLClassData filler = renderingManager.getRendering(someValuesFrom.getFiller().asOWLClass());
return new OBORelationship(property, filler);
}
Aggregations