neo4j :: Neo4jClient :: nodes_with_label
lbl
var client = new Neo4jClient("http://neo4j: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)
# Retrieve all nodes with specified `lbl`
#
# var client = new Neo4jClient("http://neo4j: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.to_percent_encoding}/nodes")
var nodes = new Array[NeoNode]
for json in res.as(JsonArray) do
var obj = json.as(JsonObject)
var node = load_node(obj["self"].to_s)
node.internal_properties = obj["data"].as(JsonObject)
nodes.add node
end
return nodes
end
lib/neo4j/neo4j.nit:210,2--234,4