grano icon indicating copy to clipboard operation
grano copied to clipboard

Query language

Open jazzido opened this issue 11 years ago • 4 comments

Gremlin looks like a great resource to draw inspiration from.

More relevant links:

Idea: implement a subset of Gremlin. Doesn't look that hard.

jazzido avatar Mar 15 '14 16:03 jazzido

Just for the record:

-- transitive closure of the edges defined in `grano_relation`
WITH RECURSIVE search_graph(source_id, target_id, id, depth, path, cycle)
AS (
   SELECT e.source_id, e.target_id, e.id, 1,
          ARRAY[e.id],
          false
   FROM grano_relation e

   UNION ALL

   SELECT e.source_id, e.target_id, e.id, sg.depth + 1,
          path || e.id,
          e.id = ANY(path)
   FROM grano_relation e, search_graph sg
   WHERE e.source_id = sg.target_id AND NOT cycle
)

SELECT * FROM search_graph;

jazzido avatar Mar 16 '14 16:03 jazzido

I'm really interested in exploring the MQL approach and have started an extension to that end here:

https://github.com/granoproject/grano-ql

pudo avatar Jun 22 '14 21:06 pudo