org.opencyc.uml.interpreter
Class CycExtractor

java.lang.Object
  |
  +--org.opencyc.uml.interpreter.CycExtractor

public class CycExtractor
extends java.lang.Object

Extracts a state machine model from the Cyc KB.

Author:
Stephen L. Reed

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Field Summary
protected  CycList argumentTerms
          the argument terms for the current procedure
protected  CompositeState container
          the container of the current state vertex
protected  CycAccess cycAccess
          the CycAccess object which manages the Cyc server connection
static int DEFAULT_VERBOSITY
          The default verbosity of this object's output.
protected  org.opencyc.uml.core.Procedure doActivityProcedure
          the doActivity procedure for the current state
protected  org.opencyc.uml.core.Procedure entryProcedure
          the entry procedure for the current state
protected  org.opencyc.uml.core.Procedure exitProcedure
          the exit procedure for the current state
static java.lang.String mtName
          the name of the relevant inference microtheory
protected  CycFort mtTerm
          the relevant inference microtheory
protected  java.util.HashMap procedureDictionary
          the dictionary with the key a procedureTerm and the value its Procedure
protected  CycList procedureTerms
          the list of procedure terms
protected  CycList resultTerms
          the result terms for the current procedure
protected  StateMachine stateMachine
          the state machine
protected  StateMachineFactory stateMachineFactory
          the state machine factory
protected  java.lang.String stateMachineName
          the state machine name
protected  CycConstant stateMachineTerm
          the state machine term
protected  java.lang.String stateVertexCommentString
          the current state vertex comment string
protected  java.util.HashMap stateVertexDictionary
          the dictionary with the key a stateTerm and the value its StateVertex
protected  java.lang.String stateVertexName
          the current state vertex name
protected  CycList stateVertexTerms
          the list of state vertex terms
protected  java.util.HashMap transitionDictionary
          the dictionary with the key a transitionTerm and the value its Transition
protected  CycList transitionTerms
          the list of transition terms
protected  int verbosity
          Sets verbosity of this object's output.
 
Constructor Summary
CycExtractor(CycAccess cycAccess)
          Construct a new CycExtractor object given the CycAccess server connection.
 
Method Summary
 StateMachine extract(java.lang.String stateMachineName)
          Extracts the state machine model specified by the given name.
protected  void extractCompositeState(CycConstant compositeStateTerm)
          Extracts a composite state from Cyc given its Cyc term
protected  void extractFinalState(CycConstant finalStateTerm)
          Extracts a final state from Cyc given its Cyc term
protected  void extractProcedures()
          Extracts the procedures for the state machine from Cyc.
protected  void extractPseudoState(CycConstant pseudoStateTerm)
          Extracts a pseudo state from Cyc given its Cyc term
protected  void extractSimpleState(CycConstant simpleStateTerm)
          Extracts a simple state from Cyc given its Cyc term
protected  StateMachine extractStateMachine()
          Extracts the state machine from Cyc.
protected  void extractStates()
          Extracts the states for the state machine from Cyc.
protected  void extractTransitions()
          Extracts the transitions for the state machine from Cyc.
protected  void getArgumentAndResultTerms(CycConstant procedureTerm)
          Gets the argument and result terms for the given procedure term.
protected  void getEntryExitDoActivityProcedures(CycConstant stateTerm)
          Gets the entry, exit and doActivity procedures for the given state term
protected  void getProcedureTerms()
          Returns the procedure terms of the state machine.
protected  void getStateTerms()
          Finds the state terms of the state machine term.
protected  void getTransitionTerms()
          Returns the transition terms of the state machine.
 void setVerbosity(int verbosity)
          Sets verbosity of this object's output.
protected  Event translateTermToEvent(CycConstant eventTerm)
          Returns the Event corresponding to the given event term
protected  java.lang.Class translateType(CycConstant typeTerm)
          Returns the java class denoted by the given Cyc type term.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VERBOSITY

public static final int DEFAULT_VERBOSITY
The default verbosity of this object's output. 0 --> quiet ... 9 -> maximum diagnostic input.

verbosity

protected int verbosity
Sets verbosity of this object's output. 0 --> quiet ... 9 -> maximum diagnostic input.

mtName

public static final java.lang.String mtName
the name of the relevant inference microtheory

mtTerm

protected CycFort mtTerm
the relevant inference microtheory

cycAccess

protected CycAccess cycAccess
the CycAccess object which manages the Cyc server connection

stateMachineFactory

protected StateMachineFactory stateMachineFactory
the state machine factory

stateMachineTerm

protected CycConstant stateMachineTerm
the state machine term

stateMachineName

protected java.lang.String stateMachineName
the state machine name

stateMachine

protected StateMachine stateMachine
the state machine

stateVertexTerms

protected CycList stateVertexTerms
the list of state vertex terms

stateVertexDictionary

protected java.util.HashMap stateVertexDictionary
the dictionary with the key a stateTerm and the value its StateVertex

transitionTerms

protected CycList transitionTerms
the list of transition terms

procedureTerms

protected CycList procedureTerms
the list of procedure terms

transitionDictionary

