diff --git a/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java b/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java index b69294e7f6eded3c7d1a2155155487870a8617ce..013f3cb0bce16950a3d93e4685eadc507435bb86 100644 --- a/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java @@ -58,7 +58,7 @@ public class StringDistAlignment extends DistanceAlignment implements AlignmentP // Unnamed entity = max distance if ( s1 == null || s2 == null ) return 1.; Object[] params = { s1.toLowerCase(), s2.toLowerCase() }; - //if ( debug > 4 ) + if ( debug > 4 ) System.err.println( "OB:"+s1+" ++ "+s2+" ==> "+dissimilarity.invoke( null, params )); return ((Double)dissimilarity.invoke( null, params )).doubleValue(); } diff --git a/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSOntologyFactory.java b/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSOntologyFactory.java index 3bf343567cb9820c4c3ed3e3e804ca598bb03813..4d59f7e8815b70af136b80e0c17980791520383d 100644 --- a/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSOntologyFactory.java +++ b/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSOntologyFactory.java @@ -38,12 +38,13 @@ public class SKOSOntologyFactory extends OntologyFactory { private static URI formalismUri = null; private static String formalismId = "SKOS1.0"; - private static OntologyCache<SKOSOntology> cache = null; + private static OntologyCache<SKOSThesaurus> cache = null; private SKOSManager manager; private SKOSDataFactory factory; public SKOSOntologyFactory() throws OntowrapException { + cache = new OntologyCache<SKOSThesaurus>(); try { formalismUri = new URI("http://www.w3.org/2004/02/skos/core#"); } catch (URISyntaxException ex) { ex.printStackTrace(); } // should not happen @@ -56,10 +57,10 @@ public class SKOSOntologyFactory extends OntologyFactory { } @Override - public SKOSOntology newOntology( Object ontology ) throws OntowrapException { + public SKOSThesaurus newOntology( Object ontology ) throws OntowrapException { if ( ontology instanceof SKOSDataset ) { - SKOSOntology onto = null; - onto = new SKOSOntology(); + SKOSThesaurus onto = null; + onto = new SKOSThesaurus(); onto.setFormalism( formalismId ); onto.setFormURI( formalismUri ); onto.setOntology( (SKOSDataset)ontology ); @@ -75,8 +76,9 @@ public class SKOSOntologyFactory extends OntologyFactory { } @Override - public SKOSOntology loadOntology( URI uri ) throws OntowrapException { - SKOSOntology onto = null; + public SKOSThesaurus loadOntology( URI uri ) throws OntowrapException { + //System.err.println(" Loading "+uri ); + SKOSThesaurus onto = null; onto = cache.getOntologyFromURI( uri ); if ( onto != null ) return onto; onto = cache.getOntology( uri ); @@ -87,7 +89,7 @@ public class SKOSOntologyFactory extends OntologyFactory { } catch (SKOSCreationException sce) { throw new OntowrapException( "Cannot load ontology: "+uri, sce); } - onto = new SKOSOntology(); + onto = new SKOSThesaurus(); onto.setFormalism( formalismId ); onto.setFormURI( formalismUri ); onto.setOntology( dataset ); @@ -95,12 +97,13 @@ public class SKOSOntologyFactory extends OntologyFactory { onto.setFile( uri ); // This is the URI of the corresponding OWL API Ontology onto.setURI( dataset.getURI() ); - cache.recordOntology( uri, onto ); + //cache.recordOntology( uri, onto ); + return onto; } @Override - public void clearCache() { + public void clearCache() throws OntowrapException { cache.clear(); } diff --git a/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSThesaurus.java b/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSThesaurus.java index e8e6e9ccca081c2fab53a83594fb7721f2506be2..58340ae9e2184a717f13afccb5bff697cad4bb39 100644 --- a/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSThesaurus.java +++ b/src/fr/inrialpes/exmo/ontowrap/skosapi/SKOSThesaurus.java @@ -36,14 +36,17 @@ import org.semanticweb.skos.SKOSUntypedLiteral; import org.semanticweb.skos.SKOSDataProperty; import fr.inrialpes.exmo.ontowrap.BasicOntology; -import fr.inrialpes.exmo.ontowrap.LoadedOntology; +import fr.inrialpes.exmo.ontowrap.HeavyLoadedOntology; import fr.inrialpes.exmo.ontowrap.OntowrapException; -public class SKOSOntology extends BasicOntology<SKOSDataset> implements LoadedOntology<SKOSDataset>{ +public class SKOSThesaurus extends BasicOntology<SKOSDataset> implements HeavyLoadedOntology<SKOSDataset>{ SKOSDataFactory factory; - public SKOSOntology () { + private static HashSet NullSet = new HashSet(); + + public SKOSThesaurus () { + NullSet = new HashSet(); } public void setFactory( SKOSDataFactory df ){ @@ -82,7 +85,7 @@ lang = untypedLiteral.getLang(); public void getDataValues( SKOSConcept o, SKOSDataProperty p, Set<String> result ){ for ( SKOSLiteral lit : onto.getSKOSDataRelationByProperty( o, p ) ){ - result.add( lit.toString() ); + result.add( lit.getLiteral() ); } } @@ -91,8 +94,8 @@ lang = untypedLiteral.getLang(); if ( !lit.isTyped() ) { SKOSUntypedLiteral l = lit.getAsSKOSUntypedLiteral(); if ( l.hasLang() && l.getLang().equals( lang ) ) - result.add( lit.toString() ); - } + result.add( lit.getLiteral() ); + } // JE: what if typed? } } @@ -255,7 +258,8 @@ lang = untypedLiteral.getLang(); //@SuppressWarnings("unchecked") public Set<?> getDataProperties() { - return null; // null or new HashSet() + return NullSet; + // return null; // null or new HashSet() } //@SuppressWarnings("unchecked") @@ -265,17 +269,17 @@ lang = untypedLiteral.getLang(); //@SuppressWarnings("unchecked") public Set<?> getIndividuals() { - return null; + return NullSet; } //@SuppressWarnings("unchecked") public Set<?> getObjectProperties() { - return null; + return NullSet; } //@SuppressWarnings("unchecked") public Set<?> getProperties() { - return null; + return NullSet; } public boolean isClass(Object o) { @@ -335,5 +339,53 @@ lang = untypedLiteral.getLang(); o.getSKOSNarrowerConcepts( onto ) o.getSKOSNarrowerTransitiveConcepts( onto ) **/ + /* Capability methods */ + // TODO + public boolean getCapabilities( int Direct, int Asserted, int Named ) { + return false; + } + + /* Class methods */ + public Set<Object> getSubClasses( Object c, int local, int asserted, int named ) { + // TODO + return NullSet; + } + public Set<Object> getSuperClasses( Object c, int local, int asserted, int named ){ + // TODO + return NullSet; + } + public Set<Object> getProperties( Object c, int local, int asserted, int named ){ + return NullSet; + } + public Set<Object> getDataProperties( Object c, int local, int asserted, int named ){ + return NullSet; + } + public Set<Object> getObjectProperties( Object c, int local, int asserted, int named ){ + return NullSet; + } + public Set<Object> getInstances( Object c, int local, int asserted, int named ){ + return NullSet; + } + + /* Property methods */ + public Set<Object> getSubProperties( Object p, int local, int asserted, int named ){ + return NullSet; + } + public Set<Object> getSuperProperties( Object p, int local, int asserted, int named ){ + return NullSet; + } + public Set<Object> getRange( Object p, int asserted ){ + return NullSet; + } + public Set<Object> getDomain( Object p, int asserted ){ + return NullSet; + } + + /* Individual methods */ + public Set<Object> getClasses( Object i, int local, int asserted, int named ){ + return NullSet; + //return onto.getSKOSConcepts(); + } + }