edu.stanford.smi.protege.model
Interface KnowledgeBase
- All Superinterfaces:
- Disposable
- All Known Implementing Classes:
- DefaultKnowledgeBase
- public interface KnowledgeBase
- extends Disposable
A container for frames. Frame creation is funneled through here.
- Author:
- Ray Fergerson
Method Summary |
void |
addJavaLoadPackage(String path)
This method requires some background information. |
void |
addKnowledgeBaseListener(KnowledgeBaseListener listener)
|
boolean |
areValidOwnSlotValues(Frame frame,
Slot slot,
Collection values)
|
void |
changeFrameName(Frame oldFrame,
String newFrameName)
|
boolean |
containsFrame(String name)
|
Cls |
createCls(String name,
Collection parents)
|
Cls |
createCls(String name,
Collection parents,
Cls metaCls)
|
Cls |
createCls(String name,
Collection parents,
Cls metaCls,
boolean isNew)
|
Facet |
createFacet(String name)
|
Facet |
createFacet(String name,
Cls metaCls)
|
Facet |
createFacet(String name,
Cls metaCls,
boolean isNew)
|
Instance |
createInstance(String name,
Cls cls)
|
Instance |
createInstance(String name,
Cls cls,
boolean isNew)
|
Slot |
createSlot(String name)
|
Slot |
createSlot(String name,
Cls metaCls)
|
Slot |
createSlot(String name,
Cls metaCls,
boolean isNew)
|
Slot |
createSlot(String name,
Cls metaCls,
Collection superslots,
boolean isNew)
|
String |
createUniqueFrameName(String name)
Deprecated. pass "null" in as a frame name to a create method to get a
gensym name |
void |
deleteCls(Cls cls)
|
void |
deleteFacet(Facet facet)
|
void |
deleteFrame(Frame frame)
|
void |
deleteInstance(Instance instance)
|
void |
deleteSlot(Slot slot)
|
String |
getBuildString()
Returns a string that contains something like "build 840" that refers to the
build of Protege in use when this kb was last saved. |
Object |
getClientInformation(Object key)
Allows a programmer to hang arbitrary information on a kb
and retrieve it later. |
Cls |
getCls(String name)
|
int |
getClsCount()
|
Collection |
getClses()
|
Collection |
getClsNameMatches(String s,
int maxMatches)
Not a regexp. |
Cls |
getDefaultClsMetaCls()
|
Cls |
getDefaultFacetMetaCls()
|
Cls |
getDefaultSlotMetaCls()
|
Facet |
getFacet(String name)
|
int |
getFacetCount()
|
Collection |
getFacets()
|
Frame |
getFrame(String name)
|
int |
getFrameCount()
|
String |
getFrameCreationTimestamp(Frame frame)
|
String |
getFrameCreator(Frame frame)
|
String |
getFrameLastModificationTimestamp(Frame frame)
|
String |
getFrameLastModifier(Frame frame)
|
Collection |
getFrameNameMatches(String s,
int maxMatches)
|
String |
getFrameNamePrefix()
|
Collection |
getFrames()
|
Instance |
getInstance(String fullname)
|
Collection |
getInstances()
|
Collection |
getInstances(Cls cls)
Deprecated. use cls.getInstances() |
String |
getInvalidOwnSlotValuesText(Frame frame,
Slot slot,
Collection values)
|
String |
getInvalidOwnSlotValueText(Frame frame,
Slot slot,
Object value)
|
KnowledgeBaseFactory |
getKnowledgeBaseFactory()
|
Collection |
getMatchingFrames(Slot slot,
Facet facet,
boolean isTemplate,
String s,
int maxMatches)
|
String |
getName()
|
int |
getNextFrameNumber()
|
Project |
getProject()
|
Collection |
getReachableSimpleInstances(Collection roots)
|
Collection |
getReferences(Object o,
int maxReferences)
|
Cls |
getRootCls()
|
Collection |
getRootClses()
A convenience method that returns ":THING" wrapped in a collection. |
Cls |
getRootClsMetaCls()
|
Cls |
getRootFacetMetaCls()
|
Cls |
getRootSlotMetaCls()
|
Collection |
getRootSlots()
|
Slot |
getSlot(String name)
|
int |
getSlotCount()
|
Collection |
getSlots()
|
String |
getSlotValueLastModificationTimestamp(Frame frame,
Slot slot,
boolean isTemplate)
|
String |
getSlotValueLastModifier(Frame frame,
Slot slot,
boolean isTemplate)
|
Collection |
getSubclasses(Cls cls)
Deprecated. use cls.getSubclasses() |
Collection |
getUnreachableSimpleInstances(Collection roots)
|
String |
getUserName()
|
String |
getVersionString()
|
boolean |
hasChanged()
|
boolean |
isAutoUpdatingFacetValues()
|
boolean |
isClsMetaCls(Cls cls)
|
boolean |
isDefaultClsMetaCls(Cls cls)
|
boolean |
isDefaultFacetMetaCls(Cls cls)
|
boolean |
isDefaultSlotMetaCls(Cls cls)
|
boolean |
isFacetMetaCls(Cls cls)
|
boolean |
isLoading()
|
boolean |
isSlotMetaCls(Cls cls)
|
boolean |
isValidOwnSlotValue(Frame frame,
Slot slot,
Object value)
|
void |
removeJavaLoadPackage(String path)
|
void |
removeKnowledgeBaseListener(KnowledgeBaseListener listener)
|
void |
setAutoUpdateFacetValues(boolean b)
|
void |
setBuildString(String s)
|
void |
setChanged(boolean b)
|
Object |
setClientInformation(Object key,
Object value)
|
void |
setDefaultClsMetaCls(Cls cls)
|
void |
setDefaultFacetMetaCls(Cls cls)
|
void |
setDefaultSlotMetaCls(Cls cls)
|
boolean |
setEventsEnabled(boolean enabled)
|
void |
setFrameNamePrefix(String name)
|
void |
setLoading(boolean b)
|
void |
setName(String name)
|
void |
setNextFrameNumber(int i)
|
void |
setProject(Project project)
|
void |
setUserName(String name)
|
void |
setValueChecking(boolean b)
|
void |
setVersionString(String s)
|
MAXIMUM_CARDINALITY_UNBOUNDED
public static final int MAXIMUM_CARDINALITY_UNBOUNDED
addJavaLoadPackage
public void addJavaLoadPackage(String path)
- This method requires some background information. When Protege wants to
create a simple instance in the kb it creates an instance of the java
class "DefaultSimpleInstance". Programmers can subclass this class and
give the subclass the name of a class in the kb. Then when protege wants
to create an instance of the class in the kb it will instead make an
instance of the programmers java class rather than DefaultSimpleInstance.
In order for this to work the user must specify the package that their
java class appears in. (The class file must also be in the plugins directory.)
For example, consider a protege project with a class A. Now a programmer
creates a subclass of model.DefaultSimpleInstance and calls it org.me.A.
He puts this .class file in the plugins/org/me directory.
(Presumably he creates the subclass this in order to add additional
methods onto org.me.A
to provide some sort of desired functionality. The desired behavior is
that when the user creates an instance of the kb class A that the system
will create an instance of org.me.A and put it in the kb. Then when the
programmer queries the kb for "get me instances of A" he will get back instances
which can be cast to org.me.A.
So, what this method does is to tell the system what package to search to
find the java class to create. When the system creates an instance of
A it searches all the packages, in order, to find a java class with the
name .A. If it finds one then it uses it to create an instance.
If it doesn't find any matches then it creates an instance of
DefaultSimpleInstance.
addKnowledgeBaseListener
public void addKnowledgeBaseListener(KnowledgeBaseListener listener)
areValidOwnSlotValues
public boolean areValidOwnSlotValues(Frame frame,
Slot slot,
Collection values)
changeFrameName
public void changeFrameName(Frame oldFrame,
String newFrameName)
containsFrame
public boolean containsFrame(String name)
createCls
public Cls createCls(String name,
Collection parents)
createCls
public Cls createCls(String name,
Collection parents,
Cls metaCls)
createCls
public Cls createCls(String name,
Collection parents,
Cls metaCls,
boolean isNew)
createFacet
public Facet createFacet(String name)
createFacet
public Facet createFacet(String name,
Cls metaCls)
createFacet
public Facet createFacet(String name,
Cls metaCls,
boolean isNew)
createInstance
public Instance createInstance(String name,
Cls cls)
createInstance
public Instance createInstance(String name,
Cls cls,
boolean isNew)
createSlot
public Slot createSlot(String name)
createSlot
public Slot createSlot(String name,
Cls metaCls)
createSlot
public Slot createSlot(String name,
Cls metaCls,
Collection superslots,
boolean isNew)
createSlot
public Slot createSlot(String name,
Cls metaCls,
boolean isNew)
createUniqueFrameName
public String createUniqueFrameName(String name)
- Deprecated. pass "null" in as a frame name to a create method to get a
gensym name
deleteCls
public void deleteCls(Cls cls)
deleteFacet
public void deleteFacet(Facet facet)
deleteFrame
public void deleteFrame(Frame frame)
deleteInstance
public void deleteInstance(Instance instance)
deleteSlot
public void deleteSlot(Slot slot)
getBuildString
public String getBuildString()
- Returns a string that contains something like "build 840" that refers to the
build of Protege in use when this kb was last saved.
This string format is not reliable and may change.
getClientInformation
public Object getClientInformation(Object key)
- Allows a programmer to hang arbitrary information on a kb
and retrieve it later. This information is not persistent.
Since all programmers share the same "client information space" we
recommend that your "key" be your java.lang.Class object. If you want
to store more than one piece of information then you can make your
value a set (or a map). Thus the common usage would be:
Map myGoodStuff = new HashMap();
myGoodStuff.put("foo", "bar");
kb.setClientInformation(myClass.class, myGoodStuff);
// ... later
Map myGoodStuff = (Map) kb.getClientInformation(myClass.class);
Widget writers typically don't need this sort of thing but backend
authors do because one instance of the backend may need to communicate
information to another instance (the loader to the storer, for example).
This is very similar to the "client property" feature on
javax.swing.JComponent or the client information on MS Windows windows
and it exists for the same reasons. It allows you to store anything
you want.
getCls
public Cls getCls(String name)
getClsCount
public int getClsCount()
getClses
public Collection getClses()
getClsNameMatches
public Collection getClsNameMatches(String s,
int maxMatches)
- Not a regexp. Allows "*" for "match any sequence" at
the begining or end.
Case-sensitivity is screwy. For systems
with all of the information in memory (text files) then the search
is case-insensitive. For database backend systems then the case-sensitivity
is determined by the case-sensitivety of searching in the database. This
means that mySQL and MS Access provide case-insensitive searchs while Oracle
provides case-sensitive searches. This different behavior is less than ideal and will be dealt with someday.
getDefaultClsMetaCls
public Cls getDefaultClsMetaCls()
getDefaultFacetMetaCls
public Cls getDefaultFacetMetaCls()
getDefaultSlotMetaCls
public Cls getDefaultSlotMetaCls()
getFacet
public Facet getFacet(String name)
getFacetCount
public int getFacetCount()
getFacets
public Collection getFacets()
getFrame
public Frame getFrame(String name)
getFrameCount
public int getFrameCount()
getFrameCreationTimestamp
public String getFrameCreationTimestamp(Frame frame)
getFrameCreator
public String getFrameCreator(Frame frame)
getFrameLastModificationTimestamp
public String getFrameLastModificationTimestamp(Frame frame)
getFrameLastModifier
public String getFrameLastModifier(Frame frame)
getFrameNameMatches
public Collection getFrameNameMatches(String s,
int maxMatches)
getFrameNamePrefix
public String getFrameNamePrefix()
getFrames
public Collection getFrames()
getInstance
public Instance getInstance(String fullname)
getInstances
public Collection getInstances()
getInstances
public Collection getInstances(Cls cls)
- Deprecated. use cls.getInstances()
getInvalidOwnSlotValuesText
public String getInvalidOwnSlotValuesText(Frame frame,
Slot slot,
Collection values)
getInvalidOwnSlotValueText
public String getInvalidOwnSlotValueText(Frame frame,
Slot slot,
Object value)
getKnowledgeBaseFactory
public KnowledgeBaseFactory getKnowledgeBaseFactory()
getMatchingFrames
public Collection getMatchingFrames(Slot slot,
Facet facet,
boolean isTemplate,
String s,
int maxMatches)
getName
public String getName()
getNextFrameNumber
public int getNextFrameNumber()
getProject
public Project getProject()
getReachableSimpleInstances
public Collection getReachableSimpleInstances(Collection roots)
getReferences
public Collection getReferences(Object o,
int maxReferences)
getRootCls
public Cls getRootCls()
getRootClses
public Collection getRootClses()
- A convenience method that returns ":THING" wrapped in a collection.
getRootClsMetaCls
public Cls getRootClsMetaCls()
getRootFacetMetaCls
public Cls getRootFacetMetaCls()
getRootSlotMetaCls
public Cls getRootSlotMetaCls()
getRootSlots
public Collection getRootSlots()
getSlot
public Slot getSlot(String name)
getSlotCount
public int getSlotCount()
getSlots
public Collection getSlots()
getSlotValueLastModificationTimestamp
public String getSlotValueLastModificationTimestamp(Frame frame,
Slot slot,
boolean isTemplate)
getSlotValueLastModifier
public String getSlotValueLastModifier(Frame frame,
Slot slot,
boolean isTemplate)
getSubclasses
public Collection getSubclasses(Cls cls)
- Deprecated. use cls.getSubclasses()
getUnreachableSimpleInstances
public Collection getUnreachableSimpleInstances(Collection roots)
getUserName
public String getUserName()
getVersionString
public String getVersionString()
hasChanged
public boolean hasChanged()
isAutoUpdatingFacetValues
public boolean isAutoUpdatingFacetValues()
isClsMetaCls
public boolean isClsMetaCls(Cls cls)
isDefaultClsMetaCls
public boolean isDefaultClsMetaCls(Cls cls)
isDefaultFacetMetaCls
public boolean isDefaultFacetMetaCls(Cls cls)
isDefaultSlotMetaCls
public boolean isDefaultSlotMetaCls(Cls cls)
isFacetMetaCls
public boolean isFacetMetaCls(Cls cls)
isLoading
public boolean isLoading()
isSlotMetaCls
public boolean isSlotMetaCls(Cls cls)
isValidOwnSlotValue
public boolean isValidOwnSlotValue(Frame frame,
Slot slot,
Object value)
removeJavaLoadPackage
public void removeJavaLoadPackage(String path)
removeKnowledgeBaseListener
public void removeKnowledgeBaseListener(KnowledgeBaseListener listener)
setAutoUpdateFacetValues
public void setAutoUpdateFacetValues(boolean b)
setBuildString
public void setBuildString(String s)
setChanged
public void setChanged(boolean b)
setClientInformation
public Object setClientInformation(Object key,
Object value)
setDefaultClsMetaCls
public void setDefaultClsMetaCls(Cls cls)
setDefaultFacetMetaCls
public void setDefaultFacetMetaCls(Cls cls)
setDefaultSlotMetaCls
public void setDefaultSlotMetaCls(Cls cls)
setEventsEnabled
public boolean setEventsEnabled(boolean enabled)
setFrameNamePrefix
public void setFrameNamePrefix(String name)
setLoading
public void setLoading(boolean b)
setName
public void setName(String name)
setNextFrameNumber
public void setNextFrameNumber(int i)
setProject
public void setProject(Project project)
setUserName
public void setUserName(String name)
setValueChecking
public void setValueChecking(boolean b)
setVersionString
public void setVersionString(String s)
Submit a bug report or feature request
Protege-2000 is a trademark of Stanford University.
Copyright (c) 1998-2002 Stanford University.