dca::UrlClassification Class Reference
[URL Classification]

#include <url_classification.h>

List of all members.


Detailed Description

Main class for the URL classification.

See also:
UrlDbClassifier
// assume we have a valid DcaInstance (myDca), License (myLicense) and DbConnection (myDbConnection)

// initialize the URL Classification module
dca::UrlClassification myUrlClassification = 
        dca::UrlClassification::create( myDca, myLicense );

UrlDbClassifierOptions creationOptions;
// enable Feedback mechanism
creationOptions.enable_Feedback = true; 
// enable detection of embedded URLs
creationOptions.enable_EmbeddedUrlDetection = true;

// create a UrlDbClassifier by using creationOptions
dca::UrlDbClassifier myUrlDbClassifier = 
        myUrlClassification.createDbClassifier( myDbConnection, creationOptions );

// create a URL object to classify
dca::Url myUrl = dca::Url::create( myDca, "www.ibm.com" );

// declare the classification results
dca::UrlClassificationResults myUrlClassificationResults;

// start URL Classification
dca::FunctionResult myResult = 
        myUrlDbClassifier.classify( myUrl, myUrlClassificationResults );

// if myResult returns false an error occurred.
if( !myResult ) {
        cout << "Received an error from URL Classification (Error code:" <<
                myResult.getReturnCode() << ", Description: " <<
                myResult.getDescription() << ")." << endl;
        return;
}

if( myUrlClassificationResults.isUnknownUrl() ) {
        // if the given URL is unknown there are no resulting categories available
        cout << "Received no results, URL is unknown." << endl;
        return;
}

if( !myUrlClassificationResults.isCategorized() ) {
        // given URL (or host) is KNOWN, but does not have any categories assigned
        cout << "URL is known but has no assigned categories." << endl;
        return;
}

// we got results and want to print them out
PrintResults( myUrlClassificationResults );

Definition at line 101 of file url_classification.h.

Public Member Functions

UrlDbClassifier createDbClassifier (const DbConnection &aDbConnection, const UrlDbClassifierOptions &options=UrlDbClassifierOptions()) const
 Create a URL database classifier. The classifier is created by using the provided database connection. The DbClassifier is automatically connected to the database via the DbConnection after successful initialization.
LogLevel setLogLevel (LogLevel newLevel)
 Sets the logging level for the given class instance. The old value will be returned.

Static Public Member Functions

static UrlClassification create (const DcaInstance &aDcaInstance, const License &aLicense)
 Creates the URL classification module by using the given DcaInstance and License.

Static Public Attributes

static DCA_MODULE_ID_TYPE ID
 The unique ID of the URL classification module.

Member Function Documentation

static UrlClassification dca::UrlClassification::create ( const DcaInstance aDcaInstance,
const License aLicense 
) [static]

Creates the URL classification module by using the given DcaInstance and License.

This is the package creation function.

Before using any other functions of the URL classification package, a UrlClassification instance must be created by sumitting a valid DcaInstance and License.

Parameters:
[in] aDcaInstance A previously initialized DcaInstance object
[in] aLicense An initialized License object
Returns:
An initialized UrlClassification instance.
Exceptions:
ExDca One of the following error codes (available by using ExDca::getReturnCode() in your catch-handler)

UrlDbClassifier dca::UrlClassification::createDbClassifier ( const DbConnection aDbConnection,
const UrlDbClassifierOptions options = UrlDbClassifierOptions() 
) const

Create a URL database classifier. The classifier is created by using the provided database connection. The DbClassifier is automatically connected to the database via the DbConnection after successful initialization.

Parameters:
[in] aDbConnection The database connection to be used for classification
[in] options The Options that define several aspects on how embedded URLs should be handled, and whether or not WebLearn should be enabled. This paramter is optional.
Returns:
A UrlDbClassifier that is associated with the specified db connection, using the specified options (if any).
Exceptions:
ExDca One of the following error codes (available by using ExDca::getReturnCode() in your catch-handler)

LogLevel dca::UrlClassification::setLogLevel ( LogLevel  newLevel  ) 

Sets the logging level for the given class instance. The old value will be returned.

Usually the logging level is set to LOG_Notice.

Parameters:
[in] newLevel The new LogLevel the class instance should use for logging
Returns:
The old used logging level.

The documentation for this class was generated from the following file:

Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1