From 3ba7b98e97e704e5f81f987f1ae57301214136cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandbox=20=F0=9F=A4=96?= Date: Thu, 4 May 2023 09:40:26 +0000 Subject: [PATCH] Triggered by dispatch event. Origin: https://github.com/neo4j-graph-examples/template/commit/b4dc2957032d1030fe0fb06ebf95a8947f940c0c --- code/graphql/example.js | 4 ++++ code/javascript/example.js | 2 +- code/python/example.py | 24 +++++++++++------------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/code/graphql/example.js b/code/graphql/example.js index 7b69b9b..991ca09 100644 --- a/code/graphql/example.js +++ b/code/graphql/example.js @@ -45,6 +45,7 @@ type Other { valid_until: String! intermediary_of: [Entity] @relationship(type: "intermediary_of", direction: OUT) + same_name_as: [Entity] @relationship(type: "SAME_NAME_AS", direction: OUT) } type Intermediary { @@ -55,6 +56,7 @@ type Intermediary { sourceID: String! valid_until: String! connected_to: [Entity] @relationship(type: "connected_to", direction: OUT) + same_name_as: [Entity] @relationship(type: "SAME_NAME_AS", direction: OUT) } type Officer { @@ -69,6 +71,8 @@ type Officer { @relationship(type: "registered_address", direction: OUT) officer_of: [Entity] @relationship(type: "officer_of", direction: OUT) connected_to: [Entity] @relationship(type: "connected_to", direction: OUT) + same_name_as: [Entity] @relationship(type: "SAME_NAME_AS", direction: OUT) + same_id_as: [Officer] @relationship(type: "SAME_ID_AS", direction: OUT) num_of_connected_entities: Int @cypher( statement: """ diff --git a/code/javascript/example.js b/code/javascript/example.js index f771186..65c44b9 100644 --- a/code/javascript/example.js +++ b/code/javascript/example.js @@ -3,7 +3,7 @@ const neo4j = require('neo4j-driver'); const driver = neo4j.driver('neo4j://:', neo4j.auth.basic('', ''), - {/* encrypted: 'ENCRYPTION_OFF' */}); + {}); const query = ` diff --git a/code/python/example.py b/code/python/example.py index 9b0cb9b..8361dc8 100644 --- a/code/python/example.py +++ b/code/python/example.py @@ -1,22 +1,20 @@ -# pip3 install neo4j-driver +# pip3 install neo4j # python3 example.py from neo4j import GraphDatabase, basic_auth -driver = GraphDatabase.driver( - "neo4j://:", - auth=basic_auth("", "")) - cypher_query = ''' MATCH (a:Officer {name:$name})-[r:officer_of|intermediary_of|registered_address*..10]-(b) RETURN b.name as name LIMIT 20 ''' -with driver.session(database="neo4j") as session: - results = session.read_transaction( - lambda tx: tx.run(cypher_query, - name="Ross, Jr. - Wilbur Louis").data()) - for record in results: - print(record['name']) - -driver.close() +with GraphDatabase.driver( + "neo4j://:", + auth=("", "") +) as driver: + result = driver.execute_query( + cypher_query, + name="Ross, Jr. - Wilbur Louis", + database_="neo4j") + for record in result.records: + print(record['name'])