neo4j: add nitunit for `Neo4jClient::nodes_with_label`
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 22 Jul 2014 03:20:58 +0000 (23:20 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 22 Jul 2014 03:21:53 +0000 (23:21 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/neo4j/neo4j.nit

index 6b3f0f3..d19ba2a 100644 (file)
@@ -246,6 +246,19 @@ class Neo4jClient
        end
 
        # Retrieve all nodes with specified `lbl`
+       #
+       #     var client = new Neo4jClient("http://localhost:7474")
+       #     #
+       #     var andres = new NeoNode
+       #     andres.labels.add_all(["Human", "Male"])
+       #     client.save_node(andres)
+       #     var kate = new NeoNode
+       #     kate.labels.add_all(["Human", "Female"])
+       #     client.save_node(kate)
+       #     #
+       #     var nodes = client.nodes_with_label("Human")
+       #     assert nodes.has(andres)
+       #     assert nodes.has(kate)
        fun nodes_with_label(lbl: String): Array[NeoNode] do
                var res = get("{base_url}/db/data/label/{lbl}/nodes")
                var nodes = new Array[NeoNode]