edu.stanford.smi.protegex.owl.model.framestore
Class CardinalityRestrictionUpdater

java.lang.Object
  extended byedu.stanford.smi.protegex.owl.model.framestore.AbstractRestrictionUpdater
      extended byedu.stanford.smi.protegex.owl.model.framestore.CardinalityRestrictionUpdater
All Implemented Interfaces:
RestrictionUpdater

class CardinalityRestrictionUpdater
extends AbstractRestrictionUpdater


Field Summary
private  edu.stanford.smi.protege.model.Facet maxCardinalityFacet
           
private  edu.stanford.smi.protege.model.Facet minCardinalityFacet
           
protected  AbstractOWLModel owlModel
          The OWLModel this operates on
 
Constructor Summary
(package private) CardinalityRestrictionUpdater(AbstractOWLModel owlModel)
           
 
Method Summary
 void copyFacetValuesIntoNamedClass(RDFSNamedClass cls, OWLRestriction restriction)
           
private  OWLCardinalityBase createCardinalityRestriction(RDFProperty property, edu.stanford.smi.protege.model.Facet facet, int cardinality)
           
private  void ensureCardinalityRestriction(edu.stanford.smi.protege.model.Cls cls, RDFProperty property, edu.stanford.smi.protege.model.Facet facet)
           
private  edu.stanford.smi.protege.model.Cls getCardinalityRestrictionCls(edu.stanford.smi.protege.model.Facet facet)
           
protected  edu.stanford.smi.protege.model.Cls getDirectRestriction(edu.stanford.smi.protege.model.Cls cls, edu.stanford.smi.protege.model.Slot slot, Class metaClass)
           
protected  Collection getDirectRestrictions(edu.stanford.smi.protege.model.Cls cls, edu.stanford.smi.protege.model.Slot slot, Class metaClass)
           
private  boolean hasCardinalityRestriction(edu.stanford.smi.protege.model.Cls cls, edu.stanford.smi.protege.model.Slot slot, edu.stanford.smi.protege.model.Cls metaCls, int cardinality)
           
private  boolean hasCardinalityRestriction(edu.stanford.smi.protege.model.Cls cls, edu.stanford.smi.protege.model.Slot slot, edu.stanford.smi.protege.model.Facet facet, int cardinality)
           
protected  void log(String message)
           
protected  void removeRestrictions(edu.stanford.smi.protege.model.Cls cls, edu.stanford.smi.protege.model.Slot slot, edu.stanford.smi.protege.model.Cls metaCls)
           
private  void updateBothCardinalityFacets(RDFSNamedClass cls, edu.stanford.smi.protege.model.Slot slot)
           
private  void updateCardinalityRestrictions(edu.stanford.smi.protege.model.Cls cls, RDFProperty slot, edu.stanford.smi.protege.model.Facet changedFacet, edu.stanford.smi.protege.model.Facet otherFacet)
          Updates or creates CardinalityRestrictions in response to a change in either max or min cardinality facet.
protected  void updateMaximumCardinalityFacet(RDFSNamedClass cls, edu.stanford.smi.protege.model.Slot slot)
           
protected  void updateMinimumCardinalityFacet(RDFSNamedClass cls, edu.stanford.smi.protege.model.Slot slot)
           
 void updateRestrictions(OWLNamedClass cls, RDFProperty property, edu.stanford.smi.protege.model.Facet facet)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxCardinalityFacet

private edu.stanford.smi.protege.model.Facet maxCardinalityFacet

minCardinalityFacet

private edu.stanford.smi.protege.model.Facet minCardinalityFacet

owlModel

protected AbstractOWLModel owlModel
The OWLModel this operates on

Constructor Detail

CardinalityRestrictionUpdater

CardinalityRestrictionUpdater(AbstractOWLModel owlModel)
Method Detail

createCardinalityRestriction

private OWLCardinalityBase createCardinalityRestriction(RDFProperty property,
                                                        edu.stanford.smi.protege.model.Facet facet,
                                                        int cardinality)

ensureCardinalityRestriction

private void ensureCardinalityRestriction(edu.stanford.smi.protege.model.Cls cls,
                                          RDFProperty property,
                                          edu.stanford.smi.protege.model.Facet facet)

getCardinalityRestrictionCls

private edu.stanford.smi.protege.model.Cls getCardinalityRestrictionCls(edu.stanford.smi.protege.model.Facet facet)

hasCardinalityRestriction

private boolean hasCardinalityRestriction(edu.stanford.smi.protege.model.Cls cls,
                                          edu.stanford.smi.protege.model.Slot slot,
                                          edu.stanford.smi.protege.model.Facet facet,
                                          int cardinality)

hasCardinalityRestriction

private boolean hasCardinalityRestriction(edu.stanford.smi.protege.model.Cls cls,
                                          edu.stanford.smi.protege.model.Slot slot,
                                          edu.stanford.smi.protege.model.Cls metaCls,
                                          int cardinality)

updateBothCardinalityFacets

private void updateBothCardinalityFacets(RDFSNamedClass cls,
                                         edu.stanford.smi.protege.model.Slot slot)

updateCardinalityRestrictions

private void updateCardinalityRestrictions(edu.stanford.smi.protege.model.Cls cls,
                                           RDFProperty slot,
                                           edu.stanford.smi.protege.model.Facet changedFacet,
                                           edu.stanford.smi.protege.model.Facet otherFacet)
Updates or creates CardinalityRestrictions in response to a change in either max or min cardinality facet. Depending on the situation this does the following:

a) MAX has changed and MAX != MIN: - Replace MaxCardiRestrictions - Remove CardiRestrictions - If defined then replace MinCardiRestrictions b) MAX has changed and MAX == MIN - Remove MaxCardiRestrictions - Remove MinCardiRestrictions - Replace CardiRestrictions c) MAX was deleted - Remove MaxCardiRestrictions - Remove CardiRestrictions - If defined then replace MinCardiRestrictions

Parameters:
cls - the Cls where the facet has changed
slot - the Slot that has changed
changedFacet - the Facet that has changed
otherFacet - the inverse Facet to changedFacet (unchanged)

updateMaximumCardinalityFacet

protected void updateMaximumCardinalityFacet(RDFSNamedClass cls,
                                             edu.stanford.smi.protege.model.Slot slot)

updateMinimumCardinalityFacet

protected void updateMinimumCardinalityFacet(RDFSNamedClass cls,
                                             edu.stanford.smi.protege.model.Slot slot)

copyFacetValuesIntoNamedClass

public void copyFacetValuesIntoNamedClass(RDFSNamedClass cls,
                                          OWLRestriction restriction)

updateRestrictions

public void updateRestrictions(OWLNamedClass cls,
                               RDFProperty property,
                               edu.stanford.smi.protege.model.Facet facet)

getDirectRestriction

protected edu.stanford.smi.protege.model.Cls getDirectRestriction(edu.stanford.smi.protege.model.Cls cls,
                                                                  edu.stanford.smi.protege.model.Slot slot,
                                                                  Class metaClass)

getDirectRestrictions

protected Collection getDirectRestrictions(edu.stanford.smi.protege.model.Cls cls,
                                           edu.stanford.smi.protege.model.Slot slot,
                                           Class metaClass)

log

protected void log(String message)

removeRestrictions

protected void removeRestrictions(edu.stanford.smi.protege.model.Cls cls,
                                  edu.stanford.smi.protege.model.Slot slot,
                                  edu.stanford.smi.protege.model.Cls metaCls)