/** Create a Context from content of st:param */ public Context process() { Entity ent = g.getEdges(Context.STL_PARAM).iterator().next(); if (ent == null) { return new Context(); } return process(ent.getNode(1)); }
/** * Dans le cas des chemins * * @param gNode * @param from * @param qEdge * @param env ne pas prendre en compte l'env dans le calcul des chemins * @param exp * @param src l'ensemble des * @param start noeud courant * @param index sens du parcours * @return */ @Override public Iterable<Entity> getEdges( Node gNode, List<Node> from, Edge qEdge, Environment env, Regex exp, Node src, Node start, int index) { Graph resGraph = Graph.create(); return resGraph.getEdges(); }
/** * Transforms an EDGE request into a simple SPARQL query pushed to the remote producer. Results * are returned through standard web services protocol. * * @param gNode graph variable if it exists, null otherwise * @param from "from named <g>" list * @param qEdge edge searched for * @param env query execution context (current variable values, etc.) * @return an iterator over graph entities */ @Override public Iterable<Entity> getEdges(Node gNode, List<Node> from, Edge qEdge, Environment env) { // si gNode != null et from non vide, alors "from named" // si gNode == null et from non vide alors "from" String query = getSparqlQuery(qEdge, env); Graph resGraph = Graph.create(); Graph g = Graph.create(); StopWatch sw = new StopWatch(); sw.start(); InputStream is = null; try { QueryProcess exec = QueryProcess.create(resGraph); if (query != null) { Mappings map = exec.query(query); // logger.info("Received results in " + sw.getTime()); String sparqlRes = RDFFormat.create(map).toString(); // System.out.println(XMLFormat.create(map)); if (sparqlRes != null) { Load l = Load.create(g); is = new ByteArrayInputStream(sparqlRes.getBytes()); l.load(is); // logger.info("Results (cardinality " + g.size() + ") merged in " + // sw.getTime() + " ms."); } } } catch (LoadException ex) { ex.printStackTrace(); } catch (EngineException ex) { ex.printStackTrace(); } // for (Iterator<Entity> it = g.getEdges().iterator(); it.hasNext();) { // Edge e = (Edge) it.next(); // System.out.println(e); // } // return g.getEdges(); }
public Iterable<Entity> getEdges() { Graph g = getGraph(); if (g == null) return new ArrayList<Entity>(); return g.getEdges(); }