private void addAllRestriction(Cls cls, RDFProperty property, Cls allCls) { OWLAllValuesFrom restriction = owlModel.createOWLAllValuesFrom(property, (RDFSClass) allCls); cls.addDirectSuperclass(restriction); if (log.isLoggable(Level.FINE)) { log.fine( "+ OWLAllValuesFrom " + restriction.getBrowserText() + " to " + cls.getName() + "." + property.getName()); } }
protected void updateAllRestrictions(Cls cls, RDFProperty property) { if (cls.hasDirectlyOverriddenTemplateFacet(property, valueTypeFacet)) { ValueType valueType = cls.getTemplateSlotValueType(property); if (valueType == ValueType.INSTANCE) { Collection clses = cls.getTemplateSlotAllowedClses(property); if (clses.size() == 0) { removeRestrictions(cls, property, metaCls); addAllRestriction(cls, property, owlModel.createOWLEnumeratedClass()); } else { ensureNoSurvivingClsesAreDeleted(cls, property, clses, metaCls); if (clses.size() == 1) { Cls allCls = (Cls) clses.iterator().next(); removeRestrictions(cls, property, metaCls); addAllRestriction(cls, property, allCls); } else { OWLUnionClass unionCls = owlModel.createOWLUnionClass(clses); removeRestrictions(cls, property, metaCls); addAllRestriction(cls, property, unionCls); } } } else if (valueType != ValueType.SYMBOL && valueType != ValueType.CLS) { removeRestrictions(cls, property, metaCls); RDFSDatatype datatype = owlModel.getRDFSDatatypeByURI( XMLSchemaDatatypes.getDefaultXSDDatatype(valueType).getURI()); OWLAllValuesFrom restriction = owlModel.createOWLAllValuesFrom(property, datatype); cls.addDirectSuperclass(restriction); if (log.isLoggable(Level.FINE)) { log.fine( "+ OWLAllValuesFrom " + restriction.getBrowserText() + " to " + cls.getName() + "." + property.getName()); } } } else { removeRestrictions(cls, property, metaCls); } }