Get the list of all URIs of a certain class. @param rdfClass @return list of subjects @throws RepositoryException
(IRI rdfClass)
| 386 | * @throws RepositoryException |
| 387 | */ |
| 388 | public List<IRI> query(IRI rdfClass) throws RepositoryException { |
| 389 | ArrayList<IRI> lst = new ArrayList<>(); |
| 390 | int i = 0; |
| 391 | |
| 392 | try (RepositoryResult<Statement> stmts = |
| 393 | conn.getStatements(null, RDF.TYPE, rdfClass, false)) { |
| 394 | |
| 395 | if (! stmts.hasNext()) { |
| 396 | logger.warn("No results for class {}", rdfClass.stringValue()); |
| 397 | } |
| 398 | |
| 399 | while(stmts.hasNext()) { |
| 400 | Statement stmt = stmts.next(); |
| 401 | lst.add((IRI) stmt.getSubject()); |
| 402 | i++; |
| 403 | } |
| 404 | } |
| 405 | logger.debug("Retrieved {} statements for {}", i, rdfClass.stringValue()); |
| 406 | return lst; |
| 407 | } |
| 408 | |
| 409 | /** |
| 410 | * Get a DCAT Dataset or a Distribution. |