Protege 3.5

edu.stanford.smi.protege.model.framestore
Class SimpleFrameStore

java.lang.Object
  extended by edu.stanford.smi.protege.model.framestore.SimpleFrameStore
All Implemented Interfaces:
FrameStore
Direct Known Subclasses:
InMemoryFrameStore

public class SimpleFrameStore
extends Object
implements FrameStore


Field Summary
 
Fields inherited from interface edu.stanford.smi.protege.model.framestore.FrameStore
UNLIMITED_MATCHES
 
Constructor Summary
SimpleFrameStore(KnowledgeBase kb, NarrowFrameStore helper)
           
 
Method Summary
protected  void addCls(Cls cls, Collection directTypes, Collection directSuperclasses, boolean loadDefaults)
           
 void addDirectOwnSlotValue(Frame frame, Slot slot, Object value)
           
 void addDirectOwnSlotValues(Frame frame, Slot slot, Collection values)
           
 void addDirectSuperclass(Cls cls, Cls superclass)
           
 void addDirectSuperslot(Slot slot, Slot superslot)
           
 void addDirectTemplateSlot(Cls cls, Slot slot)
           
 void addDirectType(Instance instance, Cls type)
           
protected  void addSlot(Slot slot, Collection directTypes, Collection directSuperslots, boolean loadDefaults)
           
protected  void addSystemFrames()
           
 boolean beginTransaction(String name)
           
 void close()
           
 boolean commitTransaction()
           
protected  Cls createCls(FrameID id, Collection directTypes)
           
 Cls createCls(FrameID id, Collection directTypes, Collection directSuperclasses, boolean loadDefaults)
           
protected  Facet createFacet(FrameID id, Collection directTypes)
           
 Facet createFacet(FrameID id, Collection directTypes, boolean loadDefaults)
           
protected  SimpleInstance createSimpleInstance(FrameID id, Collection directTypes)
           
 SimpleInstance createSimpleInstance(FrameID id, Collection directTypes, boolean loadDefaults)
           
protected  Slot createSlot(FrameID id, Collection directTypes)
           
 Slot createSlot(FrameID id, Collection directTypes, Collection directSuperslots, boolean loadDefaults)
           
 void deleteCls(Cls cls)
          Delete a single leaf class.
 void deleteFacet(Facet facet)
           
 void deleteSimpleInstance(SimpleInstance simpleInstance)
           
 void deleteSlot(Slot slot)
           
static boolean equals(Object o1, Object o2)
           
 void executeQuery(Query query, QueryCallback callback)
          The executeQuery method allows for complex queries.
 int getClsCount()
           
 Set<Cls> getClses()
           
