Mentions légales du service

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

- corrected bug about creation of relations

- generalized creation of standard relations with < and >
- creation of standard relations from classname
parent 5f432768
No related branches found
No related tags found
No related merge requests found
......@@ -29,11 +29,13 @@
<p><ul compact="1">
<li>Added a <tt>parseString( String )</tt> method in <tt>AlignmentParser</tt></li>
<li>Implemented parsing of relations named by class name</li>
<li>Got rid of the property file for wordnet</li>
<li>In Server/FIPA, suppressed generated files on close()</li>
<li>In Server/FIPA, suppressed printout</li>
<li>Completely rewritten autodetection of renderers and methods in server</li>
<li>Corrected an error on "force"-ing alignment in Server/HTML (was inverted)</li>
<li>Corrected bugs in relation writing/parsing</li>
<li>Transferred the TODOs to gforge</li>
</ul></p>
......
......@@ -207,7 +207,7 @@ public class BasicAlignment implements Alignment {
// JE: Why does this not allow to create cells with ids preserved?
// This would be useful when the Alignements are cloned to preserve them
public Cell addAlignCell(Object ob1, Object ob2, String relation, double measure) throws AlignmentException {
return addAlignCell( (String)null, ob1, ob2, BasicRelation.createRelation("="), measure );
return addAlignCell( (String)null, ob1, ob2, BasicRelation.createRelation(relation), measure );
};
public Cell addAlignCell(Object ob1, Object ob2) throws AlignmentException {
......
......@@ -22,6 +22,7 @@ package fr.inrialpes.exmo.align.impl;
import fr.inrialpes.exmo.align.impl.rel.EquivRelation;
import fr.inrialpes.exmo.align.impl.rel.SubsumeRelation;
import fr.inrialpes.exmo.align.impl.rel.SubsumedRelation;
import fr.inrialpes.exmo.align.impl.rel.IncompatRelation;
import fr.inrialpes.exmo.align.impl.rel.NonTransitiveImplicationRelation;
......@@ -29,6 +30,7 @@ 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 org.xml.sax.ContentHandler;
......@@ -65,16 +67,23 @@ public class BasicRelation implements Relation
Relation relation = null;
if ( rel.equals("=") ) {
relation = new EquivRelation();
} else if ( rel.equals("<") ) {
} else if ( rel.equals("<") || rel.equals("&lt;") ) {
relation = new SubsumeRelation();
} else if ( rel.equals(">") || rel.equals("&gt;") ) {
relation = new SubsumedRelation();
} else if ( rel.equals("%") ) {
relation = new IncompatRelation();
} else if ( rel.equals("~>") ) {
} else if ( rel.equals("~>") || rel.equals("~&gt;") ) {
relation = new NonTransitiveImplicationRelation();
} else {
// I could use the class name for relation,
// this would be more extensible...
relation = new BasicRelation("=");
try {
// Create a relation from classname
Class relationClass = Class.forName(rel);
Constructor relationConstructor = relationClass.getConstructor((Class[])null);
relation = (Relation)relationConstructor.newInstance((Object[])null);
} catch ( Exception ex ) {
ex.printStackTrace();
}
};
return relation;
}
......
......@@ -24,6 +24,8 @@ import org.semanticweb.owl.align.AlignmentVisitor;
import fr.inrialpes.exmo.align.impl.BasicRelation;
import java.io.PrintWriter;
/**
* Represents an OWL subsumption relation.
*
......@@ -45,6 +47,11 @@ public class SubsumedRelation extends BasicRelation
public SubsumedRelation(){
super("<");
}
public void write( PrintWriter writer ) {
writer.print("&lt;");
}
}
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