Neo4j

Arnaud_K 2017-10-27: I created a Tcl extension wrapping the C driver for the Neo4j graph database. You can find the repository here .

Documentation

Please refer to the README file .

Usage

Basic example

package require neo4j

set db [neo4j_connect -host localhost -port 7687 -user neo4j -password "neo4j"]
set res [neo4j_query $db "MATCH (n) RETURN n LIMIT 5"]
neo4j_disconnect $db

Other features

# Named parameters
set query {MATCH (p:Person {name: $n}) RETURN p}
set res [neo4j_query $db $query n "Julio"]

# Output format
# get a list of tuples (default)
set res [neo4j_query $db $query] -llist
# get a flat list
set res [neo4j_query $db $query] -list
# mixed with named parameters:
set res [neo4j_query $db $query] -list name "Julio"

# Using transactions
neo4j_query $db "BEGIN"
if {[catch {neo4j_query $db "CREATE (:Person {name: 'Julio'})"}]} {
    puts stderr "Error !"
    neo4j_query $db "ROLLBACK"
} else {
    neo4j_query $db "COMMIT"
}

I didn't implement the TLS part. Feel free to fork, improve, make suggestions.


arjen - 2017-10-30 12:08:14

Interesting - we have recently started using Neo4j and I would love to use it from within Tcl. This seems to make that possible.