zeus.concepts
Class OntologyDb

java.lang.Object
  extended byzeus.util.Tree
      extended byzeus.concepts.OntologyDb

public class OntologyDb
extends Tree

This implements the Ontology Database component, which has two main roles:

Aside from the fact creation and query methods, developers are unlikely to need the other methods of this class. Change Log 26/06/01 introduced allAncestors method which returns an interator containing all ancestors of a type - Simon Thompson


Field Summary
static java.lang.String ABSTRACT
           
static java.lang.String AMOUNT
           
(package private) static java.lang.String ATTRIBUTE_TAG
           
static int ATTRIBUTES_CHANGED
           
static java.lang.String[] BASIC_TYPES
           
(package private) static java.lang.String BEGIN_ATTRIBUTE_ITEM
           
(package private) static java.lang.String BEGIN_ATTRIBUTE_LIST
           
(package private) static java.lang.String BEGIN_FACT_ITEM
           
(package private) static java.lang.String BEGIN_FACTS
           
(package private) static java.lang.String BEGIN_ONTOLOGY
           
(package private) static java.lang.String BEGIN_PREAMBLE
           
(package private) static java.lang.String BEGIN_RESTRICTION_ITEM
           
(package private) static java.lang.String BEGIN_RESTRICTIONS
           
static java.lang.String BOOLEAN
           
(package private) static java.lang.String CDATA
           
protected  javax.swing.event.EventListenerList changeListeners
           
(package private) static java.lang.String CLOSE_BRACKET
           
(package private) static java.lang.String COMMA
           
static java.lang.String COST
           
protected static java.lang.String CSEP
           
static java.lang.String DATE
           
(package private) static java.lang.String DEFA_TAG
           
(package private) static int DEFAULT
           
protected  int editableLimit
           
(package private) static java.lang.String ELEMENT_TAG
           
(package private) static java.lang.String END_ATTRIBUTE_ITEM
           
(package private) static java.lang.String END_ATTRIBUTE_LIST
           
(package private) static java.lang.String END_FACT_ITEM
           
(package private) static java.lang.String END_FACTS
           
(package private) static java.lang.String END_ONTOLOGY
           
(package private) static java.lang.String END_PREAMBLE
           
(package private) static java.lang.String END_RESTRICTION_ITEM
           
(package private) static java.lang.String END_RESTRICTIONS
           
static java.lang.String ENTITY
           
protected  java.lang.String error
           
static int ERROR_MASK
           
static int FACT_ADDED
           
static int FACT_REMOVED
           
static int FACT_RENAMED
           
protected static java.lang.String FACT_STR
           
protected  java.util.Hashtable factIndex
           
protected  java.lang.String filename
           
protected  GenSym genSym
           
static java.lang.String[] GOAL_ATTRIBUTES
           
static java.lang.String GOAL_FACT
           
(package private) static java.lang.String GT
           
(package private) static java.lang.String HEADER
           
static java.lang.String INTEGER
           
static java.lang.String LIST
           
(package private) static java.lang.String LT
           
static java.lang.String MESSAGE
           
static java.lang.String MONEY
           
(package private) static int NAME
           
protected static java.lang.String NAME_STR
           
(package private) static java.lang.String NAME_TAG
           
static java.lang.String NUMBER
           
static java.lang.String OBJECT_TYPE
           
protected  java.lang.String ontologyName
           
(package private) static java.lang.String OPEN_BRACKET
           
(package private) static java.lang.String PARENT_TAG
           
(package private) static java.lang.String PCDATA
           
(package private) static java.lang.String[] PREDEFINED_FACTS
           
(package private) static java.lang.String QUOTE
           
static java.lang.String REAL
           
static int RELOAD
          OntologyDbChangeEvent types
(package private) static java.lang.String REST_TAG
           
(package private) static int RESTRICTION
           
static int RESTRICTION_ADDED
           
static int RESTRICTION_CHANGED
           
static int RESTRICTION_REMOVED
           
protected  OrderedHashtable restrictions
           
static java.lang.String ROOT
           
protected  boolean save_needed
           
(package private) static java.lang.String SPACE
           
static java.lang.String STRING
           
(package private) static java.lang.String SYSTEM
           
(package private) static java.lang.String SYSTEM_NAME
           
protected static java.lang.String TFILE
           
static java.lang.String TIME
           
(package private) static int TYPE
           
(package private) static java.lang.String TYPE_TAG
           
(package private) static java.lang.String VALUE_TAG
           
(package private) static java.lang.String VERSION
           
protected  java.lang.String warning
           
static int WARNING_MASK
           
 
Fields inherited from class zeus.util.Tree
root
 
