com.apelon.dts.client.classifier
Class ClassifyQuery

java.lang.Object
  extended by com.apelon.apelonserver.client.BasicQuery
      extended by com.apelon.dts.client.classifier.ClassifyQuery

public abstract class ClassifyQuery
extends BasicQuery

This class can be used to perform the classification of an Ontylog Extension namespace.
In order to classify an Ontylog Extension namespace, the concepts must adhere to these rules:

The following modeling error conditions are identified during the classification process:

Once the classification is done successfully, the classification graph( inferred concepts and inferred roles) is refreshed for the Ontylog Extension namespace.

ClassifyQuery can take serveral types of ServerConnection. If the serverconnection is JDBC connection, the location of RTC connection parameter properties needs to be passed. If you're using a JDBC connection, you'll need to add something like the following lines:

  ServerConnectionJDBC scJDBC = new ServerConnectionJDBC(user, password,
    host, port, instance);

   ClassifyQuery classifyQuery =     ClassifyQuery.createInstance(scJDBC);

  String mcPath = "mc.properties"; //path is relative to the working directory
  scJDBC.setQueryServer(
     Class.forName("com.apelon.dts.server.ClassifyServer"),
       com.apelon.dts.client.common.DTSHeader.CLASSIFYQUERY_HEADER,
      new String[]{mcPath});
 

The following events are fired in this class: If you have two instances of ClassifyQuery and you would like to share the listeners between them, then you can code something like this.
 ClassifyQuery cq1 = null;
 ClassifyQuery cq2 = null;

 // Initialization code for cq1 and cq2

 cq2.addClassifyListener(cq1.getClassifyListener());
 // Now any event from cq2 will be available to cq1 listeners
 

Copyright: Copyright (c) 2003

Company: Apelon, Inc.

Since:
DTS 3.3.0
Version:
DTS 3.3.0
Author:
Apelon, Inc.

Field Summary
protected  ClassifyListener classifyListener
           
 
Fields inherited from class com.apelon.apelonserver.client.BasicQuery
ADMIN, queryHeader
 
Constructor Summary
protected ClassifyQuery()
          Creates an instance of ClassifyQuery.
protected ClassifyQuery(boolean isValidating)
          Constructs a new ClassifyQuery.
 
Method Summary
 void addClassifyListener(ClassifyListener listener)
           
 boolean classify(int namespaceId)
          Sends classification request to Modular Classifier server to classify the given Ontylog Extension local namespace with respect to the linked Ontylog Subscription namespace.
static ClassifyQuery createInstance(ServerConnection sc)
          Creates an instance of ClassifyQuery
Depending on the type of ServerConnection object passed in the argument, the query may be local(JDBC), socket, or another implementation.
static ClassifyQuery createInstance(ServerConnection sc, boolean isValidating)
          Creates an instance of ClassifyQuery.
protected  void fireClassifyAction(ClassifyEvent event)
           
 ClassifyListener getClassifyListener()
          Get the ClassifyListener.
static boolean isCycleError(DTSException de)
          During the classification, if an exception is thrown, this method can tell if the exception is due to the cycle error.
static boolean isEqError(DTSException de)
          During the classification, if an exception is thrown, this method can tell if the exception is due to the eq error.
 void removeClassifyListener(ClassifyListener listener)
           
 
Methods inherited from class com.apelon.apelonserver.client.BasicQuery
executeQuery, executeQueryNoParse, getServerConnection, initializeDtds, initializeDtds, ping, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classifyListener

protected transient ClassifyListener classifyListener
Constructor Detail

ClassifyQuery

protected ClassifyQuery()
Creates an instance of ClassifyQuery.


ClassifyQuery

protected ClassifyQuery(boolean isValidating)
Constructs a new ClassifyQuery.

Parameters:
isValidating - a boolean value. It is true if XML needs to be validated, otherwise it is false.
Method Detail

createInstance

public static ClassifyQuery createInstance(ServerConnection sc)
                                    throws IllegalArgumentException
Creates an instance of ClassifyQuery
Depending on the type of ServerConnection object passed in the argument, the query may be local(JDBC), socket, or another implementation.

Parameters:
sc - the type of server connection
Returns:
the created ClassifyQuery
Throws:
IllegalArgumentException - if a null server connection is passed
See Also:
ServerConnectionJDBC, ServerConnectionSocket

createInstance

public static ClassifyQuery createInstance(ServerConnection sc,
                                           boolean isValidating)
                                    throws IllegalArgumentException
Creates an instance of ClassifyQuery.
Depending on the type of ServerConnection object passed in the argument, the server may be local(JDBC), socket, or another implementation.
The second argument is a boolean value for XML validation.

Parameters:
sc - the type of server connection
isValidating - true if XML needs to be validated; otherwise it is false.
Returns:
the created AssociationServer
Throws:
IllegalArgumentException - if a null server connection is passed
See Also:
ServerConnectionJDBC, ServerConnectionSocket

classify

public boolean classify(int namespaceId)
                 throws DTSException
Sends classification request to Modular Classifier server to classify the given Ontylog Extension local namespace with respect to the linked Ontylog Subscription namespace. If this request is successfully serviced, the classification graph (inferred concepts and inferred roles) is refreshed for the Ontylog Extension namespace.

The classification process checks these conditions for the concepts of the namespace :

If any of these conditions is false, it is notified via DTSException.

The classification process also throws DTSException for these modeling errors:

There is a limitation of number of concepts to be classified. The default maximum number of concepts to be classified is 1,0000,000. If the number of concepts in the Ontylog Extension namespace is more than this limit, the API will throw DTSException.

Parameters:
namespaceId - Ontylog Extension namespace id
Returns:
true - the classification is done successfully; otherwise false.
Throws:
DTSException - if any error occurs in the method
See Also:
ClassifyDetailsQuery

isCycleError

public static boolean isCycleError(DTSException de)
During the classification, if an exception is thrown, this method can tell if the exception is due to the cycle error.

Parameters:
de - DTSException thrown from classify API
Returns:
true - indicates the error is due to cycle error; otherwise false.
See Also:
ClassifyCycleError

isEqError

public static boolean isEqError(DTSException de)
During the classification, if an exception is thrown, this method can tell if the exception is due to the eq error.

Parameters:
de - DTSException thrown from classify API
Returns:
true - indicates the error is due to equivalency error; otherwise false.
See Also:
ClassifyEquivError

fireClassifyAction

protected void fireClassifyAction(ClassifyEvent event)

getClassifyListener

public ClassifyListener getClassifyListener()
Get the ClassifyListener. This can be used to link the chain of classify listeners of this class to classify listener of another instance of ClassifyQuery.

Returns:
ClassifyListener

addClassifyListener

public void addClassifyListener(ClassifyListener listener)

removeClassifyListener

public void removeClassifyListener(ClassifyListener listener)


Copyright © 2011. All Rights Reserved.