MCPcopy Create free account
hub / github.com/Fedict/dcattools / query

Method query

helpers/src/main/java/be/gov/data/dcat/helpers/Storage.java:388–407  ·  view source on GitHub ↗

Get the list of all URIs of a certain class. @param rdfClass @return list of subjects @throws RepositoryException

(IRI rdfClass)

Source from the content-addressed store, hash-verified

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.

Callers 1

generateCatalogMethod · 0.80

Calls 1

addMethod · 0.45

Tested by

no test coverage detected