OntologyResourceHelper orh = engine.getOntologyResourceHelper();
if (predicateName.equals("child")) {
// find all child nodes of the parentMode
for (DObject childObject : parentObject.getChildren()) {
OntClass childClass = orh.createOntClassByCMSObject(childObject.getInstance());
if (childClass != null) {
orh.addSubsumptionAssertion(parentClass, childClass);
} else {
logger.warn("Failed to create OntClass for child object {} while processing CMS Object",
childObject.getName(), parentObject.getName());
}
}
} else {
// find the ranges of the predicate whose subject is parentNode
for (DProperty property : parentObject.getProperties()) {
DPropertyDefinition propDef = property.getDefinition();
// propDef returns null if a * named property comes
// TODO after handling * named properties, remove the null check
if (propDef == null) {
logger.warn("Property definition could not be got for property {}", property.getName());
continue;
}
String propName = propDef.getName();
if (propName.equals(predicateName) || propName.contains(predicateName)) {
List<CMSObject> referencedObjects = propertyBridgeProcessor.resolveReferenceNodes(
property, engine);
for (CMSObject o : referencedObjects) {
OntClass childClass = orh.createOntClassByCMSObject(o);
if (childClass != null) {
orh.addSubsumptionAssertion(parentClass, childClass);
} else {
logger.warn(
"Failed to create OntClass for referenced object {} while processing {}",