Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2fae4bc2 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- first implementation of the new HeavyLoadedOntology interface

parent 869d02e5
No related branches found
No related tags found
No related merge requests found
/*
* $Id$
*
* Copyright (C) INRIA Rhne-Alpes, 2004-2008
* Copyright (C) INRIA, 2004-2008
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -29,6 +29,7 @@ import fr.inrialpes.exmo.align.impl.BasicEvaluator;
import fr.inrialpes.exmo.align.impl.ObjectAlignment;
import fr.inrialpes.exmo.align.onto.HeavyLoadedOntology;
import fr.inrialpes.exmo.align.onto.LoadedOntology;
import fr.inrialpes.exmo.align.onto.OntologyFactory;
import java.util.Enumeration;
import java.util.Iterator;
......@@ -57,12 +58,12 @@ public class ExtPREvaluator extends BasicEvaluator {
//private double editBETA = .6;
//private double oriented = .5;
private double symprec = 0.;
private double symrec = 0.;
private double effprec = 0.;
private double effrec = 0.;
private double orientprec = 0.;
private double orientrec = 0.;
private double symprec = 1.;
private double symrec = 1.;
private double effprec = 1.;
private double effrec = 1.;
private double orientprec = 1.;
private double orientrec = 1.;
private int nbexpected = 0;
private int nbfound = 0;
......@@ -77,15 +78,15 @@ public class ExtPREvaluator extends BasicEvaluator {
}
public double getSymPrecision() { return symprec; }
public double getSymRecall() { return symrec; }
public double getSymRecall() { return symrec; }
public double getSymSimilarity() { return symsimilarity; }
public double getEffPrecision() { return effprec; }
public double getEffRecall() { return effrec; }
public double getEffRecall() { return effrec; }
public double getEffSimilarity() { return effsimilarity; }
public double getOrientPrecision() { return orientprec; }
public double getOrientRecall() { return orientrec; }
public double getOrientRecall() { return orientrec; }
public double getOrientSimilarity() { return orientsimilarity; }
public int getExpected() { return nbexpected; }
......@@ -142,14 +143,14 @@ public class ExtPREvaluator extends BasicEvaluator {
// nbexpected is 0 [=> nbcorrect is 0] (r=NaN, p=0[if nbfound>0, NaN otherwise])
// precision+recall is 0 [= nbcorrect is 0]
// precision is 0 [= nbcorrect is 0]
symprec = symsimilarity / (double) nbfound;
symrec = symsimilarity / (double) nbexpected;
if ( nbfound != 0 ) symprec = symsimilarity / (double) nbfound;
if ( nbexpected != 0 ) symrec = symsimilarity / (double) nbexpected;
effsimilarity = symsimilarity;
effprec = effsimilarity / (double) nbfound;
effrec = effsimilarity / (double) nbexpected;
if ( nbfound != 0 ) effprec = effsimilarity / (double) nbfound;
if ( nbexpected != 0 ) effrec = effsimilarity / (double) nbexpected;
orientsimilarity = symsimilarity;
orientprec = orientsimilarity / (double) nbfound;
orientrec = orientsimilarity / (double) nbexpected;
if ( nbfound != 0 ) orientprec = orientsimilarity / (double) nbfound;
if ( nbexpected != 0 ) orientrec = orientsimilarity / (double) nbexpected;
//System.err.println(">>>> " + nbcorrect + " : " + nbfound + " : " + nbexpected);
return (result);
}
......@@ -195,7 +196,7 @@ public class ExtPREvaluator extends BasicEvaluator {
}
public boolean isSuperProperty( Object prop1, Object prop2, HeavyLoadedOntology<Object> ontology ) throws AlignmentException {
return ontology.getSuperProperties( prop2, true, true, true ).contains( prop1 );
return ontology.getSuperProperties( prop2, OntologyFactory.ANY, OntologyFactory.ANY, OntologyFactory.ANY ).contains( prop1 );
}
......@@ -218,7 +219,7 @@ public class ExtPREvaluator extends BasicEvaluator {
public int isSuperClass( Object class1, Object class2, HeavyLoadedOntology<Object> ontology ) throws AlignmentException {
URI uri1 = ontology.getEntityURI( class1 );
Set<Object> bufferedSuperClasses = null;
Set<Object> superclasses = ontology.getSuperClasses( class1, true, true, true );
Set<Object> superclasses = ontology.getSuperClasses( class1, OntologyFactory.ANY, OntologyFactory.ANY, OntologyFactory.ANY );
int level = 0;
while ( !superclasses.isEmpty() ){
......@@ -232,9 +233,7 @@ public class ExtPREvaluator extends BasicEvaluator {
if ( uri1.toString().equals(uri2.toString()) ) {
return level;
} else {
// [W:unchecked] due to OWL API not serving generic types
//superclasses.addAll(((OWLClass)entity).getSuperClasses( ontology )); // [W:unchecked]
superclasses.addAll( ontology.getSuperClasses( entity, true, true, true ) );
superclasses.addAll( ontology.getSuperClasses( entity, OntologyFactory.ANY, OntologyFactory.ANY, OntologyFactory.ANY ) );
}
}
}
......
/*
* $Id$
*
* Copyright (C) INRIA Rhne-Alpes, 2003-2004, 2007-2008
* Copyright (C) INRIA, 2003-2004, 2007-2008
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -32,6 +32,7 @@ import org.semanticweb.owl.align.Parameters;
import fr.inrialpes.exmo.align.impl.DistanceAlignment;
import fr.inrialpes.exmo.align.onto.HeavyLoadedOntology;
import fr.inrialpes.exmo.align.onto.OntologyFactory;
/** This class has been built for ISWC experiments with bibliography.
* It implements a non iterative (one step) OLA algorithms based on
......@@ -186,13 +187,13 @@ public class NameAndPropertyAlignment extends DistanceAlignment implements Align
// / nbatts of c[i] + nbatts of c[j]
for ( i=0; i<nbclass1; i++ ){
Set<Object> properties1 = honto1.getProperties( classlist1.get(i), true, true, true );
Set<Object> properties1 = honto1.getProperties( classlist1.get(i), OntologyFactory.ANY, OntologyFactory.ANY, OntologyFactory.ANY );
int nba1 = properties1.size();
if ( nba1 > 0 ) { // if not, keep old values...
//Set correspondences = new HashSet();
for ( j=0; j<nbclass2; j++ ){
Set<Object> properties2 = honto2.getProperties( classlist2.get(j), true, true, true );
Set<Object> properties2 = honto2.getProperties( classlist2.get(j), OntologyFactory.ANY, OntologyFactory.ANY, OntologyFactory.ANY );
//int nba2 = properties1.size();
//double attsum = 0.;
// check that there is a correspondance
......
/*
* $Id$
*
* Copyright (C) INRIA Rhne-Alpes, 2003-2004, 2007-2008
* Copyright (C) INRIA, 2003-2004, 2007-2008
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -33,6 +33,7 @@ import org.semanticweb.owl.align.Parameters;
import fr.inrialpes.exmo.align.impl.DistanceAlignment;
import fr.inrialpes.exmo.align.onto.HeavyLoadedOntology;
import fr.inrialpes.exmo.align.onto.OntologyFactory;
/** This class has been built for ISWC experiments with bibliography.
* It implements a non iterative (one step) OLA algorithms based on
......@@ -188,12 +189,12 @@ public class StrucSubsDistAlignment extends DistanceAlignment implements Alignme
// (sigma (att in c[i]) getAllignCell... )
// / nbatts of c[i] + nbatts of c[j]
for ( i=0; i<nbclass1; i++ ){
Set<Object> properties1 = honto1.getProperties( classlist1.get(i), true, true, true );
Set<Object> properties1 = honto1.getProperties( classlist1.get(i), OntologyFactory.ANY, OntologyFactory.ANY, OntologyFactory.ANY );
int nba1 = properties1.size();
if ( nba1 > 0 ) { // if not, keep old values...
//Set correspondences = new HashSet();
for ( j=0; j<nbclass2; j++ ){
Set<Object> properties2 = honto2.getProperties( classlist2.get(j), true, true, true );
Set<Object> properties2 = honto2.getProperties( classlist2.get(j), OntologyFactory.ANY, OntologyFactory.ANY, OntologyFactory.ANY );
int nba2 = properties2.size();
double attsum = 0.;
// check that there is a correspondance
......
/*
* $Id$
*
* Copyright (C) INRIA Rhne-Alpes, 2008
* Copyright (C) INRIA, 2008
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -33,21 +33,24 @@ import org.semanticweb.owl.align.AlignmentException;
*/
public interface HeavyLoadedOntology<O> extends LoadedOntology<O> {
/* Capability methods */
public boolean getCapabilities( int Direct, int Asserted, int Named );
/* Class methods */
public Set<Object> getSubClasses( Object c, boolean local, boolean asserted, boolean named );
public Set<Object> getSuperClasses( Object c, boolean local, boolean asserted, boolean named );
public Set<Object> getProperties( Object c, boolean local, boolean asserted, boolean named );
public Set<Object> getDataProperties( Object c, boolean local, boolean asserted, boolean named );
public Set<Object> getObjectProperties( Object c, boolean local, boolean asserted, boolean named );
public Set<Object> getInstances( Object c, boolean local, boolean asserted, boolean named );
public Set<Object> getSubClasses( Object c, int local, int asserted, int named );
public Set<Object> getSuperClasses( Object c, int local, int asserted, int named );
public Set<Object> getProperties( Object c, int local, int asserted, int named );
public Set<Object> getDataProperties( Object c, int local, int asserted, int named );
public Set<Object> getObjectProperties( Object c, int local, int asserted, int named );
public Set<Object> getInstances( Object c, int local, int asserted, int named );
/* Property methods */
public Set<Object> getSubProperties( Object p, boolean local, boolean asserted, boolean named );
public Set<Object> getSuperProperties( Object p, boolean local, boolean asserted, boolean named );
public Set<Object> getSubProperties( Object p, int local, int asserted, int named );
public Set<Object> getSuperProperties( Object p, int local, int asserted, int named );
public Set<Object> getRange( Object p, boolean asserted );
public Set<Object> getDomain( Object p, boolean asserted );
/* Individual methods */
public Set<Object> getClasses( Object i, boolean local, boolean asserted, boolean named );
public Set<Object> getClasses( Object i, int local, int asserted, int named );
}
......@@ -29,6 +29,20 @@ import org.semanticweb.owl.align.AlignmentException;
public abstract class OntologyFactory {
public static int ANY = 0;
public static int DIRECT = 1;
public static int INDIRECT = 2;
public static int ASSERTED = 3;
public static int UNASSERTED = 4;
public static int INHERITED = 5;
public static int FULL = 6;
public static int NAMED = 7;
public static int LOCAL = 8;
public static int GLOBAL = 9;
public static int UNNAMED = 10;
public static int MENTIONNED = 11;
public static int ALL = 12;
//protected static OntologyFactory instance = null;
protected static Hashtable<String,OntologyFactory> instances = null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment