Extensions

Creating New Functions for Regular Expressions

It is possible to create new functions to use in the link and rewriting filters used by the WebBot crawling module.

To create new functions in WebBot, implemented in Java, the following class has to be extended:

com.denodo.aracne.webbot.util.processors.function.FunctionExpression

implementing its two abstract methods:

public abstract void validate()

which checks that the parameters of the function are valid and, in another case, launches an ExpressionProcessorException.

and

public abstract String doProcess()

which evaluates the function and returns the result. In the case of the built-in DateFormat function, doProcess calculates the date corresponding to a specific expression and returns it as a string following the indicated pattern.

The FunctionExpression class provides two utility methods:

public String getParameter(int i) throws InvalidParameterException

public int getNumOfParameters()

which allow obtaining the parameters of the function and its number.

In order for the new functions to be used by Denodo Aracne, these must belong to the package com.denodo.aracne.webbot.util.processors.function.

For more information consult the Denodo Aracne Javadoc documentation and the examples in <DENODO_HOME>/samples/arn/webbot-api.