diff --git a/html/relnotes.html b/html/relnotes.html index 12624ffb996940f7093da5b1448975ae98bb9066..f05db85adc9677e4c0db60df25b0d5724165f745 100644 --- a/html/relnotes.html +++ b/html/relnotes.html @@ -70,6 +70,13 @@ with a warning: use <tt>java.lang.Properties</tt> instead; <tt>BasicParameters</tt> is not used anymore in the API (impl)</tt> <li><tt>BasicAlignment.getXNamespaces()</tt> returns <tt>Properties</tt> (impl)</li> +<li>Finally simplified visitor patterns (impl/edoal/renderer)</li> +<li>Integrated <tt>owl:propertyChain</tt> in OWL rendering (edoal)</li> +<li>Corrected bug with <tt>owl:inverseOf</tt> in OWL rendering (edoal)</li> +<!--li>Upgraded to <span style="color: green">Jena 2.7</span>, + <span style="color: green">Xerces 2.10</span>, + <span style="color: green">log4j 1.2.16</span>, + <span style="color: green">slf4j 1.6.4</span> (lib)</li--> <li>Simplified <tt>TestGen</tt> options (cli)</li> <li>All documentation is now on the web site and not in the (outdated) manuals (doc)</li> </ul></p> diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/Apply.java b/src/fr/inrialpes/exmo/align/impl/edoal/Apply.java index fe6d6258054607aed74f604bfb21ec7a9f72ab3a..b0d93538fffce57b5e41b69c1cc8d5fc446a6939 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/Apply.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/Apply.java @@ -27,6 +27,7 @@ import java.net.URISyntaxException; import org.semanticweb.owl.align.AlignmentException; import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; /** * <p> @@ -37,9 +38,8 @@ import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; * function/service. The {@code args} specifies the parameters needed for the * function to compute the transformaion. * </p> - * <p> - * $Id$ - * </p> + * + * @version $Id$ */ public class Apply implements ValueExpression { @@ -67,12 +67,11 @@ public class Apply implements ValueExpression { arguments = args; } - public void accept(EDOALVisitor visitor) throws AlignmentException { + public void accept( EDOALVisitor visitor ) throws AlignmentException { visitor.visit(this); } - - public void accept(TypeCheckingVisitor visitor) throws AlignmentException { - visitor.visit(this); + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); } public URI getOperation() { diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ClassConstruction.java b/src/fr/inrialpes/exmo/align/impl/edoal/ClassConstruction.java index 0f2e78b80f682403c901c4212c6e7806686f10a4..ce7fc42dfd13223ef4250db4b14abfea2aa74b17 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ClassConstruction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ClassConstruction.java @@ -29,24 +29,21 @@ import fr.inrialpes.exmo.align.parser.SyntaxElement.Constructor; import fr.inrialpes.exmo.align.parser.SyntaxElement; import org.semanticweb.owl.align.AlignmentException; -import org.semanticweb.owl.align.AlignmentVisitor; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; /** * <p> * Represents a ClassExpression. * </p> - * - * @author Francois Scharffe, Adrian Mocan - * + * <p> * Created on 23-Mar-2005 Committed by $Author: adrianmocan $ - * - * $Source: - * /cvsroot/mediation/mappingapi/src/fr.inrialpes.exmo.align.impl.edoal/ClassExpr.java,v $, - * @version $Revision: 1.5 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * </p> + * + * @version $Id$ */ -// JE2010: Should it be abstract with ClassConjunction?? - public class ClassConstruction extends ClassExpression { /** Holds all expressions. */ @@ -76,6 +73,13 @@ public class ClassConstruction extends ClassExpression { this.operator = op; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public Constructor getOperator() { return operator; } @@ -92,11 +96,6 @@ public class ClassConstruction extends ClassExpression { components.add( exp ); } - /* - public void accept(AlignmentVisitor visitor) throws AlignmentException { - visitor.visit(this); - } - */ /* public Object clone() { return super.clone(); diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ClassDomainRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/ClassDomainRestriction.java index 689c90827c25c0878289333cf32478c93cf9ff2a..ebd64f1ffc4c2df3c4207e4e65c56e8d647719f9 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ClassDomainRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ClassDomainRestriction.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.5 - 2006 - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -22,6 +22,11 @@ package fr.inrialpes.exmo.align.impl.edoal; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + public class ClassDomainRestriction extends ClassRestriction implements Cloneable { ClassExpression domain = null; @@ -55,6 +60,13 @@ public class ClassDomainRestriction extends ClassRestriction implements Cloneabl domain = cl; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public ClassExpression getDomain() { return domain; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ClassExpression.java b/src/fr/inrialpes/exmo/align/impl/edoal/ClassExpression.java index 3f9ae9f0eb3748bf1409f77a26bdd64b1f38fd96..3cb333a8c6cf09353abce09866ac641b805a3c4f 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ClassExpression.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ClassExpression.java @@ -31,14 +31,11 @@ import org.semanticweb.owl.align.AlignmentVisitor; * <p> * Represents a ClassExpression. * </p> - * - * @author Francois Scharffe, Adrian Mocan - * + * <p> * Created on 23-Mar-2005 Committed by $Author: adrianmocan $ - * - * $Source: - * /cvsroot/mediation/mappingapi/src/fr.inrialpes.exmo.align.impl.edoal/ClassExpr.java,v $, - * @version $Revision: 1.5 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * </p> + * + * @version $Id$ */ public abstract class ClassExpression extends Expression { @@ -47,12 +44,6 @@ public abstract class ClassExpression extends Expression { super(); } - /* - public void accept(AlignmentVisitor visitor) throws AlignmentException { - visitor.visit(this); - } - */ - /* public Object clone() { return super.clone(); }*/ diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ClassId.java b/src/fr/inrialpes/exmo/align/impl/edoal/ClassId.java index 0e2d36c81eb601310e0bd7a1ff6f00eabd650da3..fc65b0e98069d281e1dc1971f0b1cfe19b928a2d 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ClassId.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ClassId.java @@ -25,7 +25,9 @@ package fr.inrialpes.exmo.align.impl.edoal; import java.util.Collection; import org.semanticweb.owl.align.AlignmentException; -import org.semanticweb.owl.align.AlignmentVisitor; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; import java.net.URI; import java.net.URISyntaxException; @@ -33,8 +35,6 @@ import java.net.URISyntaxException; /** * A simple Id to represent a Class. * - * @author richi - * */ public class ClassId extends ClassExpression implements Id { @@ -72,6 +72,13 @@ public class ClassId extends ClassExpression implements Id { id = u.toString(); } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public URI getURI(){ return uri; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ClassOccurenceRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/ClassOccurenceRestriction.java index a5dabd9cea20145f67edce8f3f2bee85158cf9e2..f6ee477bea4d968713926026345048e41adc3a22 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ClassOccurenceRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ClassOccurenceRestriction.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.5 - 2006 -- then AttributeOccurenceCondition.java - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -22,22 +22,17 @@ package fr.inrialpes.exmo.align.impl.edoal; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Represents a attributeOccurenceRestriction tag for a ClassExpressions. * </p> - * <p> - * Created on 24-Mar-2005 Committed by $Author: poettler_ric $ - * </p> - * <p> - * $Id: ClassOccurenceRestriction.java,v 1.5 2006/11/15 16:01:17 poettler_ric - * Exp $ - * </p> * - * @author Francois Scharffe - * @author Adrian Mocan - * @author Richard Pöttler - * @version $Revision: 1.6 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public class ClassOccurenceRestriction extends ClassRestriction implements Cloneable { @@ -63,6 +58,13 @@ public class ClassOccurenceRestriction extends ClassRestriction implements Clone occurence = n; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept(TypeCheckingVisitor visitor) throws AlignmentException { + return visitor.visit(this); + } + public int getOccurence() { return occurence; } public void setOccurence( int n ) { occurence = n; } public Comparator getComparator() { return comparator; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ClassRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/ClassRestriction.java index a71413bde6aabd625a4e7007a815877173e1396e..b63eac313eac39a8ab38277fc12ee35dc214bccf 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ClassRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ClassRestriction.java @@ -38,14 +38,8 @@ import org.semanticweb.owl.align.AlignmentVisitor; * <p> * Created on 24-Mar-2005 Committed by $Author: poettler_ric $ * </p> - * <p> - * $Id$ - * </p> * - * @author Francois Scharffe - * @author Adrian Mocan - * @author Richard Pöttler - * @version $Revision: 1.6 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public abstract class ClassRestriction extends ClassExpression { @@ -57,12 +51,6 @@ public abstract class ClassRestriction extends ClassExpression { constrainedPath = att; } - /* - public void accept(AlignmentVisitor visitor) throws AlignmentException { - visitor.visit(this); - } - */ - public PathExpression getRestrictionPath() { return constrainedPath; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ClassTypeRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/ClassTypeRestriction.java index cfe1009ee5c4f17522e0dbd7c5a0ef995c493357..7843ab948b9a44bf6cd0a4e3af7e2c41ab63141d 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ClassTypeRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ClassTypeRestriction.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.5 - 2006 - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -22,21 +22,20 @@ package fr.inrialpes.exmo.align.impl.edoal; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Represents a type typeCondition tag for PropertyExpressions. * </p> * <p> - * $Id$ - * </p> - * <p> * Created on 24-Mar-2005 Committed by $Author: poettler_ric $ * </p> * - * @author Francois Scharffe - * @author Adrian Mocan - * @author Richard Pöttler - * @version $Revision: 1.5 $ $Date: 2010-03-07 21:55:23 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public class ClassTypeRestriction extends ClassRestriction implements Cloneable { @@ -73,6 +72,13 @@ public class ClassTypeRestriction extends ClassRestriction implements Cloneable type = t; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public Datatype getType() { return type; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ClassValueRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/ClassValueRestriction.java index 8210d13b3daa18cddc4fe6a559241606a0649be7..9074a2948a3675751b62c8c6b048d64cafa0081e 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ClassValueRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ClassValueRestriction.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.6 - 2006 - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -22,19 +22,20 @@ package fr.inrialpes.exmo.align.impl.edoal; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Represents a type valueCondition tag for PropertyExpressions. * </p> * <p> - * $Id$ - * </p> - * <p> * Created on 24-Mar-2005 Committed by $Author: poettler_ric $ * </p> * - * @author Richard Pöttler - * @version $Revision: 1.6 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public class ClassValueRestriction extends ClassRestriction implements Cloneable { @@ -59,6 +60,13 @@ public class ClassValueRestriction extends ClassRestriction implements Cloneable comparator = comp; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept(TypeCheckingVisitor visitor) throws AlignmentException { + return visitor.visit(this); + } + public Comparator getComparator() { return comparator; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/Comparator.java b/src/fr/inrialpes/exmo/align/impl/edoal/Comparator.java index 38651cb74b438e2cba24111c9950f95d54ad7d07..9ecf3b87af3aaee39a19c3990bc347fc024a5c1c 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/Comparator.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/Comparator.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/Datatype.java b/src/fr/inrialpes/exmo/align/impl/edoal/Datatype.java index e6a90c124f75ca4882501091e143a66f72da7265..0d1d372aa1f42c2ca10bb2ee99adcb4d091cbacd 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/Datatype.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/Datatype.java @@ -24,13 +24,13 @@ package fr.inrialpes.exmo.align.impl.edoal; import org.semanticweb.owl.align.AlignmentException; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Id to represent a datatype * </p> - * <p> - * $Id$ - * </p> */ public class Datatype { //implements Cloneable @@ -41,6 +41,9 @@ public class Datatype { //implements Cloneable public void accept( EDOALVisitor visitor) throws AlignmentException { visitor.visit( this ); } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } /** * Constructs an object with the given type. diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/EDOALAlignment.java b/src/fr/inrialpes/exmo/align/impl/edoal/EDOALAlignment.java index 45ae3c720581d96f8b89093d3e5b6fca45ec8982..a237a1f44d9bf65d0247388aa9664349580b3ada 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/EDOALAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/EDOALAlignment.java @@ -73,7 +73,7 @@ public class EDOALAlignment extends BasicAlignment { variables = new Hashtable<String,Variable>(); } - public void accept(TypeCheckingVisitor visitor) throws AlignmentException { + public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { visitor.visit(this); } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/Expression.java b/src/fr/inrialpes/exmo/align/impl/edoal/Expression.java index 495a9434717b21616efe261314d0d92b20f27704..11734698bb3f7b89498754f854b6a48f359bbe1b 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/Expression.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/Expression.java @@ -30,6 +30,7 @@ import java.util.Set; import org.semanticweb.owl.align.AlignmentException; import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; /** * <p> @@ -48,14 +49,11 @@ import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; * <code>toString</code> and <code>hashCode</code> methods must be * overwritten, too. * </p> - * - * @author Francois Scharffe, Adrian Mocan - * + * <p> * Created on 23-Mar-2005 Committed by $Author: adrianmocan $ + * </p> * - * $Source: - * /cvsroot/mediation/mappingapi/src/fr.inrialpes.exmo.align.impl.edoal/Expression.java,v $, - * @version $Revision: 1.7 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public abstract class Expression implements Cloneable { @@ -66,13 +64,9 @@ public abstract class Expression implements Cloneable { protected Expression() {} - public void accept(EDOALVisitor visitor) throws AlignmentException { - visitor.visit(this); - } + public abstract void accept( EDOALVisitor visitor ) throws AlignmentException; - public void accept(TypeCheckingVisitor visitor) throws AlignmentException { - visitor.visit(this); - } + public abstract TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException; public Variable getVariable() { return variable; } public void setVariable( Variable v ) { variable = v; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/InstanceExpression.java b/src/fr/inrialpes/exmo/align/impl/edoal/InstanceExpression.java index 1d910606606373f957683fc6d1418037acd2d85e..cbf48713102a5d929d5a1a07eab7dce075bba6d2 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/InstanceExpression.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/InstanceExpression.java @@ -22,23 +22,18 @@ package fr.inrialpes.exmo.align.impl.edoal; -import org.semanticweb.owl.align.AlignmentException; - /** * <p> * Represents a InstanceExpression. * </p> - * - * @author Francois Scharffe, Adrian Mocan - * + * <p> * Created on 23-Mar-2005 Committed by $Author: adrianmocan $ - * - * $Source: - * /cvsroot/mediation/mappingapi/src/fr.inrialpes.exmo.align.impl.edoal/InstanceExpr.java,v $, - * @version $Revision: 1.4 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * </p> + * + * @version $Id$ */ -public class InstanceExpression extends Expression implements ValueExpression { +public abstract class InstanceExpression extends Expression implements ValueExpression { /** * Creates a simple InstaneExpression with the given Id. @@ -47,9 +42,6 @@ public class InstanceExpression extends Expression implements ValueExpression { super(); } - public void accept(EDOALVisitor visitor) throws AlignmentException { - visitor.visit(this); - } /* public Object clone() { return super.clone(); diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/InstanceId.java b/src/fr/inrialpes/exmo/align/impl/edoal/InstanceId.java index d57c226990795fb48dbdd7233bbf51085f7bfa8d..57771bab0a1ff19282299e04d8c39dc041beef92 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/InstanceId.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/InstanceId.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.4 - 2006 -- then InstanceExpr - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -25,11 +25,14 @@ package fr.inrialpes.exmo.align.impl.edoal; import java.net.URI; import java.net.URISyntaxException; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * A simple Id to represent a Instance. * - * @author richi - * */ public class InstanceId extends InstanceExpression implements Id { @@ -64,6 +67,13 @@ public class InstanceId extends InstanceExpression implements Id { this.uri = u; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + /** * Returns the Id. * diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PathExpression.java b/src/fr/inrialpes/exmo/align/impl/edoal/PathExpression.java index 92eb60304d5c99ff399ab911a8ceb33e7dd3f458..7dbe6701ec9a0a155831bd79a99bcadaef03f5e4 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PathExpression.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PathExpression.java @@ -24,22 +24,15 @@ package fr.inrialpes.exmo.align.impl.edoal; import java.util.Collection; -import org.semanticweb.owl.align.AlignmentException; - -import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; - /** * <p> - * Represents a RelationExpression. + * Represents a RelationExpression or a PropertyExpression. * </p> - * - * @author Francois Scharffe, Adrian Mocan - * + * <p> * Created on 23-Mar-2005 Committed by $Author: adrianmocan $ + * </p> * - * $Source: - * /cvsroot/mediation/mappingapi/src/fr.inrialpes.exmo.align.impl.edoal/RelationExpr.java,v $, - * @version $Revision: 1.5 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public abstract class PathExpression extends Expression implements Cloneable, ValueExpression { @@ -48,13 +41,6 @@ public abstract class PathExpression extends Expression implements Cloneable, Va super(); } - public void accept( EDOALVisitor visitor ) throws AlignmentException { - visitor.visit( this ); - } - public void accept(TypeCheckingVisitor visitor) throws AlignmentException { - visitor.visit(this); - } - /* public Object clone() { return super.clone(); diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyConstruction.java b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyConstruction.java index 22811217f3e3261f0d8775fe12430044fe735120..f3bf15c6817522dcdc2c8edcd2cad67a606baf71 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyConstruction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyConstruction.java @@ -31,22 +31,19 @@ import fr.inrialpes.exmo.align.parser.SyntaxElement; import org.semanticweb.owl.align.AlignmentException; import org.semanticweb.owl.align.AlignmentVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Represents a PropertyConstruction. * </p> * - * @author Francois Scharffe, Adrian Mocan - * * Created on 23-Mar-2005 Committed by $Author: adrianmocan $ * - * $Source: - * /cvsroot/mediation/mappingapi/src/fr.inrialpes.exmo.align.impl.edoal/PropertyExpr.java,v $, - * @version $Revision: 1.5 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ -// JE2010: Should it be abstract with RelationConjunction?? - public class PropertyConstruction extends PropertyExpression { /** Holds all expressions. */ @@ -79,6 +76,13 @@ public class PropertyConstruction extends PropertyExpression { this.operator = op; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept(TypeCheckingVisitor visitor) throws AlignmentException { + return visitor.visit(this); + } + public Constructor getOperator() { return operator; } @@ -95,11 +99,6 @@ public class PropertyConstruction extends PropertyExpression { components.add( exp ); } - /* - public void accept(AlignmentVisitor visitor) throws AlignmentException { - visitor.visit(this); - } - */ /* public Object clone() { return super.clone(); diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyDomainRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyDomainRestriction.java index df320e7e04e9439d5cbfcd8dd57e682042eeb041..101b6632af9e5a7814b7d0c509a3f47e4a69fcc8 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyDomainRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyDomainRestriction.java @@ -22,16 +22,17 @@ package fr.inrialpes.exmo.align.impl.edoal; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Represents a domainRestriction tag for PropertyExpressions. * </p> - * <p> - * $Id$ - * </p> * - * @author Richard Pöttler - * @version $Revision: 1.4 $ + * @version $Id$ * */ public class PropertyDomainRestriction extends PropertyRestriction { @@ -60,6 +61,13 @@ public class PropertyDomainRestriction extends PropertyRestriction { domain = dom; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public ClassExpression getDomain() { return domain; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyExpression.java b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyExpression.java index 3c5dbc2ed25331e083b77fcf88fc1b58ce04d069..b419a5ae3f42c752af505f644cc1cdbce7ca3731 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyExpression.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyExpression.java @@ -25,19 +25,12 @@ package fr.inrialpes.exmo.align.impl.edoal; import java.util.Collection; import java.util.Set; -import org.semanticweb.owl.align.AlignmentException; - /** * <p> * Represents a PropertyExpression. * </p> - * <p> - * $Id$ - * </p> * - * @author Francois Scharffe, Adrian Mocan - * @author richi - * @version $Revision: 1.7 $ + * @version $Id$ */ public abstract class PropertyExpression extends PathExpression implements Cloneable { @@ -48,9 +41,4 @@ public abstract class PropertyExpression extends PathExpression implements Clone public PropertyExpression() { super(); } - - public void accept(EDOALVisitor visitor) throws AlignmentException { - visitor.visit(this); - } - } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyId.java b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyId.java index f828a1db8face7567ca68b4ee5fd81c851f76880..88db6868fa4fb63531c745230e3b43b88884a9e8 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyId.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyId.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.7 - 2006 -- then AttributeExpr.java - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -25,16 +25,17 @@ package fr.inrialpes.exmo.align.impl.edoal; import java.net.URI; import java.net.URISyntaxException; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * A simple Id to represent a Property. * </p> - * <p> - * $Id$ - * </p> * - * @author richi - * @version $Revision: 1.7 $ + * @version $Id$ */ public class PropertyId extends PropertyExpression implements Id { /** Holds the identifier. */ @@ -55,6 +56,13 @@ public class PropertyId extends PropertyExpression implements Id { id = u.toString(); } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept(TypeCheckingVisitor visitor) throws AlignmentException { + return visitor.visit(this); + } + public URI getURI(){ return uri; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyRestriction.java index a7993365efeb412e73f2462becf9bd390aa685ef..8a529c29d6b09bd74700a31ab29690d43550e851 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyRestriction.java @@ -22,8 +22,6 @@ package fr.inrialpes.exmo.align.impl.edoal; -import org.semanticweb.owl.align.AlignmentException; - /** * <p> * Superclass for all AttributeConditions. @@ -37,14 +35,8 @@ import org.semanticweb.owl.align.AlignmentException; * <p> * Created on 24-Mar-2005 Committed by $Author: poettler_ric $ * </p> - * <p> - * $Id$ - * </p> * - * @author Richard Pöttler - * @author Adrian Mocan - * @author Francois Scharffe - * @version $Revision: 1.6 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public abstract class PropertyRestriction extends PropertyExpression implements Cloneable { @@ -53,10 +45,6 @@ public abstract class PropertyRestriction extends PropertyExpression implements super(); } - public void accept(EDOALVisitor visitor) throws AlignmentException { - visitor.visit(this); - } - /* public Object clone() { try { diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyTypeRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyTypeRestriction.java index ac1b137af535bbda3d6db1baa87879c2edd454b5..9d85ae0b13a761ea2596d70f830a537bb1713877 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyTypeRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyTypeRestriction.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.6 - 2006 -- then AttributeTypeCondition.java - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -22,6 +22,11 @@ package fr.inrialpes.exmo.align.impl.edoal; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Represents a attributeTypeRestriction tag for a ClassExpressions. @@ -29,14 +34,8 @@ package fr.inrialpes.exmo.align.impl.edoal; * <p> * Created on 24-Mar-2005 Committed by $Author: poettler_ric $ * </p> - * <p> - * $Id$ - * </p> * - * @author Francois Scharffe - * @author Adrian Mocan - * @author Richard Pöttler - * @version $Revision: 1.6 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public class PropertyTypeRestriction extends PropertyRestriction implements Cloneable { @@ -65,6 +64,13 @@ public class PropertyTypeRestriction extends PropertyRestriction implements Clon type = t; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public Datatype getType() { return type; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyValueRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyValueRestriction.java index e20590fe1ca3a41467d4bde2a0de4a4c979eb1ca..80ac70716d0f9f643edb62561b9288cce3ea9aa4 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyValueRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyValueRestriction.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -20,6 +20,11 @@ package fr.inrialpes.exmo.align.impl.edoal; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Represents a attributeValueRestriction tag for a ClassExpressions. @@ -27,14 +32,8 @@ package fr.inrialpes.exmo.align.impl.edoal; * <p> * Created on 24-Mar-2005 Committed by $Author: poettler_ric $ * </p> - * <p> - * $Id$ - * </p> * - * @author Francois Scharffe - * @author Adrian Mocan - * @author Richard Pöttler - * @version $Revision: 1.6 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public class PropertyValueRestriction extends PropertyRestriction implements Cloneable { @@ -67,6 +66,13 @@ public class PropertyValueRestriction extends PropertyRestriction implements Clo value = v; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public Comparator getComparator(){ return comparator; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/RelationCoDomainRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/RelationCoDomainRestriction.java index 649e3c3c66efedea94ea3c34e3b1240b04e0f976..fcc95145df20bb3750bbd172f0e3f8ba42c2fec2 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/RelationCoDomainRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/RelationCoDomainRestriction.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.4 - 2006 - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -22,17 +22,17 @@ package fr.inrialpes.exmo.align.impl.edoal; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Represents a coDomainRestriction tag for RelationExpressions. * </p> - * <p> - * $Id: RelationCoDomainRestriction.java,v 1.3 2006/11/15 16:01:17 poettler_ric - * Exp $ - * </p> * - * @author Richard Pöttler - * @version $Revision: 1.4 $ + * @version $Id$ * */ public class RelationCoDomainRestriction extends RelationRestriction { @@ -62,6 +62,13 @@ public class RelationCoDomainRestriction extends RelationRestriction { codomain = cod; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public ClassExpression getCoDomain() { return codomain; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/RelationConstruction.java b/src/fr/inrialpes/exmo/align/impl/edoal/RelationConstruction.java index 8399e245eef0f84e37788e4ba397350f083c854c..679db57fbc48430307287110a339a0505718f484 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/RelationConstruction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/RelationConstruction.java @@ -29,20 +29,18 @@ import fr.inrialpes.exmo.align.parser.SyntaxElement.Constructor; import fr.inrialpes.exmo.align.parser.SyntaxElement; import org.semanticweb.owl.align.AlignmentException; -import org.semanticweb.owl.align.AlignmentVisitor; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; /** * <p> * Represents a RelationExpression. * </p> * - * @author Francois Scharffe, Adrian Mocan - * * Created on 23-Mar-2005 Committed by $Author: adrianmocan $ * - * $Source: - * /cvsroot/mediation/mappingapi/src/fr.inrialpes.exmo.align.impl.edoal/RelationExpr.java,v $, - * @version $Revision: 1.5 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public class RelationConstruction extends RelationExpression { @@ -81,6 +79,13 @@ public class RelationConstruction extends RelationExpression { this.operator = op; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public Constructor getOperator() { return operator; } @@ -97,11 +102,6 @@ public class RelationConstruction extends RelationExpression { components.add( exp ); } - /* - public void accept(AlignmentVisitor visitor) throws AlignmentException { - visitor.visit(this); - } - */ /* public Object clone() { return super.clone(); diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/RelationDomainRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/RelationDomainRestriction.java index b56201116d9693b1f6b57ca9631ff0224c1c0bff..5a8564e2f26aa0ac310f179b5c8236f58eb9e16d 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/RelationDomainRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/RelationDomainRestriction.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.4 - 2006 - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -22,16 +22,17 @@ package fr.inrialpes.exmo.align.impl.edoal; +import org.semanticweb.owl.align.AlignmentException; + +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * <p> * Represents a domainRestriction tag for RelationExpressions. * </p> - * <p> - * $Id$ - * </p> * - * @author Richard Pöttler - * @version $Revision: 1.4 $ + * @version $Id$ * */ public class RelationDomainRestriction extends RelationRestriction { @@ -60,6 +61,13 @@ public class RelationDomainRestriction extends RelationRestriction { domain = dom; } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public ClassExpression getDomain() { return domain; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/RelationExpression.java b/src/fr/inrialpes/exmo/align/impl/edoal/RelationExpression.java index abc947ea7252086b7e15f8b35eda87e17c0bf0f3..a5fca191f703a19be66178a0c571929d9ab222d4 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/RelationExpression.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/RelationExpression.java @@ -22,22 +22,14 @@ package fr.inrialpes.exmo.align.impl.edoal; -import java.util.Collection; - -import org.semanticweb.owl.align.AlignmentException; - - /** * <p> * Represents a RelationExpression. * </p> - * - * @author Francois Scharffe, Adrian Mocan - * + * <p> * Created on 23-Mar-2005 Committed by $Author: adrianmocan $ - * - * $Source: - * /cvsroot/mediation/mappingapi/src/fr.inrialpes.exmo.align.impl.edoal/RelationExpr.java,v $, + * </p> + * * @version $Revision: 1.5 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ */ @@ -47,9 +39,6 @@ public abstract class RelationExpression extends PathExpression implements Clone super(); } - public void accept(EDOALVisitor visitor) throws AlignmentException { - visitor.visit(this); - } /* public Object clone() { return super.clone(); diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/RelationId.java b/src/fr/inrialpes/exmo/align/impl/edoal/RelationId.java index 33a989e7cf0558e8484f776a2eaab0a3f0241a8d..5e73337044f2263d4011a8ccf1f54bc568502600 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/RelationId.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/RelationId.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.5 - 2006 -- then RelationExpr - * Copyright (C) INRIA, 2009-2010 + * Copyright (C) INRIA, 2009-2010, 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -27,11 +27,12 @@ import java.net.URISyntaxException; import org.semanticweb.owl.align.AlignmentException; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * A simple Id to represent a Relation. * - * @author richi - * */ public class RelationId extends RelationExpression implements Id { /** Holds the identifier. */ @@ -68,6 +69,13 @@ public class RelationId extends RelationExpression implements Id { id = u.toString(); } + public void accept( EDOALVisitor visitor ) throws AlignmentException { + visitor.visit( this ); + } + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); + } + public URI getURI(){ return uri; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/RelationRestriction.java b/src/fr/inrialpes/exmo/align/impl/edoal/RelationRestriction.java index 9b1557bb668a358fb88189fcc2d2bd592b5387a2..3e680ac4af348f26086416d7e55fe29c3e295e6e 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/RelationRestriction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/RelationRestriction.java @@ -22,8 +22,6 @@ package fr.inrialpes.exmo.align.impl.edoal; -import org.semanticweb.owl.align.AlignmentException; - /** * <p> * Superclass for all RelationConditions. @@ -37,21 +35,11 @@ import org.semanticweb.owl.align.AlignmentException; * <p> * Created on 23-Mar-2005 Committed by $Author: poettler_ric $ * </p> - * <p> - * $Id$ - * </p> - * * - * @author Richard Pöttler - * @author Francois Scharffe - * @version $Revision: 1.5 $ $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ public abstract class RelationRestriction extends RelationExpression { protected RelationRestriction() {} - public void accept(EDOALVisitor visitor) throws AlignmentException { - visitor.visit(this); - } - } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/TransfService.java b/src/fr/inrialpes/exmo/align/impl/edoal/TransfService.java index 239c280d28fdb5bdd5382b8413bf6dcf26cfea4f..14b5b453b83c7959ae1a7bf33d8d85e09b43e554 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/TransfService.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/TransfService.java @@ -28,8 +28,6 @@ import java.util.HashSet; import java.util.Set; import java.net.URI; -import org.semanticweb.owl.align.AlignmentException; - /** * <p> * Represents a tranformation service to transform the values of attributes. @@ -45,14 +43,10 @@ import org.semanticweb.owl.align.AlignmentException; * function at the given address. The {@code pov} specifies the parameters * needed for the function to compute the transformaion. * </p> - * <p> - * $Id$ - * </p> * - * @author richi - * @version $Revision: 1.2 $ - * date $Date: 2010-03-07 20:40:05 +0100 (Sun, 07 Mar 2010) $ + * @version $Id$ */ + public class TransfService implements Cloneable { /** resource (uri) to the service */ private URI res; @@ -78,11 +72,6 @@ public class TransfService implements Cloneable { public TransfService(final URI res, final Collection<Id> params) { this(res, null, params); } - /* - public void accept( EDOALVisitor visitor ) throws AlignmentException { - visitor.visit(this); - } - */ /** * <p> diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/Transformation.java b/src/fr/inrialpes/exmo/align/impl/edoal/Transformation.java index 2b3348a13142410fcc98cb313a9f4d1ce4d73bfa..83c72c30fc774633d5a12cc30b71898bac1ce5df 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/Transformation.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/Transformation.java @@ -24,12 +24,12 @@ package fr.inrialpes.exmo.align.impl.edoal; import org.semanticweb.owl.align.AlignmentException; import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; /** * This implements a transformation of an entity into another. * The transformation is specified usually through function and can go one way or bith ways * - * @author Jérôme Euzenat * @version $Id$ */ @@ -43,9 +43,8 @@ public class Transformation { public void accept( EDOALVisitor visitor) throws AlignmentException { visitor.visit( this ); } - - public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { - visitor.visit(this); + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); } /** Creation **/ diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/Value.java b/src/fr/inrialpes/exmo/align/impl/edoal/Value.java index 7147a8449b6bca2194235662edd9aeb734799eab..4e05b35f616f4e49b547e35f6d05043b64da4499 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/Value.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/Value.java @@ -27,17 +27,14 @@ import java.net.URI; import org.semanticweb.owl.align.AlignmentException; import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; /** * <p> * Id to represent a simple valuestring. * </p> - * <p> - * $Id$ - * </p> * - * @author richi - * @version $Revision: 1.2 $ + * @version $Id$ */ public class Value implements ValueExpression { //implements Cloneable, Visitable { @@ -75,12 +72,11 @@ public class Value implements ValueExpression { //implements Cloneable, Visitabl this.type = type; } - public void accept(EDOALVisitor visitor) throws AlignmentException { + public void accept( EDOALVisitor visitor ) throws AlignmentException { visitor.visit(this); } - - public void accept(TypeCheckingVisitor visitor) throws AlignmentException { - visitor.visit(this); + public TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException { + return visitor.visit(this); } public String getValue() { diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/ValueExpression.java b/src/fr/inrialpes/exmo/align/impl/edoal/ValueExpression.java index 12b3a93eae2743f095b0177dabc68243cbdf1f9b..d242fed8292f4a8c19a32e600b31a67a18b3ef9d 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/ValueExpression.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/ValueExpression.java @@ -22,6 +22,9 @@ package fr.inrialpes.exmo.align.impl.edoal; import org.semanticweb.owl.align.AlignmentException; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor.TYPE; + /** * Interface implemented by expressions which can be used as values: * Value, Path, Instance @@ -30,5 +33,7 @@ import org.semanticweb.owl.align.AlignmentException; public interface ValueExpression { public void accept( EDOALVisitor v ) throws AlignmentException; + + public abstract TYPE accept( TypeCheckingVisitor visitor ) throws AlignmentException; } diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/Variable.java b/src/fr/inrialpes/exmo/align/impl/edoal/Variable.java index 4b5bce1015ffbf5ef176128990b6a49849512a6e..7d53128c53d4ae461b6cfba80476fa6bd96997d6 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/Variable.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/Variable.java @@ -26,8 +26,6 @@ import java.util.HashSet; /** * A simple Id to represent a Instance. * - * @author richi - * */ public class Variable { @@ -61,7 +59,6 @@ public class Variable { return toString(); } - /** * <p> * Returns a simple description of this object. <b>The format of the diff --git a/src/fr/inrialpes/exmo/align/impl/rel/EquivRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/EquivRelation.java index 1c9cf6dd4f6def1166df3417024c5a2879307e52..2cb4fbdadf82c282e56329e765d0a02a7b46706b 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/EquivRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/EquivRelation.java @@ -26,10 +26,11 @@ import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; + /** * Represents an OWL equivalence relation. * - * @author Jérôme Euzenat * @version $Id$ */ @@ -38,6 +39,9 @@ public class EquivRelation extends BasicRelation { public void accept( AlignmentVisitor visitor ) throws AlignmentException { visitor.visit( this ); } + public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { + visitor.visit(this); + } static final String prettyLabel = "="; diff --git a/src/fr/inrialpes/exmo/align/impl/rel/HasInstanceRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/HasInstanceRelation.java index 2b909790eed68e02b921a52875513a3dcabb04fa..5423e42a5a34533a07763d0cfbcae7d83e5f710c 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/HasInstanceRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/HasInstanceRelation.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2004, 2008, 2011 + * Copyright (C) INRIA, 2004, 2008, 2011-2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -26,11 +26,12 @@ import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; + /** * Represents an OWL equivalence relation. * - * @author Jérôme Euzenat - * @version $Id$ +xs * @version $Id$ */ public class HasInstanceRelation extends BasicRelation @@ -38,6 +39,9 @@ public class HasInstanceRelation extends BasicRelation public void accept( AlignmentVisitor visitor) throws AlignmentException { visitor.visit( this ); } + public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { + visitor.visit(this); + } static final String prettyLabel = "HasInstance"; diff --git a/src/fr/inrialpes/exmo/align/impl/rel/IncompatRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/IncompatRelation.java index a017d066654308e73920f098dabca43f819e0148..3469a05b76ead8e9e11ef2e39b981c1f80e1b210 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/IncompatRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/IncompatRelation.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2004, 2008, 2011 + * Copyright (C) INRIA, 2004, 2008, 2011-2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -26,10 +26,11 @@ import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; + /** * Represents an OWL equivalence relation. * - * @author Jérôme Euzenat * @version $Id$ */ @@ -38,6 +39,9 @@ public class IncompatRelation extends BasicRelation public void accept( AlignmentVisitor visitor) throws AlignmentException { visitor.visit( this ); } + public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { + visitor.visit(this); + } static final String prettyLabel = "%"; diff --git a/src/fr/inrialpes/exmo/align/impl/rel/InstanceOfRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/InstanceOfRelation.java index 6a4256b31b8e45a75f6b9145d44ccb8be5b44b05..2d236ce272187b6dad8a9bf5f5b61d9e026a4d59 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/InstanceOfRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/InstanceOfRelation.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2011 + * Copyright (C) INRIA, 2011-2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -26,10 +26,11 @@ import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; + /** * Represents a relation between an instance and its class. * - * @author Jérôme Euzenat * @version $Id$ */ @@ -38,6 +39,9 @@ public class InstanceOfRelation extends BasicRelation public void accept( AlignmentVisitor visitor) throws AlignmentException { visitor.visit( this ); } + public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { + visitor.visit(this); + } static final String prettyLabel = "InstanceOf"; diff --git a/src/fr/inrialpes/exmo/align/impl/rel/NonTransitiveImplicationRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/NonTransitiveImplicationRelation.java index 8fd813886ffa8e1c1d44efdc5f7d7ea16605bad0..72bda390f10dcfb7601190c7d939b66a7a2b7296 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/NonTransitiveImplicationRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/NonTransitiveImplicationRelation.java @@ -1,7 +1,7 @@ /* * $Id$ ¨* - * Copyright (C) INRIA, 2004-2005, 2008, 2011 + * Copyright (C) INRIA, 2004-2005, 2008, 2011-2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -25,11 +25,12 @@ import org.semanticweb.owl.align.AlignmentVisitor; import fr.inrialpes.exmo.align.impl.BasicRelation; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; + /** * Represents a non transitive implication relation. * as it can be found in C-OWL and other works * - * @author Jérôme Euzenat * @version $Id$ */ @@ -38,6 +39,9 @@ public class NonTransitiveImplicationRelation extends BasicRelation public void accept( AlignmentVisitor visitor) throws AlignmentException { visitor.visit( this ); } + public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { + visitor.visit(this); + } static final String prettyLabel = "~>"; diff --git a/src/fr/inrialpes/exmo/align/impl/rel/SubsumeRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/SubsumeRelation.java index bd89729d17402b21c475c32ae4a42e33afd0db62..d4d682364ffbdbd2eecabbcd5e907bed1434d074 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/SubsumeRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/SubsumeRelation.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2004, 2008, 2011 + * Copyright (C) INRIA, 2004, 2008, 2011-2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -26,11 +26,11 @@ import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; /** * Represents an OWL subsumption relation. * - * @author Jérôme Euzenat * @version $Id$ */ @@ -39,6 +39,9 @@ public class SubsumeRelation extends BasicRelation public void accept( AlignmentVisitor visitor) throws AlignmentException { visitor.visit( this ); } + public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { + visitor.visit(this); + } static final String prettyLabel = ">"; diff --git a/src/fr/inrialpes/exmo/align/impl/rel/SubsumedRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/SubsumedRelation.java index 5217fca192cc989cdde4213cc14bc2ff2d7cfd3f..7a69e10c7f61781ba63124eb2326291836fc05d8 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/SubsumedRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/SubsumedRelation.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2004-2005, 2008, 2011 + * Copyright (C) INRIA, 2004-2005, 2008, 2011-2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -26,12 +26,13 @@ import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; +import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; + import java.io.PrintWriter; /** * Represents an OWL subsumption relation. * - * @author Jérôme Euzenat * @version $Id$ */ @@ -40,6 +41,9 @@ public class SubsumedRelation extends BasicRelation public void accept( AlignmentVisitor visitor) throws AlignmentException { visitor.visit( this ); } + public void accept( TypeCheckingVisitor visitor ) throws AlignmentException { + visitor.visit(this); + } static final String prettyLabel = "<"; diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java index 20e52455a9f75e07ff2afa378f3ccd64554d5209..39cc697c0ff2953ea75606a2337b580d5fcbaa73 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java @@ -159,7 +159,7 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements // default behaviour if ( cell.getId() != null ) writer.print(NL+NL+"<!-- "+cell.getId()+" -->"+NL); if ( cell instanceof EDOALCell ) { - visit( (EDOALCell)cell ); + ((EDOALCell)cell).accept( this ); // useless cast? } else { this.cell = cell; Object ob1 = cell.getObject1(); @@ -238,6 +238,31 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements } } + public void printRel( Object ob, LoadedOntology onto, Relation rel ) throws AlignmentException { + if ( !edoal ) { + String owlrel = getRelationName( onto, rel, ob ); + if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); + try { + writer.print(" <"+owlrel+" rdf:resource=\""+onto.getEntityURI( ob )+"\"/>"+NL); + } catch ( OntowrapException owex ) { + throw new AlignmentException( "Error accessing ontology", owex ); + } + } else { + String owlrel = getRelationName( rel, ob ); + if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); + if ( ob instanceof InstanceId ) { + indentedOutput("<"+owlrel+" rdf:resource=\""+((InstanceId)ob).getURI()+"\"/>"); + } else { + indentedOutput("<"+owlrel+">"); + writer.print(NL); + increaseIndent(); + ((Expression)ob).accept( this ); // ?? no cast + decreaseIndent(); + writer.print(NL); + indentedOutput("</"+owlrel+">"); + } + } + } /** * For EDOAL relation name depends on type of expressions @@ -335,167 +360,41 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements */ public void visit( EquivRelation rel ) throws AlignmentException { - Object ob2 = cell.getObject2(); - if ( !edoal ) { - String owlrel = getRelationName( onto2, rel, ob2 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - try { - writer.print(" <"+owlrel+" rdf:resource=\""+onto2.getEntityURI( ob2 )+"\"/>"+NL); - } catch ( OntowrapException owex ) { - throw new AlignmentException( "Error accessing ontology", owex ); - } - } else { - String owlrel = getRelationName( rel, ob2 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - if ( ob2 instanceof InstanceId ) { - indentedOutput("<"+owlrel+" rdf:resource=\""+((InstanceId)ob2).getURI()+"\"/>"); - } else { - indentedOutput("<"+owlrel+">"); - writer.print(NL); - increaseIndent(); - ((Expression)ob2).accept( this ); - decreaseIndent(); - writer.print(NL); - indentedOutput("</"+owlrel+">"); - } - } + printRel( cell.getObject2(), onto2, rel ); } public void visit( SubsumeRelation rel ) throws AlignmentException { - Object ob1 = cell.getObject1(); - if ( !edoal ) { - String owlrel = getRelationName( onto1, rel, ob1 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - try { - writer.print(" <"+owlrel+" rdf:resource=\""+onto1.getEntityURI( ob1 )+"\"/>"+NL); - } catch ( OntowrapException owex ) { - throw new AlignmentException( "Error accessing ontology", owex ); - } - } else { - String owlrel = getRelationName( rel, ob1 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - indentedOutput("<"+owlrel+">"); - writer.print(NL); - increaseIndent(); - ((Expression)ob1).accept( this ); - decreaseIndent(); - writer.print(NL); - indentedOutput("</"+owlrel+">"); - } + printRel( cell.getObject1(), onto1, rel ); } public void visit( SubsumedRelation rel ) throws AlignmentException { - Object ob2 = cell.getObject2(); - if ( !edoal ) { - String owlrel = getRelationName( onto2, rel, ob2 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - try { - writer.print(" <"+owlrel+" rdf:resource=\""+onto2.getEntityURI( ob2 )+"\"/>"+NL); - } catch ( OntowrapException owex ) { - throw new AlignmentException( "Error accessing ontology", owex ); - } - } else { - String owlrel = getRelationName( rel, ob2 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - indentedOutput("<"+owlrel+">"); - writer.print(NL); - increaseIndent(); - ((Expression)ob2).accept( this ); - decreaseIndent(); - writer.print(NL); - indentedOutput("</"+owlrel+">"); - } + printRel( cell.getObject2(), onto2, rel ); } public void visit( IncompatRelation rel ) throws AlignmentException { - Object ob2 = cell.getObject2(); - if ( !edoal ) { - String owlrel = getRelationName( onto2, rel, ob2 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - try { - writer.print(" <"+owlrel+" rdf:resource=\""+onto2.getEntityURI( ob2 )+"\"/>"+NL); - } catch ( OntowrapException owex ) { - throw new AlignmentException( "Cannot find entity URI", owex ); - } - } else { - String owlrel = getRelationName( rel, ob2 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - indentedOutput("<"+owlrel+">"); - writer.print(NL); - increaseIndent(); - ((Expression)ob2).accept( this ); - writer.print(NL); - decreaseIndent(); - indentedOutput("</"+owlrel+">"); - } + printRel( cell.getObject2(), onto2, rel ); } public void visit( InstanceOfRelation rel ) throws AlignmentException { - Object ob2 = cell.getObject2(); - if ( !edoal ) { - String owlrel = getRelationName( onto2, rel, ob2 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - try { - writer.print(" <"+owlrel+" rdf:resource=\""+onto2.getEntityURI( ob2 )+"\"/>"+NL); - } catch ( OntowrapException owex ) { - throw new AlignmentException( "Cannot find entity URI", owex ); - } - } else { - String owlrel = getRelationName( rel, ob2 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - indentedOutput("<"+owlrel+">"); - writer.print(NL); - increaseIndent(); - ((Expression)ob2).accept( this ); - writer.print(NL); - decreaseIndent(); - indentedOutput("</"+owlrel+">"); - } + printRel( cell.getObject2(), onto2, rel ); } public void visit( HasInstanceRelation rel ) throws AlignmentException { - Object ob1 = cell.getObject1(); - if ( !edoal ) { - String owlrel = getRelationName( onto1, rel, ob1 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - try { - writer.print(" <"+owlrel+" rdf:resource=\""+onto1.getEntityURI( ob1 )+"\"/>"+NL); - } catch ( OntowrapException owex ) { - throw new AlignmentException( "Error accessing ontology", owex ); - } - } else { - String owlrel = getRelationName( rel, ob1 ); - if ( owlrel == null ) throw new AlignmentException( "Cannot express relation "+rel ); - indentedOutput("<"+owlrel+">"); - writer.print(NL); - increaseIndent(); - ((Expression)ob1).accept( this ); - writer.print(NL); - decreaseIndent(); - indentedOutput("</"+owlrel+">"); - } + printRel( cell.getObject1(), onto1, rel ); } // ******* EDOAL public void visit( Expression o ) throws AlignmentException { - if ( o instanceof ClassExpression ) visit( (ClassExpression)o ); - else if ( o instanceof PathExpression ) visit( (PathExpression)o ); - else if ( o instanceof InstanceExpression ) visit( (InstanceExpression)o ); - else throw new AlignmentException( "Cannot dispatch generic Expression "+o ); + throw new AlignmentException( "Cannot dispatch generic Expression "+o ); } public void visit( final PathExpression p ) throws AlignmentException { - if ( p instanceof RelationExpression ) visit( (RelationExpression)p ); - else if ( p instanceof PropertyExpression ) visit( (PropertyExpression)p ); - else throw new AlignmentException( "Cannot dispatch generic PathExpression "+p ); + throw new AlignmentException( "Cannot dispatch generic PathExpression "+p ); } public void visit( final ClassExpression e ) throws AlignmentException { - if ( e instanceof ClassId ) visit( (ClassId)e ); - else if ( e instanceof ClassConstruction ) visit( (ClassConstruction)e ); - else if ( e instanceof ClassRestriction ) visit( (ClassRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } public void visit( final ClassId e ) throws AlignmentException { @@ -561,11 +460,7 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements } public void visit(final ClassRestriction e) throws AlignmentException { - if ( e instanceof ClassValueRestriction ) visit( (ClassValueRestriction)e ); - else if ( e instanceof ClassTypeRestriction ) visit( (ClassTypeRestriction)e ); - else if ( e instanceof ClassDomainRestriction ) visit( (ClassDomainRestriction)e ); - else if ( e instanceof ClassOccurenceRestriction ) visit( (ClassOccurenceRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } public void visit( final ClassValueRestriction c ) throws AlignmentException { @@ -612,7 +507,7 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements indentedOutput("</owl:onProperty>"+NL); indentedOutput("<owl:allValuesFrom>"+NL); increaseIndent(); - visit( c.getType() ); // JE2010 ?? + c.getType().accept( this ); writer.print(NL); decreaseIndent(); indentedOutput("</owl:allValuesFrom>"+NL); @@ -678,10 +573,7 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements } public void visit(final PropertyExpression e) throws AlignmentException { - if ( e instanceof PropertyId ) visit( (PropertyId)e ); - else if ( e instanceof PropertyConstruction ) visit( (PropertyConstruction)e ); - else if ( e instanceof PropertyRestriction ) visit( (PropertyRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } public void visit(final PropertyId e) throws AlignmentException { @@ -739,10 +631,7 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements } public void visit(final PropertyRestriction e) throws AlignmentException { - if ( e instanceof PropertyValueRestriction ) visit( (PropertyValueRestriction)e ); - else if ( e instanceof PropertyDomainRestriction ) visit( (PropertyDomainRestriction)e ); - else if ( e instanceof PropertyTypeRestriction ) visit( (PropertyTypeRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } public void visit(final PropertyValueRestriction c) throws AlignmentException { @@ -833,10 +722,7 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements } public void visit( final RelationExpression e ) throws AlignmentException { - if ( e instanceof RelationId ) visit( (RelationId)e ); - else if ( e instanceof RelationRestriction ) visit( (RelationRestriction)e ); - else if ( e instanceof RelationConstruction ) visit( (RelationConstruction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } public void visit( final RelationId e ) throws AlignmentException { @@ -903,9 +789,7 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements } public void visit( final RelationRestriction e ) throws AlignmentException { - if ( e instanceof RelationCoDomainRestriction ) visit( (RelationCoDomainRestriction)e ); - else if ( e instanceof RelationDomainRestriction ) visit( (RelationDomainRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } public void visit(final RelationCoDomainRestriction c) throws AlignmentException { @@ -941,8 +825,7 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements } public void visit( final InstanceExpression e ) throws AlignmentException { - if ( e instanceof InstanceId ) visit( (InstanceId)e ); - else throw new AlignmentException( "Cannot handle InstanceExpression "+e ); + throw new AlignmentException( "Cannot handle InstanceExpression "+e ); } public void visit( final InstanceId e ) throws AlignmentException { @@ -961,17 +844,13 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements } public void visit( final ValueExpression e ) throws AlignmentException { - if ( e instanceof InstanceExpression ) visit( (InstanceExpression)e ); - else if ( e instanceof PathExpression ) visit( (PathExpression)e ); - else if ( e instanceof Apply ) visit( (Apply)e ); - else if ( e instanceof Value ) visit( (Value)e ); - else throw new AlignmentException( "Cannot dispatch generic ValueExpression "+e ); + throw new AlignmentException( "Cannot dispatch generic ValueExpression "+e ); } // Unused: see ClassValueRestriction above public void visit( final Value e ) throws AlignmentException { } - + // OWL does not allow for function calls public void visit( final Apply e ) throws AlignmentException { throw new AlignmentException( "Cannot render function call in OWL "+e ); diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java index b69bffdc4f942aad592d5bbd59f4311a686ac135..ca7129d3e3c3dca1d177642da99af5a2f603fb79 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java @@ -311,27 +311,19 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align rel.write( writer ); }; + public void visit( Expression o ) throws AlignmentException { - if ( o instanceof PathExpression ) visit( (PathExpression)o ); - else if ( o instanceof ClassExpression ) visit( (ClassExpression)o ); - else if ( o instanceof InstanceExpression ) visit( (InstanceExpression)o ); - else throw new AlignmentException( "Cannot dispatch Expression "+o ); + throw new AlignmentException( "Cannot dispatch Expression "+o ); } - // DONE public void visit( final PathExpression p ) throws AlignmentException { - if ( p instanceof RelationExpression ) visit( (RelationExpression)p ); - else if ( p instanceof PropertyExpression ) visit( (PropertyExpression)p ); - else throw new AlignmentException( "Cannot dispatch PathExpression "+p ); + throw new AlignmentException( "Cannot dispatch PathExpression "+p ); } - // DONE public void visit( final ClassExpression e ) throws AlignmentException { - if ( e instanceof ClassId ) visit( (ClassId)e ); - else if ( e instanceof ClassConstruction ) visit( (ClassConstruction)e ); - else if ( e instanceof ClassRestriction ) visit( (ClassRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } + public void renderVariables( Expression expr ) { if ( expr.getVariable() != null ) { @@ -339,7 +331,6 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align } } - // DONE+TESTED public void visit( final ClassId e ) throws AlignmentException { indentedOutput("<"+SyntaxElement.CLASS_EXPR.print(DEF)); if ( e.getURI() != null ) { @@ -350,7 +341,6 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align writer.print("/>"); } - // DONE+TESTED public void visit( final ClassConstruction e ) throws AlignmentException { final Constructor op = e.getOperator(); String sop = SyntaxElement.getElement( op ).print(DEF) ; @@ -364,7 +354,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align increaseIndent(); for ( final ClassExpression ce : e.getComponents() ) { writer.print(linePrefix); - visit( ce ); + ce.accept( this ); writer.print(NL); } decreaseIndent(); @@ -373,16 +363,10 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.CLASS_EXPR.print(DEF)+">"); } - // DONE+TESTED public void visit(final ClassRestriction e) throws AlignmentException { - if ( e instanceof ClassValueRestriction ) visit( (ClassValueRestriction)e ); - else if ( e instanceof ClassTypeRestriction ) visit( (ClassTypeRestriction)e ); - else if ( e instanceof ClassDomainRestriction ) visit( (ClassDomainRestriction)e ); - else if ( e instanceof ClassOccurenceRestriction ) visit( (ClassOccurenceRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } - - // DONE+TESTED + public void visit( final ClassValueRestriction c ) throws AlignmentException { indentedOutput("<"+SyntaxElement.VALUE_COND.print(DEF)); if ( isPattern ) renderVariables( c ); @@ -390,7 +374,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align increaseIndent(); indentedOutput("<"+SyntaxElement.ONPROPERTY.print(DEF)+">"+NL); increaseIndent(); - visit( c.getRestrictionPath() ); + c.getRestrictionPath().accept( this ); decreaseIndent(); writer.print(NL); indentedOutputln("</"+SyntaxElement.ONPROPERTY.print(DEF)+">"); @@ -400,7 +384,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align writer.print("\"/>"+NL); indentedOutput("<"+SyntaxElement.VALUE.print(DEF)+">"+NL); increaseIndent(); - visit( c.getValue() ); + c.getValue().accept( this ); writer.print(NL); decreaseIndent(); indentedOutput("</"+SyntaxElement.VALUE.print(DEF)+">"+NL); @@ -408,7 +392,6 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.VALUE_COND.print(DEF)+">"); } - // DONE+TESTED public void visit( final ClassTypeRestriction c ) throws AlignmentException { indentedOutput("<"+SyntaxElement.TYPE_COND.print(DEF)); if ( isPattern ) renderVariables( c ); @@ -416,17 +399,16 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align increaseIndent(); indentedOutput("<"+SyntaxElement.ONPROPERTY.print(DEF)+">"+NL); increaseIndent(); - visit( c.getRestrictionPath() ); + c.getRestrictionPath().accept( this ); writer.print(NL); decreaseIndent(); indentedOutput("</"+SyntaxElement.ONPROPERTY.print(DEF)+">"+NL); - visit( c.getType() ); // Directly -> to be changed for rendering all/exists + c.getType().accept( this ); // Directly -> to be changed for rendering all/exists decreaseIndent(); writer.print(NL); indentedOutput("</"+SyntaxElement.TYPE_COND.print(DEF)+">"); } - // DONE+TESTED public void visit( final ClassDomainRestriction c ) throws AlignmentException { indentedOutput("<"+SyntaxElement.DOMAIN_RESTRICTION.print(DEF)); if ( isPattern ) renderVariables( c ); @@ -434,7 +416,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align increaseIndent(); indentedOutput("<"+SyntaxElement.ONPROPERTY.print(DEF)+">"+NL); increaseIndent(); - visit( c.getRestrictionPath() ); + c.getRestrictionPath().accept( this ); writer.print(NL); decreaseIndent(); indentedOutput("</"+SyntaxElement.ONPROPERTY.print(DEF)+">"+NL); @@ -444,7 +426,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("<"+SyntaxElement.EXISTS.print(DEF)+">"+NL); } increaseIndent(); - visit( c.getDomain() ); + c.getDomain().accept( this ); writer.print(NL); decreaseIndent(); if ( c.isUniversal() ) { @@ -456,7 +438,6 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.DOMAIN_RESTRICTION.print(DEF)+">"); } - // DONE+TESTED public void visit( final ClassOccurenceRestriction c ) throws AlignmentException { indentedOutput("<"+SyntaxElement.OCCURENCE_COND.print(DEF)); if ( isPattern ) renderVariables( c ); @@ -464,7 +445,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align increaseIndent(); indentedOutput("<"+SyntaxElement.ONPROPERTY.print(DEF)+">"+NL); increaseIndent(); - visit( c.getRestrictionPath() ); + c.getRestrictionPath().accept( this ); writer.print(NL); decreaseIndent(); indentedOutput("</"+SyntaxElement.ONPROPERTY.print(DEF)+">"+NL); @@ -479,15 +460,10 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.OCCURENCE_COND.print(DEF)+">"); } - // DONE public void visit(final PropertyExpression e) throws AlignmentException { - if ( e instanceof PropertyId ) visit( (PropertyId)e ); - else if ( e instanceof PropertyConstruction ) visit( (PropertyConstruction)e ); - else if ( e instanceof PropertyRestriction ) visit( (PropertyRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } - - // DONE + public void visit(final PropertyId e) throws AlignmentException { indentedOutput("<"+SyntaxElement.PROPERTY_EXPR.print(DEF)); if ( e.getURI() != null ){ @@ -498,7 +474,6 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align writer.print("/>"); } - // DONE public void visit(final PropertyConstruction e) throws AlignmentException { indentedOutput("<"+SyntaxElement.PROPERTY_EXPR.print(DEF)); if ( isPattern ) renderVariables( e ); @@ -513,12 +488,12 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align if ( (op == Constructor.AND) || (op == Constructor.OR) || (op == Constructor.COMP) ) { for ( final PathExpression pe : e.getComponents() ) { writer.print(linePrefix); - visit( pe ); + pe.accept( this ); writer.print(NL); } } else { for (final PathExpression pe : e.getComponents()) { - visit( pe ); + pe.accept( this ); writer.print(NL); } } @@ -527,16 +502,11 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align decreaseIndent(); indentedOutput("</"+SyntaxElement.PROPERTY_EXPR.print(DEF)+">"); } - - // DONE + public void visit(final PropertyRestriction e) throws AlignmentException { - if ( e instanceof PropertyValueRestriction ) visit( (PropertyValueRestriction)e ); - else if ( e instanceof PropertyDomainRestriction ) visit( (PropertyDomainRestriction)e ); - else if ( e instanceof PropertyTypeRestriction ) visit( (PropertyTypeRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } - - // DONE + public void visit(final PropertyValueRestriction c) throws AlignmentException { indentedOutput("<"+SyntaxElement.PROPERTY_VALUE_COND.print(DEF)); if ( isPattern ) renderVariables( c ); @@ -548,7 +518,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align writer.print("\"/>"+NL); indentedOutput("<"+SyntaxElement.VALUE.print(DEF)+">"+NL); increaseIndent(); - visit( c.getValue() ); + c.getValue().accept( this ); writer.print(NL); decreaseIndent(); indentedOutput("</"+SyntaxElement.VALUE.print(DEF)+">"+NL); @@ -556,7 +526,6 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.PROPERTY_VALUE_COND.print(DEF)+">"); } - // DONE public void visit(final PropertyDomainRestriction c) throws AlignmentException { indentedOutput("<"+SyntaxElement.PROPERTY_DOMAIN_COND.print(DEF)); if ( isPattern ) renderVariables( c ); @@ -564,7 +533,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align increaseIndent(); indentedOutput("<"+SyntaxElement.TOCLASS.print(DEF)+">"+NL); increaseIndent(); - visit( c.getDomain() ); + c.getDomain().accept( this ); writer.print(NL); decreaseIndent(); indentedOutput("</"+SyntaxElement.TOCLASS.print(DEF)+">"+NL); @@ -572,26 +541,20 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.PROPERTY_DOMAIN_COND.print(DEF)+">"); } - // DONE public void visit(final PropertyTypeRestriction c) throws AlignmentException { indentedOutput("<"+SyntaxElement.PROPERTY_TYPE_COND.print(DEF)); if ( isPattern ) renderVariables( c ); writer.print(">"+NL); increaseIndent(); - visit( c.getType() ); + c.getType().accept( this ); decreaseIndent(); indentedOutput("</"+SyntaxElement.PROPERTY_TYPE_COND.print(DEF)+">"); } - // DONE public void visit( final RelationExpression e ) throws AlignmentException { - if ( e instanceof RelationId ) visit( (RelationId)e ); - else if ( e instanceof RelationRestriction ) visit( (RelationRestriction)e ); - else if ( e instanceof RelationConstruction ) visit( (RelationConstruction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } - - // DONE + public void visit( final RelationId e ) throws AlignmentException { indentedOutput("<"+SyntaxElement.RELATION_EXPR.print(DEF)); if ( e.getURI() != null ) { @@ -602,7 +565,6 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align writer.print("/>"); } - // DONE public void visit( final RelationConstruction e ) throws AlignmentException { indentedOutput("<"+SyntaxElement.RELATION_EXPR.print(DEF)); if ( isPattern ) renderVariables( e ); @@ -617,12 +579,12 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align if ( (op == Constructor.AND) || (op == Constructor.OR) || (op == Constructor.COMP) ) { for (final PathExpression re : e.getComponents()) { writer.print(linePrefix); - visit( re ); + re.accept( this ); writer.print(NL); } } else { // NOT... or else: enumerate them for (final PathExpression re : e.getComponents()) { - visit( re ); + re.accept( this ); writer.print(NL); } } @@ -632,14 +594,10 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.RELATION_EXPR.print(DEF)+">"); } - // DONE public void visit( final RelationRestriction e ) throws AlignmentException { - if ( e instanceof RelationCoDomainRestriction ) visit( (RelationCoDomainRestriction)e ); - else if ( e instanceof RelationDomainRestriction ) visit( (RelationDomainRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } - // DONE public void visit(final RelationCoDomainRestriction c) throws AlignmentException { indentedOutput("<"+SyntaxElement.RELATION_CODOMAIN_COND.print(DEF)); if ( isPattern ) renderVariables( c ); @@ -647,7 +605,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align increaseIndent(); indentedOutput("<"+SyntaxElement.TOCLASS.print(DEF)+">"+NL); increaseIndent(); - visit( c.getCoDomain() ); + c.getCoDomain().accept( this ); writer.print(NL); decreaseIndent(); indentedOutput("</"+SyntaxElement.TOCLASS.print(DEF)+">"+NL); @@ -655,7 +613,6 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.RELATION_CODOMAIN_COND.print(DEF)+">"); } - // DONE public void visit(final RelationDomainRestriction c) throws AlignmentException { indentedOutput("<"+SyntaxElement.RELATION_DOMAIN_COND.print(DEF)); if ( isPattern ) renderVariables( c ); @@ -663,7 +620,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align increaseIndent(); indentedOutput("<"+SyntaxElement.TOCLASS.print(DEF)+">"+NL); increaseIndent(); - visit( c.getDomain() ); + c.getDomain().accept( this ); writer.print(NL); decreaseIndent(); indentedOutput("</"+SyntaxElement.TOCLASS.print(DEF)+">"+NL); @@ -671,13 +628,10 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.RELATION_DOMAIN_COND.print(DEF)+">"); } - // DONE public void visit( final InstanceExpression e ) throws AlignmentException { - if ( e instanceof InstanceId ) visit( (InstanceId)e ); - else throw new AlignmentException( "Cannot handle InstanceExpression "+e ); + throw new AlignmentException( "Cannot handle InstanceExpression "+e ); } - // DONE+TESTED public void visit( final InstanceId e ) throws AlignmentException { indentedOutput("<"+SyntaxElement.INSTANCE_EXPR.print(DEF)); if ( e.getURI() != null ) { @@ -688,13 +642,8 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align writer.print("/>"); } - // DONE+TESTED public void visit( final ValueExpression e ) throws AlignmentException { - if ( e instanceof InstanceExpression ) visit( (InstanceExpression)e ); - else if ( e instanceof PathExpression ) visit( (PathExpression)e ); - else if ( e instanceof Apply ) visit( (Apply)e ); - else if ( e instanceof Value ) visit( (Value)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } public void visit( final Value e ) throws AlignmentException { @@ -712,7 +661,7 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align increaseIndent(); for ( final ValueExpression ve : e.getArguments() ) { writer.print(linePrefix); - visit( ve ); + ve.accept( this ); writer.print(NL); } decreaseIndent(); @@ -740,7 +689,6 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</"+SyntaxElement.TRANSF.print(DEF)+">"); } - // DONE public void visit( final Datatype e ) throws AlignmentException { indentedOutput("<"+SyntaxElement.DATATYPE.print(DEF)+">"); writer.print(e.plainText()); diff --git a/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java b/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java index 62f9204be691c6e7dafd1764bebc79418a8ac00b..072034f898f2b7d4d2c4343d9a54402a6bb41237 100644 --- a/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java +++ b/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java @@ -215,7 +215,7 @@ public enum SyntaxElement { throw new NullPointerException("The string must not be null"); } for ( SyntaxElement e : SyntaxElement.values() ) { - if ( s.equals(e.getName()) ) { + if ( s.equals( e.getName() ) ) { return e; } } diff --git a/src/fr/inrialpes/exmo/align/parser/TypeCheckingVisitor.java b/src/fr/inrialpes/exmo/align/parser/TypeCheckingVisitor.java index 8d4e5191ab9030402503c3e7e7c2929d86d2908a..f5f9c357dc864da7acfc5734529548773abb58ae 100644 --- a/src/fr/inrialpes/exmo/align/parser/TypeCheckingVisitor.java +++ b/src/fr/inrialpes/exmo/align/parser/TypeCheckingVisitor.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2010-2011 + * Copyright (C) INRIA, 2010-2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -80,7 +80,7 @@ import fr.inrialpes.exmo.align.impl.edoal.EDOALCell; public class TypeCheckingVisitor { - private enum TYPE { CLASS, PROPERTY, RELATION, INSTANCE, VALUE, DATATYPE, ANY, ERROR }; + public enum TYPE { CLASS, PROPERTY, RELATION, INSTANCE, VALUE, DATATYPE, ANY, ERROR }; EDOALAlignment alignment = null; EDOALCell cell = null; @@ -96,27 +96,11 @@ public class TypeCheckingVisitor { nslist = new Hashtable<URI,TYPE>(); } - /* - * JE: These major dispatches are a pain. - * I should learn a bit more Java about that - * (and at least inverse the order - */ - public TYPE visit( Visitable o ) throws AlignmentException { - if ( o instanceof Expression ) return visit( (Expression)o ); - else throw new AlignmentException( "Cannot type check all" ); + throw new AlignmentException( "Cannot type check all" ); } public TYPE visit( Expression o ) throws AlignmentException { - if ( o instanceof ClassExpression ) return visit( (ClassExpression)o ); - //else if ( o instanceof TransfService ) return visit( (TransfService)o ); - else if ( o instanceof RelationRestriction ) return visit( (RelationRestriction)o ); - else if ( o instanceof PropertyRestriction ) return visit( (PropertyRestriction)o ); - else if ( o instanceof ClassRestriction ) return visit( (ClassRestriction)o ); - else if ( o instanceof PathExpression ) return visit( (PathExpression)o ); - else if ( o instanceof PropertyExpression ) return visit( (PropertyExpression)o ); - else if ( o instanceof InstanceExpression ) return visit( (InstanceExpression)o ); - else if ( o instanceof RelationExpression ) return visit( (RelationExpression)o ); throw new AlignmentException("Cannot export abstract Expression: "+o ); } @@ -132,8 +116,8 @@ public class TypeCheckingVisitor { this.cell = cell; // Could be useful when not parsing EDOAL if ( alignment.getLevel().startsWith("2EDOAL") ) { - TYPE t1 = visit( ((Expression)(cell.getObject1())) ); - TYPE t2 = visit( ((Expression)(cell.getObject2())) ); + TYPE t1 = ((Expression)(cell.getObject1())).accept( this ); + TYPE t2 = ((Expression)(cell.getObject2())).accept( this ); // JE2011: This should be dependent on the Relation type (e.g., instanceOf) // See below if ( !compatible( t1, t2 ) ) return TYPE.ERROR; @@ -156,7 +140,7 @@ public class TypeCheckingVisitor { } // JE2011 - // This should no be related to the Relation class + // This should not be related to the Relation class // and it can implement a compatibility check from the given types! // depending on the //public TYPE visit( EDOALRelation rel ) { @@ -165,24 +149,19 @@ public class TypeCheckingVisitor { public TYPE visit( final Transformation trsf ) throws AlignmentException { // getType() could allow to do better typing - TYPE tp1 = visit( trsf.getObject1() ); - TYPE tp2 = visit( trsf.getObject2() ); + TYPE tp1 = trsf.getObject1().accept( this ); + TYPE tp2 = trsf.getObject2().accept( this ); if ( !compatible( tp1, TYPE.VALUE ) ) return raiseError( null, tp1, TYPE.VALUE ); if ( !compatible( tp2, TYPE.VALUE ) ) return raiseError( null, tp2, TYPE.VALUE ); return TYPE.ANY; } public TYPE visit( final PathExpression p ) throws AlignmentException { - if ( p instanceof RelationExpression ) return visit( (RelationExpression)p ); - else if ( p instanceof PropertyExpression ) return visit( (PropertyExpression)p ); - else throw new AlignmentException( "Cannot dispatch PathExpression "+p ); + throw new AlignmentException( "Cannot dispatch PathExpression "+p ); } public TYPE visit( final ClassExpression e ) throws AlignmentException { - if ( e instanceof ClassId ) return visit( (ClassId)e ); - else if ( e instanceof ClassConstruction ) return visit( (ClassConstruction)e ); - else if ( e instanceof ClassRestriction ) return visit( (ClassRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); } public TYPE visit( final ClassId e ) throws AlignmentException { @@ -196,7 +175,7 @@ public class TypeCheckingVisitor { final Constructor op = e.getOperator(); // do we test the operator? boolean allright = true; for (final ClassExpression ce : e.getComponents()) { - TYPE tp = visit( ce ); + TYPE tp = ce.accept( this ); if ( !compatible( tp, TYPE.CLASS ) ) { raiseError( null, tp, TYPE.CLASS ); allright = false; @@ -207,31 +186,27 @@ public class TypeCheckingVisitor { } public TYPE visit(final ClassRestriction e) throws AlignmentException { - if ( e instanceof ClassValueRestriction ) return visit( (ClassValueRestriction)e ); - else if ( e instanceof ClassTypeRestriction ) return visit( (ClassTypeRestriction)e ); - else if ( e instanceof ClassDomainRestriction ) return visit( (ClassDomainRestriction)e ); - else if ( e instanceof ClassOccurenceRestriction ) return visit( (ClassOccurenceRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch ClassRestriction "+e ); } public TYPE visit( final ClassValueRestriction c ) throws AlignmentException { - TYPE ptype = visit( c.getRestrictionPath() ); - TYPE tp = visit( c.getValue() ); + TYPE ptype = c.getRestrictionPath().accept( this ); + TYPE tp = c.getValue().accept( this ); if ( !pcompatible( ptype, tp ) ) return raiseError( null, ptype, tp ); return TYPE.CLASS; } public TYPE visit( final ClassTypeRestriction c ) throws AlignmentException { - TYPE ptype = visit( c.getRestrictionPath() ); - TYPE tp = visit( c.getType() ); + TYPE ptype = c.getRestrictionPath().accept( this ); + TYPE tp = c.getType().accept( this ); if ( !compatible( ptype, TYPE.PROPERTY ) ) return raiseError( null, ptype, TYPE.PROPERTY ); if ( !compatible( tp, TYPE.DATATYPE ) ) return raiseError( null, tp, TYPE.DATATYPE ); return TYPE.CLASS; } public TYPE visit( final ClassDomainRestriction c ) throws AlignmentException { - TYPE ptype = visit( c.getRestrictionPath() ); - TYPE tp = visit( c.getDomain() ); + TYPE ptype = c.getRestrictionPath().accept( this ); + TYPE tp = c.getDomain().accept( this ); if ( !compatible( ptype, TYPE.RELATION ) ) return raiseError( null, ptype, TYPE.RELATION ); if ( !compatible( tp, TYPE.CLASS ) ) return raiseError( null, tp, TYPE.CLASS ); return TYPE.CLASS; @@ -239,7 +214,7 @@ public class TypeCheckingVisitor { public TYPE visit( final ClassOccurenceRestriction c ) throws AlignmentException { //c.getComparator().getURI(); - TYPE ptype = visit( c.getRestrictionPath() ); + TYPE ptype = c.getRestrictionPath().accept( this ); // c.getOccurence() is an integer if ( !compatible( ptype, TYPE.RELATION ) && !compatible( ptype, TYPE.PROPERTY ) ) return raiseError( null, ptype, TYPE.RELATION ); @@ -247,10 +222,7 @@ public class TypeCheckingVisitor { } public TYPE visit(final PropertyExpression e) throws AlignmentException { - if ( e instanceof PropertyId ) return visit( (PropertyId)e ); - else if ( e instanceof PropertyConstruction ) return visit( (PropertyConstruction)e ); - else if ( e instanceof PropertyRestriction ) return visit( (PropertyRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch PropertyExpression "+e ); } public TYPE visit(final PropertyId e) throws AlignmentException { @@ -264,7 +236,7 @@ public class TypeCheckingVisitor { //final Constructor op = e.getOperator(); // do we test the operator? boolean allright = true; for ( final PathExpression pe : e.getComponents() ) { - TYPE tp = visit( pe ); + TYPE tp = pe.accept( this ); if ( !compatible( tp, TYPE.PROPERTY ) ) { raiseError( null, tp, TYPE.PROPERTY ); allright = false; @@ -275,36 +247,30 @@ public class TypeCheckingVisitor { } public TYPE visit(final PropertyRestriction e) throws AlignmentException { - if ( e instanceof PropertyValueRestriction ) return visit( (PropertyValueRestriction)e ); - else if ( e instanceof PropertyDomainRestriction ) return visit( (PropertyDomainRestriction)e ); - else if ( e instanceof PropertyTypeRestriction ) return visit( (PropertyTypeRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch PropertyRestriction "+e ); } public TYPE visit(final PropertyValueRestriction c) throws AlignmentException { //c.getComparator().getURI(); // do we test the operator? - TYPE type = visit( c.getValue() ); + TYPE type = c.getValue().accept( this ); if ( !compatible( type, TYPE.VALUE ) ) return raiseError( null, type, TYPE.VALUE ); return TYPE.PROPERTY; } public TYPE visit(final PropertyDomainRestriction c) throws AlignmentException { - TYPE type = visit( c.getDomain() ); + TYPE type = c.getDomain().accept( this ); if ( !compatible( type, TYPE.DATATYPE ) ) return raiseError( null, type, TYPE.DATATYPE ); return TYPE.PROPERTY; } public TYPE visit(final PropertyTypeRestriction c) throws AlignmentException { - TYPE type = visit( c.getType() ); + TYPE type = c.getType().accept( this ); if ( !compatible( type, TYPE.DATATYPE ) ) return raiseError( null, type, TYPE.DATATYPE ); return TYPE.PROPERTY; } public TYPE visit( final RelationExpression e ) throws AlignmentException { - if ( e instanceof RelationId ) return visit( (RelationId)e ); - else if ( e instanceof RelationRestriction ) return visit( (RelationRestriction)e ); - else if ( e instanceof RelationConstruction ) return visit( (RelationConstruction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch RelationExpression "+e ); } public TYPE visit( final RelationId e ) throws AlignmentException { @@ -318,7 +284,7 @@ public class TypeCheckingVisitor { final Constructor op = e.getOperator(); // do we test the operator? boolean allright = true; for (final PathExpression re : e.getComponents()) { - TYPE tp = visit( re ); + TYPE tp = re.accept( this ); if ( !compatible( tp, TYPE.RELATION ) ) { raiseError( null, tp, TYPE.RELATION ); allright = false; @@ -329,26 +295,23 @@ public class TypeCheckingVisitor { } public TYPE visit( final RelationRestriction e ) throws AlignmentException { - if ( e instanceof RelationCoDomainRestriction ) return visit( (RelationCoDomainRestriction)e ); - else if ( e instanceof RelationDomainRestriction ) return visit( (RelationDomainRestriction)e ); - else throw new AlignmentException( "Cannot dispatch ClassExpression "+e ); + throw new AlignmentException( "Cannot dispatch RelationRestriction "+e ); } public TYPE visit(final RelationCoDomainRestriction c) throws AlignmentException { - TYPE type = visit( c.getCoDomain() ); + TYPE type = c.getCoDomain().accept( this ); if ( !compatible( type, TYPE.CLASS ) ) return raiseError( null, type, TYPE.CLASS ); return TYPE.RELATION; } public TYPE visit(final RelationDomainRestriction c) throws AlignmentException { - TYPE type = visit( c.getDomain() ); + TYPE type = c.getDomain().accept( this ); if ( !compatible( type, TYPE.CLASS ) ) return raiseError( null, type, TYPE.CLASS ); return TYPE.RELATION; } public TYPE visit( final InstanceExpression e ) throws AlignmentException { - if ( e instanceof InstanceId ) return visit( (InstanceId)e ); - else throw new AlignmentException( "Cannot handle InstanceExpression "+e ); + throw new AlignmentException( "Cannot handle InstanceExpression "+e ); } public TYPE visit( final InstanceId e ) throws AlignmentException { @@ -359,11 +322,8 @@ public class TypeCheckingVisitor { } public TYPE visit( final ValueExpression e ) throws AlignmentException { - if ( e instanceof Value ) return visit( (Value)e ); - else if ( e instanceof Apply ) return visit( (Apply)e ); - else if ( e instanceof InstanceExpression ) return visit( (InstanceExpression)e ); - else if ( e instanceof PathExpression ) { - TYPE type = visit( (PathExpression)e ); + if ( e instanceof PathExpression ) { + TYPE type = e.accept( this ); if ( !compatible( type, TYPE.PROPERTY ) ) return raiseError( null, type, TYPE.PROPERTY ); return TYPE.VALUE; } else throw new AlignmentException( "Cannot handle ValueExpression "+e ); @@ -377,7 +337,7 @@ public class TypeCheckingVisitor { // e.getOperation() boolean allright = true; for ( ValueExpression ve : e.getArguments() ) { - TYPE tp = visit( ve ); + TYPE tp = ve.accept( this ); if ( !compatible( tp, TYPE.VALUE ) ) { raiseError( null, tp, TYPE.VALUE ); allright = false;