Constructor Summary
OntologyDb()
           
OntologyDb(GenSym genSym)
           
 
Method Summary
 void __addChildFact(java.lang.String parent, java.lang.String name)
           
 void __addNewAttributeRow(java.lang.String fact, java.lang.String name, java.lang.String type, java.lang.String restriction, java.lang.String default_value)
           
 void __addRestriction(java.lang.String name, java.lang.String type, java.lang.String value)
           
 void __setWarning(java.lang.String info)
           
 void addAttributeRows(java.lang.String fact, java.lang.String[][] input)
           
 void addChangeListener(javax.swing.event.ChangeListener x)
           
 TreeNode addChildFact(TreeNode parent)
           
 boolean addNamedChildFact(TreeNode parent, java.lang.String name)
          New method added by Jaron to allow named facts to be added through an API call rather than the FactTable GUI
 void addNewAttribute(java.lang.String fact, java.lang.String name, java.lang.String type)
           
 void addNewAttributeRow(java.lang.String fact)
           
 void addNewRestriction()
           
 void addRestrictions(java.lang.String[][] input)
           
 java.util.Iterator allAncestors(java.lang.String name)
          get a list of the ancestors of a type
protected  ValueFunction checkDefaultValue(java.lang.String type, java.lang.String value)
           
protected  ValueFunction checkRestriction(ValueFunction child, java.lang.String name)
           
protected  ValueFunction checkRestrictionEntry(java.lang.String type, java.lang.String value)
           
 void clear()
           
 TreeNode copyFactTree(TreeNode node)
           
protected  void copyFactTree1(TreeNode top_node, TreeNode node)
           
 TreeNode createAttributeTree(java.lang.String fact, java.lang.String name)
           
protected  void createAttributeTreeNodes(java.lang.String fact, TreeNode base)
           
 void deleteAttributes(java.lang.String fact, java.lang.String[] attributes)
           
 void deleteRestrictions(java.lang.String[] names)
           
protected  void fireChanged(int type, java.lang.Object data)
           
 GenSym GenSym()
           
 java.lang.String[][] getAllAttributeEntriesFor(java.lang.String fact)
           
 java.lang.String[] getAllRestrictionNames()
           
 java.lang.String[][] getAllRestrictions()
           
 boolean[][] getAllRestrictionValidityInfo()
           
 boolean[][] getAllValidityInfoFor(java.lang.String fact)
           
 java.lang.String[][] getAttributeEntriesFor(java.lang.String fact)
           
protected  java.lang.String getBasicType(java.lang.String type)
           
 int getEditableLimit()
           
protected  java.util.Vector getElementNodes(FactDescription desc)
           
 java.lang.String getError()
           
 Fact getFact(boolean is_variable, java.lang.String type)
          This method is used to create a new Fact from its ontology description
 java.util.Hashtable getFactIndex()
           
 java.lang.String getFilename()
           
protected  java.lang.String getInheritedTypeFor(java.lang.String fact, java.lang.String name)
           
(package private)  java.lang.String[][] getNetAttributeEntriesFor(java.lang.String fact)
           
(package private)  java.lang.String[] getNetAttributesOnlyFor(java.lang.String fact)
           
 java.lang.String getOntologyName()
          return the actual user defined name of the ontology
protected  java.lang.String getRestrictionBasicType(java.lang.String restriction)
           
 boolean[][] getValidityInfoFor(java.lang.String fact)
           
 java.lang.String getWarning()
           
protected  boolean hasBasicAttributes(FactDescription desc)
           
 boolean hasFact(java.lang.String fact)
           
 boolean isAncestorOf(java.lang.String name, java.lang.String parent)
           
 boolean[] isAttributeValid(java.lang.String fact, java.lang.String name)
           
 boolean isFactEditable(java.lang.String name)
           
 boolean[] isRestrictionValid(java.lang.String name)
           
 boolean isSaveNeeded()
           
static void main(java.lang.String[] arg)
           
 int openFile(java.io.File file)
           
 TreeNode pasteFactTree(TreeNode parent, TreeNode node)
           
 void removeChangeListener(javax.swing.event.ChangeListener x)
           
 void removeFact(TreeNode node)
           
 java.lang.Object renameFact(java.lang.String previous, java.lang.String current)
           
 int saveDAML(java.io.File file)
           
 int saveFile(java.io.File file)
           
 int saveXML(java.io.File file)
           
 java.lang.String setAttribute(java.lang.String fact, java.lang.String attribute, int column, java.lang.String value)
           
private  void setFilename(java.io.File file)
           
 java.lang.String setRestrictionData(java.lang.String name, int column, java.lang.Object aValue)
           
