@Override
public Model getConciseBoundedDescription(Set<String> resources, int depth, boolean withTypesForLeafs) {
if (useSingleQuery) {
log.trace("Computing CBDs for {} ...", resources);
long start = System.currentTimeMillis();
ParameterizedSparqlString template = generateQueryTemplate(depth, withTypesForLeafs, true);
String query = template.toString().replace("%VALUES%", resources.stream().map(r -> "<" + r + ">").collect(Collectors.joining(" ")));
log.trace(query);
System.out.println(query);
try (QueryExecution qe = qef.createQueryExecution(query)) {
Model model = qe.execConstruct();
log.trace("Got {} triples in {} ms.", model.size(), (System.currentTimeMillis() - start));
return model;
} catch (Exception e) {
log.error("Failed to computed CBD for resources {}", resources);
throw new RuntimeException("Failed to computed CBD for resource " + resources, e);
}
} else {
return super.getConciseBoundedDescription(resources, depth, withTypesForLeafs);
}
}