From 9b7bbbb8c313dd941dbfb0faed562bf6995728cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20David?= <Jerome.David@univ-grenoble-alpes.fr> Date: Thu, 7 Oct 2010 14:38:12 +0000 Subject: [PATCH] getEntity(Uri) was returning always something. now it returns null when the uri do not correspond to a skosconcept --- .../exmo/ontowrap/skoslite/SKOSLiteThesaurus.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fr/inrialpes/exmo/ontowrap/skoslite/SKOSLiteThesaurus.java b/src/fr/inrialpes/exmo/ontowrap/skoslite/SKOSLiteThesaurus.java index a4f7b8c7..c950841c 100644 --- a/src/fr/inrialpes/exmo/ontowrap/skoslite/SKOSLiteThesaurus.java +++ b/src/fr/inrialpes/exmo/ontowrap/skoslite/SKOSLiteThesaurus.java @@ -179,7 +179,12 @@ public class SKOSLiteThesaurus implements HeavyLoadedOntology<Model> { @Override public Object getEntity(URI u) throws OntowrapException { try { - return ontoInf.getResource(u.toString()); + Object o = ontoInf.getRawModel().getResource(u.toString()); + if (! ontoInf.contains((Resource) o, RDF.type, ontoInf.getResource(SKOS_CONCEPT))) { + return null;//System.out.println(u+" : "+o); + } + + return o; } catch (Exception e) { throw new OntowrapException("No Object for URI "+u); } -- GitLab