OntoSimOntoSim is a Java API allowing to compute similarities between ontologies. It relies on the Alignment API for ontology loading so it is quite independent of the ontology API used (JENA or OWL API).
OntoSim provides a framework for designing various kinds of similarities. In particular, we differentiated similarities in the ontology space [David2008a] from those in the alignment space [Euzenat2009b,David2010b]. The latter ones make use of available alignments in a network of ontologies while the former only rely on ontology data. OntoSim is based on an ontology interface, shared with the Alignment API Ontowrap package allowing for using ontology parsed with different API. Structure
APIThe Measure interfaceThe OntoSim API is based on a very simple generic Measure interface. The public interface Measure<O> { static enum TYPES {similarity, dissimilarity, distance, other}; public TYPES getMType(); public double getMeasureValue( O o1, O o2); public double getSim( O o1, O o2); public double getDissim( O o1, O o2); }
This generic interface is instanciated for defining the profile of various basic categories of measures:
MatrixMeasureThe This allows to define the
ExtractorThe The interface is: public interface Extractor { Cardinality getCardinality(); Object[][] extract(Matrix m); //or Matching extract(Matrix m); } The AggregationSchemeThe public AggregationScheme { double getValue(double[] vals); }With the new version of OntoSim, the DistanceAlignment class should be refactored in order it can easily use OntoSim entity measures.
public abstract class AggregationScheme { public abstract double getValue(double[] vals); public abstract <O> double getValue(Measure<O> measure,Matching<O> matching); } Ontology measuresFrom this it is possible to define general classes of measures such as: Measure |- AlignmentSpaceMeasure (abstract: OntologyNetwork) |- OntologySpaceMeasure (abstract: ) |- VectorSpaceMeasure (abstract: Collection<LoadedOntology>)These measures are simply defined with respect to their internal variables. ExampleOntologyFactory of=OntologyFactory.getFactory(); LoadedOntology o1 = of.loadOntology(uri1); LoadedOntology o2 = of.loadOntology(uri2); Vector<LoadedOntology> ontos = new Vector<LoadedOntology>(); ontos.add(o1); ontos.add(o2); VectorLexicalSim m = new VectorLexicalSim(ontos,new JaccardVM(), DocumentCollection.VECTOR_TYPE.TFIDF); System.out.println(m.getSim(o1, o2,)); SetMeasure<Entity> cm = new MaxCoupling(new OLAEntitySim()); GeneralOntologyMeasure m2 = new GeneralOntologyMeasure(cm); System.out.println(m2.getSim(o1, o2,)); EntityLexicalMeasure lm=new EntityLexicalMeasure(new StringMeasureSS(new Levenstein())); SetMeasure<Entity> cm2 = new MaxCoupling(lm); GeneralOntologyMeasure m3 = new GeneralOntologyMeasure(cm2); System.out.println(m3.getSim(o1, o2)); LicenseOntoSim is available under the LGPL 2.1 or above. 2 http://secondstring./ |
|
来自: yanniyanxin > 《jena》