- Integer parentId = QueryCache.resultURIToResource(graph, parts[0], entry, null);
- ObjectResourceIdMap<String> map = QueryCache.resultChildMap(graph, parentId, entry, null);
- if(map == null) {
- procedure.execute(graph, 0);
- if(entry != null) entry.addOrSet(graph, graph.processor, 0);
- } else {
- int result = map.getId(URIStringUtils.unescape(parts[1]));
- if(entry != null) entry.addOrSet(graph, graph.processor, result);
- procedure.execute(graph, result);
- }
+ QueryCache.runnerURIToResource(graph, parts[0], entry, null, new InternalProcedure<Integer>() {
+
+ @Override
+ public void execute(ReadGraphImpl graph, Integer parentId) throws DatabaseException {
+
+ ObjectResourceIdMap<String> map = QueryCache.resultChildMap(graph, parentId, entry, null);
+ assert(map != null);
+ int result = map.getId(URIStringUtils.unescape(parts[1]));
+ if (result == 0) {
+ ResourceNotFoundException e = new ResourceNotFoundException("No resource for URI: " + id);
+ procedure.exception(graph, e);
+ } else {
+ procedure.execute(graph, result);
+ }
+ }
+
+ @Override
+ public void exception(ReadGraphImpl graph, Throwable throwable) throws DatabaseException {
+ procedure.exception(graph, throwable);
+ }
+
+ });