/** * Choose a graph from a DatasetGraph. If it's the union, provide a union graph (not always the * best way to deal with union). * * @param dataset * @param graphNode * @return Graph */ protected static Graph chooseGraph(DatasetGraph dataset, Node graphNode) { if (graphNode == null) return dataset.getDefaultGraph(); else if (Var.isVar(graphNode)) throw new NotImplemented("Choosing a graph OpExecutorStage.executeBlockFilter[Variable]"); else if (graphNode == Node.ANY) throw new NotImplemented("OpExecutorMain.executeBlockFilter[Node.ANY]"); else if (Quad.isUnionGraph(graphNode)) { // TODO Check this! Work needed here to consolidate union graph handling. List<Node> graphs = Iter.toList(dataset.listGraphNodes()); return new GraphUnionRead(dataset, graphs); } else return dataset.getGraph(graphNode); }
private static TextIndex chooseTextIndex(DatasetGraph dsg) { Context c = dsg.getContext(); Object obj = dsg.getContext().get(TextQuery.textIndex); if (obj != null) { try { return (TextIndex) obj; } catch (ClassCastException ex) { Log.warn( TextQueryPF.class, "Context setting '" + TextQuery.textIndex + "'is not a TextIndex"); } } if (dsg instanceof DatasetGraphText) { DatasetGraphText x = (DatasetGraphText) dsg; return x.getTextIndex(); } Log.warn( TextQueryPF.class, "Failed to find the text index : tried context and as a text-enabled dataset"); return null; }