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

Author:
KAoS Team $Revision: 1.8 $

Method Summary
 java.util.Set<java.lang.String> askQuery(java.lang.String variableName, java.lang.String multiplyVariablesQuery)
          Get values of the selected variable satisfying 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<java.lang.String> getResourcesWithValueForProperty(java.lang.String property, java.lang.String value)
          Get values of the variable satisfying the KIF query: (property ?subject value).
 java.util.Set<java.lang.String> getUltimateOntologyTypesOfIndividual(java.lang.String individualName)
           
 java.lang.String getUniqueValueForProperty(java.lang.String property, java.lang.String subject)
          Get a single value of the variable satisfying the KIF query: (property subject ?val).
 java.util.Set<java.lang.String> getValuesForProperty(java.lang.String property, java.lang.String subject)
          Get values of the variable satisfying 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)
          kaos.core.csi.query.QueryState interface implementation - begin
 
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
kaos.core.csi.query.QueryState interface implementation - begin

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<java.lang.String> askQuery(java.lang.String variableName,
                                                java.lang.String multiplyVariablesQuery)
                                         throws DirectoryFailure,
                                                QueryFailure
Description copied from interface: QueryState
Get values of the selected variable satisfying 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 satisfying 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
Description copied from interface: QueryState
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 unknown

getValuesForProperty

public java.util.Set<java.lang.String> getValuesForProperty(java.lang.String property,
                                                            java.lang.String subject)
                                                     throws DirectoryFailure,
                                                            QueryFailure
Description copied from interface: QueryState
Get values of the variable satisfying 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
QueryFailure

getResourcesWithValueForProperty

public java.util.Set<java.lang.String> getResourcesWithValueForProperty(java.lang.String property,
                                                                        java.lang.String value)
                                                                 throws DirectoryFailure,
                                                                        QueryFailure
Description copied from interface: QueryState
Get values of the variable satisfying the KIF query: (property ?subject value).

Specified by:
getResourcesWithValueForProperty in interface QueryState
Parameters:
property - the name of the property
value - the value
Returns:
a set with name of subjects which has the specified value for the given property
Throws:
DirectoryFailure
QueryFailure

getUniqueValueForProperty

public java.lang.String getUniqueValueForProperty(java.lang.String property,
                                                  java.lang.String subject)
                                           throws DirectoryFailure,
                                                  QueryFailure
Description copied from interface: QueryState
Get a single value of the variable satisfying the KIF query: (property subject ?val).

Specified by:
getUniqueValueForProperty in interface QueryState
Parameters:
property - String containing the name of the property.
subject - String containing the name of the subject.
Returns:
String containing the single value for the property on this subject.
Throws:
DirectoryFailure - if the connection to the DS cannot be established.
QueryFailure - if reasoning failed.

getUltimateOntologyTypesOfIndividual

public java.util.Set<java.lang.String> getUltimateOntologyTypesOfIndividual(java.lang.String individualName)
                                                                     throws DirectoryFailure,
                                                                            UnknownConceptException
Throws:
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)