kaos.core.csi.query
Class QueryStateImpl

java.lang.Object
  extended by kaos.core.csi.query.QueryStateImpl
All Implemented Interfaces:
QueryState

public class QueryStateImpl
extends java.lang.Object
implements QueryState

Defines the operations to query the different aspects of domain and actor registrations


Method Summary
 java.util.Set askQuery(java.lang.String variableName, java.lang.String multiplyVariablesQuery)
          Get values of the selected variable satisfing the KIF query with possibly many variable.
static QueryState getInstance(java.lang.String transportName)
          Retrieve an instance of QueryState.
 java.util.Set getInstancesOf(java.lang.String conceptName)
          Get set of instances of the given concept; if the concept is an instance itself the set contains just this instance.
 java.util.Set getUltimateOntologyTypesOfIndividual(java.lang.String individualName)
          Finds the ultimate Ontology type of the provided individual
 java.util.Set getValuesForProperty(java.lang.String property, java.lang.String subject)
          Get values of the variable satisfing the KIF query: (property subject ?val).
protected  void logMessage(java.lang.String msg, java.lang.Exception e, int logLevel)
           
protected  void logMessage(java.lang.String msg, int logLevel)
           
 boolean testTrue(java.lang.String statement)
          Test if the KIF statemant is true according to the ontologies in the ontology repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static QueryState getInstance(java.lang.String transportName)
                              throws java.lang.Exception
Retrieve an instance of QueryState.

Parameters:
transportName - String specifying the name of the transport to use for communication with the KAoS Directory Service.
Returns:
a singleton, QueryState.
Throws:
java.lang.Exception

testTrue

public boolean testTrue(java.lang.String statement)
                 throws DirectoryFailure,
                        QueryFailure
Test if the KIF statemant is true according to the ontologies in the ontology repository.

Specified by:
testTrue in interface QueryState
Parameters:
statement - to be tested for truth
Returns:
true if the statement is true and false in the opposite case
Throws:
DirectoryFailure - if the connection to the DS cannot be established
QueryFailure - if query failed

askQuery

public java.util.Set askQuery(java.lang.String variableName,
                              java.lang.String multiplyVariablesQuery)
                       throws DirectoryFailure,
                              QueryFailure
Get values of the selected variable satisfing the KIF query with possibly many variable.

Specified by:
askQuery in interface QueryState
Parameters:
variableName - the name of the selected variable
multiplyVariablesQuery - the query
Returns:
a set with values satisfing the query
Throws:
DirectoryFailure - if the connection to the DS cannot be established
QueryFailure - if query failed.

getInstancesOf

public java.util.Set getInstancesOf(java.lang.String conceptName)
                             throws DirectoryFailure,
                                    UnknownConceptException
Get set of instances of the given concept; if the concept is an instance itself the set contains just this instance.

Specified by:
getInstancesOf in interface QueryState
Parameters:
conceptName - The name of the concept
Returns:
Set of instance ids
Throws:
DirectoryFailure - if the connection to the DS cannot be established
UnknownConceptException - if conceptName is unknow

getValuesForProperty

public java.util.Set getValuesForProperty(java.lang.String property,
                                          java.lang.String subject)
                                   throws DirectoryFailure,
                                          QueryFailure
Get values of the variable satisfing the KIF query: (property subject ?val).

Specified by:
getValuesForProperty in interface QueryState
Parameters:
property - the name of the property
subject - the name of the subject
Returns:
a set with values for the property on this subject
Throws:
DirectoryFailure - if the connection to the DS cannot be established
QueryFailure - if query failed

getUltimateOntologyTypesOfIndividual

public java.util.Set getUltimateOntologyTypesOfIndividual(java.lang.String individualName)
                                                   throws DirectoryFailure,
                                                          UnknownConceptException
Finds the ultimate Ontology type of the provided individual

Parameters:
individualName - the name of the individual
Returns:
the set of names of the Ontology classes being the most narrow ones for the given individual
Throws:
individualName - if concept unknow or any problem with JTP approached
DirectoryFailure
UnknownConceptException

logMessage

protected void logMessage(java.lang.String msg,
                          int logLevel)

logMessage

protected void logMessage(java.lang.String msg,
                          java.lang.Exception e,
                          int logLevel)