diff --git a/README.TXT b/README.TXT index fb0539affa82b591ff445fcf1594f0e4ef66f264..3cf7008ac7e36a2db94a847f77de9c687d203ad7 100644 --- a/README.TXT +++ b/README.TXT @@ -1,6 +1,6 @@ ####################################################################### # Ontology alignment API and implementation # -# 23/10/2015, version 4.7+ # +# 20/11/2015, version 4.8 # # http://alignapi.gforge.inria.fr # ####################################################################### @@ -51,7 +51,7 @@ For a better introduction, see the tutorial at http://alignapi.gforge.inria.fr/tutorial or find it as a script in html/tutorial/script.sh -$ setenv CWD `pwd` +$ export CWD=`pwd` $ java -jar lib/procalign.jar --help @@ -82,7 +82,7 @@ Using with JWNL (Wordnet) - jwnl.jar commons-logging.jar must be in lib. (file_properties.xml need not anymore to be in current directory) -$ setenv WNDIR ../WordNet-3.0/dict +$ export WNDIR=../WordNet-3.0/dict $ java -jar lib/procalign.jar -Dwndict=$WNDIR file://$CWD/examples/rdf/edu.umbc.ebiquity.publication.owl file://$CWD/examples/rdf/edu.mit.visus.bibtex.owl -i fr.inrialpes.exmo.align.ling.JWNLAlignment -o examples/rdf/JWNL.rdf diff --git a/examples/omwg/transf.rdf b/examples/omwg/transf.rdf index 17e5d986648dcd25ef2d792d85aa8234d7783aff..01981b10f2e5c94784d8a5f0061540a2a8f8dc2f 100644 --- a/examples/omwg/transf.rdf +++ b/examples/omwg/transf.rdf @@ -32,19 +32,19 @@ it only illustrates transformations <align:level>2EDOAL</align:level> <align:type>**</align:type> <align:onto1> - <align:Ontology rdf:about="&im;"> + <align:Ontology rdf:about="&im;"> <align:formalism> <align:Formalism align:name="OWL1.0" align:uri="http://www.w3.org/2002/07/owl#"/> </align:formalism> - </align:Ontology> + </align:Ontology> </align:onto1> <align:onto2> - <align:Ontology rdf:about="&me;"> + <align:Ontology rdf:about="&me;"> <align:location>http://www.scharffe.fr/ontologies/OntologieDuVin.wsml</align:location> <align:formalism> <align:Formalism align:uri="http://www.wsmo.org/wsml/wsml-syntax/wsml-dl" align:name="wsml" /> </align:formalism> - </align:Ontology> + </align:Ontology> </align:onto2> <align:map> <align:Cell rdf:about="#M11b"> diff --git a/src/fr/inrialpes/exmo/align/cli/ExtGroupEval.java b/src/fr/inrialpes/exmo/align/cli/ExtGroupEval.java index 481f37b462ef483527ec175355a7cdbbe640f503..eb1365e44c5a7382464e341596d36e855d6aa70c 100644 --- a/src/fr/inrialpes/exmo/align/cli/ExtGroupEval.java +++ b/src/fr/inrialpes/exmo/align/cli/ExtGroupEval.java @@ -230,6 +230,8 @@ public class ExtGroupEval extends CommonCLI { /** * This does not only print the results but compute the average as well + * + * @param result: the vector of vector result to be printed */ public void print( Vector<Vector<Object>> result ) { PrintStream writer = null; diff --git a/src/fr/inrialpes/exmo/align/cli/GroupEval.java b/src/fr/inrialpes/exmo/align/cli/GroupEval.java index c2f90518475e549d806715ccac5d3b72312419bd..aa5bada4086c4f2e6e565bbb3f933bd08d764ab0 100644 --- a/src/fr/inrialpes/exmo/align/cli/GroupEval.java +++ b/src/fr/inrialpes/exmo/align/cli/GroupEval.java @@ -251,6 +251,8 @@ public class GroupEval extends CommonCLI { /** * This does not only print the results but compute the average as well + * + * @param result: the vector of vector result to be printed */ public void print( Vector<Vector<Object>> result ) { PrintStream writer = null; @@ -274,6 +276,9 @@ public class GroupEval extends CommonCLI { * A plot of the precision recall points on a triangular space * Added level lines provides by Christian Meilicke (U. Mannheim) * See his program in comment below + * + * @param result: the vector of vector result to be printed + * @param writer: the writer in which to print it */ public void printTRIANGLE( Vector<Vector<Object>> result, PrintStream writer ) { // variables for computing iterative harmonic means diff --git a/src/fr/inrialpes/exmo/align/cli/WGroupEval.java b/src/fr/inrialpes/exmo/align/cli/WGroupEval.java index 795847f645b0befca802210cd2358e1d7c91a5c1..c99a157a05fb0e23543c059bb2cf55b7ac1db685 100644 --- a/src/fr/inrialpes/exmo/align/cli/WGroupEval.java +++ b/src/fr/inrialpes/exmo/align/cli/WGroupEval.java @@ -232,6 +232,8 @@ public class WGroupEval extends CommonCLI { /** * This does not only print the results but compute the average as well + * + * @param result: the vector of vector result to be printed */ public void print( Vector<Vector<Object>> result ) { PrintStream writer = null; diff --git a/src/fr/inrialpes/exmo/align/gen/Alterator.java b/src/fr/inrialpes/exmo/align/gen/Alterator.java index 3f3d6f4f1effda06f13e50a694b46485b0a79471..d357f59aaaae710567dbfcafded683eb16970b69 100644 --- a/src/fr/inrialpes/exmo/align/gen/Alterator.java +++ b/src/fr/inrialpes/exmo/align/gen/Alterator.java @@ -46,17 +46,20 @@ public interface Alterator { //public Alterator( Alterator om ); /** - * the namespace of the input ontology + * @return the namespace of the input ontology */ public String getNamespace(); /** - * the namespace of the source ontology in the input alignment + * @return the namespace of the source ontology in the input alignment */ public String getBase(); /** * modify applies the alteration to the input (the results are kept in * internal structures. + * + * @param params: the alteration to be performed + * @return the Alterator object with alterations performed */ public Alterator modify( Properties params ); @@ -64,6 +67,8 @@ public interface Alterator { /** * getProtoAlignment, getProtoOntology, getHierarchy * are used for accessing these internal structure at creation time. + * + * @return properties representing a currect alignment */ public Properties getProtoAlignment(); public OntModel getProtoOntology(); @@ -72,14 +77,20 @@ public interface Alterator { /** * Modifies the namespaces of source and target ontologies * (for the main purpose of outputing them) + * + * @param namespace1 and + * @param namespace2: the namespaces to be given to source and target ontologies */ public void relocateTest( String namespace1, String namespace2 ); public void relocateTest( String namespace2 ); /** - * Returns the altered Alignment and Ontology in output form + * @return the altered Alignment in output form */ public Alignment getAlignment(); + /** + * @return the altered Ontology in output form + */ public OntModel getModifiedOntology(); } diff --git a/src/fr/inrialpes/exmo/align/gen/OntologyNetworkGenerator.java b/src/fr/inrialpes/exmo/align/gen/OntologyNetworkGenerator.java index c04d361d61defbd97b1927dedefc2cc2036ab072..2e6e9fc4d4f8d27b78260fa4bfce862413134fd3 100644 --- a/src/fr/inrialpes/exmo/align/gen/OntologyNetworkGenerator.java +++ b/src/fr/inrialpes/exmo/align/gen/OntologyNetworkGenerator.java @@ -40,6 +40,12 @@ public interface OntologyNetworkGenerator { * Returns an ontology network of size n (the number of ontologies) * starting from an ontology o. * Parameters may further specify the requirements. + * + * @param n: the size of the generated network of ontologies + * @param o: the initial ontology + * @param params: generator parameters + * //@throws AlignmentException whenever something goes wrong + * @return the generated network */ public OntologyNetwork generate( int n, Ontology<Object> o, Properties params ); diff --git a/src/fr/inrialpes/exmo/align/gen/OntologyNetworkWeakener.java b/src/fr/inrialpes/exmo/align/gen/OntologyNetworkWeakener.java index 8293adc282621108a61badca8996168886bf8872..724506f14d3ebc1a513f57aa9040df902e66e7e5 100644 --- a/src/fr/inrialpes/exmo/align/gen/OntologyNetworkWeakener.java +++ b/src/fr/inrialpes/exmo/align/gen/OntologyNetworkWeakener.java @@ -38,11 +38,23 @@ public interface OntologyNetworkWeakener { /** * Weakens the ontology network of n units + * + * @param on: the network of ontologies to weaken + * @param n: the extent of the weakening in units + * @param p: weakening parameters + * @throws AlignmentException whenever something goes wrong + * @return the weakened network */ public OntologyNetwork weaken( OntologyNetwork on, int n, Properties p ) throws AlignmentException; /** * Weakens the ontology network of n% + * + * @param on: the network of ontologies to weaken + * @param n: the extent of the weakening in percentage + * @param p: weakening parameters + * @throws AlignmentException whenever something goes wrong + * @return the weakened network */ public OntologyNetwork weaken( OntologyNetwork on, double n, Properties p ) throws AlignmentException; diff --git a/src/fr/inrialpes/exmo/align/gen/TestGenerator.java b/src/fr/inrialpes/exmo/align/gen/TestGenerator.java index ff47e1caa59a87747cd8f8badd6de1fe20f2ee49..071a3ba8d88db345ed5dd024b62dbcb228b2539e 100644 --- a/src/fr/inrialpes/exmo/align/gen/TestGenerator.java +++ b/src/fr/inrialpes/exmo/align/gen/TestGenerator.java @@ -172,6 +172,14 @@ public class TestGenerator { /** * Generate a test by altering an existing test + * + * @param pKey: type of the alteration to perform + * @param pVal: extent (percentage?) of the alteration to perform + * @param suffix: suffix of the test + * @param prevTest: name of the prevous test + * @param al: an input protoalignment + * @param testNb: name (number) of the test to be generated + * @return the protoalignment expressed as properties */ public Properties incrementModifyOntology( String pKey, String pVal, String suffix, String prevTest, Properties al, String testNb ) { Properties p = new Properties(); @@ -183,6 +191,12 @@ public class TestGenerator { /** * Generate a test by altering an existing test + * + * @param prevTestDir: the directory of the initial test + * @param al: an input protoalignment + * @param testDir: the directory of the final test + * @param params: parameters describing the test alterations + * @return the protoalignment expressed as properties */ public Properties incrementModifyOntology( String prevTestDir, Properties al, String testDir, Properties params ) { return modifyOntology( dirprefix+"/"+prevTestDir+"/"+ontoname, al, testDir, params ); @@ -191,6 +205,12 @@ public class TestGenerator { //modifies an ontology /** * Generate a test from an ontology + * + * @param file: the file containing the initial ontology + * @param al: an input protoalignment + * @param dirName: the name of the directory in which the test will be relocated + * @param params: parameters describing the test alterations + * @return the protoalignment expressed as properties */ public Properties modifyOntology( String file, Properties al, String dirName, Properties params) { logger.trace( "Source: {}; Target {}", file, dirName ); @@ -209,7 +229,7 @@ public class TestGenerator { // ******************************************************* GENERATOR - //generate the alingnment + //generate the alignment public Alterator generate( OntModel onto, Properties params, Properties initalign ) { logger.debug( "[-------------------------------------------------]" ); logger.debug( "{} / {} / {} / {}", urlprefix, dirprefix, ontoname, alignname ); diff --git a/src/fr/inrialpes/exmo/align/gen/alt/BasicAlterator.java b/src/fr/inrialpes/exmo/align/gen/alt/BasicAlterator.java index 53357f3dbfefff7f58a3805235fec7fd7569ff44..b34d9f49ab3dc8c9982dfd8f195d058583521ac5 100644 --- a/src/fr/inrialpes/exmo/align/gen/alt/BasicAlterator.java +++ b/src/fr/inrialpes/exmo/align/gen/alt/BasicAlterator.java @@ -407,6 +407,9 @@ public abstract class BasicAlterator implements Alterator { * Modifies the namespace of the generated ontology * This is the initial implementation. * However... it has some problem with Jena treating fragments (containing numbers and / in them). + * + * @param ns: the namespace under which to relocate the ontology + * @return the relocated ontology */ public OntModel changeNamespace ( String ns ) { OntModel newModel = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM ); //create new Model @@ -443,6 +446,9 @@ public abstract class BasicAlterator implements Alterator { * OntModel.write( OutputStream out ) / OntModel.write( Writer writer ) * new Model().read( InputStream in, String base ) / new Model().read(Reader reader, String base) * So far this is less efficient (and less elegant) than the modifications above + * + * @param base2: the namespace under which to relocate the ontology + * @return the relocated ontology */ public OntModel changeNamespace2( String base2 ) { OntModel model = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM ); @@ -481,6 +487,10 @@ public abstract class BasicAlterator implements Alterator { * Rename the ontology, just in case it does not have the same URI as its content... * This happens * oldURI should be useless + * + * @param model: the ontology whose URI have to be relocated + * @param oldURI: the current URI prefix + * @param newURI: the new URI prefix */ public void renameOntology( OntModel model, String oldURI, String newURI ) { Ontology onto = model.getOntology( oldURI ); diff --git a/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java b/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java index d4f2c1490bc4d4e758895fc72a74200ff2decebf..385685a09adcdce46095e4a507a1e07acaa3c3f3 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java @@ -115,6 +115,12 @@ public class BasicAlignment implements Alignment, Extensible { * which will then replaced the one that was there at creation time * or a "concrete" ontology which will be inserted in the fr.inrialpes.exmo.ontowrap.Ontology * object. + * + * @param onto1 and + * @param onto2: the two aligned ontologies + * @param relType: the type of relations to use + * @param confType: the type of confidence measures to use + * @throws AlignmentException when something goes wrong */ public void init( Object onto1, Object onto2, Class<? extends Relation> relType, Class<?> confType ) throws AlignmentException { relationType = relType; @@ -159,7 +165,7 @@ public class BasicAlignment implements Alignment, Extensible { return sum; } - /** A few statistical primitives, undocumented **/ + /* A few statistical primitives, undocumented */ public double maxConfidence() { double result = 0.; for ( Cell c : this ) { @@ -193,7 +199,7 @@ public class BasicAlignment implements Alignment, Extensible { } // For standard deviation, take the square root of variance - /** Alignment methods * */ + /* Alignment methods */ public Object getOntology1() { return onto1.getOntology(); }; @@ -334,7 +340,7 @@ public class BasicAlignment implements Alignment, Extensible { hash2 = new Hashtable<Object,Set<Cell>>(); } - /** Cell methods **/ + /* Cell methods */ // Could use a relationType.getIdRelation() / confidenceType.getTop() -- But kept this way public Cell addAlignCell( Object ob1, Object ob2 ) throws AlignmentException { return addAlignCell( (String)null, ob1, ob2, "=", BasicConfidence.getTopConfidence() ); @@ -350,6 +356,10 @@ public class BasicAlignment implements Alignment, Extensible { /** * The constructor to use + * + * @param rel: the string representing the relation + * @throws AlignmentException when something goes wrong + * @return a relation of the relevant type corresponding to the given string */ public Relation createRelation( String rel ) throws AlignmentException { // Any of them... call the local createRelation()... @@ -570,6 +580,9 @@ public class BasicAlignment implements Alignment, Extensible { /*************************************************************************** * The cut function suppresses from an alignment all the cell over a * particular threshold + * + * @param threshold: the threshold under which to cut + * @throws AlignmentException when something goes wrong (unlikely) **************************************************************************/ public void cut2(double threshold) throws AlignmentException { for ( Cell c : this ) { @@ -580,6 +593,9 @@ public class BasicAlignment implements Alignment, Extensible { /*************************************************************************** * Default cut implementation * For compatibility with API until version 1.1 + * + * @param threshold: the threshold under which to cut + * @throws AlignmentException when something goes wrong (unlikely) **************************************************************************/ public void cut( double threshold ) throws AlignmentException { cut( "hard", threshold ); @@ -587,6 +603,10 @@ public class BasicAlignment implements Alignment, Extensible { /*************************************************************************** * Cut refinement : + * Rule: + * threshold is betweew 1 and 0 + * + * @param method: the cut method to be used described as: * - getting those cells with strength above n (hard) * - getting the n best cells (best) * - getting those cells with strength at worse n under the best (span) @@ -594,8 +614,8 @@ public class BasicAlignment implements Alignment, Extensible { * - getting those cells with strength at worse n% of the best (prop) * - getting all cells until a gap of n (hardgap) * - getting all cells until a gap of n% of the last (propgap) - * Rule: - * threshold is betweew 1 and 0 + * @param threshold: the threshold under which to cut + * @throws AlignmentException when something goes wrong (unlikely) **************************************************************************/ public void cut( String method, double threshold ) throws AlignmentException { @@ -646,6 +666,9 @@ public class BasicAlignment implements Alignment, Extensible { /** * The harden function acts like threshold but put all weights to 1. + * + * @param threshold: the threshold above which to harden + * @throws AlignmentException when something goes wrong (unlikely) */ public void harden(double threshold) throws AlignmentException { for ( Cell c : this ) { @@ -664,9 +687,16 @@ public class BasicAlignment implements Alignment, Extensible { * - check compatibility and setup for type and level * - conserve extensions if necessary */ - /* + /** * This method is used by the algebraic operators * It has to be overriden by implementations. + * + * @param onto1 and + * @param onto2: the two aligned ontologies + * @param relType: the type of relations to use + * @param confType: the type of confidence measures to use + * @throws AlignmentException when something goes wrong + * @return a newly created alignment */ public BasicAlignment createNewAlignment( Object onto1, Object onto2, Class<? extends Relation> relType, Class<?> confType ) throws AlignmentException { BasicAlignment align = new BasicAlignment(); @@ -680,6 +710,10 @@ public class BasicAlignment implements Alignment, Extensible { * alignment will contain: * ( o, o', diff(n,n'), r) * any pair which is only in the first alignment is preserved. + * + * @param align: the alignment which is substracted + * @throws AlignmentException when something goes wrong + * @return the difference between the current alignment and align */ public Alignment diff( Alignment align ) throws AlignmentException { // Could also test: onto1 == getOntologyObject1(); @@ -722,6 +756,9 @@ public class BasicAlignment implements Alignment, Extensible { /** * Each cell of @align is contained in this alignment * no semantics (a semantic predicate would be entails). + * + * @param align: the alignment for testing containment + * @return true is align is contained */ public boolean contains( Alignment align ) { try { @@ -752,6 +789,11 @@ public class BasicAlignment implements Alignment, Extensible { * any pair which is in only one alignment is preserved. * * This does not pay any attention to the relations used: it returns a random relation! + * + * @param modality: the aggregation modality + * @param aligns: the alignments to be aggregated + * @throws AlignmentException when something goes wrong + * @return the aggregated alignment */ public static Alignment aggregate( String modality, Set<BasicAlignment> aligns ) throws AlignmentException { // Could also test: onto1 == getOntologyObject1(); @@ -822,6 +864,8 @@ public class BasicAlignment implements Alignment, Extensible { /** * Generates a sorted iterator for the alignment * WARNING: this is quite expensive since it allocates and sort a structure each time + * + * @return the set of cells in a sorted structure */ public TreeSet<Cell> getSortedIterator() { TreeSet<Cell> result = new TreeSet<Cell>(); @@ -849,6 +893,8 @@ public class BasicAlignment implements Alignment, Extensible { * alignment will contain: * ( e, e', meet(n,n'), r) * any pair which is in only one alignment is discarded. + * + * @param align: */ public Alignment meet( Alignment align ) throws AlignmentException { // Could also test: onto1 == getOntologyObject1(); @@ -935,6 +981,10 @@ public class BasicAlignment implements Alignment, Extensible { * any pair (o, o', n, r) in O and (o',o", n', r') in O' the resulting * alignment will contain: * ( o, o", join(n,n'), compose(r, r')) iff compose(r,r') exists. + * + * @param align: the alignment to compose with this one + * @return the composed alignments + * @throws AlignmentException when something goes wrong (e.g., the two alignments are not connected) */ public Alignment compose( Alignment align ) throws AlignmentException { if ( !onto2.getURI().equals( align.getOntology1URI() ) ) @@ -1028,6 +1078,9 @@ public class BasicAlignment implements Alignment, Extensible { * is applied, then the ingested alignmment will be modified as well. * JE: May be a "force" boolean for really ingesting or copying may be * useful + * + * @param alignment: the alignment to be included in the current alignment + * @throws AlignmentException when something goes wrong */ public void ingest( Alignment alignment ) throws AlignmentException { if ( alignment != null ) @@ -1038,6 +1091,8 @@ public class BasicAlignment implements Alignment, Extensible { /** * Generate a copy of this alignment object * It has the same content but a different id (no id indeed) + * + * @return a clone of this alignment */ public Object clone() { BasicAlignment align; @@ -1064,6 +1119,8 @@ public class BasicAlignment implements Alignment, Extensible { /** * Returns default exception for conversion to URIAlignments * + * @return a URI alignment corresponding to this alignment + * @throws AlignmentException when something goes wrong (the alignment cannot be converted) */ public URIAlignment toURIAlignment() throws AlignmentException { throw new AlignmentException("[BasicAlignment].toURIAlignment() cannot process"); @@ -1073,6 +1130,9 @@ public class BasicAlignment implements Alignment, Extensible { * This should be rewritten in order to generate the axiom ontology instead * of printing it! And then use ontology serialization for getting it * printed. + * + * @param renderer: the renderer with which to render the alignment + * @throws AlignmentException when something goes wrong */ public void render( AlignmentVisitor renderer ) throws AlignmentException { accept(renderer); @@ -1085,8 +1145,6 @@ public class BasicAlignment implements Alignment, Extensible { public void cleanUp() {} /** - * @param aQuery -- query to be re-written - * @return -- rewritten query: * - replaces all entity IRI by their counterpart in the ontology * * Caveats: @@ -1094,6 +1152,9 @@ public class BasicAlignment implements Alignment, Extensible { * - This does not care for the *:x status of alignments * - This does work from ontology1 to ontology2, not the other way around * (use invert() in this case). + * @param aQuery -- query to be re-written + * @return -- rewritten query: + * @throws AlignmentException when something goes wrong */ public String rewriteQuery( String aQuery ) throws AlignmentException { return rewriteSPARQLQuery( aQuery ); diff --git a/src/fr/inrialpes/exmo/align/impl/BasicCell.java b/src/fr/inrialpes/exmo/align/impl/BasicCell.java index 1d9b96b4232ef5d3df3a801294a4edd91ced1a53..89dd2c3179c1ff049df21d57c05f09dc504e431d 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicCell.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicCell.java @@ -59,7 +59,15 @@ public class BasicCell implements Cell, Comparable<Cell>, Extensible { protected double strength = 0; protected Extensions extensions = null; - /** Creation **/ + /** Creation + * Creates a correspondence + * @param id: the identifier of the correspondence + * @param ob1 and + * @param ob2 the related objects + * @param rel the relation + * @param m the confidence measure + * @throws AlignmentException when something goes wrong (an object is null, confidence is out of bound...) + **/ public BasicCell( String id, Object ob1, Object ob2, Relation rel, double m ) throws AlignmentException { if ( ob1 == null ) throw new AlignmentException( "object1 cannot be null" ); if ( ob2 == null ) throw new AlignmentException( "object2 cannot be null" ); diff --git a/src/fr/inrialpes/exmo/align/impl/BasicConfidence.java b/src/fr/inrialpes/exmo/align/impl/BasicConfidence.java index 2315dd59ea4433ebc9ba68d9ed8d1d544ec67525..e822753a35074eb70a92bf81474505e7448ec3ed 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicConfidence.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicConfidence.java @@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory; public class BasicConfidence { final static Logger logger = LoggerFactory.getLogger( BasicConfidence.class ); - /** will never be used + /* will never be used public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { visitor.visit(this); } diff --git a/src/fr/inrialpes/exmo/align/impl/BasicEvaluator.java b/src/fr/inrialpes/exmo/align/impl/BasicEvaluator.java index 13a84723a10ab1be8f320f3baa429564cb7bc722..42784e46abd1aa7f9366d8e29f2ab49297df392a 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicEvaluator.java @@ -41,7 +41,13 @@ public abstract class BasicEvaluator implements Evaluator { protected Alignment align1; protected Alignment align2; - /** Creation **/ + /** Creation + * Creates an evaluator + * + * @param align1 and + * @param align2: the two alignments to be evaluated + * @throws AlignmentException when something goes wrong (never in this case) + **/ public BasicEvaluator( Alignment align1, Alignment align2 ) throws AlignmentException { this.align1 = align1; this.align2 = align2; diff --git a/src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java b/src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java index fbcd2758b5c690b36cabe91f1631da46dce068a3..cdf225d4a11a1287787dad66ae1381e39390f5e6 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java @@ -223,6 +223,8 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { /** * Clone does some deeper cloning * It has the same content but a different id (no id indeed) + * + * @return a new network with the same set of ontologies */ public BasicOntologyNetwork copyOnto() { //public Object clone() { @@ -235,6 +237,8 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { * Invert all alignments in a network of ontologies * In fact, this is closing by invert! * Modifies the network + * + * @throws AlignmentException when something goes wrong (unlikely) */ public void invert() throws AlignmentException { Vector<Alignment> newal = new Vector<Alignment>(); @@ -245,6 +249,8 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { /** * Denormalizes an ontology network: suppress all empty alignments * Modifies the network + * + * @throws AlignmentException when something goes wrong (unlikely) */ public void denormalize() throws AlignmentException { Vector<Alignment> toremove = new Vector<Alignment>(); @@ -257,6 +263,8 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { /** * Normalizes an ontology network for it to have exactly one alignment between each pair of ontologies. * Modifies the network + * + * @throws AlignmentException when something goes wrong (unlikely) */ public void normalize() throws AlignmentException { for ( OntologyTriple ot1 : ontologies.values() ) { @@ -281,6 +289,11 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { /** * This only works on normalised networks (and returns a normalised network) * Combine all alignments into one (add an alignment to those existing merging everything) + * + * @param ot1 and + * @param ot2: two ontology triples + * @param newal: a new alignment to integrate with the alignment between these ontologies + * @throws AlignmentException when something goes wrong (unlikely) */ protected void mergeAlignments( OntologyTriple ot1, OntologyTriple ot2, Alignment newal ) throws AlignmentException { Alignment al = getAlignments( ot1, ot2 ).iterator().next(); @@ -299,6 +312,12 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { * Because it depends on (a) the type of alignment and (b) the ontology language * The code below is OK, but no alignment type is available... * generateIdAlignment should be a static method of an alignment type depending on the ontology type + * + * @param reflexive: if the reflexive closure must be performed (non implements) + * @param symmetric: if the symmetric closure must be performed + * @param transitive: if the transitive closure must be performed + * @param params: parameters to pass to closure (currently unused) + * @throws AlignmentException when something goes wrong */ public void close( boolean reflexive, boolean symmetric, boolean transitive, Properties params ) throws AlignmentException { normalize(); @@ -334,6 +353,10 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { * & al(o2,o1)-1 o al(o2,o3) * & ... * But this assumes symetric closure as well... + * + * @param params: parameters to pass to closure (currently unused) + * @throws AlignmentException when something goes wrong + * @return true if the composition has generated new correspondences */ protected boolean applyComposition( Properties params ) throws AlignmentException { boolean change = false; @@ -365,6 +388,12 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { /** * Merge all alignments between the same ontology as one (conjunction) * Create a new alignment... + * + * @param als: a set of alignments + * @param onto1 and + * @param onto2: the two ontologies between which these alignments are + * @throws AlignmentException when something goes wrong + * @return a new alignment equivalent to als, but normalised */ protected static Alignment normalizeAlignmentSet( Set<Alignment> als, Ontology<Object> onto1, Ontology<Object> onto2 ) throws AlignmentException { Alignment result = null; @@ -392,6 +421,12 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { * What is missing is the transitive closure... * * JE: beware: will bug if not provided with BasicOntologyNetworks + * + * @param on: a network of ontologies + * @param onto1 and + * @param onto2: the URI of two ontologies between which the alignments will be normalised + * @throws AlignmentException when something goes wrong + * @return a single new alignment between onto1 and onto2 equivalence to those of the network */ public static Alignment getQuasiNormalizedAlignment( OntologyNetwork on, URI onto1, URI onto2 ) throws AlignmentException { // getAlignments returns a non mutable structure so it has to be copied @@ -433,6 +468,12 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { * TODO * Alternative definition! * {@literal public void match( Class<? extends AlignmentProcess> method, boolean reflexive ) throws AlignmentException} + * + * @param method: the ontology matching method to use to match + * @param reflexive: if alignments have to be found between the same ontology + * @param symmetric: if alignments must be computed symmetrically + * @param params: parameters passed to the matching method + * @throws AlignmentException when something goes wrong */ public void match( String method, boolean reflexive, boolean symmetric, Properties params ) throws AlignmentException { for ( OntologyTriple ot1 : ontologies.values() ) { @@ -475,6 +516,10 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { /** * Applies a threshold to all alignments in a network * Modifies the network + * + * @param method: the trimming method + * @param threshold: the trimming threshold + * @throws AlignmentException when something goes wrong */ public void trim( String method, double threshold ) throws AlignmentException { for ( Alignment al : alignments ) { @@ -489,6 +534,11 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { * So the homomorphism is trivial * * TODO: add extensions? i.e., partial clone as BasicAlignment (same in diff and join) + * + * @param on1 and + * @param on2: the two networks to be met + * @throws AlignmentException when something goes wrong + * @return the result of the meet operation */ public static BasicOntologyNetwork meet( OntologyNetwork on1, OntologyNetwork on2 ) throws AlignmentException { BasicOntologyNetwork result = new BasicOntologyNetwork(); @@ -521,6 +571,11 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { * * The semantics used is the reduced semantics in which ontologies identified by their URIs can only be matched to themselves * So the homomorphism is trivial + * + * @param on1 and + * @param on2: the two networks to be substracted + * @throws AlignmentException when something goes wrong + * @return the result of the diff operation */ public static BasicOntologyNetwork diff( OntologyNetwork on1, OntologyNetwork on2 ) throws AlignmentException { BasicOntologyNetwork result = new BasicOntologyNetwork(); @@ -556,6 +611,11 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { * * The semantics used is the reduced semantics in which ontologies identified by their URIs can only be matched to themselves * So the homomorphism is trivial + * + * @param on1 and + * @param on2: the two networks to be joined + * @throws AlignmentException when something goes wrong + * @return the result of the join operation */ public static BasicOntologyNetwork join( OntologyNetwork on1, OntologyNetwork on2 ) throws AlignmentException { BasicOntologyNetwork result = new BasicOntologyNetwork(); @@ -667,6 +727,10 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { /** * Parsing * here we use Jena + * + * @param uri: the URL of an RDF graph describing a network + * @throws AlignmentException when something goes wrong (I/O usually) + * @return the network of ontologies that has been read */ // Certainly not only URIs for testing reasons diff --git a/src/fr/inrialpes/exmo/align/impl/BasicParameters.java b/src/fr/inrialpes/exmo/align/impl/BasicParameters.java index 04a4d02f18b48868686ccff5c924e451b1a136af..c1a26a634e7445f72e2743c5f9e98ac78a5704ab 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicParameters.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicParameters.java @@ -108,7 +108,7 @@ public class BasicParameters extends Properties implements Parameters, Cloneable * and p.loadFromXML( new FileInputStream( filename ) ) * which are natural implementers for this. */ - public void write(){ + public void write() { System.out.println("<?xml version='1.0' ?>"); System.out.println("<Parameters>"); for ( Entry<Object,Object> e : entrySet() ) { @@ -119,6 +119,8 @@ public class BasicParameters extends Properties implements Parameters, Cloneable /** * displays the current parameters (debugging) + * + * @param stream: the stream in which to display the parameters */ public void displayParameters( PrintStream stream ){ stream.println("Parameters:"); diff --git a/src/fr/inrialpes/exmo/align/impl/BasicRelation.java b/src/fr/inrialpes/exmo/align/impl/BasicRelation.java index ec677cfbfaa1678e3f870fc110c5f3d5d8174e9f..2aae271ffc2e24d9b2f0f5bbe7f0fb7f86c97f27 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicRelation.java @@ -126,6 +126,8 @@ public class BasicRelation implements Relation { /** * The name to use if no other information is available + * + * @return the name of the relation class */ public String getClassName() { return getClass().toString(); @@ -141,6 +143,10 @@ public class BasicRelation implements Relation { /** * The constructor to use + * + * @param rel: the string representation of the relation + * @return the corresponding relation object + * @throws AlignmentException if something goes wrong (e.g., rel cannot be interpreted) */ public static BasicRelation createRelation( String rel ) throws AlignmentException { Class<?> relationClass = getClass( rel ); @@ -162,17 +168,31 @@ public class BasicRelation implements Relation { } } - /** By default the inverse is the relation itself **/ + /** + * By default the inverse is the relation itself + * + * @return the inverse of the relation + **/ public Relation inverse() { return this; } - /** By default... no composition possible **/ + /** + * By default... no composition possible + * + * @param r: a relation with which to compose + * @return this relation composed with r + **/ public Relation compose( Relation r ) { return null; } - /** By default... meet if equals **/ + /** + * By default... meet if equals + * + * @param rels: a set of relations to meet with this one + * @return the relation which is the result of the meet + **/ public BasicRelation meet( Relation... rels ) { for( Relation r : rels ) { if ( !this.equals( r ) ) return null; @@ -180,7 +200,13 @@ public class BasicRelation implements Relation { return this; } - /** By default... we are not in disjunctive relations... then returns null **/ + /** + * By default... we are not in disjunctive relations... then returns null + * + * + * @param rels: a set of relations to join with this one + * @return the relation which is the result of the join + **/ public BasicRelation join( Relation... rels ) { for( Relation r : rels ) { if ( !this.equals( r ) ) return null; @@ -188,10 +214,19 @@ public class BasicRelation implements Relation { return this; } - /** Housekeeping **/ + /** + * Housekeeping + * + * @param h: the content handler in which to dump the relation + **/ public void dump( ContentHandler h ){}; - /** This is kept for displayig more correctly the result **/ + /** + * This is kept for displayig more correctly the result + * + * + * @param writer: the writer where to print the result + **/ public void write( PrintWriter writer ) { if ( relation != null ) { writer.print( relation ); @@ -202,7 +237,12 @@ public class BasicRelation implements Relation { } } - /** Are the two relations equal **/ + /** + * Are the two relations equal + * + * @param o: an object with which to compare this one + * @return true is o is equal to this object + **/ public boolean equals( Object o ) { if ( o == this ) return true; if ( o == null ) return false; diff --git a/src/fr/inrialpes/exmo/align/impl/BitSetAlgebraRelation.java b/src/fr/inrialpes/exmo/align/impl/BitSetAlgebraRelation.java index 64aa3fb5aa55d708f1ebb26f1b0d589c9935adb2..3589258b79db4320628239cdbafa4e77cf53cb52 100644 --- a/src/fr/inrialpes/exmo/align/impl/BitSetAlgebraRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/BitSetAlgebraRelation.java @@ -50,6 +50,9 @@ public abstract class BitSetAlgebraRelation<T extends BaseRelation> extends BitS /** * composition + * + * @param dr: a bitset relation to compose with this one + * @return the bitset corresponding to the composed relation */ public BitSet protocompose( BitSetAlgebraRelation<T> dr ) { BitSet bs = createSet(); @@ -67,7 +70,11 @@ public abstract class BitSetAlgebraRelation<T extends BaseRelation> extends BitS protected abstract BitSet compose( T r1, T r2 ); - /** inverse, could potentially go to Disjunctive */ + /** + * inverse, could potentially go to Disjunctive + * + * @return the bitset corresponding to the relation inverse to this one + */ protected BitSet protoinverse() { BitSet bs = createSet(); for( T r : this ) { diff --git a/src/fr/inrialpes/exmo/align/impl/BitSetDisjunctiveRelation.java b/src/fr/inrialpes/exmo/align/impl/BitSetDisjunctiveRelation.java index a436d927392cc8f2794336ffc6bf4cc2236f80aa..a3850ccb64233665531fd49209b01bfb018c9d03 100644 --- a/src/fr/inrialpes/exmo/align/impl/BitSetDisjunctiveRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/BitSetDisjunctiveRelation.java @@ -84,7 +84,12 @@ public abstract class BitSetDisjunctiveRelation<T extends BaseRelation> extends return new RelationIterator<T>(); } - /** intersection */ + /** + * intersection + * + * @param drs: a set of bitset disjunctive relations to be intersected + * @return the bitset corresponding to the intersected relation + */ @SafeVarargs protected final BitSet protojoin( BitSetDisjunctiveRelation<T>... drs ) { BitSet bs = (BitSet)relset.clone(); for( BitSetDisjunctiveRelation<T> dr : drs ) { @@ -97,7 +102,12 @@ public abstract class BitSetDisjunctiveRelation<T extends BaseRelation> extends throw new AlignmentException( "Cannot join relations from heterogeneous algebras" ); } - /** union */ + /** + * union + * + * @param drs: a set of bitset disjunctive relations to be met + * @return the bitset corresponding to the met relations + */ @SafeVarargs protected final BitSet protomeet( BitSetDisjunctiveRelation<T>... drs ) { BitSet bs = (BitSet)relset.clone(); for( BitSetDisjunctiveRelation<T> dr : drs ) { @@ -110,7 +120,12 @@ public abstract class BitSetDisjunctiveRelation<T extends BaseRelation> extends throw new AlignmentException( "Cannot meet relations from heterogeneous algebras" ); } - /** complement */ + /** + * complement + * + * @param dr: a set of bitset disjunctive relations to be complemented + * @return the bitset corresponding to the complemented relation + */ protected BitSet protocompl( BitSetDisjunctiveRelation<T> dr ) { BitSet bs = (BitSet)relset.clone(); //for( int i=0; i < size; i++ ) bs.flip( i ); diff --git a/src/fr/inrialpes/exmo/align/impl/DistanceAlignment.java b/src/fr/inrialpes/exmo/align/impl/DistanceAlignment.java index e0733f15027f0bbe1b27fd925da97f72c31ec55f..95bd6004f30123357dc86a59ad9630d638e0a8f8 100644 --- a/src/fr/inrialpes/exmo/align/impl/DistanceAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/DistanceAlignment.java @@ -85,6 +85,8 @@ public abstract class DistanceAlignment extends ObjectAlignment implements Align /** * Prints the distance matrix + * + * @param params: the parameters of the distance */ public void printDistanceMatrix( Properties params ){ String algName = params.getProperty("algName"); @@ -120,6 +122,8 @@ public abstract class DistanceAlignment extends ObjectAlignment implements Align /** * Extract the alignment form the Similarity + * + * @param type: the type of alignment to extract: * There are theoretically 16 types of extractors composing the * characteristics * [q]estion mark = ?, one or zero relation @@ -131,6 +135,9 @@ public abstract class DistanceAlignment extends ObjectAlignment implements Align * ** (covering ++, *+ and +*) * ?* (covering 1*, 1+ and ?+) * *? (covering +?, *1 and +1) + * @param params: the parameter of the measure + * @throws AlignmentException when something goes wrong + * @return the extracted alignment */ public Alignment extract(String type, Properties params) throws AlignmentException { double threshold = 0.; @@ -153,6 +160,10 @@ public abstract class DistanceAlignment extends ObjectAlignment implements Align * Extract the alignment of a ?* type * Non symmetric: for each entity of onto1, take the highest if superior to threshold * Complexity: O(n^2) + * + * @param threshold: the threshold to apply to extracted correspondences + * @param params: the parameter of the measure + * @return the extracted alignment */ // JE: Yes, could only be implemented by copying the code... public Alignment extractsq( double threshold, Properties params) { @@ -228,6 +239,10 @@ public abstract class DistanceAlignment extends ObjectAlignment implements Align * Extract the alignment of a ** type * Symmetric: return all elements above threshold * Complexity: O(n^2) + * + * @param threshold: the threshold to apply to extracted correspondences + * @param params: the parameter of the measure + * @return the extracted alignment */ @SuppressWarnings({"unchecked","rawTypes"}) //ConcatenatedIterator public Alignment extractss( double threshold, Properties params) { @@ -285,6 +300,10 @@ public abstract class DistanceAlignment extends ObjectAlignment implements Align * raise problems: * - It invert column and rows when nbrows > nbcol (Hungarian loops) * - It prevents to generate alignments when one category has no elements. + * + * @param threshold: the threshold to apply to extracted correspondences + * @param params: the parameter of the measure + * @return the extracted alignment */ @SuppressWarnings({"unchecked","rawTypes"}) //ConcatenatedIterator public Alignment extractqq( double threshold, Properties params) { @@ -462,6 +481,10 @@ public abstract class DistanceAlignment extends ObjectAlignment implements Align * This algorithm will select the first and last correspondances of * overall similarity 1.1, while the optimum is the second solution * with overall of 1.8. + * + * @param threshold: the threshold to apply to extracted correspondences + * @param params: the parameter of the measure + * @return the extracted alignment */ @SuppressWarnings({"unchecked","rawTypes"}) //ConcatenatedIterator public Alignment extractqqgreedy( double threshold, Properties params) { diff --git a/src/fr/inrialpes/exmo/align/impl/Extensible.java b/src/fr/inrialpes/exmo/align/impl/Extensible.java index d125f5c24c752296ff973239f35b5fc13b01ef57..18afccd6fa6745f7337b9bf14e80f233a0fe6160 100644 --- a/src/fr/inrialpes/exmo/align/impl/Extensible.java +++ b/src/fr/inrialpes/exmo/align/impl/Extensible.java @@ -37,6 +37,8 @@ public interface Extensible { * to the alignment structure itself. * getExtensions returns a set of tripes: uri*label*value * all three being String + * + * @return a collection of tripes: uri*label*value implemented as String[] */ public Collection<String[]> getExtensions(); diff --git a/src/fr/inrialpes/exmo/align/impl/InstanceBasedMatrixMeasure.java b/src/fr/inrialpes/exmo/align/impl/InstanceBasedMatrixMeasure.java index ab50e6515739ca6149638d556a103c412b9c7623..dde23e644c45b640a8c008d7c65145446016d553 100644 --- a/src/fr/inrialpes/exmo/align/impl/InstanceBasedMatrixMeasure.java +++ b/src/fr/inrialpes/exmo/align/impl/InstanceBasedMatrixMeasure.java @@ -111,6 +111,8 @@ public abstract class InstanceBasedMatrixMeasure extends MatrixMeasure { * This is the empty method of this abstract class * it must compute the instance distance * and fill the adequate indmatrix with these distances. + * + * @param params: the parameters of the distance (e.g., cmeasure) */ public abstract void computeInstanceDistance( Properties params ); diff --git a/src/fr/inrialpes/exmo/align/impl/ObjectCell.java b/src/fr/inrialpes/exmo/align/impl/ObjectCell.java index 27bc7730f62f8a72d69d3621e53a7fb2cb136cd1..49be6998f4f942c8fcd50e4915095b963478c16d 100644 --- a/src/fr/inrialpes/exmo/align/impl/ObjectCell.java +++ b/src/fr/inrialpes/exmo/align/impl/ObjectCell.java @@ -50,7 +50,16 @@ public class ObjectCell extends BasicCell { // visitor.visit( this ); //} - /** Creation **/ + /** + * Creation + * + * @param id: the identifier of the correspondence (may be null) + * @param ob1 and + * @param ob2: the two objects related by the correspondence + * @param rel: the relation between the objects + * @param m: the confidence measure in the correspondence + * @throws AlignmentException when something goes wrong (e.g., confidence out of bounds) + **/ public ObjectCell( String id, Object ob1, Object ob2, Relation rel, double m ) throws AlignmentException { super( id, ob1, ob2, rel, m ); }; diff --git a/src/fr/inrialpes/exmo/align/impl/Similarity.java b/src/fr/inrialpes/exmo/align/impl/Similarity.java index c2e26ebb92fd906102e684b686153f29101f6c9f..5c388eb2dc14b6d460aea47154d7bd251e6ad423 100644 --- a/src/fr/inrialpes/exmo/align/impl/Similarity.java +++ b/src/fr/inrialpes/exmo/align/impl/Similarity.java @@ -39,23 +39,34 @@ public interface Similarity // ontology1 and ontology2 /** * Is it a similarity or a distance? + * + * @return true if the object represent a similarity (otherwise, it is a distance) */ public boolean getSimilarity(); // JE: OntoRewr: This should not be in init /** * Initialize the similarity value with various useful structures + * + * @param onto1 and + * @param onto2: the two ontologies which are matched */ public void initialize( LoadedOntology<Object> onto1, LoadedOntology<Object> onto2 ); public void initialize( LoadedOntology<Object> onto1, LoadedOntology<Object> onto2, Alignment align ); /** * actually computes the similarity and store it in the adequate structures + * + * @param p: the parameters of the measure to compute */ public void compute( Properties p ); /** * Accessors to the stored similarity values + * + * @param c1 and + * @param c2: the two objects for which computing the similarity + * @return the measure value */ public double getClassSimilarity( Object c1, Object c2 ); public double getPropertySimilarity( Object p1, Object p2); @@ -63,6 +74,8 @@ public interface Similarity /** * Printers of the obtained similarity values + * + * @param type: the type of layout of the printout */ public void printClassSimilarityMatrix( String type ); public void printPropertySimilarityMatrix( String type ); diff --git a/src/fr/inrialpes/exmo/align/impl/URICell.java b/src/fr/inrialpes/exmo/align/impl/URICell.java index 8a3146e6a97a5d3a739521d48ecb21627750ba55..33215c7f3a9b423a6069b30e30c04fb3974b5205 100644 --- a/src/fr/inrialpes/exmo/align/impl/URICell.java +++ b/src/fr/inrialpes/exmo/align/impl/URICell.java @@ -50,11 +50,19 @@ public class URICell extends BasicCell { visitor.visit( this ); } - /** Creation **/ + /** + * Creation + * + * @param id: the identifier of the correspondence (may be null) + * @param ob1 and + * @param ob2: the URI of the two objects related by the correspondence + * @param rel: the relation between the objects + * @param m: the confidence measure in the correspondence + * @throws AlignmentException when something goes wrong (e.g., confidence out of bounds) + **/ // public URICell( Object ob1, Object ob2 ) throws AlignmentException { // super( ob1, ob2 ); // }; - public URICell( String id, URI ob1, URI ob2, Relation rel, double m ) throws AlignmentException { super( id, ob1, ob2, rel, m ); } diff --git a/src/fr/inrialpes/exmo/align/impl/aggr/BasicAggregator.java b/src/fr/inrialpes/exmo/align/impl/aggr/BasicAggregator.java index 8ebaa717797675747ba5bd90b1dd8af77abf9a1d..a0183dfd8e756a3d122518b051ab33ecb768ab06 100644 --- a/src/fr/inrialpes/exmo/align/impl/aggr/BasicAggregator.java +++ b/src/fr/inrialpes/exmo/align/impl/aggr/BasicAggregator.java @@ -77,6 +77,9 @@ public abstract class BasicAggregator extends BasicAlignment { /** * Record the content of alignments. + * + * @param al: an alignment to intergrate + * @throws AlignmentException when something goes wrong (e.g., ontologies are different) */ public void ingest( BasicAlignment al ) throws AlignmentException { Ontology<? extends Object> onto1 = getOntologyObject1(); @@ -106,6 +109,8 @@ public abstract class BasicAggregator extends BasicAlignment { /** * Extract the alignment from consensus * This has to be implemented in concrete classes + * + * @throws AlignmentException when something goes wrong */ public abstract void extract() throws AlignmentException; @@ -115,6 +120,9 @@ public abstract class BasicAggregator extends BasicAlignment { * NOTE: It may be worth to consider that the relations do not have to * be equal but could be more specific or general than one another. * This could typically be made with algebras of relations. + * + * @param c: a cell to test the presence in the current aggregation + * @return the cell corresponding to c if it exists, null otherwise */ public Cell isAlreadyThere( Cell c ){ try { diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ClassId.java b/src/fr/inrialpes/exmo/align/impl/edoal/ClassId.java index fc65b0e98069d281e1dc1971f0b1cfe19b928a2d..09b1f86c14db5f903832d6beed11006a7f9712c3 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ClassId.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ClassId.java @@ -88,14 +88,11 @@ public class ClassId extends ClassExpression implements Id { } /** - * <p> - * Returns a simple description of this object. <b>The format of the + * @return a simple description of this object. + * <b>The format of the * returned String is undocumented and subject to change.</b> - * <p> - * <p> * An expamle return String could be: * <code>classId: http://my/super/class</code> - * </p> */ public String toString() { return "classId: " + id; diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/EDOALAlignment.java b/src/fr/inrialpes/exmo/align/impl/edoal/EDOALAlignment.java index bb470c6deea72171aa9d96a7799a6a2b2dc62f37..99be16db4be9c555fc2e6f1be88457eceb8d0a5d 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/EDOALAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/EDOALAlignment.java @@ -265,6 +265,10 @@ public class EDOALAlignment extends BasicAlignment { /** * convert an URI alignment into a corresponding EDOALAlignment * The same could be implemented for ObjectAlignent if necessary + * + * @param onto: the URI of the ontology to load + * @return the loaded ontology + * @throws AlignmentException when something goes wrong (ontology not loadable) */ // This works for any BasicAlignment but will return an empty // alignment if they do not have proper URI dereferencing. @@ -319,7 +323,10 @@ public class EDOALAlignment extends BasicAlignment { } /** * The EDOALAlignment has LoadedOntologies as ontologies - */ + * + * @param al: an alignment to convert as an EDOALAlignement + * @throws AlignmentException when something goes wrong (typically cannot access the aligned ontologies) + */ public void convertToEDOAL( BasicAlignment al ) throws AlignmentException { setType( al.getType() ); setExtensions( al.getExtensionsObject().convertExtension( "toEDOAL", "fr.inrialpes.exmo.align.edoal.EDOALAlignment#toEDOAL" ) ); @@ -362,6 +369,8 @@ public class EDOALAlignment extends BasicAlignment { /** * Generate a copy of this alignment object + * + * @return a clone of this alignment */ // JE: this is a mere copy of the method in BasicAlignement // It has two difficulties diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/EDOALCell.java b/src/fr/inrialpes/exmo/align/impl/edoal/EDOALCell.java index 83074c1429bba79aa201069438e6c4b23bb396a0..edac79b339a782d69b59991d1c09a6112a129336 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/EDOALCell.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/EDOALCell.java @@ -55,7 +55,16 @@ public class EDOALCell extends BasicCell { visitor.visit( this ); } - /** Creation **/ + /** + * Creation + * + * @param id: the identifier of the correspondence (may be null) + * @param ob1 and + * @param ob2: the two EDOAL expressions related by the correspondence + * @param rel: the relation between the objects + * @param m: the confidence measure in the correspondence + * @throws AlignmentException when something goes wrong (e.g., confidence out of bounds) + **/ public EDOALCell( String id, Expression ob1, Expression ob2, Relation rel, double m ) throws AlignmentException { super( id, (Object)ob1, (Object)ob2, rel, m ); }; @@ -84,6 +93,8 @@ public class EDOALCell extends BasicCell { /** * May be null + * + * @return the set of transformations attached to this correspondence */ public Set<Transformation> transformations() { return transformations; @@ -95,6 +106,11 @@ public class EDOALCell extends BasicCell { } linkkeys.add( linkkey ); } + /** + * May be null + * + * @return the set of link keys attached to this correspondence + */ public Set<Linkkey> linkkeys() { return linkkeys; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/InstanceId.java b/src/fr/inrialpes/exmo/align/impl/edoal/InstanceId.java index 57771bab0a1ff19282299e04d8c39dc041beef92..7eedb6374c4b410f5d352386d238fbc35be3f0c2 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/InstanceId.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/InstanceId.java @@ -85,14 +85,11 @@ public class InstanceId extends InstanceExpression implements Id { /** - * <p> - * Returns a simple description of this object. <b>The format of the + * @return a simple description of this object. + * <b>The format of the * returned String is undocumented and subject to change.</b> - * <p> - * <p> * An expamle return String could be: - * <code>instanceId: http://my/super/instance</code> - * </p> + * <code>InstanceId: http://my/super/instance</code> */ public String toString() { return "instanceId: " + uri; diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyId.java b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyId.java index 3ab1c6aa50664af21d58a9ad5d0a0093d3b832e4..18ef1f732ce6d95666938a461dba6d59378f330c 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyId.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyId.java @@ -72,14 +72,11 @@ public class PropertyId extends PropertyExpression implements Id { } /** - * <p> - * Returns a simple description of this object. <b>The format of the + * @return a simple description of this object. + * <b>The format of the * returned String is undocumented and subject to change.</b> - * <p> - * <p> - * An expamle return String could be: - * <code>attributeId: http://my/super/attribute</code> - * </p> + * An example return String could be: + * <code>PropertyId: http://my/super/property</code> */ public String toString() { return "PropertyId: " + id; diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/RelationId.java b/src/fr/inrialpes/exmo/align/impl/edoal/RelationId.java index 11767bc4714adca78d62f5febaab552379ae7dc6..e28bc422dd50d8406e0451adbfb0fb26c990f1ae 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/RelationId.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/RelationId.java @@ -84,14 +84,11 @@ public class RelationId extends RelationExpression implements Id { } /** - * <p> - * Returns a simple description of this object. <b>The format of the + * @return a simple description of this object. + * <b>The format of the * returned String is undocumented and subject to change.</b> - * <p> - * <p> - * An expamle return String could be: - * <code>RelationId: http://my/super/class</code> - * </p> + * An example return String could be: + * <code>RelationId: http://my/super/relation</code> */ public String toString() { return "RelationId: " + id; diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/Transformation.java b/src/fr/inrialpes/exmo/align/impl/edoal/Transformation.java index 83c72c30fc774633d5a12cc30b71898bac1ce5df..7510394d07a5f2677dffd85b5f32eae88eb4f993 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/Transformation.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/Transformation.java @@ -47,7 +47,14 @@ public class Transformation { return visitor.visit(this); } - /** Creation **/ + /** + * Creation + * + * @param type: the direction of the transformation + * @param ob1 and + * @param ob2: the two components of the transformation + * @throws AlignmentException when something goes wrong (unlikely) + **/ public Transformation( String type, ValueExpression ob1, ValueExpression ob2 ) throws AlignmentException { this.type = type; expr1 = ob1; diff --git a/src/fr/inrialpes/exmo/align/impl/eval/AveragePRGraphEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/AveragePRGraphEvaluator.java index 97cd78c3a2bf800eba61a6945a7743860caa2c35..ad7800b20c7fd610adb8c95ef3d6ad77e6f02a34 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/AveragePRGraphEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/AveragePRGraphEvaluator.java @@ -33,6 +33,8 @@ import java.util.SortedSet; import java.util.Comparator; import java.util.Vector; import java.io.PrintWriter; +import java.io.IOException; + import java.net.URI; import org.slf4j.Logger; @@ -190,8 +192,11 @@ public class AveragePRGraphEvaluator extends GraphEvaluator { /** * This output the result + * + * @param writer: the writer where to print the result + * @throws IOException when something goes wrong */ - public void write(PrintWriter writer) throws java.io.IOException { + public void write(PrintWriter writer) throws IOException { writer.println("<?xml version='1.0' encoding='utf-8' standalone='yes'?>"); writer.println("<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>"); writer.println(" <output rdf:about=''>"); @@ -206,9 +211,12 @@ public class AveragePRGraphEvaluator extends GraphEvaluator { writer.print(" </output>\n</rdf:RDF>\n"); } - /* Write out the final interpolated recall/precision graph data. + /** + * Write out the final interpolated recall/precision graph data. * One line for each recall/precision point in the form: 'R-value P-value'. * This is the format needed for GNUPLOT. + * + * @param writer: the writer where to print the result */ public void writePlot( PrintWriter writer ) { for(int i = 0; i < STEP+1; i++){ diff --git a/src/fr/inrialpes/exmo/align/impl/eval/DiffEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/DiffEvaluator.java index 799a72dc066198401042bfae607e51875e8dc932..a6f4d6f6a52465ad83a9286d1d25963326a66889 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/DiffEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/DiffEvaluator.java @@ -67,6 +67,7 @@ public class DiffEvaluator extends BasicEvaluator implements Evaluator { * @param align2 : the alignment to evaluate * The two parameters are transformed into URIAlignment before being processed * Hence, if one of them is modified after initialisation, this will not be taken into account. + * @throws AlignmentException when something goes wrong **/ public DiffEvaluator(Alignment align1, Alignment align2) throws AlignmentException { super(((BasicAlignment)align1).toURIAlignment(), ((BasicAlignment)align2).toURIAlignment()); diff --git a/src/fr/inrialpes/exmo/align/impl/eval/ExtPREvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/ExtPREvaluator.java index 9fd989754f6fb26aaab7cda05bd02c3f11d2c10e..07b045faa229d50a49d4d048a39e78c920b48ba2 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/ExtPREvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/ExtPREvaluator.java @@ -37,7 +37,9 @@ import fr.inrialpes.exmo.ontowrap.OntowrapException; import java.util.Properties; import java.util.HashSet; import java.util.Set; + import java.io.PrintWriter; +import java.io.IOException; import java.net.URI; @@ -106,7 +108,14 @@ public class ExtPREvaluator extends BasicEvaluator implements Evaluator { private boolean withConfidence = true; private boolean relsensitive = false; - /** Creation **/ + /** + * Creation + * + * @param align1 and + * @param align2: two alignments on which extended precision and recall will be computed + * @throws AlignmentException when something goes wrong + * + **/ public ExtPREvaluator(Alignment align1, Alignment align2) throws AlignmentException { super(align1, align2); convertToObjectAlignments( align1, align2 ); @@ -210,6 +219,10 @@ public class ExtPREvaluator extends BasicEvaluator implements Evaluator { * the similarity is symALPHA^(val1+val2), symALPHA being lower than 1. * valx is the length of the subclass chain. * Table 1 (and 2) of [Ehrig and Euzenat 2005] + * + * @param c1: the cell whose similarity is measured + * @param s2: alignment against which similarity is computed + * @return the symmetric similarity */ protected double computeSymSimilarity( Cell c1, Alignment s2 ){ double sim = 0; // the similarity between the pair of elements @@ -254,6 +267,10 @@ public class ExtPREvaluator extends BasicEvaluator implements Evaluator { * Effort-based relaxed precision and recal similarity * Note: it will be better if the parameters were replaced by the actual sibling (choice) * Table 3 of [Ehrig2005] + * + * @param c1: the cell whose similarity is measured + * @param s2: alignment against which similarity is computed + * @return the effort-based similarity */ protected double computeEffSimilarity( Cell c1, Alignment s2 ){ double sim = 0; // the similarity between the pair of elements @@ -300,6 +317,10 @@ public class ExtPREvaluator extends BasicEvaluator implements Evaluator { /** * Oriented relaxed precision and recal similarity * Table 4 (and 5) of [Ehrig and Euzenat 2005] + * + * @param c1: the cell whose similarity is measured + * @param s2: alignment against which similarity is computed + * @return the precision-oriented similarity */ protected double computePrecisionOrientedSimilarity( Cell c1, Alignment s2 ){ double sim = 0; // the similarity between the pair of elements @@ -353,6 +374,10 @@ public class ExtPREvaluator extends BasicEvaluator implements Evaluator { /** * Oriented relaxed precision and recal similarity * Table 6 (and 7) of [Ehrig and Euzenat 2005] + * + * @param c1: the cell whose similarity is measured + * @param s2: alignment against which similarity is computed + * @return the recall-oriented similarity */ protected double computeRecallOrientedSimilarity( Cell c1, Alignment s2 ){ double sim = 0; // the similarity between the pair of elements @@ -404,10 +429,16 @@ public class ExtPREvaluator extends BasicEvaluator implements Evaluator { } /** - * Returns the relative position of two entities: + * Returns the relative position of two entities in an ontology + * + * @param o1 and + * @param o2: two objects the position of which is computed + * @param onto: the ontology to which the objects belong + * @return the relative position: * 0: unrelated * n: o1 is a n-step sub-entity of o2 * -n: o2 is a n-step sub-entity of o1 + * @throws AlignmentException when something goes wrong (typically objects do not belong to the ontology) */ protected int relativePosition( Object o1, Object o2, HeavyLoadedOntology<Object> onto ) throws AlignmentException { try { @@ -436,6 +467,12 @@ public class ExtPREvaluator extends BasicEvaluator implements Evaluator { * * This would require computing the transitive reduction of the superClass * relation which is currently returned by HeavyLoadedOntology. + * + * @param class1 and + * @param class2: two classes superclass relationship is tested + * @param ontology: the ontology to which the classes belong + * @return the relation between these classes + * @throws AlignmentException when something goes wrong */ @SuppressWarnings({"unchecked"}) public int isSuperClass( Object class1, Object class2, HeavyLoadedOntology<Object> ontology ) throws AlignmentException { @@ -505,8 +542,11 @@ public class ExtPREvaluator extends BasicEvaluator implements Evaluator { /** * This now output the results in Lockheed format. + * + * @param writer: the writer where to print the result + * @throws IOException when something goes wrong */ - public void write(PrintWriter writer) throws java.io.IOException { + public void write(PrintWriter writer) throws IOException { writer.println("<?xml version='1.0' encoding='utf-8' standalone='yes'?>"); writer.println("<"+SyntaxElement.RDF.print()+" xmlns:"+Namespace.RDF.shortCut+"='"+Namespace.RDF.prefix+"'\n xmlns:"+Namespace.ATLMAP.shortCut+"='"+Namespace.ATLMAP.prefix+"'>"); writer.println(" <"+Namespace.ATLMAP.shortCut+":output "+SyntaxElement.RDF_ABOUT.print()+"=''>"); diff --git a/src/fr/inrialpes/exmo/align/impl/eval/GraphEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/GraphEvaluator.java index d257af41d0608ee6dc703d33286b004ea8b3b73f..35391b846a03db0f6811065778f6c44f01590dbb 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/GraphEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/GraphEvaluator.java @@ -34,6 +34,7 @@ import java.util.Vector; import java.util.SortedSet; import java.util.Comparator; import java.io.PrintWriter; +import java.io.IOException; import java.net.URI; import org.slf4j.Logger; @@ -73,15 +74,20 @@ public abstract class GraphEvaluator { public boolean invalid = true; /** - * Returns the points to display in a graph + * @return the points to display in a graph + * @throws AlignmentException when something goes wrong */ public abstract Vector<Pair> eval() throws AlignmentException; /** - * Returns the points to display in a graph + * @param params: display parameters + * @return the points to display in a graph + * @throws AlignmentException when something goes wrong */ public abstract Vector<Pair> eval( Properties params ) throws AlignmentException; /** * Retuns a simple global evaluation measure if any + * + * @return a global value assessing the result */ public abstract double getGlobalResult(); @@ -146,9 +152,11 @@ public abstract class GraphEvaluator { } } - /* - * Tells if the cell is found in the reference alignment - * (without relation consideration) + /** + * Integrate the cells of the alignment to evaluate in cellSet if the cell is found in the reference alignment + * + * @param al: the alignment to evaluate + * @param ref: the reference alignment */ public void ingest( Alignment al, Alignment ref ){ nbexpected += ref.nbCells(); @@ -167,9 +175,13 @@ public abstract class GraphEvaluator { else return cellSet.size(); } - /* + /** * Tells if the cell is found in the reference alignment * (without relation consideration) + * + * @param c: the cell to consider + * @param ref: the reference alignment + * @return true if the cell is correct */ public boolean isCorrect( Cell c, Alignment ref ) { try { @@ -190,8 +202,11 @@ public abstract class GraphEvaluator { /** * This output the resulting plot in XML + * + * @param writer: the writer where to print the result + * @throws IOException when something goes wrong */ - public void writeXMLMap( PrintWriter writer) throws java.io.IOException { + public void writeXMLMap( PrintWriter writer) throws IOException { for( Pair precrec: points ) { writer.print(" <step>\n <x>"); writer.print( precrec.getX() ); @@ -201,9 +216,12 @@ public abstract class GraphEvaluator { } } - /* Write out the final interpolated recall/precision graph data. + /** + * Write out the final interpolated recall/precision graph data. * One line for each recall/precision point in the form: 'R-value P-value'. * This is the format needed for GNUPLOT. + * + * @param writer: the writer where to print the result */ public void writePlot( PrintWriter writer ) { for( Pair p : points ){ diff --git a/src/fr/inrialpes/exmo/align/impl/eval/PRGraphEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/PRGraphEvaluator.java index c74e7163d6c59cfa0eed4d2c6256662600721508..3716c891ec490a4d351fa6024213ff7cc11e9134 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/PRGraphEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/PRGraphEvaluator.java @@ -34,7 +34,10 @@ import java.util.Set; import java.util.SortedSet; import java.util.Comparator; import java.util.Vector; + import java.io.PrintWriter; +import java.io.IOException; + import java.net.URI; import org.slf4j.Logger; @@ -79,6 +82,8 @@ public class PRGraphEvaluator extends GraphEvaluator { /** * Compute precision and recall graphs. + * + * @return the points to display in a graph */ public Vector<Pair> eval() { // throws AlignmentException return eval( (Properties)null ); @@ -86,6 +91,9 @@ public class PRGraphEvaluator extends GraphEvaluator { /** * Compute precision and recall graphs. + * + * @param params: display parameters + * @return the points to display in a graph */ public Vector<Pair> eval( Properties params ) { // throws AlignmentException points = new Vector<Pair>(STEP+1); @@ -100,6 +108,8 @@ public class PRGraphEvaluator extends GraphEvaluator { /** * Returns a list of Precision at recall points (Pairs) * From an ordered vector of cells with their correctness status + * + * @return the points to display in a graph */ public Vector<Pair> evalOpenEnded() { // Determine what the increment is @@ -141,6 +151,8 @@ public class PRGraphEvaluator extends GraphEvaluator { /** * Returns a list of Precision at recall points (Pairs) * From an ordered vector of cells with their correctness status + * + * @return the points to display in a graph */ public Vector<Pair> evalOldStyle() { double[] precisions = new double[STEP+1]; @@ -213,8 +225,11 @@ public class PRGraphEvaluator extends GraphEvaluator { /** * This output the result + * + * @param writer: the writer where to print the result + * @throws IOException when something goes wrong */ - public void write(PrintWriter writer) throws java.io.IOException { + public void write(PrintWriter writer) throws IOException { writer.println("<?xml version='1.0' encoding='utf-8' standalone='yes'?>"); writer.println("<"+SyntaxElement.RDF.print()+" xmlns:"+Namespace.RDF.shortCut+"='"+Namespace.RDF.prefix+"'>"); writer.println(" <output "+SyntaxElement.RDF_ABOUT.print()+"=''>"); diff --git a/src/fr/inrialpes/exmo/align/impl/eval/PRecEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/PRecEvaluator.java index cd8be2a36d78636f02badb44a09d21a3e1f87bc0..d403b105ade26286891164b60698be355b9d2a2b 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/PRecEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/PRecEvaluator.java @@ -77,7 +77,9 @@ public class PRecEvaluator extends BasicEvaluator implements Evaluator { * @param align2 : the alignment to evaluate * The two parameters are transformed into URIAlignment before being processed * Hence, if one of them is modified after initialisation, this will not be taken into account. - **/ + * + * @throws AlignmentException when something goes wrong + */ public PRecEvaluator( Alignment align1, Alignment align2 ) throws AlignmentException { super(((BasicAlignment)align1).toURIAlignment(), ((BasicAlignment)align2).toURIAlignment()); } @@ -96,6 +98,7 @@ public class PRecEvaluator extends BasicEvaluator implements Evaluator { } /** + * Computes the evaluation measure (the results are stored in the object) * * The formulas are standard: * given a reference alignment A @@ -108,6 +111,10 @@ public class PRecEvaluator extends BasicEvaluator implements Evaluator { * with inter = set intersection and |.| cardinal. * * In the implementation |B|=nbfound, |A|=nbexpected and |A inter B|=nbcorrect. + * + * @param params: the evaluation parameters + * @return the semantic F-measure of the alignment + * @throws AlignmentException when something goes wrong */ public double eval( Properties params ) throws AlignmentException { init(); diff --git a/src/fr/inrialpes/exmo/align/impl/eval/ROCCurveEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/ROCCurveEvaluator.java index 0fd2cfb0361fa58a2f5bf5ec978bb4436533afc1..97c103f56521925b83b5e21e0f26532dfa35e2e7 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/ROCCurveEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/ROCCurveEvaluator.java @@ -34,7 +34,10 @@ import java.util.Set; import java.util.SortedSet; import java.util.Comparator; import java.util.Vector; + import java.io.PrintWriter; +import java.io.IOException; + import java.net.URI; /** @@ -84,6 +87,9 @@ public class ROCCurveEvaluator extends GraphEvaluator { /** * Compute ROCCurve points * From an ordered vector of cells with their correctness status + * + * @param param: parameters of the evaluation + * @return the curve as a set of points */ public Vector<Pair> eval( Properties param ) { // Local variables @@ -150,6 +156,8 @@ public class ROCCurveEvaluator extends GraphEvaluator { /** * For the moment + * * + * @return the points to display in a graph */ public Vector<Pair> eval() { return eval( (Properties)null ); @@ -157,8 +165,11 @@ public class ROCCurveEvaluator extends GraphEvaluator { /** * This output the result + * + * @param writer: the writer where to print the result + * @throws IOException when something goes wrong */ - public void write(PrintWriter writer) throws java.io.IOException { + public void write(PrintWriter writer) throws IOException { writer.println("<?xml version='1.0' encoding='utf-8' standalone='yes'?>"); writer.println("<"+SyntaxElement.RDF.print()+" xmlns:"+Namespace.RDF.shortCut+"='"+Namespace.RDF.prefix+"'>"); writer.println(" <output rdf:about=''>"); diff --git a/src/fr/inrialpes/exmo/align/impl/eval/SemPRecEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/SemPRecEvaluator.java index 47e847f2662256b9a0e7ab22ae2f0a5f85b1774d..821b58d2724cc3da0a1da42e45d84e9f03c4a5a7 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/SemPRecEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/SemPRecEvaluator.java @@ -111,6 +111,7 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { * Initiate Evaluator for precision and recall * @param al1 : the reference alignment * @param al2 : the alignment to evaluate + * @throws AlignmentException when something goes wrong **/ public SemPRecEvaluator( Alignment al1, Alignment al2 ) throws AlignmentException { super( al1, al2 ); @@ -133,20 +134,16 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { } /** + * Computes the evaluation measure (the results are stored in the object) * - * The formulas are standard: - * given a reference alignment A - * given an obtained alignment B - * which are sets of cells (linking one entity of ontology O to another of ontolohy O'). - * - * P = |A inter B| / |B| - * R = |A inter B| / |A| - * F = 2PR/(P+R) - * with inter = set intersection and |.| cardinal. - * - * In the implementation |B|=nbfound, |A|=nbexpected and |A inter B|=nbcorrect. + * The formulas are standard (see PREvaluation) except that they use + * the entailment of a correspondence by an alignment instead of set-membership * * This takes semantics as a parameter which should be a litteral of fr.paris8.iut.info.iddl.conf.Semantics + * + * @param params: the evaluation parameters + * @return the semantic F-measure of the alignment + * @throws AlignmentException when something goes wrong */ public double eval( Properties params ) throws AlignmentException { init( params ); @@ -222,7 +219,9 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { /** * Even simpler if they are loaded: just merge them on the spot - * + * + * @param align: the alignment to load + * @throws AlignmentException when something goes wrong (typically IO and syntax problem) */ public void loadAlignedOntologies( ObjectAlignment align ) throws AlignmentException { // Get the two ontologies @@ -262,8 +261,11 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { } - /* + /** * Loads the Aligned ontologies without intermediate file + * + * @param align: the alignment to load + * @throws AlignmentException when something goes wrong (typically IO and syntax problem) */ public void loadPipedAlignedOntologies( final ObjectAlignment align ) throws AlignmentException { PipedInputStream in = new PipedInputStream(); @@ -322,8 +324,11 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { } } - /* + /** * Loads the Aligned ontologies through an intermediate file + * + * @param align: the alignment to load + * @throws AlignmentException when something goes wrong (typically IO and syntax problem) */ public void loadFileAlignedOntologies( ObjectAlignment align ) throws AlignmentException { // Render the alignment diff --git a/src/fr/inrialpes/exmo/align/impl/eval/SymMeanEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/SymMeanEvaluator.java index 2ec66d4bc63b93bd4a3b8c7bbef293d9bfbc1743..fd79db2028c4805dee1f658387c71a2b8dca952b 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/SymMeanEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/SymMeanEvaluator.java @@ -57,7 +57,13 @@ public class SymMeanEvaluator extends BasicEvaluator implements Evaluator { private double propScore = 0.; private double indScore = 0.; - /** Creation **/ + /** + * Creation + * + * @param align1 and + * @param align2: the two alignments to compare + * @throws AlignmentException when something goes wrong + **/ public SymMeanEvaluator( Alignment align1, Alignment align2 ) throws AlignmentException { super(align1,align2); convertToObjectAlignments( align1, align2 ); diff --git a/src/fr/inrialpes/exmo/align/impl/eval/ThresholdGraphEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/ThresholdGraphEvaluator.java index 55fdeaef2b036e24b1db1f440326c9e0427d02b8..d5775fa75a0cd11792b19e47ec681f908805c0a9 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/ThresholdGraphEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/ThresholdGraphEvaluator.java @@ -34,7 +34,10 @@ import java.util.Set; import java.util.SortedSet; import java.util.Comparator; import java.util.Vector; + import java.io.PrintWriter; +import java.io.IOException; + import java.net.URI; import org.slf4j.Logger; @@ -61,6 +64,8 @@ public class ThresholdGraphEvaluator extends GraphEvaluator { /** * Compute threshold graph + * + * @return the curve as a set of points */ public Vector<Pair> eval() { // throws AlignmentException return eval( (Properties)null ); @@ -75,6 +80,8 @@ public class ThresholdGraphEvaluator extends GraphEvaluator { * But it is better to: take the cells in reverse order * Compute the measures on the fly * + * @param params: parameters of the evaluation + * @return the curve as a set of points */ public Vector<Pair> eval( Properties params ) { // throws AlignmentException points = new Vector<Pair>(STEP+1); @@ -140,8 +147,11 @@ public class ThresholdGraphEvaluator extends GraphEvaluator { /** * This output the result + * + * @param writer: the writer where to print the result + * @throws IOException when something goes wrong */ - public void write(PrintWriter writer) throws java.io.IOException { + public void write(PrintWriter writer) throws IOException { writer.println("<?xml version='1.0' encoding='utf-8' standalone='yes'?>"); writer.println("<"+SyntaxElement.RDF.print()+" xmlns:"+Namespace.RDF.shortCut+"='"+Namespace.RDF.prefix+"'>"); writer.println(" <output "+SyntaxElement.RDF_ABOUT.print()+"=''>"); diff --git a/src/fr/inrialpes/exmo/align/impl/eval/WeightedPREvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/WeightedPREvaluator.java index ec62c43bf137bf51d3dd7985a8f7fc16c604e654..5e2eb4552c5296d77f58452ba4e0e71776bdb23e 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/WeightedPREvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/WeightedPREvaluator.java @@ -33,7 +33,10 @@ import fr.inrialpes.exmo.align.impl.Annotations; import java.util.Properties; import java.util.Set; + import java.io.PrintWriter; +import java.io.IOException; + import java.net.URI; import org.slf4j.Logger; @@ -79,6 +82,8 @@ public class WeightedPREvaluator extends BasicEvaluator implements Evaluator { * @param align2 : the alignment to evaluate * The two parameters are transformed into URIAlignment before being processed * Hence, if one of them is modified after initialisation, this will not be taken into account. + * + * @throws AlignmentException when something goes wrong **/ public WeightedPREvaluator(Alignment align1, Alignment align2) throws AlignmentException { super(((BasicAlignment)align1).toURIAlignment(), ((BasicAlignment)align2).toURIAlignment()); @@ -99,18 +104,14 @@ public class WeightedPREvaluator extends BasicEvaluator implements Evaluator { } /** + * Computes the evaluation measure (the results are stored in the object) * - * The formulas are standard: - * given a reference alignment A - * given an obtained alignment B - * which are sets of cells (linking one entity of ontology O to another of ontolohy O'). + * The formulas are standard (see PREvaluation) except that they use + * the difference between confidences instead of booleans * - * P = |A inter B| / |B| - * R = |A inter B| / |A| - * F = 2PR/(P+R) - * with inter = set intersection and |.| cardinal. - * - * In the implementation |B|=nbfound, |A|=nbexpected and |A inter B|=nbcorrect. + * @param params: the evaluation parameters + * @return the weighted F-measure of the alignment + * @throws AlignmentException when something goes wrong */ public double eval( Properties params ) throws AlignmentException { init(); @@ -219,8 +220,11 @@ return result; /** * This now output the results in Lockheed format. + * + * @param writer: the writer in which to write the result + * @throws IOException when something goes wrong */ - public void write(PrintWriter writer) throws java.io.IOException { + public void write(PrintWriter writer) throws IOException { writer.println("<?xml version='1.0' encoding='utf-8' standalone='yes'?>"); writer.println("<"+SyntaxElement.RDF.print()+" xmlns:"+Namespace.RDF.shortCut+"='"+Namespace.RDF.prefix+"'\n xmlns:"+Namespace.ATLMAP.shortCut+"='"+Namespace.ATLMAP.prefix+"'>"); writer.println(" <"+Namespace.ATLMAP.shortCut+":output "+SyntaxElement.RDF_ABOUT.print()+"=''>"); diff --git a/src/fr/inrialpes/exmo/align/impl/method/ClassStructAlignment.java b/src/fr/inrialpes/exmo/align/impl/method/ClassStructAlignment.java index 9c91fb022032381902fc0936bd7a2a2e5cc55f62..733b3fce61a54b452c9c4ecd923253e83bd2b978 100644 --- a/src/fr/inrialpes/exmo/align/impl/method/ClassStructAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/method/ClassStructAlignment.java @@ -73,6 +73,11 @@ public class ClassStructAlignment extends DistanceAlignment implements Alignment /** * Initialisation * The class requires HeavyLoadedOntologies + * + * @param o1 and + * @param o2: the two ontoogies to match + * @param ontologies: an ontology cache + * @throws AlignmentException when something goes wrong */ public void init(Object o1, Object o2, Object ontologies) throws AlignmentException { super.init( o1, o2, ontologies ); @@ -81,7 +86,13 @@ public class ClassStructAlignment extends DistanceAlignment implements Alignment throw new AlignmentException( "ClassStructAlignment requires HeavyLoadedOntology ontology loader" ); } - /** Processing **/ + /** + * Processing + * + * @param alignment: an initial alignment + * @param params: the parameters of the matching process + * @throws AlignmentException when something goes wrong + */ // Could better use similarity public void align( Alignment alignment, Properties params ) throws AlignmentException { loadInit( alignment ); diff --git a/src/fr/inrialpes/exmo/align/impl/method/NameAndPropertyAlignment.java b/src/fr/inrialpes/exmo/align/impl/method/NameAndPropertyAlignment.java index c7abb0bcac97ad62166567d89dc1984cfe73c814..cbc1499ce6160c273b4b4f2d4603b8b6e0e6b553 100644 --- a/src/fr/inrialpes/exmo/align/impl/method/NameAndPropertyAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/method/NameAndPropertyAlignment.java @@ -71,6 +71,11 @@ public class NameAndPropertyAlignment extends DistanceAlignment implements Align /** * Initialisation * The class requires HeavyLoadedOntologies + * + * @param o1 and + * @param o2: the two ontoogies to match + * @param ontologies: an ontology cache + * @throws AlignmentException when something goes wrong */ public void init(Object o1, Object o2, Object ontologies) throws AlignmentException { super.init( o1, o2, ontologies ); @@ -79,7 +84,13 @@ public class NameAndPropertyAlignment extends DistanceAlignment implements Align throw new AlignmentException( "NameAndPropertyAlignment requires HeavyLoadedOntology ontology loader" ); } - /** Processing **/ + /** + * Processing + * + * @param alignment: an initial alignment + * @param params: the parameters of the matching process + * @throws AlignmentException when something goes wrong + */ // Could better use similarity public void align( Alignment alignment, Properties params ) throws AlignmentException { loadInit( alignment ); @@ -250,6 +261,9 @@ public class NameAndPropertyAlignment extends DistanceAlignment implements Align /** * Make a local alignement + * + * @param prop1 and + * @param prop2: the two set of properties for a single class to match * @return an average of all the property alignement */ private double alignLocal( Set<? extends Object> prop1, Set<? extends Object> prop2) { diff --git a/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java b/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java index 20bff41a7987ba18ce0226dfc6ca2452cfbb2005..fd24055fa5f13b7e552ba2f871147750f43cd283 100644 --- a/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java @@ -98,7 +98,13 @@ public class StringDistAlignment extends DistanceAlignment implements AlignmentP //setType("**"); } - /* Processing */ + /** + * Processing + * + * @param alignment: an initial alignment + * @param params: the parameters of the matching process + * @throws AlignmentException when something goes wrong + */ public void align( Alignment alignment, Properties params ) throws AlignmentException { // Get function from params String f = params.getProperty("stringFunction"); diff --git a/src/fr/inrialpes/exmo/align/impl/method/StrucSubsDistAlignment.java b/src/fr/inrialpes/exmo/align/impl/method/StrucSubsDistAlignment.java index 7c529114976284a917cca2594f44927926540174..64bb9f99c6f23c82099028a6ec816f380791c282 100644 --- a/src/fr/inrialpes/exmo/align/impl/method/StrucSubsDistAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/method/StrucSubsDistAlignment.java @@ -71,6 +71,11 @@ public class StrucSubsDistAlignment extends DistanceAlignment implements Alignme /** * Initialisation * The class requires HeavyLoadedOntologies + * + * @param o1 and + * @param o2: the two ontoogies to match + * @param ontologies: an ontology cache + * @throws AlignmentException when something goes wrong */ public void init(Object o1, Object o2, Object ontologies) throws AlignmentException { super.init( o1, o2, ontologies ); @@ -79,7 +84,13 @@ public class StrucSubsDistAlignment extends DistanceAlignment implements Alignme throw new AlignmentException( "StrucSubsDistAlignment requires HeavyLoadedOntology ontology loader" ); } - /** Processing **/ + /** + * Processing + * + * @param alignment: an initial alignment + * @param params: the parameters of the matching process + * @throws AlignmentException when something goes wrong + */ // Could better use similarity public void align( Alignment alignment, Properties params ) throws AlignmentException { loadInit( alignment ); diff --git a/src/fr/inrialpes/exmo/align/impl/rel/A16AlgebraRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/A16AlgebraRelation.java index c760827049f99cd0f6841db23989180767049e9a..f75a0e2c077bb4719648e148209927bfaa4106ce 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/A16AlgebraRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/A16AlgebraRelation.java @@ -309,6 +309,8 @@ public class A16AlgebraRelation extends BitSetAlgebraRelation<A16BaseRelation> { /** * This is private because it refers to the implementation as BitSet + * + * @param rels: the internal representation of the relation */ private A16AlgebraRelation( BitSet rels ) { super( rels ); diff --git a/src/fr/inrialpes/exmo/align/impl/rel/A2AlgebraRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/A2AlgebraRelation.java index 9717328e48de7dcb3c8481a4decef69006bb4855..4667d1c8c726a431487f2fb2cfe579e901a91893 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/A2AlgebraRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/A2AlgebraRelation.java @@ -92,6 +92,8 @@ public class A2AlgebraRelation extends BitSetAlgebraRelation<A2BaseRelation> { /** * This is private because it refers to the implementation as BitSet + * + * @param rels: the internal representation of the relation */ private A2AlgebraRelation( BitSet rels ) { super( rels ); diff --git a/src/fr/inrialpes/exmo/align/impl/rel/A5AlgebraRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/A5AlgebraRelation.java index 8fed7c12c4d5329f6a4fe4558fe92f34cb9ba3ea..28474377e2f2f030eb589e5e963bafd6058bfa08 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/A5AlgebraRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/A5AlgebraRelation.java @@ -141,6 +141,8 @@ public class A5AlgebraRelation extends BitSetAlgebraRelation<A5BaseRelation> { /** * This is private because it refers to the implementation as BitSet + * + * @param rels: the internal representation of the relation */ private A5AlgebraRelation( BitSet rels ) { super( rels ); diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/GenericReflectiveVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/GenericReflectiveVisitor.java index 1f8389197c6d09272a0e8113e8feae08b10ce77d..0ab8e484ce0e679c89e2043ea4956a1aa37f64d0 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/GenericReflectiveVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/GenericReflectiveVisitor.java @@ -44,6 +44,10 @@ public class GenericReflectiveVisitor { * Look-up for X in the superclass of c (up to root, otherwise it loops) * If not found, look it up in the implemented interface * (there may be such a method for interfaces) + * + * @param c: the class in which the method should apply + * @param root: the topmost class above c + * @return the relevant method */ protected Method getMethod( Class<?> c, Class<?> root ) { Class<?> newc = c; diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java index b52a3562a1912c219f404f1da8fc32e53d9c2d99..6bb70767f7c2e9960399ad2620eac844ee037abe 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java @@ -164,6 +164,8 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito * Generates anew variable. This is always an object because we know * the subjects (named by outside). * It may be necessary to generate blanks. + * + * @return the new variable */ protected String createVarName() { if ( blanks ) { @@ -272,8 +274,8 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito /** * Produce Query only for local call. * - * @param referer - * @return + * @param referer: the reference to a query (corresponding to a correspondence) + * @return the query */ public String getQuery( Object referer ) { return queries.get( referer ); diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java index b503399c2fa0007fdc251ddb2ee0ddb2a1e1e8af..72919a149dc6fe43203b4dc97811a2a5007418d7 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java @@ -308,6 +308,10 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements /** * For EDOAL relation name depends on type of expressions + * + * @param rel: the relation to render + * @param ob: an object on which this relation applies + * @return the rendered relation */ public String getRelationName( Relation rel, Object ob ) { if ( RelationTransformer.isEquivalence( rel ) ) { @@ -350,8 +354,12 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements /** * Regular: relation name depends on loaded ontology + * + * @param onto: the ontology in which belongs ob + * @param rel: a relation to render + * @param ob: an object affected by this relation + * @return the rendered relation */ - public String getRelationName( LoadedOntology<? extends Object> onto, Relation rel, Object ob ) { try { if ( RelationTransformer.isEquivalence( rel ) ) { @@ -585,6 +593,9 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements * OWL, and in particular OWL 2, does not allow for more Relation (ObjectProperty) * and Property (DataProperty) constructor than owl:inverseOf * It is thus imposible to transcribe our and, or and not constructors. + * + * @param e: a compound property to render + * @throws AlignmentException when something goes wrong */ public void visit( final PropertyConstruction e ) throws AlignmentException { Relation toProcessNext = toProcess; @@ -731,6 +742,9 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements * defining a property subsumed by this closure through an axiom. * It is also possible to rewrite the reflexive closures as axioms as well. * But the transitive closure can only be obtained through subsumption. + * + * @param e: a compound relation to render + * @throws AlignmentException when something goes wrong */ public void visit( final RelationConstruction e ) throws AlignmentException { Relation toProcessNext = toProcess; @@ -843,6 +857,8 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements * * OWL offers further possiblities, such as additional owl:withRestriction * clauses + * + * @param e: a datatype to render */ public void visit( final Datatype e ) { indentedOutput("<owl:Datatype><owl:onDataType rdf:resource=\""+e.getType()+"\"/></owl:Datatype>"); diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/SILKRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/SILKRendererVisitor.java index 7826b835124fb829fa2529cb5507e0c1023858e6..c944eb30545015a624adc5fb1ead90cbbaf09c9e 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/SILKRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/SILKRendererVisitor.java @@ -56,6 +56,10 @@ import fr.inrialpes.exmo.align.impl.edoal.LinkkeyEquals; import fr.inrialpes.exmo.align.impl.edoal.LinkkeyIntersects; import fr.inrialpes.exmo.align.parser.SyntaxElement.Constructor; +/** + * This renders only a skeleton for the SILK script. + * In particular, it is impossible to know where to fetch the data from (this could eventually be injected) + */ public class SILKRendererVisitor extends GraphPatternRendererVisitor implements AlignmentVisitor { final static Logger logger = LoggerFactory.getLogger(SILKRendererVisitor.class); @@ -322,6 +326,11 @@ public class SILKRendererVisitor extends GraphPatternRendererVisitor implements /** * This is incomplete as SILK is able to deal with reverse (\) and constraints ([]) + * + * @param var: the starting point of the path (a variable) + * @param pex: the path expression to render + * @return the rendering of the path expression + * @throws AlignmentException when something goes wrong */ private String generateSILKPath( String var, PathExpression pex ) throws AlignmentException { String path = var; diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/SPARQLSelectRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/SPARQLSelectRendererVisitor.java index 5dd6f845cf8c2f0912c0e51a05527b3de073a336..5402de75aecf938743f75c101e5b0e38b4a290bb 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/SPARQLSelectRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/SPARQLSelectRendererVisitor.java @@ -167,6 +167,9 @@ public class SPARQLSelectRendererVisitor extends GraphPatternRendererVisitor imp /** * Linkkeys are irrelevant to SELECT queries + * + * @param linkkeyEquals: the link key to render + * @throws AlignmentException when something goes wrong */ public void visit(final LinkkeyEquals linkkeyEquals) throws AlignmentException { return; @@ -174,12 +177,15 @@ public class SPARQLSelectRendererVisitor extends GraphPatternRendererVisitor imp /** * Linkkeys are irrelevant to SELECT queries + * + * @param linkkeyIntersects: the link key to render + * @throws AlignmentException when something goes wrong */ public void visit(final LinkkeyIntersects linkkeyIntersects) throws AlignmentException { return; } - /*** JE: shouldn't it be in Graph ***/ + /* JE: shouldn't it be in Graph ***/ protected void beginNamedGraph(String namedGraph) { if (namedGraph != null) { addToGP("GRAPH <" + namedGraph + "> {" + NL); diff --git a/src/fr/inrialpes/exmo/align/parser/AlignmentParser.java b/src/fr/inrialpes/exmo/align/parser/AlignmentParser.java index f145730283efdd1cf30313b3e68327f8c7f9df3d..fe8a019651968a09494719a3e10ae9f1c67a3021 100644 --- a/src/fr/inrialpes/exmo/align/parser/AlignmentParser.java +++ b/src/fr/inrialpes/exmo/align/parser/AlignmentParser.java @@ -105,8 +105,11 @@ public class AlignmentParser { * Parses the document corresponding to the URI given in parameter * If the current process has links (import or include) to others documents then they are * parsed. - * @param uri URI of the document to parse - * @param loaded (cached ontologies) + * + * @param uri: URI of the document to parse + * @param loaded: (cached ontologies) + * @return the parsed alignment + * @throws AlignmentException when something goes wrong * @deprecated use parse( URI ) instead */ @Deprecated @@ -118,8 +121,10 @@ public class AlignmentParser { * Parses the document given in parameter * If the current process has links (import or include) to others documents then they are * parsed. - * @param o - * A URI, InputStream, String or Reader + * + * @param o: a URI, InputStream, String or Reader containing the alignment + * @return the parsed alignment + * @throws AlignmentException when something goes wrong */ private Alignment callParser( Object o ) throws AlignmentException { try { @@ -151,6 +156,11 @@ public class AlignmentParser { /** * This dispatch is ridiculous, but that's life + * + * @param p: a parser + * @param o: a URI, InputStream, String or Reader containing the alignment + * @return the parsed alignment + * @throws AlignmentException when something goes wrong */ private Alignment callParser( XMLParser p, Object o ) throws AlignmentException { if ( o instanceof URI ) return p.parse( ((URI)o).toString() ); @@ -170,7 +180,10 @@ public class AlignmentParser { /** * Parses the content of a string - * @param s String the string to parse + * + * @param s: a string containing an alignment + * @return the parsed alignment + * @throws AlignmentException when something goes wrong */ public Alignment parseString( String s ) throws AlignmentException { // The problem here is that InputStream are consumed by parsers @@ -181,7 +194,10 @@ public class AlignmentParser { /** * Parses a the content of a reader + * * @param r the reader to parse + * @return the parsed alignment + * @throws AlignmentException when something goes wrong */ public Alignment parse( Reader r ) throws AlignmentException { callParser( r ); @@ -190,7 +206,10 @@ public class AlignmentParser { /** * Parses a URI expressed as a String + * * @param uri the URI as a String + * @return the parsed alignment + * @throws AlignmentException when something goes wrong * This is only here for compatibility purposes */ public Alignment parse( String uri ) throws AlignmentException { @@ -204,7 +223,10 @@ public class AlignmentParser { /** * Parses a URI + * * @param uri the URI + * @return the parsed alignment + * @throws AlignmentException when something goes wrong */ public Alignment parse( URI uri ) throws AlignmentException { callParser( uri ); @@ -213,7 +235,10 @@ public class AlignmentParser { /** * Parses an inputStream + * * @param s the Stream to parse + * @return the parsed alignment + * @throws AlignmentException when something goes wrong */ public Alignment parse( InputStream s ) throws AlignmentException { callParser( s ); diff --git a/src/fr/inrialpes/exmo/align/parser/RDFParser.java b/src/fr/inrialpes/exmo/align/parser/RDFParser.java index fffcd25be689aac3e8d64d53e7946ec88639571c..85cb5023ff96e5f54f1ae7e4f06d1c1d02d1ef24 100644 --- a/src/fr/inrialpes/exmo/align/parser/RDFParser.java +++ b/src/fr/inrialpes/exmo/align/parser/RDFParser.java @@ -134,7 +134,7 @@ public class RDFParser { /** * Creates an RDF Parser. * - * @param debugMode The value of the debug mode (DEPRECATED) + * @param debugMode: The value of the debug mode (DEPRECATED) */ public RDFParser(int debugMode) { } @@ -161,9 +161,9 @@ public class RDFParser { * Parse the input model. The model shall include one statement that include * (?,RDF.type,Alignment) * - * @param rdfmodel the rdfmodel containing the RDF representation of the + * @param rdfmodel: the rdfmodel containing the RDF representation of the * parsed alignment - * @return the result EDOALAlignment + * @return the parsed EDOALAlignment * @throws AlignmentException if there is any exception, throw * AlignmentException that include describe infomation and a caused * exception. @@ -230,7 +230,7 @@ public class RDFParser { * * @param node the alignment resource * @return the parsed mapping document - * @throws AlignmentException + * @throws AlignmentException when something goes wrong */ public EDOALAlignment parseAlignment(final Resource node) throws AlignmentException { if (node == null) { @@ -368,6 +368,7 @@ public class RDFParser { * @param node the ontology node * @return the Ontology object * @throws NullPointerException if the node is null + * @throws AlignmentException when something goes wrong */ protected Ontology<Object> parseOntology(final Resource node) throws AlignmentException { if (node == null) { @@ -395,9 +396,9 @@ public class RDFParser { * Parses a mapping rule. The parsed node must be a Cell resource including * the mandatory Statement. <code><Cell></code> tag. * - * @param node the <code><Cell></code> tag - * @return the parsed rule - * @exception AlignmentException + * @param node: a node of type Cell + * @return the parsed correspondence + * @exception AlignmentException when something goes wrong */ protected EDOALCell parseCell( final Resource node ) throws AlignmentException { if (node == null) { @@ -529,9 +530,9 @@ public class RDFParser { /** * - * @param node - * @return - * @throws AlignmentException + * @param node: a node corresponding to a link key binding + * @return the parsed binding + * @throws AlignmentException when something goes wrong */ protected LinkkeyBinding parseLinkkeyBinding(final Resource node) throws AlignmentException { if (node == null) { diff --git a/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java b/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java index 6b05f47c29ddb9909684002db8da3121141adf56..84a2845add297c063e8238933c4356050327e924 100644 --- a/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java +++ b/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java @@ -267,7 +267,9 @@ public enum SyntaxElement { } /** + * @param name: the name of the element to retrieve * @return the resource of the element. + * @throws AlignmentException when the syntactic resources have not been initialised (use init()) */ public static Object getResource(String name) throws AlignmentException { if (register == null) { @@ -313,9 +315,9 @@ public enum SyntaxElement { * namespace of the element, the formated string will not be prefixed bye * the namespace and ':'. * - * @param namespace the namespace for which not to prefix the resulting + * @param namespace: the namespace for which not to prefix the resulting * string - * @return teh formated string + * @return the formated string * @see #print() */ public String print(final Namespace namespace) { diff --git a/src/fr/inrialpes/exmo/align/parser/XMLParser.java b/src/fr/inrialpes/exmo/align/parser/XMLParser.java index c46ba7a4735c348d8a57ab6cd8f25a8b7eeeeb3f..230f95e1d8aa5b228d37a22b947ace4ff0ca3756 100644 --- a/src/fr/inrialpes/exmo/align/parser/XMLParser.java +++ b/src/fr/inrialpes/exmo/align/parser/XMLParser.java @@ -176,6 +176,8 @@ public class XMLParser extends DefaultHandler { /** * Creates an XML Parser. + * @throws SAXException when syntax errors are encountered + * @throws ParserConfigurationException when the parser cannot be configured */ public XMLParser() throws ParserConfigurationException, SAXException { this(false); @@ -183,8 +185,10 @@ public class XMLParser extends DefaultHandler { /** * Creates an XML Parser. - * @param validate 0 if non validating, more otherwise + * @param validate: 0 if non validating, more otherwise * This should become a boolean + * @throws SAXException when syntax errors are encountered + * @throws ParserConfigurationException when the parser cannot be configured */ public XMLParser( int validate ) throws ParserConfigurationException, SAXException { this( (validate > 0) ); @@ -209,6 +213,9 @@ public class XMLParser extends DefaultHandler { * @param uri URI of the document to parse * Note: SAXParser has a parse( String uri ) method but it does not do content negotiation * Hence we have to reimplement it (2014) + * + * @return the parsed alignment + * @throws AlignmentException when something goes wrong */ public Alignment parse( String uri ) throws AlignmentException { try { @@ -227,7 +234,10 @@ public class XMLParser extends DefaultHandler { /** * Parses a reader, used for reading from a string + * * @param r the reader from which to parse + * @return the parsed alignment + * @throws AlignmentException when something goes wrong */ public Alignment parse( Reader r ) throws AlignmentException { try { @@ -242,7 +252,10 @@ public class XMLParser extends DefaultHandler { /** * Parses a string instead of a URI + * * @param s String the string to parse + * @return the parsed alignment + * @throws AlignmentException when something goes wrong */ public Alignment parse( InputStream s ) throws AlignmentException { try { @@ -269,15 +282,16 @@ public class XMLParser extends DefaultHandler { cellids = new HashSet<String>(); } - /** - * Called by the XML parser at the begining of an element. - * The corresponing graph component is create for each element. - * - * @param namespaceURI The namespace of the current element - * @param pName The local name of the current element - * @param qname The name of the current element - * @param atts The attributes name of the current element - */ + /** + * Called by the XML parser at the begining of an element. + * The corresponing graph component is create for each element. + * + * @param namespaceURI: The namespace of the current element + * @param pName: The local name of the current element + * @param qname: The name of the current element + * @param atts: The attributes name of the current element + * @throws SAXException when something goes wrong + */ public void startElement( String namespaceURI, String pName, String qname, Attributes atts ) throws SAXException { logger.trace( "startElement XMLParser : {}", pName ); parseLevel++; @@ -386,11 +400,16 @@ public class XMLParser extends DefaultHandler { throw new SAXException("[XMLParser] bad URI syntax : "+name);} } - /* From a patch proposed by Sabine Massmann + /** + * From a patch proposed by Sabine Massmann * Get around some nasty double parsing bug. Sometimes it parses * 6.925955630686735E-4 as * content XMLParser : 6.925955630686735 * content XMLParser : E-4 + * + * @param ch: an array of chars from the string part of XML + * @param start: the beging of the string to extract + * @param length: the length of the string to extract */ public void characters( char ch[], int start, int length ) { String newContent = new String( ch, start, length ); @@ -407,9 +426,10 @@ public class XMLParser extends DefaultHandler { /** * Called by the XML parser at the end of an element. * - * @param namespaceURI The namespace of the current element - * @param pName The local name of the current element - * @param qName The name of the current element + * @param namespaceURI: The namespace of the current element + * @param pName: The local name of the current element + * @param qName: The name of the current element + * @throws SAXException when something goes wrong */ public void endElement( String namespaceURI, String pName, String qName ) throws SAXException { logger.trace( "endElement XMLParser : {}", pName ); diff --git a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java index 8f35625df3454841dc7c1bab13d6e427aed96e15..212f8aff5b815d2d83aa54aff31467440843bea2 100644 --- a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java +++ b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java @@ -151,6 +151,11 @@ public class AServProtocolManager implements Service { * Initialization and constructor *********************************************************************/ + /** + * Creation + * + * @param dir: a hash-table of all directories by which the service will be registred + */ public AServProtocolManager ( Hashtable<String,Directory> dir ) { directories = dir; } @@ -337,6 +342,9 @@ public class AServProtocolManager implements Service { /** * returns null if alignment not retrieved * Otherwise returns AlignmentId or an ErrorMsg + * + * @param params: the parameters of the query + * @return a message containing the query result */ private Message retrieveAlignment( Properties params ){ String method = params.getProperty("method"); @@ -614,9 +622,12 @@ public class AServProtocolManager implements Service { } } - /* + /** * Returns only the metadata of an alignment and returns it in * parameters + * + * @param params: the parameters of the query + * @return a message containing the query result */ public Message metadata( Properties params ){ // Retrieve the alignment @@ -647,6 +658,12 @@ public class AServProtocolManager implements Service { * There is no way an alignment server could modify an alignment *********************************************************************/ + /** + * Trim an alignment + * + * @param params: the parameters of the query + * @return a message containing the query result + */ public Message trim( Properties params ) { // Retrieve the alignment String id = params.getProperty("id"); @@ -788,6 +805,9 @@ public class AServProtocolManager implements Service { /** * Store evaluation result from its URI + * + * @param params: the parameters of the query + * @return a message containing the query result */ public Message storeEval( Properties params ){ return new ErrorMsg( params, newId(), serverId,"Not yet implemented" ); @@ -795,6 +815,9 @@ public class AServProtocolManager implements Service { /** * Evaluate a track: a set of results + * + * @param params: the parameters of the query + * @return a message containing the query result */ // It is also possible to try a groupeval ~> with a zipfile containing results // ~~> But it is more difficult to know where is the reference (non public) @@ -808,6 +831,9 @@ public class AServProtocolManager implements Service { /** * Store the result + * + * @param params: the parameters of the query + * @return a message containing the query result */ public Message storeGroupEval( Properties params ){ return new ErrorMsg( params, newId(), serverId,"Not yet implemented" ); @@ -815,6 +841,9 @@ public class AServProtocolManager implements Service { /** * Retrieve the results (all registered result) of a particular test + * + * @param params: the parameters of the query + * @return a message containing the query result */ public Message getResults( Properties params ){ return new ErrorMsg( params, newId(), serverId,"Not yet implemented" ); @@ -847,6 +876,12 @@ public class AServProtocolManager implements Service { * Ontology Networks */ + /** + * Load a network of ontologies from its description + * + * @param params: the parameters of the query + * @return a message containing the query result + */ public Message loadOntologyNetwork( Properties params ) { // load the ontology network String name = params.getProperty("url"); @@ -1256,6 +1291,11 @@ public class AServProtocolManager implements Service { * requires to store the node that can be */ + /** + * + * @param params: the parameters of the query + * @return a message containing the query result + */ // Implements: reply-with public Message replywith(Properties params){ @@ -1292,6 +1332,12 @@ public class AServProtocolManager implements Service { * Utilities: reaching and loading ontologies *********************************************************************/ + /** + * Load an ontology + * + * @param uri: the URI (URL) of the ontology + * @return the loaded ontology + */ public LoadedOntology<? extends Object> reachable( URI uri ){ try { OntologyFactory factory = OntologyFactory.getFactory(); @@ -1312,7 +1358,9 @@ public class AServProtocolManager implements Service { /** * Display all the classes inheriting or implementing a given * interface in the currently loaded packages. - * @param toclass the interface to implement + * + * @param toclass: the interface to implement + * @return the set of strings corresponding to the implementation of the class */ public Set<String> implementations( Class<?> toclass ) { return implementations( toclass, new HashSet<String>() ); diff --git a/src/fr/inrialpes/exmo/align/service/AlignmentServiceProfile.java b/src/fr/inrialpes/exmo/align/service/AlignmentServiceProfile.java index 14cff0ebf11f66078cd60066912c408200c381cd..aea3bd91a39c545e37a9b33513e32978c52cb0c9 100644 --- a/src/fr/inrialpes/exmo/align/service/AlignmentServiceProfile.java +++ b/src/fr/inrialpes/exmo/align/service/AlignmentServiceProfile.java @@ -26,22 +26,38 @@ public interface AlignmentServiceProfile { /** * Creates the Service object and declares it after any - * required registery + * required registry + * + * @param p: the parameters of the service + * @param m: the protocol manager that the service will call + * @throws AServException when something goes wrong */ public void init( Properties p, AServProtocolManager m ) throws AServException; /** * Tells if it accept requests with this prefix + * + * @param prefix: the prefix of the URI of an incoming query + * @return true when the URI prefix is an accepted query */ public boolean accept( String prefix ); /** * Process a particular request + * + * @param uri: the URI of the query + * @param prefix: its prefix + * @param perf: its performative (the action to be processed) + * @param header: the HTTP header + * @param params: the parameters of the query + * @return true when the URI prefix is an accepted query */ public String process( String uri, String prefix, String perf, Properties header, Properties params ); /** * Shutdown the Service and undeclare it from any registery + * + * @throws AServException when something goes wrong */ public void close() throws AServException; } diff --git a/src/fr/inrialpes/exmo/align/service/Cache.java b/src/fr/inrialpes/exmo/align/service/Cache.java index c3bf06cb8091fe13bedef224f5e608eba204da05..abcb5626f49e4de31d20e53677e440679086c52c 100644 --- a/src/fr/inrialpes/exmo/align/service/Cache.java +++ b/src/fr/inrialpes/exmo/align/service/Cache.java @@ -39,6 +39,10 @@ public interface Cache { /** * loads the alignment descriptions from the database and put them in the * alignmentTable hashtable + * + * @param p: the initialisation parameters + * @param prefix: the URI prefix of the current server + * @throws AlignmentException when something goes wrong (cannot access database, but format) */ public void init( Properties p, String prefix ) throws AlignmentException; @@ -68,22 +72,38 @@ public interface Cache { * retrieve alignment metadata from id * This is more difficult because we return the alignment we have * disreagarding if it is complete o only metadata + * + * @param uri: the URI of the alignment whose metadata to retrieve + * @return the retrieved alignment filled only with its metadata + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public Alignment getMetadata( String uri ) throws AlignmentException; /** * retrieve full alignment from id (and cache it) + * + * @param uri: the URI of the alignment to retrieve + * @return the retrieved alignment + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public Alignment getAlignment( String uri ) throws AlignmentException; /** * retrieve full alignment from URI or description + * + * @param uri: the URI of the alignments to retrieve + * @return the set of retrieved alignments + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public Set<Alignment> getAlignmentByURI( String uri ) throws AlignmentException; public Set<Alignment> getAlignmentsByDescription( String desc ) throws AlignmentException; /** * retrieve network of ontologies from id + * + * @param uri: the URI of the network to retrieve + * @return the retrieved network of ontologies + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public OntologyNetwork getOntologyNetwork( String uri ) throws AlignmentException; @@ -92,6 +112,10 @@ public interface Cache { /** * returns the alignments between two ontologies * if one of the ontologies is null, then return them all + * + * @param uri1 and + * @param uri2: the URIs two ontologies from which retrieving alignments + * @return the retrieved alignments */ public Set<Alignment> getAlignments( URI uri1, URI uri2 ); @@ -107,21 +131,41 @@ public interface Cache { /** * records newly created alignment and returns its idenfifier + * + * @param alignment: the alignment to record + * @param force: true if the alignment is too be recorded even if it was recorded + * @return the URI of the recorded alignment */ public String recordNewAlignment( Alignment alignment, boolean force ); /** * records alignment identified by id and returns its idenfifier + * + * @param uri: the URI of the alignment to record + * @param al: the alignment to record + * @param force: true if the alignment is too be recorded even if it was recorded + * @return the URI of the recorded alignment + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public String recordNewAlignment( String uri, Alignment al, boolean force ) throws AlignmentException; /** * records newly created network and returns its idenfifier + * + * @param network: the network of ontologies to record + * @param force: true if the network is too be recorded even if it was recorded + * @return the URI of the recorded network */ public String recordNewNetwork( OntologyNetwork network, boolean force ); /** * records network identified by id and returns its idenfifier + * + * @param uri: the URI of the network to record + * @param network: the network of ontologies to record + * @param force: true if the network is too be recorded even if it was recorded + * @return the URI of the recorded network + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public String recordNewNetwork( String uri, OntologyNetwork network, boolean force ) throws AlignmentException; @@ -134,6 +178,10 @@ public interface Cache { /** * Non publicised class + * + * @param uri: the URI of the alignment to erase + * @param eraseFromDB: true if the alignment is erased from the database cache + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public void eraseAlignment( String uri, boolean eraseFromDB ) throws AlignmentException; diff --git a/src/fr/inrialpes/exmo/align/service/Directory.java b/src/fr/inrialpes/exmo/align/service/Directory.java index f5cc91e3c118d85f474dfa33519f0988fcf1186a..75c05c00a3db15f6b4c5eb8249bd7618a81f0096 100644 --- a/src/fr/inrialpes/exmo/align/service/Directory.java +++ b/src/fr/inrialpes/exmo/align/service/Directory.java @@ -31,21 +31,32 @@ public interface Directory { * Parameters can contain, e.g.: * - the directory address * - the declaration of the current service + * + * @param p: the properties of the connection to open + * @throws AServException when something goes wrong */ public void open( Properties p ) throws AServException; /** * Register an alignment to the directory (if necessary) + * + * @param al: the alignment to register + * @throws AServException when something goes wrong */ public void register( Alignment al ) throws AServException; /** * Unregister an alignment to the directory (if necessary) + * + * @param al: the alignment to unregister + * @throws AServException when something goes wrong */ public void unregister( Alignment al ) throws AServException; /** * Shutdown the connection and/or registration to the directory + * + * @throws AServException when something goes wrong */ public void close() throws AServException; } diff --git a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java index 25e3bb8d945ffda8312c90ad82940e19044b9abf..e56ff205a0884ce104716df6c001520d522d522b 100644 --- a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java +++ b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java @@ -129,7 +129,14 @@ public class HTMLAServProfile implements AlignmentServiceProfile { /** * HTTP administration interface + * Handles administrative specific requests * Allows some limited administration of the server through HTTP + * + * @param uri: the URL comming from the HTTP server + * @param perf: its performative (the action to be processed) + * @param header: the HTTP header + * @param params: the parameters of the query + * @return the HTML output to be displayed */ public String adminAnswer( String uri, String perf, Properties header, Properties params ) { //logger.trace( "ADMIN[{}]", perf); @@ -203,7 +210,14 @@ public class HTMLAServProfile implements AlignmentServiceProfile { /** * HTTP ontology networks interface + * Handles network of ontologies specific requests * Allows the ontology networks management through HTTP + * + * @param uri: the URL comming from the HTTP server + * @param perf: its performative (the action to be processed) + * @param header: the HTTP header + * @param params: the parameters of the query + * @return the HTML output to be displayed */ public String ontologyNetworkAnswer( String uri, String perf, Properties header, Properties params ) { logger.trace( "ONTONET[{}]", perf); @@ -418,6 +432,13 @@ public class HTMLAServProfile implements AlignmentServiceProfile { /** * User friendly HTTP interface * uses the protocol but offers user-targeted interaction + * Handles alignment specific requests + * + * @param uri: the URL comming from the HTTP server + * @param perf: its performative (the action to be processed) + * @param header: the HTTP header + * @param params: the parameters of the query + * @return the HTML output to be displayed */ public String htmlAnswer( String uri, String perf, Properties header, Properties params ) { logger.trace("HTML[{}]", perf ); diff --git a/src/fr/inrialpes/exmo/align/service/HTTPResponse.java b/src/fr/inrialpes/exmo/align/service/HTTPResponse.java index dee4374b50468cf2e08cd18109b9a857079801d7..7d31815761518d4318690d16047a7915dd39b2d3 100644 --- a/src/fr/inrialpes/exmo/align/service/HTTPResponse.java +++ b/src/fr/inrialpes/exmo/align/service/HTTPResponse.java @@ -62,6 +62,10 @@ public class HTTPResponse { /** * Basic constructor. + * + * @param status: the HTTP status value (OK, ERR...) + * @param mimeType: the MIME type of the answer + * @param data: the content of the answer */ public HTTPResponse( String status, String mimeType, InputStream data ) { this.status = status; @@ -72,6 +76,10 @@ public class HTTPResponse { /** * Convenience method that makes an InputStream out of * given text. + * + * @param status: the HTTP status value (OK, ERR...) + * @param mimeType: the MIME type of the answer + * @param txt: the text of the answer (to be encoded) */ public HTTPResponse( String status, String mimeType, String txt ) { this.status = status; @@ -83,6 +91,9 @@ public class HTTPResponse { /** * Adds given line to the header. + * + * @param name: name of the property to add to the HTTP header + * @param value: value of the property */ public void addHeader( String name, String value ) { header.put( name, value ); diff --git a/src/fr/inrialpes/exmo/align/service/HTTPTransport.java b/src/fr/inrialpes/exmo/align/service/HTTPTransport.java index 01702616b4b8374efd4c73b6c4190207523adf03..fc4afc115aab44449fda521fda360a73427fad0b 100644 --- a/src/fr/inrialpes/exmo/align/service/HTTPTransport.java +++ b/src/fr/inrialpes/exmo/align/service/HTTPTransport.java @@ -83,8 +83,12 @@ public class HTTPTransport { // ================================================== /** - * Starts a HTTP server to given port.<p> - * Throws an exception if the socket is already in use + * Starts a HTTP server to given port. + * + * @param params: the parameters of the connection, including HTTP port and host + * @param manager: the manager which will deal with connections + * @param serv: the set of services to be listening on this connection + * @throws AServException when something goes wrong (e.g., socket already in use) */ public void init( Properties params, AServProtocolManager manager, Vector<AlignmentServiceProfile> serv ) throws AServException { this.manager = manager; @@ -243,15 +247,15 @@ public class HTTPTransport { // ================================================== /** - * Override this to customize the server.<p> + * Override this to customize the server. * * (By default, this delegates to serveFile() and allows directory listing.) * - * @param uri Percent-decoded URI without parameters, for example "/index.cgi" - * @param method "GET", "POST" etc. - * @param parms Parsed, percent decoded parameters from URI and, in case of POST, data. - * @param header Header entries, percent decoded - * @return HTTP response, see class Response for details + * @param uri: Percent-decoded URI without parameters, for example "/index.cgi" + * @param method: "GET", "POST" etc. + * @param parms: Parsed, percent decoded parameters from URI and, in case of POST, data. + * @param header: Header entries, percent decoded + * @return an HTTP response made of these elements (see @class Response for details) */ public HTTPResponse serve( String uri, String method, Properties header, Properties parms ) { logger.debug( "{} '{}'", method, uri ); @@ -345,6 +349,10 @@ public class HTTPTransport { /** * Returns the alignment in negociated format + * + * @param uri: the URI of an alignment + * @param mimeType: the MIME type in which the alignment is requested + * @return an HTTP response corresponding to the alignment in the requested MIME type */ public HTTPResponse returnAlignment( String uri, String mimeType ) { Properties params = new Properties(); @@ -367,6 +375,10 @@ public class HTTPTransport { /** * Returns the network in HTML or RDF + * + * @param uri: the URI of a network of ontologies + * @param mimeType: the MIME type in which the network of ontologies is requested + * @return an HTTP response corresponding to the network of ontologies in the requested MIME type */ public HTTPResponse returnNetwork( String uri, String mimeType ) { Properties params = new Properties(); diff --git a/src/fr/inrialpes/exmo/align/service/SQLCache.java b/src/fr/inrialpes/exmo/align/service/SQLCache.java index f20e5baa697f898e3169c15794f3b949a0877202..831dee336e11f9e19ec945b32fc13fd1d48cbdd0 100644 --- a/src/fr/inrialpes/exmo/align/service/SQLCache.java +++ b/src/fr/inrialpes/exmo/align/service/SQLCache.java @@ -136,6 +136,10 @@ public class SQLCache extends VolatilCache implements Cache { /** * loads the alignment descriptions from the database and put them in the * alignmentTable hashtable + * + * @param p: the initialisation parameters + * @param prefix: the URI prefix of the current server + * @throws AlignmentException when something goes wrong (cannot access database, but format) */ public void init( Properties p, String prefix ) throws AlignmentException { super.init( p, prefix ); @@ -198,6 +202,9 @@ public class SQLCache extends VolatilCache implements Cache { /** * loads the alignment descriptions and networks of ontologies from the * database and put them in the indexes + * + * @param force: true if data is downloaded from the database + * @throws SQLException when something goes wrong (e.g., no database access) */ private void load( boolean force ) throws SQLException { logger.debug( "Loading alignments and networks..." ); @@ -206,7 +213,6 @@ public class SQLCache extends VolatilCache implements Cache { OntologyNetwork noo = null; Vector<String> idInfo = new Vector<String>(); - if (force) { // Retrieve the alignment ids try ( Statement st = conn.createStatement() ) { @@ -249,6 +255,9 @@ public class SQLCache extends VolatilCache implements Cache { /** * loads the description of alignments from the database and set them * in an alignment object + * + * @param id: the id of an alignment + * @return the loaded alignment */ protected Alignment retrieveDescription( String id ) { ResultSet rs; @@ -330,7 +339,13 @@ public class SQLCache extends VolatilCache implements Cache { * should be invoked when: * ( result.getExtension(CACHED) == "" * AND result.getExtension(STORED) != "") { - + * + * @param uri: the uri of an alignment + * @param alignment: the alignment structure containing its metadata + * @return the retrieved alignment + * @throws SQLException when the database is not accessible + * @throws URISyntaxException when the URI is invalid + * @throws AlignmentException when something else goes wrong (no corresponding alignment) */ protected Alignment retrieveAlignment( String uri, Alignment alignment ) throws SQLException, AlignmentException, URISyntaxException { String id = stripAlignmentUri( uri ); @@ -438,6 +453,11 @@ public class SQLCache extends VolatilCache implements Cache { /** * retrieve full alignment from id (and cache it) + * + * @param uri: the URI of an alignment + * @param result: its alignment structure + * @return the fetched alignment + * @throws AlignmentException when something goes wrong */ protected Alignment fetchAlignment( String uri, Alignment result ) throws AlignmentException { try { @@ -446,7 +466,7 @@ public class SQLCache extends VolatilCache implements Cache { logger.trace( "Cache: cannot read from DB", sqlex ); throw new AlignmentException( "getAlignment: SQL exception", sqlex ); } catch ( URISyntaxException urisex ) { - logger.trace( "Cache: cannot read from DB", urisex ); + logger.trace( "Cache: Incorrect URI", urisex ); throw new AlignmentException( "getAlignment: Cannot find alignment", urisex ); } } @@ -456,11 +476,14 @@ public class SQLCache extends VolatilCache implements Cache { /** * quote: * Prepare a string to be used in SQL queries by preceeding occurences of - * "'", """, and "\" by a "\". + * "'", """, and "\'" by a "\"". * This should be implemented at a lower level within Java itself * (or the sql package). * This function is used here for protecting everything to be entered in * the database + * + * @param s: a string to be passed to SQL + * @return the string with quotes protected */ public static String quote( String s ) { if ( s == null ) return "NULL"; @@ -481,6 +504,9 @@ public class SQLCache extends VolatilCache implements Cache { /** * Non publicised class + * + * @param uri: the URI of the alignment to suppress from the store + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public void unstoreAlignment( String uri ) throws AlignmentException { Alignment alignment = getAlignment( uri ); diff --git a/src/fr/inrialpes/exmo/align/service/VolatilCache.java b/src/fr/inrialpes/exmo/align/service/VolatilCache.java index e41eb00c09a66457858f595a838bf7cc3b7b93af..d9305ee04de1b4c2456e5b6eb1099a69f7a1d5ed 100644 --- a/src/fr/inrialpes/exmo/align/service/VolatilCache.java +++ b/src/fr/inrialpes/exmo/align/service/VolatilCache.java @@ -96,6 +96,10 @@ public class VolatilCache implements Cache { /** * loads the alignment descriptions from the database and put them in the * alignmentTable hashtable + * + * @param p: the initialisation parameters + * @param prefix: the URI prefix of the current server + * @throws AlignmentException when something goes wrong (cannot access database, but format) */ public void init( Properties p, String prefix ) throws AlignmentException { logger.debug( "Initializing Database cache" ); @@ -130,6 +134,9 @@ public class VolatilCache implements Cache { /** * Find alignments by URI + * + * @param uri: the URI of the alignment to retrieve + * @return the set of retrieved alignments */ public Set<Alignment> getAlignmentByURI( String uri ) { Set<Alignment> result = null; @@ -144,7 +151,10 @@ public class VolatilCache implements Cache { /** * Find alignments by pretty - * NOT IMPLEMENTED YET + * TODO: NOT IMPLEMENTED YET + * + * @param desc: a string describing the sought alignment + * @return the set of retrieved alignments */ public Set<Alignment> getAlignmentsByDescription( String desc ) { return null; @@ -152,6 +162,9 @@ public class VolatilCache implements Cache { /** * Find alignments by ontology URIs + * + * @param uri: the URI of one ontology + * @return the set of retrieved alignments */ public Set<Alignment> getAlignments( URI uri ) { return ontologyTable.get( uri ); @@ -160,6 +173,10 @@ public class VolatilCache implements Cache { /** * returns the alignments between two ontologies * if one of the ontologies is null, then return them all + * + * @param uri1 and + * @param uri2: the URIs two ontologies from which retrieving alignments + * @return the set of retrieved alignments */ public Set<Alignment> getAlignments( URI uri1, URI uri2 ) { Set<Alignment> result; @@ -302,6 +319,10 @@ public class VolatilCache implements Cache { * retrieve alignment metadata from id * This is more difficult because we return the alignment we have * disreagarding if it is complete o only metadata + * + * @param uri: the URI of the alignment whose metadata to retrieve + * @return the retrieved alignment filled only with its metadata + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public Alignment getMetadata( String uri ) throws AlignmentException { Alignment result = alignmentTable.get( uri ); @@ -312,6 +333,10 @@ public class VolatilCache implements Cache { /** * retrieve full alignment from id (and cache it) + * + * @param uri: the URI of the alignment to retrieve + * @return the retrieved alignment + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public Alignment getAlignment( String uri ) throws AlignmentException { Alignment result = null; @@ -342,6 +367,10 @@ public class VolatilCache implements Cache { /** * retrieve network of ontologies from id + * + * @param uri: the URI of the network to retrieve + * @return the retrieved network of ontologies + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public OntologyNetwork getOntologyNetwork( String uri ) throws AlignmentException { try { @@ -370,6 +399,8 @@ public class VolatilCache implements Cache { * should be invoked when: * ( result.getExtension(CACHED) != "" * AND obviously result.getExtension(STORED) != "" + * + * @param alignment: the alignment to unload */ protected void flushAlignment( Alignment alignment ) {// throws AlignmentException //alignment.removeAllCells(); @@ -382,6 +413,10 @@ public class VolatilCache implements Cache { /** * records newly created alignment + * + * @param alignment: the alignment to record + * @param force: true if the alignment is too be recorded even if it was recorded + * @return the URI of the recorded alignment */ public String recordNewAlignment( Alignment alignment, boolean force ) { try { return recordNewAlignment( generateAlignmentUri(), alignment, force ); @@ -390,6 +425,12 @@ public class VolatilCache implements Cache { /** * records alignment identified by id + * + * @param uri: the URI of the alignment to record + * @param al: the alignment to record + * @param force: true if the alignment is too be recorded even if it was recorded + * @return the URI of the recorded alignment + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public String recordNewAlignment( String uri, Alignment al, boolean force ) throws AlignmentException { al.setExtension(SVCNS, OURI1, al.getOntology1URI().toString()); @@ -406,6 +447,11 @@ public class VolatilCache implements Cache { /** * records alignment identified by id * force will register the new alignment even if it is already registered + * + * @param uri: the URI of the alignment to record + * @param alignment: the alignment to record + * @param force: true if the alignment is too be recorded even if it was recorded + * @return the URI of the recorded alignment */ public String recordAlignment( String uri, Alignment alignment, boolean force ) { // URIINdex: if this guy already has a URI, record in table @@ -451,6 +497,8 @@ public class VolatilCache implements Cache { /** * suppresses the record for an alignment + * + * @param alignment: the alignment to unrecord */ public void unRecordAlignment( Alignment alignment ) { String id = alignment.getExtension( Namespace.ALIGNMENT.uri, Annotations.ID ); @@ -476,6 +524,10 @@ public class VolatilCache implements Cache { /** * records a newly created network + * + * @param network: the network of ontologies to record + * @param force: true if the network is too be recorded even if it was recorded + * @return the URI of the recorded network */ public String recordNewNetwork( OntologyNetwork network, boolean force ) { try { @@ -488,6 +540,12 @@ public class VolatilCache implements Cache { /** * records alignment identified by id + * + * @param uri: the URI of the network to record + * @param network: the network of ontologies to record + * @param force: true if the network is too be recorded even if it was recorded + * @return the URI of the recorded network + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public String recordNewNetwork( String uri, OntologyNetwork network, boolean force ) throws AlignmentException { logger.debug( "Recording network with URI {}", uri ); @@ -502,6 +560,11 @@ public class VolatilCache implements Cache { /** * records a network identified by id + * + * @param uri: the URI of the network to record + * @param network: the network of ontologies to record + * @param force: true if the network is too be recorded even if it was recorded + * @return the URI of the recorded network */ public String recordNetwork( String uri, OntologyNetwork network, boolean force ) { // record the network at the corresponding Uri in tables! @@ -521,6 +584,8 @@ public class VolatilCache implements Cache { /** * suppresses the record for a network of ontologies + * + * @param network: the network of ontologies to record */ public void unRecordNetwork( OntologyNetwork network ) { String id = ((BasicOntologyNetwork)network).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID ); @@ -542,6 +607,10 @@ public class VolatilCache implements Cache { /** * Non publicised class + * + * @param uri: the URI of the alignment to erase + * @param eraseFromDB: true if the alignment is erased from the database cache + * @throws AlignmentException when something goes wrong (cannot resolve URI) */ public void eraseAlignment( String uri, boolean eraseFromDB ) throws AlignmentException { Alignment alignment = getAlignment( uri ); diff --git a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java index 3fbecc2e9fdb45dac6218a6e1d7798e01b026517..8356b1d3c68a26f4b1c2fb3ab0cbce306aa16aa2 100644 --- a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java +++ b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java @@ -224,6 +224,12 @@ public class WSAServProfile implements AlignmentServiceProfile { * and the answer is through the resulting page (RDF? SOAP? HTTP? JSON?) * Not implemented yet * but reserved if appears useful + * + * @param uri: the URI of the request + * @param perf: its performative (the action to be processed) + * @param header: the HTTP header + * @param param: the parameters of the request + * @return the answer to the request as a string */ public String protocolAnswer( String uri, String perf, Properties header, Properties param ) { String method = null; @@ -645,6 +651,9 @@ public class WSAServProfile implements AlignmentServiceProfile { /** * Extract parameters from a DOM document resulting from parsing a SOAP messgae + * + * @param doc: a DOM document resulting from parsing a SOAP messgae + * @return the content of the SOAP message as a property set */ private Properties getParameters( Document doc ) { Properties params = new Properties(); diff --git a/src/fr/inrialpes/exmo/align/service/msg/Message.java b/src/fr/inrialpes/exmo/align/service/msg/Message.java index 5d8691227a67888075ba30c990f43157cbf7b7db..4fc3e834f48fc0eb8cf7b41e689d0f9f9d28094f 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/Message.java +++ b/src/fr/inrialpes/exmo/align/service/msg/Message.java @@ -60,6 +60,8 @@ public class Message { /** * This must return an XML object, typically an attribute. + * + * @return a string containing the message as XML */ public String RESTString(){ return "<Message>"+getXMLContent()+"</Message>"; @@ -67,6 +69,8 @@ public class Message { /** * For HTML interface calling the REST interface + * + * @return a string containing the message as HTML */ public String HTMLRESTString(){ return "<Message/>"; @@ -78,6 +82,8 @@ public class Message { /** * This must return a JSON object, that will typically be an attribute value. + * + * @return a string containing the message as JSON */ public String JSONString(){ return "\""+getJSONContent()+"\""; diff --git a/src/fr/inrialpes/exmo/align/service/osgi/Service.java b/src/fr/inrialpes/exmo/align/service/osgi/Service.java index fd771ef5a6618aa304e16da84cecbd2bfa964d37..63b6f84bf3540193d7f19a71c0f1f6bed96310fd 100644 --- a/src/fr/inrialpes/exmo/align/service/osgi/Service.java +++ b/src/fr/inrialpes/exmo/align/service/osgi/Service.java @@ -65,6 +65,12 @@ public interface Service { * Basic protocol primitives *********************************************************************/ + /** + * load an alignment + * + * @param mess: the parameters of the request + * @return the message corresponding to the answer of the request + */ public Message load( Properties mess ); public Message align( Properties mess ); @@ -83,6 +89,12 @@ public interface Service { * Extended protocol primitives *********************************************************************/ + /** + * store an alignment + * + * @param mess: the parameters of the request + * @return the message corresponding to the answer of the request + */ public Message store( Properties mess ); //public Message erase( Properties mess ); @@ -96,6 +108,12 @@ public interface Service { * There is no way an alignment server could modify an alignment *********************************************************************/ + /** + * trim an alignment + * + * @param mess: the parameters of the request + * @return the message corresponding to the answer of the request + */ public Message trim( Properties mess ); public Message harden( Properties mess ); @@ -116,6 +134,12 @@ public interface Service { * Network of alignment server implementation *********************************************************************/ + /** + * load a network of ontologies + * + * @param params: the parameters of the request + * @return the message corresponding to the answer of the request + */ public Message loadOntologyNetwork( Properties params ); public Message renderOntologyNetwork( Properties params ); @@ -142,6 +166,12 @@ public interface Service { * Utilities: reaching and loading ontologies *********************************************************************/ + /** + * store an alignment + * + * @param al: the alignment to store + * @return true if everything has worked properly + */ public boolean storedAlignment( Alignment al ); public boolean storedNetwork( OntologyNetwork on ); diff --git a/src/fr/inrialpes/exmo/ontowrap/LoadedOntology.java b/src/fr/inrialpes/exmo/ontowrap/LoadedOntology.java index 72e2304b2a3706fb2646d74c8ec161343daebc60..a8233fca255b2013c5bf51b598a6af49a327de41 100644 --- a/src/fr/inrialpes/exmo/ontowrap/LoadedOntology.java +++ b/src/fr/inrialpes/exmo/ontowrap/LoadedOntology.java @@ -31,7 +31,8 @@ public interface LoadedOntology<O> extends Ontology<O> { /** * returns the entity corresponding to the given URI * If no such entity exists, may return null or raise an exception - * @param u an URI + * + * @param u: the URI of an entity * @return the corresponding entity in the ontology or null * @throws OntowrapException when an exception has been caught */ @@ -39,7 +40,8 @@ public interface LoadedOntology<O> extends Ontology<O> { /** * returns the URI of an entity in the ontology - * @param o the entity + * + * @param o: the entity * @return its URI if it exists or null * @throws OntowrapException when an exception has been caught */ @@ -54,9 +56,10 @@ public interface LoadedOntology<O> extends Ontology<O> { * last fragment (after the last "/" or just before) in this order. * Because of its low definiteness, it is not advised to use this primitive * and it is better to use other ones (getNames, getComments, getAnnotations). - * @param o the entity - * @return a label - * @throws OntowrapException + * + * @param o: the entity + * @return the name of the entity + * @throws OntowrapException when something went wrong */ public String getEntityName( Object o ) throws OntowrapException; @@ -68,43 +71,49 @@ public interface LoadedOntology<O> extends Ontology<O> { * otherwise returns the default name (getEntityName) * Because of its low definiteness, it is not advised to use this primitive * and it is better to use other ones (getNames, getComments, getAnnotations). - * @param o the entity - * @return a label - * @throws OntowrapException + * + * @param o: the entity + * @param lang: the code of the language ("en", "fr", "es", etc.) + * @return a name of the entity + * @throws OntowrapException when something went wrong */ public String getEntityName( Object o, String lang ) throws OntowrapException; /** * returns all the names of an entity in a language if specified. * otherwise, returns null - * @param o the entity - * @param lang the code of the language ("en", "fr", "es", etc.) + * + * @param o: the entity + * @param lang: the code of the language ("en", "fr", "es", etc.) * @return the default name - * @throws OntowrapException + * @throws OntowrapException when something went wrong */ public Set<String> getEntityNames( Object o, String lang ) throws OntowrapException; /** * Returns all the names a given entity (e.g., rdfs:labels in OWL/RDFS). - * @param o the entity + * + * @param o: the entity * @return the set of labels - * @throws OntowrapException + * @throws OntowrapException when something went wrong */ public Set<String> getEntityNames( Object o ) throws OntowrapException; /** * Returns the values ofof textual properties (e.g., "rdfs:comment", rdfs:label in RDFS/OWL) for a given entity and for a given natural language (attribute xml:lang). - * @param o the entity - * @param lang the code of the language ("en", "fr", "es", etc.) + * + * @param o: the entity + * @param lang: the code of the language ("en", "fr", "es", etc.) * @return the set of comments - * @throws OntowrapException + * @throws OntowrapException when something went wrong */ public Set<String> getEntityComments( Object o , String lang ) throws OntowrapException; /** * Returns all the values of textual properties (e.g., "rdfs:comment", rdfs:label in RDFS/OWL) for a given entity - * @param o the entity + * + * @param o: the entity * @return the set of comments - * @throws OntowrapException + * @throws OntowrapException when something went wrong */ public Set<String> getEntityComments( Object o ) throws OntowrapException; @@ -112,9 +121,10 @@ public interface LoadedOntology<O> extends Ontology<O> { * Returns all the values of the "owl:AnnotationProperty" property for a given entity. * These annotations are those predefined in owl (owl:versionInfo, rdfs:label, rdfs:comment, rdfs:seeAlso and rdfs:isDefinedBy) * but also all other defined annotation properties which are subClass of "owl:AnnotationProperty" - * @param o the entity + * + * @param o: the entity * @return the set of annotation values - * @throws OntowrapException + * @throws OntowrapException when something went wrong */ public Set<String> getEntityAnnotations( Object o ) throws OntowrapException; @@ -124,10 +134,11 @@ public interface LoadedOntology<O> extends Ontology<O> { * Returns all the values of the "owl:AnnotationProperty" property for a given entity expressed in the required language. * These annotations are those predefined in owl (owl:versionInfo, rdfs:label, rdfs:comment, rdfs:seeAlso and rdfs:isDefinedBy) * but also all other defined annotation properties which are subClass of "owl:AnnotationProperty" - * @param o the entity - * @param lang the code of the language ("en", "fr", "es", etc.) + * + * @param o: the entity + * @param lang: the code of the language ("en", "fr", "es", etc.) * @return the set of annotation values - * @throws OntowrapException + * @throws OntowrapException when something went wrong */ public Set<String> getEntityAnnotations( Object o, String lang ) throws OntowrapException; @@ -140,7 +151,9 @@ public interface LoadedOntology<O> extends Ontology<O> { /** * Returns all named entities having URI beginning with the ontology URI + * * @return the set of entities + * @throws OntowrapException when something went wrong */ public Set<? extends Object> getEntities() throws OntowrapException; public Set<? extends Object> getClasses() throws OntowrapException; diff --git a/src/fr/inrialpes/exmo/ontowrap/OntologyFactory.java b/src/fr/inrialpes/exmo/ontowrap/OntologyFactory.java index 84077c067aab75ed64ef50bfba6d0bacefe17f95..6369c296de5ea7f697ebb16a06500b33d948b658 100644 --- a/src/fr/inrialpes/exmo/ontowrap/OntologyFactory.java +++ b/src/fr/inrialpes/exmo/ontowrap/OntologyFactory.java @@ -141,12 +141,19 @@ public abstract class OntologyFactory { /** * All Ontologies must implement clearCache() * which unload their ontologies if any cache is enabled. + * + * @throws OntowrapException when something goes wrong */ public abstract void clearCache() throws OntowrapException; /** * Encapsulate an ontology already in the environment * These methods should rather be in a LoadableOntologyFactory + * + * @param onto: the ontology to be encapsulated + * @param onlyLocalEntities: true if only the entities in the namespace of the ontology have to be considered + * @return the LoadedOntology object + * @throws OntowrapException when something goes wrong */ public abstract LoadedOntology<? extends Object> newOntology( Object onto , boolean onlyLocalEntities ) throws OntowrapException; @@ -157,14 +164,22 @@ public abstract class OntologyFactory { /** * Load an ontology, cache enabled * These methods should rather be in a LoadableOntologyFactory + * + * @param uri: the URI (URL) of the ontology to load + * @return the loaded ontology + * @throws OntowrapException when something goes wrong */ public LoadedOntology<? extends Object> loadOntology( URI uri ) throws OntowrapException { // logger.trace( "loading URI: {}", uri ); return loadOntology( uri, true ); } - /* + /** * Loads and ontology which is not loaded yet + * + * @param onto: the Ontology object corresponding to the ontology to load + * @return the corresponding LoadedOntology object + * @throws OntowrapException when something goes wrong */ public LoadedOntology<? extends Object> loadOntology( Ontology<? extends Object> onto ) throws OntowrapException { // logger.trace( "loading Ontology: {}", onto ); @@ -182,6 +197,11 @@ public abstract class OntologyFactory { /** * Load an ontology, cache enabled * These methods should rather be in a LoadableOntologyFactory + * + * @param uri: the URI (URL) of the ontology to load + * @param onlyLocalEntities: true if only the entities in the namespace of the ontology have to be considered + * @return the LoadedOntology object + * @throws OntowrapException when something goes wrong */ public abstract LoadedOntology<? extends Object> loadOntology( URI uri, boolean onlyLocalEntities ) throws OntowrapException; diff --git a/src/fr/inrialpes/exmo/ontowrap/owlapi10/OWLAPIOntology.java b/src/fr/inrialpes/exmo/ontowrap/owlapi10/OWLAPIOntology.java index afb47057a3e5ad39c75b220e0f7ef26d69c36b4b..935cea64fce011cd4a744f41dd5c8b765af0171d 100644 --- a/src/fr/inrialpes/exmo/ontowrap/owlapi10/OWLAPIOntology.java +++ b/src/fr/inrialpes/exmo/ontowrap/owlapi10/OWLAPIOntology.java @@ -530,6 +530,9 @@ public class OWLAPIOntology extends BasicOntology<OWLOntology> implements HeavyL /** * returns emptyset in case of error (e.g., if p is a property) + * + * @param p: the class on which to find cardinality restrictions + * @return the set of cardinality restrictions */ public Set<Object> getCardinalityRestrictions( Object p ){ Set<Object> spcl = new HashSet<Object>(); @@ -545,6 +548,9 @@ public class OWLAPIOntology extends BasicOntology<OWLOntology> implements HeavyL /** * Inherits all properties of a class + * + * @param cl: the class on which to find cardinality restrictions + * @return the set of inherited properties of the class */ private Set<Object> getInheritedProperties( OWLClass cl ) { Set<Object> resultSet = new HashSet<Object>(); diff --git a/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3Ontology.java b/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3Ontology.java index 735329fa7f9f58092cbe6b4497abda8e8eb977c9..64c38d81ade2be75be196fc669888aa7d61ef2cb 100644 --- a/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3Ontology.java +++ b/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3Ontology.java @@ -120,6 +120,11 @@ public class OWLAPI3Ontology extends BasicOntology<OWLOntology> implements Heavy /** * type and lang can be null + * + * @param o: the OWL entity on which to find annotations + * @param type: the URI of the annotation type + * @param lang: the code of the language ("en", "fr", "es", etc.) + * @return the set of annotations on the entity expressed in the given language */ protected Set<String> getEntityAnnotations( Object o, URI type, String lang ) { // We cannot retreive encapsulated annotations with this API diff --git a/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSThesaurus.java b/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSThesaurus.java index 8f8ab92103ec64df6aab96e1682054b2de3a3bb3..3b9ad94a74e7f046d53bc4e2d44c5e4549f35ae0 100644 --- a/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSThesaurus.java +++ b/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSThesaurus.java @@ -68,11 +68,11 @@ public class SKOSThesaurus extends BasicOntology<SKOSDataset> implements HeavyLo * ontology (the S is for Simple). * * Translation from SKOS to OWL (by Antoine Isaac): - * skos:Concept --> owl:Class - * skos:broader --> rdfs:subClassOf - * skos:prefLabel, skos:altLabel, skos:hiddenLabel --> rdfs:label - * skos:notes, skos:definition, skos:scopeNote --> rdfs:comments - * skos:related --> rdfs:seeAlso [ignored] + * skos:Concept --> owl:Class + * skos:broader -->, rdfs:subClassOf + * skos:prefLabel, skos:altLabel, skos:hiddenLabel --> rdfs:label + * skos:notes, skos:definition, skos:scopeNote --> rdfs:comments + * skos:related --> rdfs:seeAlso [ignored] * * OK So what is in the SKOS Data model, since this is the only one that we * will take into account... @@ -86,7 +86,7 @@ public class SKOSThesaurus extends BasicOntology<SKOSDataset> implements HeavyLo * **/ - /** + /* onto.getSKOSDataRelationAssertions(concept) assertion.getSKOSObject(); @@ -100,14 +100,20 @@ lang = untypedLiteral.getLang(); }} */ - - public void getDataValues( SKOSConcept o, SKOSDataProperty p, Set<String> result ){ + /** + * Returns one of the prefLabel property values for a given SKOS concept. + * + * @param o: the concept whose property value is sought + * @param p: the sought property + * @param result: a set of strings containing the result + */ + private void getDataValues( SKOSConcept o, SKOSDataProperty p, Set<String> result ){ for ( SKOSLiteral lit : onto.getSKOSDataRelationByProperty( o, p ) ){ result.add( lit.getLiteral() ); } } - public void getDataValues( SKOSConcept o, SKOSDataProperty p, Set<String> result, String lang ){ + private void getDataValues( SKOSConcept o, SKOSDataProperty p, Set<String> result, String lang ){ for ( SKOSLiteral lit : onto.getSKOSDataRelationByProperty( o, p ) ){ if ( !lit.isTyped() ) { SKOSUntypedLiteral l = lit.getAsSKOSUntypedLiteral(); @@ -119,18 +125,19 @@ lang = untypedLiteral.getLang(); /** We should document: - name < names + name < names annotations - comments(lang) < comments + comments(lang) < comments **/ // NEARLY DONE /** - * returns one of the prefLabel property values for a given SKOS concept. - * @param o the entity - * @return a label - * @throws OntowrapException - * JE// This is not satisfying because in case of several PrefLabels it will return the first one... + * Returns one of the prefLabel property values for a given SKOS concept. + * + * @param o: the entity whose name is sought + * @return the name of the entity + * @throws OntowrapException when something goes wrong + * JE: This is not satisfying because in case of several PrefLabels it will return the first one... */ public String getEntityName( Object o ) throws OntowrapException { Set<String> result = new HashSet<String>(); @@ -141,12 +148,13 @@ lang = untypedLiteral.getLang(); // NEARLY DONE /** - * returns one of the prefLabel property values for a given SKOS concept in a given language. - * @param o the entity - * @param lang the code of the language ("en", "fr", "es", etc.) - * @return a label - * @throws OntowrapException - * JE// This is not satisfying because in case of several PrefLabels it will return the first one... + * Returns one of the prefLabel property values for a given SKOS concept in a given language. + * + * @param o: the entity whose prefered label is sought + * @param lang: the code of the language ("en", "fr", "es", etc.) + * @return the preferred label in the given language if available + * @throws OntowrapException when something goes wrong + * JE: This is not satisfying because in case of several PrefLabels it will return the first one... */ public String getEntityName( Object o, String lang ) throws OntowrapException { Set<String> result = new HashSet<String>(); @@ -157,10 +165,11 @@ lang = untypedLiteral.getLang(); /** * Returns the values of the prefLabel, hiddenLabel and altLabel properties in a given language. - * @param o the entity - * @param lang the code of the language ("en", "fr", "es", etc.) - * @return the set of labels - * @throws OntowrapException + * + * @param o: the entity whose preferred labels are sought + * @param lang: the code of the language ("en", "fr", "es", etc.) + * @return the set of preferred label in the given language if available + * @throws OntowrapException when something goes wrong */ public Set<String> getEntityNames( Object o, String lang ) throws OntowrapException { Set<String> result = new HashSet<String>(); @@ -172,9 +181,10 @@ lang = untypedLiteral.getLang(); /** * Returns the values of the prefLabel, hiddenLabel and altLabel properties. - * @param o the concept - * @return the set of labels - * @throws OntowrapException + * + * @param o: the concept + * @return the set of labels of the concept + * @throws OntowrapException when something goes wrong */ public Set<String> getEntityNames(Object o) throws OntowrapException { Set<String> result = new HashSet<String>(); @@ -188,10 +198,11 @@ lang = untypedLiteral.getLang(); // TODO /** * Returns the values of the "rdfs:comment" property for a given entity and for a given natural language (attribute xml:lang). - * @param o the entity - * @param lang the code of the language ("en", "fr", "es", etc.) - * @return the set of comments - * @throws OntowrapException + * + * @param o: the concept the comments on which are sought + * @param lang: the code of the language ("en", "fr", "es", etc.) + * @return the set of comments in the given language + * @throws OntowrapException when something goes wrong */ public Set<String> getEntityComments(Object o, String lang) throws OntowrapException { Set<String> comments = new HashSet<String>(); @@ -213,9 +224,10 @@ lang = untypedLiteral.getLang(); // TODO /** * Returns all the values of the "rdfs:comment" property for a given entity - * @param o the entity - * @return the set of comments - * @throws OntowrapException + * + * @param o: the concept the comments on which are sought + * @return the set of comments on the concept + * @throws OntowrapException when something goes wrong */ public Set<String> getEntityComments( Object o ) throws OntowrapException { return getEntityComments(o,null); @@ -229,9 +241,10 @@ lang = untypedLiteral.getLang(); * skos:note, skos:changeNote, skos:definition, skos:editorialNote, * skos:example, skos:historyNote and skos:scopeNote * but also all other defined annotation properties which are subClass of "owl:AnnotationProperty" - * @param o the entity - * @return the set of annotation values - * @throws OntowrapException + * + * @param o: the concept the annotations on which are sought + * @return the set of annotations on the concept + * @throws OntowrapException when something goes wrong */ public Set<String> getEntityAnnotations( Object o ) throws OntowrapException { Set<String> annots = new HashSet<String>(); @@ -249,6 +262,11 @@ lang = untypedLiteral.getLang(); /** * There is no languages on annotations in SKOS API * Hence we return all of them + * + * @param o: the concept the annotations on which are sought + * @param lang: the code of the language ("en", "fr", "es", etc.) + * @return the set of annotations on the concept in the given language + * @throws OntowrapException when something goes wrong */ public Set<String> getEntityAnnotations( Object o, String lang ) throws OntowrapException { return getEntityAnnotations( o ); diff --git a/src/fr/inrialpes/exmo/queryprocessor/QueryProcessor.java b/src/fr/inrialpes/exmo/queryprocessor/QueryProcessor.java index 2527eaabc1bad7c9f93fd1d10cf7ffa9545f661c..d81a4afb7cb72c21b7ef49fbefd59787a8cf5fd0 100644 --- a/src/fr/inrialpes/exmo/queryprocessor/QueryProcessor.java +++ b/src/fr/inrialpes/exmo/queryprocessor/QueryProcessor.java @@ -35,27 +35,33 @@ public interface QueryProcessor { /** * @param query -- The query string * @param type -- The query type, can be one of SELECT, ASK, CONSTRUCT, or DESCRIBE - * @return Result, result form depends on type + * @return the query result as a Result object depending on type */ - public Result query(String query, Type type); + public Result query( String query, Type type ); /** - *@param query -- The query string + * @param query -- The query string + * @return the query result as a Result object */ - public Result query(String query); + public Result query( String query ); /** - *@param query -- The query string - *@return query results as string + * @param query -- The query string + * @return the query results as a string */ - public String queryWithStringResults(String query); + public String queryWithStringResults( String query ); /** - *@param query -- the query string - *@return the type of the query + * @param query -- the query string + * @return the type of the query */ - public int getType(String query); + public int getType( String query ); - public void loadOntology(String uri); + /** + * Loads an ontology + * + * @param uri -- the URI of the ontology to load + */ + public void loadOntology( String uri ); } diff --git a/src/fr/inrialpes/exmo/queryprocessor/Result.java b/src/fr/inrialpes/exmo/queryprocessor/Result.java index 9dcf06df07ad4932d018c8e059ab018d72ddd134..6eac6e947861067ae956d08ea79fe9b48a35afbd 100644 --- a/src/fr/inrialpes/exmo/queryprocessor/Result.java +++ b/src/fr/inrialpes/exmo/queryprocessor/Result.java @@ -28,24 +28,32 @@ import java.util.Vector; * @author Arun Sharma */ public interface Result { - /**@return the type of the result set + /** + * @return the type of the result set */ public int getType(); - /**@return the reslut for ASK type queries + /** + * @return the reslut for ASK type queries + * @throws QueryTypeMismatchException when the query cannot be evaluated */ public boolean getAskResult() throws QueryTypeMismatchException; /** - *@return the RDF graph for construct queries + * @return the RDF graph for construct queries + * @throws QueryTypeMismatchException when the query cannot be evaluated */ public RDFGraph getConstructResult() throws QueryTypeMismatchException; - /**@return a collection set for SELECT queries + /** + * @return a collection set for SELECT queries + * @throws QueryTypeMismatchException when the query cannot be evaluated */ public Collection<Vector<Object>> getSelectResult() throws QueryTypeMismatchException; - /**@return an XML string for the SELECT queries + /** + * @return an XML string for the SELECT queries + * @throws QueryTypeMismatchException when the query cannot be evaluated */ public String getSelectResultasXML() throws QueryTypeMismatchException; diff --git a/src/org/semanticweb/owl/align/Alignment.java b/src/org/semanticweb/owl/align/Alignment.java index c7a99901382fceafa2efc6ba0df2518eae64fe44..0e8e55c6b6a3a89278b015b00bfdea77edc97fcf 100644 --- a/src/org/semanticweb/owl/align/Alignment.java +++ b/src/org/semanticweb/owl/align/Alignment.java @@ -45,34 +45,55 @@ import org.xml.sax.ContentHandler; public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { /** Initialize the alignement before using it - * @param onto1, @param onto2: the two ontologies aligned - * @throws AlignmentException + * @param onto1 and + * @param onto2: the two ontologies aligned + * @throws AlignmentException if cannot initialize **/ public void init( Object onto1, Object onto2 ) throws AlignmentException; /** * Initialize the alignement before using it, with some ontology caching trick * //@deprecated The OntologyCache is now internal, use init( onto1, onto2 ) instead - * @param onto1, @param onto2: the two ontologies aligned + * @param onto1 and + * @param onto2: the two ontologies aligned * @param cache: a cache where to find and store the ontologies - * @throws AlignmentException + * @throws AlignmentException when cannot initialise **/ //@Deprecated public void init( Object onto1, Object onto2, Object cache ) throws AlignmentException; - /** Alignment methods **/ + /* Alignment methods */ + /** + * @return the first ontology of the alignment + */ public Object getOntology1(); + + /** + * @return the second ontology of the alignment + */ public Object getOntology2(); + + /** + * @return the URI of the first ontology of the alignment + * @throws AlignmentException when no URI is found (unlikely) + */ public URI getOntology1URI() throws AlignmentException; + + /** + * @return the URI of the second ontology of the alignment + * @throws AlignmentException when no URI is found (unlikely) + */ public URI getOntology2URI() throws AlignmentException; public void setOntology1(Object ontology) throws AlignmentException; public void setOntology2(Object ontology) throws AlignmentException; /** * Alignment type: - * Currently defined a sa String. + * Currently defined as a String. * This string is supposed to contain two characters: among ?, 1, *, + * Can be implemented otherwise + * + * @param level the level of the alignment */ public void setLevel( String level ); public String getLevel(); @@ -81,18 +102,21 @@ public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { * Currently defined a sa String. * This string is supposed to contain two characters: among ?, 1, *, + * Can be implemented otherwise + * + * @param type the type of the alignment */ public void setType( String type ); public String getType(); /** - * Alignment type: - * Currently defined a sa String. - * This string is supposed to contain two characters: among ?, 1, *, + - * Can be implemented otherwise + * Set the ontology used by the alignment + * This URI is in fact a URL of where to fetch the ontology. + * It may be local. + * + * @param file: the URI of the first ontology */ - public void setFile1( URI type ); - public void setFile2( URI type ); + public void setFile1( URI file ); + public void setFile2( URI file ); public URI getFile1(); public URI getFile2(); @@ -109,11 +133,19 @@ public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { /** * Cells are created and indexed at once + * + * @param ob1 the object of the first ontology in the correspondence + * @param ob2 the object of the second ontology in the correspondence + * @param relation the relation between these objects + * @param measure the confidence measure in the correspondence + * @return the corresponding cell + * @throws AlignmentException when something goes wrong (unknown objects, bad relation) */ - public Cell addAlignCell( Object ob1, Object ob, String relation, double measure) throws AlignmentException; + public Cell addAlignCell( Object ob1, Object ob2, String relation, double measure) throws AlignmentException; public Cell addAlignCell( Object ob1, Object ob2) throws AlignmentException; public void remCell( Cell c ) throws AlignmentException; + /** * Cells are retrieved * These primitives are deprecated. Use getAlignCells1 and getAlignCells2 @@ -121,15 +153,23 @@ public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { * Reason: this applies only for 1:1 alignments * Some implementations might act cleverly (retrieving the best value). * Basic implementations may raise the exception + * + * @param ob the object of the first ontology from which to retrieve the correspondence + * @return the corresponding cell + * @throws AlignmentException when something goes wrong * //@deprecated There is more than one cell about one object */ //@Deprecated public Cell getAlignCell1( Object ob ) throws AlignmentException; /** * //@deprecated There is more than one cell about one object + * @param ob the object of the second ontology from which to retrieve the correspondence + * @return the corresponding cell + * @throws AlignmentException when something goes wrong */ //@Deprecated public Cell getAlignCell2( Object ob ) throws AlignmentException; + /** * Each part of the cell can be queried independently. * These primitives are deprecated. Use getAlignCells1 and getAlignCells2 @@ -137,6 +177,11 @@ public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { * Reason: this applies only for 1:1 alignments * Some implementations might act cleverly (retrieving the best value). * Basic implementations may raise the exception + * + * @param ob the object of the first ontology from which to retrieve the correspondence + * @return the corresponding object + * @throws AlignmentException when something goes wrong + * //@deprecated There is more than one cell about one object */ public Object getAlignedObject1( Object ob ) throws AlignmentException; public Object getAlignedObject2( Object ob ) throws AlignmentException; @@ -152,6 +197,10 @@ public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { * Reason: this applies only for 1:1 alignments * Some implementations might act cleverly (retrieving the best value). * Basic implementations may raise the exception + * + * @param ob the object of the first ontology from which to retrieve the correspondences + * @return the set of correspondences involving this object + * @throws AlignmentException when something goes wrong */ public Set<Cell> getAlignCells1( Object ob ) throws AlignmentException; public Set<Cell> getAlignCells2( Object ob ) throws AlignmentException; @@ -161,6 +210,8 @@ public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { * to the alignment structure itself. * getExtensions returns a set of tripes: uri*label*value * all three being String + * + * @return the collection of extensions of the alignment */ public Collection<String[]> getExtensions(); public String getExtension( String uri, String label ); @@ -175,7 +226,10 @@ public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { // HARD, // ... // } - /* + /** + * Trim an alignment under a particular threshold + * + * @param method: a string indicating the cutting method * - getting those cells with strength above n (hard) * - getting the n best cells (best) * - getting those cells with strength at worse n under the best (span) @@ -183,14 +237,17 @@ public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { * - getting those cells with strength at worse n% of the best (prop) * - getting all cells until a gap of n (hardgap) * - getting all cells until a gap of n% of the last (propgap) + * @param threshold: the threshold + * @throws AlignmentException when something goes wrong (unknown method) */ - public void cut( String method, double threshold ) throws AlignmentException; public void cut( double threshold ) throws AlignmentException; public void harden( double threshold ) throws AlignmentException; /** * Algebra of alignment manipulation operations: compose, join, meet. + * @return the inverse alignment from onto2 to onto1 + * @throws AlignmentException when something goes wrong (unlikely) */ public Alignment inverse() throws AlignmentException; public Alignment diff(Alignment align) throws AlignmentException; @@ -205,20 +262,27 @@ public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { * methods in Cell and Relation. */ /** + * Dumps an alignment into a SAX handler * Dump should be implemented as a method generating SAX events * for a SAXHandler provided as input + * + * @param h: a SAX content handler */ public void dump(ContentHandler h); // public void write( PrintStream writer ) throws IOException, AlignmentException; //public void write( PrintWriter writer ) throws IOException, AlignmentException; /** Exporting - The alignments are exported for other purposes. + * The alignments are exported for other purposes. + * + * @param renderer an AlignmentVisitor object which determines how the alignment is rendered + * @throws AlignmentException when something goes wrong (cannot render in this format) */ public void render( AlignmentVisitor renderer ) throws AlignmentException; /** Implementation of the clone method - */ + * @return a clone of the alignment + */ public Object clone(); } diff --git a/src/org/semanticweb/owl/align/AlignmentProcess.java b/src/org/semanticweb/owl/align/AlignmentProcess.java index 243fbbfd3b3c88a69bdeabf5a02282271a0d7a6a..6f5c92edfeaa56f996b6a1460f8af0d374e5c845 100644 --- a/src/org/semanticweb/owl/align/AlignmentProcess.java +++ b/src/org/semanticweb/owl/align/AlignmentProcess.java @@ -36,6 +36,10 @@ public interface AlignmentProcess extends Alignment * The align method computes the alignment from the ontologies. * It is hightly dependent on the implementation. * It take an initial Alignment as input. + * + * @param alignment: an alignment taken as input to the matching operation (may be null) + * @param param: the parameter of the matching operation + * @throws AlignmentException when something goes wrong */ public void align( Alignment alignment, Properties param ) throws AlignmentException; diff --git a/src/org/semanticweb/owl/align/AlignmentRepairer.java b/src/org/semanticweb/owl/align/AlignmentRepairer.java index 94e8299f88f08508562d6a805c4e3ff42ef5015c..97713886307179ca39586b967ed0f28a956e68de 100644 --- a/src/org/semanticweb/owl/align/AlignmentRepairer.java +++ b/src/org/semanticweb/owl/align/AlignmentRepairer.java @@ -41,6 +41,9 @@ public interface AlignmentRepairer { * * Known parameters (for both alignments and networks): * - reasoner (hermit|pellet|elk): which reasoner is used + * + * @param param: set of properties expressing the parameters for this repairer + * @throws AlignmentException when something goes wrong */ public void init( Properties param ) throws AlignmentException; @@ -59,11 +62,21 @@ public interface AlignmentRepairer { * - optimality (global|local|greedy|greedymin|globaliso): does the repairer look for particular optimum * - entities (concepts|properties|conceptproperties): types of correspondences taken into account * - + * + * @param alignment: the alignment to be repaired + * @param param: specific repairing parameters as properties + * @return the repaired alignment + * @throws AlignmentException when something goes wrong */ public Alignment repair( Alignment alignment, Properties param ) throws AlignmentException; /** * Perform repair on a whole network of ontologies. + * + * @param network: the network of ontologies to be repaired + * @param param: specific repairing parameters as properties + * @return the repaired network of ontologies + * @throws AlignmentException when something goes wrong */ public OntologyNetwork repair( OntologyNetwork network, Properties param ) throws AlignmentException; diff --git a/src/org/semanticweb/owl/align/Cell.java b/src/org/semanticweb/owl/align/Cell.java index 8b27e4180e0c75ac3e19d34b70dd72681fb88c94..9896229f5d522ed626a436f76d5a7bd4f3341c61 100644 --- a/src/org/semanticweb/owl/align/Cell.java +++ b/src/org/semanticweb/owl/align/Cell.java @@ -44,7 +44,9 @@ import org.xml.sax.SAXException; public interface Cell extends Comparable<Cell>, Visitable { /** Creation **/ - + /** + * @return the Id of the cell (null if there is no id) + */ public String getId(); public void setId( String id ); public String getSemantics(); @@ -52,11 +54,15 @@ public interface Cell extends Comparable<Cell>, Visitable { public Object getObject1(); public Object getObject2(); /** + * @return the URI of the object of the first ontology + * @throws AlignmentException if something goes wrong (has no URI) * //@deprecated use getObject1AsURI( null ) instead */ //@Deprecated public URI getObject1AsURI() throws AlignmentException; /** + * @return the URI of the object of the first ontology + * @throws AlignmentException if something goes wrong (has no URI) * //@deprecated use getObject2AsURI( null ) instead */ //@Deprecated @@ -77,6 +83,8 @@ public interface Cell extends Comparable<Cell>, Visitable { * to the Cell structure itself. * getExtensions returns a set of tripes: uri*label*value * all three being String + * + * @return the collection of extensions of the alignment */ public Collection<String[]> getExtensions(); //public Parameters getExtensions(); @@ -88,7 +96,11 @@ public interface Cell extends Comparable<Cell>, Visitable { // V5: This will have to be Set<Cell> compose... public Cell compose( Cell c ) throws AlignmentException; - /** Housekeeping **/ + /** + * Dumps an alignment into a SAX handler + * + * @param h: a SAX content handler + */ public void dump(ContentHandler h); // public void write( PrintStream writer ) throws IOException, AlignmentException; // public void write( PrintWriter writer ) throws IOException, AlignmentException; diff --git a/src/org/semanticweb/owl/align/Evaluator.java b/src/org/semanticweb/owl/align/Evaluator.java index 6490a622fc6ee44e97ad117305f5be98a2028fe7..5870399dddfa797a9d1b3c5c3297d69d4da4a988 100644 --- a/src/org/semanticweb/owl/align/Evaluator.java +++ b/src/org/semanticweb/owl/align/Evaluator.java @@ -21,6 +21,8 @@ package org.semanticweb.owl.align; import java.io.PrintWriter; +import java.io.IOException; + import java.util.Properties; /** @@ -39,6 +41,10 @@ public interface Evaluator { * Run the evaluation between the two ontologies. * Returns a double (between 0 and 1) providing an idea of the * proximity + * + * @param param: evaluation parameters + * @return the result of the evaluation as a single value + * @throws AlignmentException when something goes wrong */ public double eval( Properties param ) throws AlignmentException; @@ -47,6 +53,11 @@ public interface Evaluator { * Returns a double (between 0 and 1) providing an idea of the * proximity * The additional argument allows to cache the ontologies if necessary + * + * @param param: evaluation parameters + * @param cache: an ontology cache + * @return the result of the evaluation as a single value + * @throws AlignmentException when something goes wrong * //@deprecated The OntologyCache is now internal, use eval( params ) instead **/ //@Deprecated @@ -56,12 +67,17 @@ public interface Evaluator { /** * Outputs (in XML/RDF) a full report on the proximity of the two * ontologies. + * + * @param writer: the writer to use for outputing the evaluation + * @throws IOException when the output cannot be performed */ - public void write( PrintWriter writer ) throws java.io.IOException ; + public void write( PrintWriter writer ) throws IOException ; /** * Returns the results as a property list not further described but * suitable for display. + * + * @return the results as a set of properties */ public Properties getResults(); } diff --git a/src/org/semanticweb/owl/align/OntologyNetwork.java b/src/org/semanticweb/owl/align/OntologyNetwork.java index 3675bdc3cf3688b178472c621f6b6d3902148a68..963fa9fa4d898e5b3d5b20b9ad820b2330c7b8d3 100644 --- a/src/org/semanticweb/owl/align/OntologyNetwork.java +++ b/src/org/semanticweb/owl/align/OntologyNetwork.java @@ -49,6 +49,8 @@ public interface OntologyNetwork extends Cloneable { /** * close reflexively the network. * The network is modified. + * + * @throws AlignmentException if something goes wrong */ public void invert() throws AlignmentException; } diff --git a/src/org/semanticweb/owl/align/Relation.java b/src/org/semanticweb/owl/align/Relation.java index 7e9b2ea7a9533095fda2996f5733f65bf081519f..0b1e546581311979952b7693f08e40ac79c04a32 100644 --- a/src/org/semanticweb/owl/align/Relation.java +++ b/src/org/semanticweb/owl/align/Relation.java @@ -32,7 +32,7 @@ import org.xml.sax.ContentHandler; public interface Relation extends Visitable { - /** Creation **/ + public String getRelation(); // V5: this, especially compose should be allowed to throw errors @@ -43,7 +43,9 @@ public interface Relation extends Visitable { // It should be deprecated in version 5 of the API! public boolean equals( Relation r ); - /** Housekeeping **/ + /** Housekeeping + * @param h: a SAX content handler + **/ public void dump( ContentHandler h ); public void write( PrintWriter writer );