Mentions légales du service

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

- added SPARQL operation for comparator

parent 119c2e8d
No related branches found
No related tags found
No related merge requests found
...@@ -28,11 +28,12 @@ import fr.inrialpes.exmo.align.impl.Namespace; ...@@ -28,11 +28,12 @@ import fr.inrialpes.exmo.align.impl.Namespace;
public class Comparator { public class Comparator {
URI uri = null; URI uri = null;
String sparql = null;
// SHOULD CERTAINLY BE AN ENUM // SHOULD CERTAINLY BE AN ENUM
public static Comparator EQUAL = initComparator( Namespace.EDOAL.prefix+"equals", 0 ); public static Comparator EQUAL = initComparator( Namespace.EDOAL.prefix+"equals", 0, "=" );
public static Comparator LOWER = initComparator( Namespace.EDOAL.prefix+"lower-than", -1 ); public static Comparator LOWER = initComparator( Namespace.EDOAL.prefix+"lower-than", -1, "<" );
public static Comparator GREATER = initComparator( Namespace.EDOAL.prefix+"greater-than", 1 ); public static Comparator GREATER = initComparator( Namespace.EDOAL.prefix+"greater-than", 1, ">" );
public static Comparator getComparator( URI u ) { public static Comparator getComparator( URI u ) {
if ( u.equals( EQUAL.getURI() ) ) { if ( u.equals( EQUAL.getURI() ) ) {
...@@ -49,13 +50,18 @@ public class Comparator { ...@@ -49,13 +50,18 @@ public class Comparator {
} }
public Comparator( URI u ) { public Comparator( URI u ) {
super(); this();
uri = u; uri = u;
} }
private static Comparator initComparator( String uri, int rank ){ public Comparator( URI u, String s ) {
this( u );
sparql = s;
}
private static Comparator initComparator( String uri, int rank, String sparql ){
try { try {
return new Comparator( new URI( uri ) ); return new Comparator( new URI( uri ), sparql );
} catch ( URISyntaxException usex ) { } catch ( URISyntaxException usex ) {
return new Comparator(); return new Comparator();
} }
...@@ -65,6 +71,10 @@ public class Comparator { ...@@ -65,6 +71,10 @@ public class Comparator {
return uri; return uri;
} }
public String getSPARQLComparator() {
return sparql;
}
public boolean equals ( Object ob ) { public boolean equals ( Object ob ) {
if ( ob == this ) return true; if ( ob == this ) return true;
else if ( !(ob instanceof Comparator) ) return false; else if ( !(ob instanceof Comparator) ) return false;
......
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