@Test public void testDO() { String doid = "1485"; String queryString = "prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" + "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + "prefix owl: <http://www.w3.org/2002/07/owl#>\n" + "\n" + "select ?s ?p ?o \n" + "from <http://purl.obolibrary.org/obo/merged/DOID>\n" + "\n" + "WHERE {\n" + " <http://purl.obolibrary.org/obo/DOID_" + doid + "> ?p ?o\n" + "}"; Query query = QueryFactory.create(queryString); QueryExecution qExe = QueryExecutionFactory.sparqlService("http://sparql.hegroup.org/sparql/", query); ResultSet results = qExe.execSelect(); ResultSetFormatter.out(System.out, results, query); assertNotNull(results); /*Model model = ModelFactory.createDefaultModel(); Selector selector = new SimpleSelector(null, model.getProperty("<http://www.geneontology.org/formats/oboInOwl#hasDbXref>"), (RDFNode) null); // you need to cast the last null as otherwise the method is ambigious */ List<String> dbXref = new ArrayList<>(); List<String> iao = new ArrayList<>(); List<String> exactSynonym = new ArrayList<>(); List<String> alternativeId = new ArrayList<>(); String diseaseLabel; while (results.hasNext()) { QuerySolution querySolution = results.nextSolution(); if (querySolution.get("p").toString().matches("rdfs:label ")) { diseaseLabel = querySolution.get("o").toString(); } if (querySolution .get("p") .toString() .matches("http://www.geneontology.org/formats/oboInOwl#hasDbXref")) { System.out.println( querySolution.get("p").toString() + " " + querySolution.get("o").toString()); dbXref.add(querySolution.get("o").toString()); } if (querySolution.get("p").toString().matches("http://purl.obolibrary.org/obo/IAO_0000115")) { System.out.println( querySolution.get("p").toString() + " " + querySolution.get("o").toString()); iao.add(querySolution.get("o").toString()); } if (querySolution .get("p") .toString() .matches("http://www.geneontology.org/formats/oboInOwl#hasExactSynonym")) { System.out.println( querySolution.get("p").toString() + " " + querySolution.get("o").toString()); exactSynonym.add(querySolution.get("o").toString()); } if (querySolution .get("p") .toString() .matches("http://www.geneontology.org/formats/oboInOwl#hasAlternativeId")) { System.out.println( querySolution.get("p").toString() + " " + querySolution.get("o").toString()); alternativeId.add(querySolution.get("o").toString()); } } assertNotNull(dbXref); assertNotNull(iao); }