- Start Neo4j Server with:
bundle exec rake neo4j:start
- Start the Application Server with:
bundle exec rails s -p 3010
- Send a POST to
http://localhost:3010/insert-data
with body:It'll persist this graph in Redis Following the strategy:{ "data": "[[\"John\",\"Is a Friend of\",\"James\"],[\"John\",\"Is a Friend of\",\"Jill\"],[\"James\",\"Is a Friend of\",\"Jesse\"],[\"James\",\"Is a Friend of\",\"Jill\"],[\"Jill\",\"Is a friend of\",\"Doug\"],[\"Jill\",\"Likes\",\"Snowboarding\"],[\"Snowboarding\",\"Is a\",\"Sport\"], [\"Doug\",\"Plays\",\"RPG\"]]" }
"subject predicate" => "object"
It'll persist this graph in Neo4j Following the strategy:subject:Type -[predicate]- object:Type
- POST:
http://localhost:3010/save-triple-to-redis
- With BODY:
{ "data": "[[\"John\",\"Is a Friend of\",\"James\"],[\"John\",\"Is a Friend of\",\"Jill\"],[\"James\",\"Is a Friend of\",\"Jesse\"],[\"James\",\"Is a Friend of\",\"Jill\"],[\"Jill\",\"Is a friend of\",\"Doug\"],[\"Jill\",\"Likes\",\"Snowboarding\"],[\"Snowboarding\",\"Is a\",\"Sport\"], [\"Doug\",\"Plays\",\"RPG\"]]" }
It'll persist this graph in Redis Following the strategy:
- "subject:predicate" => "object"
and predicate => subject:predicate:object
- POST:
http://localhost:3010/save-triple-to-neo4j
With BODY:
{"data": "[[\"John\",\"Is a Friend of\",\"James\"],[\"James\",\"Is a Friend of\",\"Jesse\"],[\"Jill\",\"Is a friend of\",\"Doug\"],[\"Jill\",\"Likes\",\"Snowboarding\"],[\"Snowboarding\",\"Is a\",\"Sport\"]]" }
It'll persist this graph in Neo4j Following the strategy:
- subject:Type -[predicate]- object:Type
The Values stored in Neo4j chan be checked via GUI
- Acess:
localhost:7474
- Run queries
MATCH (n:Person) RETURN n LIMIT 25
MATCH p=()-[r:IS_A_FRIEND_OF]->() RETURN p LIMIT 25
For testing purposes this projects abstracts a graph as an Array like:
[[subject 0, predicate 0, object 0],
[subject 1, predicate 1, object 1]]
"[[\"John\",\"Is a Friend of\",\"James\"],[\"John\",\"Is a Friend of\",\"Jill\"],[\"James\",\"Is a Friend of\",\"Jesse\"],[\"James\",\"Is a Friend of\",\"Jill\"],[\"Jill\",\"Is a friend of\",\"Doug\"],[\"Jill\",\"Likes\",\"Snowboarding\"],[\"Snowboarding\",\"Is a\",\"Sport\"], [\"Doug\",\"Plays\",\"RPG\"]]"
- You can test Querying sending a GET request to
/parse
. - You should send a SPARQL query as PARAM
query
.
- GET:
http://localhost:3010/parse?query=SELECT ?p WHERE { ?p IS_A_FRIEND_OF ?x . ?x LIKES 'Snowboarding' }
-
For the test data mentioned above, it'll return:
- John
- James
-
GET:
http://localhost:3010/parse?query=SELECT ?p WHERE { ?p IS_A_FRIEND_OF ?x . ?x PLAYS 'RPG' }
-
For the test data mentioned above, it'll return:
- Jill
-
GET:
http://localhost:3010/parse?query=SELECT ?p WHERE { ?p IS_A_FRIEND_OF ?r }
-
For the test data mentioned above, it'll return:
- Jill
- John
- James
-
GET:
http://localhost:3010/parse?query=SELECT ?p WHERE { ?p IS_A_FRIEND_OF 'Jesse' }
- For the test data mentioned above, it'll return:
- James