Wednesday, October 18, 2006

Creating your Own (DBE) Semantic Search Engine

The DBE by default comes with 2 different search engine interfaces. One is integrated within the DBEStudio (QFSDT or Query Formulator and Semantic Discovery Tool) as a Eclipse perspecive and the other is integrated within the, soon to be released, DBE Portal, which in turn is also based on the QFSDT codebase.

If for whatever reason the default ones are not enough or if you want to create a complete new way of searching for DBE real world and software services, it is not too difficult to create your own.

If we keep things simple, we can quickly extend the portal QFSDT library and create our own semantic search engine with, literally, 10 lines of code.

As an example, the figure below illustrates what the user interface of the DBE Portal displays when we enter a search query. Please note that the query used uses the DBE query language. For example, if I want to search for restaurants in Nottingham, a potential query based on the BML models that I used and deployed as part of the ServiceManifests is:

Restaurants location=Nottingham

The results are:

The previous screenshot shows the basis of performing a search operation. First of all we need to create an instance of ServiceSearcher, which takes no arguments.

ServiceSearcher serviceSearcher = new ServiceSearcher()

After we obtain an instance of ServiceSearcher, we call the getServices method with one argument of type String.

Vector v = serviceSearcher.getServices(String s);

Where in our case s = "MyID4Searching##### Restaurant location=Nottingham"

The argument contains in reality two different parameters separated by the string “####”. The first parameter specifies a search ID that can be used to performed asynchronous search across several Semantic Registries. To keep things simple, we assume that we only search in one SR (the local one as configured in qfsdt.portal settings, not shown on this example).

The second parameter is the query itself, which in this case is:
"Restaurant location=Nottingham"

When the query returns we obtain a Vector in which each element is a String[] containing 4 elements: the SMID of the service, the rating according to our query, and two more related to the Service Name/Description and URL.

The example can be downloaded here:



Post a Comment

<< Home