use of org.semanticweb.owlapi.model.OWLClass in project osp-validator by open-simulation-platform.
the class VE_AngularMechanicalPort_1 method getInvalidObjects.
@Override
protected List<AngularMechanicalPort> getInvalidObjects() {
OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_AngularMechanicalPort_1, context.owl.prefixManager);
Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
return invalidIndividuals.stream().map(individual -> (AngularMechanicalPort) context.variableGroups.get(individual)).collect(Collectors.toList());
}
use of org.semanticweb.owlapi.model.OWLClass in project osp-validator by open-simulation-platform.
the class VE_Charge_1 method getInvalidObjects.
@Override
protected List<Charge> getInvalidObjects() {
OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Charge_1, context.owl.prefixManager);
Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
return invalidIndividuals.stream().map(individual -> (Charge) context.variableGroups.get(individual)).collect(Collectors.toList());
}
use of org.semanticweb.owlapi.model.OWLClass in project osp-validator by open-simulation-platform.
the class VE_Charge_2 method getInvalidObjects.
@Override
protected List<Charge> getInvalidObjects() {
OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Charge_2, context.owl.prefixManager);
Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
return invalidIndividuals.stream().map(individual -> (Charge) context.variableGroups.get(individual)).collect(Collectors.toList());
}
use of org.semanticweb.owlapi.model.OWLClass in project onto-viewer by edmcouncil.
the class OwlDataHandler method handleInheritedAxioms.
// /**
// * This method is used to handle Inherited Axioms
// *
// * @param ontology Paramter which loaded ontology.
// * @param clazz Clazz are all properties of Inherited Axioms.
// * @return Class and properties of Inherited Axioms.
// */
private OwlDetailsProperties<PropertyValue> handleInheritedAxioms(OWLOntology ontology, OWLClass clazz) {
OwlDetailsProperties<PropertyValue> result = new OwlDetailsProperties<>();
String subClassOfKey = ViewerIdentifierFactory.createId(ViewerIdentifierFactory.Type.axiom, "SubClassOf");
String equivalentClassKey = ViewerIdentifierFactory.createId(ViewerIdentifierFactory.Type.axiom, "EquivalentClasses");
String key = ViewerIdentifierFactory.createId(ViewerIdentifierFactory.Type.function, OwlType.ANONYMOUS_ANCESTOR.name().toLowerCase());
Set<OWLClassExpression> alreadySeen = new HashSet<>();
Set<OWLClass> rset = owlUtils.getSuperClasses(clazz, ontology, alreadySeen);
Map<IRI, Set<OwlAxiomPropertyValue>> values = new HashMap<>();
rset.stream().forEachOrdered((c) -> {
OwlDetailsProperties<PropertyValue> handleAxioms = handleAxioms(c, ontology);
for (Map.Entry<String, List<PropertyValue>> entry : handleAxioms.getProperties().entrySet()) {
if (entry.getKey().equals(subClassOfKey) || entry.getKey().equals(equivalentClassKey)) {
for (PropertyValue propertyValue : entry.getValue()) {
if (propertyValue.getType() != OwlType.TAXONOMY) {
if (entry.getKey().equals(equivalentClassKey)) {
OwlAxiomPropertyValue opv = (OwlAxiomPropertyValue) propertyValue;
String val = opv.getValue();
String[] value = val.split(" ");
value[0] = value[1] = "";
val = String.join(" ", value);
opv.setValue(val);
}
OwlAxiomPropertyValue opv = (OwlAxiomPropertyValue) propertyValue;
Set<OwlAxiomPropertyValue> owlAxiomPropertyValues = values.getOrDefault(c.getIRI(), new LinkedHashSet<>());
owlAxiomPropertyValues.add(opv);
values.put(c.getIRI(), owlAxiomPropertyValues);
}
}
}
}
});
StringBuilder sb = new StringBuilder();
for (Map.Entry<IRI, Set<OwlAxiomPropertyValue>> entry : values.entrySet()) {
OwlAxiomPropertyValue opv = new OwlAxiomPropertyValue();
sb.append("%arg00%").append(" <br />");
int i = 0;
for (OwlAxiomPropertyValue owlAxiomPropertyValue : entry.getValue()) {
i++;
sb.append("- ").append(owlAxiomPropertyValue.getValue());
if (i < entry.getValue().size()) {
sb.append("<br />");
}
for (Map.Entry<String, OwlAxiomPropertyEntity> mapping : owlAxiomPropertyValue.getEntityMaping().entrySet()) {
opv.addEntityValues(mapping.getKey(), mapping.getValue());
}
}
OwlAxiomPropertyEntity prop = new OwlAxiomPropertyEntity();
prop.setIri(entry.getKey().toString());
prop.setLabel(labelProvider.getLabelOrDefaultFragment(entry.getKey()));
opv.addEntityValues("%arg00%", prop);
opv.setValue(sb.toString());
opv.setType(OwlType.AXIOM);
sb = new StringBuilder();
String fullRenderedString = parseRenderedString(opv);
opv.setFullRenderedString(fullRenderedString);
result.addProperty(key, opv);
}
result.sortPropertiesInAlphabeticalOrder();
return result;
}
use of org.semanticweb.owlapi.model.OWLClass in project onto-viewer by edmcouncil.
the class IndividualDataHandler method handleClassIndividuals.
/**
* Handle all individual for OWLClass given on parameter.
*
* @param ontology
* @param clazz
* @return
*/
public OwlDetailsProperties<PropertyValue> handleClassIndividuals(OWLOntology ontology, OWLClass clazz) {
OwlDetailsProperties<PropertyValue> result = new OwlDetailsProperties<>();
Set<OWLNamedIndividual> listOfIndividuals = ontology.importsClosure().flatMap(currentOntology -> getInstancesByClass(currentOntology, clazz).stream()).collect(Collectors.toSet());
for (OWLNamedIndividual namedIndividual : listOfIndividuals) {
OwlListElementIndividualProperty s = new OwlListElementIndividualProperty();
s.setType(OwlType.INSTANCES);
String label = labelExtractor.getLabelOrDefaultFragment(namedIndividual);
s.setValue(new PairImpl(label, namedIndividual.getIRI().toString()));
result.addProperty(instanceKey, s);
namedIndividual.getEntityType();
}
return result;
}
Aggregations