dca::UrlDbClassifier Class Reference
[URL Classification]

#include <urldb_classifier.h>

List of all members.


Detailed Description

URL database classifier class.

The classify function takes a given URL object and returns the database classification result.

This can be either

See also:
UrlClassification::createDbClassifier, UrlClassification, UrlClassificationResults,
// 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 39 of file urldb_classifier.h.

Public Member Functions

FunctionResult classify (const Url &aUrl, UrlClassificationResults &urlResults) const
 Performs the URL classification and returns the results.
LogLevel setLogLevel (LogLevel newLevel)
 Sets the logging level for the given class instance. The old value will be returned.

Member Function Documentation

FunctionResult dca::UrlDbClassifier::classify ( const Url aUrl,
UrlClassificationResults urlResults 
) const

Performs the URL classification and returns the results.

Parameters:
[in] aUrl A URL object created by using Url::create()
[out] urlResults The classification results, containing all matched categories (if any)
Returns:
DCA_SUCCESS or one of the following error codes
LogLevel dca::UrlDbClassifier::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