micahstubbs / blockbuilder-graph-search-ui

user interface for blockbuilder graph search
0 stars 3 forks source link

write neo4j query to return all linked blocks for a given block #27

Closed micahstubbs closed 7 years ago

micahstubbs commented 7 years ago

this query is is really close

MATCH (a)-[:LINKS_TO]-(d)
WHERE a.gistId = "6ac67b0d8ed673c9aa61"
RETURN distinct a,d

screen shot 2017-09-08 at 9 47 16 pm

screen shot 2017-09-08 at 9 47 09 pm

micahstubbs commented 7 years ago

now I wonder why the custom vis only shows 6 relationships, when we can see 15 relationships in neo4j 🤔

micahstubbs commented 7 years ago

ok, now I see why. in the current query we send back to neo4j, we only ask for the relationships between the queried node and it's 1st degree connections.

screen shot 2017-09-08 at 9 55 39 pm

micahstubbs commented 7 years ago

this tutorial is helpful https://www.airpair.com/neo4j/posts/getting-started-with-neo4j-and-cypher

micahstubbs commented 7 years ago

trying out this query that gets "friends of friends" or 2nd degree connections

MATCH (n)-[r:LINKS_TO]-(f)
WHERE n.gistId = "6ac67b0d8ed673c9aa61"
MATCH (n)-[:LINKS_TO]-()-[:LINKS_TO]-(fof)
RETURN n, fof, r

screen shot 2017-09-09 at 11 47 35 am

micahstubbs commented 7 years ago

blocked by this node dragging https://github.com/micahstubbs/blockbuilder-graph-search-ui/issues/20 right now

micahstubbs commented 7 years ago

was blocked by #29 as well, now unblocked 🎉

micahstubbs commented 7 years ago

looks better with node dragging

screen shot 2017-09-11 at 5 34 17 pm

micahstubbs commented 7 years ago

I think this is it!

match all the relationships where the destination node is the block we specify find all the friends-of-friends of the origin blocks return the origin blocks, their friends of friends, and our original one destination block as well

MATCH (n)-[r:LINKS_TO]-(f)
WHERE f.gistId = "8a173cfcb9171627c7f1"
MATCH (n)-[:LINKS_TO]-()-[:LINKS_TO]-(fof)
RETURN n, fof, f

screen shot 2017-09-11 at 6 34 03 pm

micahstubbs commented 7 years ago

now to make a better default layout