diff --git a/src/fr/inrialpes/exmo/align/onto/BasicOntology.java b/src/fr/inrialpes/exmo/align/onto/BasicOntology.java index 1be683d135803461b02e62cdc7f3a4fd22313f70..57d23175f835cca99e6b2aabc9528bd0ee3f2546 100644 --- a/src/fr/inrialpes/exmo/align/onto/BasicOntology.java +++ b/src/fr/inrialpes/exmo/align/onto/BasicOntology.java @@ -22,11 +22,15 @@ package fr.inrialpes.exmo.align.onto; import java.net.URI; +import org.semanticweb.owl.align.AlignmentVisitor; +import org.semanticweb.owl.align.AlignmentException; + /** * Store the information regarding ontologies in a specific structure */ public class BasicOntology<O> implements Ontology<O> { + protected URI uri = null; protected URI file = null; protected URI formalismURI = null; @@ -35,6 +39,10 @@ public class BasicOntology<O> implements Ontology<O> { public BasicOntology() {}; + public void accept( AlignmentVisitor visitor) throws AlignmentException { + visitor.visit( this ); + } + public URI getURI() { return uri; } public URI getFile() { return file; } public URI getFormURI() { return formalismURI; } @@ -46,4 +54,17 @@ public class BasicOntology<O> implements Ontology<O> { public void setFormURI( URI u ) { formalismURI = u; } public void setFormalism( String name ) { formalism = name; } public void setOntology( O o ) { this.onto = o; } + + public String getFragmentAsLabel( URI u ){ + String result = u.getFragment(); + if ( result == null ) { + String suri = u.toString(); + int end = suri.length()-1; + if ( suri.charAt(end) == '/' ) end--; + int start = end-1; + for ( ; suri.charAt( start ) != '/' && start != 0 ; start-- ); + result = suri.substring( start+1, end+1 ); + } + return result; + } }