@Ignore @Test public final void testSubclasses() { fail("Not yet implemented"); }
@Override public Iterator<String> subclasses(String entitySearchTerm) { Map<OntResource, String> classMap = retrieve(entitySearchTerm); Map<String, String> subclasses = new HashMap<>(); for (OntResource resource : classMap.keySet()) { if (resource instanceof OntClass) { for (Iterator<?> i = ((OntClass) resource).listSubClasses(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } for (Iterator<?> i = ((OntClass) resource).listInstances(); i.hasNext(); ) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } else if (resource instanceof Individual) { for (Iterator<?> i = resource.listSameAs(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } } return subclasses.keySet().iterator(); }
LocalOntology implements Ontology { @Override public Iterator<String> subclasses(String entitySearchTerm) { Map<OntResource, String> classMap = retrieve(entitySearchTerm); Map<String, String> subclasses = new HashMap<>(); for (OntResource resource : classMap.keySet()) { if (resource instanceof OntClass) { for (Iterator<?> i = ((OntClass) resource).listSubClasses(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } for (Iterator<?> i = ((OntClass) resource).listInstances(); i.hasNext(); ) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } else if (resource instanceof Individual) { for (Iterator<?> i = resource.listSameAs(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } } return subclasses.keySet().iterator(); } }
LocalOntology implements Ontology { @Override public Iterator<String> subclasses(String entitySearchTerm) { Map<OntResource, String> classMap = retrieve(entitySearchTerm); Map<String, String> subclasses = new HashMap<>(); for (OntResource resource : classMap.keySet()) { if (resource instanceof OntClass) { for (Iterator<?> i = ((OntClass) resource).listSubClasses(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } for (Iterator<?> i = ((OntClass) resource).listInstances(); i.hasNext(); ) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } else if (resource instanceof Individual) { for (Iterator<?> i = resource.listSameAs(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } } return subclasses.keySet().iterator(); } LocalOntology(); }
LocalOntology implements Ontology { @Override public Iterator<String> subclasses(String entitySearchTerm) { Map<OntResource, String> classMap = retrieve(entitySearchTerm); Map<String, String> subclasses = new HashMap<>(); for (OntResource resource : classMap.keySet()) { if (resource instanceof OntClass) { for (Iterator<?> i = ((OntClass) resource).listSubClasses(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } for (Iterator<?> i = ((OntClass) resource).listInstances(); i.hasNext(); ) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } else if (resource instanceof Individual) { for (Iterator<?> i = resource.listSameAs(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } } return subclasses.keySet().iterator(); } LocalOntology(); Ontology getInstance(); @Override void load(); @Override void load(String[] urls); OntologyParser getParser(); static OntModel getModel(); List<String> getLoadedOntologyResources(); @Override void merge(Ontology o); @Override Iterator<String> subclasses(String entitySearchTerm); @Override Iterator synonyms(String queryKeyPhrase); void addSearchTerm(String label, OntResource resource); Map<OntResource, String> retrieve(String label); static void renderClassDescription(PrintStream out, OntClass c, int depth); }
LocalOntology implements Ontology { @Override public Iterator<String> subclasses(String entitySearchTerm) { Map<OntResource, String> classMap = retrieve(entitySearchTerm); Map<String, String> subclasses = new HashMap<>(); for (OntResource resource : classMap.keySet()) { if (resource instanceof OntClass) { for (Iterator<?> i = ((OntClass) resource).listSubClasses(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } for (Iterator<?> i = ((OntClass) resource).listInstances(); i.hasNext(); ) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } else if (resource instanceof Individual) { for (Iterator<?> i = resource.listSameAs(); i.hasNext();) { OntResource subclass = (OntResource) i.next(); for (Iterator<?> j = subclass.listLabels(null); j.hasNext();) { Literal l = (Literal) j.next(); subclasses.put(l.toString(), "1"); } } } } return subclasses.keySet().iterator(); } LocalOntology(); Ontology getInstance(); @Override void load(); @Override void load(String[] urls); OntologyParser getParser(); static OntModel getModel(); List<String> getLoadedOntologyResources(); @Override void merge(Ontology o); @Override Iterator<String> subclasses(String entitySearchTerm); @Override Iterator synonyms(String queryKeyPhrase); void addSearchTerm(String label, OntResource resource); Map<OntResource, String> retrieve(String label); static void renderClassDescription(PrintStream out, OntClass c, int depth); static final Logger LOG; static final String DELIMITER_SEARCHTERM; }