protected java.util.HashMap transitionDictionary
the dictionary with the key a transitionTerm and the value its Transition

procedureDictionary

protected java.util.HashMap procedureDictionary
the dictionary with the key a procedureTerm and the value its Procedure

argumentTerms

protected CycList argumentTerms
the argument terms for the current procedure

resultTerms

protected CycList resultTerms
the result terms for the current procedure

stateVertexName

protected java.lang.String stateVertexName
the current state vertex name

stateVertexCommentString

protected java.lang.String stateVertexCommentString
the current state vertex comment string

entryProcedure

protected org.opencyc.uml.core.Procedure entryProcedure
the entry procedure for the current state

exitProcedure

protected org.opencyc.uml.core.Procedure exitProcedure
the exit procedure for the current state

doActivityProcedure

protected org.opencyc.uml.core.Procedure doActivityProcedure
the doActivity procedure for the current state

container

protected CompositeState container
the container of the current state vertex
Constructor Detail

CycExtractor

public CycExtractor(CycAccess cycAccess)
Construct a new CycExtractor object given the CycAccess server connection.
Parameters:
cycAcess - the given CycAccess Cyc KB server connection
Method Detail

extract

public StateMachine extract(java.lang.String stateMachineName)
                     throws java.io.IOException,
                            CycApiException,
                            java.lang.ClassNotFoundException
Extracts the state machine model specified by the given name.
Parameters:
stateMachineName - the name of the state machine to be extracted from Cyc
Returns:
the state machine model specified by the given name

extractStateMachine

protected StateMachine extractStateMachine()
                                    throws java.io.IOException,
                                           CycApiException,
                                           java.lang.ClassNotFoundException
Extracts the state machine from Cyc.

extractProcedures

protected void extractProcedures()
                          throws java.io.IOException,
                                 CycApiException,
                                 java.lang.ClassNotFoundException
Extracts the procedures for the state machine from Cyc.

translateType

protected java.lang.Class translateType(CycConstant typeTerm)
                                 throws java.io.IOException,
                                        CycApiException,
                                        java.lang.ClassNotFoundException
Returns the java class denoted by the given Cyc type term.
Parameters:
typeTerm - the given type term
Returns:
the java class denoted by the given Cyc type term

getArgumentAndResultTerms

protected void getArgumentAndResultTerms(CycConstant procedureTerm)
                                  throws java.io.IOException,
                                         CycApiException
Gets the argument and result terms for the given procedure term.
Parameters:
procedureTerm - the given procedure term

extractStates

protected void extractStates()
                      throws java.io.IOException,
                             CycApiException,
                             java.lang.ClassNotFoundException
Extracts the states for the state machine from Cyc.

extractCompositeState

protected void extractCompositeState(CycConstant compositeStateTerm)
                              throws java.io.IOException,
                                     CycApiException
Extracts a composite state from Cyc given its Cyc term
Parameters:
compositeStateTerm - the given composite state term

extractPseudoState

protected void extractPseudoState(CycConstant pseudoStateTerm)
                           throws java.io.IOException,
                                  CycApiException
Extracts a pseudo state from Cyc given its Cyc term
Parameters:
pseuodStateTerm - the given pseudo state term

extractSimpleState

protected void extractSimpleState(CycConstant simpleStateTerm)
                           throws java.io.IOException,
                                  CycApiException
Extracts a simple state from Cyc given its Cyc term
Parameters:
simpleStateTerm - the given state vertex term

extractFinalState

protected void extractFinalState(CycConstant finalStateTerm)
                          throws java.io.IOException,
                                 CycApiException
Extracts a final state from Cyc given its Cyc term
Parameters:
finalStateTerm - the given state vertex term

getStateTerms

protected void getStateTerms()
                      throws java.io.IOException,
                             CycApiException
Finds the state terms of the state machine term.

getEntryExitDoActivityProcedures

protected void getEntryExitDoActivityProcedures(CycConstant stateTerm)
                                         throws java.io.IOException,
                                                CycApiException
Gets the entry, exit and doActivity procedures for the given state term
Parameters:
state - the given state term

getTransitionTerms

protected void getTransitionTerms()
                           throws java.io.IOException,
                                  CycApiException
Returns the transition terms of the state machine.

getProcedureTerms

protected void getProcedureTerms()
                          throws java.io.IOException,
                                 CycApiException
Returns the procedure terms of the state machine.

extractTransitions

protected void extractTransitions()
                           throws java.io.IOException,
                                  CycApiException,
                                  java.lang.ClassNotFoundException
Extracts the transitions for the state machine from Cyc.

translateTermToEvent

protected Event translateTermToEvent(CycConstant eventTerm)
                              throws java.io.IOException,
                                     CycApiException,
                                     java.lang.ClassNotFoundException
Returns the Event corresponding to the given event term
Parameters:
eventTerm - the given event term
Returns:
the Event corresponding to the given event term

setVerbosity

public void setVerbosity(int verbosity)
Sets verbosity of this object's output. 0 --> quiet ... 9 -> maximum diagnostic input.
Parameters:
verbosity - 0 --> quiet ... 9 -> maximum diagnostic input