static Collection<Cls> getClsesToBeDeleted(Cls cls, FrameStore fs)
          This method should not be down here in the frame store chain.
 Set<Cls> getClsesWithAnyDirectTemplateSlotValue(Slot slot)
           
 Set getClsesWithDirectTemplateFacetValue(Slot slot, Facet facet, Object value)
           
 Set getClsesWithDirectTemplateSlotValue(Slot slot, Object value)
           
 Set<Cls> getClsesWithMatchingBrowserText(String value, Collection superclasses, int maxMatches)
           
 Set getClsesWithMatchingDirectTemplateFacetValue(Slot slot, Facet facet, String value, int maxMatches)
           
 Set getClsesWithMatchingDirectTemplateSlotValue(Slot slot, String value, int maxMatches)
           
 FrameStore getDelegate()
           
 List getDirectDomain(Slot slot)
           
 List<Instance> getDirectInstances(Cls cls)
           
 Set getDirectlyOverriddenTemplateFacets(Cls cls, Slot slot)
           
 Set getDirectlyOverriddenTemplateSlots(Cls cls)
           
 List getDirectOwnSlotValues(Frame frame, Slot slot)
           
 Set getDirectOwnSlotValuesClosure(Frame frame, Slot slot)
           
 int getDirectOwnSlotValuesCount(Frame frame, Slot slot)
           
 List<Cls> getDirectSubclasses(Cls cls)
           
 List getDirectSubslots(Slot slot)
           
 List<Cls> getDirectSuperclasses(Cls cls)
           
 List getDirectSuperslots(Slot slot)
           
 List getDirectTemplateFacetValues(Cls cls, Slot slot, Facet facet)
           
 List getDirectTemplateSlots(Cls cls)
           
 List getDirectTemplateSlotValues(Cls cls, Slot slot)
           
 List getDirectTypes(Instance instance)
           
 Set getDomain(Slot slot)
           
 List<AbstractEvent> getEvents()
           
 int getFacetCount()
           
 Set<Facet> getFacets()
           
 Frame getFrame(FrameID id)
           
 Frame getFrame(String name)
           
 int getFrameCount()
           
 String getFrameName(Frame frame)
           
 Set<Frame> getFrames()
           
 Set<Frame> getFramesWithAnyDirectOwnSlotValue(Slot slot)
           
 Set<Frame> getFramesWithDirectOwnSlotValue(Slot slot, Object value)
           
 Set<Frame> getFramesWithMatchingDirectOwnSlotValue(Slot slot, String value, int maxMatches)
           
 NarrowFrameStore getHelper()
           
 Set<Instance> getInstances(Cls cls)
           
 Set<Reference> getMatchingReferences(String value, int maxMatches)
           
 String getName()
           
 Set getOverriddenTemplateFacets(Cls cls, Slot slot)
           
 Set getOverriddenTemplateSlots(Cls cls)
           
 Set getOwnFacets(Frame frame, Slot slot)
           
 Collection getOwnFacetValues(Frame frame, Slot slot, Facet facet)
           
 Set<Slot> getOwnSlots(Frame frame)
           
 Collection getOwnSlotValues(Frame frame, Slot slot)
           
 Set<Reference> getReferences(Object value)
           
 int getSimpleInstanceCount()
           
 int getSlotCount()
           
 Set<Slot> getSlots()
           
 Set<Cls> getSubclasses(Cls cls)
           
 Set getSubslots(Slot slot)
           
 Set getSuperclasses(Cls cls)
           
 Set getSuperslots(Slot slot)
           
 Set<Facet> getTemplateFacets(Cls cls, Slot slot)
           
 Collection getTemplateFacetValues(Cls localCls, Slot slot, Facet facet)
           
 Set getTemplateSlots(Cls cls)
           
 Collection getTemplateSlotValues(Cls cls, Slot slot)
           
 TransactionMonitor getTransactionStatusMonitor()
          Retrieves a transaction status monitor for transactions.
 Set getTypes(Instance instance)
           
 void moveDirectOwnSlotValue(Frame frame, Slot slot, int from, int to)
           
 void moveDirectSubclass(Cls cls, Cls subclass, int index)
           
 void moveDirectSubslot(Slot slot, Slot subslot, int index)
           
 void moveDirectTemplateSlot(Cls cls, Slot slot, int index)
           
 void moveDirectType(Instance instance, Cls type, int index)
           
 void reinitialize()
           
 void removeDirectOwnSlotValue(Frame frame, Slot slot, Object value)
           
 void removeDirectSuperclass(Cls cls, Cls superclass)
           
 void removeDirectSuperslot(Slot slot, Slot superslot)
           
 void removeDirectTemplateFacetOverrides(Cls cls, Slot slot)
           
 void removeDirectTemplateSlot(Cls cls, Slot slot)
           
 void removeDirectType(Instance instance, Cls type)
           
 void replaceFrame(Frame original, Frame replacement)
           
 boolean rollbackTransaction()
           
 void setDelegate(FrameStore fs)
           
 void setDirectOwnSlotValues(Frame frame, Slot slot, Collection newValues)
           
 void setDirectTemplateFacetValues(Cls cls, Slot slot, Facet facet, Collection values)
           
 void setDirectTemplateSlotValues(Cls cls, Slot slot, Collection values)
           
 void setHelper(NarrowFrameStore helper)
           
 void swizzleInstance(Instance instance)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleFrameStore

public SimpleFrameStore(KnowledgeBase kb,
                        NarrowFrameStore helper)
Method Detail

getName

public String getName()
Specified by:
getName in interface FrameStore

reinitialize

