neo4j -
Neo4j connector through its JSON REST API using curl.
In order to connect to Neo4j you need a connector:
var client = new Neo4jClient("http://neo4j:7474")
assert client.is_ok
The fundamental units that form a graph are nodes and relationships.
Nodes are used to represent entities stored in base:
var andres = new NeoNode
andres["name"] = "Andres"
# Connect the node to Neo4j
client.save_node(andres)
assert andres.is_linked
# Create a second node
var kate = new NeoNode
kate["name"] = "Kate"
client.save_node(kate)
assert kate.is_linked
Relationships between nodes are a key part of a graph database. They allow for finding related data. Just like nodes, relationships can have properties.
var loves = new NeoEdge(andres, "LOVES", kate)
client.save_edge(loves)
assert loves.is_linked
Nodes can also be loaded fron Neo4j:
var url = andres.url.to_s
var from = client.load_node(url)
assert from["name"].to_s == "Andres"
var to = from.out_nodes("LOVES").first # follow the first LOVES relationship
assert to["name"].to_s == "Kate"
For more details, see http://docs.neo4j.org/chunked/milestone/rest-api.html
Content
- neo4j (lib/neo4j)
- curl_json: cURL requests compatible with the JSON REST APIs. (lib/neo4j/curl_json.nit)
- error: Errors thrown by the
neo4j
library. (lib/neo4j/error.nit) - graph (lib/neo4j/graph)
- graph: Provides an interface for services on a Neo4j graphs. (lib/neo4j/graph/graph.nit)
- json_graph_store: Provides JSON as a mean to store graphs. (lib/neo4j/graph/json_graph_store.nit)
- sequential_id: Provides a sequential identification scheme for Neo4j nodes. (lib/neo4j/graph/sequential_id.nit)
- neo4j: Neo4j connector through its JSON REST API using curl. (lib/neo4j/neo4j.nit)