(package private)  boolean validate(java.lang.String fact, java.lang.String attribute, ValueFunction value)
           
 boolean[] validateFact(Fact f1)
           
 
Methods inherited from class zeus.util.Tree
getRoot, nodes, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RELOAD

public static final int RELOAD
OntologyDbChangeEvent types

See Also:
Constant Field Values

FACT_ADDED

public static final int FACT_ADDED
See Also:
Constant Field Values

FACT_REMOVED

public static final int FACT_REMOVED
See Also:
Constant Field Values

FACT_RENAMED

public static final int FACT_RENAMED
See Also:
Constant Field Values

ATTRIBUTES_CHANGED

public static final int ATTRIBUTES_CHANGED
See Also:
Constant Field Values

RESTRICTION_ADDED

public static final int RESTRICTION_ADDED
See Also:
Constant Field Values

RESTRICTION_REMOVED

public static final int RESTRICTION_REMOVED
See Also:
Constant Field Values

RESTRICTION_CHANGED

public static final int RESTRICTION_CHANGED
See Also:
Constant Field Values

ROOT

public static final java.lang.String ROOT
See Also:
Constant Field Values

ABSTRACT

public static final java.lang.String ABSTRACT
See Also:
Constant Field Values

ENTITY

public static final java.lang.String ENTITY
See Also:
Constant Field Values

MESSAGE

public static final java.lang.String MESSAGE
See Also:
Constant Field Values

MONEY

public static final java.lang.String MONEY
See Also:
Constant Field Values

AMOUNT

public static final java.lang.String AMOUNT
See Also:
Constant Field Values

NUMBER

public static final java.lang.String NUMBER
See Also:
Constant Field Values

COST

public static final java.lang.String COST
See Also:
Constant Field Values

GOAL_FACT

public static final java.lang.String GOAL_FACT
See Also:
Constant Field Values

WARNING_MASK

public static final int WARNING_MASK
See Also:
Constant Field Values

ERROR_MASK

public static final int ERROR_MASK
See Also:
Constant Field Values

BEGIN_ONTOLOGY

static final java.lang.String BEGIN_ONTOLOGY
See Also:
Constant Field Values

BEGIN_PREAMBLE

static final java.lang.String BEGIN_PREAMBLE
See Also:
Constant Field Values

BEGIN_RESTRICTIONS

static final java.lang.String BEGIN_RESTRICTIONS
See Also:
Constant Field Values

BEGIN_RESTRICTION_ITEM

static final java.lang.String BEGIN_RESTRICTION_ITEM
See Also:
Constant Field Values

BEGIN_FACTS

static final java.lang.String BEGIN_FACTS
See Also:
Constant Field Values

BEGIN_FACT_ITEM

static final java.lang.String BEGIN_FACT_ITEM
See Also:
Constant Field Values

BEGIN_ATTRIBUTE_LIST

static final java.lang.String BEGIN_ATTRIBUTE_LIST
See Also:
Constant Field Values

BEGIN_ATTRIBUTE_ITEM

static final java.lang.String BEGIN_ATTRIBUTE_ITEM
See Also:
Constant Field Values

END_PREAMBLE

static final java.lang.String END_PREAMBLE
See Also:
Constant Field Values

END_RESTRICTION_ITEM

static final java.lang.String END_RESTRICTION_ITEM
See Also:
Constant Field Values

END_RESTRICTIONS

static final java.lang.String END_RESTRICTIONS
See Also:
Constant Field Values

END_ATTRIBUTE_ITEM

static final java.lang.String END_ATTRIBUTE_ITEM
See Also:
Constant Field Values

END_ATTRIBUTE_LIST

static final java.lang.String END_ATTRIBUTE_LIST
See Also:
Constant Field Values

END_FACT_ITEM

static final java.lang.String END_FACT_ITEM
See Also:
Constant Field Values

END_FACTS

static final java.lang.String END_FACTS
See Also:
Constant Field Values

END_ONTOLOGY

static final java.lang.String END_ONTOLOGY
See Also:
Constant Field Values

SYSTEM_NAME

static final java.lang.String SYSTEM_NAME
See Also:
Constant Field Values

SYSTEM

static final java.lang.String SYSTEM
See Also:
Constant Field Values

VERSION

static final java.lang.String VERSION
See Also:
Constant Field Values

NAME_TAG

static final java.lang.String NAME_TAG
See Also:
Constant Field Values

PARENT_TAG

static final java.lang.String PARENT_TAG
See Also:
Constant Field Values

TYPE_TAG

static final java.lang.String TYPE_TAG
See Also:
Constant Field Values

