Search:
OWL-S iMatcher Project Page

Overview

OWL-S iMachter performs hybrid Semantic Web service matchmaking. The main features of the program are the following:

  • allows the user to define customized matchmaking strategies
  • uses similarity measures to improve the matchmaking performance
  • includes an evaluation framework
  • calculates precision vs. recall graphs
  • allows the user to immediately plot the results using Gnuplot
  • is simple to use
  • is extensible with related matchmaking techniques in the field

How to use

Typically, the following steps are necessary to perform customized matchmaking:

1. Define an iSPARQL strategy.

A simple strategy could look as follows:

================================================
  1 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  2 PREFIX owl: <http://www.w3.org/2002/07/owl#>
  3 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  4 PREFIX service: <http://www.daml.org/services/owl-s/1.1/Service.owl#>
  5 PREFIX profile: <http://www.daml.org/services/owl-s/1.1/Profile.owl#>
  6 PREFIX simpack: <java:ch.uzh.ifi.isparql.apf.simpack.>
  7
  8 SELECT ?service ?sim
  9 WHERE {
10   ?service service:presents ?serviceProfile .
11   ?serviceProfile profile:serviceName ?serviceName .
12   <http://localhost/book_price_service.owls#BOOK_PRICE_SERVICE> service:presents ?queryProfile .
13   ?queryProfile profile:serviceName ?queryName .
14
15   IMPRECISE {
16     ?sim simpack:levenshtein (?serviceName ?queryName)
17   }
18
19 } ORDER BY DESC (?sim)
================================================


As mentioned earlier, the creation and evaluation of arbitrary complex strategies is possilble. Have a look at a more complex strategy, such as the following:

================================================
  1   PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  2   PREFIX owl: <http://www.w3.org/2002/07/owl#>
  3   PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  4   PREFIX service: <http://www.daml.org/services/owl-s/1.1/Service.owl#>
  5   PREFIX profile: <http://www.daml.org/services/owl-s/1.1/Profile.owl#>
  6   PREFIX simpack: <java:ch.uzh.ifi.isparql.apf.simpack.>
  7
  8   SELECT ?service ?sim
  9   WHERE {
10     ?service service:presents ?serviceProfile .
11     ?serviceProfile profile:serviceName ?serviceName .
12     ?serviceProfile profile:textDescription ?serviceTextDescription .
13     <http://localhost/book_price_service.owls#BOOK_PRICE_SERVICE> service:presents ?queryProfile .
14     ?queryProfile profile:textDescription ?queryTextDescription .
15     ?queryProfile profile:serviceName ?queryName .
16
17     IMPRECISE {
18       ?sim1 simpack:xingstroulia (?serviceName ?queryName) .
19       ?sim2 simpack:tfidf (?serviceTextDescription ?queryTextDescription) .
20       ?sim3 simpack:jaccardInputs (?serviceProfile ?queryProfile "true") .   
21       ?sim4 simpack:jaccardOutputs (?serviceProfile ?queryProfile "true") .
22       ?sim simpack:score (0.0401 ?sim1 0.9488 ?sim2 0.1933 ?sim3 0.0843 ?sim4 -0.0396 1.0)
23     }
24
25   } ORDER BY DESC (?sim)        
================================================

2. Define an iSPARQL property function.

For instance, for the virtual triple pattern simpack:levenshtein in the first strategy on line 16:

package ch.uzh.ifi.isparql.apf.simpack;

import simpack.accessor.string.StringAccessor;
import simpack.measure.sequence.Levenshtein;
import simpack.util.conversion.WorstCaseDistanceConversion;

import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.query.core.Var;
import com.hp.hpl.jena.query.engine.Binding;
import com.hp.hpl.jena.query.engine.Binding1;
import com.hp.hpl.jena.query.engine.QueryIterator;
import com.hp.hpl.jena.query.engine1.ExecutionContext;
import com.hp.hpl.jena.query.engine1.iterator.QueryIterSingleton;
import com.hp.hpl.jena.query.expr.NodeValue;
import com.hp.hpl.jena.query.pfunction.PropFuncArg;
import com.hp.hpl.jena.query.pfunction.PropertyFunctionBase;

public class levenshtein extends PropertyFunctionBase {

  @Override
  public QueryIterator exec(Binding binding, PropFuncArg subject,
      Node predicate, PropFuncArg object, ExecutionContext execCxt) {

    subject = subject.evalIfExists(binding);
    Node s = subject.getArg();

    object = object.evalIfExists(binding);
    Node arg1 = object.getArg(0);
    Node arg2 = object.getArg(1);

    String a = null, b = null;
    if (arg1.isLiteral() && arg2.isLiteral()) {
      a = arg1.getLiteralLexicalForm();
      b = arg2.getLiteralLexicalForm();
    else if (arg1.isURI() && arg2.isURI()) {
      a = arg1.getLocalName();
      b = arg2.getLocalName();
    else {
      System.out.println("Error: Node types unequal.");
      System.out.println(arg1.toString());
      System.out.println(arg2.toString());
    }

    StringAccessor sa1 = new StringAccessor(a);
    StringAccessor sa2 = new StringAccessor(b);

    Levenshtein<String> levensteinMeasure;
    levensteinMeasure = new Levenshtein<String>(sa1, sa2,
        new WorstCaseDistanceConversion());
    double sim = levensteinMeasure.getSimilarity();

    NodeValue nv = NodeValue.makeDouble(sim);
    Binding bind = new Binding1(binding, Var.alloc(s), nv.asNode());

    return new QueryIterSingleton(bind, execCxt);
  }
}


3. Customize evaluation run

Customize class MacroAveragingTest in the tests package by specifying the service knowledge base and the queries to be executed. Furthermore, add a line as follows:

strategies.add(new LevNStrategy());

This will execute the strategy defined by the LevNStrategy class. As a result, a file called eval.gp will be created, which can be plotted with Gnuplot.

4. Plot

Call the script gnuplot.sh to print the precision vs. recall curve(s) for this iSPARQL matchmaking strategy:

[peter@neverland]$ ./gnuplot.sh

This will open a window to display the curve.

License

iMatcher is licensed under LGPL.

Download

OWL-S iMatcher consists of two parts:

  • iMatcher: Core Semantic Web service matchmaker
  • SimPack: Generic Java library of similarity measures for the use in ontologies (the newest version of SimPack is already include in iMatcher)

Datasets

Questions and Bug Reports

If you find bugs or you have problems with the code you cannot solve by yourself, please contact me via email.

References

Last modified March 15th, 2008 by Christoph Kiefer <kiefer at ifi.uzh.ch>

4905