public void reinitialize()
Specified by:
reinitialize in interface FrameStore

setHelper

public void setHelper(NarrowFrameStore helper)

getHelper

public NarrowFrameStore getHelper()

executeQuery

public void executeQuery(Query query,
                         QueryCallback callback)
Description copied from interface: FrameStore
The executeQuery method allows for complex queries. It is asynchronous so that in server-client mode the server knowledge base lock will not be held for an excessive amount of time. The contract specifies that the implementor must call one of the QueryCallback methods in a separate thread. This makes it possible for the caller to know how to retrieve the results in a synchronous way without worrying about deadlock.

Specified by:
executeQuery in interface FrameStore

deleteCls

public void deleteCls(Cls cls)
Description copied from interface: FrameStore
Delete a single leaf class. The operation fails if the class has subclasses or instances.

Specified by:
deleteCls in interface FrameStore
Parameters:
cls - Class to be deleted

getClsesToBeDeleted

public static Collection<Cls> getClsesToBeDeleted(Cls cls,
                                                  FrameStore fs)
This method should not be down here in the frame store chain.

Returns:
Collection of Clses

deleteSlot

public void deleteSlot(Slot slot)
Specified by:
deleteSlot in interface FrameStore

deleteFacet

public void deleteFacet(Facet facet)
Specified by:
deleteFacet in interface FrameStore

deleteSimpleInstance

public void deleteSimpleInstance(SimpleInstance simpleInstance)
Specified by:
deleteSimpleInstance in interface FrameStore

getReferences

public Set<Reference> getReferences(Object value)
Specified by:
getReferences in interface FrameStore

close

public void close()
Specified by:
close in interface FrameStore

getMatchingReferences

public Set<Reference> getMatchingReferences(String value,
                                            int maxMatches)
Specified by:
getMatchingReferences in interface FrameStore

getClsesWithMatchingBrowserText

public Set<Cls> getClsesWithMatchingBrowserText(String value,
                                                Collection superclasses,
                                                int maxMatches)
Specified by:
getClsesWithMatchingBrowserText in interface FrameStore

getClsCount

public int getClsCount()
Specified by:
getClsCount in interface FrameStore

getSlotCount

public int getSlotCount()
Specified by:
getSlotCount in interface FrameStore

getFacetCount

public int getFacetCount()
Specified by:
getFacetCount in interface FrameStore

getSimpleInstanceCount

public int getSimpleInstanceCount()
Specified by:
getSimpleInstanceCount in interface FrameStore

getFrameCount

public int getFrameCount()
Specified by:
getFrameCount in interface FrameStore

getClses

public Set<Cls> getClses()
Specified by:
getClses in interface FrameStore

getSlots

public Set<Slot> getSlots()
Specified by:
getSlots in interface FrameStore

getFacets

public Set<Facet> getFacets()
Specified by:
getFacets in interface FrameStore

getFrames

public Set<Frame> getFrames()
Specified by:
getFrames in interface FrameStore

getDirectTemplateSlots

public List getDirectTemplateSlots(Cls cls)
Specified by:
getDirectTemplateSlots in interface FrameStore

getDirectSuperclasses

public List<Cls> getDirectSuperclasses(Cls cls)
Specified by:
getDirectSuperclasses in interface FrameStore

getDirectSuperslots

public List getDirectSuperslots(Slot slot)
Specified by:
getDirectSuperslots in interface FrameStore

getDirectSubslots

public List getDirectSubslots(Slot slot)
Specified by:
getDirectSubslots in interface FrameStore

getSuperslots

public Set getSuperslots(Slot slot)
Specified by:
getSuperslots in interface FrameStore

getSubslots

public Set getSubslots(Slot slot)
Specified by:
getSubslots in interface FrameStore

getSuperclasses

public Set getSuperclasses(Cls cls)
Specified by:
getSuperclasses in interface FrameStore

getDirectSubclasses

public List<Cls> getDirectSubclasses(Cls cls)
Specified by:
getDirectSubclasses in interface FrameStore

getSubclasses

public Set<Cls> getSubclasses(Cls cls)
Specified by:
getSubclasses in interface FrameStore