VALUE_TAG

static final java.lang.String VALUE_TAG
See Also:
Constant Field Values

REST_TAG

static final java.lang.String REST_TAG
See Also:
Constant Field Values

DEFA_TAG

static final java.lang.String DEFA_TAG
See Also:
Constant Field Values

QUOTE

static final java.lang.String QUOTE
See Also:
Constant Field Values

NAME

static final int NAME
See Also:
Constant Field Values

TYPE

static final int TYPE
See Also:
Constant Field Values

RESTRICTION

static final int RESTRICTION
See Also:
Constant Field Values

DEFAULT

static final int DEFAULT
See Also:
Constant Field Values

FACT_STR

protected static final java.lang.String FACT_STR
See Also:
Constant Field Values

NAME_STR

protected static final java.lang.String NAME_STR
See Also:
Constant Field Values

CSEP

protected static final java.lang.String CSEP
See Also:
Constant Field Values

TFILE

protected static final java.lang.String TFILE
See Also:
Constant Field Values

STRING

public static final java.lang.String STRING
See Also:
Constant Field Values

INTEGER

public static final java.lang.String INTEGER
See Also:
Constant Field Values

REAL

public static final java.lang.String REAL
See Also:
Constant Field Values

BOOLEAN

public static final java.lang.String BOOLEAN
See Also:
Constant Field Values

DATE

public static final java.lang.String DATE
See Also:
Constant Field Values

TIME

public static final java.lang.String TIME
See Also:
Constant Field Values

LIST

public static final java.lang.String LIST
See Also:
Constant Field Values

OBJECT_TYPE

public static final java.lang.String OBJECT_TYPE
See Also:
Constant Field Values

BASIC_TYPES

public static final java.lang.String[] BASIC_TYPES

PREDEFINED_FACTS

static final java.lang.String[] PREDEFINED_FACTS

GOAL_ATTRIBUTES

public static final java.lang.String[] GOAL_ATTRIBUTES

changeListeners

protected javax.swing.event.EventListenerList changeListeners

factIndex

protected java.util.Hashtable factIndex

restrictions

protected OrderedHashtable restrictions

editableLimit

protected int editableLimit

save_needed

protected boolean save_needed

error

protected java.lang.String error

warning

protected java.lang.String warning

filename

protected java.lang.String filename

ontologyName

protected java.lang.String ontologyName

genSym

protected GenSym genSym

HEADER

static final java.lang.String HEADER
See Also:
Constant Field Values

ELEMENT_TAG

static final java.lang.String ELEMENT_TAG
See Also:
Constant Field Values

ATTRIBUTE_TAG

static final java.lang.String ATTRIBUTE_TAG
See Also:
Constant Field Values

LT

static final java.lang.String LT
See Also:
Constant Field Values

GT

static final java.lang.String GT
See Also:
Constant Field Values

SPACE

static final java.lang.String SPACE
See Also:
Constant Field Values

OPEN_BRACKET

static final java.lang.String OPEN_BRACKET
See Also:
Constant Field Values

CLOSE_BRACKET

static final java.lang.String CLOSE_BRACKET
See Also:
Constant Field Values

COMMA

static final java.lang.String COMMA
See Also:
Constant Field Values

PCDATA

static final java.lang.String PCDATA
See Also:
Constant Field Values

CDATA

static final java.lang.String CDATA
See Also:
Constant Field Values
Constructor Detail

OntologyDb

public OntologyDb()

OntologyDb

public OntologyDb(GenSym genSym)
Method Detail

GenSym

public GenSym GenSym()

getOntologyName

public java.lang.String getOntologyName()
return the actual user defined name of the ontology


clear

public void clear()

isSaveNeeded

public boolean isSaveNeeded()

getError

public java.lang.String getError()

getWarning

public java.lang.String getWarning()

getFilename

public java.lang.String getFilename()

__setWarning

public void __setWarning(java.lang.String info)

saveDAML

public int saveDAML(java.io.File file)

saveXML

public int saveXML(java.io.File file)

getElementNodes

protected java.util.Vector getElementNodes(FactDescription desc)

hasBasicAttributes

protected boolean hasBasicAttributes(FactDescription desc)

saveFile

public int saveFile(java.io.File file)

openFile

public int openFile(java.io.File file)

setFilename

private void setFilename(java.io.File file)

isAncestorOf

public boolean isAncestorOf(java.lang.String name,
                            java.lang.String parent)

allAncestors

public java.util.Iterator allAncestors(java.lang.String name)
get a list of the ancestors of a type

Since:
1.2.2

addChildFact

public TreeNode addChildFact(TreeNode parent)

addNamedChildFact

