-
Notifications
You must be signed in to change notification settings - Fork 0
/
InitTest.kt
30 lines (21 loc) · 994 Bytes
/
InitTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import geodes.sms.neo4j.io.GraphManager
class InitTest {
fun initTest() {
val dbUri = "bolt://localhost:7687"
val username = "neo4j"
val password = "admin"
val graphManager = GraphManager(dbUri, username, password) // init a connection with the database
val n1 = graphManager.createNode("Node1") // n1 is a node controller
val n2 = graphManager.createNode("Node1")
val n3 = graphManager.createNode("Node2")
val n4 = n1.createChild("ref", "Node4")
val n5 = n4.createChild("ref", "Node5")
graphManager.saveChanges() // commit updates to the storage
n5.createOutRef("ref2", n1) // controllers remain interactable after the commit
n1.putProperty("property", "Test property")
graphManager.saveChanges() // commit new changes
n4.remove() // remove the node 'n4' within its children (cascade delete)
graphManager.saveChanges()
graphManager.close()
}
}