getTemplateFacets

public Set<Facet> getTemplateFacets(Cls cls,
                                    Slot slot)
Specified by:
getTemplateFacets in interface FrameStore

getTemplateFacetValues

public Collection getTemplateFacetValues(Cls localCls,
                                         Slot slot,
                                         Facet facet)
Specified by:
getTemplateFacetValues in interface FrameStore

getTemplateSlotValues

public Collection getTemplateSlotValues(Cls cls,
                                        Slot slot)
Specified by:
getTemplateSlotValues in interface FrameStore

getDirectOwnSlotValuesClosure

public Set getDirectOwnSlotValuesClosure(Frame frame,
                                         Slot slot)
Specified by:
getDirectOwnSlotValuesClosure in interface FrameStore

equals

public static boolean equals(Object o1,
                             Object o2)

getDirectTypes

public List getDirectTypes(Instance instance)
Specified by:
getDirectTypes in interface FrameStore

getDirectInstances

public List<Instance> getDirectInstances(Cls cls)
Specified by:
getDirectInstances in interface FrameStore

getInstances

public Set<Instance> getInstances(Cls cls)
Specified by:
getInstances in interface FrameStore

getTypes

public Set getTypes(Instance instance)
Specified by:
getTypes in interface FrameStore

getFrame

public Frame getFrame(String name)
Specified by:
getFrame in interface FrameStore

getFrame

public Frame getFrame(FrameID id)
Specified by:
getFrame in interface FrameStore

getOwnSlots

public Set<Slot> getOwnSlots(Frame frame)
Specified by:
getOwnSlots in interface FrameStore

getTemplateSlots

public Set getTemplateSlots(Cls cls)
Specified by:
getTemplateSlots in interface FrameStore

getDomain

public Set getDomain(Slot slot)
Specified by:
getDomain in interface FrameStore

getDirectDomain

public List getDirectDomain(Slot slot)
Specified by:
getDirectDomain in interface FrameStore

addDirectSuperclass

public void addDirectSuperclass(Cls cls,
                                Cls superclass)
Specified by:
addDirectSuperclass in interface FrameStore

removeDirectSuperclass

public void removeDirectSuperclass(Cls cls,
                                   Cls superclass)
Specified by:
removeDirectSuperclass in interface FrameStore

addDirectSuperslot

public void addDirectSuperslot(Slot slot,
                               Slot superslot)
Specified by:
addDirectSuperslot in interface FrameStore

removeDirectSuperslot

public void removeDirectSuperslot(Slot slot,
                                  Slot superslot)
Specified by:
removeDirectSuperslot in interface FrameStore

addDirectType

public void addDirectType(Instance instance,
                          Cls type)
Specified by:
addDirectType in interface FrameStore

swizzleInstance

public void swizzleInstance(Instance instance)

removeDirectType

public void removeDirectType(Instance instance,
                             Cls type)
Specified by:
removeDirectType in interface FrameStore

moveDirectType

public void moveDirectType(Instance instance,
                           Cls type,
                           int index)
Specified by:
moveDirectType in interface FrameStore

moveDirectSubclass

public void moveDirectSubclass(Cls cls,
                               Cls subclass,
                               int index)
Specified by:
moveDirectSubclass in interface FrameStore

moveDirectSubslot

public void moveDirectSubslot(Slot slot,
                              Slot subslot,
                              int index)
Specified by:
moveDirectSubslot in interface FrameStore

addDirectTemplateSlot

public void addDirectTemplateSlot(Cls cls,
                                  Slot slot)
Specified by:
addDirectTemplateSlot in interface FrameStore

moveDirectTemplateSlot

public void moveDirectTemplateSlot(Cls cls,
                                   Slot slot,
                                   int index)
Specified by:
moveDirectTemplateSlot in interface FrameStore

removeDirectTemplateSlot

public void removeDirectTemplateSlot(Cls cls,
                                     Slot slot)
Specified by:
removeDirectTemplateSlot in interface FrameStore

addDirectOwnSlotValue

public void addDirectOwnSlotValue(Frame frame,
                                  Slot slot,
                                  Object value)

removeDirectOwnSlotValue

