-
- @Override
- public Object compute(ReadGraphImpl graph, final InternalProcedure<TObjectIntHashMap<String>> procedure) throws DatabaseException {
- computeForEach(graph, id, this, procedure);
- return getResult();
- }
-
- public static void computeForEach(ReadGraphImpl graph, final String id, final NamespaceIndex entry, final InternalProcedure<TObjectIntHashMap<String>> procedure) throws DatabaseException {
-
- QueryProcessor processor = graph.processor;
-
-// System.err.println("NamespaceIndex " + id);
-
- if("http://".equals(id) || "http:/".equals(id)) {
- index(graph, processor.getRootLibrary(), entry, procedure);
- } else {
- final String[] parts = URIStringUtils.splitURI(id);
- if(parts != null) {
- QueryCache.runnerNamespaceIndex(graph, parts[0], entry, null, new InternalProcedure<TObjectIntHashMap<String>>() {
-
- @Override
- public void execute(ReadGraphImpl graph, TObjectIntHashMap<String> index) throws DatabaseException {
-
- if(index != null) {
- index(graph, index.get(parts[1]), entry, procedure);
- } else {
- if(entry != null) entry.add2(graph, null);
- procedure.execute(graph, null);
-// System.err.println("NamespaceIndex[" + id + "]->null");
- }
-
- }
-
- @Override
- public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException {
- if(DebugException.DEBUG) new DebugException(t).printStackTrace();
- if(entry != null) entry.except(t);
- procedure.exception(graph, t);
- }
-
- });
- } else {
- if(entry != null) entry.add2(graph, null);
- procedure.execute(graph, null);
-// System.err.println("NamespaceIndex[" + id + "]->null");
- }
-
- }
-
- }
-