public boolean addNamedChildFact(TreeNode parent,
                                 java.lang.String name)
New method added by Jaron to allow named facts to be added through an API call rather than the FactTable GUI


__addChildFact

public void __addChildFact(java.lang.String parent,
                           java.lang.String name)

renameFact

public java.lang.Object renameFact(java.lang.String previous,
                                   java.lang.String current)

isFactEditable

public boolean isFactEditable(java.lang.String name)

removeFact

public void removeFact(TreeNode node)

copyFactTree

public TreeNode copyFactTree(TreeNode node)

copyFactTree1

protected void copyFactTree1(TreeNode top_node,
                             TreeNode node)

pasteFactTree

public TreeNode pasteFactTree(TreeNode parent,
                              TreeNode node)

hasFact

public boolean hasFact(java.lang.String fact)

getFact

public Fact getFact(boolean is_variable,
                    java.lang.String type)
This method is used to create a new Fact from its ontology description


getAttributeEntriesFor

public java.lang.String[][] getAttributeEntriesFor(java.lang.String fact)

getAllAttributeEntriesFor

public java.lang.String[][] getAllAttributeEntriesFor(java.lang.String fact)

getEditableLimit

public int getEditableLimit()

getNetAttributeEntriesFor

java.lang.String[][] getNetAttributeEntriesFor(java.lang.String fact)

getNetAttributesOnlyFor

java.lang.String[] getNetAttributesOnlyFor(java.lang.String fact)

setAttribute

public java.lang.String setAttribute(java.lang.String fact,
                                     java.lang.String attribute,
                                     int column,
                                     java.lang.String value)

addNewAttributeRow

public void addNewAttributeRow(java.lang.String fact)

addNewAttribute

public void addNewAttribute(java.lang.String fact,
                            java.lang.String name,
                            java.lang.String type)

__addNewAttributeRow

public void __addNewAttributeRow(java.lang.String fact,
                                 java.lang.String name,
                                 java.lang.String type,
                                 java.lang.String restriction,
                                 java.lang.String default_value)

deleteAttributes

public void deleteAttributes(java.lang.String fact,
                             java.lang.String[] attributes)

addAttributeRows

public void addAttributeRows(java.lang.String fact,
                             java.lang.String[][] input)

createAttributeTree

public TreeNode createAttributeTree(java.lang.String fact,
                                    java.lang.String name)

createAttributeTreeNodes

protected void createAttributeTreeNodes(java.lang.String fact,
                                        TreeNode base)

getAllRestrictions

public java.lang.String[][] getAllRestrictions()

getAllRestrictionNames

public java.lang.String[] getAllRestrictionNames()

setRestrictionData

public java.lang.String setRestrictionData(java.lang.String name,
                                           int column,
                                           java.lang.Object aValue)

addNewRestriction

public void addNewRestriction()

deleteRestrictions

public void deleteRestrictions(java.lang.String[] names)

addRestrictions

public void addRestrictions(java.lang.String[][] input)

__addRestriction

public void __addRestriction(java.lang.String name,
                             java.lang.String type,
                             java.lang.String value)

validateFact

public boolean[] validateFact(Fact f1)

validate

boolean validate(java.lang.String fact,
                 java.lang.String attribute,
                 ValueFunction value)

getAllRestrictionValidityInfo

public boolean[][] getAllRestrictionValidityInfo()

isRestrictionValid

public boolean[] isRestrictionValid(java.lang.String name)

checkRestriction

protected ValueFunction checkRestriction(ValueFunction child,
                                         java.lang.String name)

checkDefaultValue

protected ValueFunction checkDefaultValue(java.lang.String type,
                                          java.lang.String value)

checkRestrictionEntry

protected ValueFunction checkRestrictionEntry(java.lang.String type,
                                              java.lang.String value)

getRestrictionBasicType

protected java.lang.String getRestrictionBasicType(java.lang.String restriction)

getBasicType

protected java.lang.String getBasicType(java.lang.String type)

isAttributeValid

public boolean[] isAttributeValid(java.lang.String fact,
                                  java.lang.String name)

getInheritedTypeFor

protected java.lang.String getInheritedTypeFor(java.lang.String fact,
                                               java.lang.String name)

getValidityInfoFor

public boolean[][] getValidityInfoFor(java.lang.String fact)

getAllValidityInfoFor

public boolean[][] getAllValidityInfoFor(java.lang.String fact)

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener x)

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener x)

fireChanged

protected void fireChanged(int type,
                           java.lang.Object data)

main

public static void main(java.lang.String[] arg)

getFactIndex

public java.util.Hashtable getFactIndex()


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.