public void removeDirectOwnSlotValue(Frame frame,
                                     Slot slot,
                                     Object value)

moveDirectOwnSlotValue

public void moveDirectOwnSlotValue(Frame frame,
                                   Slot slot,
                                   int from,
                                   int to)
Specified by:
moveDirectOwnSlotValue in interface FrameStore

addDirectOwnSlotValues

public void addDirectOwnSlotValues(Frame frame,
                                   Slot slot,
                                   Collection values)

createCls

public Cls createCls(FrameID id,
                     Collection directTypes,
                     Collection directSuperclasses,
                     boolean loadDefaults)
Specified by:
createCls in interface FrameStore

createSlot

public Slot createSlot(FrameID id,
                       Collection directTypes,
                       Collection directSuperslots,
                       boolean loadDefaults)
Specified by:
createSlot in interface FrameStore

createSimpleInstance

public SimpleInstance createSimpleInstance(FrameID id,
                                           Collection directTypes,
                                           boolean loadDefaults)
Specified by:
createSimpleInstance in interface FrameStore

createFacet

public Facet createFacet(FrameID id,
                         Collection directTypes,
                         boolean loadDefaults)
Specified by:
createFacet in interface FrameStore

addCls

protected void addCls(Cls cls,
                      Collection directTypes,
                      Collection directSuperclasses,
                      boolean loadDefaults)

addSlot

protected void addSlot(Slot slot,
                       Collection directTypes,
                       Collection directSuperslots,
                       boolean loadDefaults)

getOwnSlotValues

public Collection getOwnSlotValues(Frame frame,
                                   Slot slot)
Specified by:
getOwnSlotValues in interface FrameStore

getDirectOwnSlotValues

public List getDirectOwnSlotValues(Frame frame,
                                   Slot slot)
Specified by:
getDirectOwnSlotValues in interface FrameStore

getDirectOwnSlotValuesCount

public int getDirectOwnSlotValuesCount(Frame frame,
                                       Slot slot)
Specified by:
getDirectOwnSlotValuesCount in interface FrameStore

setDirectOwnSlotValues

public void setDirectOwnSlotValues(Frame frame,
                                   Slot slot,
                                   Collection newValues)
Specified by:
setDirectOwnSlotValues in interface FrameStore

getDirectTemplateSlotValues

public List getDirectTemplateSlotValues(Cls cls,
                                        Slot slot)
Specified by:
getDirectTemplateSlotValues in interface FrameStore

setDirectTemplateSlotValues

public void setDirectTemplateSlotValues(Cls cls,
                                        Slot slot,
                                        Collection values)
Specified by:
setDirectTemplateSlotValues in interface FrameStore

getDirectTemplateFacetValues

public List getDirectTemplateFacetValues(Cls cls,
                                         Slot slot,
                                         Facet facet)
Specified by:
getDirectTemplateFacetValues in interface FrameStore

setDirectTemplateFacetValues

public void setDirectTemplateFacetValues(Cls cls,
                                         Slot slot,
                                         Facet facet,
                                         Collection values)
Specified by:
setDirectTemplateFacetValues in interface FrameStore

getFramesWithDirectOwnSlotValue

public Set<Frame> getFramesWithDirectOwnSlotValue(Slot slot,
                                                  Object value)
Specified by:
getFramesWithDirectOwnSlotValue in interface FrameStore

getFramesWithAnyDirectOwnSlotValue

public Set<Frame> getFramesWithAnyDirectOwnSlotValue(Slot slot)
Specified by:
getFramesWithAnyDirectOwnSlotValue in interface FrameStore

getClsesWithDirectTemplateSlotValue

public Set getClsesWithDirectTemplateSlotValue(Slot slot,
                                               Object value)
Specified by:
getClsesWithDirectTemplateSlotValue in interface FrameStore

getClsesWithAnyDirectTemplateSlotValue

public Set<Cls> getClsesWithAnyDirectTemplateSlotValue(Slot slot)
Specified by:
getClsesWithAnyDirectTemplateSlotValue in interface FrameStore

getClsesWithDirectTemplateFacetValue

