ANCIR / grano

A toolkit for mapping networks of political and economic influence through diverse types of entities and their relations. Accessible at http://granoproject.org
http://granoproject.org
MIT License
188 stars 28 forks source link

Query language #38

Open jazzido opened 10 years ago

jazzido commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

Also, RDBMS in the social networks age

pudo commented 10 years ago

Collecting stuff:

pudo commented 10 years ago

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

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