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());
   }
 }
Ejemplo n.º 2
0
 public void testUndocreateCls() {
   Cls cls = createCls();
   String name = cls.getName();
   assertNotNull("name", name);
   Frame frame = getFrame(name);
   assertEquals("created", cls, frame);
   assertTrue("can undo", _frameStore.canUndo());
   _frameStore.undo();
   frame = getFrame(name);
   assertNull("undone", frame);
   _frameStore.redo();
   frame = getFrame(name);
   assertEquals("recreated", frame.getName(), name);
 }
 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);
   }
 }