public Set getClsesWithDirectTemplateFacetValue(Slot slot,
                                                Facet facet,
                                                Object value)
Specified by:
getClsesWithDirectTemplateFacetValue in interface FrameStore

getFramesWithMatchingDirectOwnSlotValue

public Set<Frame> getFramesWithMatchingDirectOwnSlotValue(Slot slot,
                                                          String value,
                                                          int maxMatches)
Specified by:
getFramesWithMatchingDirectOwnSlotValue in interface FrameStore

getClsesWithMatchingDirectTemplateSlotValue

public Set getClsesWithMatchingDirectTemplateSlotValue(Slot slot,
                                                       String value,
                                                       int maxMatches)
Specified by:
getClsesWithMatchingDirectTemplateSlotValue in interface FrameStore

getClsesWithMatchingDirectTemplateFacetValue

public Set getClsesWithMatchingDirectTemplateFacetValue(Slot slot,
                                                        Facet facet,
                                                        String value,
                                                        int maxMatches)
Specified by:
getClsesWithMatchingDirectTemplateFacetValue in interface FrameStore

getFrameName

public String getFrameName(Frame frame)
Specified by:
getFrameName in interface FrameStore

addSystemFrames

protected void addSystemFrames()

createCls

protected Cls createCls(FrameID id,
                        Collection directTypes)

createSlot

protected Slot createSlot(FrameID id,
                          Collection directTypes)

createFacet

protected Facet createFacet(FrameID id,
                            Collection directTypes)

createSimpleInstance

protected SimpleInstance createSimpleInstance(FrameID id,
                                              Collection directTypes)

getOwnFacets

public Set getOwnFacets(Frame frame,
                        Slot slot)
Specified by:
getOwnFacets in interface FrameStore

getOwnFacetValues

public Collection getOwnFacetValues(Frame frame,
                                    Slot slot,
                                    Facet facet)
Specified by:
getOwnFacetValues in interface FrameStore

getOverriddenTemplateSlots

public Set getOverriddenTemplateSlots(Cls cls)
Specified by:
getOverriddenTemplateSlots in interface FrameStore

getDirectlyOverriddenTemplateSlots

public Set getDirectlyOverriddenTemplateSlots(Cls cls)
Specified by:
getDirectlyOverriddenTemplateSlots in interface FrameStore

getOverriddenTemplateFacets

public Set getOverriddenTemplateFacets(Cls cls,
                                       Slot slot)
Specified by:
getOverriddenTemplateFacets in interface FrameStore

getDirectlyOverriddenTemplateFacets

public Set getDirectlyOverriddenTemplateFacets(Cls cls,
                                               Slot slot)
Specified by:
getDirectlyOverriddenTemplateFacets in interface FrameStore

removeDirectTemplateFacetOverrides

public void removeDirectTemplateFacetOverrides(Cls cls,
                                               Slot slot)
Specified by:
removeDirectTemplateFacetOverrides in interface FrameStore

beginTransaction

public boolean beginTransaction(String name)
Specified by:
beginTransaction in interface FrameStore

commitTransaction

public boolean commitTransaction()
Specified by:
commitTransaction in interface FrameStore

rollbackTransaction

public boolean rollbackTransaction()
Specified by:
rollbackTransaction in interface FrameStore

getTransactionStatusMonitor

public TransactionMonitor getTransactionStatusMonitor()
Description copied from interface: FrameStore
Retrieves a transaction status monitor for transactions. If this call returns null then it means that transactions are not supported.

Specified by:
getTransactionStatusMonitor in interface FrameStore
Returns:
A TransactionMonitor object that tracks the status of transactions.

getEvents

public List<AbstractEvent> getEvents()
Specified by:
getEvents in interface FrameStore

setDelegate

public void setDelegate(FrameStore fs)
Specified by:
setDelegate in interface FrameStore

getDelegate

public FrameStore getDelegate()
Specified by:
getDelegate in interface FrameStore

toString

public String toString()
Overrides:
toString in class Object

replaceFrame

public void replaceFrame(Frame original,
                         Frame replacement)
Specified by:
replaceFrame in interface FrameStore

Protege 3.5

Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2013 Stanford University.