Created
May 25, 2013 18:03
-
-
Save rvanbruggen/5650102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
****************************************** | |
*** Some cool ConceptNet Graph Queries *** | |
****************************************** | |
*** Look up a concept in the Graph *** | |
START beer=node:Concepts(id="/c/en/beer") | |
return beer; | |
*** Figure out the relations of a concept to other concepts *** | |
START sushi=node:Concepts(id="/c/en/sushi") | |
MATCH sushi-[r]-other_concepts | |
RETURN sushi.id, TYPE(r), other_concepts.id; | |
START beer=node:Concepts(id="/c/en/beer") | |
MATCH beer-[r]-other_concepts | |
RETURN beer.id, TYPE(r), other_concepts.id; | |
*** Find ALL Shortest Paths between two concepts *** | |
START | |
sushi=node:Concepts(id="/c/en/sushi"), | |
beer=node:Concepts(id="/c/en/beer") | |
MATCH | |
p = AllShortestPaths(sushi-[*..10]-beer) | |
return p; | |
START | |
car=node:Concepts(id="/c/en/car"), | |
beer=node:Concepts(id="/c/en/beer") | |
MATCH | |
p = AllShortestPaths(car-[*..10]-beer) | |
return p; | |
START | |
wine=node:Concepts(id="/c/en/wine"), | |
beer=node:Concepts(id="/c/en/beer") | |
MATCH | |
p = AllShortestPaths(wine-[*..10]-beer) | |
return p; | |
*** Find *a* Shortest Path between two concepts *** | |
START | |
sushi=node:Concepts(id="/c/en/sushi"), | |
beer=node:Concepts(id="/c/en/beer") | |
MATCH | |
p = ShortestPath(sushi-[*..10]-beer) | |
return p; | |
START | |
car=node:Concepts(id="/c/en/car"), | |
beer=node:Concepts(id="/c/en/beer") | |
MATCH | |
p = ShortestPath(car-[*..10]-beer) | |
return p; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment