Mentions légales du service

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

- new expressive language EDOAL

parent e670d718
No related branches found
No related tags found
No related merge requests found
Showing
with 1941 additions and 0 deletions
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.5 - 2006 - was ClassExpr
* Copyright (C) INRIA, 2009-2010
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.util.Collection;
import java.util.HashSet;
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 org.semanticweb.owl.align.Visitable;
/**
* <p>
* Represents a ClassExpression.
* </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/ClassExpr.java,v $,
* @version $Revision: 1.5 $ $Date$
*/
// JE2010: Should it be abstract with ClassConjunction??
public class ClassConstruction extends ClassExpression {
/** Holds all expressions. */
private Collection<ClassExpression> components;
/** Operator of this complex expression. */
private Constructor operator;
public ClassConstruction() {
super();
components = new HashSet<ClassExpression>();
}
public ClassConstruction( Constructor op, Collection<ClassExpression> expressions ) {
if ((expressions == null) || (op == null)) {
throw new NullPointerException("The subexpressions and the operator must not be null");
}
if (expressions.contains(null)) {
throw new IllegalArgumentException("The subexpressions must not contain null");
}
this.components = expressions;
if ( op != SyntaxElement.AND.getOperator() &&
op != SyntaxElement.OR.getOperator() &&
op != SyntaxElement.NOT.getOperator() ) {
throw new IllegalArgumentException( "Incorrect operator for class : "+op );
}
this.operator = op;
}
public Constructor getOperator() {
return operator;
}
public void setOperator( Constructor op ) {
operator = op;
}
public Collection<ClassExpression> getComponents() {
return components;
}
public void addComponents( ClassExpression exp ) {
components.add( exp );
}
/*
public void accept(AlignmentVisitor visitor) throws AlignmentException {
visitor.visit(this);
}
*/
/*
public Object clone() {
return super.clone();
}
*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.5 - 2006 - was ClassExpr
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.util.Collection;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Visitable;
/**
* <p>
* Represents a ClassExpression.
* </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/ClassExpr.java,v $,
* @version $Revision: 1.5 $ $Date$
*/
public abstract class ClassExpression extends Expression {
protected ClassExpression() {
super();
}
/*
public void accept(AlignmentVisitor visitor) throws AlignmentException {
visitor.visit(this);
}
*/
/* public Object clone() {
return super.clone();
}*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.5 - 2006
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.util.Collection;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Visitable;
import java.net.URI;
import java.net.URISyntaxException;
/**
* A simple Id to represent a Class.
*
* @author richi
*
*/
public class ClassId extends ClassExpression implements Id {
/** Holds the identifier. */
private String id;
URI uri;
public ClassId(final String id) throws AlignmentException {
if (id == null) {
throw new NullPointerException("The id must not be null");
}
if (id.length() <= 0) {
throw new IllegalArgumentException(
"The id must be longer than 0 characters");
}
this.id = id;
try {
uri = new URI( id );
} catch ( URISyntaxException mfuex ) {
throw new AlignmentException( "Not an URI "+id, mfuex );
}
}
public ClassId( final URI u ) {
if ( u == null) {
throw new NullPointerException("The URI must not be null");
}
this.uri = u;
id = u.toString();
}
public URI getURI(){
return uri;
}
public String plainText() {
return id;
}
/**
* <p>
* Returns a simple description of this object. <b>The format of the
* returned String is undocumented and subject to change.</b>
* <p>
* <p>
* An expamle return String could be:
* <code>classId: http://my/super/class</code>
* </p>
*/
public String toString() {
return "classId: " + id;
}
public int hashCode() {
int result = 17;
result = result * 37 + id.hashCode();
return result;
}
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof ClassId)) {
return false;
}
ClassId i = (ClassId) obj;
return id.equals(i.id);
}
/*
public Object clone() {
return super.clone();
}
*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.5 - 2006 -- then AttributeOccurenceCondition.java
* Copyright (C) INRIA, 2009-2010
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
/**
* <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$
*/
public class ClassOccurenceRestriction extends ClassRestriction implements Cloneable {
Comparator comparator = null;
int occurence = 1;
/**
* Constructs a attributeOccurenceRestriction with the given restriction.
*
* @param attribute
* the attribute on which the restriction should be applied
* @param restriction
* the restriction for the domain
* @throws NullPointerException
* if the restriction is null
*/
public ClassOccurenceRestriction( final PathExpression p, Comparator c, int n ) {
super( p );
constrainedPath = p;
comparator = c;
occurence = n;
}
public int getOccurence() { return occurence; }
public void setOccurence( int n ) { occurence = n; }
public Comparator getComparator() { return comparator; }
public void setComparator( Comparator c ) { comparator = c; }
/*
public Object clone() {
return super.clone();
}
*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.6 - 2006
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Visitable;
/**
* <p>
* Superclass for all ClassRestrictions.
* </p>
* <p>
* To successfully subclass this class the <code>clone</code> and
* <code>equals</code> methods must be overwritten. And if new fields were
* introduced, the <code>hashCode</code> and <code>toString</code> methods,
* too.
* </p>
* <p>
* Created on 24-Mar-2005 Committed by $Author: poettler_ric $
* </p>
* <p>
* $Id: ClassRestriction.java,v 1.6 2006/11/27 16:39:08 poettler_ric Exp $
* </p>
*
* @author Francois Scharffe
* @author Adrian Mocan
* @author Richard Pöttler
* @version $Revision: 1.6 $ $Date$
*/
public abstract class ClassRestriction extends ClassExpression {
/** The attribute on which the restriction should be applied. */
protected PathExpression constrainedPath = null;
public ClassRestriction( PathExpression att ) {
super();
constrainedPath = att;
}
/*
public void accept(AlignmentVisitor visitor) throws AlignmentException {
visitor.visit(this);
}
*/
public PathExpression getRestrictionPath() {
return constrainedPath;
}
public void setRestrictionPath( PathExpression att) {
constrainedPath = att;
}
/*
public Object clone() {
try {
ClassRestriction clone = (ClassRestriction) super.clone();
clone.restriction = (Restriction) restriction.clone();
clone.attribute = (PathExpression) attribute.clone();
clone.target = (ExpressionDefinition) target.clone();
return clone;
} catch (CloneNotSupportedException e) {
assert true : "Object is always cloneable";
}
return null;
}
*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.5 - 2006
* Copyright (C) INRIA, 2009-2010
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
/**
* <p>
* Represents a type typeCondition tag for PropertyExpressions.
* </p>
* <p>
* $Id: ClassTypeRestriction.java,v 1.5 2006/11/27 16:39:09 poettler_ric Exp $
* </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$
*/
public class ClassTypeRestriction extends ClassRestriction implements Cloneable {
// BEWARE THIS IS INCORRECTLY IMPLEMENTED AS VALUES INSTEAD OF TYPES
Datatype type = null;
/**
* Constructs a typeCondition with the given restriction.
*
* @param res
* the restriction for the domain
* @param target
* the target expression which should be restricted
* @throws NullPointerException
* if the restriction is null
*/
public ClassTypeRestriction(final PathExpression p,
final Datatype t) {
super(p);
// Check that this is a property
type = t;
}
public Datatype getType() {
return type;
}
public void setType( Datatype t ) {
type = t;
}
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.6 - 2006
* Copyright (C) INRIA, 2009-2010
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
/**
* <p>
* Represents a type valueCondition tag for PropertyExpressions.
* </p>
* <p>
* $Id: ClassValueRestriction.java,v 1.6 2006/11/27 16:39:09 poettler_ric Exp $
* </p>
* <p>
* Created on 24-Mar-2005 Committed by $Author: poettler_ric $
* </p>
*
* @author Richard Pöttler
* @version $Revision: 1.6 $ $Date$
*/
public class ClassValueRestriction extends ClassRestriction implements Cloneable {
Comparator comparator = null;
PathExpression pathValue = null;
Value value = null;
InstanceExpression inst = null;
/**
* Constructs a valueCondition with the given restriction.
*
* @param res
* the restriction for the domain
* @param target
* the target expression which should be restricted
* @throws NullPointerException
* if the restriction is null
*/
public ClassValueRestriction(final PathExpression p, final Comparator comp, final PathExpression p2) {
super(p);
pathValue = p2;
comparator = comp;
}
public ClassValueRestriction(final PathExpression p, final Comparator comp, final Value v) {
super(p);
value = v;
comparator = comp;
}
public ClassValueRestriction(final PathExpression p, final Comparator comp, final InstanceExpression i) {
super(p);
inst = i;
comparator = comp;
}
public Comparator getComparator() {
return comparator;
}
public void setComparator( Comparator comp ) {
comparator = comp;
}
public PathExpression getPathValue() {
return pathValue;
}
public InstanceExpression getInstanceValue() {
return inst;
}
public Value getValue() {
return value;
}
public void setValue( PathExpression p ) {
pathValue = p;
value = null;
inst = null;
}
public void setValue( InstanceExpression i ) {
inst = i;
pathValue = null;
value = null;
}
public void setValue( Value v ) {
value = v;
pathValue = null;
inst = null;
}
}
/*
* $Id$
*
* Copyright (C) INRIA, 2009-2010
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.net.URI;
import java.net.URISyntaxException;
public class Comparator {
URI uri = null;
// This replaces the Comparator class
// SHOULD CERTAINLY BE AN ENUM
public static Comparator EQUAL = initComparator( "http://www.w3.org/2001/XMLSchema#equals", 0 );
public static Comparator LOWER = initComparator( "http://www.w3.org/2001/XMLSchema#lower-than", -1 );
public static Comparator GREATER = initComparator( "http://www.w3.org/2001/XMLSchema#greater-than", 1 );
protected Comparator() {
super();
}
public Comparator( URI u ) {
super();
uri = u;
}
private static Comparator initComparator( String uri, int rank ){
try {
return new Comparator( new URI( uri ) );
} catch ( URISyntaxException usex ) {
return new Comparator();
}
}
public URI getURI() {
return uri;
}
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.2 - 2006
* Copyright (C) INRIA, 2009-2010
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
/**
* <p>
* Id to represent a datatype
* </p>
* <p>
* $Id$
* </p>
*/
public class Datatype { //implements Cloneable, Visitable {
/** Holds the type */
private String type;
/**
* Constructs an object with the given type.
*
* @param type
* the type for this object.
* @throws NullPointerException
* if the type is {@code null}
* @throws IllegalArgumentException
* if the type isn't longer than 0
*/
public Datatype( final String type ) {
if (type == null) {
throw new NullPointerException("The type must not be null");
}
this.type = type;
}
// public void accept(AlignmentVisitor visitor) throws AlignmentException {
// visitor.visit(this);
// }
public String plainText() {
return type;
}
public int hashCode() {
return type.hashCode();
}
public boolean equals(final Object o) {
if ( o == this ) {
return true;
}
if (!(o instanceof Datatype)) {
return false;
}
Datatype s = (Datatype) o;
return type.equals(s.type);
}
/*
public Object clone() {
return super.clone();
}
*/
/**
* <p>
* Returns a short description about this object. <b>The format of the
* returned string is undocumentd and subject to change.</b>
* </p>
* <p>
* An example return string could be: {@code 15}
* </p>
*/
public String toString() {
return type;
}
}
/*
* $Id: EDOALAlignment.java,v 1.6 2008/09/15 08:38:54 jeuzenat Exp $
*
* Sourceforge version 1.6 - 2008 - was OMWGAlignment
* Copyright (C) INRIA, 2007-2010
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Set;
import java.net.URI;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.Alignment;
import org.semanticweb.owl.align.Cell;
import org.semanticweb.owl.align.Relation;
import org.semanticweb.owl.align.Parameters;
import fr.inrialpes.exmo.ontowrap.Ontology;
import fr.inrialpes.exmo.align.impl.Annotations;
import fr.inrialpes.exmo.align.impl.Namespace;
import fr.inrialpes.exmo.align.impl.BasicAlignment;
import fr.inrialpes.exmo.align.impl.BasicParameters;
import fr.inrialpes.exmo.align.impl.Extensions;
/**
* <p>This class is an encapsulation of BasicAlignement so that
* it creates the structures required by the MappingDocument within
* the BasicAlignment</p>
* JE 2009: Maybe ObjectAlignment could even be better
*
*/
public class EDOALAlignment extends BasicAlignment {
protected EDOALAlignment init = null;
public EDOALAlignment() {
setLevel("2EDOAL");
setXNamespace( Namespace.EDOAL.shortCut, Namespace.EDOAL.prefix );
}
public void init( Object onto1, Object onto2 ) throws AlignmentException {
if ( (onto1 == null) || (onto2 == null) )
throw new AlignmentException("The source and target ontologies must not be null");
if ( (onto1 instanceof Ontology && onto2 instanceof Ontology) ){
super.init( onto1, onto2 );
} else {
throw new AlignmentException("arguments must be LoadedOntology");
};
}
public void loadInit( Alignment al ) throws AlignmentException {
if ( al instanceof EDOALAlignment ) {
init = (EDOALAlignment)al;
} else {
throw new AlignmentException( "EDOAL required as initial alignment");
}
}
/*
* Dealing with correspondences
*/
/** Cell methods **/
public Cell addAlignCell( EDOALCell rule ) throws AlignmentException {
addCell( rule );
return rule;
}
public Cell addAlignCell(String id, Object ob1, Object ob2, Relation relation, double measure, Extensions extensions ) throws AlignmentException {
if ( !( ob1 instanceof Expression && ob2 instanceof Expression ) )
throw new AlignmentException("arguments must be Expressions");
return super.addAlignCell( id, ob1, ob2, relation, measure, extensions);
};
public Cell addAlignCell(String id, Object ob1, Object ob2, Relation relation, double measure) throws AlignmentException {
if ( !( ob1 instanceof Expression && ob2 instanceof Expression ) )
throw new AlignmentException("arguments must be Expressions");
return super.addAlignCell( id, ob1, ob2, relation, measure);
};
public Cell addAlignCell(Object ob1, Object ob2, String relation, double measure) throws AlignmentException {
if ( !( ob1 instanceof Expression && ob2 instanceof Expression ) )
throw new AlignmentException("arguments must be Expressions");
return super.addAlignCell( ob1, ob2, relation, measure);
};
public Cell addAlignCell(Object ob1, Object ob2) throws AlignmentException {
if ( !( ob1 instanceof Expression && ob2 instanceof Expression ) )
throw new AlignmentException("arguments must be Expressions");
return super.addAlignCell( ob1, ob2 );
};
public Cell createCell(String id, Object ob1, Object ob2, Relation relation, double measure) throws AlignmentException {
return (Cell)new EDOALCell( id, (Expression)ob1, (Expression)ob2, (EDOALRelation)relation, measure);
}
public Set<Cell> getAlignCells1(Object ob) throws AlignmentException {
if ( ob instanceof Expression ){
return super.getAlignCells1( ob );
} else {
throw new AlignmentException("argument must be Expression");
}
}
public Set<Cell> getAlignCells2(Object ob) throws AlignmentException {
if ( ob instanceof Expression ){
return super.getAlignCells2( ob );
} else {
throw new AlignmentException("argument must be Expression");
}
}
// Deprecated: implement as the one retrieving the highest strength correspondence (
public Cell getAlignCell1(Object ob) throws AlignmentException {
if ( Annotations.STRICT_IMPLEMENTATION == true ){
throw new AlignmentException("deprecated (use getAlignCells1 instead)");
} else {
if ( ob instanceof Expression ){
return super.getAlignCell1( ob );
} else {
throw new AlignmentException("argument must be Expression");
}
}
}
public Cell getAlignCell2(Object ob) throws AlignmentException {
if ( Annotations.STRICT_IMPLEMENTATION == true ){
throw new AlignmentException("deprecated (use getAlignCells2 instead)");
} else {
if ( ob instanceof Expression ){
return super.getAlignCell2( ob );
} else {
throw new AlignmentException("argument must be Expression");
}
}
}
/*
* Dealing with ontology Ids from an Alignment API standpoint
*/
public URI getOntology1URI() { return onto1.getURI(); };
public URI getOntology2URI() { return onto2.getURI(); };
public void setOntology1(Object ontology) throws AlignmentException {
if ( ontology instanceof Ontology ){
super.setOntology1( ontology );
} else {
throw new AlignmentException("arguments must be Ontology");
};
};
public void setOntology2(Object ontology) throws AlignmentException {
if ( ontology instanceof Ontology ){
super.setOntology2( ontology );
} else {
throw new AlignmentException("arguments must be Ontology");
};
};
/**
* Returns the mappings of the EDOALAlignment
* @return The set of rules contained by the EDOALAlignment
*/
/**
* Generate a copy of this alignment object
*/
// JE: this is a mere copy of the method in BasicAlignement
// It has two difficulties
// - it should call the current init() and not that of BasicAlignement
// - it should catch the AlignmentException that it is supposed to raise
public Object clone() {
EDOALAlignment align = new EDOALAlignment();
try {
align.init( (Ontology)getOntology1(), (Ontology)getOntology2() );
} catch ( AlignmentException e ) {};
align.setType( getType() );
align.setLevel( getLevel() );
align.setFile1( getFile1() );
align.setFile2( getFile2() );
for ( String[] ext: extensions.getValues() ){
align.setExtension( ext[0], ext[1], ext[2] );
}
align.setExtension( Namespace.ALIGNMENT.getUriPrefix(), "id", (String)null );
try {
align.ingest( this );
} catch (AlignmentException ex) { ex.printStackTrace(); }
return align;
}
}
/*
* $Id: EDOALCell.java,v 1.2 2008/06/29 16:18:49 jeuzenat Exp $
*
* Sourceforge version 1.2 - 2008
* Copyright (C) INRIA, 2007-2009
*
* 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 the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.io.PrintStream;
import java.io.IOException;
import java.util.Comparator;
import java.lang.ClassNotFoundException;
import java.lang.Float;
import java.lang.Double;
import java.net.URISyntaxException;
import java.net.URI;
import org.semanticweb.owl.align.Alignment;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Cell;
import org.semanticweb.owl.align.Relation;
import fr.inrialpes.exmo.align.impl.BasicCell;
import fr.inrialpes.exmo.align.impl.rel.*;
/**
* This implements a particular of ontology correspondence when it
* is a correspondence from the EDOAL Mapping Language.
*
* The current implementation of this class consists of encapsulating
* the EDOAL Mapping Rule object and reimplementing the ALignment API
* accessors around it.
* This is fine but there is another implementation that would be more
* satisfactory:
*
* Reimplementing the EDOAL Mapping Rules in terms of a proper Cell
* with:
* id: URI id
* object1: Resource source
* object2: Resource target
* relation: The class name of the rule
* measure: float measure
* -- no real use of direction.
*
* @author Jrme Euzenat
* @version $Id: EDOALCell.java,v 1.2 2008/06/29 16:18:49 jeuzenat Exp $
*/
public class EDOALCell extends BasicCell {
// JE2009: This has been added for
private URI id; // This is the id
public void accept( AlignmentVisitor visitor) throws AlignmentException {
visitor.visit( this );
}
/** Creation **/
public EDOALCell( String id, Expression ob1, Expression ob2, EDOALRelation rel, double m ) throws AlignmentException {
super( id, (Object)ob1, (Object)ob2, rel, m );
};
public boolean equals( Cell c ) {
if ( c instanceof EDOALCell ){
return ( object1.equals(c.getObject1()) && object2.equals(c.getObject2()) && strength == c.getStrength() && (relation.equals( c.getRelation() )) );
} else {
return false;
}
}
// JE// Maybe do it in case Expressions have URI
public URI getObject1AsURI( Alignment al ) throws AlignmentException {
return null;
//throw new AlignmentException( "Cannot convert to URI "+object1 );
}
public URI getObject2AsURI( Alignment al ) throws AlignmentException {
return null;
//throw new AlignmentException( "Cannot convert to URI "+object2 );
}
public Cell inverse() throws AlignmentException {
return (Cell)new EDOALCell( (String)null, (Expression)object2, (Expression)object1, (EDOALRelation)relation.inverse(), strength );
// The same should be done for the measure
}
}
/*
* $Id: EDOALRelation.java,v 1.3 2008/02/28 20:14:10 jeuzenat Exp $
*
* Sourceforge version 1.3 - 2008
* Copyright (C) INRIA, 2007-2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
// JE2009: This is a total mess that must be rewritten wrt Direction
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Relation;
import java.lang.reflect.Constructor;
import java.io.PrintWriter;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import org.xml.sax.ContentHandler;
/**
* Represents an ontology alignment relation.
* In fact, for the EDOAL Mapping language, this encodes directions
* but should be rewritten in order to achive a better implementation
*
* @author Jérôme Euzenat
* @version $Id: EDOALRelation.java,v 1.3 2008/02/28 20:14:10 jeuzenat Exp $
*/
public class EDOALRelation implements Relation {
/**
* <p>
* Enumeration to distinuish the direction of the mapping.
* </p>
* <p>
* $Id: MappingRule.java,v 1.10 2008/01/22 18:24:58 jeuzenat Exp $
* </p>
*
* @author richi
* @version $Revision: 1.10 $
*/
// JE2009: THIS SHOULD BE REWRITTEN WITH SUBCLASSES AND NO DIRECTIONS...
/* [JE:22/01/2008]
* I make this compliant with 2.2.10 and replacing RDFRuleTYpe
* The Trick for having a hash-table for recording the various relations makes the nameIndex non-static and the getRelation() unusable in static context...
* Hence it has to be used as: Direction.GENERIC.getRelation();
*/
public static enum Direction {
GENERIC("Generic",(String)null),
EQUIVALENCE("Equivalence","="),
DISJOINTFROM("DisjointFrom","><"),
SUBSUMES("Subsumes",">"),
SUBSUMEDBY("SubsumedBy","<"),
INSTANCEOF("InstanceOf",(String)null),
HASINSTANCE("HasInstance",(String)null);
private final String EDOALRepr;
private final String abbrev;
private final URI uri;
private static Map<String, Direction> nameIndex = null;
private Direction(final String repr, final String abb) {
EDOALRepr = repr;
abbrev = abb;
uri = (URI)null;
}
public String toString() {
return EDOALRepr;
}
public static Direction getRelation( final String name ){
if ( nameIndex == null ){
nameIndex = new HashMap<String, Direction>();
nameIndex.put( "Equivalence", EQUIVALENCE );
nameIndex.put( "=", EQUIVALENCE );
nameIndex.put( "equivalence", EQUIVALENCE );
nameIndex.put( "ClassMapping", EQUIVALENCE );
nameIndex.put( "Subsumes", SUBSUMES );
nameIndex.put( ">", SUBSUMES );
nameIndex.put( "SubsumedBy", SUBSUMEDBY );
nameIndex.put( "<", SUBSUMEDBY );
nameIndex.put("><",DISJOINTFROM);
nameIndex.put("DisjointFrom",DISJOINTFROM);
nameIndex.put("Disjoint",DISJOINTFROM);
nameIndex.put("disjointFrom",DISJOINTFROM);
nameIndex.put("disjoint",DISJOINTFROM);
nameIndex.put( "InstanceOf", INSTANCEOF );
nameIndex.put( "HasInstance", HASINSTANCE );
}
if (name == null)
throw new NullPointerException("The string to search must not be null");
return nameIndex.get(name);
}
}
public void accept( AlignmentVisitor visitor) throws AlignmentException {
visitor.visit( this );
}
/**
* It is intended that the value of the relation is =, < or >.
* But this can be any string in other applications.
*/
protected String type = null;
protected Direction direction = null;
/** Creation **/
public EDOALRelation( String t ) throws AlignmentException {
direction = Direction.getRelation( t );
if ( direction == null ) throw new AlignmentException( "Unknown EDOALRelation : "+t );
type = t;
}
/** Creation **/
public EDOALRelation( Direction d ) {
type = d.toString();
direction = d;
}
/** Creation: OLD Stuff should disappear **/
public EDOALRelation( String t, Direction d ) {
direction = d;
type = t;
}
/** printable format **/
public String getRelation(){
return type;
}
/** printable format **/
public Direction getDirection(){
return direction;
}
public Relation compose(Relation r) {
String newType = null;
Direction newDirection = null;
if ( ! (r instanceof EDOALRelation) ) return null;
String rType = ((EDOALRelation)r).getRelation();
// Compose types
if ( type.startsWith("Class") ) { newType = "Class"; }
else if ( type.startsWith("Relation") ) { newType = "Relation"; }
else if ( type.startsWith("Attribute") ) { newType = "Attribute"; }
else if ( type.startsWith("Instance") ) { newType = "Instance"; }
if ( ( type.endsWith("Class") && !rType.startsWith("Class") ) ||
( type.endsWith("Relation") && !rType.startsWith("Relation") ) ||
( type.endsWith("Attribute") && !rType.startsWith("Attribute") ) ||
( type.endsWith("Instance") && !rType.startsWith("Instance") ) ){
return null;
}
if ( rType.endsWith("Class") ) { newType += "Class"; }
else if ( rType.endsWith("Relation") ) { newType += "Relation"; }
else if ( rType.endsWith("Attribute") ) { newType += "Attribute"; }
else if ( rType.endsWith("Instance") ) { newType += "Instance"; }
// Compose directions
Direction rDir = ((EDOALRelation)r).getDirection();
if ( direction == Direction.GENERIC || rDir == Direction.GENERIC ||
direction == null || rDir == null ) return null;
if ( direction == Direction.EQUIVALENCE ) { newDirection = rDir; }
else if ( direction == Direction.SUBSUMES ) {
if ( rDir == Direction.SUBSUMES || rDir == Direction.EQUIVALENCE ) {
newDirection = Direction.SUBSUMES;
} else if ( rDir == Direction.HASINSTANCE ) newDirection = Direction.HASINSTANCE;
} else if ( direction == Direction.SUBSUMEDBY ) {
if ( rDir == Direction.SUBSUMEDBY || rDir == Direction.EQUIVALENCE )
newDirection = Direction.SUBSUMEDBY;
} else if ( direction == Direction.INSTANCEOF ) {
if ( rDir == Direction.SUBSUMEDBY || rDir == Direction.EQUIVALENCE )
newDirection = Direction.INSTANCEOF;
} else if ( direction == Direction.HASINSTANCE ) {
if ( rDir == Direction.EQUIVALENCE ) newDirection = Direction.HASINSTANCE;
}
if ( newType != null && newDirection != null ) {
return new EDOALRelation( newType, newDirection );
} else return null;
}
/** By default the inverse is the relation itself **/
public Relation inverse() {
if ( type.equals("Class") ) return new EDOALRelation("Class", direction);
else if (type.equals("ClassRelation") ) return new EDOALRelation("RelationClass", direction);
else if (type.equals("ClassAttribute") ) return new EDOALRelation("AttributeClass", direction);
else if (type.equals("ClassInstance") ) return new EDOALRelation("InstanceClass", direction);
else if (type.equals("RelationClass") ) return new EDOALRelation("ClassRelation", direction);
else if (type.equals("Relation") ) return new EDOALRelation("Relation", direction);
else if (type.equals("RelationAttribute") ) return new EDOALRelation("AttributeRelation", direction);
else if (type.equals("RelationInstance") ) return new EDOALRelation("InstanceRelation", direction);
else if (type.equals("AttributeClass") ) return new EDOALRelation("ClassAttribute", direction);
else if (type.equals("AttributeRelation") ) return new EDOALRelation("RelationAttribute", direction);
else if (type.equals("Attribute") ) return new EDOALRelation("Attribute", direction);
else if (type.equals("AttributeInstance") ) return new EDOALRelation("InstanceAttribute", direction);
else if (type.equals("InstanceClass") ) return new EDOALRelation("ClassInstance", direction);
else if (type.equals("InstanceRelation") ) return new EDOALRelation("RelationInstance", direction);
else if (type.equals("InstanceAttribute") ) return new EDOALRelation("AttributeInstance", direction);
else if (type.equals("Instance") ) return new EDOALRelation("Instance", direction);
else return null;
}
/** Are the two relations equal **/
public boolean equals( Relation r ) {
if ( r instanceof EDOALRelation ){
return ( type.equals( ((EDOALRelation)r).getRelation() )
&& direction.equals( ((EDOALRelation)r).getDirection() ) );
} else {
return false;
}
}
/** Housekeeping **/
public void dump( ContentHandler h ){};
/** This is kept for displayig more correctly the result **/
public void write( PrintWriter writer ) {
writer.print(direction.toString());
}
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.7 - 2007
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.semanticweb.owl.align.Visitable;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
/**
* <p>
* This class serves as the base for the four different expression types. These
* types are namely <code>AttributeExpression</code>,
* <code>ClassExpression</code>, <code>RelationExpression</code> and
* <code>InstanceExpression</code>
* </p>
* <p>
* The only fields stored in this class is the <code>ExpressionDefinition</code>
* of this Expression and the set of condition associated with this expression.
* </p>
* <p>
* To successfully subclass this class overwrite the <code>equals</code> and
* <code>clone</code> methods. If new fields are introduced the
* <code>toString</code> and <code>hashCode</code> methods must be
* overwritten, too.
* </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/Expression.java,v $,
* @version $Revision: 1.7 $ $Date$
*/
public abstract class Expression implements Cloneable, Visitable {
protected Expression() {}
public void accept(AlignmentVisitor visitor) throws AlignmentException {
visitor.visit(this);
}
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.3 - 2006
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.net.URI;
/**
* Interface or class description
*
* @author FirstName LastName, FirstName LastName
*
* Created on 22-Mar-2005
* Committed by $Author: poettler_ric $
*
* $Source: /cvsroot/mediation/mappingapi/src/fr.inrialpes.exmo.align.impl.edoal/Id.java,v $,
* @version $Revision: 1.3 $ $Date$
*/
public interface Id {
/*
public boolean isComplexExpression(){
return false;
}
*/
/**
* Returns a plain representation of the value of this id.
* @return the plain text representation.
*/
public String plainText();
/**
* Returns a plain representation of the value of this id.
* @return the plain text representation.
*/
public URI getURI();
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.4 - 2006
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Visitable;
/**
* <p>
* Represents a InstanceExpression.
* </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/InstanceExpr.java,v $,
* @version $Revision: 1.4 $ $Date$
*/
public class InstanceExpression extends Expression {
/**
* Creates a simple InstaneExpression with the given Id.
*
* @param id
* the Id of this expression
* @throws IllegalArgumentException
* if the id isn't a InstanceId
*/
public InstanceExpression() {
super();
}
public void accept(AlignmentVisitor visitor) throws AlignmentException {
visitor.visit(this);
}
/*
public Object clone() {
return super.clone();
}
*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.4 - 2006 -- then InstanceExpr
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.net.URI;
import java.net.URISyntaxException;
/**
* A simple Id to represent a Instance.
*
* @author richi
*
*/
public class InstanceId extends InstanceExpression implements Id {
private URI uri;
public URI getURI(){
return uri;
}
public void setURI( URI u ){
uri = u;
}
/**
* Constructs a InstanceId.
*
* @param id
* the id of the class
*/
public InstanceId( final URI u ) {
if ( u == null ) {
throw new NullPointerException("The URI must not be null");
}
this.uri = u;
}
/**
* Returns the Id.
*
* @return the id.
*/
public String plainText() {
return toString();
}
/**
* <p>
* Returns a simple description of this object. <b>The format of the
* returned String is undocumented and subject to change.</b>
* <p>
* <p>
* An expamle return String could be:
* <code>instanceId: http://my/super/instance</code>
* </p>
*/
public String toString() {
return "instanceId: " + uri;
}
/*
public Object clone() {
return super.clone();
}
*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.5 - 2006
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.util.Collection;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Visitable;
/**
* <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$
*/
public abstract class PathExpression extends Expression implements Cloneable, Visitable {
public PathExpression() {
super();
}
public void accept(AlignmentVisitor visitor) throws AlignmentException {
visitor.visit(this);
}
/*
public Object clone() {
return super.clone();
}
*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.5 - 2006 - was PropertyExpr
* Copyright (C) INRIA, 2009-2010
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.util.Collection;
import java.util.HashSet;
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 org.semanticweb.owl.align.Visitable;
/**
* <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$
*/
// JE2010: Should it be abstract with RelationConjunction??
public class PropertyConstruction extends PropertyExpression {
/** Holds all expressions. */
private Collection<PathExpression> components;
/** Operator of this complex expression. */
private Constructor operator;
public PropertyConstruction() {
super();
components = new HashSet<PathExpression>();
}
public PropertyConstruction( Constructor op, Collection<PathExpression> expressions ) {
if ((expressions == null) || (op == null)) {
throw new NullPointerException("The subexpressions and the operator must not be null");
}
if (expressions.contains(null)) {
throw new IllegalArgumentException("The subexpressions must not contain null");
}
// The collection should have only relations and end in a property
// It should be ordered with comp: implement List
this.components = expressions;
if ( op != SyntaxElement.AND.getOperator() &&
op != SyntaxElement.OR.getOperator() &&
op != SyntaxElement.NOT.getOperator() &&
op != SyntaxElement.COMPOSE.getOperator() ) {
throw new IllegalArgumentException( "Incorrect operator for property : "+op );
}
this.operator = op;
}
public Constructor getOperator() {
return operator;
}
public void setOperator( Constructor op ) {
operator = op;
}
public Collection<PathExpression> getComponents() {
return components;
}
public void addComponents( PathExpression exp ) {
components.add( exp );
}
/*
public void accept(AlignmentVisitor visitor) throws AlignmentException {
visitor.visit(this);
}
*/
/*
public Object clone() {
return super.clone();
}
*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.4 - 2006 -- then DomainAttributeCondition.java
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
/**
* <p>
* Represents a domainRestriction tag for PropertyExpressions.
* </p>
* <p>
* $Id: PropertyDomainRestriction.java,v 1.4 2006/11/27 16:39:08 poettler_ric Exp $
* </p>
*
* @author Richard Pöttler
* @version $Revision: 1.4 $
* @date $Date$
*
*/
public class PropertyDomainRestriction extends PropertyRestriction {
protected ClassExpression domain;
/**
* Constructs a domainRestiction with the given restriction.
*
* @param restriction
* the restriction for the domain
* @throws NullPointerException
* if the restriction is null
*/
public PropertyDomainRestriction() {
super();
}
/**
* Constructs a domainRestiction with the given restriction.
*
* @param res
* the restriction for the domain
* @param target
* the target expression which should be restricted
* @throws NullPointerException
* if the restriction is null
*/
public PropertyDomainRestriction(final ClassExpression dom) {
super();
domain = dom;
}
public ClassExpression getDomain() {
return domain;
}
public void setDomain( ClassExpression dom ) {
domain = dom;
}
/*
public Object clone() {
return super.clone();
}
*/
}
/*
* $Id$
*
* Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck
* Sourceforge version 1.7 - 2006 -- then AttributeExpr.java
* Copyright (C) INRIA, 2009
*
* 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
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package fr.inrialpes.exmo.align.impl.edoal;
import java.util.Collection;
import java.util.Set;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Visitable;
/**
* <p>
* Represents a PropertyExpression.
* </p>
* <p>
* $Id: PropertyExpr.java,v 1.7 2006/11/30 12:21:41 poettler_ric Exp $
* </p>
*
* @author Francois Scharffe, Adrian Mocan
* @author richi
* @version $Revision: 1.7 $
* @date $Date$
*/
public abstract class PropertyExpression extends PathExpression implements Cloneable, Visitable {
/** The transformation service */
private TransfService transf;
/**
* Creates a simple PropertyExpression with the given ExpressionDefinition,
* conditions and transf.
*
* @param id
* the ExpressionDefinition
* @param conditions
* the conditions for the expression
* @param transf
* the transformation service
* @throws IllegalArgumentException
* if there are other ids than PropertyId
* @throws NullPointerException
* if the id is {@code null}
*/
public PropertyExpression() {
super();
}
public void accept(AlignmentVisitor visitor) throws AlignmentException {
visitor.visit(this);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment