{"items":[{"tags":["python","windows","docker","neo4j"],"comments":[{"owner":{"reputation":165741,"user_id":10008173,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/bc86d913c15f3b126673faa654e9668c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"David Maze","link":"https://stackoverflow.com/users/10008173/david-maze"},"edited":false,"score":0,"creation_date":1769906400,"post_id":79880191,"comment_id":140965397,"link":"https://stackoverflow.com/questions/79880191/neo4j-graphacademy-docker-installlation-error-on-windows-modulenotfounderror-n#comment140965397_79880191"},{"owner":{"reputation":165741,"user_id":10008173,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/bc86d913c15f3b126673faa654e9668c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"David Maze","link":"https://stackoverflow.com/users/10008173/david-maze"},"edited":false,"score":0,"creation_date":1769906404,"post_id":79880191,"comment_id":140965398,"link":"https://stackoverflow.com/questions/79880191/neo4j-graphacademy-docker-installlation-error-on-windows-modulenotfounderror-n#comment140965398_79880191"},{"owner":{"reputation":35,"user_id":8365285,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/27bc25c8504ac5d64db909dcdb9b4b0c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"rnoftz","link":"https://stackoverflow.com/users/8365285/rnoftz"},"reply_to_user":{"reputation":165741,"user_id":10008173,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/bc86d913c15f3b126673faa654e9668c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"David Maze","link":"https://stackoverflow.com/users/10008173/david-maze"},"edited":false,"score":0,"creation_date":1769944327,"post_id":79880191,"comment_id":140965682,"link":"https://stackoverflow.com/questions/79880191/neo4j-graphacademy-docker-installlation-error-on-windows-modulenotfounderror-n#comment140965682_79880191"}],"answers":[{"comments":[{"owner":{"reputation":35,"user_id":8365285,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/27bc25c8504ac5d64db909dcdb9b4b0c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"rnoftz","link":"https://stackoverflow.com/users/8365285/rnoftz"},"edited":false,"score":0,"creation_date":1769977836,"post_id":79880614,"comment_id":140966176,"link":"https://stackoverflow.com/questions/79880191/neo4j-graphacademy-docker-installlation-error-on-windows-modulenotfounderror-n/79880614#comment140966176_79880614"}],"tags":[],"owner":{"reputation":91,"user_id":9335303,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/c8d3c1350d24814b549e1e2e906f4a31?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Jeremy Adams","link":"https://stackoverflow.com/users/9335303/jeremy-adams"},"comment_count":1,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1769967240,"creation_date":1769967240,"answer_id":79880614,"question_id":79880191,"share_link":"https://stackoverflow.com/a/79880614","body_markdown":"```\r\n# Start your image with a node base image\r\nFROM python\r\n# The /app directory should act as the main application directory\r\nWORKDIR /app\r\n# Copy the app package and package-lock.json file\r\nCOPY . /app\r\n\r\n# Install neo4j package including driver\r\nRUN pip install neo4j\r\n\r\n# Start the app using serve command\r\nCMD [ &quot;python&quot;, &quot;app.py&quot; ]\r\n```\r\n\r\n```\r\n$ docker build . -t test\r\n\r\n# empty db\r\n\r\n$ docker run --network=&quot;host&quot; test:latest\r\nThis is testing\r\n11:30\r\n0\r\n\r\n# I added movie data via browser to the db\r\n\r\n$ docker run --network=&quot;host&quot; test:latest\r\nThis is testing\r\n11:30\r\n171\r\n```\r\n\r\nYou need to get to the docker host network vs the bridge network.  \r\nhttps://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach","link":"https://stackoverflow.com/questions/79880191/neo4j-graphacademy-docker-installlation-error-on-windows-modulenotfounderror-n/79880614#79880614","title":"Neo4j GraphAcademy Docker Installlation Error on Windows: ModuleNotFoundError: No module named neo4j"}],"owner":{"reputation":35,"user_id":8365285,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/27bc25c8504ac5d64db909dcdb9b4b0c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"rnoftz","link":"https://stackoverflow.com/users/8365285/rnoftz"},"last_editor":{"reputation":791,"user_id":6723659,"user_type":"registered","accept_rate":86,"profile_image":"https://i.sstatic.net/ze6n1.jpg?s=256","display_name":"Nick","link":"https://stackoverflow.com/users/6723659/nick"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":68,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"accepted_answer_id":79880614,"answer_count":1,"score":1,"last_activity_date":1769967240,"creation_date":1769888361,"last_edit_date":1769948127,"question_id":79880191,"share_link":"https://stackoverflow.com/q/79880191","body_markdown":"I&#39;m trying to get a container running Python to connect to my Neo4j container in Docker.\r\n\r\nI&#39;m following the steps in the Neo4j GraphAcademy Python Installation tutorial (&lt;https://neo4j.com/docs/python-manual/current/install/&gt;) and Getting Started with Docker tutorial (&lt;https://neo4j.com/docs/operations-manual/current/docker/introduction/&gt;).  In Windows 10 on the Docker Desktop, I&#39;m getting an error when starting my container in Docker.  \r\n  \r\nI started by uninstalling/deleting all previous python and neo4j versions.  As well as deleting any environment variables associated with them.  I&#39;ve downloaded the latest versions of Python and Neo4j.  I&#39;ve installed the Python driver and installed the Neo4j image for Docker.\r\n\r\nThe Neo4j image starts with no problem in Docker.  The Neo4j browser opens and logs me in (using the default credentials per the tutorial).  The Docker starter image runs without issue as ewll.  I&#39;ve created very rudimentary Dockerfile and app.py files.\r\n\r\nI put &#39;print&#39; commands in the app.py file, so that I can see that the container is using my app.py file.\r\n\r\nAny guidance is greatly appreciated.\r\n\r\n\\--- pip freeze ---\r\n\r\nneo4j==6.1.0\r\n\r\npytz==2025.2\r\n\r\n\\--- User environment variables added to PATH ---\r\n\r\n...\\\\Python314\\\\Scripts\\\\\r\n\r\n...\\\\Python314\\\\Launcher\\\\\r\n\r\n...\\\\Python314\\\\  \r\n\r\n\\--- System environment variables - NEO4J_HOME ---\r\n\r\n...\\\\...\\neo4j-community-2025.11.2-windows\\\\\r\n\r\n  \r\n\\--- Dockerfile ---\r\n```\r\n\\# Start your image with a node base image\r\n\r\nFROM python\r\n\r\n\\# The /app directory should act as the main application directory\r\n\r\nWORKDIR /app\r\n\r\n\\# Copy the app package and package-lock.json file\r\n\r\nCOPY . /app\r\n\r\n\\# Start the app using serve command\r\n\r\nCMD \\[ &quot;python&quot;, &quot;app.py&quot; \\]\r\n\r\n```\r\n\r\n\\--- app.py ---\r\n\r\n```\r\nprint(&quot;This is testing&quot;)\r\nprint(&quot;11:30&quot;)\r\nfrom neo4j import GraphDatabase\r\n\r\ndriver = GraphDatabase.driver(\r\n  &quot;neo4j://localhost:7687&quot;,       # (1)\r\n  auth=(&quot;neo4j&quot;, &quot;##########&quot;) # (2)\r\n)\r\n\r\ndriver.verify_connectivity()\r\n\r\nrecords, summary, keys = driver.execute_query( # (1)\r\n    &quot;RETURN COUNT {()} AS count&quot;\r\n)\r\n\r\n# Get the first record\r\nfirst = records[0]      # (2)\r\n\r\n# Print the count entry\r\nprint(first[&quot;count&quot;])   # (3)\r\n```\r\n\r\n\r\n\\--- Error ---\r\n\r\n\r\n```\r\nThis is testing\r\n\r\n11:30\r\n\r\nTraceback (most recent call last):\r\n\r\n  File &quot;/app/app.py&quot;, line 3, in &lt;module&gt;\r\n\r\n    from neo4j import GraphDatabase\r\n\r\nModuleNotFoundError: No module named &#39;neo4j&#39;\r\n```","link":"https://stackoverflow.com/questions/79880191/neo4j-graphacademy-docker-installlation-error-on-windows-modulenotfounderror-n","title":"Neo4j GraphAcademy Docker Installlation Error on Windows: ModuleNotFoundError: No module named neo4j"},{"tags":["neo4j","graphql"],"owner":{"reputation":77,"user_id":5613830,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a6130c7024e8aece0796d3fd2d00c301?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Student2792","link":"https://stackoverflow.com/users/5613830/student2792"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":33,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1769115510,"creation_date":1769115510,"question_id":79874115,"share_link":"https://stackoverflow.com/q/79874115","body_markdown":"I have a Docker Compose setup with Redis, Neo4j, and a Node.js service. This setup used to work, but now Docker refuses to start my web container because the Neo4j container is marked as unhealthy.\r\n\r\nDocker error:\r\n\r\n```dependency failed to start: container hierarchy-service-neo4j-1 is unhealthy```\r\n\r\n\r\nWhen I try to start the web container manually, I get this error:\r\n```\r\nNeo4jError: Failed to connect to server.\r\nPlease ensure that your database is listening on the correct host and port\r\nand that you have compatible encryption settings both on Neo4j server and driver.\r\nNote that the default encryption setting has changed in Neo4j 4.0.\r\n\r\nCaused by: connect ECONNREFUSED 172.18.0.3:7687\r\n```\r\n\r\nDocker compose file:\r\n```\r\nservices:\r\n  redis:\r\n    image: redis/redis-stack\r\n    ports:\r\n      - &quot;6380:6380&quot;\r\n    environment:\r\n      REDIS_ARGS: --appendonly yes --port 6380\r\n    volumes:\r\n      - ./redisdata:/data\r\n    restart: always\r\n\r\n  neo4j:\r\n    image: neo4j:latest\r\n    ports:\r\n      - &quot;7474:7474&quot;\r\n      - &quot;7687:7687&quot;\r\n    environment:\r\n      - NEO4J_AUTH=neo4j/password\r\n      - NEO4J_PLUGINS=[&quot;apoc&quot;]\r\n    volumes:\r\n      - ./neo4j_db/data:/data\r\n      - ./neo4j_db/logs:/logs\r\n    restart: always\r\n    healthcheck:\r\n      test: wget http://localhost:7474 || exit 1\r\n      interval: 1s\r\n      timeout: 10s\r\n      retries: 20\r\n      start_period: 3s\r\n\r\n  web:\r\n    build:\r\n      context: .\r\n      dockerfile: Dockerfile\r\n    depends_on:\r\n      redis:\r\n        condition: service_started\r\n      neo4j:\r\n        condition: service_healthy\r\n    ports:\r\n      - &quot;4001:4001&quot;\r\n    env_file:\r\n      - .env\r\n    environment:\r\n      - REDIS_URL=redis://redis:6380\r\n      - NEO4J_URI=bolt://neo4j:7687\r\n```\r\n\r\nWhat is the correct way to debug and fix this?","link":"https://stackoverflow.com/questions/79874115/docker-compose-neo4j-container-is-unhealthy-and-app-fails-with-econnrefused-on-b","title":"Docker Compose Neo4j container is unhealthy and app fails with ECONNREFUSED on Bolt port 7687"},{"tags":["database","elasticsearch","neo4j","cypher","full-text-search"],"owner":{"reputation":1,"user_id":32116662,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a23de98ab4503b4f79d38a75dc6132d5?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"yo brr","link":"https://stackoverflow.com/users/32116662/yo-brr"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":106,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1770225900,"creation_date":1766992661,"question_id":79856598,"share_link":"https://stackoverflow.com/q/79856598","body_markdown":"here i got :\r\n\r\n- **Elasticsearch** stores most of the searchable / document-like data (text fields, city, etc.)\r\n\r\n- **Neo4j** stores relationships and some entity attributes (e.g., gender, graph connections)\r\n\r\nEach entity exists in both systems and is linked by a shared `eid`.\r\n\r\nCurrently, I query Elasticsearch using `apoc.es.getRaw()` from Neo4j to retrieve matching documents, then match the returned `eid`s back to Neo4j nodes for further filtering and graph traversal.\r\n\r\n**The problem:**  \r\nSome filters exist only in Neo4j (e.g., `gender`), while others exist only in Elasticsearch (e.g., `city`).  \r\nFor example, when searching for **“males living in Shiraz”**, Elasticsearch may return thousands of documents for `city = Shiraz`, but only a small subset match `gender = male` in Neo4j. This results in inefficient queries because large ES result sets must be processed just to find a small valid subset.\r\n\r\n**Question:**  \r\nIs there any recommended or established pattern to efficiently handle this kind of cross-database filtering between Neo4j and Elasticsearch?\r\n\r\nSpecifically:\r\n\r\n- Is there a way to push Neo4j filters into Elasticsearch queries?\r\n\r\n- Are there known architectural patterns for “joining” or synchronizing filters between the two systems?\r\n\r\n- How do people typically avoid scanning large Elasticsearch result sets when part of the filter logic lives in Neo4j?\r\n\r\nps : I am aware that real-time joins are not natively supported ","link":"https://stackoverflow.com/questions/79856598/efficient-search-across-elasticsearch-and-neo4j-without-pulling-large-result-set","title":"Efficient Search Across Elasticsearch and Neo4j Without Pulling Large Result Sets"},{"tags":["database","graph","neo4j","cypher","neo4j-desktop"],"answers":[{"tags":[],"owner":{"reputation":311,"user_id":1820471,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/926ee773dc9fce7219f479e33b0d2c95?s=256&d=identicon&r=PG","display_name":"Capo Mestre","link":"https://stackoverflow.com/users/1820471/capo-mestre"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1764327643,"creation_date":1764327643,"answer_id":79832486,"question_id":79831981,"share_link":"https://stackoverflow.com/a/79832486","body_markdown":"The solution:\r\n\r\nNeo4j Desktop version 2 is only compatible with Neo4j v5 and newer.\r\n\r\nNeo4j Desktop version 1 should be instead downloaded from [https://neo4j.com/deployment-center/?desktop-gdb](https://neo4j.com/deployment-center/?desktop-gdb &quot;https://neo4j.com/deployment-center/?desktop-gdb&quot;)&#160;. Then creating a project with a DBMS with version 4.3.6 solved the issue.\r\n\r\n  \r\nMore details here: https://reactome.org/dev/graph-database/neo4j-desktop","link":"https://stackoverflow.com/questions/79831981/neo4j-has-issues-with-loading-reactome-graph-database/79832486#79832486","title":"Neo4j has issues with loading Reactome Graph Database"},{"tags":[],"owner":{"reputation":11296,"user_id":9690090,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/65ff21259cfecb89c52daf873a478e65?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Gwang-Jin Kim","link":"https://stackoverflow.com/users/9690090/gwang-jin-kim"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1766332017,"creation_date":1766332017,"answer_id":79852321,"question_id":79831981,"share_link":"https://stackoverflow.com/a/79852321","body_markdown":"On which OS are you working right now? Windows? MacOS? Linux?\r\n\r\nDo you have Docker already installed and running?\r\n\r\nBecause with Docker, it would just a one-liner to have reactome Graph Database running with Docker:\r\n\r\n```\r\ndocker run -p 7474:7474 -p 7687:7687 \\\r\n  -e NEO4J_dbms_memory_heap_maxSize=8g \\\r\n  public.ecr.aws/reactome/graphdb:latest\r\n```","link":"https://stackoverflow.com/questions/79831981/neo4j-has-issues-with-loading-reactome-graph-database/79852321#79852321","title":"Neo4j has issues with loading Reactome Graph Database"}],"owner":{"reputation":311,"user_id":1820471,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/926ee773dc9fce7219f479e33b0d2c95?s=256&d=identicon&r=PG","display_name":"Capo Mestre","link":"https://stackoverflow.com/users/1820471/capo-mestre"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":65,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":2,"score":1,"last_activity_date":1766332017,"creation_date":1764265921,"question_id":79831981,"share_link":"https://stackoverflow.com/q/79831981","body_markdown":"I have been trying to start exploring the Reactome Graph Database today following the instructions given at https://reactome.org/dev/graph-database#GetStarted\r\n\r\nI have installed Neo4j Desktop 2 (version 2.0.5)\r\nI have installed Java Runtime Environment v.25\r\nMacOS version 26.1\r\n\r\nI have downloaded from Reactome the file: \r\nreactome.graphdb.dump\r\n\r\nI have also a folder:\r\ngraph.db\r\n\r\nIn Neo4j Desktop, I have created an instance called ‘Reactome&#39;, and opened/imported the database from the dump-file.\r\n\r\nIn a newly created Neo4j data folder, I have located the file ’neo4j.conf’ and added the following lines there:\r\n\r\n```\r\ndbms.default_database=reactome.graphdb\r\n\r\ndbms.recovery.fail_on_missing_files=false\r\n\r\nunsupported.dbms.tx_log.fail_on_corrupted_log_files=false\r\n```\r\n\r\nI have made sure that both the dump-file and the folder graph.db are in the subfolder &#39;path/to/neo4j/data/databases/&#39;\r\n\r\nWhen I try to explore the Reactome Graph Database in Neo4j Desktop App, I get the following error:\r\n\r\n```Please reload the application, if the problem persist please contact Neo4j Support. Error: {&quot;type&quot;:&quot;ERROR.NODATABASEACCESS”}```\r\n\r\nimage.png\r\n\r\nI have also tried the Web Browser (Safari) by going to the link:\r\nhttp://localhost:7474/browser/\r\n\r\nThe Reactome.graphdb seems to have been recognized as judged from the top bar of the page, where I can also see the version of Cypher (v.5):\r\n\r\nimage.png\r\n\r\nHere is the screenshot of the upper half of the browser page, where the error can be seen too when trying to run a Cypher query:\r\n\r\nimage.png\r\n[![enter image description here][1]][1]\r\n\r\n\r\nI am writing to you because essentially I am not sure what else I can try, and therefore heavily relying on your support.\r\n\r\nAny input would be appreciated.\r\n\r\n\r\n  [1]: https://i.sstatic.net/lbOlV79F.png","link":"https://stackoverflow.com/questions/79831981/neo4j-has-issues-with-loading-reactome-graph-database","title":"Neo4j has issues with loading Reactome Graph Database"},{"tags":["neo4j","cypher","nodes"],"owner":{"reputation":41,"user_id":15893957,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/e7b0e236852159647280879f0a68ee74?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"ShirMarom13","link":"https://stackoverflow.com/users/15893957/shirmarom13"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":86,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1763902735,"creation_date":1763902735,"question_id":79827880,"share_link":"https://stackoverflow.com/q/79827880","body_markdown":"I&#39;ve been trying to find the best (easiest to adjust and modify, and most efficient) way to implement and find an OR relation between Neo4j graph relations.\r\n\r\nFor reference - my Neo4j DB can contain **millions** of nodes and relations.\r\n\r\nFor example, I want to see the results attached here:\r\n\r\n![example graph](https://i.sstatic.net/8HWZM5TK.png &quot;example query&quot;)\r\n\r\n`[s:School]-[:HAS]-&gt;(c:Classroom)-[:CONTAINS]-&gt;(w:Whiteboard) AND (c)-[:CONTAINS]-&gt;(t:Table)`\r\n\r\nOR\r\n\r\n`[s:School]-[:HAS]-&gt;(g:Gym)-[:CONTAINS]-&gt;(f:Football)`\r\n\r\nI&#39;ve come up with this query that seems to work, but it seems to have a couple of issues (correct me if i&#39;m wrong):\r\n\r\n```\r\n// Part 1: Filter all relevant schools\r\nMATCH (s:School)\r\nWHERE\r\n  (\r\n    EXISTS {\r\n       MATCH (s)-[:HAS]-&gt;(c:Classroom)\r\n       MATCH (c)-[:CONTAINS]-&gt;(w:Whiteboard)\r\n       MATCH (c)-[:HAS]-&gt;(t:Table)\r\n    }\r\n    \r\n    OR \r\n\r\n    EXISTS {\r\n        MATCH (s)-[:HAS]-&gt;(g:Gym)&lt;-[:CONTAINS]-(f:Football)\r\n        }\r\n    }\r\n  )\r\n\r\n// Part 2: Stitch all relevant paths to return all the nodes and relations besides schools\r\n\r\nWITH s,\r\n\r\n  [p = (s)-[:HAS]-&gt;(:Gym)&lt;-[:CONTAINS]-(:Football) \r\n   WHERE all(n in nodes(p) WHERE n.temp IS NULL OR NOT n.temp) | p] AS gym_paths,\r\n\r\n  [p = (s)-[:HAS]-&gt;(c:Classroom)-[:CONTAINS]-&gt;(:Whiteboard) \r\n   WHERE EXISTS { MATCH (c)-[:CONTAINS]-&gt;(:Table) }\r\n   AND all(n in nodes(p) WHERE n.temp IS NULL OR NOT n.temp) | p] AS classroom_whiteboard_paths,\r\n\r\n  [p = (s)-[:HAS]-&gt;(c:Classroom)-[:CONTAINS]-&gt;(:Table)\r\n   WHERE EXISTS { MATCH (c)-[:CONTAINS]-&gt;(:Whiteboard) }\r\n   AND all(n in nodes(p) WHERE n.temp IS NULL OR NOT n.temp) | p] AS classroom_table_paths\r\n\r\nWITH s, (gym_paths + classroom_whiteboard_paths + classroom_table_paths) AS all_paths\r\n\r\nUNWIND all_paths AS path\r\nRETURN s, path\r\n```\r\n\r\n1. The initial match (of schools) can return thousands and even ten thousands of results. The DB must find all possible paths for a single `School` node, collect them into an in-memory list variable, and only then proceed to the next step - which has a high memory cost.\r\n\r\n2. The database may be calculating the same underlying path patterns multiple times: once in the first part for filtering, and again in the second part for stitching.\r\n\r\n3. Placing a `WHERE EXISTS` inside a list comprehension forces the database to perform the expensive existence check for every potential path before deciding whether to include it in the list.\r\n\r\nOn the other hand, it seems that using UNION might also be problematic in terms of scalability and also performance -the more OR relations we add to the query (and we currently don&#39;t plan on limiting the number of OR a query can include, but we might if we have no better option), the more complex it becomes.\r\n\r\nAny idea and/or approach is welcome.\r\n\r\nThanks!","link":"https://stackoverflow.com/questions/79827880/cypher-best-practice-to-find-or-between-relations","title":"Cypher - best practice to find OR between relations"},{"tags":["java","neo4j","spring-data-neo4j"],"answers":[{"tags":[],"owner":{"reputation":8282,"user_id":2650436,"user_type":"registered","accept_rate":80,"profile_image":"https://www.gravatar.com/avatar/34ecacd077244d141a23c46ea094df5c?s=256&d=identicon&r=PG","display_name":"meistermeier","link":"https://stackoverflow.com/users/2650436/meistermeier"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1764150332,"creation_date":1764150332,"answer_id":79830532,"question_id":79827307,"share_link":"https://stackoverflow.com/a/79830532","body_markdown":"First of all: Spring Data Neo4j only works with the `@Node` entities for repositories and `Neo4jTemplate` operations. The `@RelationshipProperties` are not meant to be fetched on their own but e.g. via an `Airport` in you case.   \r\nAs far as I can see the `Airport` class is also missing a `@Relationship` (or two for both directions) definition completely. For now just assume that you have a definition like\r\n\r\n```java\r\n@Relationship(type = &quot;LINE&quot;, direction = Relationship.Direction.INCOMING)\r\nList&lt;Line&gt; incomingFlights;\r\n@Relationship(type = &quot;LINE&quot;, direction = Relationship.Direction.OUTGOING)\r\nList&lt;Line&gt; outgoingFlights;\r\n```\r\n\r\nThen you would use an `AirportRepository` to fetch the `Airports` and iterate over their `Lines`.  \r\nIf you&#39;re really just interested in the `Lines` w/o any information about start and end node, I would suggest using the `Neo4jClient` which is also part of Spring Data Neo4j but is unaware of the metamodel defined via the annotations.\r\n\r\n```java\r\nneo4jClient.query(&quot;&quot;&quot;\r\n\t   MATCH (origin:Airport)-[r:LINE]-&gt;(destination:Airport)\r\n\t   WHERE id(origin) &lt; id(destination)\r\n\t   RETURN r, destination\t\r\n\t\t&quot;&quot;&quot;)\r\n\t\t.fetchAs(Line.class)\r\n\t\t.mappedBy((typeSystem, record) -&gt; {\r\n\t\t\tvar lineRelationship = record.get(&quot;r&quot;).asRelationship();\r\n\t\t\t// populate and return line\r\n\t\t})\r\n\t\t.all();\r\n```\r\n\r\nI am explicitly ignoring the `destination` in this example because if you would also be interested in this, you could use a `AirportRepository extends Neo4jRepository&lt;Airport, Long&gt;` and your Java object graph traversal with the returned `Airport` .  \r\nLast but not least, if you want to put this query into an `AirportRepository`, you should not return `r, destination` but `collect(r), destination`. This will create an array to attach to the destination airport for each record. The original query will yield a record for each line/destination combination and thus leave you in the end with just a single `Line` (SDN will overwrite the relationships in the Java collection with the last record)","link":"https://stackoverflow.com/questions/79827307/get-a-list-of-relationships-from-neo4j-repository-using-spring/79830532#79830532","title":"Get a list of relationships from Neo4J repository using Spring"}],"owner":{"reputation":1,"user_id":15498699,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/e02aa7043d9c1b8d820b04a4d0b43d70?s=256&d=identicon&r=PG","display_name":"Quaky","link":"https://stackoverflow.com/users/15498699/quaky"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":70,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1764150332,"creation_date":1763813465,"question_id":79827307,"share_link":"https://stackoverflow.com/q/79827307","body_markdown":"I started learning the development of REST API using Spring and Neo4J. I am unable to understand how Repositories work, even I looked to the documentation.\r\n\r\nI have Airport node and LINE relationship. There are stored both-way lines between two airports in the Neo4J databse. I would like to obtain all relationships between all airports. How can I do that? I tried this query. It returns correct number of instances of Line class, but all attributes are null. What am I doing wrong?\r\n\r\nThis is `AirportNode` class:\r\n\r\n```Java\r\n@Node(&quot;Airport&quot;)\r\n@NoArgsConstructor\r\n@AllArgsConstructor\r\n@Getter\r\n@Setter\r\npublic class AirportNode implements Serializable {\r\n\r\n    /**\r\n     * The unique identifier for the airport node in Neo4J.\r\n     */\r\n    @Id\r\n    @GeneratedValue\r\n    private Long id;\r\n\r\n    /**\r\n     * The relational database ID corresponding to this airport.\r\n     * This links the Neo4j node to its counterpart in a relational database.\r\n     */\r\n    @Property(&quot;relational_id&quot;)\r\n    private Long relationalId;\r\n\r\n    /**\r\n     * IATA code of the airport (3-letter code).\r\n     * This is a unique identifier for the airport according to the International Air Transport Association standard.\r\n     */\r\n    @Property(&quot;code&quot;)\r\n    private String code;\r\n\r\n    @Property(&quot;name&quot;)\r\n    private String name;\r\n\r\n    @Property(&quot;country&quot;)\r\n    private String country;\r\n\r\n    @Property(&quot;zone&quot;)\r\n    private String zone;\r\n\r\n    @Property(&quot;latitude&quot;)\r\n    private Double latitude;\r\n\r\n    @Property(&quot;longitude&quot;)\r\n    private Double longitude;\r\n/// Getters, Setters, ctors\r\n}\r\n```\r\n\r\nThis is `Line` class:\r\n\r\n```Java\r\n@RelationshipProperties\r\n@Getter\r\n@Setter\r\npublic class Line {\r\n\r\n    /**\r\n     * The unique identifier for this relationship in Neo4J.\r\n     */\r\n    @Id\r\n    @GeneratedValue\r\n    private Long id;\r\n\r\n    /**\r\n     * The destination airport that this line connects to.\r\n     */\r\n    @TargetNode\r\n    private AirportNode destination;\r\n\r\n    @Property(name=&quot;distance&quot;)\r\n    private Double distance;\r\n\r\n    @Property(name=&quot;relational_id&quot;)\r\n    private Long relationalId;\r\n\r\n// getters, setters, ctors\r\n}\r\n```\r\n\r\nThis is the `LineRepository` with the query:\r\n\r\n```Java\r\npublic interface LineRepository extends Neo4JRepository&lt;Line, Long&gt; {\r\n    @Query(&quot;&quot;&quot;\r\n        MATCH (origin:Airport)-[r:LINE]-&gt;(destination:Airport)\r\n        WHERE id(origin) &lt; id(destination)\r\n        RETURN r, destination\r\n    &quot;&quot;&quot;)\r\n    List&lt;Line&gt; findAllLines();\r\n}\r\n```","link":"https://stackoverflow.com/questions/79827307/get-a-list-of-relationships-from-neo4j-repository-using-spring","title":"Get a list of relationships from Neo4J repository using Spring"},{"tags":["neo4j","cypher"],"answers":[{"comments":[{"owner":{"reputation":166,"user_id":12794739,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AAuE7mBooQ8qS_p4zWSvsnqOj37myuTJaXCAl8CXYkhWnA=k-s256","display_name":"AFatNiBBa","link":"https://stackoverflow.com/users/12794739/afatnibba"},"edited":false,"score":0,"creation_date":1763075387,"post_id":79819491,"comment_id":140853346,"link":"https://stackoverflow.com/questions/79819364/how-to-specify-more-than-two-relationships-to-the-same-node-in-a-merge/79819491#comment140853346_79819491"},{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"reply_to_user":{"reputation":166,"user_id":12794739,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AAuE7mBooQ8qS_p4zWSvsnqOj37myuTJaXCAl8CXYkhWnA=k-s256","display_name":"AFatNiBBa","link":"https://stackoverflow.com/users/12794739/afatnibba"},"edited":false,"score":1,"creation_date":1763117415,"post_id":79819491,"comment_id":140853979,"link":"https://stackoverflow.com/questions/79819364/how-to-specify-more-than-two-relationships-to-the-same-node-in-a-merge/79819491#comment140853979_79819491"},{"owner":{"reputation":166,"user_id":12794739,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AAuE7mBooQ8qS_p4zWSvsnqOj37myuTJaXCAl8CXYkhWnA=k-s256","display_name":"AFatNiBBa","link":"https://stackoverflow.com/users/12794739/afatnibba"},"edited":false,"score":0,"creation_date":1763148289,"post_id":79819491,"comment_id":140854887,"link":"https://stackoverflow.com/questions/79819364/how-to-specify-more-than-two-relationships-to-the-same-node-in-a-merge/79819491#comment140854887_79819491"},{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"reply_to_user":{"reputation":166,"user_id":12794739,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AAuE7mBooQ8qS_p4zWSvsnqOj37myuTJaXCAl8CXYkhWnA=k-s256","display_name":"AFatNiBBa","link":"https://stackoverflow.com/users/12794739/afatnibba"},"edited":false,"score":0,"creation_date":1763395892,"post_id":79819491,"comment_id":140858646,"link":"https://stackoverflow.com/questions/79819364/how-to-specify-more-than-two-relationships-to-the-same-node-in-a-merge/79819491#comment140858646_79819491"},{"owner":{"reputation":166,"user_id":12794739,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AAuE7mBooQ8qS_p4zWSvsnqOj37myuTJaXCAl8CXYkhWnA=k-s256","display_name":"AFatNiBBa","link":"https://stackoverflow.com/users/12794739/afatnibba"},"edited":false,"score":0,"creation_date":1763656892,"post_id":79819491,"comment_id":140864751,"link":"https://stackoverflow.com/questions/79819364/how-to-specify-more-than-two-relationships-to-the-same-node-in-a-merge/79819491#comment140864751_79819491"}],"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"last_editor":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":5,"down_vote_count":0,"up_vote_count":2,"is_accepted":true,"score":2,"last_activity_date":1763117375,"last_edit_date":1763117375,"creation_date":1763073045,"answer_id":79819491,"question_id":79819364,"share_link":"https://stackoverflow.com/a/79819491","body_markdown":"In order to create three relationships connecting three existing nodes to a new node with label `W` — but only if those nodes are not already so connected — you can do it using `CREATE`:\r\n```lang-cypher\r\nMATCH (a:X { id: 1 }), (b:Y { id: 2 }), (c:Z { id: 4 })\r\n  WHERE NOT EXISTS { (a)-[:HAS]-&gt;(d:W)&lt;-[:HAS]-(b), (d)&lt;-[:HAS]-(c) }\r\nCREATE (a)-[:HAS]-&gt;(d:W)&lt;-[:HAS]-(b), (d)&lt;-[:HAS]-(c)\r\n```\r\nIf the pattern in `NOT EXISTS` already exists, then `MATCH` produces no rows for `CREATE` to execute over i.e. nothing is created. ","link":"https://stackoverflow.com/questions/79819364/how-to-specify-more-than-two-relationships-to-the-same-node-in-a-merge/79819491#79819491","title":"How to specify more than two relationships to the same node in a `MERGE`"}],"owner":{"reputation":166,"user_id":12794739,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AAuE7mBooQ8qS_p4zWSvsnqOj37myuTJaXCAl8CXYkhWnA=k-s256","display_name":"AFatNiBBa","link":"https://stackoverflow.com/users/12794739/afatnibba"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":88,"favorite_count":0,"down_vote_count":0,"up_vote_count":2,"accepted_answer_id":79819491,"answer_count":1,"score":2,"last_activity_date":1763117375,"creation_date":1763062708,"question_id":79819364,"share_link":"https://stackoverflow.com/q/79819364","body_markdown":"I have this situation\r\n```cypher\r\nCREATE (a:X { id: 1 })\r\nCREATE (b:Y { id: 2 })\r\nCREATE (c:Z { id: 3 })\r\nCREATE (:Z { id: 4 })\r\nCREATE (a)-[:HAS]-&gt;(d:W { id: 5 })&lt;-[:HAS]-(b)\r\nCREATE (c)-[:HAS]-&gt;(d)\r\n```\r\n[![Initial situation][1]][1]\r\n\r\nAnd I want to run this query\r\n```cypher\r\nMATCH (a:X { id: 1 })\r\nMATCH (b:Y { id: 2 })\r\nMATCH (c:Z { id: 4 }) // The one with no relationships yet\r\nMERGE (a)-[:HAS]-&gt;(d:W)&lt;-[:HAS]-(b), (d)&lt;-[:HAS]-(c)\r\nON CREATE SET d.id = 6\r\n```\r\nThe problem is that I&#39;m not allowed to put more than one path in a single `MERGE`, how can I do this?\r\n\r\nThis is the result I want to achieve\r\n\r\n[![Expected result][2]][2]\r\n\r\nNotice that I can&#39;t just do this\r\n```cypher\r\nMATCH (a:X { id: 1 })\r\nMATCH (b:Y { id: 2 })\r\nMATCH (c:Z { id: 4 })\r\nMERGE (a)-[:HAS]-&gt;(d:W)&lt;-[:HAS]-(b) // This path already exists, but it uses the other `Z`\r\nON CREATE SET d.id = 6\r\nMERGE (d)&lt;-[:HAS]-(c) // Separate merge\r\n```\r\nBecause the result would be\r\n\r\n[![What I don&#39;t want][3]][3]\r\n\r\n\r\n  [1]: https://i.sstatic.net/9ncPFLqK.png\r\n  [2]: https://i.sstatic.net/Ae3Rg48J.png\r\n  [3]: https://i.sstatic.net/7AnLy7Ye.png","link":"https://stackoverflow.com/questions/79819364/how-to-specify-more-than-two-relationships-to-the-same-node-in-a-merge","title":"How to specify more than two relationships to the same node in a `MERGE`"},{"tags":["neo4j","cypher"],"answers":[{"tags":[],"owner":{"reputation":56,"user_id":31871396,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/62df1bb179ed9b3a091f4125ea357921?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Hannes Voigt","link":"https://stackoverflow.com/users/31871396/hannes-voigt"},"comment_count":0,"down_vote_count":0,"up_vote_count":5,"is_accepted":true,"score":5,"last_activity_date":1763037932,"creation_date":1763037932,"answer_id":79818882,"question_id":79818753,"share_link":"https://stackoverflow.com/a/79818882","body_markdown":"**TL;DR** It is correct behavior. The two aggregations are not the same, since the first is without a grouping key and the second is with a grouping key.\r\n\r\n# UNWIND and COLLECT semantics\r\n\r\nTwo things:\r\n\r\n1. `UNWIND list AS elt` removes a row who&#39;s `list` is the empty list\r\n\r\n2. `COLLECT(elt)` produce the empty list, if there are no rows in the table that get aggregated.\r\n\r\nNotice how the behavior is symmetric. One operation if the inverse of the other.\r\n\r\n```\r\nCYPHER 25\r\nLET list = [1, 2, 3]\r\nUNWIND list AS elt\r\nRETURN COLLECT(elt) AS list\r\n```\r\n\r\nproduces the same list that is initially set in `LET` — empty or not.\r\n\r\nBTW: In Cypher 5 it is the same:\r\n\r\n```\r\nCYPHER 5\r\nWITH [1, 2, 3] AS list\r\nUNWIND list AS elt\r\nRETURN COLLECT(elt) AS list\r\n```\r\n\r\nNote that `UNWIND` and `COUNT` have the same symmetry.\r\n\r\n# Aggregation with and without grouping keys\r\n\r\nIn aggregation, there are two possible situations:\r\n\r\n1. If there are no grouping keys, then you get a total aggregate of the whole table\r\n\r\n2. If there are grouping keys, then you get an aggregate per group\r\n\r\nGrouping keys are all columns without an aggregation function in the projection expression, i.e. in\r\n\r\n```\r\nWITH la, collect(b) AS lb\r\n```\r\n\r\n`la` is a grouping key.\r\n\r\nA group is constituted by all row that have the same value in all grouping key columns. Consequently, there has to be at least one row to constitute a group and hence groups can&#39;t be empty.\r\n\r\nSo, the `COLLECT` in an aggregation with grouping keys never aggregate over an empty table, since groups are never empty. The whole table may be empty, but that just means that there are no groups at all. Consequently, `COLLECT` never produces an empty list in an aggregation with grouping keys. `COLLECT` can only produce an empty list in a total aggregation.\r\n\r\nSimilarly and by the very same argument, `COUNT` never produces `0` in an aggregation with grouping keys and `COUNT` can only produce an empty list in a total aggregation.\r\n\r\nFor total aggregation the group behavior can be simulated with a constant grouping key, e.g.:\r\n\r\n```\r\nCYPHER 25\r\nUNWIND [] AS elt\r\nRETURN 1 AS _foo, COLLECT(elt) AS list\r\n```\r\n\r\nSimulating the total behavior for groups, requires collecting the group values and unwinding them in a subquery like this:\r\n\r\n```\r\nCYPHER 25\r\nUNWIND [{a: 1, b: 2}, {a: 1, b: 3}, {a: 2, b: null}] AS row\r\nWITH row.a AS a, row.b AS b\r\n// here after the table looks like this:\r\n// ╒═╤════╕\r\n// │a│b   │\r\n// ╞═╪════╡\r\n// │1│2   │\r\n// ├─┼────┤\r\n// │1│3   │\r\n// ├─┼────┤\r\n// │2│null│\r\n// └─┴────┘\r\n//\r\nWITH a, COLLECT(b) AS bs // collect the group\r\nCALL (bs) {\r\n  UNWIND bs AS b // unwind in the subquery\r\n  RETURN COLLECT(b) AS bCol, COUNT(b) AS bCnt\r\n}\r\nRETURN a, bCol, bCnt\r\n```\r\n\r\nand the result is\r\n\r\n```\r\n╒═╤══════╤════╕\r\n│a│bCol  │bCnt│\r\n╞═╪══════╪════╡\r\n│1│[2, 3]│2   │\r\n├─┼──────┼────┤\r\n│2│[]    │0   │ // &lt;-- empty list out of collect for a group\r\n└─┴──────┴────┘\r\n```\r\n\r\nThe above also shows that this works likewise for `COUNT`.\r\n\r\n# CALL subqueries\r\n\r\nBy wrapping UNWIND and the aggregation into a subquery, they get &quot;insulated&quot; from the cardinality of outer driving table. A subquery is executed once for every row. \r\n\r\nHence, in\r\n\r\n```\r\nCALL () {\r\n  UNWIND [1,2,3] AS a\r\n  RETURN collect(a) AS la\r\n}\r\nCALL () {\r\n  UNWIND [4,5,6] AS b\r\n  RETURN collect(b) AS lb\r\n}\r\nRETURN la, lb\r\n```\r\n\r\nboth subqueries start on a single row (like every top-level query starts with a single row and no columns, aka unit table). Further, the aggregations in both subqueries do not have a grouping key, i.e. the crucial difference in the original query is gone.","link":"https://stackoverflow.com/questions/79818753/why-doesnt-this-neo4j-query-return-anything-when-the-second-list-is-empty/79818882#79818882","title":"Why doesn&#39;t this Neo4j query return anything when the second list is empty?"}],"owner":{"reputation":166,"user_id":12794739,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AAuE7mBooQ8qS_p4zWSvsnqOj37myuTJaXCAl8CXYkhWnA=k-s256","display_name":"AFatNiBBa","link":"https://stackoverflow.com/users/12794739/afatnibba"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":71,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"accepted_answer_id":79818882,"answer_count":1,"score":1,"last_activity_date":1763037932,"creation_date":1763030818,"question_id":79818753,"share_link":"https://stackoverflow.com/q/79818753","body_markdown":"If I run this query\r\n```cypher\r\nUNWIND [1,2,3] AS a\r\nWITH collect(a) AS la\r\nUNWIND [4,5,6] AS b\r\nWITH la, collect(b) AS lb\r\nRETURN la, lb\r\n```\r\nI get this result\r\n\r\n| la | lb |\r\n|:-:|:-:|\r\n| [1, 2, 3] | [4, 5, 6] |\r\n\r\nIf I change the FIRST list to `[]`, I get this\r\n\r\n| la | lb |\r\n|:-:|:-:|\r\n| [] | [4, 5, 6] |\r\n\r\nBUT if I change the SECOND one to `[]` (Even if the first one is still `[1, 2, 3]`), I don&#39;t get anything.\r\n\r\nWhy am I not getting this result instead?\r\n\r\n| la | lb |\r\n|:-:|:-:|\r\n| [1, 2, 3] | [] |\r\n\r\nI can fix this edge case by using sub-queries\r\n```cypher\r\nCALL () {\r\n  UNWIND [1,2,3] AS a\r\n  RETURN collect(a) AS la\r\n}\r\nCALL () {\r\n  UNWIND [4,5,6] AS b\r\n  RETURN collect(b) AS lb\r\n}\r\nRETURN la, lb\r\n```\r\nBut I still don&#39;t see why it behaves this way, is it a bug, or is it intentional?","link":"https://stackoverflow.com/questions/79818753/why-doesnt-this-neo4j-query-return-anything-when-the-second-list-is-empty","title":"Why doesn&#39;t this Neo4j query return anything when the second list is empty?"},{"tags":["neo4j","rbac","whitelist","blacklist"],"answers":[{"tags":[],"owner":{"reputation":20225,"user_id":2662355,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/6ea0a9d988f145b0e666dfdd96374736?s=256&d=identicon&r=PG","display_name":"Christophe Willemsen","link":"https://stackoverflow.com/users/2662355/christophe-willemsen"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1761057012,"creation_date":1761057012,"answer_id":79795932,"question_id":79794115,"share_link":"https://stackoverflow.com/a/79795932","body_markdown":"From the [Neo4j docs](https://neo4j.com/docs/operations-manual/current/authentication-authorization/manage-privileges/) \r\n\r\n&gt; It is possible to grant or deny access, or use a combination of the two. The user will be able to access the resource if they have a `GRANT` (allowlist) and do not have a `DENY` (denylist) relevant to that resource. All other combinations of `GRANT` and `DENY` will result in the matching path being inaccessible.\r\n\r\nThis means in your use case that the DENY rule wins.\r\n\r\nBe careful, however, to create the property with `CALL db.create(&#39;property&#39;)` before as the property must exist in the database for the rule to be correctly created, see https://neo4j.com/docs/operations-manual/current/authentication-authorization/limitations/#access-control-limitations-non-existing-labels","link":"https://stackoverflow.com/questions/79794115/internal-implementation-of-neo4js-rbac-to-handle-conflicting-privileges-assigne/79795932#79795932","title":"Internal implementation of Neo4j&#39;s RBAC to handle conflicting privileges assigned for the same role"}],"owner":{"reputation":192,"user_id":24926095,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/d5349b827ae2fb0bc48f10766c292ce8?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Kt Student","link":"https://stackoverflow.com/users/24926095/kt-student"},"last_editor":{"reputation":760602,"user_id":13302,"user_type":"registered","accept_rate":99,"profile_image":"https://www.gravatar.com/avatar/b4779212f57ff2e9549ea90a4499c2d7?s=256&d=identicon&r=PG","display_name":"marc_s","link":"https://stackoverflow.com/users/13302/marc-s"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":64,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1761057012,"creation_date":1760854207,"last_edit_date":1760868543,"question_id":79794115,"share_link":"https://stackoverflow.com/q/79794115","body_markdown":"In Neo4j, when assigning write privileges on a spicific node type for a role, I can deny write permission on some property on that node type, but also grant write permission on all the node&#39;s properties.\r\n\r\nIn this case, which algorithm does Neo4j implement internally to handle this case to infer the final privileges on that node type?","link":"https://stackoverflow.com/questions/79794115/internal-implementation-of-neo4js-rbac-to-handle-conflicting-privileges-assigne","title":"Internal implementation of Neo4j&#39;s RBAC to handle conflicting privileges assigned for the same role"},{"tags":["neo4j","cypher"],"comments":[{"owner":{"reputation":9115,"user_id":277128,"user_type":"registered","accept_rate":79,"profile_image":"https://www.gravatar.com/avatar/f06979a03b9b522c80cb12def209c31a?s=256&d=identicon&r=PG","display_name":"fbiville","link":"https://stackoverflow.com/users/277128/fbiville"},"edited":false,"score":0,"creation_date":1759397273,"post_id":79780719,"comment_id":140772873,"link":"https://stackoverflow.com/questions/79780719/understanding-indexes-in-neo4j#comment140772873_79780719"}],"answers":[{"comments":[{"owner":{"reputation":149,"user_id":5552047,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b68ece0671a660093abcdc51d9a8024b?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Martin","link":"https://stackoverflow.com/users/5552047/martin"},"edited":false,"score":0,"creation_date":1759436461,"post_id":79780784,"comment_id":140774168,"link":"https://stackoverflow.com/questions/79780719/understanding-indexes-in-neo4j/79780784#comment140774168_79780784"},{"owner":{"reputation":76,"user_id":11926449,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/df8bab2526f7787a9adacbdeb438e2aa?s=256&d=identicon&r=PG","display_name":"Therese","link":"https://stackoverflow.com/users/11926449/therese"},"reply_to_user":{"reputation":149,"user_id":5552047,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b68ece0671a660093abcdc51d9a8024b?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Martin","link":"https://stackoverflow.com/users/5552047/martin"},"edited":false,"score":0,"creation_date":1759497230,"post_id":79780784,"comment_id":140775336,"link":"https://stackoverflow.com/questions/79780719/understanding-indexes-in-neo4j/79780784#comment140775336_79780784"}],"tags":[],"owner":{"reputation":76,"user_id":11926449,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/df8bab2526f7787a9adacbdeb438e2aa?s=256&d=identicon&r=PG","display_name":"Therese","link":"https://stackoverflow.com/users/11926449/therese"},"comment_count":2,"down_vote_count":0,"up_vote_count":1,"is_accepted":false,"score":1,"last_activity_date":1759398623,"creation_date":1759398623,"answer_id":79780784,"question_id":79780719,"share_link":"https://stackoverflow.com/a/79780784","body_markdown":"I agree with @fbiville&#39;s comment with that documentation link.  \r\n  \r\nBut otherwise I would try different ones on the labels/relationship types and properties you use in your query and see what helps. It might also be that you can&#39;t use some indexes if we can&#39;t be sure you won&#39;t get any nodes/relationships where the property is missing/null, in which case if you know they won&#39;t be then adding additional filters in the where clause for `nX.id IS NOT NULL` might help as well.  \r\n  \r\nA starting point I&#39;d use would be a range index on the `:Object` nodes for the `type` property as it might help finding the nodes in the MATCH clause (`CREATE INDEX objectTypeIndex FOR (n:Object) ON (n.type)`), potentially an index on the `:Object` nodes for the `id` property as well (or a composite index over both (`CREATE INDEX objectTypeIndex FOR (n:Object) ON (n.type, n.id)`)), but the issue with that might be that it looks like only n1 and n7 are guaranteed to not have null values as `id` so those indexes might not be able to be used (as the indexes doesn&#39;t store null values so we can only use indexes if we can guarantee that the property isn&#39;t null)  \r\n  \r\nHope that helps,  \r\nTherese","link":"https://stackoverflow.com/questions/79780719/understanding-indexes-in-neo4j/79780784#79780784","title":"Understanding indexes in Neo4j"},{"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"last_editor":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":false,"score":1,"last_activity_date":1759410411,"last_edit_date":1759410411,"creation_date":1759401966,"answer_id":79780830,"question_id":79780719,"share_link":"https://stackoverflow.com/a/79780830","body_markdown":"Creating an index as [Therese&#39;s answer](https://stackoverflow.com/a/79780784/2258090) suggests should be your starting point. If the performance is still not what you expect, use [PROFILE](https://stackoverflow.com/a/79780784/2258090) to see where the query is spending most time.\r\n\r\nThere is an additional option if you are able to use [`CYPHER 25`](https://neo4j.com/docs/cypher-manual/current/queries/select-version/) and version 2025.08 or greater. As your `WHERE` conditions are (1) requiring no repeated nodes (2) requiring an increasing value for the `r1` property of relationships, you can rewrite your query as a quantified path pattern and express those conditions with [`allReduce`](https://neo4j.com/docs/cypher-manual/25/functions/predicate/#functions-allreduce). Here is your query rewritten:\r\n```\r\nMATCH\r\n  (n1:Object {id: 299235, type: 3}) \r\n  (()-[r:COMPARED_TO]-&gt;(n:Object {type: 3})){6} \r\n  ({id: 302515})\r\nWHERE \r\n  allReduce(\r\n    span = {}, \r\n    rel IN r | { previous: span.current, current: rel.r1 },\r\n    span.previous IS NULL OR span.previous &lt; span.current\r\n  ) AND\r\n  allReduce(\r\n    acc = [n1],\r\n    node IN n | [node] + acc,\r\n    NOT head(acc) IN tail(acc)\r\n  )\r\nRETURN r[0], r[1], r[2], r[3], r[4], r[5]\r\nORDER BY r[0].r1 DESC, r[1].r1 DESC, r[2].r1 DESC, r[3].r1 DESC, r[4].r1 DESC, r[5].r1 DESC\r\nLIMIT 99\r\n```\r\n\r\nThis allows the query to be optimised for those `WHERE` conditions.  ","link":"https://stackoverflow.com/questions/79780719/understanding-indexes-in-neo4j/79780830#79780830","title":"Understanding indexes in Neo4j"},{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":false,"score":1,"last_activity_date":1759517506,"last_edit_date":1759517506,"creation_date":1759515867,"answer_id":79782062,"question_id":79780719,"share_link":"https://stackoverflow.com/a/79782062","body_markdown":"Indexes are only used to find the initial node(s) or relationship(s) on which to &quot;anchor&quot; a query. All further data traversal proceeds from those initial anchors.  \r\n  \r\nIn your use case, it only makes sense for the Cypher planner to anchor on one or both of these nodes:\r\n- `(n1:Object {id:299235,type:3})`\r\n- `(n7:Object {id:302515,type:3})`\r\n\r\nSo you need a node index, not a relationship index. For example, you can create a composite node index for the `id` and `type` properties on `Object` like this:\r\n\r\n    CREATE INDEX Object_id_type FOR (o:Object) ON (o.id, o.type)\r\n\r\nAlso, the APOC procedure [apoc.path.expandConfig](https://neo4j.com/docs/apoc/current/overview/apoc.path/apoc.path.expandConfig/) supports a lot of functionality for path expansion that is not directly available using pure Cypher. So, something like this *might* be faster:\r\n\r\n    MATCH (start:Object {id: 299235, type: 3}), (end:Object {id: 302515, type: 3})\r\n    CALL apoc.path.expandConfig(start, {\r\n      relationshipFilter: &quot;COMPARED_TO&gt;&quot;,    \r\n      labelFilter: &quot;+Object&quot;,\r\n      minLevel: 6,\r\n      maxLevel: 6,\r\n      endNodes: [end],\r\n      uniqueness: &quot;NODE_GLOBAL&quot;\r\n    }) YIELD path\r\n    WHERE ALL(n IN nodes(path) WHERE n.type = 3)\r\n      AND ALL(i IN range(0, length(path)-1) \r\n              WHERE relationships(path)[i].r1 &lt; relationships(path)[i+1].r1)  // Strict ascending r1\r\n    RETURN relationships(path) AS rels\r\n    ORDER BY rels[0].r1 DESC, rels[1].r1 DESC, rels[2].r1 DESC, rels[3].r1 DESC, rels[4].r1 DESC, rels[5].r1 DESC\r\n    LIMIT 99\r\n\r\nNotes:\r\n\r\n- If you created the suggested index, then the `MATCH` should quickly get the `start` and `end` nodes, which may help a bit.\r\n- `NODE_GLOBAL` uniqueness means that the same node cannot appear multiple times in any returned path. Assuming that `Object` nodes have uniques `id` values, this obviates having to read and compare `id` values.\r\n- If you do not really need to test that intermediate nodes have `type` 3, eliminating that test from the code should speed things up a bit.\r\n- Read the procedure doc to see if you need to tweak any config options.","link":"https://stackoverflow.com/questions/79780719/understanding-indexes-in-neo4j/79782062#79782062","title":"Understanding indexes in Neo4j"},{"tags":[],"owner":{"reputation":149,"user_id":5552047,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b68ece0671a660093abcdc51d9a8024b?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Martin","link":"https://stackoverflow.com/users/5552047/martin"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1763324455,"creation_date":1763324455,"answer_id":79821731,"question_id":79780719,"share_link":"https://stackoverflow.com/a/79821731","body_markdown":"For anyone who comes here in the future with a similar problem ...\r\n\r\nAs mentioned before, adding indexes made little difference on it&#39;s own, with the query as it stood.\r\n\r\nHowever, I then changed my query to use apoc.coll.different() and apoc.coll.max() and this made a huge difference.","link":"https://stackoverflow.com/questions/79780719/understanding-indexes-in-neo4j/79821731#79821731","title":"Understanding indexes in Neo4j"}],"owner":{"reputation":149,"user_id":5552047,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b68ece0671a660093abcdc51d9a8024b?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Martin","link":"https://stackoverflow.com/users/5552047/martin"},"last_editor":{"reputation":71002,"user_id":272109,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/32170c62eb744820e8afdd023379a95a?s=256&d=identicon&r=PG","display_name":"David Makogon","link":"https://stackoverflow.com/users/272109/david-makogon"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":107,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":4,"score":0,"last_activity_date":1763324455,"creation_date":1759392478,"last_edit_date":1759541407,"question_id":79780719,"share_link":"https://stackoverflow.com/q/79780719","body_markdown":"I have a fairly complicated Cypher query as follows:\r\n\r\n```sql\r\nMATCH (n1:Object {id:299235,type:3})-[r1:COMPARED_TO]-&gt;(n2:Object {type:3})-[r2:COMPARED_TO]-&gt;(n3:Object {type:3})-[r3:COMPARED_TO]-&gt;(n4:Object {type:3})-[r4:COMPARED_TO]-&gt;(n5:Object {type:3})-[r5:COMPARED_TO]-&gt;(n6:Object {type:3})-[r6:COMPARED_TO]-&gt;(n7:Object {id:302515,type:3})\r\nWHERE n1.id &lt;&gt; n2.id AND n1.id &lt;&gt; n3.id AND n1.id &lt;&gt; n4.id AND n1.id &lt;&gt; n5.id AND n1.id &lt;&gt; n6.id AND n1.id &lt;&gt; n7.id AND n2.id &lt;&gt; n3.id AND n2.id &lt;&gt; n4.id AND n2.id &lt;&gt; n5.id AND n2.id &lt;&gt; n6.id AND n2.id &lt;&gt; n7.id AND n3.id &lt;&gt; n4.id AND n3.id &lt;&gt; n5.id AND n3.id &lt;&gt; n6.id AND n3.id &lt;&gt; n7.id AND n4.id &lt;&gt; n5.id AND n4.id &lt;&gt; n6.id AND n4.id &lt;&gt; n7.id AND n5.id &lt;&gt; n6.id AND n5.id &lt;&gt; n7.id AND n6.id &lt;&gt; n7.id AND r2.r1 &gt; r1.r1 AND r3.r1 &gt; r2.r1 AND r3.r1 &gt; r1.r1 AND r4.r1 &gt; r3.r1 AND r4.r1 &gt; r2.r1 AND r4.r1 &gt; r1.r1 AND r5.r1 &gt; r4.r1 AND r5.r1 &gt; r3.r1 AND r5.r1 &gt; r2.r1 AND r5.r1 &gt; r1.r1 AND r6.r1 &gt; r5.r1 AND r6.r1 &gt; r4.r1 AND r6.r1 &gt; r3.r1 AND r6.r1 &gt; r2.r1 AND r6.r1 &gt; r1.r1\r\nRETURN r1,r2,r3,r4,r5,r6\r\nORDER BY r1.r1 DESC,r2.r1 DESC,r3.r1 DESC,r4.r1 DESC,r5.r1 DESC,r6.r1 DESC LIMIT 99\r\n```\r\nand it is so slow as to be completely useless.\r\n\r\nI cannot understand what indexes I need to create to make this usable.\r\n\r\nI have tried\r\n```sql\r\nCREATE INDEX range_index_relationships\r\nFOR ()-[r:COMPARED_TO]-()\r\nON (r.r1)\r\n```\r\nwhich made no difference.","link":"https://stackoverflow.com/questions/79780719/understanding-indexes-in-neo4j","title":"Understanding indexes in Neo4j"},{"tags":["amazon-s3","neo4j"],"owner":{"reputation":192,"user_id":24926095,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/d5349b827ae2fb0bc48f10766c292ce8?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Kt Student","link":"https://stackoverflow.com/users/24926095/kt-student"},"last_editor":{"reputation":192,"user_id":24926095,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/d5349b827ae2fb0bc48f10766c292ce8?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Kt Student","link":"https://stackoverflow.com/users/24926095/kt-student"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":51,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":0,"score":1,"last_activity_date":1759301054,"creation_date":1759230894,"last_edit_date":1759301054,"question_id":79779025,"share_link":"https://stackoverflow.com/q/79779025","body_markdown":"I&#39;m using Neo4j Browser (from Neo4j Desktop for Windows) on my local computer to run the following Cypher query to export local graph data to a bucket on AWS S3:\r\n\r\n    CALL apoc.export.csv.query(\r\n      &quot;MATCH (n:Person) RETURN n.name AS Name, n.born AS BirthYear&quot;,\r\n      $url,\r\n      {batchSize:1000,  quotes:true, header:true}\r\n    )\r\n    YIELD file, nodes, relationships, properties, time\r\n    RETURN file;\r\n\r\nBut it always return an error with the following message:\r\n\r\n    Failed to invoke procedure `apoc.export.csv.query`: Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: The AWS Access Key Id you provided does not exist in our records. (Service: Amazon S3; Status Code: 403; Error Code: InvalidAccessKeyId; Request ID: CWHN0KMP....\r\n\r\nThe `$url` follows the format on the documatation `s3://accessKey:secretKey@endpoint:port/bucket/key`, in my case it is: `s3://&lt;AWS_ACCESS_KEY_ID&gt;:&lt;AWS_SECRET_ACCESS_KEY&gt;@s3.eu-central-1.amazonaws.com:443/&lt;my-bucket-name&gt;/&lt;my-object-file-name&gt;.json`.\r\n\r\nWhat am I missing?\r\n","link":"https://stackoverflow.com/questions/79779025/failed-to-invoke-procedure-apoc-export-csv-query-the-aws-access-key-id-you-pr","title":"Failed to invoke procedure `apoc.export.csv.query`: The AWS Access Key Id you provided does not exist in our records"},{"tags":["python","neo4j","hpc"],"owner":{"reputation":3,"user_id":20820667,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/7a0676d034d9d5a3364fc7beffb0f0a2?s=256&d=identicon&r=PG","display_name":"prasad","link":"https://stackoverflow.com/users/20820667/prasad"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":47,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1758185982,"creation_date":1758185982,"question_id":79768204,"share_link":"https://stackoverflow.com/q/79768204","body_markdown":"I&#39;m trying to run the Neo4j Docker container using Singularity on an HPC system. The container starts successfully, but it shuts down automatically when I try to add data to the database (e.g., via Cypher queries or CSV import).\r\nHere are the commands I used:\r\n\r\n\r\n\r\n\r\n\r\n\r\n```\r\nsingularity instance start \\\r\n  --env NEO4J_dbms_default__listen__address=0.0.0.0 \\\r\n  --env NEO4J_dbms_connector_http_listen__address=:7474 \\\r\n  --env NEO4J_dbms_connector_bolt_listen__address=:7687 \\\r\n  --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes \\\r\n  --env NEO4J_AUTH=neo4j/securepassword \\\r\n  -B /home/prasad/docker/neo4j/data:/data \\\r\n  -B /home/prasad/docker/neo4j/logs:/logs \\\r\n  -B /home/prasad/docker/neo4j/import:/import \\\r\n  neo4j_enterprise.sif neo4j_enterprise\r\n\r\n```\r\n\r\nI also tried:\r\n\r\n\r\n```\r\nsingularity run \\\r\n  --env NEO4J_dbms_default__listen__address=0.0.0.0 \\\r\n  --env NEO4J_dbms_connector_http_listen__address=:7474 \\\r\n  --env NEO4J_dbms_connector_bolt_listen__address=:7687 \\\r\n  --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes \\\r\n  --env NEO4J_AUTH=neo4j/securepassword \\\r\n  -B /home/prasad/docker/neo4j/data:/data \\\r\n  -B /home/prasad/docker/neo4j/logs:/logs \\\r\n  -B /home/prasad/docker/neo4j/import:/import \\\r\n  instance://neo4j_enterprise\r\n\r\n```\r\n\r\nEnvironment:\r\n\r\nSingularity version: 4.1.1\r\nNeo4j Docker image: neo4j:5 enterprise (converted to .sif)\r\nHost system: HPC cluster (non-root access)\r\nVolumes mounted: /data, /logs, /import\r\n\r\nIssue:\r\nNeo4j starts fine, but shuts down when I try to import data or run queries. There are no clear errors in the logs—just a shutdown message.\r\nQuestions:\r\n\r\n1. Has anyone successfully run Neo4j inside Singularity on HPC?\r\n2. Are there specific flags or configurations needed to prevent shutdown during data operations?\r\n3. Could this be related to memory limits, file system permissions, or something else?\r\n\r\nAny help or suggestions would be greatly appreciated!","link":"https://stackoverflow.com/questions/79768204/how-to-run-neo4j-docker-container-using-singularity-on-hpc-without-shutdown-duri","title":"How to run Neo4j Docker container using Singularity on HPC without shutdown during data import?"},{"tags":["neo4j"],"comments":[{"owner":{"reputation":4414,"user_id":20306007,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/98bbc403493aee3681b71dae7abef66e?s=256&d=identicon&r=PG","display_name":"life888888","link":"https://stackoverflow.com/users/20306007/life888888"},"edited":false,"score":0,"creation_date":1758111664,"post_id":79767211,"comment_id":140742222,"link":"https://stackoverflow.com/questions/79767211/unable-to-access-neo4j-running-in-docker-on-vm-from-outside-the-vm#comment140742222_79767211"},{"owner":{"reputation":1,"user_id":31509482,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/f54708ba046c9b1b5dc172568d2f974d?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Ganesh Kumar","link":"https://stackoverflow.com/users/31509482/ganesh-kumar"},"reply_to_user":{"reputation":4414,"user_id":20306007,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/98bbc403493aee3681b71dae7abef66e?s=256&d=identicon&r=PG","display_name":"life888888","link":"https://stackoverflow.com/users/20306007/life888888"},"edited":false,"score":0,"creation_date":1758116644,"post_id":79767211,"comment_id":140742491,"link":"https://stackoverflow.com/questions/79767211/unable-to-access-neo4j-running-in-docker-on-vm-from-outside-the-vm#comment140742491_79767211"},{"owner":{"reputation":4414,"user_id":20306007,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/98bbc403493aee3681b71dae7abef66e?s=256&d=identicon&r=PG","display_name":"life888888","link":"https://stackoverflow.com/users/20306007/life888888"},"edited":false,"score":0,"creation_date":1758117402,"post_id":79767211,"comment_id":140742515,"link":"https://stackoverflow.com/questions/79767211/unable-to-access-neo4j-running-in-docker-on-vm-from-outside-the-vm#comment140742515_79767211"}],"owner":{"reputation":1,"user_id":31509482,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/f54708ba046c9b1b5dc172568d2f974d?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Ganesh Kumar","link":"https://stackoverflow.com/users/31509482/ganesh-kumar"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":55,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1758106432,"creation_date":1758106432,"question_id":79767211,"share_link":"https://stackoverflow.com/q/79767211","body_markdown":"I have deployed Neo4j Community Edition (with APOC plugin) inside a Docker container running on a Linux VM.\r\n\r\nInside the VM, I can access Neo4j Browser on http://localhost:7474\r\n without issues. But from outside the VM (for example, accessing http://&lt;VM_Public_IP&gt;:7474 from my local machine), I cannot connect.\r\n\r\n\r\n\r\nHere is what I have done so far:\r\n\r\nConfirmed container is running with docker ps. The ports show as 0.0.0.0:7474-&gt;7474 and 0.0.0.0:7687-&gt;7687, so it should be accessible.\r\n\r\nChecked container logs with docker logs neo4j-apoc. Neo4j is starting fine and no errors are reported.\r\n\r\nVerified from inside the VM that curl http://localhost:7474\r\n works correctly.\r\n\r\nChecked neo4j.conf inside the container at /var/lib/neo4j/conf/neo4j.conf. The value of server.default_listen_address is set to 0.0.0.0, so Neo4j should be listening on all interfaces.\r\n\r\nEnabled the firewall on the VM and explicitly opened ports 7474 and 7687.\r\n\r\nChecked VM provider settings (Azure / AWS / GCP). I allowed inbound rules for ports 7474 and 7687 in the Network Security Group / Firewall rules.\r\n\r\nAlso made sure to allow both private and public profiles (when testing on a Windows VM).\r\n\r\nTried running with and without a custom Dockerfile. Even running the official image directly with docker run -d -p 7474:7474 -p 7687:7687 neo4j:5.20-community gives the same issue.\r\n\r\nQuestion: What else should I check so that Neo4j running in Docker on my VM can be accessed externally using the VM’s public IP?","link":"https://stackoverflow.com/questions/79767211/unable-to-access-neo4j-running-in-docker-on-vm-from-outside-the-vm","title":"Unable to access Neo4j running in Docker on VM from outside the VM"},{"tags":["neo4j","label","match","cql"],"owner":{"reputation":11,"user_id":4591796,"user_type":"registered","profile_image":"https://graph.facebook.com/10202627399084850/picture?type=large","display_name":"Naveh Ohana","link":"https://stackoverflow.com/users/4591796/naveh-ohana"},"last_editor":{"reputation":11,"user_id":4591796,"user_type":"registered","profile_image":"https://graph.facebook.com/10202627399084850/picture?type=large","display_name":"Naveh Ohana","link":"https://stackoverflow.com/users/4591796/naveh-ohana"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":79,"favorite_count":0,"down_vote_count":0,"up_vote_count":2,"answer_count":0,"score":2,"last_activity_date":1758018476,"creation_date":1758015673,"last_edit_date":1758018476,"question_id":79766066,"share_link":"https://stackoverflow.com/q/79766066","body_markdown":"I&#39;m running Neo4j 5.18.1 enterprise edition with a cluster of 6 servers.\r\nI&#39;m running 2 queries on all servers in the cluster, trying to find a specific node.\r\nThe node in question has the following labels: `[&quot;X&quot;, &quot;Y&quot;, &quot;C&quot;, &quot;D&quot;, &quot;A&quot;]`\r\n\r\n\r\nThe first query should return my node as far as I understand, but occasionally, it doesn&#39;t:\r\n\t`MATCH (n:X&amp;Y&amp;((A|B)|(!C&amp;!D)))`.\r\n\r\nThe second query returns my node:\r\n\t`MATCH (n:X&amp;Y)`\r\n\r\n - In my code, the label `X` is being added to all relevant nodes a few lines of code before the first query.\r\n - The first query **does** return other similar nodes, that have the labels: `[&quot;X&quot;, &quot;Y&quot;]`\r\n - This only happens occasionally. When I run the first query again manually after my code runs, it returns my node correctly.\r\n - When the query doesn&#39;t return the node, it happens on all neo4j servers in my cluster (including the `LEADER`).\r\n\r\nConsidering I&#39;m adding the label `X` shortly before the query, I suspected read-after-write consistency between the Neo4j cluster servers, but I don&#39;t really see how this could explain it because the other nodes that are matched by `X` are indeed returned. \r\nI also add more labels after I add A, and these labels do show up on all of these nodes at the time of the query.\r\n\r\nI&#39;ve read the [documentation](https://neo4j.com/docs/cypher-manual/current/patterns/reference/#label-expressions-examples) but couldn&#39;t find anything wrong.\r\nDoes neo4j even support complex label expressions such as `...|(!C&amp;!D)`?\r\n\r\nAnyway, has anyone else encountered such a problem?\r\nThanks in advance.","link":"https://stackoverflow.com/questions/79766066/neo4j-complex-label-expressions-inconsistencies","title":"Neo4j complex label expressions inconsistencies"},{"tags":["neo4j","artificial-intelligence","large-language-model","google-gemini","rag"],"comments":[{"owner":{"reputation":1952,"user_id":1686903,"user_type":"registered","accept_rate":75,"profile_image":"https://i.sstatic.net/oO8Sw.jpg?s=256","display_name":"sam","link":"https://stackoverflow.com/users/1686903/sam"},"edited":false,"score":0,"creation_date":1759841416,"post_id":79758366,"comment_id":140781673,"link":"https://stackoverflow.com/questions/79758366/zep-graphiti-core-adding-episode-fails-the-llm-structured-output#comment140781673_79758366"}],"owner":{"reputation":438,"user_id":8766532,"user_type":"registered","profile_image":"https://i.sstatic.net/TrdDz.jpg?s=256","display_name":"George Petropoulos","link":"https://stackoverflow.com/users/8766532/george-petropoulos"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":177,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1757279506,"creation_date":1757279506,"question_id":79758366,"share_link":"https://stackoverflow.com/q/79758366","body_markdown":"On the ingestion part to the graph db, I pass a json file, as an episode, custom entities (and edges), using gemini api, but I get some discrepancy on the structured output, like so:\r\n\r\n    LLM generation failed parsing as JSON, will try to salvage.&quot;\r\n    Input messages: [\r\n      {\r\n        &quot;parts&quot;: [\r\n          {\r\n            &quot;video_metadata&quot;: null,\r\n            &quot;thought&quot;: null,\r\n            &quot;inline_data&quot;: null,\r\n            &quot;file_data&quot;: null,\r\n            &quot;thought_signature&quot;: null,\r\n            &quot;code_execution_result&quot;: null,\r\n            &quot;executable_code&quot;: null,\r\n            &quot;function_call&quot;: null,\r\n            &quot;function_response&quot;: null,\r\n            &quot;text&quot;: &quot;\\n\\n        &lt;MESSAGES&gt;\\n        [\\n  \\&quot;{\\\\\\&quot;entities\\\\\\&quot;: [{\\\\\\&quot;id\\\\\\&quot;: \\\\\\&quot;invoice_ted-a-29896\\\\\\&quot;, \\\\\\&quot;type\\\\\\&quot;: \\\\\\&quot;InvoiceEntity\\\\\\&quot;, \\\\\\&quot;doc_code\\\\\\&quot;: \\\\\\&quot;TED-A-29896\\\\\\&quot;, \\\\\\&quot;doc_registration_date\\\\\\&quot;: \\\\\\&quot;10/1/2025\\\\\\&quot;, \\\\\\&quot;reason\\\\\\&quot;: \\\\\\&quot;\\\\\\&quot;, \\\\\\&quot;description\\\\\\&quot;: \\\\\\&quot;Expense Invoice\\\\\\&quot;, \\\\\\&quot;activity_code\\\\\\&quot;: \\\\\\&quot;SaaS\\\\\\&quot;, \\\\\\&quot;business_unit_code\\\\\\&quot;: \\\\\\&quot;MM_SOUTH\\\\\\&quot;, \\\\\\&quot;dimension1_code............ d \\\\&quot;, &#39;entity_types&#39;: [&#39;Entity&#39;, &#39;CanonicalItemEntity&#39;], &#39;attributes&#39;: {&#39;labels&#39;: [&#39;Entity&#39;, &#39;CanonicalItemEntity&#39;]}}\\n        &lt;/ENTITY&gt;\\n        &quot;\r\n          }\r\n        ],\r\n        &quot;role&quot;: &quot;user&quot;\r\n      }\r\n    ]\r\n\r\nHas anyone encountered this?","link":"https://stackoverflow.com/questions/79758366/zep-graphiti-core-adding-episode-fails-the-llm-structured-output","title":"Zep Graphiti - core - Adding Episode fails the LLM structured output"},{"tags":["neo4j","cypher"],"answers":[{"comments":[{"owner":{"reputation":149,"user_id":5552047,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b68ece0671a660093abcdc51d9a8024b?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Martin","link":"https://stackoverflow.com/users/5552047/martin"},"edited":false,"score":0,"creation_date":1756553263,"post_id":79746147,"comment_id":140703421,"link":"https://stackoverflow.com/questions/79744785/matching-variable-length-paths-in-neo4j-with-where/79746147#comment140703421_79746147"},{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"reply_to_user":{"reputation":149,"user_id":5552047,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b68ece0671a660093abcdc51d9a8024b?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Martin","link":"https://stackoverflow.com/users/5552047/martin"},"edited":false,"score":0,"creation_date":1756752483,"post_id":79746147,"comment_id":140707605,"link":"https://stackoverflow.com/questions/79744785/matching-variable-length-paths-in-neo4j-with-where/79746147#comment140707605_79746147"}],"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":2,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1756754339,"last_edit_date":1756754339,"creation_date":1756151994,"answer_id":79746147,"question_id":79744785,"share_link":"https://stackoverflow.com/a/79746147","body_markdown":"If you want to find all `KNOWS` paths (up to length 5) from `A` to `F` in which adjacent nodes do not have the same `met_at` value, you can do this:\r\n\r\n```SQL\r\nMATCH p = (:Person {name:&#39;A&#39;})-[r:KNOWS*1..5]-&gt;(:Person {name:&#39;F&#39;})\r\nWHERE ALL(i IN RANGE(0, LENGTH(p) - 2) WHERE \r\n  r[i].met_at &lt;&gt; r[i+1].met_at)\r\nRETURN p\r\n```","link":"https://stackoverflow.com/questions/79744785/matching-variable-length-paths-in-neo4j-with-where/79746147#79746147","title":"Matching variable length paths in Neo4j with WHERE"}],"owner":{"reputation":149,"user_id":5552047,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b68ece0671a660093abcdc51d9a8024b?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Martin","link":"https://stackoverflow.com/users/5552047/martin"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":82,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79746147,"answer_count":1,"score":0,"last_activity_date":1756754339,"creation_date":1756030453,"question_id":79744785,"share_link":"https://stackoverflow.com/q/79744785","body_markdown":"I am getting my head around a Neo4j database that links people together, along with details of how they are connected.\r\n\r\nSpecifically I have a &quot;Person&quot; node and a &quot;KNOWS&quot; relationship which has a &quot;met_at&quot; property.\r\n\r\nI can now match a variable length path with:\r\n\r\n    MATCH (:Person {name:&#39;A&#39;})-[r:KNOWS*1..5]-&gt;(:Person {name:&#39;B&#39;}) RETURN r\r\n\r\nto get links between people. So far so good.\r\n\r\nNow imagine I have the following connections:\r\n\r\n - A-[:KNOWS{met_at:1}]-&gt;B\r\n - A-[:KNOWS{met_at:1}]-&gt;C\r\n - B-[:KNOWS{met_at:2}]-&gt;D\r\n - C-[:KNOWS{met_at:2}]-&gt;E\r\n - D-[:KNOWS{met_at:2}]-&gt;E\r\n - E-[:KNOWS{met_at:3}]-&gt;F\r\n\r\nIs it possible to craft a WHERE to add to the above MATCH statement so that when finding paths from A to F it excludes the path A-&gt;B-&gt;D-&gt;E-&gt;F because B met D at the same time as D met E ... ie. it only returns A-&gt;C-&gt;E-&gt;F\r\n\r\nI know I could do each level separately:\r\n\r\n    MATCH (:Person {name:&#39;A&#39;})-[r1:KNOWS]-&gt;(:Person)-[r2:KNOWS]-&gt;(:Person {name:&#39;F&#39;}) WHERE r2.met_at &lt;&gt; r1.met_at RETURN r1,r2\r\n    MATCH (:Person {name:&#39;A&#39;})-[r1:KNOWS]-&gt;(:Person)-[r2:KNOWS]-&gt;(:Person)-[r3:KNOWS]-&gt;(:Person {name:&#39;F&#39;}) WHERE r2.met_at &lt;&gt; r1.met_at AND r3.met_at &lt;&gt; r2.met_at RETURN r1,r2,r3\r\n    etc...\r\n\r\n\r\nbut I am trying to do it in a single query, is that possible?\r\n\r\nThanks :-)\r\n","link":"https://stackoverflow.com/questions/79744785/matching-variable-length-paths-in-neo4j-with-where","title":"Matching variable length paths in Neo4j with WHERE"},{"tags":["python","neo4j","ubuntu-24.04"],"comments":[{"owner":{"reputation":325,"user_id":4232381,"user_type":"registered","profile_image":"https://lh5.googleusercontent.com/-qWHEmQzdnjs/AAAAAAAAAAI/AAAAAAAAADU/oOl9JPQbRvk/s256-rj/photo.jpg","display_name":"JJ Ward","link":"https://stackoverflow.com/users/4232381/jj-ward"},"edited":false,"score":1,"creation_date":1770212086,"post_id":79738010,"comment_id":140969920,"link":"https://stackoverflow.com/questions/79738010/why-does-neo4j-connect-over-tls-using-bolt-when-tls-level-required#comment140969920_79738010"}],"owner":{"reputation":1,"user_id":21810505,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/c3375023f6619702aba817465589aadb?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Robin","link":"https://stackoverflow.com/users/21810505/robin"},"last_editor":{"reputation":1,"user_id":21810505,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/c3375023f6619702aba817465589aadb?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Robin","link":"https://stackoverflow.com/users/21810505/robin"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":76,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1755454693,"creation_date":1755452935,"last_edit_date":1755454693,"question_id":79738010,"share_link":"https://stackoverflow.com/q/79738010","body_markdown":"Neo4j Community is running on an Ubuntu Server in a virtual private network on Azure. The default HTTP for both its [browser](https://neo4j.com/docs/browser-manual/current/about-browser/) and [bolt](https://neo4j.com/docs/bolt/current/bolt/) are disabled in favour of HTTPS and WSS (through self-signed certificates).\r\n\r\n1. The browser is being proxied with [NGINX](https://nginx.org/) and has the following configuration:\r\n\r\n```\r\nserver.http.enabled=false\r\nserver.https.enabled=true\r\n\r\ndbms.ssl.policy.https.enabled=true\r\ndbms.ssl.policy.https.base_directory=certificates/https\r\ndbms.ssl.policy.https.private_key=sub.domain.key\r\ndbms.ssl.policy.https.public_certificate=sub.domain.pem\r\ndbms.ssl.policy.https.client_auth=NONE\r\n```\r\n\r\n2. Bolt is exposed on port 7687 with the following configuration:\r\n\r\n```\r\nserver.bolt.enabled=true\r\nserver.bolt.tls_level=REQUIRED\r\n\r\ndbms.ssl.policy.bolt.enabled=true\r\ndbms.ssl.policy.bolt.base_directory=certificates/bolt\r\ndbms.ssl.policy.bolt.private_key=sub.domain.key\r\ndbms.ssl.policy.bolt.public_certificate=sub.domain.pem\r\ndbms.ssl.policy.bolt.client_auth=NONE\r\n```\r\n\r\nVisiting **https://sub.domain.com/neo4j** in a browser succeeds and displays **bolt+s://sub.domain.com:7687** as the connection to [bolt](https://neo4j.com/docs/bolt/current/bolt/). See [Neo4j Python Driver](https://neo4j.com/docs/api/python-driver/current/api.html#uri) for the URI schemes.\r\n\r\nConnecting to **bolt+s://sub.domain.com:7687** using the Python SDK as follows doesn&#39;t work and results in a SSLCertVerificationError:\r\n\r\n```\r\ndriver = AsyncGraphDatabase.driver(\r\n    f&quot;bolt+s://{settings.host}:{settings.port}&quot;,\r\n    auth=(settings.username, settings.password)\r\n)\r\n```\r\n\r\nBut connecting to **bolt://sub.domain.com:7687** using the same SDK does:\r\n\r\n```\r\ndriver = AsyncGraphDatabase.driver(\r\n    f&quot;bolt://{settings.host}:{settings.port}&quot;,\r\n    auth=(settings.username, settings.password),\r\n    trusted_certificates=TrustSystemCAs()\r\n)\r\n```\r\n\r\nDoes the connection succeed because **server.bolt.tls_level=REQUIRED** forces the driver to upgrade the connection? i.e., Is it safe to assume that the successful connection being made is over TLS?\r\n\r\nN.B. Connecting to **bolt+ssc://sub.domain.com:7687** using the same SDK works but isn&#39;t suitable for production:\r\n\r\n```\r\ndriver = AsyncGraphDatabase.driver(\r\n   f&quot;bolt+ssc://{settings.host}:{settings.port}&quot;,\r\n   auth=(settings.username, settings.password)\r\n)\r\n```","link":"https://stackoverflow.com/questions/79738010/why-does-neo4j-connect-over-tls-using-bolt-when-tls-level-required","title":"Why does Neo4j connect over TLS using bolt:// when tls_level=REQUIRED?"},{"tags":["csv","neo4j","cypher"],"answers":[{"comments":[{"owner":{"reputation":101,"user_id":11598293,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/85aee34b7f0786961eaf2db8cdbf358c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Jaap","link":"https://stackoverflow.com/users/11598293/jaap"},"edited":false,"score":0,"creation_date":1754391377,"post_id":79725973,"comment_id":140643208,"link":"https://stackoverflow.com/questions/79725896/neo4j-5-14-0-add-labels-based-on-values-in-csv-file/79725973#comment140643208_79725973"}],"tags":[],"owner":{"reputation":20225,"user_id":2662355,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/6ea0a9d988f145b0e666dfdd96374736?s=256&d=identicon&r=PG","display_name":"Christophe Willemsen","link":"https://stackoverflow.com/users/2662355/christophe-willemsen"},"comment_count":1,"down_vote_count":0,"up_vote_count":0,"is_accepted":true,"score":0,"last_activity_date":1754389804,"creation_date":1754389804,"answer_id":79725973,"question_id":79725896,"share_link":"https://stackoverflow.com/a/79725973","body_markdown":"Dynamic labels in SET clauses was [introduced in Neo4j 5.24](https://neo4j.com/docs/cypher-manual/5/deprecations-additions-removals-compatibility/#cypher-deprecations-additions-removals-5.24), so you must upgrade to that version at a minimum.\r\n\r\n```\r\nLOAD CSV WITH HEADERS \r\nFROM &#39;file:///classification.csv&#39; AS row\r\nCREATE (o:Object {ID: row.Object_ID, Type: row.Type})\r\nSET o:$(row.`Hierarchy_name`)\r\nSET o:$(row.`Classification`);\r\n```","link":"https://stackoverflow.com/questions/79725896/neo4j-5-14-0-add-labels-based-on-values-in-csv-file/79725973#79725973","title":"Neo4J (5.14.0): add labels based on values in CSV file"}],"owner":{"reputation":101,"user_id":11598293,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/85aee34b7f0786961eaf2db8cdbf358c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Jaap","link":"https://stackoverflow.com/users/11598293/jaap"},"last_editor":{"reputation":101,"user_id":11598293,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/85aee34b7f0786961eaf2db8cdbf358c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Jaap","link":"https://stackoverflow.com/users/11598293/jaap"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":44,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"accepted_answer_id":79725973,"answer_count":1,"score":1,"last_activity_date":1754389804,"creation_date":1754386738,"last_edit_date":1754388523,"question_id":79725896,"share_link":"https://stackoverflow.com/q/79725896","body_markdown":"I&#39;m trying to create nodes with one set label (:object) and two additional labels that are based on values in the following CSV file:\r\n\r\n|Object_ID|Classification|Hierarchy_name|Object_type|\r\n|---------|--------------|--------------|-----------|\r\n|O0010|visual_works|sculpture|sculpture|\r\n|O0011|components|book_jackets|book|cover|\r\n\r\nI thought it would be possible to add dynamic labels based on the values in the spreadsheet using the $ expression, but I cannot find information about how to use this in relation to loading information from a CSV file.\r\n\r\nCurrently, my faulty script looks like this:\r\n\r\n```\r\nLOAD CSV WITH HEADERS FROM &#39;file:///classification.csv&#39; AS row\r\nCREATE (o:object:$(row.Hierarchy_name):$(row.Classification){ID: row.Object_ID, Type: row.Type});","link":"https://stackoverflow.com/questions/79725896/neo4j-5-14-0-add-labels-based-on-values-in-csv-file","title":"Neo4J (5.14.0): add labels based on values in CSV file"},{"tags":["neo4j","cypher"],"answers":[{"tags":[],"owner":{"reputation":558,"user_id":2259302,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/aff4a398f6f272cbdb4dab0c4df4f3b2?s=256&d=identicon&r=PG","display_name":"H&#229;kan L&#246;fqvist","link":"https://stackoverflow.com/users/2259302/h%c3%a5kan-l%c3%b6fqvist"},"last_editor":{"reputation":558,"user_id":2259302,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/aff4a398f6f272cbdb4dab0c4df4f3b2?s=256&d=identicon&r=PG","display_name":"H&#229;kan L&#246;fqvist","link":"https://stackoverflow.com/users/2259302/h%c3%a5kan-l%c3%b6fqvist"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1753955516,"last_edit_date":1753955516,"creation_date":1753955015,"answer_id":79721093,"question_id":79720461,"share_link":"https://stackoverflow.com/a/79721093","body_markdown":"I think it is as simple as adding both &quot;ownership paths&quot; together. To help understand the query, I also created as small graph + drawing.\r\n\r\n```\r\n// create example graph\r\nCREATE (:starting)-[:OWNS {p: 0.5}]-&gt;(a:node)-[:OWNS {p: 0.8}]-&gt;(:node)-[:OWNS {p: 0.4}]-&gt;(c:node)-[:OWNS {p: 0.8}]-&gt;(:target),\r\n(a)-[:OWNS {p: 0.3}]-&gt;(c)\r\n\r\n// query it\r\nmatch p = (:starting)-[:OWNS]-&gt;{1,10}(:target)\r\nwith p, reduce( acc = 1.0, x in relationships(p) | acc*x.p ) as pct\r\nreturn sum(pct) as total_ownership\r\n\r\n// result\r\n╒═══════════════════╕\r\n│total_ownership    │\r\n╞═══════════════════╡\r\n│0.24800000000000003│\r\n└───────────────────┘\r\n```\r\n\r\n[![enter image description here](https://i.sstatic.net/6JjI7SBM.png)](https://i.sstatic.net/6JjI7SBM.png)\r\n\r\nNote: All operations are float/there is no decimal type + exact math in neo4j. So the answer will not be exact.","link":"https://stackoverflow.com/questions/79720461/calculating-percentage-from-relationships-in-a-multi-node-path-in-neo4j/79721093#79721093","title":"Calculating percentage from relationships in a multi-node path in Neo4j"}],"owner":{"reputation":19,"user_id":22505612,"user_type":"registered","profile_image":"https://i.sstatic.net/I0MxNHWk.jpg?s=256","display_name":"bunny","link":"https://stackoverflow.com/users/22505612/bunny"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":40,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79721093,"answer_count":1,"score":0,"last_activity_date":1753955516,"creation_date":1753905026,"question_id":79720461,"share_link":"https://stackoverflow.com/q/79720461","body_markdown":"I have a non-cyclical graph, where all the nodes are of type (label) Entity and all relationships are of type OWNS. Each relationship is guaranteed to have a property Percentage, which is the numeric data type. Each node has an Id field (different from the internal id that Neo4j uses).\r\n\r\nGiven a starting node and target node, the path between them can have 1 relationship or many in between (if there are many nodes in that path). Using Cyper, how can I return the total percentage between the starting and target node? This can be complicated because the paths aren’t always linear. I’ve attached a picture example below.\r\n\r\nI only started using Neo4j a week ago, so this is the very simplistic query I’ve written just to show the nodes and relationships given a starting and target node:\r\n\r\n    MATCH p=(:Entity {Id: &quot;&lt;STARTING ID&gt;&quot;})-[:OWNS*]-&gt;(:Entity {Id: &quot;&lt;TARGET ID&gt;&quot;})\r\n    RETURN p\r\n\r\nHowever, instead of showing the graph, I would just like the calculated percentage between them.\r\n\r\nExample:\r\n[![grpah example][1]][1]\r\n\r\n\r\n  [1]: https://i.sstatic.net/UAtmSVED.png","link":"https://stackoverflow.com/questions/79720461/calculating-percentage-from-relationships-in-a-multi-node-path-in-neo4j","title":"Calculating percentage from relationships in a multi-node path in Neo4j"},{"tags":["neo4j","neo4j-apoc"],"owner":{"reputation":117,"user_id":8890395,"user_type":"registered","profile_image":"https://lh5.googleusercontent.com/-bkdXBED8FIw/AAAAAAAAAAI/AAAAAAAAAYY/Z92BvhSHmrU/s256-rj/photo.jpg","display_name":"Adi334","link":"https://stackoverflow.com/users/8890395/adi334"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":43,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1751867594,"creation_date":1751867594,"question_id":79692356,"share_link":"https://stackoverflow.com/q/79692356","body_markdown":"All,\r\n   Is there any APOC trigger to update a datatime property when node or relationship changes in Neo4j? added a property timestamp and it should get populated when new data comes in or gets updated. Thanks ","link":"https://stackoverflow.com/questions/79692356/neo4j-apoc-trigger-update-datetime-when-n-r-o-changes","title":"Neo4j- APOC Trigger update datetime when n-r-o changes"},{"tags":["neo4j","azure-databricks","apache-spark-connector"],"answers":[{"comments":[{"owner":{"reputation":111,"user_id":21317583,"user_type":"registered","profile_image":"https://i.sstatic.net/7T7Mf.jpg?s=256","display_name":"Arbind Chandra","link":"https://stackoverflow.com/users/21317583/arbind-chandra"},"edited":false,"score":0,"creation_date":1751555566,"post_id":79688935,"comment_id":140562496,"link":"https://stackoverflow.com/questions/79688890/unable-to-run-neo4j-create-constraint-cypher-query-from-databricks-using-pyspark/79688935#comment140562496_79688935"},{"owner":{"reputation":9115,"user_id":277128,"user_type":"registered","accept_rate":79,"profile_image":"https://www.gravatar.com/avatar/f06979a03b9b522c80cb12def209c31a?s=256&d=identicon&r=PG","display_name":"fbiville","link":"https://stackoverflow.com/users/277128/fbiville"},"reply_to_user":{"reputation":111,"user_id":21317583,"user_type":"registered","profile_image":"https://i.sstatic.net/7T7Mf.jpg?s=256","display_name":"Arbind Chandra","link":"https://stackoverflow.com/users/21317583/arbind-chandra"},"edited":false,"score":0,"creation_date":1751615387,"post_id":79688935,"comment_id":140564245,"link":"https://stackoverflow.com/questions/79688890/unable-to-run-neo4j-create-constraint-cypher-query-from-databricks-using-pyspark/79688935#comment140564245_79688935"}],"tags":[],"owner":{"reputation":9115,"user_id":277128,"user_type":"registered","accept_rate":79,"profile_image":"https://www.gravatar.com/avatar/f06979a03b9b522c80cb12def209c31a?s=256&d=identicon&r=PG","display_name":"fbiville","link":"https://stackoverflow.com/users/277128/fbiville"},"comment_count":2,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1751549736,"creation_date":1751549736,"answer_id":79688935,"question_id":79688890,"share_link":"https://stackoverflow.com/a/79688935","body_markdown":"If you want to initialize constraints with the Spark Connector for Neo4j, you have two choices:\r\n\r\n1. configure the right [schema optimization strategy](https://neo4j.com/docs/spark/current/write/schema-optimization/), constraints will be inferred from your dataframe schema\r\n\r\n2. use the `script` option (where the value would be `CREATE CONSTRAINT unique_person IF NOT EXISTS FOR (p:Person) REQUIRE p.name IS UNIQUE`)\r\n\r\nIn any case, your `query` call must be for data imports, not schema initialization.  \r\nThe [official documentation](https://neo4j.com/docs/spark/current/write/query/) hopefully helps in that regards.","link":"https://stackoverflow.com/questions/79688890/unable-to-run-neo4j-create-constraint-cypher-query-from-databricks-using-pyspark/79688935#79688935","title":"Unable to run neo4j create constraint cypher query from Databricks using pyspark connector"}],"owner":{"reputation":111,"user_id":21317583,"user_type":"registered","profile_image":"https://i.sstatic.net/7T7Mf.jpg?s=256","display_name":"Arbind Chandra","link":"https://stackoverflow.com/users/21317583/arbind-chandra"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":45,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79688935,"answer_count":1,"score":0,"last_activity_date":1751549736,"creation_date":1751547612,"question_id":79688890,"share_link":"https://stackoverflow.com/q/79688890","body_markdown":"I am using databricks notebook and neo4j spark connector to run cypher query to create constraints. While executing its given an error.. I tried multiple ways to change the databricks runtime version and spark connector version, but no luck.\r\n\r\nError msg:\r\nIllegalArgumentException: Please provide a valid WRITE query.\r\n\r\nI tried to test using multiple version of databricks runtime along with spark connector and did not get any luck.\r\nHere is the code.\r\n\r\n```\r\nfrom pyspark.sql import SparkSession\r\n\r\n# Initialize Spark session\r\nspark = SparkSession.builder \\\r\n .appName(&quot;Neo4j Integration&quot;) \\\r\n .getOrCreate()\r\n\r\n# Neo4j connection config\r\nneo4j_config = {\r\n &quot;url&quot;: &quot;bolt://localhost:7687&quot;,\r\n &quot;authentication.type&quot;: &quot;basic&quot;,\r\n &quot;authentication.basic.username&quot;: &quot;&lt;username&gt;&quot;,\r\n &quot;authentication.basic.password&quot;: &quot;password&quot;\r\n}\r\n\r\n# Sample data\r\ndata = [\r\n{&quot;id&quot;: &quot;1&quot;, &quot;name&quot;: &quot;Alice&quot;}\r\n]\r\n \r\n# Create DataFrame\r\ndf = spark.createDataFrame(data)\r\n \r\n \r\nConstraints_Query = &quot;&quot;&quot;\r\nCREATE CONSTRAINT unique_person IF NOT EXISTS FOR (p:Person) REQUIRE p.name IS UNIQUE\r\n&quot;&quot;&quot;\r\n# Execute Cypher query to create constraint\r\ndf.write.format(&quot;org.neo4j.spark.DataSource&quot;) \\\r\n    .options(**neo4j_config) \\\r\n    .option(&quot;query&quot;, Constraints_Query) \\\r\n    .option(&quot;database&quot;, &quot;neo4j&quot;)\\\r\n    .mode(&#39;Overwrite&#39;)\\\r\n    .save()\r\n```\r\n","link":"https://stackoverflow.com/questions/79688890/unable-to-run-neo4j-create-constraint-cypher-query-from-databricks-using-pyspark","title":"Unable to run neo4j create constraint cypher query from Databricks using pyspark connector"},{"tags":["neo4j","spring-data-neo4j","neo4jclient"],"answers":[{"comments":[{"owner":{"reputation":1139,"user_id":20882864,"user_type":"registered","profile_image":"https://i.sstatic.net/CCQCy.jpg?s=256","display_name":"Marce Puente","link":"https://stackoverflow.com/users/20882864/marce-puente"},"edited":false,"score":0,"creation_date":1761954012,"post_id":79806029,"comment_id":140830263,"link":"https://stackoverflow.com/questions/79673720/i-am-using-neo4j-5-26-0-getting-ongoing-transaction-error/79806029#comment140830263_79806029"}],"tags":[],"owner":{"reputation":1,"user_id":1548893,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/ea38f3e8079570f892e7f88000c16f15?s=256&d=identicon&r=PG","display_name":"user1548893","link":"https://stackoverflow.com/users/1548893/user1548893"},"last_editor":{"reputation":1,"user_id":1548893,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/ea38f3e8079570f892e7f88000c16f15?s=256&d=identicon&r=PG","display_name":"user1548893","link":"https://stackoverflow.com/users/1548893/user1548893"},"comment_count":1,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1761929236,"last_edit_date":1761929236,"creation_date":1761929157,"answer_id":79806029,"question_id":79673720,"share_link":"https://stackoverflow.com/a/79806029","body_markdown":"I was able to solve this issue by changing my code from\r\n\r\n```\r\n@Configuration\r\n@EnableTransactionManagement\r\npublic class Neo4jConfig {\r\n\r\n    @Bean\r\n    public Neo4jTransactionManager transactionManager(org.neo4j.driver.Driver driver) {\r\n        Neo4jTransactionManager manager = new Neo4jTransactionManager(driver);\r\n        manager.setValidateExistingTransaction(true);\r\n        manager.\r\n        return manager;\r\n    }\r\n}\r\n```\r\n\r\nto\r\n\r\n```\r\n@Configuration\r\n@EnableTransactionManagement\r\npublic class Neo4jConfig {\r\n\r\n    @Value(&quot;${spring.data.neo4j.database}&quot;)\r\n    private String database;\r\n\r\n    @Bean\r\n    public DatabaseSelectionProvider databaseSelectionProvider() {\r\n        return () -&gt; DatabaseSelection.byName(database);\r\n    }\r\n\r\n    @Bean\r\n    public Neo4jClient neo4jClient(Driver driver, DatabaseSelectionProvider provider) {\r\n        return Neo4jClient.with(driver)\r\n                .withDatabaseSelectionProvider(provider)\r\n                .build();\r\n    }\r\n\r\n    @Bean\r\n    public PlatformTransactionManager transactionManager(Driver driver, DatabaseSelectionProvider provider) {\r\n        return Neo4jTransactionManager.with(driver)\r\n                .withDatabaseSelectionProvider(provider)\r\n                .build();\r\n    }\r\n}\r\n```\r\n\r\nI found this on a Chinese website, along with an explanation: https://leileiluoluo-com.translate.goog/posts/spring-data-neo4j-database-config-error.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=sv&amp;_x_tr_pto=wapp","link":"https://stackoverflow.com/questions/79673720/i-am-using-neo4j-5-26-0-getting-ongoing-transaction-error/79806029#79806029","title":"I am using neo4j 5.26.0, getting Ongoing Transaction error"}],"owner":{"reputation":1,"user_id":29803265,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/19ce02394edbba4814601cdaf02ae9da?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Ankit Lokhande","link":"https://stackoverflow.com/users/29803265/ankit-lokhande"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":80,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1761929236,"creation_date":1750438184,"question_id":79673720,"share_link":"https://stackoverflow.com/q/79673720","body_markdown":"\\*\\*There is already an ongoing Spring transaction for the default user of the default database, but you requested the default user of &#39;neo4j&#39;\r\n\\*\\*\r\nAbove issue comes when I do neo4jTemplate.save(entities), neo4jTemplate is autowired.\r\nbelow is my initialisation method which is used in testcases\r\n\r\n```\r\n      void initialize(ConfigurableApplicationContext context) {\r\n      Map&lt;String, String&gt; properties = [\r\n          &quot;spring.neo4j.uri&quot;                    : neo4j.boltURI().toString(),\r\n          &quot;spring.neo4j.authentication.username&quot;: &quot;neo4j&quot;,\r\n          &quot;spring.neo4j.authentication.password&quot;: &quot;Test@1234&quot;,\r\n          &quot;spring.neo4j.database&quot;               : &quot;neo4j&quot;,\r\n          &quot;spring.data.neo4j.database&quot;          : &quot;neo4j&quot;,\r\n          &quot;product&quot;                             : &quot;flamingo&quot;,\r\n          &quot;auth.strategy&quot;                       : &quot;jwt&quot;,\r\n          &quot;spring.jpa.database-platform&quot;    :&quot;org.hibernate.dialect.PostgreSQLDialect&quot;,\r\n          &quot;spring.jpa.hibernate.ddl-auto&quot;       : &quot;create&quot;\r\n      ]\r\n      TestPropertyValues.of(properties).applyTo(context.environment)\r\n    }\r\n```\r\n\r\nI have tried everything that chatGpt suggested.","link":"https://stackoverflow.com/questions/79673720/i-am-using-neo4j-5-26-0-getting-ongoing-transaction-error","title":"I am using neo4j 5.26.0, getting Ongoing Transaction error"},{"tags":["neo4j","metrics","jmx","jconsole","mbeans"],"owner":{"reputation":1,"user_id":13641375,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/4119bb33a0302b0bde45b6238b67a3c1?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Joice Joy","link":"https://stackoverflow.com/users/13641375/joice-joy"},"last_editor":{"reputation":6507,"user_id":12892553,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/f7430006a38ea2860db6e020493893c0?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Nimantha","link":"https://stackoverflow.com/users/12892553/nimantha"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":51,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1750335118,"creation_date":1750334515,"last_edit_date":1750335118,"question_id":79672018,"share_link":"https://stackoverflow.com/q/79672018","body_markdown":"I&#39;m currently using Neo4j version 4.4.42 via Neo4j Desktop and I&#39;m able to connect to Neo4j JVM process using JConsole, and under the MBeans section, I can see some Page Cache metrics.\r\n\r\nHowever, I noticed that only a limited set of attributes are visible—specifically: hits,hit ratio,page faults,usage ratio.\r\n\r\nAccording to the official Neo4j metrics reference:\r\n :link: https://neo4j.com/docs/operations-manual/4.4/monitoring/metrics/reference/\r\nThere are many more Page Cache-related attributes (e.g., bytesRead, bytesWritten, etc.) that I expected to see, but they are not present in JConsole.\r\n\r\nTo cross-check, I also tested this in Neo4j version 5.26.6, and observed the same issue—only a minimal set of Page Cache metrics are exposed via JMX.\r\n\r\nIs this expected behaviour in these versions, or is there an additional configuration required to expose the complete set of Page Cache metrics via JMX?","link":"https://stackoverflow.com/questions/79672018/missing-or-incomplete-page-cache-jmx-metrics-for-neo4j","title":"Missing or incomplete Page Cache JMX metrics for Neo4J"},{"tags":["linux","docker-compose","neo4j"],"comments":[{"owner":{"reputation":20225,"user_id":2662355,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/6ea0a9d988f145b0e666dfdd96374736?s=256&d=identicon&r=PG","display_name":"Christophe Willemsen","link":"https://stackoverflow.com/users/2662355/christophe-willemsen"},"edited":false,"score":0,"creation_date":1750316414,"post_id":79671632,"comment_id":140525789,"link":"https://stackoverflow.com/questions/79671632/problems-setting-up-neo4j-apoc-with-docker-compose#comment140525789_79671632"},{"owner":{"reputation":1,"user_id":-1,"user_type":"moderator","profile_image":"https://www.gravatar.com/avatar/a007be5a61f6aa8f3e85ae2fc18dd66e?s=256&d=identicon&r=PG","display_name":"Community","link":"https://stackoverflow.com/users/-1/community"},"edited":false,"score":0,"creation_date":1750322597,"post_id":79671632,"comment_id":140526043,"link":"https://stackoverflow.com/questions/79671632/problems-setting-up-neo4j-apoc-with-docker-compose#comment140526043_79671632"}],"owner":{"reputation":1,"user_id":24364042,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5547f6bd1d8e5a75d60e1804fd5a9da2?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Grumpel Pumpel Alias","link":"https://stackoverflow.com/users/24364042/grumpel-pumpel-alias"},"last_editor":{"reputation":1,"user_id":24364042,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5547f6bd1d8e5a75d60e1804fd5a9da2?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Grumpel Pumpel Alias","link":"https://stackoverflow.com/users/24364042/grumpel-pumpel-alias"},"comment_count":2,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":89,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1750334689,"creation_date":1750315347,"last_edit_date":1750334689,"question_id":79671632,"share_link":"https://stackoverflow.com/q/79671632","body_markdown":"edit2: solved this by downloading apoccore to enhance apocextended\r\n\r\nedit: running this \r\n\r\n    `match (from:_Category)&lt;-[:_from]-(r:_Relationship)-[:_to]-&gt;(to:_Category)\r\n    match (x)-[rel]-&gt;(y)\r\n    where type(rel) = r.name\r\n    call apoc.create.addLabels(x,[from.name]) yield node as xs\r\n    call apoc.create.addLabels(y,[to.name]) yield node as ys\r\n    return count(xs) + count(ys) + &quot; nodes updated&quot;`\r\n\r\ni get this error: Neo.ClientError.Procedure.ProcedureNotFound\r\nThere is no procedure with the name `apoc.create.addLabels` registered for this database instance. Please ensure you&#39;ve spelled the procedure name correctly and that the procedure is properly deployed.\r\n\r\nmy yaml file looks like this:\r\n\r\n    services:\r\n      neo4j:\r\n        image: neo4j:latest\r\n        volumes:\r\n            - /home/ted/neo4j/logs:/logs\r\n          #  - /home/ted/neo4j/conf:/conf\r\n            - /home/ted/neo4j/data:/data\r\n            - /home/ted/neo4j/plugins:/plugins\r\n        environment:\r\n          - NEO4J_dbms_security_procedures_unrestricted=apoc.*\r\n          - NEO4J_dbms_security_procedures_allowlist=apoc.*\r\n          - NEO4J_apoc_import_file_enabled=true\r\n          - NEO4J_apoc_export_file_enabled=true\r\n          - NEO4J_apoc_trigger_enabled=true\r\n          - NEO4J_dbms_security_procedures_unrestricted=*\r\n        ports:\r\n          - &quot;7474:7474&quot;\r\n          - &quot;7687:7687&quot;\r\n        restart: unless-stopped\r\n\r\n","link":"https://stackoverflow.com/questions/79671632/problems-setting-up-neo4j-apoc-with-docker-compose","title":"Problems setting up Neo4j APOC with docker compose"},{"tags":["spring-boot","neo4j","jhipster","spring-data-neo4j","spring-restcontroller"],"comments":[{"owner":{"reputation":1,"user_id":-1,"user_type":"moderator","profile_image":"https://www.gravatar.com/avatar/a007be5a61f6aa8f3e85ae2fc18dd66e?s=256&d=identicon&r=PG","display_name":"Community","link":"https://stackoverflow.com/users/-1/community"},"edited":false,"score":0,"creation_date":1749766680,"post_id":79664075,"comment_id":140509926,"link":"https://stackoverflow.com/questions/79664075/spring-boot-rest-endpoint-seems-to-not-execute-neo4j-java-driver-statements-jhi#comment140509926_79664075"}],"owner":{"reputation":21,"user_id":23511556,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/ACg8ocLdHRbC3XRplavtyc2GqKtgLXjHUXuDS6i_qjPh1KT_Qg=k-s256","display_name":"Mouhamad Moustapha Mbaye","link":"https://stackoverflow.com/users/23511556/mouhamad-moustapha-mbaye"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":44,"favorite_count":0,"down_vote_count":0,"up_vote_count":2,"answer_count":0,"score":2,"last_activity_date":1749773856,"creation_date":1749759781,"question_id":79664075,"share_link":"https://stackoverflow.com/q/79664075","body_markdown":"I am integrating Neo4j into my JHipster 8.5.0 / Spring Boot 3.3.0 application.\r\nI have configured a Neo4jConfig with a Driver bean, a Neo4jService to send Cypher statements, and a REST endpoint /api/neo4j/import that calls this service.\r\n\r\n→ The REST endpoint returns 200 OK.\r\n→ Neo4jService is initialized (driver injected).\r\n→ But inside executeCypherStatements(), I never see the expected &quot;Executing Cypher&quot; logs.\r\n→ Also, no Cypher statements appear in Neo4j.\r\n\r\nI added catch blocks but no exception is thrown either.\r\nNeo4j Desktop is running, bolt://localhost:7687 is up, and the driver connects (driver initialized).\r\n\r\nI am using the official neo4j-java-driver version 5.11.0 (not the Spring Boot starter).\r\n\r\n→ Why is my service not executing the Cypher?\r\n→ Is this a limitation of using neo4j-java-driver in JHipster / Spring Boot?\r\n→ Do I need to switch to spring-boot-starter-data-neo4j to make it work properly?\r\n\r\n1- ** I created a Neo4jConfig:**\r\n\r\n```\r\n@Configuration\r\npublic class Neo4jConfig {\r\n    @Value(&quot;${neo4j.uri}&quot;)\r\n    private String uri;\r\n\r\n    @Value(&quot;${neo4j.username}&quot;)\r\n    private String username;\r\n\r\n    @Value(&quot;${neo4j.password}&quot;)\r\n    private String password;\r\n\r\n    @Bean\r\n    public Driver neo4jDriver() {\r\n        return GraphDatabase.driver(uri, AuthTokens.basic(username, password));\r\n    }\r\n}\r\n```\r\n\r\n2- ** I created a Neo4jService:**\r\n\r\n```\r\n@Service\r\npublic class Neo4jService {\r\n    private final Driver driver;\r\n\r\n    public Neo4jService(Driver driver) {\r\n        this.driver = driver;\r\n        System.out.println(&quot;Neo4jService initialized with driver: &quot; + driver);\r\n    }\r\n\r\n    @PostConstruct\r\n    public void postConstruct() {\r\n        System.out.println(&quot;Neo4jService postConstruct - driver: &quot; + driver);\r\n    }\r\n\r\n    public void executeCypherStatements(List&lt;String&gt; statements) {\r\n        try (Session session = driver.session()) {\r\n            System.out.println(&quot;Neo4jService → session opened&quot;);  // I added this\r\n            for (String stmt : statements) {\r\n                System.out.println(&quot;Executing Cypher: &quot; + stmt);\r\n                session.run(stmt);\r\n            }\r\n        } catch (Exception e) {\r\n            System.out.println(&quot;Neo4jService ERROR → &quot; + e.getMessage());\r\n            e.printStackTrace();\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n\r\n3- ** I created a REST controller:**\r\n\r\n```\r\n@RestController\r\n@RequestMapping(&quot;/api/neo4j&quot;)\r\npublic class Neo4jImportResource {\r\n    private final Neo4jService neo4jService;\r\n\r\n    @Autowired\r\n    public Neo4jImportResource(Neo4jService neo4jService) {\r\n        this.neo4jService = neo4jService;\r\n    }\r\n\r\n    @PostMapping(&quot;/import&quot;)\r\n    public ResponseEntity&lt;String&gt; importGraph() {\r\n        List&lt;String&gt; statements = List.of(\r\n            &quot;MERGE (a:TestNode {name: &#39;NodeA&#39;})&quot;,\r\n            &quot;MERGE (b:TestNode {name: &#39;NodeB&#39;})&quot;,\r\n            &quot;MERGE (a)-[:CONNECTED_TO]-&gt;(b)&quot;\r\n        );\r\n\r\n        neo4jService.executeCypherStatements(statements);\r\n\r\n        return ResponseEntity.ok(&quot;Import done&quot;);\r\n    }\r\n}\r\n```\r\n\r\n\r\n4- **In my application-dev.yml I configured:**\r\n\r\n```\r\nneo4j:\r\n  uri: bolt://localhost:7687\r\n  username: neo4j\r\n  password: mypassword\r\n\r\n```\r\n\r\n\r\n5- **Result:**\r\n\r\nI can see in backend console:\r\n```\r\nNeo4jService initialized with driver: org.neo4j.driver.internal.InternalDriver@xxxx\r\nNeo4jService postConstruct, driver: org.neo4j.driver.internal.InternalDriver@xxxx\r\n```\r\n\r\nWhen I `POST /api/neo4j/import` I get HTTP 200 OK.\r\n\r\nBUT I do NOT see:\r\n```\r\nNeo4jService → session opened\r\nExecuting Cypher: ...\r\n```\r\n→ It seems that executeCypherStatements() is not really executing → or that driver.session() fails silently.\r\n\r\n6- **Context**\r\nNeo4j Desktop is started, with base neo4j running on port 7687.\r\n\r\nThe driver does connect (since driver is initialized).\r\n\r\nNo exception printed in catch block → but nothing runs.\r\n\r\nJHipster project (so I use Gradle and neo4j-java-driver 5.11.0, not spring-boot-starter-data-neo4j).\r\n\r\n\r\n7- **Question:**\r\n- Why is my Neo4jService.executeCypherStatements() apparently not running?\r\n- Why does session.run() produce no log / no exception but also no Cypher in Neo4j?\r\n- Is this a problem with neo4j-java-driver used inside JHipster / Spring Boot? Do I need spring-boot-starter-data-neo4j instead?\r\n\r\n→ Any advice welcome, I just want to inject Cypher statements reliably from my REST controller.\r\n\r\nThanks in advance!","link":"https://stackoverflow.com/questions/79664075/spring-boot-rest-endpoint-seems-to-not-execute-neo4j-java-driver-statements-jhi","title":"Spring Boot REST endpoint seems to not execute Neo4j Java driver statements (JHipster + Neo4jConfig + Neo4jService) → no Cypher run"},{"tags":["python","neo4j","cypher"],"owner":{"reputation":2304,"user_id":11793491,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/475ba136105fb3c2c2cb460014db95fa?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Alexis","link":"https://stackoverflow.com/users/11793491/alexis"},"last_editor":{"reputation":2304,"user_id":11793491,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/475ba136105fb3c2c2cb460014db95fa?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Alexis","link":"https://stackoverflow.com/users/11793491/alexis"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":153,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1749641057,"creation_date":1749442714,"last_edit_date":1749444570,"question_id":79658347,"share_link":"https://stackoverflow.com/q/79658347","body_markdown":"I have the following query in Neo4j using the Python library graphdatascience:\r\n```python\r\nG, result = gds.graph.project(\r\n    &quot;communities&quot;,  #  Graph name\r\n    &quot;__Entity__&quot;,  #  Node projection\r\n    {\r\n        &quot;_ALL_&quot;: {\r\n            &quot;type&quot;: &quot;*&quot;,\r\n            &quot;orientation&quot;: &quot;UNDIRECTED&quot;,\r\n            &quot;properties&quot;: {&quot;weight&quot;: {&quot;property&quot;: &quot;*&quot;, &quot;aggregation&quot;: &quot;COUNT&quot;}},\r\n        }\r\n    },\r\n)\r\n```\r\n\r\nAnd I try to run this for a filtered selection of nodes. So I used this:\r\n\r\n```python\r\nG, result = gds.graph.cypher.project(\r\n    &quot;&quot;&quot;\r\n    MATCH (n:__Entity__)--(m:__Entity__) \r\n    WHERE n.node_embedding IS NOT NULL \r\n    AND m.node_embedding IS NOT NULL \r\n    AND n.docID = $doc \r\n    AND m.docID = $doc \r\n    RETURN gds.graph.project($graph_name, n, m, \r\n    {\r\n        sourceNodeLabels: $label,\r\n        targetNodeLabels: $label,\r\n        sourceNodeProperties: n { .weight },\r\n        targetNodeProperties: m { .weight }\r\n    }, \r\n    {\r\n        undirectedRelationshipTypes: [&#39;*&#39;]\r\n    })\r\n    &quot;&quot;&quot;,\r\n    database=&#39;neo4j&#39;,\r\n    graph_name=&#39;communities&#39;,\r\n    label=&#39;__Entity__&#39;,\r\n    doc=&#39;Gasification&#39;\r\n)\r\n```\r\nBut I&#39;m stuck on how to relate the `&quot;properties&quot;: {&quot;weight&quot;: {&quot;property&quot;: &quot;*&quot;, &quot;aggregation&quot;: &quot;COUNT&quot;}}` in the code. Any pointer will be highly appreciated.","link":"https://stackoverflow.com/questions/79658347/how-to-form-a-projection-while-filtering-some-nodes-in-neo4j","title":"How to form a projection while filtering some nodes in Neo4j"},{"tags":["vector","neo4j","similarity","cosine-similarity","similarity-search"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":true,"score":0,"last_activity_date":1749165216,"last_edit_date":1749165216,"creation_date":1749055710,"answer_id":79653185,"question_id":79652973,"share_link":"https://stackoverflow.com/a/79653185","body_markdown":"The Cypher manual [documents](https://neo4j.com/docs/cypher-manual/current/indexes/semantic-indexes/vector-indexes/#similarity-functions) (in the &quot;Learn more about the cosine similarity function&quot; dropdown) that Neo4j&#39;s vector index uses a **normalized cosine similarity** function that maps values to the range **\\[0, 1\\]** rather than the traditional **\\[-1, 1\\]**.\r\n\r\nWhile the normalized and traditional calculations are equally valid for comparing similarity, you must avoid mixing their results in the same context or comparison.","link":"https://stackoverflow.com/questions/79652973/neo4j-vector-similarity-function/79653185#79653185","title":"Neo4j vector similarity function"}],"owner":{"reputation":13,"user_id":30720106,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/39203e4053f8c5df0d2bf1970fef6d87?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Gal Shubeli","link":"https://stackoverflow.com/users/30720106/gal-shubeli"},"last_editor":{"reputation":15635,"user_id":14732669,"user_type":"registered","profile_image":"https://i.sstatic.net/3NYGa.png?s=256","display_name":"ray","link":"https://stackoverflow.com/users/14732669/ray"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":184,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"accepted_answer_id":79653185,"answer_count":1,"score":1,"last_activity_date":1749165216,"creation_date":1749047393,"last_edit_date":1749048115,"question_id":79652973,"share_link":"https://stackoverflow.com/q/79652973","body_markdown":"I&#39;m trying to understand the difference between the `vector.similarity.cosine` Cypher function and the `gds.similarity.cosine` function in Neo4j. According to the [Neo4j documentation](https://neo4j.com/docs/graph-data-science/current/algorithms/similarity-functions/), both are used to compute cosine similarity, but I’m getting different results from them.\r\n\r\nFor example, given the following vectors:\r\n- Vector A: [1.0, 5.0, 3.0, 6.7]\r\n- Vector B: [5.0, 2.5, 3.1, 9.0]]\r\n\r\nWhen I use `vector.similarity.cosine(A, B)`, I get result 0.941, but using `gds.similarity.cosine(A, B)` should give 0.882. The equation cosine similarity (with numpy) calculation gives 0.882.\r\n\r\nWhy are these values different? Is there a difference in normalization, implementation details, or expected input formats between the two functions?\r\n\r\n![enter image description here][1]\r\n\r\nAny insights would be appreciated.\r\n\r\n\r\n  [1]: https://i.sstatic.net/iLiBlXj8.png","link":"https://stackoverflow.com/questions/79652973/neo4j-vector-similarity-function","title":"Neo4j vector similarity function"},{"tags":["python","graph","neo4j","networkx","random-walk"],"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1748906303,"post_id":79650281,"comment_id":140481749,"link":"https://stackoverflow.com/questions/79650281/how-can-i-create-graph-projections-in-neo4j-for-a-very-large-graph#comment140481749_79650281"},{"owner":{"reputation":71,"user_id":12815867,"user_type":"registered","profile_image":"https://i.sstatic.net/Lh4Rw.jpg?s=256","display_name":"Karthick Durai","link":"https://stackoverflow.com/users/12815867/karthick-durai"},"reply_to_user":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1748941747,"post_id":79650281,"comment_id":140482673,"link":"https://stackoverflow.com/questions/79650281/how-can-i-create-graph-projections-in-neo4j-for-a-very-large-graph#comment140482673_79650281"}],"answers":[{"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":1,"creation_date":1748969372,"post_id":79651568,"comment_id":140484207,"link":"https://stackoverflow.com/questions/79650281/how-can-i-create-graph-projections-in-neo4j-for-a-very-large-graph/79651568#comment140484207_79651568"}],"tags":[],"owner":{"reputation":71,"user_id":12815867,"user_type":"registered","profile_image":"https://i.sstatic.net/Lh4Rw.jpg?s=256","display_name":"Karthick Durai","link":"https://stackoverflow.com/users/12815867/karthick-durai"},"comment_count":1,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1748966836,"creation_date":1748966836,"answer_id":79651568,"question_id":79650281,"share_link":"https://stackoverflow.com/a/79651568","body_markdown":"I think I found the answer to my question. So if my goal is to create node embeddings using the random walk algorithm. I could potentially only store the node_ids as projected graph. Then while creating the random walk for each start node, proceed to collect all the node_ids, then make a cypher query to retrieve their properties and labels separately. By this approach, I reduce the memory footprint, but end up loosing up on time, by making one additional query per walk. Would this be a viable solution?","link":"https://stackoverflow.com/questions/79650281/how-can-i-create-graph-projections-in-neo4j-for-a-very-large-graph/79651568#79651568","title":"How can I create graph Projections in Neo4J for a very large graph"}],"owner":{"reputation":71,"user_id":12815867,"user_type":"registered","profile_image":"https://i.sstatic.net/Lh4Rw.jpg?s=256","display_name":"Karthick Durai","link":"https://stackoverflow.com/users/12815867/karthick-durai"},"last_editor":{"reputation":2634,"user_id":11703584,"user_type":"registered","profile_image":"https://i.sstatic.net/OQBDLq18.jpg?s=256","display_name":"Olamide","link":"https://stackoverflow.com/users/11703584/olamide"},"comment_count":2,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":82,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":1,"score":1,"last_activity_date":1748966836,"creation_date":1748895559,"last_edit_date":1748909934,"question_id":79650281,"share_link":"https://stackoverflow.com/q/79650281","body_markdown":"I have 7M nodes and 20M relationships, my goal is to run random walk and node2vec using gds. \r\nMy current strategy is -&gt; create graph projection, run random walk , use my custom python code to create embeddings and store it to s3, then to mongo Atlas. \r\nI&#39;m stuck in a problem, I am running out of heap memory:\r\n&gt; Failed to invoke procedure gds.graph.project: Caused by: java.lang.IllegalStateException: Procedure was blocked since maximum estimated memory (5271 MiB) exceeds current free memory (3068 MiB). Consider resizing your Aura instance via console.neo4j.io. Alternatively, use &#39;sudo: true&#39; to override the memory validation. Overriding the validation is at your own risk. The database can run out of memory and data can be lost.```\r\n\r\nThe data is very important, so I can&#39;t take the risk of overriding this. Is there any solution to do this, without buying a larger instance, I suppose? \r\nI wanted to load it in batches, but then the problem is that there is no certainty that the nodes will be connected, since it will be retrieved based on the ID field. How do I make this work?\r\n\r\nI don&#39;t even need the gds to be honest. Just want a methodology to sample connected components of fixed size, then import them to networkx, after which I can handle them. \r\n\r\nPlease, I am looking for support.","link":"https://stackoverflow.com/questions/79650281/how-can-i-create-graph-projections-in-neo4j-for-a-very-large-graph","title":"How can I create graph Projections in Neo4J for a very large graph"},{"tags":["neo4j","cypher"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1748886986,"last_edit_date":1748886986,"creation_date":1748886368,"answer_id":79650105,"question_id":79649976,"share_link":"https://stackoverflow.com/a/79650105","body_markdown":"### Data Model\r\n\r\nBefore answering your question, I have comments on your data model.\r\n\r\n1. If your `Parent` nodes do not represent childless people, then your query does not &quot;reach the deceased relatives&quot; of childless people.\r\n\r\n   (a) Also, when a person becomes a parent, you will have to change their node label to `Parent`, or add that as an additional label if the existing labels should remain. That is somewhat expensive and could disrupt to the structure of a graph.\r\n\r\n   (b) But you do not necessarily even need to have the `Parent` label, since you can tell just by the presence and directionality of any `has_parent` or `has_child` relationship on a node that it is a parent.\r\n\r\n2. When a person dies, you will have to change their node label to `Deceased`, or add that as an additional label if the existing labels should remain. The usual way to change the state of a node is to change a node property, rather than changing/adding a label - which is more expensive and could more disruptive to the structure of a graph.\r\n\r\n3. Unless necessary for speeding up specific queries, you should avoid redundant labels like (`Parent`) when you can already tell by incoming `has_parent` or outgoing `has_child` relationships that a node is a parent. Avoiding redundancy would simplify your queries and avoid potential inconsistencies.\r\n\r\n4. It is an anti-pattern to have relationships types like `has_parent` and `has_child` that always point in opposite directions. You only need one of those relationship types, since you can easily use the directionality of either type to determine which node is the parent or child. It also unnecessarily increases the size of your DB .\r\n\r\n   - The use of both of those relationship types in your query is probably causing you to get duplicate results, which is doubling your response time.\r\n\r\n### Faster Query\r\n\r\nThe following query should be twice as fast as your query, as it uses just one of the `has_parent`|`has_child` relationship types. It does not attempt to address the other data model issues I identified.\r\n\r\n```\r\nMATCH (n:Parent)-[:has_parent*..2]-(m:Deceased)\r\nRETURN n.name, n.age, m.name, m.age\r\n```","link":"https://stackoverflow.com/questions/79649976/fastest-approach-on-non-directional-paths-neo4j/79650105#79650105","title":"Fastest approach on non directional paths. Neo4j"}],"owner":{"reputation":61,"user_id":18373361,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AATXAJyknuFp2jQdITz7nfTZM5qO-0Qr-GZs2dk5Y92n=k-s256","display_name":"Christos Grigoriadis","link":"https://stackoverflow.com/users/18373361/christos-grigoriadis"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":45,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1748886986,"creation_date":1748880232,"question_id":79649976,"share_link":"https://stackoverflow.com/q/79649976","body_markdown":"I have a path like this: \r\n```\r\nMATCH (n:Parent)-[:has_parent|has_child*..2]-(m:Deceased)\r\nRETURN n.name, n.age, m.name,m.age\r\n```\r\nMy problem of course is that this is non-directional and super slow. In this path I would like to reach the deceased relatives of a person. I am interested in the first level and second level results so I practically do not want to change anything in the query except the way to get the results.\r\n\r\nIs there an apoc function that would do something like that? It is important to keep the structure the same, meaning labels and relationships.\r\n\r\nI found apoc.path.expandConfig but it is not that fast. ","link":"https://stackoverflow.com/questions/79649976/fastest-approach-on-non-directional-paths-neo4j","title":"Fastest approach on non directional paths. Neo4j"},{"tags":["spring-boot","gradle","neo4j","slf4j","spring-data-neo4j"],"answers":[{"tags":[],"owner":{"reputation":994,"user_id":1797200,"user_type":"registered","accept_rate":75,"profile_image":"https://i.sstatic.net/K3QjV.jpg?s=256","display_name":"Chris","link":"https://stackoverflow.com/users/1797200/chris"},"last_editor":{"reputation":994,"user_id":1797200,"user_type":"registered","accept_rate":75,"profile_image":"https://i.sstatic.net/K3QjV.jpg?s=256","display_name":"Chris","link":"https://stackoverflow.com/users/1797200/chris"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1748857943,"last_edit_date":1748857943,"creation_date":1748716179,"answer_id":79646877,"question_id":79646876,"share_link":"https://stackoverflow.com/a/79646877","body_markdown":"It took me a couple of hours to get the right configuration, with a lot of trial and error.\r\n\r\nThis is what I came up with: I had to exclude a couple of transient dependencies globally.\r\n\r\nInclude these excludes in your configurations block:\r\n\r\n```groovy\r\nconfigurations {\r\n    configureEach {\r\n        exclude group: &#39;commons-logging&#39;, module: &#39;commons-logging&#39;\r\n        exclude group: &#39;org.neo4j&#39;, module: &#39;neo4j-logging&#39;\r\n        exclude group: &#39;ch.qos.logback&#39;, module: &#39;logback-classic&#39;\r\n    }\r\n}\r\n```\r\n\r\nI did not find a way to exclude those packages only for the tests, but I guess that&#39;s not a problem. The first exclude is not strictly necessary for my project to work, but it makes the warning about commons-logging.jar go away.\r\n\r\nSo I had to use `configureEach` to remove the dependencys from all scopes, because removing if from `testRuntimeOnly` or other test scopes did not work for some reason.\r\n\r\nFor the casting error to the apache logger, use this configuration:\r\n\r\n```\r\nconfigurations {\r\n    configureEach {\r\n        exclude group: &#39;commons-logging&#39;, module: &#39;commons-logging&#39;\r\n        exclude group: &#39;org.apache.logging.log4j&#39;, module: &#39;log4j-to-slf4j&#39;\r\n        exclude group: &#39;ch.qos.logback&#39;, module: &#39;logback-classic&#39;\r\n    }\r\n}\r\n```\r\n\r\nYou might have to play around with excluding different combinations of those packages.","link":"https://stackoverflow.com/questions/79646876/multiple-slf4j-providers-with-neo4j-test-harness-2025-04-0-in-gradle/79646877#79646877","title":"Multiple SLF4J Providers with Neo4j Test Harness 2025.04.0 in Gradle"}],"owner":{"reputation":994,"user_id":1797200,"user_type":"registered","accept_rate":75,"profile_image":"https://i.sstatic.net/K3QjV.jpg?s=256","display_name":"Chris","link":"https://stackoverflow.com/users/1797200/chris"},"last_editor":{"reputation":994,"user_id":1797200,"user_type":"registered","accept_rate":75,"profile_image":"https://i.sstatic.net/K3QjV.jpg?s=256","display_name":"Chris","link":"https://stackoverflow.com/users/1797200/chris"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":101,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1748858461,"creation_date":1748716179,"last_edit_date":1748857749,"question_id":79646876,"share_link":"https://stackoverflow.com/q/79646876","body_markdown":"I&#39;m setting up a SpringBoot 3.5.0 project using neo4j with Spring Data Neo4j 7.5.0\r\nFor my tests I want to use Neo4j Test Harness 2025.04.0\r\n\r\nWhen starting the tests I get the following error:\r\n\r\n```\r\nStandard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts\r\nSLF4J(W): Class path contains multiple SLF4J providers.\r\nSLF4J(W): Found provider [org.neo4j.server.logging.slf4j.SLF4JLogBridge@294e5088]\r\nSLF4J(W): Found provider [ch.qos.logback.classic.spi.LogbackServiceProvider@51972dc7]\r\nSLF4J(W): See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.\r\nSLF4J(I): Actual provider is of type [org.neo4j.server.logging.slf4j.SLF4JLogBridge@294e5088]\r\n```\r\nIn earlier versions, you had to exclude ```org.slf4j:slf4j-nop```, but that does not do the trick in this configuration.\r\n\r\nSo after playing around I ran into another problem with Harness v5.26.7:\r\n```\r\nclass org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to class org.apache.logging.log4j.core.LoggerContext\r\n```\r\n","link":"https://stackoverflow.com/questions/79646876/multiple-slf4j-providers-with-neo4j-test-harness-2025-04-0-in-gradle","title":"Multiple SLF4J Providers with Neo4j Test Harness 2025.04.0 in Gradle"},{"tags":["database","neo4j","cap"],"answers":[{"comments":[{"owner":{"reputation":13,"user_id":15050268,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GhMei_vtrhAyNMDdMtUcNrPu4cIIpgOEpdBE-8RoA=k-s256","display_name":"Alexhs","link":"https://stackoverflow.com/users/15050268/alexhs"},"edited":false,"score":0,"creation_date":1747669441,"post_id":79628629,"comment_id":140439807,"link":"https://stackoverflow.com/questions/79628580/cap-theorem-for-neo4j-what-type-is-it/79628629#comment140439807_79628629"}],"tags":[],"owner":{"reputation":26,"user_id":22214354,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/96faa0d16e180bc41836018844e66c62?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Jonathan Giffard","link":"https://stackoverflow.com/users/22214354/jonathan-giffard"},"last_editor":{"reputation":26,"user_id":22214354,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/96faa0d16e180bc41836018844e66c62?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Jonathan Giffard","link":"https://stackoverflow.com/users/22214354/jonathan-giffard"},"comment_count":1,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1747653764,"last_edit_date":1747653764,"creation_date":1747653674,"answer_id":79628629,"question_id":79628580,"share_link":"https://stackoverflow.com/a/79628629","body_markdown":"Please take a look at these two docs areas.   I acknowledge that the journey between them is not clear and I&#39;ll pass that onto our docs folks\r\n\r\nhttps://neo4j.com/docs/operations-manual/current/clustering/introduction/\r\n\r\nGives this sentence\r\n\r\n1. **Causal consistency:** When invoked, a client application is guaranteed to read at least its own writes.\r\n\r\nIf you then jump over to drivers, you&#39;ll find this for the Java Driver ( also applies to others as well ) https://neo4j.com/docs/java-manual/current/bookmarks/  \r\n  \r\n  \r\nPlease let me know if this is of help.","link":"https://stackoverflow.com/questions/79628580/cap-theorem-for-neo4j-what-type-is-it/79628629#79628629","title":"CAP theorem for Neo4j, what type is it?"}],"owner":{"reputation":13,"user_id":15050268,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GhMei_vtrhAyNMDdMtUcNrPu4cIIpgOEpdBE-8RoA=k-s256","display_name":"Alexhs","link":"https://stackoverflow.com/users/15050268/alexhs"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":243,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"accepted_answer_id":79628629,"answer_count":1,"score":1,"last_activity_date":1747653764,"creation_date":1747651477,"question_id":79628580,"share_link":"https://stackoverflow.com/q/79628580","body_markdown":"I can&#39;t find information on this at all. I understand that a single instance database is CA by default and that when using a cluster Neo4j by default uses casual consistency which makes it **CP**, but I can&#39;t seem to find if you can choose the consistency. I also read later that it focuses on high-availability and the infomration I have read thus far condradicts itself.\r\n\r\nYes I have researched this and yes I have used AI to maybe find more sources but AI also condraticts itself. No I am not lazy and didn&#39;t just rely on AI.\r\n\r\nI am really unsure if what I am saying is true, please feel free to correct me and explain CAP in regards to Neo4j.","link":"https://stackoverflow.com/questions/79628580/cap-theorem-for-neo4j-what-type-is-it","title":"CAP theorem for Neo4j, what type is it?"},{"tags":["neo4j"],"answers":[{"comments":[{"owner":{"reputation":6847,"user_id":583367,"user_type":"registered","accept_rate":70,"profile_image":"https://www.gravatar.com/avatar/3e0c104f28bb57676287ba630707410a?s=256&d=identicon&r=PG","display_name":"Arjun","link":"https://stackoverflow.com/users/583367/arjun"},"edited":false,"score":0,"creation_date":1747251106,"post_id":79621621,"comment_id":140426379,"link":"https://stackoverflow.com/questions/79621056/neo4j-cluster-ha-setup/79621621#comment140426379_79621621"},{"owner":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"reply_to_user":{"reputation":6847,"user_id":583367,"user_type":"registered","accept_rate":70,"profile_image":"https://www.gravatar.com/avatar/3e0c104f28bb57676287ba630707410a?s=256&d=identicon&r=PG","display_name":"Arjun","link":"https://stackoverflow.com/users/583367/arjun"},"edited":false,"score":0,"creation_date":1747331760,"post_id":79621621,"comment_id":140429852,"link":"https://stackoverflow.com/questions/79621056/neo4j-cluster-ha-setup/79621621#comment140429852_79621621"},{"owner":{"reputation":6847,"user_id":583367,"user_type":"registered","accept_rate":70,"profile_image":"https://www.gravatar.com/avatar/3e0c104f28bb57676287ba630707410a?s=256&d=identicon&r=PG","display_name":"Arjun","link":"https://stackoverflow.com/users/583367/arjun"},"edited":false,"score":0,"creation_date":1747386210,"post_id":79621621,"comment_id":140431573,"link":"https://stackoverflow.com/questions/79621056/neo4j-cluster-ha-setup/79621621#comment140431573_79621621"},{"owner":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"reply_to_user":{"reputation":6847,"user_id":583367,"user_type":"registered","accept_rate":70,"profile_image":"https://www.gravatar.com/avatar/3e0c104f28bb57676287ba630707410a?s=256&d=identicon&r=PG","display_name":"Arjun","link":"https://stackoverflow.com/users/583367/arjun"},"edited":false,"score":0,"creation_date":1747427714,"post_id":79621621,"comment_id":140433827,"link":"https://stackoverflow.com/questions/79621056/neo4j-cluster-ha-setup/79621621#comment140433827_79621621"}],"tags":[],"owner":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"comment_count":4,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1747230446,"creation_date":1747230446,"answer_id":79621621,"question_id":79621056,"share_link":"https://stackoverflow.com/a/79621621","body_markdown":"Database clustering is done on the server side rather than on the application.  You can follow the steps/instructions on this documentation from Neo4j.\r\n\r\n```\r\n\r\nhttps://neo4j.com/docs/operations-manual/current/clustering/\r\n```\r\n\r\nThis link have an example to set-up a 3 node cluster\r\n\r\n```\r\nhttps://neo4j.com/docs/operations-manual/current/clustering/setup/deploy/\r\n```\r\n\r\nBasically, you need to update the neo4j.conf in ALL servers to list all servers that it needs to discover (connect) in case of failure. Param name is dbms.cluster.endpoints.\r\n\r\nfor example: \r\n\r\n```\r\ndbms.cluster.endpoints=server01.example.com:6000,server02.example.com:6000,server03.example.com:6000\r\n```","link":"https://stackoverflow.com/questions/79621056/neo4j-cluster-ha-setup/79621621#79621621","title":"neo4j cluster HA setup"}],"owner":{"reputation":6847,"user_id":583367,"user_type":"registered","accept_rate":70,"profile_image":"https://www.gravatar.com/avatar/3e0c104f28bb57676287ba630707410a?s=256&d=identicon&r=PG","display_name":"Arjun","link":"https://stackoverflow.com/users/583367/arjun"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":95,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1747230446,"creation_date":1747211945,"question_id":79621056,"share_link":"https://stackoverflow.com/q/79621056","body_markdown":"I have a 3-node neo4j cluster and a spring boot application which connects to it for reading data. \r\n\r\nWith below config in application.yml, application is able to connect and read the data.\r\n \r\n\r\n       neo4j:\r\n          db:\r\n            url: neo4j://10.253.229.110:7687\r\n\r\nBut, when 10.253.229.110 goes down, application is unable to serve the data. \r\nHow can I make my application highly available?\r\n\r\nI tried below in application.yaml\r\n \r\n\r\n       neo4j:\r\n          db:\r\n            url: &quot;${GRAPH_CLUSTER_URL:neo4j://10.253.229.110:7687,10.253.228.184:7687,10.252.21.127:7687}&quot;\r\n\r\nBut, getting this error:\r\n\r\n   \r\n\r\n     Caused by: java.lang.IllegalArgumentException: Invalid address format `neo4j://10.253.229.110:7687,10.253.228.184:7687,10.252.21.127:7687`\r\n        \tat org.neo4j.driver.internal.BoltServerAddress.invalidAddressFormat(BoltServerAddress.java:168)\r\n        \tat org.neo4j.driver.internal.BoltServerAddress.invalidAddressFormat(BoltServerAddress.java:164)\r\n        \tat org.neo4j.driver.internal.BoltServerAddress.hostFrom(BoltServerAddress.java:117)\r\n        \tat org.neo4j.driver.internal.BoltServerAddress.&lt;init&gt;(BoltServerAddress.java:45)\r\n        \tat org.neo4j.driver.internal.DriverFactory.newInstance(DriverFactory.java:102)\r\n        \tat org.neo4j.driver.internal.DriverFactory.newInstance(DriverFactory.java:73)\r\n\r\nAny pointers on how can I set up my application, so that even if one node goes down, it can serve the data from other node?\r\n","link":"https://stackoverflow.com/questions/79621056/neo4j-cluster-ha-setup","title":"neo4j cluster HA setup"},{"tags":["neo4j","cypher"],"answers":[{"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1746613265,"creation_date":1746613265,"answer_id":79610311,"question_id":79609683,"share_link":"https://stackoverflow.com/a/79610311","body_markdown":"You could try by moving the second `MATCH` into a `WHERE` clause, as from your description, you are looking for boundary nodes that connect to edge nodes:\r\n```sql\r\nMATCH (e1:ELEMENT {group: 1})-[r:Depending_On]-&gt;(e2:ELEMENT WHERE e2.group &lt;&gt; 1)\r\nWHERE EXISTS { \r\n  MATCH shortestPath( (e1)-[:Depending_On*..5]-(s) )\r\n  WHERE NOT EXISTS { (s)&lt;-[r1:Depending_On]-() }\r\n}\r\nRETURN e1\r\n```\r\nYou should also check whether you can replace the undirected relationship pattern in `shortestPath` with a directed pattern, which will reduce the number of paths explored.\r\n\r\nFailing that, you could &quot;pre-compute&quot; the edge and boundary nodes and give them labels. For example, updating the edge nodes with `EDGE` label like so:\r\n```sql\r\nMATCH (s)\r\nWHERE NOT EXISTS { (s)&lt;-[r1:Depending_On]-() }\r\nSET s:EDGE\r\n```\r\nThen the resulting query you could use should be faster:\r\n```sql\r\nMATCH (e1:ELEMENT&amp;BOUNDARY {group: 1})\r\nWHERE EXISTS { shortestPath( (e1)-[:Depending_On*..5]-(:EDGE) ) }\r\nRETURN e1\r\n```","link":"https://stackoverflow.com/questions/79609683/neo4j-check-if-path-exists-between-multiple-nodes/79610311#79610311","title":"Neo4j check if path exists between multiple nodes"},{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1746722927,"last_edit_date":1746722927,"creation_date":1746645019,"answer_id":79611270,"question_id":79609683,"share_link":"https://stackoverflow.com/a/79611270","body_markdown":"This should find all `edge`/`boundary` pairs for `group` 1:\r\n\r\n```\r\nMATCH (edge:ELEMENT {group:1})-[:Depending_On*..5]-&gt;(boundary:ELEMENT {group:1})\r\nWHERE\r\n  NOT EXISTS { (edge) &lt;-[:Depending_On]-() } AND\r\n  EXISTS { (boundary)-[:Depending_On]-&gt;(x:ELEMENT) WHERE x.group &lt;&gt; 1 }\r\nRETURN DISTINCT edge, boundary\r\n```\r\n\r\nNotes:\r\n\r\n- For clarity, I renamed `s`/`e1` to `edge`/`boundary`.\r\n- `shortestpath` is not used as it is unnecessary for your use case and very expensive.\r\n- `DISTINCT` is used because the same `edge/boundary` pair may be found at multiple distances from each other.\r\n- Using directed relationship patterns (when possible) is more efficient.\r\n- You may want to create an [index](https://neo4j.com/docs/cypher-manual/current/indexes/search-performance-indexes/overview/) on `ELEMENT.group` to optimize your `ELEMENT` lookups.\r\n- You can use a [parameter](https://neo4j.com/docs/cypher-manual/current/syntax/parameters/) instead of hardcoding the group number, to speed up multiple requests with different group numbers.","link":"https://stackoverflow.com/questions/79609683/neo4j-check-if-path-exists-between-multiple-nodes/79611270#79611270","title":"Neo4j check if path exists between multiple nodes"}],"owner":{"reputation":93,"user_id":7456736,"user_type":"registered","accept_rate":0,"profile_image":"https://www.gravatar.com/avatar/06eda0e03dba435918ae0091871a33f9?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Kiras","link":"https://stackoverflow.com/users/7456736/kiras"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":89,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":2,"score":0,"last_activity_date":1746722927,"creation_date":1746581507,"question_id":79609683,"share_link":"https://stackoverflow.com/q/79609683","body_markdown":"I have recently started working on Neo4J and currently I am working on migration project as part of which we need to identify few relationships existing in current Neo4J database. Below are the structure:\r\n\r\nNeo4J database has around \r\n 1. 200k+ Nodes of type ELEMENT and every node can be connected to another element node by relationship (Depending_On)\r\n 2. Every Element node has a property called as group\r\n 3. So if I take one group as an example having max elements(70k), we can categorize ELEMENT nodes as below in points 4 and 5\r\n  \r\n 4. edge node ( no incoming relation but outgoing) (**20k approx for this group**)\r\n 5. boundary node ( which connects to another element node but with\r\n    different group ) ( **8k approx for this group**)\r\n\r\nEventually I need to check whether those 20k edge nodes are connected to 8k boundary nodes within a group or not. Below is the query I am using, but it hangs and never returns the result. Seems like query is trying to find any path exists among (20k*8k) combinations.\r\n\r\nSo need help to understand, and get some pointers on this on how to improve the query or better way. I tried with pagination using skip and offset but seems that didn&#39;t help either\r\n\r\n    match(e1:ELEMENT {group:1}) - [r:Depending_On] -&gt; (e2:ELEMENT) where e2.group &lt;&gt; 1 --&gt; this is giving all boundary nodes for group1\r\n    match(s:ELEMENT {group:1})  where not exists {(s) &lt;-[r1:Depending_On]-()} and exists { shortestPath ((s) - [:Dependding_On*..5] - (e1)} --&gt; This gives edge nodes for group1 and check if any path exist between edge(s) and boundary nodes(e1)\r\n    return s,e\r\n\r\n\r\n\r\nI am using 5.20.0 version for Neo4j\r\n  ","link":"https://stackoverflow.com/questions/79609683/neo4j-check-if-path-exists-between-multiple-nodes","title":"Neo4j check if path exists between multiple nodes"},{"tags":["spring-boot","neo4j","netflix-dgs"],"owner":{"reputation":172,"user_id":7761239,"user_type":"registered","profile_image":"https://i.sstatic.net/kqPBI.jpg?s=256","display_name":"Justus Ikara","link":"https://stackoverflow.com/users/7761239/justus-ikara"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":48,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1745569747,"creation_date":1745569747,"question_id":79592119,"share_link":"https://stackoverflow.com/q/79592119","body_markdown":"I am implementing a DGS dataloader with Spring boot Neo4j,the dataloader part is implemented and fine.However,I need to get the list for Post authors from post.getCreatedBy.getId() to pass to dataloader for batch fetching,but this will cause spring boot neo4j to issue another query,potentially causing N+1 problem which defeats my implementation and the idea of dataloaders altogether.How do I get just the Id from post.createdBy().getId() node without issuing another query?\r\n\r\n \r\n\r\n    @DgsData(parentType = &quot;Post&quot;)\r\n        public CompletableFuture&lt;User&gt; createdBy(DgsDataFetchingEnvironment dfe) {\r\n            Post post = dfe.getSource();\r\n            assert post != null;\r\n            UUID userId =  post.getCreatedBy().getId();\r\n            DataLoader&lt;UUID, User&gt; loader = dfe.getDataLoader(&quot;userDataLoader&quot;);\r\n            assert loader != null;\r\n            return loader.load(userId);\r\n        }\r\n\r\n       Below is Post node\r\n\r\n    \r\n   \r\n\r\n     @EqualsAndHashCode(callSuper = true)\r\n        @Data\r\n        @Node\r\n        public class Post extends Auditable {\r\n            @Id\r\n            @GeneratedValue\r\n            private UUID id;\r\n            @CreatedBy\r\n            @Relationship(type = &quot;CREATED_BY&quot;, direction = Relationship.Direction.OUTGOING)\r\n            private User createdBy;   \r\n        }\r\n\r\n\r\n\r\n\r\n","link":"https://stackoverflow.com/questions/79592119/how-to-fetch-only-id-in-spring-boot-neo4j-relationship","title":"How to fetch only id in spring boot neo4j relationship"},{"tags":["import","neo4j","neo4j-admin"],"comments":[{"owner":{"reputation":20225,"user_id":2662355,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/6ea0a9d988f145b0e666dfdd96374736?s=256&d=identicon&r=PG","display_name":"Christophe Willemsen","link":"https://stackoverflow.com/users/2662355/christophe-willemsen"},"edited":false,"score":0,"creation_date":1745819918,"post_id":79589298,"comment_id":140375264,"link":"https://stackoverflow.com/questions/79589298/neo4j-admin-import-csv-header#comment140375264_79589298"}],"owner":{"reputation":1,"user_id":30306691,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/056c612c9196a4b8f5f294a19354f142?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"user30306691","link":"https://stackoverflow.com/users/30306691/user30306691"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":43,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1745433735,"creation_date":1745433735,"question_id":79589298,"share_link":"https://stackoverflow.com/q/79589298","body_markdown":"I&#39;m using neo4j admin to import a database into neo4j via csv files. But I have a small problem/question. Currently, for a node CSV, I have this header:\r\n\r\n```\r\nid:ID(Gene-id){id-type: string};symbol:string;name:string;symbols:string;chromosome:string;names:string;ensg_id:string;gene_group_name:string;entrez_id:string\r\n```\r\n\r\nWhat I&#39;d like to do is create another group an a propertie, for example:\r\n\r\n```\r\nid:ID(Gene-id){id-type: string};symbol:string;name:string;symbols:string;chromosome:string;names:string;ensg_id:string;gene_group_name:string;entrez_id(TEST):string\r\n```\r\n\r\nTo be able to use them in my relationships:\r\n\r\n```\r\n:END_ID(Disease-id);:START_ID(TEST);from_disease:string\r\n```\r\n\r\nI also tried putting ID in front of it:\r\n\r\n```\r\nentrez_id:ID(TEST):string\r\n```\r\n\r\nbut there are multiple :ID columns and they refer to different groups. Of course, because I already have an identifier for the node, I would just like to add a temporary group to be able to create my relationships.\r\n\r\nFor example:\r\n\r\n```\r\nNode Person: Id, name, firstname, licence\r\nNode Car: Id, name, brand, etc.\r\nEdge IS_OWNED: person’s name, car’s id\r\n```\r\n\r\nIn this example, the IS_OWNED relationship is created using the name column from Person (which isn’t the ID column) and the id of the Car. So I need to group by the name column in Person because I’m not using the ID column for this relationship.\r\n\r\nI&#39;ve already tried several times, but of course it doesn&#39;t work, and I can&#39;t find any more information in the documentation. I&#39;d like to know if there&#39;s a way to do this!\r\n\r\nI have to use neo4j admin, and I can&#39;t use the &quot;classic neo4j&quot; queries, because I have to import 70 million relationships.\r\n","link":"https://stackoverflow.com/questions/79589298/neo4j-admin-import-csv-header","title":"Neo4j-admin import csv header"},{"tags":["neo4j","apoc"],"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1745427038,"post_id":79584124,"comment_id":140362381,"link":"https://stackoverflow.com/questions/79584124/neo4j-apoc-export-json-all-not-returning-data-with-large-dataset-68k-nodes-1#comment140362381_79584124"}],"answers":[{"tags":[],"owner":{"reputation":1,"user_id":30456329,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/1dfcce036e434bfcad38f8c410d12e2b?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Josh lawson","link":"https://stackoverflow.com/users/30456329/josh-lawson"},"last_editor":{"reputation":1,"user_id":30456329,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/1dfcce036e434bfcad38f8c410d12e2b?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Josh lawson","link":"https://stackoverflow.com/users/30456329/josh-lawson"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1746487389,"last_edit_date":1746487389,"creation_date":1746487320,"answer_id":79607762,"question_id":79584124,"share_link":"https://stackoverflow.com/a/79607762","body_markdown":"Just a random guess, but do you have `apoc.export.file.enabled=true` written in your conf?\r\n\r\nAlso, I&#39;m pretty sure `apoc.export.json` does not support batch size (only cypher does).\r\n\r\nAlso, it seems odd to me that you specify &quot;null&quot;-are you trying to stream this data somewhere, or save it out to file? Because if you are saving out to JSON, maybe something like:  \r\n`apoc.export.json.all(&quot;/your/path/here&quot;, {{useTypes:true});`\r\n\r\nI was able to recently use APOC to export a database with 1M nodes and 4M edges with no issue, so I don&#39;t believe it&#39;s a size issue.","link":"https://stackoverflow.com/questions/79584124/neo4j-apoc-export-json-all-not-returning-data-with-large-dataset-68k-nodes-1/79607762#79607762","title":"Neo4j APOC export.json.all() not returning data with large dataset (68K nodes, 178K relationships) using Neo4j 4.4.40"}],"owner":{"reputation":2045,"user_id":7486447,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/95464f4204fed6cf695aaccf767fcc77?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"ARKhan","link":"https://stackoverflow.com/users/7486447/arkhan"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":92,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1746487389,"creation_date":1745216236,"question_id":79584124,"share_link":"https://stackoverflow.com/q/79584124","body_markdown":"**Problem:**\r\n\r\nI&#39;m trying to export data from Neo4j (version 4.4.40) using APOC (version 4.4.0.34) with the following Cypher query:\r\n\r\n    CALL apoc.export.json.all(null, {stream: true, batchSize: 5000, useTypes: true})\r\n    YIELD data\r\n    RETURN data\r\n\r\nThe database contains:\r\n- ~68,000 nodes (verified with MATCH (n) RETURN count(n))\r\n- ~178,000 relationships (verified with MATCH ()-[r]-&gt;() RETURN count(r))\r\n\r\nHowever, the APOC export call is not returning any data despite using batch processing with a size of 5000.\r\n\r\nWe also tried increasing memory related values in Docker ENV:\r\n\r\n    ENV NEO4J_dbms_memory_pagecache_size=2G\r\n    ENV NEO4J_dbms_memory_heap_initial_size=2G\r\n    ENV NEO4J_dbms_memory_heap_max__size=8G\r\n\r\n**Environment**:\r\n - Neo4J community version running on Docker\r\n - Using Python to execute Cypher queries\r\n\r\n**Questions:**\r\n- Is there a known limitation with APOC&#39;s JSON export for datasets of this size?\r\n- Are there specific memory settings or configurations needed for large exports?\r\n- Are there alternative approaches or parameters that would be more suitable for exporting this volume of data?\r\n\r\n","link":"https://stackoverflow.com/questions/79584124/neo4j-apoc-export-json-all-not-returning-data-with-large-dataset-68k-nodes-1","title":"Neo4j APOC export.json.all() not returning data with large dataset (68K nodes, 178K relationships) using Neo4j 4.4.40"},{"tags":["canvas","neo4j","webgl"],"owner":{"reputation":1083,"user_id":926251,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b783cfe7817cd89d619d0c8ab792cbcf?s=256&d=identicon&r=PG","display_name":"pooya72","link":"https://stackoverflow.com/users/926251/pooya72"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":62,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1747734508,"creation_date":1744910000,"question_id":79579765,"share_link":"https://stackoverflow.com/q/79579765","body_markdown":"I’m using the Neo4j Visualization Library to display Arabic text, but the letters are rendering left‑to‑right (instead of right‑to‑left) and appear disconnected. See image below. Has anyone encountered this issue and found a way to render Arabic script properly?\r\n\r\n[![enter image description here][1]][1]\r\n\r\n\r\n  [1]: https://i.sstatic.net/GsYE9pdQ.jpg","link":"https://stackoverflow.com/questions/79579765/how-to-fix-arabic-script-in-neo4j-visualization-library","title":"How to fix Arabic script in Neo4j visualization library"},{"tags":["neo4j","large-language-model"],"answers":[{"tags":[],"owner":{"reputation":76,"user_id":11926449,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/df8bab2526f7787a9adacbdeb438e2aa?s=256&d=identicon&r=PG","display_name":"Therese","link":"https://stackoverflow.com/users/11926449/therese"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1744884870,"creation_date":1744884870,"answer_id":79579004,"question_id":79578894,"share_link":"https://stackoverflow.com/a/79579004","body_markdown":"the short answer is no, having multiple labels are not available for the Neo4j indexes.\r\n\r\nThere is an exception to this which is the FULLTEXT indexes, but they are the only ones that can have multiple labels for the same index.\r\n\r\nHere is some documentation around creating vector indexes, https://neo4j.com/docs/cypher-manual/current/indexes/semantic-indexes/vector-indexes/#create-vector-index, and for the full syntax description https://neo4j.com/docs/cypher-manual/current/indexes/syntax/#create-vector-index (and to compare the fulltext one that allows more than one label: https://neo4j.com/docs/cypher-manual/current/indexes/semantic-indexes/full-text-indexes/#create-full-text-indexes and https://neo4j.com/docs/cypher-manual/current/indexes/syntax/#create-full-text-index)\r\n\r\n/Therese","link":"https://stackoverflow.com/questions/79578894/can-i-create-one-vector-index-for-multiple-labels-e-g-movie-and-person/79579004#79579004","title":"Can I create one VECTOR INDEX for multiple labels (e.g. Movie and Person)?"},{"tags":[],"owner":{"reputation":386,"user_id":21624328,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AGNmyxZzl1uvGNT2Zj90oWIgnDozeOoiJzA7-rJgem4f=k-s256","display_name":"Christoffer Bergman","link":"https://stackoverflow.com/users/21624328/christoffer-bergman"},"comment_count":0,"down_vote_count":0,"up_vote_count":2,"is_accepted":false,"score":2,"last_activity_date":1744888855,"creation_date":1744888855,"answer_id":79579130,"question_id":79578894,"share_link":"https://stackoverflow.com/a/79579130","body_markdown":"A workaround would be to do: \r\n\r\n```\r\nMATCH (n:Movie|Person)\r\nSET n:MultiLabel;\r\n\r\nCREATE VECTOR INDEX multiLabelIndex\r\nIF NOT EXISTS\r\nFOR (n:MultiLabel) ON (n.text)\r\nOPTIONS {\r\n  indexConfig: {\r\n    &#39;vector.dimensions&#39;: 1536,\r\n    &#39;vector.similarity_function&#39;: &#39;cosine&#39;\r\n  }\r\n};\r\n```","link":"https://stackoverflow.com/questions/79578894/can-i-create-one-vector-index-for-multiple-labels-e-g-movie-and-person/79579130#79579130","title":"Can I create one VECTOR INDEX for multiple labels (e.g. Movie and Person)?"},{"tags":[],"owner":{"reputation":351,"user_id":12314521,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/0e4f10d5d3a582ac48b098b30f0bcdc8?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"jupyter","link":"https://stackoverflow.com/users/12314521/jupyter"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1751264408,"creation_date":1751264408,"answer_id":79684313,"question_id":79578894,"share_link":"https://stackoverflow.com/a/79684313","body_markdown":"Oh, or just add one more label for both node type, named `Node` then \r\n\r\n```\r\nFOR (n:Node) ON (n.text)\r\n```","link":"https://stackoverflow.com/questions/79578894/can-i-create-one-vector-index-for-multiple-labels-e-g-movie-and-person/79684313#79684313","title":"Can I create one VECTOR INDEX for multiple labels (e.g. Movie and Person)?"}],"owner":{"reputation":224,"user_id":19542908,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/8fec8ae53d30b2a7d411ae5e0d6dfab8?s=256&d=identicon&r=PG","display_name":"bayes2021","link":"https://stackoverflow.com/users/19542908/bayes2021"},"last_editor":{"reputation":123876,"user_id":3001761,"user_type":"registered","profile_image":"https://i.sstatic.net/feZwC.jpg?s=256","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":259,"favorite_count":0,"down_vote_count":0,"up_vote_count":2,"accepted_answer_id":79579004,"answer_count":3,"score":2,"last_activity_date":1751264408,"creation_date":1744881489,"last_edit_date":1744881587,"question_id":79578894,"share_link":"https://stackoverflow.com/q/79578894","body_markdown":"I&#39;m on Neo4j 5.27 (community) and want to index the same property (say embedding) across two different node types—Movie and Person—with a single vector index. I’ve tried:\r\n\r\n```\r\nCREATE VECTOR INDEX multiLabelIndex\r\nIF NOT EXISTS\r\nFOR (n:Movie|Person) ON (n.text)\r\nOPTIONS {\r\n  indexConfig: {\r\n    &#39;vector.dimensions&#39;: 1536,\r\n    &#39;vector.similarity_function&#39;: &#39;cosine&#39;\r\n  }\r\n};\r\n```\r\nbut receive a syntax error about the FOR (n) clause.\r\n\r\nIs it supported to specify multiple labels in one FOR clause?\r\n","link":"https://stackoverflow.com/questions/79578894/can-i-create-one-vector-index-for-multiple-labels-e-g-movie-and-person","title":"Can I create one VECTOR INDEX for multiple labels (e.g. Movie and Person)?"},{"tags":["neo4j","cypher"],"answers":[{"comments":[{"owner":{"reputation":4695,"user_id":318414,"user_type":"registered","accept_rate":95,"profile_image":"https://www.gravatar.com/avatar/7ebd7dea6af0c5703f80e6e5e1bb0ab1?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"simonalexander2005","link":"https://stackoverflow.com/users/318414/simonalexander2005"},"edited":false,"score":0,"creation_date":1744877306,"post_id":79577657,"comment_id":140343619,"link":"https://stackoverflow.com/questions/79576941/create-relationship-only-if-node-merge-resulted-in-create/79577657#comment140343619_79577657"},{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"reply_to_user":{"reputation":4695,"user_id":318414,"user_type":"registered","accept_rate":95,"profile_image":"https://www.gravatar.com/avatar/7ebd7dea6af0c5703f80e6e5e1bb0ab1?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"simonalexander2005","link":"https://stackoverflow.com/users/318414/simonalexander2005"},"edited":false,"score":0,"creation_date":1744906952,"post_id":79577657,"comment_id":140345424,"link":"https://stackoverflow.com/questions/79576941/create-relationship-only-if-node-merge-resulted-in-create/79577657#comment140345424_79577657"}],"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":2,"down_vote_count":0,"up_vote_count":3,"is_accepted":true,"score":3,"last_activity_date":1744826793,"last_edit_date":1744826793,"creation_date":1744820396,"answer_id":79577657,"question_id":79576941,"share_link":"https://stackoverflow.com/a/79577657","body_markdown":"In `ON CREATE` you can set a temporary `isNew` property. Then, if `isNew` is true, `CREATE` the relationship and remove `isNew`.\r\n\r\n```cypher\r\nMATCH (f:FirstNode {with:$parametersF})\r\nMERGE (s:SomeNode {with:$parametersS})\r\nON CREATE SET s.source=$source, s.isNew = TRUE\r\nWITH f, s\r\nWHERE s.isNew\r\nCREATE (s)-[:IS_CONNECTED_TO]-&gt;(f)\r\nREMOVE s.isNew\r\n```","link":"https://stackoverflow.com/questions/79576941/create-relationship-only-if-node-merge-resulted-in-create/79577657#79577657","title":"Create relationship only if node merge resulted in create"}],"owner":{"reputation":4695,"user_id":318414,"user_type":"registered","accept_rate":95,"profile_image":"https://www.gravatar.com/avatar/7ebd7dea6af0c5703f80e6e5e1bb0ab1?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"simonalexander2005","link":"https://stackoverflow.com/users/318414/simonalexander2005"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":87,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"accepted_answer_id":79577657,"answer_count":1,"score":1,"last_activity_date":1744826793,"creation_date":1744798767,"last_edit_date":1744822351,"question_id":79576941,"share_link":"https://stackoverflow.com/q/79576941","body_markdown":"Say I have some Cypher:\r\n\r\n```cypher\r\nMATCH (f:FirstNode {with:$parametersF})\r\nWITH f\r\nMERGE (s:SomeNode {with:$parametersS})\r\nON CREATE SET s.source=$source\r\nMERGE (s)-[:IS_CONNECTED_TO]-&gt;(f)\r\n```\r\n\r\nI want to be able to move the second `MERGE` into the `ON CREATE` (and change the `MERGE` into a `CREATE`) - meaning that I only want it to create the relationship if the node was just created. So something like:\r\n\r\n```lang-cypher\r\n...\r\nMERGE (s:SomeNode {with:$parametersS})\r\nON CREATE SET s.source=$source\r\nON CREATE CREATE (s)-[:IS_CONNECTED_TO]-&gt;(f)\r\n```\r\nBut this isn&#39;t valid cypher. Is there a better way to do this? I&#39;m trying to reduce lock acquisition on the relationship where I know it&#39;s not needed.","link":"https://stackoverflow.com/questions/79576941/create-relationship-only-if-node-merge-resulted-in-create","title":"Create relationship only if node merge resulted in create"},{"tags":["java","spring-boot","neo4j"],"comments":[{"owner":{"reputation":5309,"user_id":18364656,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/70eb650df3e935255b17e62942f30620?s=256&d=identicon&r=PG","display_name":"Andrei Lisa","link":"https://stackoverflow.com/users/18364656/andrei-lisa"},"edited":false,"score":0,"creation_date":1744732143,"post_id":79574738,"comment_id":140337616,"link":"https://stackoverflow.com/questions/79574738/unable-to-use-spring-boot-jpa-and-spring-boot-neo4j-at-the-same-time-in-a-basic#comment140337616_79574738"},{"owner":{"reputation":127,"user_id":6724450,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-5o9uo7DjEUQ/AAAAAAAAAAI/AAAAAAAAABE/ZpexBNE8nos/s256-rj/photo.jpg","display_name":"Doukya","link":"https://stackoverflow.com/users/6724450/doukya"},"reply_to_user":{"reputation":5309,"user_id":18364656,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/70eb650df3e935255b17e62942f30620?s=256&d=identicon&r=PG","display_name":"Andrei Lisa","link":"https://stackoverflow.com/users/18364656/andrei-lisa"},"edited":false,"score":1,"creation_date":1744736863,"post_id":79574738,"comment_id":140337902,"link":"https://stackoverflow.com/questions/79574738/unable-to-use-spring-boot-jpa-and-spring-boot-neo4j-at-the-same-time-in-a-basic#comment140337902_79574738"},{"owner":{"reputation":5309,"user_id":18364656,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/70eb650df3e935255b17e62942f30620?s=256&d=identicon&r=PG","display_name":"Andrei Lisa","link":"https://stackoverflow.com/users/18364656/andrei-lisa"},"edited":false,"score":0,"creation_date":1744794022,"post_id":79574738,"comment_id":140339948,"link":"https://stackoverflow.com/questions/79574738/unable-to-use-spring-boot-jpa-and-spring-boot-neo4j-at-the-same-time-in-a-basic#comment140339948_79574738"}],"answers":[{"tags":[],"owner":{"reputation":5309,"user_id":18364656,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/70eb650df3e935255b17e62942f30620?s=256&d=identicon&r=PG","display_name":"Andrei Lisa","link":"https://stackoverflow.com/users/18364656/andrei-lisa"},"last_editor":{"reputation":5309,"user_id":18364656,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/70eb650df3e935255b17e62942f30620?s=256&d=identicon&r=PG","display_name":"Andrei Lisa","link":"https://stackoverflow.com/users/18364656/andrei-lisa"},"comment_count":0,"down_vote_count":0,"up_vote_count":2,"is_accepted":true,"score":2,"last_activity_date":1744795856,"last_edit_date":1744795856,"creation_date":1744793961,"answer_id":79576766,"question_id":79574738,"share_link":"https://stackoverflow.com/a/79576766","body_markdown":"Based on this github discussion [2931](https://github.com/spring-projects/spring-data-neo4j/issues/2931) as well as related issues from that thread.\r\n\r\nEspecially the following idea:\r\n\r\n&gt; The `Neo4jDataAutoConfiguration` will only create a `*Neo4j*TransactionManager` if there is no other `TransactionManager` already instantiated. This means if the JPA tx manager was created first, there won&#39;t be a second one unless it gets defined manually.\r\n\r\nIt means that you have to instantiate it on your own something like:\r\n\r\nDeclare a `Ne4jTemplate`\r\n\r\n```\r\n@Configuration(proxyBeanMethods = false)\r\npublic class Neo4jConfig {\r\n\r\n  @Bean({&quot;neo4jTemplate&quot;})\r\n  @ConditionalOnMissingBean({Neo4jOperations.class})\r\n  public Neo4jTemplate neo4jTemplate(\r\n          Neo4jClient neo4jClient,\r\n          Neo4jMappingContext neo4jMappingContext,\r\n          Driver driver, DatabaseSelectionProvider databaseNameProvider, ObjectProvider&lt;TransactionManagerCustomizers&gt; optionalCustomizers\r\n  ) {\r\n    Neo4jTransactionManager transactionManager = new Neo4jTransactionManager(driver, databaseNameProvider);\r\n    optionalCustomizers.ifAvailable((customizer) -&gt; {\r\n      customizer.customize(transactionManager);\r\n    });\r\n    return new Neo4jTemplate(neo4jClient, neo4jMappingContext, transactionManager);\r\n  }\r\n\r\n} \r\n```\r\n\r\nAs well as you `Repository` layer will be for instance something like:\r\n\r\n```\r\npublic interface Repository&lt;T,V&gt; {\r\n\r\n  Optional&lt;T&gt; findById(String id);\r\n\r\n  T save(T instance);\r\n}\r\n```\r\n\r\n```\r\n\r\n\r\n@Repository\r\npublic class ExtbTransactionRepositoryImpl implements Repository&lt;Transaction, String&gt; {\r\n\r\n private final Neo4jTemplate neo4jTemplate;\r\n\r\n  public ExtbTransactionRepositoryImpl(Neo4jTemplate neo4jTemplate) {\r\n    this.neo4jTemplate = neo4jTemplate;\r\n  }\r\n\r\n  @Override\r\n  public Optional&lt;Transaction&gt; findById(String id) {\r\n    return neo4jTemplate.findById(id, Transaction.class);\r\n  }\r\n\r\n  @Override\r\n  public Transaction save(Transaction instance) {\r\n    return neo4jTemplate.save(instance);\r\n  }\r\n}\r\n```\r\n\r\nIt should fix the issue and you will have a ready to use solution.","link":"https://stackoverflow.com/questions/79574738/unable-to-use-spring-boot-jpa-and-spring-boot-neo4j-at-the-same-time-in-a-basic/79576766#79576766","title":"Unable to use Spring-boot jpa and Spring-boot neo4j at the same time in a basic CRUD project"}],"owner":{"reputation":127,"user_id":6724450,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-5o9uo7DjEUQ/AAAAAAAAAAI/AAAAAAAAABE/ZpexBNE8nos/s256-rj/photo.jpg","display_name":"Doukya","link":"https://stackoverflow.com/users/6724450/doukya"},"last_editor":{"reputation":127076,"user_id":2696260,"user_type":"registered","profile_image":"https://i.sstatic.net/qHEzx.png?s=256","display_name":"M. Deinum","link":"https://stackoverflow.com/users/2696260/m-deinum"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":183,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79576766,"answer_count":1,"score":0,"last_activity_date":1744795856,"creation_date":1744707407,"last_edit_date":1744740316,"question_id":79574738,"share_link":"https://stackoverflow.com/q/79574738","body_markdown":"I managed to implement a small project that allows me to save data in my Neo4j database. However, when I add dependencies spring-boot-starter-data-jpa and ojdbc11, without any other modifications, I get the error message below. I have searched the internet without any success. I have tried implementing different transaction management methods for JPA and Neo4j without success. I don&#39;t know if anyone can help me use both dependencies in the same application.\r\n\r\nThe complete code is available here:[link to spring-neo4j source code][1]\r\n\r\n```\r\nError during migration: Cannot invoke &quot;org.springframework.transaction.support.TransactionTemplate.execute(org.springframework.transaction.support.TransactionCallback)&quot; because &quot;this.transactionTemplate&quot; is null\r\n2025-04-15T09:43:12.236+01:00  INFO 20716 --- [spring-neo4j] [  restartedMain] .s.b.a.l.ConditionEvaluationReportLogger : \r\n\r\nError starting ApplicationContext. To display the condition evaluation report re-run your application with &#39;debug&#39; enabled.\r\n2025-04-15T09:43:12.264+01:00 ERROR 20716 --- [spring-neo4j] [  restartedMain] o.s.boot.SpringApplication               : Application run failed\r\n\r\njava.lang.NullPointerException: Cannot invoke &quot;org.springframework.transaction.support.TransactionTemplate.execute(org.springframework.transaction.support.TransactionCallback)&quot; because &quot;this.transactionTemplate&quot; is null\r\n\tat org.springframework.data.neo4j.core.Neo4jTemplate.save(Neo4jTemplate.java:382) ~[spring-data-neo4j-7.4.4.jar:7.4.4]\r\n\tat org.springframework.data.neo4j.repository.support.SimpleNeo4jRepository.save(SimpleNeo4jRepository.java:120) ~[spring-data-neo4j-7.4.4.jar:7.4.4]\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]\r\n\tat org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:359) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:277) ~[spring-data-commons-3.4.4.jar:3.4.4]\r\n\tat org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170) ~[spring-data-commons-3.4.4.jar:3.4.4]\r\n\tat org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158) ~[spring-data-commons-3.4.4.jar:3.4.4]\r\n\tat org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:515) ~[spring-data-commons-3.4.4.jar:3.4.4]\r\n\tat org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:284) ~[spring-data-commons-3.4.4.jar:3.4.4]\r\n\tat org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:731) ~[spring-data-commons-3.4.4.jar:3.4.4]\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:174) ~[spring-data-commons-3.4.4.jar:3.4.4]\r\n\tat org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:149) ~[spring-data-commons-3.4.4.jar:3.4.4]\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:69) ~[spring-data-commons-3.4.4.jar:3.4.4]\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:380) ~[spring-tx-6.2.5.jar:6.2.5]\r\n\tat org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-6.2.5.jar:6.2.5]\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138) ~[spring-tx-6.2.5.jar:6.2.5]\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat jdk.proxy4/jdk.proxy4.$Proxy110.save(Unknown Source) ~[na:na]\r\n\tat com.example.service.NeoTransactionService.addExtbTransactionNode(NeoTransactionService.java:30) ~[classes/:na]\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]\r\n\tat org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:359) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:380) ~[spring-tx-6.2.5.jar:6.2.5]\r\n\tat org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-6.2.5.jar:6.2.5]\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:727) ~[spring-aop-6.2.5.jar:6.2.5]\r\n\tat com.example.service.NeoTransactionService$$SpringCGLIB$$0.addExtbTransactionNode(&lt;generated&gt;) ~[classes/:na]\r\n\tat com.example.Neo4jRunner.run(Neo4jRunner.java:40) ~[classes/:na]\r\n\tat org.springframework.boot.SpringApplication.lambda$callRunner$5(SpringApplication.java:788) ~[spring-boot-3.4.4.jar:3.4.4]\r\n\tat org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:82) ~[spring-core-6.2.5.jar:6.2.5]\r\n\tat org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[spring-core-6.2.5.jar:6.2.5]\r\n\tat org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:86) ~[spring-core-6.2.5.jar:6.2.5]\r\n\tat org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:796) ~[spring-boot-3.4.4.jar:3.4.4]\r\n\tat org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:787) ~[spring-boot-3.4.4.jar:3.4.4]\r\n\tat org.springframework.boot.SpringApplication.lambda$callRunners$3(SpringApplication.java:772) ~[spring-boot-3.4.4.jar:3.4.4]\r\n\tat java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[na:na]\r\n\tat java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) ~[na:na]\r\n\tat java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) ~[na:na]\r\n\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]\r\n\tat java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[na:na]\r\n\tat java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[na:na]\r\n\tat java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]\r\n\tat java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na]\r\n\tat org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:772) ~[spring-boot-3.4.4.jar:3.4.4]\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:325) ~[spring-boot-3.4.4.jar:3.4.4]\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[spring-boot-3.4.4.jar:3.4.4]\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[spring-boot-3.4.4.jar:3.4.4]\r\n\tat com.example.SpringNeo4jApplication.main(SpringNeo4jApplication.java:10) ~[classes/:na]\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]\r\n\tat org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.4.4.jar:3.4.4]\r\n\r\n2025-04-15T09:43:12.277+01:00  INFO 20716 --- [spring-neo4j] [  restartedMain] o.s.b.w.e.tomcat.GracefulShutdown        : Commencing graceful shutdown. Waiting for active requests to complete\r\n2025-04-15T09:43:12.495+01:00  INFO 20716 --- [spring-neo4j] [tomcat-shutdown] o.s.b.w.e.tomcat.GracefulShutdown        : Graceful shutdown complete\r\n2025-04-15T09:43:12.499+01:00  INFO 20716 --- [spring-neo4j] [  restartedMain] o.neo4j.driver.internal.InternalDriver   : Closing driver instance 2128206805\r\n2025-04-15T09:43:12.731+01:00  INFO 20716 --- [spring-neo4j] [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit &#39;default&#39;\r\n2025-04-15T09:43:12.735+01:00  INFO 20716 --- [spring-neo4j] [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...\r\n2025-04-15T09:43:12.751+01:00  INFO 20716 --- [spring-neo4j] [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.\r\n```\r\n\r\nThe pom.xml\r\n```xml\r\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;\r\n         xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;\r\n    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;\r\n    &lt;parent&gt;\r\n        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n        &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;\r\n        &lt;version&gt;3.4.4&lt;/version&gt;\r\n        &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;\r\n    &lt;/parent&gt;\r\n    &lt;groupId&gt;com.example&lt;/groupId&gt;\r\n    &lt;artifactId&gt;spring-neo4j&lt;/artifactId&gt;\r\n    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;\r\n    &lt;name&gt;spring-neo4j&lt;/name&gt;\r\n    &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;\r\n    &lt;url/&gt;\r\n    &lt;licenses&gt;\r\n        &lt;license/&gt;\r\n    &lt;/licenses&gt;\r\n    &lt;developers&gt;\r\n        &lt;developer/&gt;\r\n    &lt;/developers&gt;\r\n    &lt;scm&gt;\r\n        &lt;connection/&gt;\r\n        &lt;developerConnection/&gt;\r\n        &lt;tag/&gt;\r\n        &lt;url/&gt;\r\n    &lt;/scm&gt;\r\n    &lt;properties&gt;\r\n        &lt;java.version&gt;17&lt;/java.version&gt;\r\n    &lt;/properties&gt;\r\n    &lt;dependencies&gt;\r\n\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n            &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;\r\n        &lt;/dependency&gt;\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;com.oracle.database.jdbc&lt;/groupId&gt;\r\n            &lt;artifactId&gt;ojdbc11&lt;/artifactId&gt;\r\n            &lt;version&gt;21.11.0.0&lt;/version&gt;\r\n        &lt;/dependency&gt;\r\n\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n            &lt;artifactId&gt;spring-boot-starter-data-neo4j&lt;/artifactId&gt;\r\n        &lt;/dependency&gt;\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n            &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;\r\n        &lt;/dependency&gt;\r\n\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n            &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;\r\n            &lt;scope&gt;runtime&lt;/scope&gt;\r\n            &lt;optional&gt;true&lt;/optional&gt;\r\n        &lt;/dependency&gt;\r\n\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;\r\n            &lt;artifactId&gt;lombok&lt;/artifactId&gt;\r\n            &lt;optional&gt;true&lt;/optional&gt;\r\n        &lt;/dependency&gt;\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n            &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;\r\n            &lt;scope&gt;test&lt;/scope&gt;\r\n        &lt;/dependency&gt;\r\n    &lt;/dependencies&gt;\r\n\r\n    &lt;build&gt;\r\n        &lt;plugins&gt;\r\n            &lt;plugin&gt;\r\n                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;\r\n                &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;\r\n                &lt;configuration&gt;\r\n                    &lt;annotationProcessorPaths&gt;\r\n                        &lt;path&gt;\r\n                            &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;\r\n                            &lt;artifactId&gt;lombok&lt;/artifactId&gt;\r\n                        &lt;/path&gt;\r\n                    &lt;/annotationProcessorPaths&gt;\r\n                &lt;/configuration&gt;\r\n            &lt;/plugin&gt;\r\n            &lt;plugin&gt;\r\n                &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n                &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;\r\n                &lt;configuration&gt;\r\n                    &lt;excludes&gt;\r\n                        &lt;exclude&gt;\r\n                            &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;\r\n                            &lt;artifactId&gt;lombok&lt;/artifactId&gt;\r\n                        &lt;/exclude&gt;\r\n                    &lt;/excludes&gt;\r\n                &lt;/configuration&gt;\r\n            &lt;/plugin&gt;\r\n        &lt;/plugins&gt;\r\n    &lt;/build&gt;\r\n\r\n&lt;/project&gt;\r\n```\r\n\r\n[1]: https://drive.google.com/file/d/1HFmfmhaOPaHrliF1rqIg7eQPrirStrY-/view?usp=sharing","link":"https://stackoverflow.com/questions/79574738/unable-to-use-spring-boot-jpa-and-spring-boot-neo4j-at-the-same-time-in-a-basic","title":"Unable to use Spring-boot jpa and Spring-boot neo4j at the same time in a basic CRUD project"},{"tags":["java","neo4j"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":2,"is_accepted":true,"score":2,"last_activity_date":1744652264,"last_edit_date":1744652264,"creation_date":1744649151,"answer_id":79573653,"question_id":79572882,"share_link":"https://stackoverflow.com/a/79573653","body_markdown":"Transactions created in a session are confined to that session, so you cannot rollback a transaction from outside that session.\r\n\r\nAlso, even within a session, you cannot rollback a transaction after it is committed (or rolled back).  [writeTransaction](https://neo4j.com/docs/api/java-driver/current/org.neo4j.driver/org/neo4j/driver/Session.html#writeTransaction\\(org.neo4j.driver.TransactionWork\\)) creates and commits/rolls-back a transaction for you.","link":"https://stackoverflow.com/questions/79572882/how-to-rollback-neo4j-transaction-outside-a-session/79573653#79573653","title":"How to rollback Neo4j transaction outside a Session"},{"tags":[],"owner":{"reputation":495,"user_id":5831358,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/dd251a68f65da8a7fdca3c333475a426?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Marj","link":"https://stackoverflow.com/users/5831358/marj"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1744706717,"creation_date":1744706717,"answer_id":79574716,"question_id":79572882,"share_link":"https://stackoverflow.com/a/79574716","body_markdown":"Yes, once it&#39;s committed, it&#39;s committed. That&#39;s really the point of commit.  \r\nIf you need to do this, then you&#39;re doing the rollback at the business level (which is a valid use case). You would need to write the inverse Cypher in its own transaction to undo the first commit. I.e. Delete the relationship and the two nodes you created in the first transaction.  \r\nHave a look at this article &lt;https://en.wikipedia.org/wiki/ACID&gt; which should help you understand the principles of how transactions in an ACID database, like Neo4j, work.","link":"https://stackoverflow.com/questions/79572882/how-to-rollback-neo4j-transaction-outside-a-session/79574716#79574716","title":"How to rollback Neo4j transaction outside a Session"}],"owner":{"reputation":1232,"user_id":4333846,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/74ae80b9e04de579919599c45d9a1726?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Harish R","link":"https://stackoverflow.com/users/4333846/harish-r"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":70,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79573653,"answer_count":2,"score":0,"last_activity_date":1744706717,"creation_date":1744625487,"question_id":79572882,"share_link":"https://stackoverflow.com/q/79572882","body_markdown":"I have a Java application that connects to Neo4j. I want to test the rollback ability for my project, so I have created a sample code.\r\nFirst, I am opening a session, perform a write transaction and commit it.\r\nAfter the session gets closed, I need to rollback my previous transaction (outside the session)\r\n\r\n    public class Neo4jTransactionExample {\r\n      public void main() {\r\n          createPersonsWithReference();\r\n          rollback();\r\n      }\r\n      public void createPersonsWithReference() {\r\n    &#160;&#160;  &#160; try (Session session = driver.session()) {\r\n    &#160;&#160;&#160;&#160;  &#160;&#160;&#160; session.writeTransaction(tx -&gt; {\r\n    &#160;&#160;&#160;&#160;&#160;&#160;  &#160;&#160;&#160;&#160;&#160; tx.run(&quot;CREATE (a:Person {name: &#39;Alice&#39;})&quot;);\r\n    &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;  &#160;&#160;&#160; tx.run(&quot;CREATE (b:Person {name: &#39;Bob&#39;})&quot;);\r\n    &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;  &#160; tx.run(&quot;MATCH (a:Person {name: &#39;Alice&#39;}), (b:Person {name: &#39;Bob&#39;}) CREATE (b)-[:KNOWS]-&gt;(a)&quot;);\r\n    &#160;  &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return null;\r\n    &#160;&#160;&#160;  &#160;&#160;&#160;&#160; });\r\n    &#160;&#160;&#160;   }\r\n      }\r\n    \r\n      public void rollback() {\r\n      \r\n      }\r\n    }\r\n\r\n\r\nHow do I perform rollback after the session gets closed?","link":"https://stackoverflow.com/questions/79572882/how-to-rollback-neo4j-transaction-outside-a-session","title":"How to rollback Neo4j transaction outside a Session"},{"tags":["database","graph","neo4j"],"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1744824208,"post_id":79572773,"comment_id":140341762,"link":"https://stackoverflow.com/questions/79572773/unable-to-access-neo4j-db-when-url-is-made-https#comment140341762_79572773"},{"owner":{"reputation":7696,"user_id":132270,"user_type":"registered","accept_rate":85,"profile_image":"https://www.gravatar.com/avatar/19566e4519ea44ec0fa03920aa21bef3?s=256&d=identicon&r=PG","display_name":"bert","link":"https://stackoverflow.com/users/132270/bert"},"edited":false,"score":0,"creation_date":1747250753,"post_id":79572773,"comment_id":140426362,"link":"https://stackoverflow.com/questions/79572773/unable-to-access-neo4j-db-when-url-is-made-https#comment140426362_79572773"},{"owner":{"reputation":1,"user_id":30245591,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/f3b52c8a8c208b018de7421e62330349?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Vivek Malapaka","link":"https://stackoverflow.com/users/30245591/vivek-malapaka"},"reply_to_user":{"reputation":7696,"user_id":132270,"user_type":"registered","accept_rate":85,"profile_image":"https://www.gravatar.com/avatar/19566e4519ea44ec0fa03920aa21bef3?s=256&d=identicon&r=PG","display_name":"bert","link":"https://stackoverflow.com/users/132270/bert"},"edited":false,"score":0,"creation_date":1747365483,"post_id":79572773,"comment_id":140430907,"link":"https://stackoverflow.com/questions/79572773/unable-to-access-neo4j-db-when-url-is-made-https#comment140430907_79572773"}],"owner":{"reputation":1,"user_id":30245591,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/f3b52c8a8c208b018de7421e62330349?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Vivek Malapaka","link":"https://stackoverflow.com/users/30245591/vivek-malapaka"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":245,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1744622359,"creation_date":1744622359,"question_id":79572773,"share_link":"https://stackoverflow.com/q/79572773","body_markdown":"I recently faced an issue with Neo4j Graph. So the issue is, previously I installed Neo4j in a GCP VM, and I used to access it using this URL http://coolname.name.in:7474/browser.\r\n\r\nFor security purposes, and I’ve made it HTTPS with the help of cert manager and Let’s encrypt. But since the time of making it HTTPS I am unable to connect to the Neo4j database despite giving the correct username and password, I am unable to connect to the database. I&#39;ve tried debugging, I&#39;ve made changes to the neo4j.conf file, but I&#39;m unable to find a clear solution on this issue. It would be of great help if you would help me navigate how to solve this.\r\n\r\nThe URL that i&#39;m accessing it with right now is : **https://dns.in/browser**\r\n\r\nThis is the error that is being thrown while connecting to the db\r\n\r\n```\r\nServiceUnavailable: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. WebSocket readyState is: 3 \r\n```\r\n\r\nI tried changing the neo4j.conf file and uncommented these lines\r\n\r\n```\r\ndbms.connector.bolt.tls_level=OPTIONAL\r\ndbms.ssl.policy.bolt.enabled=true\r\ndbms.ssl.policy.bolt.base_directory=certificates/bolt\r\ndbms.ssl.policy.bolt.private_key=private.key\r\ndbms.ssl.policy.bolt.public_certificate=public.crt\r\n```\r\n\r\n```\r\ndbms.connector.https.enabled=true\r\ndbms.ssl.policy.https.enabled=true\r\ndbms.ssl.policy.https.base_directory=certificates/https\r\ndbms.ssl.policy.https.private_key=private.key\r\ndbms.ssl.policy.https.public_certificate=public.crt\r\n```\r\n\r\nbut still i&#39;m unable to figure out the problem and solve it.\r\n\r\nall i want is for neo4j to work over https, as of now i&#39;m only able to access the UI but unable to connect to the database.\r\n\r\n**Logs from my browser:**\r\n\r\n```\r\nFailed to load resource: net::ERR_CONNECTION_CLOSED\r\n:7687/:1  Failed to load resource: net::ERR_CONNECTION_CLOSED\r\napp-6070087….js:2900 WebSocket connection to &#39;wss://dns.com:7687/&#39; failed:\r\nn@app-6070087….js:2900\r\n\r\n\r\napp-6070087….js:2900 Mixed Content: The page at &#39;https://dns.name/browser/&#39; was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint &#39;ws://dns.name:7687/&#39;. This request has been blocked; this endpoint must be available over WSS.\r\n```","link":"https://stackoverflow.com/questions/79572773/unable-to-access-neo4j-db-when-url-is-made-https","title":"Unable to access neo4j db when URL is made https"},{"tags":["neo4j","cypher","neo4j-apoc"],"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1744307409,"post_id":79566543,"comment_id":140321692,"link":"https://stackoverflow.com/questions/79566543/error-with-conditional-merge-of-nodes-with-cypher-and-apoc#comment140321692_79566543"}],"owner":{"reputation":332,"user_id":9904152,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/s256-rj/photo.jpg","display_name":"Felix","link":"https://stackoverflow.com/users/9904152/felix"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":49,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1744285278,"creation_date":1744285278,"question_id":79566543,"share_link":"https://stackoverflow.com/q/79566543","body_markdown":"I am running merging logic in cypher (neo4j 5.26) such as this:\r\n\r\n```\r\nMATCH (n:Person {name: &quot;Tom&quot;})\r\nOPTIONAL MATCH (n2:Person {name:&quot;Peter&quot;})\r\nCALL apoc.do.when(\r\n  n2 IS NULL,\r\n  &#39;SET n.name = &quot;Peter&quot; RETURN n AS node&#39;,\r\n  &#39;CALL apoc.refactor.mergeNodes([n, n2], {properties: &quot;override&quot;, mergeRels: true}) YIELD node RETURN node&#39;,\r\n  {n: n, n2: n2}\r\n) YIELD value\r\nRETURN value.node\r\n```\r\n\r\nThis is supposed to either change a node&#39;s name from &quot;Tom&quot; to &quot;Peter&quot; or to merge &quot;Tom&quot; and &quot;Peter&quot; into a single node if name &quot;Peter&quot; already exists.\r\n\r\nIf a merge is executed via apoc, then the resulting node should prioritize the properties of `n2` and merge the relationships (therefore: `{properties: &quot;override&quot;, mergeRels: true}`).\r\n\r\nWhen running this code, I get the error:\r\n\r\n```\r\nNeo.ClientError.Statement.EntityNotFound\r\nNode with id 148184 has been deleted in this transaction\r\n```\r\n\r\nThe node with id 148184 is the &quot;Peter&quot;-node.\r\n\r\nIf I understand the `mergeNodes` function correctly, then n2 is merged into n and then deleted. But I am not referencing n2 after this transaction so I am not sure why the error is thrown.\r\n\r\nFor diagnostics, I implemented the merge **without** the if-else-wrapper implemented via `apoc.do.when`. In this case, I can perform the merge without problems. However, as my use case has to respect cases where `n2` does not exist, I need the if-else logic in one way or another.\r\n\r\nHow can I implement the desired logic without running into the error?","link":"https://stackoverflow.com/questions/79566543/error-with-conditional-merge-of-nodes-with-cypher-and-apoc","title":"Error with conditional merge of nodes with cypher and apoc"},{"tags":["neo4j","shortest-path"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":false,"score":1,"last_activity_date":1744226868,"last_edit_date":1744226868,"creation_date":1744220912,"answer_id":79565015,"question_id":79564931,"share_link":"https://stackoverflow.com/a/79565015","body_markdown":"1. Make sure you have an [index](https://neo4j.com/docs/cypher-manual/current/indexes/search-performance-indexes/overview/) on the property `Point.uid` to optimize finding the end nodes. If you do not already have one, [create one](https://neo4j.com/docs/cypher-manual/current/indexes/search-performance-indexes/managing-indexes/#create-indexes). For example:\r\n\r\n       CREATE INDEX point_uid FOR (p:Point) ON (p.uid)\r\n\r\n2. [Variable-length relationships](https://neo4j.com/docs/cypher-manual/current/patterns/reference/#variable-length-relationships) should specify a reasonable upper bound on the path length to avoid taking too long (or running out of memory). For example, if you only need to see paths that are up to length 10, you should use `shortestPath((from)-[r:EDGE*..10]-(to))`.\r\n\r\n3. You are creating a cartesian product of all pairs of points, and therefore doing over double the needed number of shortest-paths operations. For example, your query is looking for paths between A---B and then again between B---A; and even paths from a `Point` back to itself. (In the query below, I am assuming you want to ignore duplicate paths and also paths from a `Point` to itself).\r\n\r\nHere is a query that addresses #2 and #3:\r\n\r\n```\r\nWITH [345920715, 345920716, 345920717, 345920718, 345920719, 345920720, 345920721, 345920722, 345920723, 345920724, 345920725, 345920726, 345920727, 345920728, 345920729, 345920730, 345920731, 345920732, 345920733, 345920734, 345920735, 345920736, 345920737, 345920738, 345920739, 345920740, 345920741, 345920742, 345920743, 345920744, 345920745, 345920746, 345920747, 345920748, 345920749, 345920750, 345920751, 345920752, 345920753, 345920754, 345920755, 345920756, 345920757, 345920758, 345920759, 345920760, 345920761, 345920762, 345920763, 345920764] AS uids\r\nUNWIND uids AS fromId  \r\nUNWIND uids AS toId  \r\nMATCH path = shortestPath((from:Point {uid: fromId})-[r:EDGE*..10]-(to:Point {uid: toId}))\r\nWHERE fromId &lt; toId // Avoid duplicate paths and self-paths\r\nRETURN\r\n  from.uid AS fromPoint, to.uid AS toPoint,\r\n  reduce(dist = 0, r in relationships(path) | dist + r.length) AS totalDistance,\r\n  reduce(time = 0, r in relationships(path) | time + r.time) AS totalTime\r\nORDER BY fromPoint, toPoint;\r\n```\r\n\r\nYou should also consider passing `uids` to the query in a [parameter](https://neo4j.com/docs/cypher-manual/current/syntax/parameters/).","link":"https://stackoverflow.com/questions/79564931/neo4j-shortestpath-query-is-taking-long-time/79565015#79565015","title":"Neo4j ShortestPath Query is taking long time"}],"owner":{"reputation":11,"user_id":30222008,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/497623603f1176887990f575b6d88120?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"dev test","link":"https://stackoverflow.com/users/30222008/dev-test"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":59,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":1,"score":1,"last_activity_date":1744226868,"creation_date":1744218418,"question_id":79564931,"share_link":"https://stackoverflow.com/q/79564931","body_markdown":"I have 50 million nodes and 64 million relationships in neo4j db. I am using shortestPath query (shown below-3rd Query) to form origin-destination matrix. But it is taking lot of time because of too many db hits.\r\nPlease suggest what are the alternatives to minimize the query time?\r\n\r\n**Query used to Create Nodes with label &quot;Point&quot;:**\r\n\r\n```\r\nCALL apoc.periodic.iterate(\r\n    &quot;\r\n    CALL apoc.load.csv(&#39;nodes.csv&#39;, {header:true,sep:&#39;,&#39;, ignore:[&#39;OBJECTID&#39;,&#39;CONNECTION_CNT&#39;],\r\n    mapping:{\r\n    NODE_ID: {type:&#39;int&#39;,name:&#39;uid&#39;},\r\n    X_COORD: {type:&#39;float&#39;,name:&#39;x&#39;},\r\n    Y_COORD: {type:&#39;float&#39;,name:&#39;y&#39;}\r\n    }\r\n    })\r\n    YIELD map as row\r\n    RETURN row\r\n    &quot;,\r\n\r\n    &quot;\r\n    WITH row WHERE row.uid IS NOT NULL\r\n    CREATE (i:Point {{uid: row.uid}})\r\n    SET i.x=toFloat(row.x),\r\n    i.y = toFloat(row.y)\r\n    RETURN COUNT(*) as total\r\n    &quot;,\r\n\r\n    {{batchSize:100000, iterateList:true, parallel:true}}\r\n)\r\n```\r\n\r\n**Query used to Create Relationship with label &quot;EDGE&quot;:**\r\n\r\n```\r\nCALL apoc.periodic.iterate(\r\n    &quot;\r\n    CALL apoc.load.csv(&#39;edges.csv&#39;, {header:true,sep:&#39;,&#39;,ignore:[&#39;POSTED_AVG_TRAVEL_TM&#39;],\r\n    mapping:{\r\n    OBJECTID: {type:&#39;int&#39;,name:&#39;edgeId&#39;},\r\n    FNODE: {type:&#39;float&#39;,name:&#39;u&#39;},\r\n    TNODE: {type:&#39;float&#39;,name:&#39;v&#39;},\r\n    TRAVEL_TM: {type:&#39;float&#39;,name:&#39;time&#39;},\r\n    ROAD_LEN: {type:&#39;float&#39;,name:&#39;distance&#39;}\r\n    }\r\n    })\r\n    YIELD map as edge\r\n    RETURN edge\r\n    &quot;,\r\n\r\n    &quot;\r\n    WITH edge\r\n    WHERE edge.edgeId IS NOT NULL\r\n    MATCH (u:Point {uid: edge.u})\r\n    MATCH (v:Point {uid: edge.v})\r\n    CREATE (u)-[r:EDGE {edgeId: edge.edgeId}]-&gt;(v)\r\n    SET r.length = toFloat(edge.distance)\r\n    SET r.time = toFloat(edge.time)\r\n    RETURN COUNT(*) AS total\r\n    &quot;,\r\n\r\n    {batchSize:100000, iterateList:true, parallel:true}\r\n)\r\n```\r\n\r\n**Shortest Path Query which is taking long time:**\r\n\r\n```\r\nWITH [345920715, 345920716, 345920717, 345920718, 345920719, 345920720, 345920721, 345920722, 345920723, 345920724, 345920725, 345920726, 345920727, 345920728, 345920729, 345920730, 345920731, 345920732, 345920733, 345920734, 345920735, 345920736, 345920737, 345920738, 345920739, 345920740, 345920741, 345920742, 345920743, 345920744, 345920745, 345920746, 345920747, 345920748, 345920749, 345920750, 345920751, 345920752, 345920753, 345920754, 345920755, 345920756, 345920757, 345920758, 345920759, 345920760, 345920761, 345920762, 345920763, 345920764] AS uids\r\nMATCH (from:Point), (to:Point)\r\nWHERE from.uid IN uids AND to.uid IN uids\r\nMATCH path = shortestPath((from)-[r:EDGE*]-(to))\r\nWITH from.uid AS fromPoint, to.uid AS toPoint, path,\r\n     reduce(time = 0, r in relationships(path) | time + r.time) AS totalTime,\r\n     reduce(dist = 0, r in relationships(path) | dist + r.length) AS totalDistance\r\nRETURN fromPoint, toPoint, totalDistance,totalTime\r\nORDER BY fromPoint, toPoint;\r\n```\r\n\r\nWith 20 uids inside `WITH` taking time=2m 20 sec, and 50 uids inside `WITH` taking time= 21 mins.\r\n\r\nLooking for reducing the query time.","link":"https://stackoverflow.com/questions/79564931/neo4j-shortestpath-query-is-taking-long-time","title":"Neo4j ShortestPath Query is taking long time"},{"tags":["neo4j","neo4j-apoc"],"answers":[{"comments":[{"owner":{"reputation":1044,"user_id":7089212,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a5f4c8120598cc2576a122a201b8f32d?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Mat","link":"https://stackoverflow.com/users/7089212/mat"},"edited":false,"score":0,"creation_date":1748638530,"post_id":79638687,"comment_id":140473827,"link":"https://stackoverflow.com/questions/79559756/name-is-null-neo4j-s-apoc-throws-a-nullpointerexception-when-trying-to-map-a/79638687#comment140473827_79638687"}],"tags":[],"owner":{"reputation":81,"user_id":9050031,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b0d5bfaf3fe7d70eb4341613aec50307?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Gemma Lamont ","link":"https://stackoverflow.com/users/9050031/gemma-lamont"},"comment_count":1,"down_vote_count":0,"up_vote_count":1,"is_accepted":false,"score":1,"last_activity_date":1748252850,"creation_date":1748252850,"answer_id":79638687,"question_id":79559756,"share_link":"https://stackoverflow.com/a/79638687","body_markdown":"I work on the APOC core plugin and looked into this for you :) To get this working now, you can add the CRS into the POINT map in the JSON file.\r\n\r\n```\r\n{\r\n    &quot;id&quot;: 0,\r\n    &quot;type&quot;: &quot;node&quot;,\r\n    &quot;properties&quot;: {\r\n        &quot;coordinates&quot;: {\r\n            &quot;latitude&quot;: 38.8232,\r\n            &quot;longitude&quot;: -122.7955,\r\n            &quot;height&quot;: 3,\r\n            &quot;crs&quot;: &quot;WGS-84-3D&quot; // Add this line\r\n        }\r\n    },\r\n    &quot;labels&quot;: [\r\n        &quot;Earthquake&quot;\r\n    ]\r\n}\r\n```\r\n\r\nWhat is happening is that APOC assumes this to be present and has no checks around it not being there, hence the null on name (this is on the CRS name).\r\n\r\nAs Neo4j has only 4 supported CRS systems, all which are inferred by Cypher by the given map fields, I have fixed APOC to also do this, the fix will be released with version **2025.06.0** in a bit over a month.\r\n\r\nFor anyone on older versions add the crs field, the mapping for each type is as follows:\r\n\r\nCartesian: `&quot;crs&quot;: &quot;cartesian&quot;`  \r\nCartesian 3D: `&quot;crs&quot;: &quot;cartesian-3d&quot;`  \r\nGeographic: `&quot;crs&quot;: &quot;WGS-84&quot;`  \r\nGeographic 3D: `&quot;crs&quot;: &quot;WGS-84-3d&quot;`\r\n\r\nFor quicker responses on bugs like this, please open the issue on our [Github](https://github.com/neo4j/apoc) as we monitor that on weekdays.\r\n\r\nFor more information on the POINT type in Neo4j see our docs [here](https://neo4j.com/docs/cypher-manual/current/values-and-types/spatial/).","link":"https://stackoverflow.com/questions/79559756/name-is-null-neo4j-s-apoc-throws-a-nullpointerexception-when-trying-to-map-a/79638687#79638687","title":"&quot;name&quot; is null: Neo4j’s APOC throws a NullPointerException when trying to map a type to a property"}],"owner":{"reputation":1044,"user_id":7089212,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a5f4c8120598cc2576a122a201b8f32d?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Mat","link":"https://stackoverflow.com/users/7089212/mat"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":57,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1748252850,"creation_date":1744025053,"question_id":79559756,"share_link":"https://stackoverflow.com/q/79559756","body_markdown":"I am trying to import a JSON Lines file into Neo4j using its APOC plugin.\r\n\r\nIn this file, each object has a `coordinates` property, itself an object containing the `latitude`, `longitude` and `height` properties.\r\n\r\nWhen importing it into Neo4j, it fails due to [the custom type mapping argument `nodePropertyMapping`](https://neo4j.com/labs/apoc/4.4/overview/apoc.import/apoc.import.json/) I pass to the APOC’s import function.\r\n\r\n```cypher\r\nMATCH (n) DETACH DELETE n;\r\nCREATE CONSTRAINT IF NOT EXISTS FOR (n:Earthquake) REQUIRE n.neo4jImportId IS UNIQUE;\r\nCALL apoc.import.json(&quot;file://test_point.json&quot;, {nodePropertyMappings: {\r\n    Earthquake: {\r\n      coordinates: &#39;Point&#39;\r\n    }\r\n}});\r\n```\r\n\r\nThis causes the following error:\r\n\r\n&gt; **Neo.ClientError.Procedure.ProcedureCallFailed**\r\n&gt; Failed to invoke procedure `apoc.import.json`: Caused by: java.lang.NullPointerException: Cannot invoke &quot;String.toLowerCase(java.util.Locale)&quot; because &quot;name&quot; is null\r\n\r\nHere is a trimmed down file (formatted for better visibility, otherwise it is in one line):\r\n\r\n```json\r\n{\r\n    &quot;id&quot;: 0,\r\n    &quot;type&quot;: &quot;node&quot;,\r\n    &quot;properties&quot;: {\r\n        &quot;coordinates&quot;: {\r\n            &quot;latitude&quot;: 38.8232,\r\n            &quot;longitude&quot;: -122.7955,\r\n            &quot;height&quot;: 3\r\n        }\r\n    },\r\n    &quot;labels&quot;: [\r\n        &quot;Earthquake&quot;\r\n    ]\r\n}\r\n```\r\n\r\nNote that this is caused by the `nodePropertyMappings` parameter. For instance, this works:\r\n\r\n```cypher\r\n...\r\nCALL apoc.import.json(&quot;file://test_point.json&quot;);\r\n```\r\n\r\nThis also works:\r\n\r\n```cypher\r\n...\r\nCALL apoc.import.json(&quot;file://test_point.json&quot;, {nodePropertyMappings: {\r\n    SomethingElse: {\r\n      coordinates: &#39;Point&#39;\r\n    }\r\n}});\r\n```\r\n\r\nI tried adding a `&quot;name&quot;` property to the object, or even the `&quot;properties&quot;` or even `&quot;coordinates&quot;` properties, with no effect.","link":"https://stackoverflow.com/questions/79559756/name-is-null-neo4j-s-apoc-throws-a-nullpointerexception-when-trying-to-map-a","title":"&quot;name&quot; is null: Neo4j’s APOC throws a NullPointerException when trying to map a type to a property"},{"tags":["typescript","neo4j","graphql","testcontainers","neo4j-apoc"],"comments":[{"owner":{"reputation":41766,"user_id":728812,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/f522bc835d745f319a9567d63f5c0cc9?s=256&d=identicon&r=PG","display_name":"Michael Hunger","link":"https://stackoverflow.com/users/728812/michael-hunger"},"edited":false,"score":0,"creation_date":1747755926,"post_id":79558348,"comment_id":140443257,"link":"https://stackoverflow.com/questions/79558348/how-to-create-a-neo4j-testcontainer-with-apoc-and-graphql-when-apoc-is-enabled#comment140443257_79558348"}],"owner":{"reputation":69,"user_id":27008330,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3330d413ce18d472324c3d8d43b7bcb1?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Assiph Rolant","link":"https://stackoverflow.com/users/27008330/assiph-rolant"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":49,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1743951349,"creation_date":1743951349,"question_id":79558348,"share_link":"https://stackoverflow.com/q/79558348","body_markdown":" I&#39;m trying to set up a Neo4j TestContainer with APOC and GraphQL, but I am encountering issues when enabling APOC.\r\n\r\nHere&#39;s my setup:\r\n\r\n * Without APOC: The data is correctly inserted into Neo4j, and GraphQL works as expected\r\n ```\r\nconst NEO4J_IMAGE = &#39;neo4j:5.23&#39;;\r\nawait new Neo4jContainer(NEO4J_IMAGE).start();\r\n```\r\n*With APOC: The data is correctly inserted into Neo4j, but GraphQL fails to retrieve the data.\r\n```\r\nawait new Neo4jContainer(NEO4J_IMAGE)\r\n  .withApoc()\r\n  .withStartupTimeout(120_000)\r\n  .start();\r\n```","link":"https://stackoverflow.com/questions/79558348/how-to-create-a-neo4j-testcontainer-with-apoc-and-graphql-when-apoc-is-enabled","title":"How to create a Neo4j TestContainer with APOC and GraphQL? When APOC is enabled, GraphQL fails to retrieve data"},{"tags":["algorithm","performance","neo4j","graph-theory","graph-traversal"],"comments":[{"owner":{"reputation":8058,"user_id":3403834,"user_type":"registered","profile_image":"https://i.sstatic.net/xpA5S.jpg?s=256","display_name":"user58697","link":"https://stackoverflow.com/users/3403834/user58697"},"edited":false,"score":0,"creation_date":1743701206,"post_id":79553296,"comment_id":140296056,"link":"https://stackoverflow.com/questions/79553296/for-given-edge-find-all-nodes-the-edge-lies-on-any-path-from#comment140296056_79553296"},{"owner":{"reputation":12378,"user_id":653539,"user_type":"registered","accept_rate":50,"profile_image":"https://i.sstatic.net/rpb9H.jpg?s=256","display_name":"Tom&#225;š Z&#225;lusk&#253;","link":"https://stackoverflow.com/users/653539/tom%c3%a1%c5%a1-z%c3%a1lusk%c3%bd"},"reply_to_user":{"reputation":8058,"user_id":3403834,"user_type":"registered","profile_image":"https://i.sstatic.net/xpA5S.jpg?s=256","display_name":"user58697","link":"https://stackoverflow.com/users/3403834/user58697"},"edited":false,"score":0,"creation_date":1743758852,"post_id":79553296,"comment_id":140298572,"link":"https://stackoverflow.com/questions/79553296/for-given-edge-find-all-nodes-the-edge-lies-on-any-path-from#comment140298572_79553296"}],"answers":[{"comments":[{"owner":{"reputation":12378,"user_id":653539,"user_type":"registered","accept_rate":50,"profile_image":"https://i.sstatic.net/rpb9H.jpg?s=256","display_name":"Tom&#225;š Z&#225;lusk&#253;","link":"https://stackoverflow.com/users/653539/tom%c3%a1%c5%a1-z%c3%a1lusk%c3%bd"},"edited":false,"score":0,"creation_date":1743779078,"post_id":79553529,"comment_id":140299897,"link":"https://stackoverflow.com/questions/79553296/for-given-edge-find-all-nodes-the-edge-lies-on-any-path-from/79553529#comment140299897_79553529"},{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"reply_to_user":{"reputation":12378,"user_id":653539,"user_type":"registered","accept_rate":50,"profile_image":"https://i.sstatic.net/rpb9H.jpg?s=256","display_name":"Tom&#225;š Z&#225;lusk&#253;","link":"https://stackoverflow.com/users/653539/tom%c3%a1%c5%a1-z%c3%a1lusk%c3%bd"},"edited":false,"score":0,"creation_date":1743780820,"post_id":79553529,"comment_id":140300033,"link":"https://stackoverflow.com/questions/79553296/for-given-edge-find-all-nodes-the-edge-lies-on-any-path-from/79553529#comment140300033_79553529"},{"owner":{"reputation":12378,"user_id":653539,"user_type":"registered","accept_rate":50,"profile_image":"https://i.sstatic.net/rpb9H.jpg?s=256","display_name":"Tom&#225;š Z&#225;lusk&#253;","link":"https://stackoverflow.com/users/653539/tom%c3%a1%c5%a1-z%c3%a1lusk%c3%bd"},"edited":false,"score":0,"creation_date":1743796921,"post_id":79553529,"comment_id":140300954,"link":"https://stackoverflow.com/questions/79553296/for-given-edge-find-all-nodes-the-edge-lies-on-any-path-from/79553529#comment140300954_79553529"},{"owner":{"reputation":12378,"user_id":653539,"user_type":"registered","accept_rate":50,"profile_image":"https://i.sstatic.net/rpb9H.jpg?s=256","display_name":"Tom&#225;š Z&#225;lusk&#253;","link":"https://stackoverflow.com/users/653539/tom%c3%a1%c5%a1-z%c3%a1lusk%c3%bd"},"edited":false,"score":0,"creation_date":1744123451,"post_id":79553529,"comment_id":140312260,"link":"https://stackoverflow.com/questions/79553296/for-given-edge-find-all-nodes-the-edge-lies-on-any-path-from/79553529#comment140312260_79553529"}],"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"last_editor":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":4,"down_vote_count":0,"up_vote_count":7,"is_accepted":true,"score":7,"last_activity_date":1743777403,"last_edit_date":1743777403,"creation_date":1743698168,"answer_id":79553529,"question_id":79553296,"share_link":"https://stackoverflow.com/a/79553529","body_markdown":"**UPDATE**\r\n\r\nFollowing the update to the explanation in the question, the following query will  return a collection of all distinct nodes for each relationship ID for which a path exists that:\r\n- connects M and the node\r\n- passes through the relationship with given ID\r\n- traverses any node at most once\r\n\r\n```lang-cypher\r\nUNWIND $edgeIds AS edgeId\r\nMATCH p = SHORTEST 1 (m {id: &quot;M&quot;})--*()-[r {id: edgeId}]-()--*(s)\r\nWHERE size(nodes(p)) = COUNT { UNWIND nodes(p) AS n RETURN DISTINCT n }\r\nRETURN edgeId, collect(s.id) AS nodes\r\n```\r\nTo show it works, I made the values &quot;M&quot;, 2 etc values of property `id` of the nodes and relationships for my examples.\r\n\r\nHere is the data and results for the first example:\r\n```\r\nCREATE ({id: &quot;M&quot;})-[:R]-&gt;({id: &quot;A&quot;})-[:R {id: 2}]-&gt;({id: &quot;B&quot;})-[:R {id: 3}]-&gt;\r\n       (n15 {id: &quot;C&quot;})-[:R {id: 4}]-&gt;(n3 {id: &quot;D&quot;}),\r\n       ({id: &quot;F&quot;})&lt;-[:R]-(n3)-[:R]-&gt;({id: &quot;E&quot;}),\r\n       (n15)-[:R]-&gt;({id: &quot;G&quot;})-[:R]-&gt;({id: &quot;H&quot;})\r\n\r\n:param edgeIds =&gt; [2, 4]\r\n\r\n+----------------------------------------------+\r\n| edgeId | nodes                               |\r\n+----------------------------------------------+\r\n| 2      | [&quot;B&quot;, &quot;C&quot;, &quot;D&quot;, &quot;G&quot;, &quot;F&quot;, &quot;E&quot;, &quot;H&quot;] |\r\n| 4      | [&quot;D&quot;, &quot;F&quot;, &quot;E&quot;]                     |\r\n+----------------------------------------------+\r\n```\r\nThe second example:\r\n```\r\nCREATE (n10 {id: &quot;B&quot;})&lt;-[:R {id: 2}]-({id: &quot;M&quot;})-[:R {id: 1}]-&gt;\r\n       ({id: &quot;A&quot;})-[:R]-&gt;(n11 {id: &quot;C&quot;})&lt;-[:R]-(n10),\r\n       (n11)-[:R {id: 5}]-&gt;(n12 {id: &quot;D&quot;})-[:R]-&gt;({id: &quot;E&quot;}),\r\n       (n12)-[:R]-&gt;({id: &quot;F&quot;})\r\n\r\n:param edgeIds =&gt; [1, 2, 5]\r\n\r\n+-----------------------------------------+\r\n| edgeId | nodes                          |\r\n+-----------------------------------------+\r\n| 1      | [&quot;A&quot;, &quot;C&quot;, &quot;B&quot;, &quot;D&quot;, &quot;E&quot;, &quot;F&quot;] |\r\n| 2      | [&quot;B&quot;, &quot;C&quot;, &quot;A&quot;, &quot;D&quot;, &quot;E&quot;, &quot;F&quot;] |\r\n| 5      | [&quot;D&quot;, &quot;E&quot;, &quot;F&quot;]                |\r\n+-----------------------------------------+\r\n```\r\nThe third example:\r\n```\r\nCREATE (n18 {id: &quot;B&quot;})&lt;-[:R {id: 2}]-({id: &quot;M&quot;})-[:R {id: 1}]-&gt;\r\n       ({id: &quot;A&quot;})-[:R {id: 3}]-&gt;(n19 {id: &quot;C&quot;})&lt;-[:R {id: 4}]-(n18),\r\n       (n19)-[:R {id: 5}]-&gt;({id: &quot;D&quot;})-[:R {id: 7}]-&gt;({id: &quot;F&quot;})&lt;-[:R {id: 8}]-\r\n       ({id: &quot;E&quot;})&lt;-[:R {id: 6}]-(n19);\r\n\r\n:param edgeIds =&gt; [1, 5]\r\n\r\n+-----------------------------------------+\r\n| edgeId | nodes                          |\r\n+-----------------------------------------+\r\n| 1      | [&quot;A&quot;, &quot;C&quot;, &quot;D&quot;, &quot;E&quot;, &quot;B&quot;, &quot;F&quot;] |\r\n| 5      | [&quot;D&quot;, &quot;F&quot;, &quot;E&quot;]                |\r\n+-----------------------------------------+\r\n```\r\n ","link":"https://stackoverflow.com/questions/79553296/for-given-edge-find-all-nodes-the-edge-lies-on-any-path-from/79553529#79553529","title":"For given edge, find all nodes the edge lies on any path from"}],"owner":{"reputation":12378,"user_id":653539,"user_type":"registered","accept_rate":50,"profile_image":"https://i.sstatic.net/rpb9H.jpg?s=256","display_name":"Tom&#225;š Z&#225;lusk&#253;","link":"https://stackoverflow.com/users/653539/tom%c3%a1%c5%a1-z%c3%a1lusk%c3%bd"},"last_editor":{"reputation":12378,"user_id":653539,"user_type":"registered","accept_rate":50,"profile_image":"https://i.sstatic.net/rpb9H.jpg?s=256","display_name":"Tom&#225;š Z&#225;lusk&#253;","link":"https://stackoverflow.com/users/653539/tom%c3%a1%c5%a1-z%c3%a1lusk%c3%bd"},"comment_count":2,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":116,"favorite_count":0,"down_vote_count":1,"up_vote_count":3,"accepted_answer_id":79553529,"answer_count":1,"score":2,"last_activity_date":1743777403,"creation_date":1743692012,"last_edit_date":1743757758,"question_id":79553296,"share_link":"https://stackoverflow.com/q/79553296","body_markdown":"I have undirected connected graph with one main node (denoted by `M` in examples below).\r\n\r\nI am trying to find efficient algorithm to following specification:\r\n\r\n  * input is set of edges (denoted by thick lines)\r\n  * output for each input edge is set of nodes\r\n  * node belongs to input edge if the edge is element of any path from it to main node\r\n\r\n**Example 1:**\r\n\r\n[![example 1][1]][1]\r\n\r\nExpected output: `{2: [B,C,D,E,F,G,H], 4: [D,E,F]}`\r\n\r\nExplanation: for all nodes from `B` to the right the path must go through edge `2`. However the nodes `A`, `B` and `C` are not under edge `4` because no path between any of them and `M` contains edge `4`.\r\n\r\n**Example 2:**\r\n\r\n[![example 2][2]][2]\r\n\r\nExpected output: `{1: [A,B,C,D,E,F], 2: [A,B,C,D,E,F], 5: [D,E,F]}`\r\n\r\nExplanation: both of nodes `A` and `B` must belong to both of edges `1` and `2` because node `M` is reachable from each of them (besides the shortest path) also through node `C`. Path length does not matter. Like in example 1, none of nodes in the cycle belongs to edge `5`.\r\n\r\n**Example 3:**  (**UPDATE** - counterexample for @user58697&#39;s comment)\r\n\r\n[![example 3][3]][3]\r\n\r\nExpected output: `{1: [A,B,C,D,E,F], 5: [D,E,F]}`\r\n\r\nExplanation: for every node `A`..`F` there exists path through edge `1` to `M` (for example `BCAM`, `FECAM`). However none of nodes `A`, `B`, `C` can reach `M` through edge `5` so they do not belong to it in result map (`ACDFECBM` is a [trail, not path](https://en.wikipedia.org/wiki/Path_(graph_theory)#Walk,_trail,_and_path)). \r\n\r\n**Straightforward solution**\r\n\r\nThe dummy algorithm works correctly (I show pseudocode because I have implemented it in Neo4j Traversal framework actually):\r\n\r\n```java\r\nMap&lt;Edge,Set&lt;Node&gt;&gt; execute(Set&lt;Edge&gt; input) {\r\n    Map&lt;Edge,Set&lt;Node&gt;&gt; result = new HashMap&lt;&gt;();\r\n    Node m = graph.getMainNode();\r\n    for (Node n : graph.getAllNodes()) {\r\n        for (Path p : depthFirstSearchAllUniquePathsFrom(n, m)) {\r\n            for (Edge e : p.getEdges().filter(input::contains).toList()) {\r\n                result.computeIfAbsent(e, new HashSet&lt;&gt;()).add(n);\r\n            }\r\n        }\r\n    }\r\n    return result;\r\n}\r\n```\r\n\r\n**The problem**\r\n\r\nThe algorithm is slow. The traversal of graph of 758 nodes and 133 input edges with many cycles takes 20min on my local computer. Debugging proves there is a lot of similar paths (the `depthFirstSearchAllUniquePathsFrom` is actually traversal with [`Uniqueness.NODE_PATH`](https://neo4j.com/docs/java-reference/current/traversal-framework/traversal-framework-java-api/#traversal-java-api-uniqueness) which is very time consuming).\r\n\r\nI seek for efficient algorithm which would better utilize information gained during traversal (for comparison - something like if Floyd-Warshall algorithm finds all paths with better complexity than would multiple calls of Dijkstra algorithm between each pair do).\r\n\r\nI actually don&#39;t want to *enumerate* paths (which has exponential of factorial complexity). I cannot distinguish whether I am falling into trap of some NP-hard problem or there is just some simple solution I am overlooking.\r\n\r\n**Notes**\r\n\r\n* [similar problem](https://math.stackexchange.com/q/304781/223031) - OP seeks for all _vertices_ passed by all paths (while I seek for all _edges_ and &quot;en-masse&quot;)\r\n\r\n\r\n  [1]: https://i.sstatic.net/51smhSnH.png\r\n  [2]: https://i.sstatic.net/8MsuszaT.png\r\n  [3]: https://i.sstatic.net/YjBCgZnx.png","link":"https://stackoverflow.com/questions/79553296/for-given-edge-find-all-nodes-the-edge-lies-on-any-path-from","title":"For given edge, find all nodes the edge lies on any path from"},{"tags":["neo4j","neo4j-aura"],"owner":{"reputation":575,"user_id":175285,"user_type":"registered","accept_rate":100,"profile_image":"https://www.gravatar.com/avatar/cb1dafbcd2a85865997e5ffce7e429eb?s=256&d=identicon&r=PG","display_name":"KenBurnsFan1","link":"https://stackoverflow.com/users/175285/kenburnsfan1"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":55,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1743618764,"creation_date":1743615730,"last_edit_date":1743618764,"question_id":79551237,"share_link":"https://stackoverflow.com/q/79551237","body_markdown":"I cannot figure this out to save my life. In the tutorials for loading CSV data into Neo4j Aura, all nodes/edges automatically inherit labels as the entity VALUES; however, all the nodes/edges in my graph use the entity TYPE as labels -e.g., all “Source” nodes are labeled “Source/Source”; all “Target” nodes are labeled “Target/Target”; and all “Relationship” nodes are labeled “Relationship.” Here is the csv file (also shown in image): \r\n[Lunar Lander entities csv][1] \r\n\r\nhttps://docs.google.com/drawings/d/e/2PACX-1vRKfDsIzGeq3vU9qVvIoNK8wp1Ou6OIc3oYKSWMgGMWBYwi1KbyRkdRBoeGfLkPnIOW6ZWELzFAeN3L/pub?w=928&amp;h=2030\r\n\r\n[![CSV entity fields not being used for node/rel labels in Neo4j Aura][2]][2]\r\n\r\n\r\n  [1]: https://github.com/guy3hammer/LunarLander/blob/main/LunarLander.csv\r\n  [2]: https://i.sstatic.net/eAWd8pCv.png","link":"https://stackoverflow.com/questions/79551237/why-is-neo4j-aura-using-entity-types-not-values-as-labels-for-nodes-in-graph","title":"Why is Neo4j Aura using entity types (not values) as labels for nodes in graph?"},{"tags":["neo4j","cypher","theory","knowledge-graph"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":false,"score":1,"last_activity_date":1742406024,"last_edit_date":1742406024,"creation_date":1742405181,"answer_id":79520951,"question_id":79520062,"share_link":"https://stackoverflow.com/a/79520951","body_markdown":"Neo4j will [filter out any MATCH result row that repeats the same relationship](https://neo4j.com/docs/cypher-manual/current/patterns/reference/#graph-patterns-rules-relationship-uniqueness). That is why **(1)** did not do what you expected.\r\n\r\nAssuming that:\r\n\r\n- `N_11` is the number of `(:User {id: &quot;1&quot;})-[:RATED]-&gt;(:Movie)` paths, and\r\n- `User` node `id` properties have string values (to allow my query to use them as map keys),\r\n\r\nthis query may do what you want:\r\n\r\n```\r\nMATCH (u1:User)-[:RATED]-&gt;(:Movie)&lt;-[:RATED]-(u2:User)\r\nWITH u1, u2, COUNT(*) as ct\r\nWITH\r\n  COLLECT(DISTINCT u1) as u1s,\r\n  COLLECT(DISTINCT u2) AS u2s,\r\n  COLLECT({headUser: u1.id, tailUser: u2.id, ct: ct}) AS pairs\r\nUNWIND apoc.coll.intersection(u1s, u2s) AS user\r\nWITH user, COUNT { (user)-[:RATED]-&gt;(:Movie) } AS userCt, pairs\r\nWITH COLLECT(user.id) AS userIds, COLLECT(userCt) AS userCts, pairs\r\nWITH apoc.map.fromLists(userIds, userCts) AS userCtMap, pairs\r\nUNWIND pairs as pair\r\nRETURN\r\n  pair.headUser AS headUser,\r\n  pair.tailUser AS tailUser,\r\n  (2.0 * pair.ct)/(userCtMap[pair.headUser] + userCtMap[pair.tailUser]) AS pathSim\r\n```\r\n\r\nThis query calculates all distinct users found by the `MATCH` clause and maps each user&#39;s `id` to its number of outgoing `-[:RATED]-&gt;(:Movie)` relationships. It then uses that mapping to calculate the denominator of your pathSim formula.","link":"https://stackoverflow.com/questions/79520062/neo4j-count-of-symmetric-meta-path-include-half-meta-paths/79520951#79520951","title":"Neo4j - Count of symmetric meta-path - Include half meta-paths"}],"owner":{"reputation":1,"user_id":29990490,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/aaa17fd77ab102e0ac193581bfd8b09f?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Emanuele Maduli","link":"https://stackoverflow.com/users/29990490/emanuele-maduli"},"last_editor":{"reputation":1,"user_id":29990490,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/aaa17fd77ab102e0ac193581bfd8b09f?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Emanuele Maduli","link":"https://stackoverflow.com/users/29990490/emanuele-maduli"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":49,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1742406024,"creation_date":1742383686,"last_edit_date":1742384700,"question_id":79520062,"share_link":"https://stackoverflow.com/q/79520062","body_markdown":"I have constructed a Neo4j graph based on MovieLens100k with the following content:\r\n\r\n 1. Nodes: `(:User)`, `(:Movie)`, `(:Genre)`\r\n\r\n 2. Relations: `(:User)-[:RATED]-&gt;(:Movie)`, `(:Movie)-[:HAS_GENRE]-&gt;(:Genre)`\r\n\r\nI want to compute PathSim, which is a similarity measure for equal-type nodes following a meta-path which links the two entities. Suppose the entities are `(:User)` and that the meta-path to follow is the following: \r\n\r\n    path1=(:User)-[:RATED]-&gt;(:Movie)&lt;-[:RATED]-(:User)\r\n\r\nSuppose to have computed such quantities:\r\n\r\nN_ij = Number of path of type path1 starting from `(:User)` with id=i and ending in `(:User)` with id=j\r\n\r\nThen PathSim for user with id 1 and id 2 is:\r\n\r\n    PathSim = 2N_12/(N_11+N_22)\r\n\r\nTo compute such quantity in Neo4j my Cypher query **(1)** is:\r\n\r\n    &quot;&quot;&quot;\r\n    MATCH path=(u1:User)-[:RATED]-&gt;(:Movie)&lt;-[:RATED]-(u2:User)\r\n    WITH u1, u2, COUNT(path) as ct\r\n    RETURN u1.id as HeadUser, u2.id as TailUser, CASE WHEN ct is null THEN 0 ELSE ct END AS Overlap\r\n    &quot;&quot;&quot;\r\n\r\nLet us focus on users 1 and 2, this correctly computes all different paths between user 1 and 2, but it does not compute all different paths between user 1 and 1. In fact, since the meta-path is symmetric, N_11 should be equal to counting the half-paths `(u1:User)-[:RATED]-&gt;(:Movie)` starting from `(:User)` with id=1, *i.e.* query **(2)**:\r\n\r\n    &quot;&quot;&quot;\r\n    MATCH path=(u1:User {id: 1})-[:RATED]-&gt;(:Movie)\r\n    WITH COUNT(path) as ct\r\n    RETURN CASE WHEN ct is null THEN 0 ELSE ct END AS Overlap\r\n    &quot;&quot;&quot;\r\n\r\nBy taking into account &quot;trivial&quot; paths consisting of going from `(:User)` to `(:Movie)` and coming back from the same exact half-path.\r\n\r\nHowever, as I understand, there is no such row in query **(1)** since Cypher only counts different half-paths given a symmetric path. \r\n\r\nIs there a way to account for &quot;trivial&quot; paths by sort of modifying query **(1)**?\r\n  ","link":"https://stackoverflow.com/questions/79520062/neo4j-count-of-symmetric-meta-path-include-half-meta-paths","title":"Neo4j - Count of symmetric meta-path - Include half meta-paths"},{"tags":["neo4j","backup","dump","neo4j-admin"],"comments":[{"owner":{"reputation":143,"user_id":15354138,"user_type":"registered","profile_image":"https://i.sstatic.net/SMud3.jpg?s=256","display_name":"sdm4n","link":"https://stackoverflow.com/users/15354138/sdm4n"},"edited":false,"score":0,"creation_date":1762333614,"post_id":79517984,"comment_id":140837378,"link":"https://stackoverflow.com/questions/79517984/unknown-frame-descriptor-when-loading-a-neo4j-dump-with-neo4j-admin-load#comment140837378_79517984"}],"owner":{"reputation":143,"user_id":15354138,"user_type":"registered","profile_image":"https://i.sstatic.net/SMud3.jpg?s=256","display_name":"sdm4n","link":"https://stackoverflow.com/users/15354138/sdm4n"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":37,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1742312173,"creation_date":1742312173,"question_id":79517984,"share_link":"https://stackoverflow.com/q/79517984","body_markdown":"I create daily dumps in a K8s cluster using `helm` with `neo4j/neo4j` version `5.21.0` and `neo4j-admin database dump` command. Then I wanted to load the dumps into a local volume using `neo4j-admin` version `5.21.2` (same with version `2025.02.0`), which brings up the following error:\r\n\r\n```\r\nCaused by: org.neo4j.cli.CommandFailedException: Not a valid Neo4j archive: /backups/neo4j.dump\r\nCaused by: com.github.luben.zstd.ZstdIOException: Unknown frame descriptor\r\n```\r\n\r\nSame for running `neo4j-admin database check` on the dump file.\r\n\r\n### Actual behavior\r\n\r\nThe dumps worked fine for several months using the exact same toolchain, but now do not work for a couple of days anymore. So sometimes they work and sometimes not. The dump file size is about 1 GiB and the &quot;uncompressed&quot; size according to `neo4j-admin database load --info` is about 5 GiB. It seems that the `dump` command creates invalid archives or that the `load` command thinks they are invalid.\r\n\r\n### Expected behavior\r\n\r\nThe database dump files can be processed with `neo4j-admin database load` and `neo4j database check` properly.\r\n\r\n### Question\r\n\r\nCan the dump files be inspected with another tool to check their validity? Since Zstd is used, I tried to extract them with another zstd tooling, but it complains about that it is not a valid archive, even for the dump files checked valid with the `neo4j-admin` tooling.\r\n\r\n### Logs\r\n\r\nLog of `neo4j-admin database load` with stacktrace:\r\n\r\n```\r\nDone: 124 files, 4.858GiB processed.\r\nFailed to load database &#39;neo4j&#39;: Not a valid Neo4j archive: /backups/neo4j.dump\r\nLoad failed for databases: &#39;neo4j&#39;\r\norg.neo4j.cli.CommandFailedException: Load failed for databases: &#39;neo4j&#39;\r\n        at org.neo4j.commandline.dbms.LoadCommand.checkFailure(LoadCommand.java:300)\r\n        at org.neo4j.commandline.dbms.LoadCommand.loadDump(LoadCommand.java:283)\r\n        at org.neo4j.commandline.dbms.LoadCommand.loadDump(LoadCommand.java:241)\r\n        at org.neo4j.commandline.dbms.LoadCommand.execute(LoadCommand.java:169)\r\n        at org.neo4j.cli.AbstractCommand.call(AbstractCommand.java:92)\r\n        at org.neo4j.cli.AbstractCommand.call(AbstractCommand.java:37)\r\n        at picocli.CommandLine.executeUserObject(CommandLine.java:2041)\r\n        at picocli.CommandLine.access$1500(CommandLine.java:148)\r\n        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)\r\n        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)\r\n        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)\r\n        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)\r\n        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)\r\n        at picocli.CommandLine.execute(CommandLine.java:2170)\r\n        at org.neo4j.cli.AdminTool.execute(AdminTool.java:94)\r\n        at org.neo4j.cli.AdminTool.main(AdminTool.java:82)\r\nCaused by: org.neo4j.cli.CommandFailedException: Not a valid Neo4j archive: /backups/neo4j.dump\r\n        at org.neo4j.commandline.dbms.LoadDumpExecutor.load(LoadDumpExecutor.java:119)\r\n        at org.neo4j.commandline.dbms.LoadDumpExecutor.execute(LoadDumpExecutor.java:80)\r\n        at org.neo4j.commandline.dbms.LoadCommand.loadDump(LoadCommand.java:274)\r\n        ... 14 more\r\nCaused by: org.neo4j.dbms.archive.IncorrectFormat: /backups/neo4j.dump\r\n        at org.neo4j.dbms.archive.Loader.nextEntry(Loader.java:190)\r\n        at org.neo4j.dbms.archive.Loader.load(Loader.java:120)\r\n        at org.neo4j.commandline.dbms.LoadDumpExecutor.load(LoadDumpExecutor.java:103)\r\n        ... 16 more\r\nCaused by: com.github.luben.zstd.ZstdIOException: Unknown frame descriptor\r\n        at com.github.luben.zstd.ZstdInputStreamNoFinalizer.readInternal(ZstdInputStreamNoFinalizer.java:184)\r\n        at com.github.luben.zstd.ZstdInputStreamNoFinalizer.read(ZstdInputStreamNoFinalizer.java:136)\r\n        at org.apache.commons.io.IOUtils.skip(IOUtils.java:2414)\r\n        at org.apache.commons.compress.utils.IOUtils.skip(IOUtils.java:282)\r\n        at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.consumeRemainderOfLastBlock(TarArchiveInputStream.java:317)\r\n        at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getRecord(TarArchiveInputStream.java:501)\r\n        at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:415)\r\n        at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextEntry(TarArchiveInputStream.java:389)\r\n        at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextEntry(TarArchiveInputStream.java:49)\r\n        at org.neo4j.dbms.archive.Loader.nextEntry(Loader.java:188)\r\n        ... 18 more\r\n```\r\n\r\nLog of `neo4j-admin database dump`:\r\n\r\n```\r\nDone: 124 files, 4.858GiB processed.\r\n2025-03-10 01:03:30.303+0000 INFO  [o.n.c.d.DumpCommand] Dump completed successfully\r\n```","link":"https://stackoverflow.com/questions/79517984/unknown-frame-descriptor-when-loading-a-neo4j-dump-with-neo4j-admin-load","title":"Unknown frame descriptor when loading a Neo4j dump with neo4j-admin load"},{"tags":["neo4j","cypher"],"answers":[{"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"last_editor":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":0,"down_vote_count":0,"up_vote_count":2,"is_accepted":true,"score":2,"last_activity_date":1741607660,"last_edit_date":1741607660,"creation_date":1741606418,"answer_id":79497856,"question_id":79497812,"share_link":"https://stackoverflow.com/a/79497856","body_markdown":"```sql\r\nMATCH path = (r:`Neo4j::Record` {record_id: 1236})\r\n  &lt;-[n:`Neo4j::RecordAssociation` \r\n       WHERE n.label IN [&#39;Part Of&#39;, &#39;Related To&#39;, &#39;Recommends&#39;]]-{0,10} ()\r\nRETURN path, length(path) AS hops\r\nORDER BY hops\r\n```","link":"https://stackoverflow.com/questions/79497812/neo4j-matching-multiple-association-labels/79497856#79497856","title":"Neo4j matching multiple association labels"}],"owner":{"reputation":2959,"user_id":1195207,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/abfecec49e4871d38bfeedf7590c06ed?s=256&d=identicon&r=PG","display_name":"knirirr","link":"https://stackoverflow.com/users/1195207/knirirr"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":52,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"accepted_answer_id":79497856,"answer_count":1,"score":1,"last_activity_date":1741607660,"creation_date":1741605539,"question_id":79497812,"share_link":"https://stackoverflow.com/q/79497812","body_markdown":"In a Neo4j database, I&#39;d like to find everything pointing to a single record of interest, and filter these relations by their label. I can do this with a single label like this:\r\n\r\n```\r\nMATCH path = (r:`Neo4j::Record` {record_id: 1236})&lt;-[:`Neo4j::RecordAssociation` {label: &#39;Part Of&#39;}]-{0,10} ()\r\nRETURN path, length(path) AS hops\r\nORDER BY hops\r\n```\r\n\r\n...but, there are some additional labels on records a few hops away from 1236, e.g. &#39;Related To&#39;, &#39;Recommends&#39; etc. and I&#39;d like to include those as well.\r\n\r\nIs there any way to modify the `{label: &#39;Part Of&#39;}` part of the above query, or some other modification, which would allow matching &#39;Part Of&#39; OR &#39;Related To&#39; OR &#39;Recommends&#39; ?","link":"https://stackoverflow.com/questions/79497812/neo4j-matching-multiple-association-labels","title":"Neo4j matching multiple association labels"},{"tags":["graph","neo4j","cypher","neo4j-bloom"],"owner":{"reputation":13,"user_id":29882860,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/0c6967d597dc5066a5ef299649f69471?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"goubint","link":"https://stackoverflow.com/users/29882860/goubint"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":44,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":0,"score":1,"last_activity_date":1741185503,"creation_date":1741185503,"question_id":79486810,"share_link":"https://stackoverflow.com/q/79486810","body_markdown":"**Title:** Neo4j Bloom - Global Filter on Multiple Node Categories  \r\n\r\n**Body:**  \r\n\r\nI&#39;m using **Neo4j Bloom** as a visualization tool on **Neo4j v5.24.0** via **Neo4j Desktop 1.6.1**.  \r\n\r\nI have five node categories (which will increase over time). My goal is to add a filter to all of them to mark nodes that have already been reviewed by the analyst (who is not an IT specialist).  \r\n\r\nThe ideal solution would be to have a **global filter** on all displayed nodes that can be toggled easily, either with a **basic filter** or a **search phrase**.  \r\n\r\n### My Questions:  \r\n1. **Can I create a global filter** for all node categories, given that they all share the `.checked` property, or do I need one filter per category?  \r\n2. **What is the most efficient approach**: using a filter (if possible) or a search phrase?  \r\n\r\n### What I Tried:  \r\nI attempted to create a **global node type** containing only the `.checked` property and assigned it as a second type/category to all nodes. However, **Bloom&#39;s hierarchy system** only displays nodes under their highest category, making the filter work but preventing access to the full node information—rendering the solution useless.  \r\n\r\n### Additional Question:  \r\n- **Is it possible to customize the order of node properties in Bloom**, or are they always sorted alphabetically?  \r\n\r\nAny guidance would be much appreciated!","link":"https://stackoverflow.com/questions/79486810/neo4j-bloom-filtering-on-all-nodes-no-matter-their-category","title":"Neo4j Bloom filtering on all nodes no matter their category"},{"tags":["graph","neo4j","cypher"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":true,"score":0,"last_activity_date":1741198097,"last_edit_date":1741198097,"creation_date":1741131774,"answer_id":79485129,"question_id":79483789,"share_link":"https://stackoverflow.com/a/79485129","body_markdown":"This answer attempts to address questions 1, 2, and 3.\r\n\r\nYou can use [CALL subqueries](https://neo4j.com/docs/cypher-manual/current/subqueries/call-subquery/) to perform updates to the DB, and that can be done in ways that do not affect the number of rows in the outer query. For example, most of the subqueries in the example below are [Unit subqueries](https://neo4j.com/docs/cypher-manual/current/subqueries/call-subquery/) that do not `RETURN` anything), which never affect the number of rows in the outer query. The first subquery does RETURN something (`p`), but it returns a value for every outer row (because it does not filter out any rows), so it also does not affect the number of outer rows.\r\n\r\nAlso, you can have those subqueries [execute multiple transactions](https://neo4j.com/docs/cypher-manual/current/subqueries/subqueries-in-transactions/), to process subquery rows in batches (of 1000, by default), to avoid running out of memory.\r\n\r\nPotentially, something like this may work for you:\r\n\r\n    :auto // Only needed if running in Neo4j Browser\r\n\r\n    LOAD CSV WITH HEADERS FROM &#39;file:///data.csv&#39; AS row  \r\n    \r\n    // 1 - Create PERSONNE nodes  \r\n\tCALL (row) {\r\n\t  MERGE (p:PERSONNE {Numero_client: row.anc_ref})  \r\n\t  SET\r\n\t\tp.Chainage = row.chainage,\r\n\t\tp.Sexe = row.sexe,  \r\n\t\tp.cres_soc = row.cres_soc,\r\n\t\tp.dres_soc = CASE WHEN row.cres_soc &lt;&gt; &quot;00&quot; THEN row.dres_soc END,\r\n\t\tp.Age = row.age_cli,  \r\n\t\tp.Nom = row.nom_cli,  \r\n\t\tp.Prenom = row.pnom_cli,  \r\n\t\tp.Nom_conjoint = row.nom_cjt,  \r\n\t\tp.Prenom_conjoint = row.pnom_cjt\r\n\t  RETURN p\r\n\t} IN TRANSACTIONS\r\n\r\n    // 2 - Create TELEPHONE nodes and relationships  \r\n    CALL (p, row) {\r\n      WITH p, row  \r\n      UNWIND [row.num_tel1, row.num_tel2] AS tel  \r\n      WITH p, row, tel  \r\n      WHERE tel IS NOT NULL AND tel &lt;&gt; &quot;&quot; AND tel &lt;&gt; &quot; &quot;  \r\n      MERGE (t:TELEPHONE {Numero: tel})  \r\n      MERGE (p)-[:A_POUR_TELEPHONE {type: CASE WHEN tel = row.num_tel1 THEN &quot;PRINCIPAL&quot; ELSE &quot;SECONDAIRE&quot; END}]-&gt;(t)\r\n    } IN TRANSACTIONS\r\n    \r\n    // 3 - Create VOITURE nodes  \r\n    CALL (p, row) {\r\n      WITH p, row  \r\n      WHERE row.num_mnrl1 IS NOT NULL AND row.num_mnrl1 &lt;&gt; &quot;&quot; AND row.num_mnrl1 &lt;&gt; &quot; &quot;  \r\n      MERGE (v:VOITURE {Immatriculation: row.num_mnrl1})  \r\n      MERGE (p)-[:POSSEDE_VOITURE]-&gt;(v)  \r\n    } IN TRANSACTIONS\r\n    \r\n    // 4 - Create EMAIL nodes\r\n    CALL (p, row) {\r\n      WITH p, row  \r\n      WHERE row.mail IS NOT NULL AND row.mail &lt;&gt; &quot;&quot; AND row.mail &lt;&gt; &quot; &quot;  \r\n      MERGE (e:EMAIL {Adresse_mail: row.mail})  \r\n      MERGE (p)-[:A_POUR_MAIL]-&gt;(e)  \r\n    } IN TRANSACTIONS\r\n    \r\n    // 5 - Create ADRESSE nodes\r\n    CALL (p, row) {\r\n      WITH p, row  \r\n      WHERE row.rue IS NOT NULL AND row.cd_post IS NOT NULL AND row.commune IS NOT NULL  \r\n      MERGE (a:ADRESSE {Rue: row.rue, Code_postal: row.cd_post, Commune: row.commune})  \r\n      MERGE (p)-[:RESIDE_A]-&gt;(a)\r\n    } IN TRANSACTIONS\r\n\r\nNotes:\r\n - The `:auto` command should only be used if running in the Neo4j Browser (it is needed for the `IN TRANSACTIONS` functionality).\r\n - You may want to specify larger batch sizes for some or all CALL\r\n   subqueries (see the docs for the syntax).\r\n - This query assumes you are using at least neo4j version 5.23. If you are not, you need to replace the [variable-scope-clause](https://neo4j.com/docs/cypher-manual/current/subqueries/call-subquery/#variable-scope-clause) syntax with [prepended `WITH` clauses](https://neo4j.com/docs/cypher-manual/current/subqueries/call-subquery/#importing-with) in each subquery.\r\n - This query can still run out of memory if the data file has a large number of rows (since their data, plus data for the new `p` nodes, have to held in memory), in which case you many want to split the file into smaller ones to be processed separately.","link":"https://stackoverflow.com/questions/79483789/neo4j-graph-creation-query/79485129#79485129","title":"Neo4j graph creation query"}],"owner":{"reputation":13,"user_id":29882860,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/0c6967d597dc5066a5ef299649f69471?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"goubint","link":"https://stackoverflow.com/users/29882860/goubint"},"last_editor":{"reputation":13,"user_id":29882860,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/0c6967d597dc5066a5ef299649f69471?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"goubint","link":"https://stackoverflow.com/users/29882860/goubint"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":58,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79485129,"answer_count":1,"score":0,"last_activity_date":1741198097,"creation_date":1741093658,"last_edit_date":1741094277,"question_id":79483789,"share_link":"https://stackoverflow.com/q/79483789","body_markdown":"### Neo4j: Issues with `WHERE` Scope and Query Optimization in Fraud Detection Graph  \r\n\r\nI&#39;m new to Neo4j and trying to build a fraud detection graph using a dataset found online.  \r\n\r\n#### Environment:  \r\n- **Neo4j Desktop**: 1.6.1  \r\n- **Neo4j DB Version**: 5.24.0  \r\n\r\n### Issues  \r\n\r\nI am facing two main problems with my Cypher query:  \r\n\r\n1. **Scope of `WHERE` Clauses**:  \r\n   - The `WHERE` statements apply to the entire following part of the query instead of only the relevant section.  \r\n   - I tried using `CALL` statements but couldn&#39;t make them work correctly.  \r\n\r\n2. **Memory Issue &amp; Query Performance**:  \r\n   - When I try to run the entire query (with fixes for the first issue), I run into memory problems.  \r\n   - I need a way to optimize the query or split it into smaller subqueries.     \r\n\r\n### Indexing  \r\n\r\nBefore running the query, I created the following indexes:  \r\n\r\n```cypher\r\nCREATE INDEX person_index FOR (p:PERSONNE) ON (p.Numero_client);\r\nCREATE INDEX phone_index FOR (t:TELEPHONE) ON (t.Numero);\r\nCREATE INDEX car_index FOR (v:VOITURE) ON (v.Immatriculation);\r\nCREATE INDEX email_index FOR (e:EMAIL) ON (e.Adresse_mail);\r\nCREATE INDEX address_index FOR (a:ADRESSE) ON (a.Rue, a.Code_postal, a.Commune);\r\n```  \r\n\r\n### Full Query  \r\n\r\n```cypher\r\nLOAD CSV WITH HEADERS FROM &#39;file:///data.csv&#39; AS row  \r\n\r\n// 1⃣ - Create PERSONNE nodes  \r\nMERGE (p:PERSONNE {Numero_client: row.anc_ref})  \r\nSET p.Chainage = row.chainage,  \r\n    p.Sexe = row.sexe,  \r\n    p.cres_soc = row.cres_soc,  \r\n    p.Age = row.age_cli,  \r\n    p.Nom = row.nom_cli,  \r\n    p.Prenom = row.pnom_cli,  \r\n    p.Nom_conjoint = row.nom_cjt,  \r\n    p.Prenom_conjoint = row.pnom_cjt  \r\nWITH p, row  \r\nWHERE row.cres_soc &lt;&gt; &quot;00&quot; AND row.dres_soc IS NOT NULL  \r\nSET p.dres_soc = row.dres_soc  \r\n\r\n// 2⃣ - Create TELEPHONE nodes and relationships  \r\nWITH p, row  \r\nUNWIND [row.num_tel1, row.num_tel2] AS tel  \r\nWITH p, row, tel  \r\nWHERE tel IS NOT NULL AND tel &lt;&gt; &quot;&quot; AND tel &lt;&gt; &quot; &quot;  \r\nMERGE (t:TELEPHONE {Numero: tel})  \r\nMERGE (p)-[:A_POUR_TELEPHONE {type: CASE WHEN tel = row.num_tel1 THEN &quot;PRINCIPAL&quot; ELSE &quot;SECONDAIRE&quot; END}]-&gt;(t)  \r\n\r\n// 3⃣ - Create VOITURE nodes  \r\nWITH p, row  \r\nWHERE row.num_mnrl1 IS NOT NULL AND row.num_mnrl1 &lt;&gt; &quot;&quot; AND row.num_mnrl1 &lt;&gt; &quot; &quot;  \r\nMERGE (v:VOITURE {Immatriculation: row.num_mnrl1})  \r\nMERGE (p)-[:POSSEDE_VOITURE]-&gt;(v)  \r\n\r\n// 4⃣ - Create EMAIL nodes  \r\nWITH p, row  \r\nWHERE row.mail IS NOT NULL AND row.mail &lt;&gt; &quot;&quot; AND row.mail &lt;&gt; &quot; &quot;  \r\nMERGE (e:EMAIL {Adresse_mail: row.mail})  \r\nMERGE (p)-[:A_POUR_MAIL]-&gt;(e)  \r\n\r\n// 5⃣ - Create ADRESSE nodes  \r\nWITH p, row  \r\nWHERE row.rue IS NOT NULL AND row.cd_post IS NOT NULL AND row.commune IS NOT NULL  \r\nMERGE (a:ADRESSE {Rue: row.rue, Code_postal: row.cd_post, Commune: row.commune})  \r\nMERGE (p)-[:RESIDE_A]-&gt;(a);\r\n```  \r\n\r\n### Attempted Solution: Splitting Query  \r\n\r\nI tried breaking the query into smaller parts:  \r\n\r\n#### **Step 1: Creating `PERSONNE` nodes**  \r\n\r\n```cypher\r\nLOAD CSV WITH HEADERS FROM &#39;file:///data.csv&#39; AS row  \r\nMERGE (p:PERSONNE {Numero_client: row.anc_ref})  \r\nSET p.Chainage = row.chainage,  \r\n    p.Sexe = row.sexe,  \r\n    p.cres_soc = row.cres_soc,  \r\n    p.Age = row.age_cli,  \r\n    p.Nom = row.nom_cli,  \r\n    p.Prenom = row.pnom_cli,  \r\n    p.Nom_conjoint = row.nom_cjt,  \r\n    p.Prenom_conjoint = row.pnom_cjt  \r\nWITH p, row  \r\nWHERE row.cres_soc &lt;&gt; &quot;00&quot; AND row.dres_soc IS NOT NULL  \r\nSET p.dres_soc = row.dres_soc  \r\n```  \r\n\r\n#### **Step 2: Adding `TELEPHONE` nodes and relationships**  \r\n\r\n```cypher\r\nLOAD CSV WITH HEADERS FROM &#39;file:///data.csv&#39; AS row  \r\nMATCH (p:PERSONNE {Numero_client: row.anc_ref})  \r\nWITH p, row  \r\nUNWIND [row.num_tel1, row.num_tel2] AS tel  \r\nWITH p, row, tel   \r\nWHERE tel IS NOT NULL AND tel &lt;&gt; &quot;&quot; AND tel &lt;&gt; &quot; &quot;  \r\nMERGE (t:TELEPHONE {Numero: tel})  \r\nMERGE (p)-[:A_POUR_TELEPHONE {type: CASE WHEN tel = row.num_tel1 THEN &quot;PRINCIPAL&quot; ELSE &quot;SECONDAIRE&quot; END}]-&gt;(t)\r\n```  \r\n\r\nThis approach sometimes works, but most of the time, I get one of the following errors:  \r\n\r\n### **Error Message**\r\n```\r\nServiceUnavailable  \r\nWebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browser&#39;s development console to determine the root cause of the failure.  \r\nCommon reasons include:\r\n- The database being unavailable  \r\n- Using the wrong connection URL  \r\n- Temporary network problems  \r\n- Browser not trusting the Neo4j certificate  \r\nWebSocket `readyState` is: 3\r\n```\r\nOr:\r\n```\r\nNeo.TransientError.General.OutOfMemoryError\r\nThere is not enough memory to perform the current task. \r\nPlease try increasing &#39;server.memory.heap.max_size&#39; in the neo4j configuration (normally in &#39;conf/neo4j.conf&#39; or, if you are using Neo4j Desktop, found through the user interface)\r\nor if you are running an embedded installation increase the heap by using &#39;-Xmx&#39; command line flag, and then restart the database.\r\n```\r\n\r\n### **Questions**  \r\n\r\n1. **How can I ensure that `WHERE` statements only apply to the relevant section of my query?**  \r\n2. **What are the best ways to optimize this query to prevent memory issues?**  \r\n3. **Is there a correct way to split the query without running into the indefinite execution issue with `MATCH` after `LOAD CSV`?**  \r\n4. **How do I troubleshoot the WebSocket connection failure in Neo4j Desktop?**  \r\n\r\nAny help would be greatly appreciated! \r\n\r\n","link":"https://stackoverflow.com/questions/79483789/neo4j-graph-creation-query","title":"Neo4j graph creation query"},{"tags":["neo4j"],"answers":[{"tags":[],"owner":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1743011434,"creation_date":1743011434,"answer_id":79536858,"question_id":79481412,"share_link":"https://stackoverflow.com/a/79536858","body_markdown":"Please follow these procedure as stated on this documentation.\r\n\r\nhttps://neo4j.com/docs/operations-manual/2025.02/configuration/connectors/\r\n\r\nor this SO answer can also help you:\r\n\r\nhttps://stackoverflow.com/questions/62333557/neo4j-setup-in-openshift","link":"https://stackoverflow.com/questions/79481412/accessing-a-neo4j-service-via-ingress-on-my-local-browser/79536858#79536858","title":"accessing a Neo4j service via ingress on my local browser"}],"owner":{"reputation":1,"user_id":22537152,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/4dab6640f2ec43573d002bc556070ffd?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"quillboar2","link":"https://stackoverflow.com/users/22537152/quillboar2"},"last_editor":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":87,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1743011434,"creation_date":1741016273,"last_edit_date":1743011391,"question_id":79481412,"share_link":"https://stackoverflow.com/q/79481412","body_markdown":"I have a pod in openshift (Azure) which embarks a neo4j database 5.20.0 (community)\r\n**The pod is running ok, and I manage to launch cypher commands in pod&#39;s terminal.**\r\n\r\nHowever, I&#39;m unable to connect to the browser UI from my local browser.\r\n**The UI itself displays well**, it&#39;s just the connection part which wouldn&#39;t work.\r\n\r\n\r\nHere are my ingresses :\r\n[enter image description here][1]\r\n\r\n\r\nThe UI displays ok with first ingress&#39; URL, until I try to connect : \r\n[enter image description here][2]\r\nOn connection, I timeout every time my browser tries to interact with websocket : \r\nI tried both neo4j:// and bolt:// connections, on both 7474 and 7687 ports.\r\n[enter image description here][3]\r\n\r\nMy settings of interest in the conf file are :\r\n\r\n    server.default_listen_address=0.0.0.0\r\n    \r\n    dbms.connectors.default_listen_address=0.0.0.0\r\n    \r\n    dbms.connector.bolt.address=0.0.0.0:7687\r\n    \r\n    dbms.connector.bolt.listen_address=0.0.0.0:7687\r\n    \r\n    server.bolt.enabled=true\r\n    \r\n    server.bolt.listen_address=:7687\r\n    \r\n    server.bolt.advertised_address=:7687\r\n    \r\n    server.http.enabled=true\r\n    \r\n    server.http.listen_address=:7474\r\n    \r\n    server.http.advertised_address=:7474\r\n\r\nOn those settings, I tried almost all possible combinations, but is still doesn&#39;t work.\r\n\r\n  [1]: https://i.sstatic.net/rPXzHbkZ.png\r\n  [2]: https://i.sstatic.net/1945Beq3.png\r\n  [3]: https://i.sstatic.net/BHySOIQz.png\r\n\r\nAny help would be welcome,\r\n\r\nRegards.","link":"https://stackoverflow.com/questions/79481412/accessing-a-neo4j-service-via-ingress-on-my-local-browser","title":"accessing a Neo4j service via ingress on my local browser"},{"tags":["neo4j","cypher"],"comments":[{"owner":{"reputation":30487,"user_id":92359,"user_type":"registered","accept_rate":94,"profile_image":"https://www.gravatar.com/avatar/664d3d4c50c731d90a32db5f9e01b4b9?s=256&d=identicon&r=PG","display_name":"InverseFalcon","link":"https://stackoverflow.com/users/92359/inversefalcon"},"edited":false,"score":0,"creation_date":1740550414,"post_id":79468285,"comment_id":140149394,"link":"https://stackoverflow.com/questions/79468285/behavior-of-the-all-predicate-function-in-neo4j#comment140149394_79468285"},{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"edited":false,"score":1,"creation_date":1740583471,"post_id":79468285,"comment_id":140151984,"link":"https://stackoverflow.com/questions/79468285/behavior-of-the-all-predicate-function-in-neo4j#comment140151984_79468285"}],"answers":[{"comments":[{"owner":{"reputation":293,"user_id":1405305,"user_type":"registered","profile_image":"https://i.sstatic.net/2mDfK.jpg?s=256","display_name":"norihide.shimatani","link":"https://stackoverflow.com/users/1405305/norihide-shimatani"},"edited":false,"score":0,"creation_date":1740617034,"post_id":79469873,"comment_id":140154200,"link":"https://stackoverflow.com/questions/79468285/behavior-of-the-all-predicate-function-in-neo4j/79469873#comment140154200_79469873"}],"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"last_editor":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":1,"down_vote_count":0,"up_vote_count":2,"is_accepted":true,"score":2,"last_activity_date":1755166119,"last_edit_date":1755166119,"creation_date":1740575766,"answer_id":79469873,"question_id":79468285,"share_link":"https://stackoverflow.com/a/79469873","body_markdown":"The `all()` predicate function returns true for empty lists because it is [vacuously true][1]. It&#39;s consistent with the other predicate functions. \r\n\r\nFor example, the contradiction of `all(x IN [] WHERE P(x))` is `any(x IN [] WHERE NOT P(x))`. In the latter case, there does not exist an `x` for which `P(x)`, and so it is always false. \r\n\r\nFor `none(x IN [] WHERE Q(x))`, we can see it is equivalent to `all(x IN [] WHERE NOT Q(x))`, and so it is also (vacuously) true.\r\n\r\nSee this example query:\r\n```lang-cypher\r\nRETURN all(x IN [] WHERE x &gt; 0),     // TRUE\r\n       none(x IN [] WHERE x &gt; 0),    // TRUE\r\n       any(x IN [] WHERE NOT x &gt; 0)  // FALSE\r\n```\r\n\r\n\r\n  [1]: https://en.wikipedia.org/wiki/Vacuous_truth","link":"https://stackoverflow.com/questions/79468285/behavior-of-the-all-predicate-function-in-neo4j/79469873#79469873","title":"Behavior of the ALL() Predicate Function in Neo4j"}],"owner":{"reputation":293,"user_id":1405305,"user_type":"registered","profile_image":"https://i.sstatic.net/2mDfK.jpg?s=256","display_name":"norihide.shimatani","link":"https://stackoverflow.com/users/1405305/norihide-shimatani"},"comment_count":2,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":87,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"accepted_answer_id":79469873,"answer_count":1,"score":1,"last_activity_date":1755166119,"creation_date":1740533491,"question_id":79468285,"share_link":"https://stackoverflow.com/q/79468285","body_markdown":"I have a question regarding the behavior of the ALL() predicate function in Neo4j 5.26.2. I have no issues with (1) and (2), however, I&#39;m finding it unusual that I get 3 hits each with (3) and (4). Is this the correct behavior (as per specification)?\r\n\r\n(1)\r\n\r\n    MATCH(p:Parent)\r\n    WHERE ALL(x IN p.array WHERE x = 2)\r\n    RETURN p.id, p.array\r\n    ;\r\n    p.id\tp.array\r\n    2\t[2, 2, 2]\r\n\r\n(2)\r\n\r\n    MATCH(p:Parent)--(c)\r\n    WITH p, COLLECT(c.parent) AS parents\r\n    WHERE ALL(x IN parents WHERE x = 2)\r\n    RETURN p.id, parents\r\n    ;\r\n    p.id\tparents\r\n    2\t[2, 2, 2]\r\n\r\n(3)\r\n\r\n    MATCH(p:Parent)\r\n    WHERE ALL(x IN p.empty_array WHERE x = 2)\r\n    RETURN p.id, p.empty_array\r\n    ;\r\n    p.id\tp.empty_array\r\n    1\t[]\r\n    2\t[]\r\n    3\t[]\r\n\r\n(4)\r\n\r\n    MATCH(p:Parent)--(c)\r\n    WITH p, COLLECT(c.does_not_exist) AS does_not_exists\r\n    WHERE ALL(x IN does_not_exists WHERE x = 2)\r\n    RETURN p.id, does_not_exists\r\n    ;\r\n    p.id\tdoes_not_exists\r\n    1\t[]\r\n    2\t[]\r\n    3\t[]\r\n\r\nYou can create test data with the following Cypher statement:\r\n\r\n    WITH\r\n        RANGE(1,3) AS parents,\r\n        RANGE(1,3) AS children\r\n    FOREACH (parent IN parents | \r\n        MERGE (p:Parent{id:parent, array:[], empty_array:[]})\r\n        FOREACH (child IN children | \r\n            CREATE (c:Child{id:parent*10 + child, parent:parent})\r\n            MERGE (p)-[:CHILD]-&gt;(c)\r\n    \t    SET p.array = p.array + parent\r\n        )\r\n    );\r\n\r\nDisplaying test data:\r\n\r\n    MATCH(p:Parent)--(c:Child)\r\n    RETURN *;\r\n\r\nDeleting test data:\r\n\r\n    MATCH(p:Parent)--(c:Child)\r\n    DETACH DELETE p, c;","link":"https://stackoverflow.com/questions/79468285/behavior-of-the-all-predicate-function-in-neo4j","title":"Behavior of the ALL() Predicate Function in Neo4j"},{"tags":["neo4j","cypher"],"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1740435642,"post_id":79462993,"comment_id":140142995,"link":"https://stackoverflow.com/questions/79462993/how-to-specify-alternative-steps-using-quantified-paths-in-cypher-neo4j#comment140142995_79462993"}],"answers":[{"comments":[{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"edited":false,"score":0,"creation_date":1740393650,"post_id":79463182,"comment_id":140139786,"link":"https://stackoverflow.com/questions/79462993/how-to-specify-alternative-steps-using-quantified-paths-in-cypher-neo4j/79463182#comment140139786_79463182"}],"tags":[],"owner":{"reputation":386,"user_id":21624328,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AGNmyxZzl1uvGNT2Zj90oWIgnDozeOoiJzA7-rJgem4f=k-s256","display_name":"Christoffer Bergman","link":"https://stackoverflow.com/users/21624328/christoffer-bergman"},"comment_count":1,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1740392643,"creation_date":1740392643,"answer_id":79463182,"question_id":79462993,"share_link":"https://stackoverflow.com/a/79463182","body_markdown":"This isn&#39;t possible in a single statement today. It is a feature that is being considered (and if so might actually get the syntax you proposed). For now, you would have to do a UNION between two QPP&#39;s.\r\n\r\n    MATCH (a0:App {name: &quot;origin&quot;}) \r\n    ( (a1:App)-[c2:CONSUMES]-&gt;(i:Interface)&lt;-[c3:PROVIDES]-&gt;(a2:App)\r\n    Where a1.name &lt;&gt; &quot;some condition&quot;\r\n    ) {1,5} \r\n    RETURN ....\r\n    UNION\r\n    MATCH (a0:App {name: &quot;origin&quot;})\r\n      (a3:App)-[c4:REQUIRES]-&gt;(a4:App) \r\n    Where a1.name &lt;&gt; &quot;some condition&quot;\r\n    ) {1,5} \r\n    RETURN ....\r\n\r\nYou just need to make sure that the two RETURN statements returns the same things (the same columns)","link":"https://stackoverflow.com/questions/79462993/how-to-specify-alternative-steps-using-quantified-paths-in-cypher-neo4j/79463182#79463182","title":"How to specify alternative steps using quantified paths in Cypher/Neo4j?"},{"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1740393426,"creation_date":1740393426,"answer_id":79463216,"question_id":79462993,"share_link":"https://stackoverflow.com/a/79463216","body_markdown":"The alternation syntax you&#39;re suggesting is not supported (yet). You could instead insert a relationship `REQIURES_VIA_INTERFACE` like so:\r\n```lang-cypher\r\nMATCH (a:App)-[:CONSUMES]-&gt;(:Interface)&lt;-[:PROVIDES]-(b:App) \r\nWHERE NOT EXISTS { (a)-[:REQUIRES_VIA_INTERFACE]-&gt;(b) }\r\nCREATE (a)-[:REQUIRES_VIA_INTERFACE]-&gt;(b)\r\n```\r\nThen your query above could become:\r\n```lang-cypher\r\nMATCH (a0:App {name: &quot;origin&quot;}) \r\n  ( (a1:App)-[c:REQUIRES|REQUIRES_VIA_INTERFACE]-&gt;(a2:App) \r\n     WHERE a1.name &lt;&gt; &quot;some condition&quot; ){1,5} \r\nRETURN *\r\n```\r\n","link":"https://stackoverflow.com/questions/79462993/how-to-specify-alternative-steps-using-quantified-paths-in-cypher-neo4j/79463216#79463216","title":"How to specify alternative steps using quantified paths in Cypher/Neo4j?"},{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1740436385,"last_edit_date":1740436385,"creation_date":1740435672,"answer_id":79464937,"question_id":79462993,"share_link":"https://stackoverflow.com/a/79464937","body_markdown":"You can use the APOC procedure [apoc.path.expandConfig](https://neo4j.com/docs/apoc/current/overview/apoc.path/apoc.path.expandConfig/) instead.\r\n\r\nFor example, to meet your 2 stated conditions, and assuming you do not want any paths that contain an `App` node whose `name` is &quot;some condition&quot;:\r\n\r\n    MATCH (a0:App {name: &quot;origin&quot;})\r\n    CALL apoc.path.expandConfig(a0, {\r\n      minLevel: 1,\r\n      maxLevel: 5,\r\n      sequence: &#39;App,CONSUMES&gt;,Interface,&lt;PROVIDES,App|App,REQUIRES&gt;,App&#39;,\r\n      uniqueness: &#39;NODE_PATH&#39;\r\n    }) YIELD path\r\n    WHERE ALL(a1 IN NODES(path) WHERE NOT a1:App OR a1.name &lt;&gt; &quot;some condition&quot;)\r\n    RETURN path\r\n\r\nIn this example, the uniqueness value of &#39;NODE_PATH&#39; is used to prevent any returned path from having cycles (where the same node appears multiple times). You may want to read the docs to see which value is appropriate for your use case.","link":"https://stackoverflow.com/questions/79462993/how-to-specify-alternative-steps-using-quantified-paths-in-cypher-neo4j/79464937#79464937","title":"How to specify alternative steps using quantified paths in Cypher/Neo4j?"}],"owner":{"reputation":161,"user_id":8462378,"user_type":"registered","profile_image":"https://i.sstatic.net/MBWL0Sdp.png?s=256","display_name":"M Lewis","link":"https://stackoverflow.com/users/8462378/m-lewis"},"last_editor":{"reputation":6280,"user_id":2266,"user_type":"registered","accept_rate":90,"profile_image":"https://www.gravatar.com/avatar/aa64f5e61bb8cbcc9d10372256580364?s=256&d=identicon&r=PG","display_name":"Charlotte Skardon","link":"https://stackoverflow.com/users/2266/charlotte-skardon"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":81,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":3,"score":1,"last_activity_date":1740482676,"creation_date":1740389094,"last_edit_date":1740482676,"question_id":79462993,"share_link":"https://stackoverflow.com/q/79462993","body_markdown":"I have a graph that where &#39;App&#39; nodes connect either directly to other App nodes using a REQUIRES relationship, or via an intermediate Interface object.\r\neg either:\r\n\r\n`(:App)-[:CONSUMES]-&gt;(:Interface)&lt;-[:PROVIDES]-(:App)`\r\nor\r\n\r\n`(:App)-[:REQUIRES]-&gt;(:App)`\r\n\r\nI&#39;m trying to do this using quantified paths to follow these relationships across multiple steps since that allows me to apply conditions (using a WHERE clause) to each step. But I&#39;m having trouble expressing the fact that I want to allow each step between App nodes to be either of these alternatives.\r\n\r\nI&#39;m conceptually trying to do the following...\r\n\r\n```\r\nMATCH (a0:App {name: &quot;origin&quot;}) \r\n( (a1:App)-[c2:CONSUMES]-&gt;(i:Interface)&lt;-[c3:PROVIDES]-&gt;(a2:App)\r\n  |   // &lt;- this isn&#39;t valid syntax  \r\n  (a3:App)-[c4:REQUIRES]-&gt;(a4:App) \r\nWhere a1.name &lt;&gt; &quot;some condition&quot;\r\n) {1,5} \r\nRETURN ....\r\n```\r\n\r\nAny suggestions on how such alternatives can be described would be appreciated.","link":"https://stackoverflow.com/questions/79462993/how-to-specify-alternative-steps-using-quantified-paths-in-cypher-neo4j","title":"How to specify alternative steps using quantified paths in Cypher/Neo4j?"},{"tags":["python","neo4j","langchain"],"answers":[{"tags":[],"owner":{"reputation":793,"user_id":4489082,"user_type":"registered","accept_rate":46,"profile_image":"https://www.gravatar.com/avatar/ee5c1940b6841ac10ad1bc467667abbe?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"pkj","link":"https://stackoverflow.com/users/4489082/pkj"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1740386308,"creation_date":1740386308,"answer_id":79462874,"question_id":79462736,"share_link":"https://stackoverflow.com/a/79462874","body_markdown":"I learn that the instance on neo4jaura was paused. Turning it on, solved the problem. ","link":"https://stackoverflow.com/questions/79462736/error-while-creating-neo4jgraph-object-using-langchain/79462874#79462874","title":"Error while creating Neo4jGraph object using langchain"},{"tags":[],"owner":{"reputation":1,"user_id":30612471,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/1b12b0e14a0ebeb12d7b3924cc0ca78c?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Yash","link":"https://stackoverflow.com/users/30612471/yash"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1747959697,"creation_date":1747959697,"answer_id":79634689,"question_id":79462736,"share_link":"https://stackoverflow.com/a/79634689","body_markdown":"the probem is  in URI ,change your URI add ssc instead of only s\r\n\r\n```\r\nNeo4j URI: neo4j+s://53XXXe0e.databases.neo4j.io\r\n//change this into\r\nNeo4j URI: neo4j+ssc://53XXXe0e.databases.neo4j.io\r\n```","link":"https://stackoverflow.com/questions/79462736/error-while-creating-neo4jgraph-object-using-langchain/79634689#79634689","title":"Error while creating Neo4jGraph object using langchain"}],"owner":{"reputation":793,"user_id":4489082,"user_type":"registered","accept_rate":46,"profile_image":"https://www.gravatar.com/avatar/ee5c1940b6841ac10ad1bc467667abbe?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"pkj","link":"https://stackoverflow.com/users/4489082/pkj"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":253,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":2,"score":0,"last_activity_date":1747959697,"creation_date":1740382726,"question_id":79462736,"share_link":"https://stackoverflow.com/q/79462736","body_markdown":"\r\nI am trying to create a neo4j object using the following code. While I run the code, I receive error. Kindly help me fix this error. I have verified that the environment variables are read correctly. I am running this on my local Ubuntu machine.\r\n\r\nCode - \r\n\r\n\r\n```\r\nfrom langchain_neo4j import Neo4jGraph \r\nimport os\r\nfrom dotenv import load_dotenv \r\nload_dotenv() \r\nneo4j_uri = os.getenv(&#39;NEO4J_URI&#39;) \r\nprint(f&quot;Neo4j URI: {neo4j_uri}&quot;)\r\ngraph = Neo4jGraph(url= neo4j_uri,username = os.getenv(&#39;NEO4J_USERNAME&#39;),password = os.getenv(&#39;NEO4J_PASSWORD&#39;))\r\n```\r\n\r\nOutput of the code- \r\n\r\n```\r\nNeo4j URI: neo4j+s://53XXXe0e.databases.neo4j.io\r\n---------------------------------------------------------------------------\r\ngaierror&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Traceback (most recent call last)\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_async_compat/network/_util.py:144, in NetworkUtil._dns_resolver(address, family)\r\n&#160; &#160; 143 try:\r\n--&gt; 144&#160; &#160; &#160;info = NetworkUtil.get_address_info(\r\n&#160; &#160; 145&#160; &#160; &#160; &#160; &#160;address.host,\r\n&#160; &#160; 146&#160; &#160; &#160; &#160; &#160;address.port,\r\n&#160; &#160; 147&#160; &#160; &#160; &#160; &#160;family=family,\r\n&#160; &#160; 148&#160; &#160; &#160; &#160; &#160;type=socket.SOCK_STREAM,\r\n&#160; &#160; 149&#160; &#160; &#160;)\r\n&#160; &#160; 150 except OSError as e:\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_async_compat/network/_util.py:130, in NetworkUtil.get_address_info(host, port, family, type, proto, flags)\r\n&#160; &#160; 128 @staticmethod\r\n&#160; &#160; 129 def get_address_info(host, port, *, family=0, type=0, proto=0, flags=0):\r\n--&gt; 130&#160; &#160; &#160;return socket.getaddrinfo(host, port, family, type, proto, flags)\r\n\r\nFile /usr/lib/python3.10/socket.py:967, in getaddrinfo(host, port, family, type, proto, flags)\r\n&#160; &#160; 966 addrlist = []\r\n--&gt; 967 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\r\n&#160; &#160; 968&#160; &#160; &#160;af, socktype, proto, canonname, sa = res\r\n\r\ngaierror: [Errno -2] Name or service not known\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nValueError&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Traceback (most recent call last)\r\nCell In[1], line 6\r\n&#160; &#160; &#160; 4 from dotenv import load_dotenv\r\n&#160; &#160; &#160; 5 load_dotenv()&#160;\r\n----&gt; 6 graph = Neo4jGraph(\r\n&#160; &#160; &#160; 7&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;url&#160; &#160; &#160; = os.getenv(&#39;NEO4J_URI&#39;),\r\n&#160; &#160; &#160; 8&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;username = os.getenv(&#39;NEO4J_USERNAME&#39;),\r\n&#160; &#160; &#160; 9&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;password = os.getenv(&#39;NEO4J_PASSWORD&#39;)\r\n&#160; &#160; &#160;10&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;)\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/langchain_neo4j/graphs/neo4j_graph.py:379, in Neo4jGraph.__init__(self, url, username, password, database, timeout, sanitize, refresh_schema, driver_config, enhanced_schema)\r\n&#160; &#160; 377 # Verify connection\r\n&#160; &#160; 378 try:\r\n--&gt; 379&#160; &#160; &#160;self._driver.verify_connectivity()\r\n&#160; &#160; 380 except neo4j.exceptions.ConfigurationError:\r\n&#160; &#160; 381&#160; &#160; &#160;raise ValueError(\r\n&#160; &#160; 382&#160; &#160; &#160; &#160; &#160;&quot;Could not connect to Neo4j database. &quot;\r\n&#160; &#160; 383&#160; &#160; &#160; &#160; &#160;&quot;Please ensure that the driver config is correct&quot;\r\n&#160; &#160; 384&#160; &#160; &#160;)\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_sync/driver.py:1081, in Driver.verify_connectivity(self, **config)\r\n&#160; &#160;1074&#160; &#160; &#160;experimental_warn(\r\n&#160; &#160;1075&#160; &#160; &#160; &#160; &#160;&quot;All configuration key-word arguments to &quot;\r\n&#160; &#160;1076&#160; &#160; &#160; &#160; &#160;&quot;verify_connectivity() are experimental. They might be &quot;\r\n&#160; &#160;1077&#160; &#160; &#160; &#160; &#160;&quot;changed or removed in any future version without prior &quot;\r\n&#160; &#160;1078&#160; &#160; &#160; &#160; &#160;&quot;notice.&quot;\r\n&#160; &#160;1079&#160; &#160; &#160;)\r\n&#160; &#160;1080 session_config = self._read_session_config(config)\r\n-&gt; 1081 self._get_server_info(session_config)\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_sync/driver.py:1296, in Driver._get_server_info(self, session_config)\r\n&#160; &#160;1294 def _get_server_info(self, session_config) -&gt; ServerInfo:\r\n&#160; &#160;1295&#160; &#160; &#160;with self._session(session_config) as session:\r\n-&gt; 1296&#160; &#160; &#160; &#160; &#160;return session._get_server_info()\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_sync/work/session.py:183, in Session._get_server_info(self)\r\n&#160; &#160; 181 def _get_server_info(self):\r\n&#160; &#160; 182&#160; &#160; &#160;assert not self._connection\r\n--&gt; 183&#160; &#160; &#160;self._connect(READ_ACCESS, liveness_check_timeout=0)\r\n&#160; &#160; 184&#160; &#160; &#160;server_info = self._connection.server_info\r\n&#160; &#160; 185&#160; &#160; &#160;self._disconnect()\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_sync/work/session.py:136, in Session._connect(self, access_mode, **acquire_kwargs)\r\n&#160; &#160; 134&#160; &#160; &#160;access_mode = self._config.default_access_mode\r\n&#160; &#160; 135 try:\r\n--&gt; 136&#160; &#160; &#160;super()._connect(\r\n&#160; &#160; 137&#160; &#160; &#160; &#160; &#160;access_mode, auth=self._config.auth, **acquire_kwargs\r\n&#160; &#160; 138&#160; &#160; &#160;)\r\n&#160; &#160; 139 except asyncio.CancelledError:\r\n&#160; &#160; 140&#160; &#160; &#160;self._handle_cancellation(message=&quot;_connect&quot;)\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_sync/work/workspace.py:167, in Workspace._connect(self, access_mode, auth, **acquire_kwargs)\r\n&#160; &#160; 159&#160; &#160; &#160;else:\r\n&#160; &#160; 160&#160; &#160; &#160; &#160; &#160;# This is the first time we open a connection to a server in a\r\n&#160; &#160; 161&#160; &#160; &#160; &#160; &#160;# cluster environment for this session without explicitly\r\n&#160; &#160;(...)\r\n&#160; &#160; 164&#160; &#160; &#160; &#160; &#160;# we shall use this database explicitly for all subsequent\r\n&#160; &#160; 165&#160; &#160; &#160; &#160; &#160;# actions within this session.\r\n&#160; &#160; 166&#160; &#160; &#160; &#160; &#160;log.debug(&quot;[#0000]&#160; _: &lt;WORKSPACE&gt; resolve home database&quot;)\r\n--&gt; 167&#160; &#160; &#160; &#160; &#160;self._pool.update_routing_table(\r\n&#160; &#160; 168&#160; &#160; &#160; &#160; &#160; &#160; &#160;database=self._config.database,\r\n&#160; &#160; 169&#160; &#160; &#160; &#160; &#160; &#160; &#160;imp_user=self._config.impersonated_user,\r\n&#160; &#160; 170&#160; &#160; &#160; &#160; &#160; &#160; &#160;bookmarks=self._get_bookmarks(),\r\n&#160; &#160; 171&#160; &#160; &#160; &#160; &#160; &#160; &#160;auth=auth,\r\n&#160; &#160; 172&#160; &#160; &#160; &#160; &#160; &#160; &#160;acquisition_timeout=acquisition_timeout,\r\n&#160; &#160; 173&#160; &#160; &#160; &#160; &#160; &#160; &#160;database_callback=self._set_cached_database,\r\n&#160; &#160; 174&#160; &#160; &#160; &#160; &#160;)\r\n&#160; &#160; 175 acquire_kwargs_ = {\r\n&#160; &#160; 176&#160; &#160; &#160;&quot;access_mode&quot;: access_mode,\r\n&#160; &#160; 177&#160; &#160; &#160;&quot;timeout&quot;: acquisition_timeout,\r\n&#160; &#160;(...)\r\n&#160; &#160; 181&#160; &#160; &#160;&quot;liveness_check_timeout&quot;: None,\r\n&#160; &#160; 182 }\r\n&#160; &#160; 183 acquire_kwargs_.update(acquire_kwargs)\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_sync/io/_pool.py:900, in Neo4jPool.update_routing_table(self, database, imp_user, bookmarks, auth, acquisition_timeout, database_callback)\r\n&#160; &#160; 890 existing_routers = set(routing_table.routers)\r\n&#160; &#160; 892 prefer_initial_routing_address = self.routing_tables[\r\n&#160; &#160; 893&#160; &#160; &#160;database\r\n&#160; &#160; 894 ].initialized_without_writers\r\n&#160; &#160; 896 if (\r\n&#160; &#160; 897&#160; &#160; &#160;prefer_initial_routing_address\r\n&#160; &#160; 898&#160; &#160; &#160;and\r\n&#160; &#160; 899&#160; &#160; &#160;# TODO: Test this state\r\n--&gt; 900&#160; &#160; &#160;self._update_routing_table_from(\r\n&#160; &#160; 901&#160; &#160; &#160; &#160; &#160;self.address,\r\n&#160; &#160; 902&#160; &#160; &#160; &#160; &#160;database=database,\r\n&#160; &#160; 903&#160; &#160; &#160; &#160; &#160;imp_user=imp_user,\r\n&#160; &#160; 904&#160; &#160; &#160; &#160; &#160;bookmarks=bookmarks,\r\n&#160; &#160; 905&#160; &#160; &#160; &#160; &#160;auth=auth,\r\n&#160; &#160; 906&#160; &#160; &#160; &#160; &#160;acquisition_timeout=acquisition_timeout,\r\n&#160; &#160; 907&#160; &#160; &#160; &#160; &#160;database_callback=database_callback,\r\n&#160; &#160; 908&#160; &#160; &#160;)\r\n&#160; &#160; 909 ):\r\n&#160; &#160; 910&#160; &#160; &#160;# Why is only the first initial routing address used?\r\n&#160; &#160; 911&#160; &#160; &#160;return\r\n&#160; &#160; 912 if self._update_routing_table_from(\r\n&#160; &#160; 913&#160; &#160; &#160;*(existing_routers - {self.address}),\r\n&#160; &#160; 914&#160; &#160; &#160;database=database,\r\n&#160; &#160;(...)\r\n&#160; &#160; 919&#160; &#160; &#160;database_callback=database_callback,\r\n&#160; &#160; 920 ):\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_sync/io/_pool.py:830, in Neo4jPool._update_routing_table_from(self, database, imp_user, bookmarks, auth, acquisition_timeout, database_callback, *routers)\r\n&#160; &#160; 822&#160; &#160; &#160;log.debug(\r\n&#160; &#160; 823&#160; &#160; &#160; &#160; &#160;(\r\n&#160; &#160; 824&#160; &#160; &#160; &#160; &#160; &#160; &#160;&quot;[#0000]&#160; _: &lt;POOL&gt; &quot;\r\n&#160; &#160;(...)\r\n&#160; &#160; 827&#160; &#160; &#160; &#160; &#160;&quot;, &quot;.join(map(repr, routers)),\r\n&#160; &#160; 828&#160; &#160; &#160;)\r\n&#160; &#160; 829 for router in routers:\r\n--&gt; 830&#160; &#160; &#160;for address in NetworkUtil.resolve_address(\r\n&#160; &#160; 831&#160; &#160; &#160; &#160; &#160;router, resolver=self.pool_config.resolver\r\n&#160; &#160; 832&#160; &#160; &#160;):\r\n&#160; &#160; 833&#160; &#160; &#160; &#160; &#160;new_routing_table = self.fetch_routing_table(\r\n&#160; &#160; 834&#160; &#160; &#160; &#160; &#160; &#160; &#160;address=address,\r\n&#160; &#160; 835&#160; &#160; &#160; &#160; &#160; &#160; &#160;acquisition_timeout=acquisition_timeout,\r\n&#160; &#160;(...)\r\n&#160; &#160; 839&#160; &#160; &#160; &#160; &#160; &#160; &#160;auth=auth,\r\n&#160; &#160; 840&#160; &#160; &#160; &#160; &#160;)\r\n&#160; &#160; 841&#160; &#160; &#160; &#160; &#160;if new_routing_table is not None:\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_async_compat/network/_util.py:196, in NetworkUtil.resolve_address(address, family, resolver)\r\n&#160; &#160; 194&#160; &#160; &#160; &#160; &#160; &#160; &#160;yield address_dns_resolved\r\n&#160; &#160; 195 else:\r\n--&gt; 196&#160; &#160; &#160;for address_dns_resolved in NetworkUtil._dns_resolver(\r\n&#160; &#160; 197&#160; &#160; &#160; &#160; &#160;address, family=family\r\n&#160; &#160; 198&#160; &#160; &#160;):\r\n&#160; &#160; 199&#160; &#160; &#160; &#160; &#160;log.debug(\r\n&#160; &#160; 200&#160; &#160; &#160; &#160; &#160; &#160; &#160;&quot;[#0000]&#160; _: &lt;RESOLVE&gt; dns resolver out: %s&quot;,\r\n&#160; &#160; 201&#160; &#160; &#160; &#160; &#160; &#160; &#160;address_dns_resolved,\r\n&#160; &#160; 202&#160; &#160; &#160; &#160; &#160;)\r\n&#160; &#160; 203&#160; &#160; &#160; &#160; &#160;yield address_dns_resolved\r\n\r\nFile ~/python3.10_venv/lib/python3.10/site-packages/neo4j/_async_compat/network/_util.py:151, in NetworkUtil._dns_resolver(address, family)\r\n&#160; &#160; 144&#160; &#160; &#160;info = NetworkUtil.get_address_info(\r\n&#160; &#160; 145&#160; &#160; &#160; &#160; &#160;address.host,\r\n&#160; &#160; 146&#160; &#160; &#160; &#160; &#160;address.port,\r\n&#160; &#160; 147&#160; &#160; &#160; &#160; &#160;family=family,\r\n&#160; &#160; 148&#160; &#160; &#160; &#160; &#160;type=socket.SOCK_STREAM,\r\n&#160; &#160; 149&#160; &#160; &#160;)\r\n&#160; &#160; 150 except OSError as e:\r\n--&gt; 151&#160; &#160; &#160;raise ValueError(f&quot;Cannot resolve address {address}&quot;) from e\r\n&#160; &#160; 152 return _resolved_addresses_from_info(info, address._host_name)\r\n\r\nValueError: Cannot resolve address 53XXXe0e.databases.neo4j.io:7687\r\n```\r\n\r\nClearing DNS with `sudo resolvectl flush-caches`, did not help. At this point I am clueless what could be wrong.","link":"https://stackoverflow.com/questions/79462736/error-while-creating-neo4jgraph-object-using-langchain","title":"Error while creating Neo4jGraph object using langchain"},{"tags":["spring-boot","apache-kafka","neo4j","apache-kafka-connect","change-data-capture"],"answers":[{"comments":[{"owner":{"reputation":307,"user_id":5095483,"user_type":"registered","profile_image":"https://lh5.googleusercontent.com/-l-BsYcxP1P4/AAAAAAAAAAI/AAAAAAAAAAA/0mTR1q_kuS8/s256-rj/photo.jpg","display_name":"Deepa Dhanalakota","link":"https://stackoverflow.com/users/5095483/deepa-dhanalakota"},"edited":false,"score":0,"creation_date":1757627077,"post_id":79432547,"comment_id":140730408,"link":"https://stackoverflow.com/questions/79430021/how-to-ensure-neo4j-transaction-changes-are-sent-as-a-single-kafka-message-in-a/79432547#comment140730408_79432547"}],"tags":[],"owner":{"reputation":19,"user_id":13067165,"user_type":"registered","profile_image":"https://lh5.googleusercontent.com/-T7s9GgZwg9U/AAAAAAAAAAI/AAAAAAAAAAA/AKF05nAoSBy_gO1xbBnDWCN3dNcSIhdiQQ/s256-rj/photo.jpg","display_name":"Ali Ince","link":"https://stackoverflow.com/users/13067165/ali-ince"},"comment_count":1,"down_vote_count":0,"up_vote_count":1,"is_accepted":false,"score":1,"last_activity_date":1739352935,"creation_date":1739352935,"answer_id":79432547,"question_id":79430021,"share_link":"https://stackoverflow.com/a/79432547","body_markdown":"Unfortunately this is not supported. Neo4j Connector for Kafka publishes all change messages received from CDC in the same way that it publishes to target topic(s). Note that this is designed in this way since publishing all change events within a single message would cause several problems (such as hitting memory limits or message size limits), especially for large transactions.\r\n\r\nIf this is a must for you, what you already suggested might be the best option.\r\n\r\n","link":"https://stackoverflow.com/questions/79430021/how-to-ensure-neo4j-transaction-changes-are-sent-as-a-single-kafka-message-in-a/79432547#79432547","title":"How to ensure Neo4j transaction changes are sent as a single Kafka message in a Spring Boot application"}],"owner":{"reputation":189,"user_id":12736215,"user_type":"registered","profile_image":"https://lh6.googleusercontent.com/--LNpAExhsXI/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rcg6QBspjMyoR_TfnsiradALSZtSA/s256-rj/photo.jpg","display_name":"Sarthak Sharma","link":"https://stackoverflow.com/users/12736215/sarthak-sharma"},"last_editor":{"reputation":189,"user_id":12736215,"user_type":"registered","profile_image":"https://lh6.googleusercontent.com/--LNpAExhsXI/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rcg6QBspjMyoR_TfnsiradALSZtSA/s256-rj/photo.jpg","display_name":"Sarthak Sharma","link":"https://stackoverflow.com/users/12736215/sarthak-sharma"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":82,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":1,"score":1,"last_activity_date":1739352935,"creation_date":1739277991,"last_edit_date":1739278451,"question_id":79430021,"share_link":"https://stackoverflow.com/q/79430021","body_markdown":"I have a setup where I’m using a Neo4j source connector to propagate change events to a Kafka topic. My Spring Boot application consumes these messages. However, when a transaction in Neo4j involves multiple changes, the connector sends each change as a separate Kafka message (But having the same txId and a sequence number). I want all changes from a single transaction to be sent to my application as a single Kafka message so that I can process them together.\r\n\r\nSample message from kafka:\r\n```\r\n{\r\n  &quot;id&quot;: &quot;CJUg4WrNW0Y7ttlh8lbkxfwAAAAAAAAEMAAAAAAAAAACAAABkh21o5c=&quot;,\r\n  &quot;txId&quot;: 1072,\r\n  &quot;seq&quot;: 2,\r\n  &quot;event&quot;: {\r\n    &quot;elementId&quot;: &quot;4:9520e16a-cd5b-463b-b6d9-61f256e4c5fc:2073&quot;,\r\n    &quot;eventType&quot;: &quot;NODE&quot;,\r\n    &quot;operation&quot;: &quot;CREATE&quot;,\r\n    &quot;labels&quot;: [\r\n      &quot;Environment&quot;\r\n    ],\r\n    &quot;keys&quot;: {},\r\n    &quot;state&quot;: {\r\n      &quot;before&quot;: null,\r\n      &quot;after&quot;: {\r\n        &quot;labels&quot;: [\r\n          &quot;Environment&quot;\r\n        ],\r\n        &quot;properties&quot;: {\r\n          &quot;name&quot;: {\r\n            &quot;B&quot;: null,\r\n            &quot;I64&quot;: null,\r\n            &quot;F64&quot;: null,\r\n            &quot;S&quot;: &quot;Dev&quot;,\r\n            &quot;BA&quot;: null,\r\n            &quot;TLD&quot;: null,\r\n            &quot;TLDT&quot;: null,\r\n            &quot;TLT&quot;: null,\r\n            &quot;TZDT&quot;: null,\r\n            &quot;TOT&quot;: null,\r\n            &quot;TD&quot;: null,\r\n            &quot;SP&quot;: null,\r\n            &quot;LB&quot;: null,\r\n            &quot;LI64&quot;: null,\r\n            &quot;LF64&quot;: null,\r\n            &quot;LS&quot;: null,\r\n            &quot;LTLD&quot;: null,\r\n            &quot;LTLDT&quot;: null,\r\n            &quot;LTLT&quot;: null,\r\n            &quot;LZDT&quot;: null,\r\n            &quot;LTOT&quot;: null,\r\n            &quot;LTD&quot;: null,\r\n            &quot;LSP&quot;: null\r\n          },\r\n          &quot;id&quot;: {\r\n            &quot;B&quot;: null,\r\n            &quot;I64&quot;: null,\r\n            &quot;F64&quot;: null,\r\n            &quot;S&quot;: &quot;78b90e78-9b79-4330-9d02-7895f349964b&quot;,\r\n            &quot;BA&quot;: null,\r\n            &quot;TLD&quot;: null,\r\n            &quot;TLDT&quot;: null,\r\n            &quot;TLT&quot;: null,\r\n            &quot;TZDT&quot;: null,\r\n            &quot;TOT&quot;: null,\r\n            &quot;TD&quot;: null,\r\n            &quot;SP&quot;: null,\r\n            &quot;LB&quot;: null,\r\n            &quot;LI64&quot;: null,\r\n            &quot;LF64&quot;: null,\r\n            &quot;LS&quot;: null,\r\n            &quot;LTLD&quot;: null,\r\n            &quot;LTLDT&quot;: null,\r\n            &quot;LTLT&quot;: null,\r\n            &quot;LZDT&quot;: null,\r\n            &quot;LTOT&quot;: null,\r\n            &quot;LTD&quot;: null,\r\n            &quot;LSP&quot;: null\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n**Current Setup**\r\n\r\nMy neo4j server version is 5.22 and Kafka connect version is 5.1.1\r\n\r\nSpring Boot Application: Consumes messages from the Kafka topic and processes them.\r\n\r\n**Problem**\r\n\r\nWhen a Neo4j transaction involves multiple changes (e.g., creating multiple nodes or relationships), the connector sends each change as a separate Kafka message. This makes it difficult to process the changes as a single unit in my application.\r\n\r\n**Example Scenario**\r\n\r\n 1. A Neo4j transaction creates 3 nodes and 2 relationships.\r\n 2. The connector sends 5 separate Kafka messages (one for each change).\r\n 3. I want these 5 changes to be sent as a single Kafka message.\r\n\r\n**What I’ve Tried**\r\n\r\nI looked into the Neo4j connector configuration but couldn’t find a way to group changes by transaction.\r\n\r\nI considered aggregating messages in my Spring Boot application in an in-memory buffer, but this feels error-prone and complex.\r\n","link":"https://stackoverflow.com/questions/79430021/how-to-ensure-neo4j-transaction-changes-are-sent-as-a-single-kafka-message-in-a","title":"How to ensure Neo4j transaction changes are sent as a single Kafka message in a Spring Boot application"},{"tags":["neo4j","cypher"],"answers":[{"comments":[{"owner":{"reputation":30487,"user_id":92359,"user_type":"registered","accept_rate":94,"profile_image":"https://www.gravatar.com/avatar/664d3d4c50c731d90a32db5f9e01b4b9?s=256&d=identicon&r=PG","display_name":"InverseFalcon","link":"https://stackoverflow.com/users/92359/inversefalcon"},"edited":false,"score":1,"creation_date":1738951801,"post_id":79421789,"comment_id":140066502,"link":"https://stackoverflow.com/questions/79420874/neo4j-query-to-select-paths-but-then-filter-certain-nodes-and-relationships-from/79421789#comment140066502_79421789"},{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"reply_to_user":{"reputation":30487,"user_id":92359,"user_type":"registered","accept_rate":94,"profile_image":"https://www.gravatar.com/avatar/664d3d4c50c731d90a32db5f9e01b4b9?s=256&d=identicon&r=PG","display_name":"InverseFalcon","link":"https://stackoverflow.com/users/92359/inversefalcon"},"edited":false,"score":0,"creation_date":1738951917,"post_id":79421789,"comment_id":140066515,"link":"https://stackoverflow.com/questions/79420874/neo4j-query-to-select-paths-but-then-filter-certain-nodes-and-relationships-from/79421789#comment140066515_79421789"},{"owner":{"reputation":8438,"user_id":877942,"user_type":"registered","accept_rate":79,"profile_image":"https://i.sstatic.net/dlJeS.jpg?s=256","display_name":"Shades88","link":"https://stackoverflow.com/users/877942/shades88"},"edited":false,"score":0,"creation_date":1739110951,"post_id":79421789,"comment_id":140072589,"link":"https://stackoverflow.com/questions/79420874/neo4j-query-to-select-paths-but-then-filter-certain-nodes-and-relationships-from/79421789#comment140072589_79421789"},{"owner":{"reputation":8438,"user_id":877942,"user_type":"registered","accept_rate":79,"profile_image":"https://i.sstatic.net/dlJeS.jpg?s=256","display_name":"Shades88","link":"https://stackoverflow.com/users/877942/shades88"},"edited":false,"score":0,"creation_date":1739111840,"post_id":79421789,"comment_id":140072640,"link":"https://stackoverflow.com/questions/79420874/neo4j-query-to-select-paths-but-then-filter-certain-nodes-and-relationships-from/79421789#comment140072640_79421789"},{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1739158723,"post_id":79421789,"comment_id":140074684,"link":"https://stackoverflow.com/questions/79420874/neo4j-query-to-select-paths-but-then-filter-certain-nodes-and-relationships-from/79421789#comment140074684_79421789"}],"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":5,"down_vote_count":0,"up_vote_count":2,"is_accepted":false,"score":2,"last_activity_date":1739011566,"last_edit_date":1739011566,"creation_date":1738951655,"answer_id":79421789,"question_id":79420874,"share_link":"https://stackoverflow.com/a/79421789","body_markdown":" 1. Your graph illustration does not match your schema (which does not include `(:Table)--&gt;(:Step)` as a possibility). Please fix your question.\r\n\r\n 2. Your first query specifies a variable-length relationship pattern with a max length of 2, whereas your illustration has one outgoing path from the `Script` node of length 3. It is not clear if this is because you are not showing your actual query, or if you are seeing the effect of the Neo4j Browser&#39;s [Connect result nodes](https://neo4j.com/docs/browser-manual/current/operations/browser-settings/) option. In this answer, I will assume that the max length of 2 is correct.\r\n\r\n 3. In any case, your main issue is that that multiple flows use the same `Table` node. To fix this, you can add the `flowId` property to the `(:Table)--&gt;(:Step)` relationships, and then have your Cypher code check that property.\r\n\r\n    Once that property is added, this is an example of a query that might work for you. It assumes that the `(:Table)--&gt;(:Step)` relationship is named `FOO`:\r\n\r\n        MATCH (:Script {flowId: &#39;Userflow_040&#39;})-[r *..2]-&gt;(connected:!Script)\r\n        WHERE length(r) = 1 OR r[1]:!FOO OR r[1].flowId = &#39;Userflow_040&#39;\r\n        RETURN *\r\n\r\n    As pointed out by @InverseFalcon, your query did not specify that the starting node needs to have a `Script` label, since `(Script...)` was missing the colon before `Script`. My example has added the colon.\r\n\r\n    And you should consider using a [parameter](https://neo4j.com/docs/cypher-manual/current/syntax/parameters/) to provide the `flowId` value instead of hardcoding it.\r\n\r\n    By the way, `WHERE labels(connected)[0] &lt;&gt; &#39;Script&#39;` does not reliably check for the &#39;Script&#39; label, since in general nodes can have multiple labels. `WHERE NOT &#39;Script&#39; IN labels(connected)` would have been better. And even better would have been `WHERE NOT connected:Script`. But what I used in my example is the most succinct way, since you can state that you only want non-`Script` labels using a [label expression](https://neo4j.com/docs/cypher-manual/current/syntax/parameters/) like `(connected:!Script)` in the `MATCH` clause.\r\n\r\n    Notice that the example also uses the (not yet documented) relationship expression `r[1]:!FOO` in the `WHERE` clause. If that does not work for you, use `NOT r[1]:FOO` instead.","link":"https://stackoverflow.com/questions/79420874/neo4j-query-to-select-paths-but-then-filter-certain-nodes-and-relationships-from/79421789#79421789","title":"Neo4j query to select paths but then filter certain nodes and relationships from each path"}],"owner":{"reputation":8438,"user_id":877942,"user_type":"registered","accept_rate":79,"profile_image":"https://i.sstatic.net/dlJeS.jpg?s=256","display_name":"Shades88","link":"https://stackoverflow.com/users/877942/shades88"},"last_editor":{"reputation":8438,"user_id":877942,"user_type":"registered","accept_rate":79,"profile_image":"https://i.sstatic.net/dlJeS.jpg?s=256","display_name":"Shades88","link":"https://stackoverflow.com/users/877942/shades88"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":88,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1739111027,"creation_date":1738930928,"last_edit_date":1739111027,"question_id":79420874,"share_link":"https://stackoverflow.com/q/79420874","body_markdown":"I have schema like this\r\n\r\n```\r\nScript--HAS--&gt;Step\r\nScript--READS--&gt;Table\r\nStep--READS--&gt;Table\r\nStep--WRITES--&gt;Table\r\nTable--HAS--&gt;Attribute\r\n```\r\n\r\nNow I am trying to extract multi level paths from Neo4j like so.\r\n\r\n```\r\nMATCH (Script{flowId: &#39;Userflow_040&#39;})-[r *..2]-&gt;(connected) \r\nWHERE labels(connected)[0] &lt;&gt; &#39;Script&#39;\r\nRETURN *\r\n```\r\n\r\nThis returns me multiple 2nd level Step nodes which actually belong to a different flowId. Step nodes dont even have flowId as an attribute. They have stepId attribute which is flowId+.+stepNumber. Like `Userflow_040.1`.\r\n\r\nIn short I get output like so\r\n[![enter image description here][2]][2]\r\nThe red node belongs to some other Script. It just shares tables with another script. SO I dont want it in the output. \r\n\r\nI tried this query\r\n\r\n```\r\nMATCH (Script {flowId: &#39;Userflow_040&#39;})-[r*..2]-&gt;(connected)\r\nWHERE connected.node_type &lt;&gt; &#39;Script&#39; and (connected.stepId starts with &#39;Userflow_040&#39;) RETURN *\r\n```\r\n\r\nBut then this will give me only the steps and the script. I am unable to understand how to fix this. Please help. \r\n\r\n\r\n  [1]: https://i.sstatic.net/26iPejUM.png\r\n  [2]: https://i.sstatic.net/nSUKbONP.png","link":"https://stackoverflow.com/questions/79420874/neo4j-query-to-select-paths-but-then-filter-certain-nodes-and-relationships-from","title":"Neo4j query to select paths but then filter certain nodes and relationships from each path"},{"tags":["java","neo4j","spring-data-neo4j","neo4j-ogm"],"answers":[{"tags":[],"owner":{"reputation":71,"user_id":9397755,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/10f2b035856eef2b59c02267e3ee9e63?s=256&d=identicon&r=PG","display_name":"Jennifer Reif","link":"https://stackoverflow.com/users/9397755/jennifer-reif"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1749848733,"creation_date":1749848733,"answer_id":79665389,"question_id":79411726,"share_link":"https://stackoverflow.com/a/79665389","body_markdown":"Correct, you do not need to use an annotation for the class to get mapped....however, there could be performance implications since the class scanner won&#39;t pick up the class as a domain entity beforehand. Details are available in the documentation: https://docs.spring.io/spring-data/neo4j/docs/current-SNAPSHOT/reference/html/#mapping.annotations.","link":"https://stackoverflow.com/questions/79411726/how-to-map-neo4j-nodes-to-java-pojos-without-annotations-on-model-classes/79665389#79665389","title":"How to map Neo4j nodes to Java POJOs without annotations on model classes"}],"owner":{"reputation":437,"user_id":3706621,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/e607bb838d13f78ef736cde31f2d0ada?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Lukasz_Plawny","link":"https://stackoverflow.com/users/3706621/lukasz-plawny"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":61,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1749848733,"creation_date":1738672847,"question_id":79411726,"share_link":"https://stackoverflow.com/q/79411726","body_markdown":"I have a domain model that shouldn&#39;t be annotated with any database specific annotations (like `@Node` or `@Id`). I would like to use one of the following libraries to integrate with Neo4j database: spring-boot-starter-data-neo4j, neo4j-ogm, spring-data-neo4j.\r\n\r\nIs it possible to define entity mapping without annotating domain model with Neo4j specific annotations?","link":"https://stackoverflow.com/questions/79411726/how-to-map-neo4j-nodes-to-java-pojos-without-annotations-on-model-classes","title":"How to map Neo4j nodes to Java POJOs without annotations on model classes"},{"tags":["neo4j","spring-data-neo4j"],"answers":[{"comments":[{"owner":{"reputation":21,"user_id":938298,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/2ec954a637c4ff9fdc841f4ee30ab9bb?s=256&d=identicon&r=PG","display_name":"ankurbrdwj","link":"https://stackoverflow.com/users/938298/ankurbrdwj"},"edited":false,"score":0,"creation_date":1738356647,"post_id":79400294,"comment_id":140032701,"link":"https://stackoverflow.com/questions/79395304/cannot-fetch-child-entity-contains-in-spring-data-neo4j/79400294#comment140032701_79400294"}],"tags":[],"owner":{"reputation":8282,"user_id":2650436,"user_type":"registered","accept_rate":80,"profile_image":"https://www.gravatar.com/avatar/34ecacd077244d141a23c46ea094df5c?s=256&d=identicon&r=PG","display_name":"meistermeier","link":"https://stackoverflow.com/users/2650436/meistermeier"},"comment_count":1,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1738248983,"creation_date":1738248983,"answer_id":79400294,"question_id":79395304,"share_link":"https://stackoverflow.com/a/79400294","body_markdown":"The browser is &quot;lying&quot; to you. In the settings page, there is a option that is checked by default to connect your results:\r\n\r\n[![Neo4j Browser settings][1]][1]\r\n\r\nIn reality, your query does not return the relationships but only the `Dishes` and `Ingredients`. \r\n\r\nFor this to work in SDN, you would have to provide the relationships and alter your query into something like this\r\n\r\n```cypher\r\nMATCH (d:Dish)-[r:CONTAINS]-&gt;(i:Ingredient)\r\nWHERE i.nameInEnglish = &quot;Paneer&quot;\r\nRETURN d, collect(r), collect(i) as ingredients\r\n```\r\nOtherwise SDN cannot guess what it should do with the returned `Dish` and the `Ingredients`. It will not just connect them because they also could have been connected via another relationship type.\r\n\r\n  [1]: https://i.sstatic.net/JHLK6Q2C.png","link":"https://stackoverflow.com/questions/79395304/cannot-fetch-child-entity-contains-in-spring-data-neo4j/79400294#79400294","title":"Cannot fetch child entity (contains) in spring-data-neo4j"}],"owner":{"reputation":21,"user_id":938298,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/2ec954a637c4ff9fdc841f4ee30ab9bb?s=256&d=identicon&r=PG","display_name":"ankurbrdwj","link":"https://stackoverflow.com/users/938298/ankurbrdwj"},"last_editor":{"reputation":21,"user_id":938298,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/2ec954a637c4ff9fdc841f4ee30ab9bb?s=256&d=identicon&r=PG","display_name":"ankurbrdwj","link":"https://stackoverflow.com/users/938298/ankurbrdwj"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":37,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79400294,"answer_count":1,"score":0,"last_activity_date":1738355521,"creation_date":1738102768,"last_edit_date":1738355521,"question_id":79395304,"share_link":"https://stackoverflow.com/q/79395304","body_markdown":"Parent class\r\n```\r\n@Node\r\n@NoArgsConstructor\r\n@AllArgsConstructor\r\npublic class Dish {\r\n  @Id\r\n  private String dishName;\r\n  @Relationship(type = &quot;CONTAINS&quot;, direction = Relationship.Direction.OUTGOING)\r\n  private List&lt;Ingredient&gt; ingredients;\r\n  private String recipeUrl;\r\n  private String cuisine; // New field for cuisine\r\n  private String dishType; // New field for dish type\r\n\r\n  // Getters and Setters for all fields\r\n```\r\n\r\nChild class\r\n```@Node\r\n@Getter\r\n@Setter\r\npublic class Ingredient {\r\n  @Id\r\n  private String nameInEnglish;\r\n  private String nameInHindi;\r\n  private String nameInGerman;\r\n```\r\nmapping in neo4j\r\n```\r\nMATCH (d:Dish {dishName: &#39;Paneer Butter Masala&#39;}),\r\n      (i1:Ingredient {nameInEnglish: &#39;Paneer&#39;}),\r\n      (i2:Ingredient {nameInEnglish: &#39;Butter&#39;}),\r\n      (i3:Ingredient {nameInEnglish: &#39;Tomato&#39;})\r\nCREATE (d)-[:CONTAINS]-&gt;(i1),\r\n       (d)-[:CONTAINS]-&gt;(i2),\r\n       (d)-[:CONTAINS]-&gt;(i3);\r\n```\r\nneo4j browser returns one dish with one ingredient\r\n```\r\n    MATCH (d:Dish)-[:CONTAINS]-&gt;(i:Ingredient)\r\n    WHERE i.nameInEnglish = &quot;Paneer&quot;\r\n    RETURN d,collect(i) as ingredients\r\n```\r\n but Java response has 1 dish with an ingredient arraylist always empty in the IntelliJ debugger \r\n[![debugger][1]][1]\r\nusing query \r\n[![enter image description here][2]][2]\r\nbut the neo4j browser\r\n[![enter image description here][3]][3]\r\n\r\n\r\n  [1]: https://i.sstatic.net/mc1ruSDs.png\r\n  [2]: https://i.sstatic.net/EwYxpyZP.png\r\n  [3]: https://i.sstatic.net/mad9PADs.png","link":"https://stackoverflow.com/questions/79395304/cannot-fetch-child-entity-contains-in-spring-data-neo4j","title":"Cannot fetch child entity (contains) in spring-data-neo4j"},{"tags":["neo4j","quarkus","neo4j-ogm"],"answers":[{"tags":[],"owner":{"reputation":4940,"user_id":1547989,"user_type":"registered","profile_image":"https://i.sstatic.net/zjdcc.jpg?s=256","display_name":"Michael Simons","link":"https://stackoverflow.com/users/1547989/michael-simons"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1737988121,"creation_date":1737988121,"answer_id":79391140,"question_id":79390386,"share_link":"https://stackoverflow.com/a/79391140","body_markdown":"it seems that Quarkus or $something in the middle of the stack has (again) become much more eager when scanning things. I am the author of both [neo4j-ogm-quarkus][1] and [quarkus-neo4j][2] and will investigate this. In the meantime, please use `org.neo4j.ogm.base-packages` to configure the packages that OGM will take into account while scanning for annotated classes. i.e. \r\n\r\n```properties\r\norg.neo4j.ogm.base-packages=org.acme\r\n```\r\n\r\nwill fix this.\r\n\r\n\r\n  [1]: https://github.com/neo4j/neo4j-ogm-quarkus\r\n  [2]: https://github.com/quarkiverse/quarkus-neo4j","link":"https://stackoverflow.com/questions/79390386/new-quarkus-application-not-starting-with-neo4j-ogm-quarkus3-11-0/79391140#79391140","title":"New Quarkus application not starting with neo4j-ogm-quarkus:3.11.0"}],"owner":{"reputation":23,"user_id":5297187,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b02306c1579c7425a8985eaa5805be41?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Radu","link":"https://stackoverflow.com/users/5297187/radu"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":94,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79391140,"answer_count":1,"score":0,"last_activity_date":1737988121,"creation_date":1737972946,"question_id":79390386,"share_link":"https://stackoverflow.com/q/79390386","body_markdown":"I have generated a new quarkus project (v3.17.7) using gradle with kotlin and added the:\r\n\r\n`implementation(&quot;org.neo4j:neo4j-ogm-quarkus:3.11.0&quot;)` dependency.\r\n\r\nThe app doesn&#39;t start when the neo4j-ogm-quarkus dependency is present.\r\nI let quarkus build a neo4j db docker image for me, I also tried with my own neo4j db (v4.3.3 and v5.26.1).\r\nI also tried using quarkus (v3.17.3 and v3.15.3) and neo4j-ogm-quarkus:3.9.0.\r\n\r\nMy error looks like this:\r\n\r\n```\r\n2025-01-27 09:23:41,492 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application: java.lang.RuntimeException: Failed to start quarkus\r\n\tat io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)\r\n\tat io.quarkus.runtime.Application.start(Application.java:101)\r\n\tat io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:119)\r\n\tat io.quarkus.runtime.Quarkus.run(Quarkus.java:71)\r\n\tat io.quarkus.runtime.Quarkus.run(Quarkus.java:44)\r\n\tat io.quarkus.runtime.Quarkus.run(Quarkus.java:124)\r\n\tat io.quarkus.runner.GeneratedMain.main(Unknown Source)\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:569)\r\n\tat io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:116)\r\n\tat java.base/java.lang.Thread.run(Thread.java:840)\r\nCaused by: java.lang.NoClassDefFoundError: io/micrometer/context/ContextSnapshotFactory\r\n\tat java.base/java.lang.Class.getDeclaredFields0(Native Method)\r\n\tat java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3297)\r\n\tat java.base/java.lang.Class.getDeclaredFields(Class.java:2371)\r\n\tat org.neo4j.ogm.metadata.FieldsInfo.&lt;init&gt;(FieldsInfo.java:57)\r\n\tat org.neo4j.ogm.metadata.ClassInfo.&lt;init&gt;(ClassInfo.java:139)\r\n\tat org.neo4j.ogm.metadata.ClassInfo.&lt;init&gt;(ClassInfo.java:119)\r\n\tat org.neo4j.ogm.metadata.DomainInfo.lambda$addClass$2(DomainInfo.java:172)\r\n\tat java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220)\r\n\tat org.neo4j.ogm.metadata.DomainInfo.addClass(DomainInfo.java:172)\r\n\tat org.neo4j.ogm.metadata.DomainInfo.create(DomainInfo.java:98)\r\n\tat org.neo4j.ogm.metadata.MetaData.&lt;init&gt;(MetaData.java:66)\r\n\tat org.neo4j.ogm.session.SessionFactory.&lt;init&gt;(SessionFactory.java:124)\r\n\tat org.neo4j.ogm.session.SessionFactory.&lt;init&gt;(SessionFactory.java:110)\r\n\tat org.neo4j.ogm.quarkus.runtime.Neo4jOgmRecorder.initializeSessionFactory(Neo4jOgmRecorder.java:65)\r\n\tat io.quarkus.deployment.steps.Neo4jOgmProcessor$createSessionFactory1383093778.deploy_0(Unknown Source)\r\n\tat io.quarkus.deployment.steps.Neo4jOgmProcessor$createSessionFactory1383093778.deploy(Unknown Source)\r\n\t... 13 more\r\nCaused by: java.lang.ClassNotFoundException: io.micrometer.context.ContextSnapshotFactory\r\n\tat java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)\r\n\tat java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)\r\n\tat java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)\r\n\tat io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:565)\r\n\tat io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:513)\r\n\t... 29 more\r\n\r\n2025-01-27 09:23:41,492 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application: java.lang.RuntimeException: Failed to start quarkus\r\n\tat io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)\r\n\tat io.quarkus.runtime.Application.start(Application.java:101)\r\n\tat io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:119)\r\n\tat io.quarkus.runtime.Quarkus.run(Quarkus.java:71)\r\n\tat io.quarkus.runtime.Quarkus.run(Quarkus.java:44)\r\n\tat io.quarkus.runtime.Quarkus.run(Quarkus.java:124)\r\n\tat io.quarkus.runner.GeneratedMain.main(Unknown Source)\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:569)\r\n\tat io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:116)\r\n\tat java.base/java.lang.Thread.run(Thread.java:840)\r\nCaused by: java.lang.NoClassDefFoundError: io/micrometer/context/ContextSnapshotFactory\r\n\tat java.base/java.lang.Class.getDeclaredFields0(Native Method)\r\n\tat java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3297)\r\n\tat java.base/java.lang.Class.getDeclaredFields(Class.java:2371)\r\n\tat org.neo4j.ogm.metadata.FieldsInfo.&lt;init&gt;(FieldsInfo.java:57)\r\n\tat org.neo4j.ogm.metadata.ClassInfo.&lt;init&gt;(ClassInfo.java:139)\r\n\tat org.neo4j.ogm.metadata.ClassInfo.&lt;init&gt;(ClassInfo.java:119)\r\n\tat org.neo4j.ogm.metadata.DomainInfo.lambda$addClass$2(DomainInfo.java:172)\r\n\tat java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220)\r\n\tat org.neo4j.ogm.metadata.DomainInfo.addClass(DomainInfo.java:172)\r\n\tat org.neo4j.ogm.metadata.DomainInfo.create(DomainInfo.java:98)\r\n\tat org.neo4j.ogm.metadata.MetaData.&lt;init&gt;(MetaData.java:66)\r\n\tat org.neo4j.ogm.session.SessionFactory.&lt;init&gt;(SessionFactory.java:124)\r\n\tat org.neo4j.ogm.session.SessionFactory.&lt;init&gt;(SessionFactory.java:110)\r\n\tat org.neo4j.ogm.quarkus.runtime.Neo4jOgmRecorder.initializeSessionFactory(Neo4jOgmRecorder.java:65)\r\n\tat io.quarkus.deployment.steps.Neo4jOgmProcessor$createSessionFactory1383093778.deploy_0(Unknown Source)\r\n\tat io.quarkus.deployment.steps.Neo4jOgmProcessor$createSessionFactory1383093778.deploy(Unknown Source)\r\n\t... 13 more\r\nCaused by: java.lang.ClassNotFoundException: io.micrometer.context.ContextSnapshotFactory\r\n\tat java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)\r\n\tat java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)\r\n\tat java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)\r\n\tat io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:565)\r\n\tat io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:513)\r\n\t... 29 more\r\n```\r\n\r\nthe dependencies in my build.gradle.kts look like this:\r\n```\r\ndependencies {\r\n    implementation(enforcedPlatform(&quot;${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}&quot;))\r\n    implementation(&quot;io.quarkus:quarkus-arc&quot;)\r\n    implementation(&quot;io.quarkus:quarkus-rest&quot;)\r\n    implementation(&quot;io.quarkus:quarkus-config-yaml&quot;)\r\n    implementation(&quot;io.quarkus:quarkus-rest-jackson&quot;)\r\n    implementation(&quot;io.quarkus:quarkus-smallrye-health&quot;)\r\n\r\n    // Quarkus Neo4j Extension\r\n//    implementation(&quot;io.quarkiverse.neo4j:quarkus-neo4j:5.0.3&quot;)\r\n//    implementation(&quot;io.micrometer:context-propagation:1.1.2&quot;)\r\n//    implementation(&quot;org.conscrypt:conscrypt-openjdk:2.5.2&quot;)\r\n    implementation(&quot;org.neo4j:neo4j-ogm-quarkus:3.11.0&quot;)\r\n    // Lombok\r\n    compileOnly(&quot;org.projectlombok:lombok:1.18.36&quot;)\r\n    annotationProcessor(&quot;org.projectlombok:lombok:1.18.36&quot;)\r\n    // MapStruct\r\n    implementation(&quot;org.mapstruct:mapstruct:1.6.3&quot;)\r\n    annotationProcessor(&quot;org.mapstruct:mapstruct-processor:1.6.3&quot;)\r\n\r\n\r\n    // Test frameworks\r\n    testImplementation(&quot;io.quarkus:quarkus-junit5&quot;)\r\n    testImplementation(&quot;io.rest-assured:rest-assured&quot;)\r\n}\r\n```\r\n\r\nSteps to reproduce:\r\ngenerate a quarkus project and add neo4j-ogm-quarkus dependency.","link":"https://stackoverflow.com/questions/79390386/new-quarkus-application-not-starting-with-neo4j-ogm-quarkus3-11-0","title":"New Quarkus application not starting with neo4j-ogm-quarkus:3.11.0"},{"tags":["powershell","neo4j"],"comments":[{"owner":{"reputation":66809,"user_id":15339544,"user_type":"registered","profile_image":"https://i.sstatic.net/F0aQdYPV.jpg?s=256","display_name":"Santiago Squarzon","link":"https://stackoverflow.com/users/15339544/santiago-squarzon"},"edited":false,"score":0,"creation_date":1737947861,"post_id":79389666,"comment_id":140004917,"link":"https://stackoverflow.com/questions/79389666/use-wildcard-characters-with-neo4j-admin#comment140004917_79389666"}],"answers":[{"comments":[{"owner":{"reputation":3438,"user_id":947889,"user_type":"registered","accept_rate":88,"profile_image":"https://i.sstatic.net/OEJez.jpg?s=256","display_name":"Dr. Strangelove","link":"https://stackoverflow.com/users/947889/dr-strangelove"},"edited":false,"score":0,"creation_date":1738023136,"post_id":79390393,"comment_id":140010243,"link":"https://stackoverflow.com/questions/79389666/use-wildcard-characters-with-neo4j-admin/79390393#comment140010243_79390393"}],"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":1,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1737973109,"creation_date":1737973109,"answer_id":79390393,"question_id":79389666,"share_link":"https://stackoverflow.com/a/79390393","body_markdown":"For filenames, `neo4j-admin` accepts regular expressions, not globbing. See the docs [here][1].\r\n\r\nFor your case, that would be:\r\n```\r\n.\\bin\\neo4j-admin.ps1 database import full --overwrite-destination neo4j \r\n--nodes=&quot;import\\node1.txt&quot; \r\n--nodes=&quot;import\\node2.txt&quot; \r\n--relationships=&quot;import/edge.*txt&quot;\r\n--delimiter &quot;\\t&quot;\r\n```\r\n\r\n\r\n  [1]: https://neo4j.com/docs/operations-manual/current/tutorial/neo4j-admin-import/#_multiple_input_files","link":"https://stackoverflow.com/questions/79389666/use-wildcard-characters-with-neo4j-admin/79390393#79390393","title":"Use wildcard characters with Neo4j admin"}],"owner":{"reputation":3438,"user_id":947889,"user_type":"registered","accept_rate":88,"profile_image":"https://i.sstatic.net/OEJez.jpg?s=256","display_name":"Dr. Strangelove","link":"https://stackoverflow.com/users/947889/dr-strangelove"},"last_editor":{"reputation":3438,"user_id":947889,"user_type":"registered","accept_rate":88,"profile_image":"https://i.sstatic.net/OEJez.jpg?s=256","display_name":"Dr. Strangelove","link":"https://stackoverflow.com/users/947889/dr-strangelove"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":63,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"accepted_answer_id":79390393,"answer_count":1,"score":1,"last_activity_date":1738023650,"creation_date":1737946536,"last_edit_date":1738023650,"question_id":79389666,"share_link":"https://stackoverflow.com/q/79389666","body_markdown":"Does `neo4j-admin` support use of wildcard characters in filenames? \r\n\r\nThe following works just fine: \r\n\r\n```\r\n.\\bin\\neo4j-admin.ps1 database import full --overwrite-destination neo4j \r\n--nodes=&quot;import\\node1.txt&quot; \r\n--nodes=&quot;import\\node2.txt&quot; \r\n--relationships=&quot;import/edge1.txt&quot;\r\n--relationships=&quot;import/edge2.txt&quot;\r\n--delimiter &quot;\\t&quot;\r\n```\r\n\r\nBut the following does not:\r\n```\r\n.\\bin\\neo4j-admin.ps1 database import full --overwrite-destination neo4j \r\n--nodes=&quot;import\\node1.txt&quot; \r\n--nodes=&quot;import\\node2.txt&quot; \r\n--relationships=&quot;import/edge*.txt&quot;\r\n--delimiter &quot;\\t&quot;\r\n```\r\n\r\n&gt; java.lang.IllegalArgumentException: File &#39;./import/edge*.txt&#39; doesn&#39;t exist\r\n\r\nI tried all combinations of single-quote instead of double-quote, without quotes, and forward slash instead of backward. All unsuccessful. \r\n\r\n```\r\n.\\bin\\neo4j-admin.ps1 --version\r\n5.26.0\r\n```\r\n\r\n---\r\n\r\n## Update 1\r\n\r\nFollowing the suggestion in [this answer](https://stackoverflow.com/a/79390393/947889), I get weird behavior when referencing multiple files using regex.\r\n\r\nConsider these files: \r\n\r\n```\r\n&gt; cat .\\import\\node1.txt\r\nPersonID:ID(Person)     Name:string     :LABEL\r\na1      name1   N\r\na2      name2   N\r\n&gt; cat .\\import\\node2.txt\r\nPersonID:ID(Person)     Name:string     :LABEL\r\na3      name3   N\r\na4      name4   N\r\n&gt; cat .\\import\\edge1.txt\r\n:START_ID(Person)       :END_ID(Person) :TYPE\r\na1      a3      t\r\na1      a2      t\r\n&gt; cat .\\import\\edge2.txt\r\n:START_ID(Person)       :END_ID(Person) :TYPE\r\na3      a4      t\r\na1      a1      t\r\n```\r\n\r\nWhen referencing each file separately as the following, the import works with no issue:\r\n\r\n```\r\n.\\bin\\neo4j-admin.ps1 database import full --overwrite-destination neo4j --nodes=&quot;import\\node1.txt&quot; --nodes=&quot;import\\node2.txt&quot; --relationships=import\\edge1.txt --relationships=import\\edge2.txt --delimiter &quot;\\t&quot; --array-delimiter &quot;;&quot; --verbose\r\n```\r\n\r\nBut it fails when you specify edges via regex as in the following.\r\n\r\n```\r\n.\\bin\\neo4j-admin.ps1 database import full --overwrite-destination neo4j --nodes=&quot;import\\node1.txt&quot; --nodes=&quot;import\\node2.txt&quot; --relationships=&#39;./import/edge.*txt&#39; --delimiter &quot;\\t&quot; --array-delimiter &quot;;&quot; --verbose\r\n```\r\n\r\n&gt; Caused by: org.neo4j.importer.FileImporter$CsvImportException: java.io.IOException: java.util.concurrent.ExecutionException: org.neo4j.internal.batchimport.input.InputException: ERROR in input\r\n  data source: BufferedCharSeeker[source:...1fda5dc62ead\\.\\import\\edge2.txt, position:41, line:1]\r\n  in field: :TYPE:3\r\n  for header: [:START_ID(Person), :END_ID(Person), :TYPE]\r\n  raw field value: :TYPE\r\n  original error: :START_ID(Person) (Person)-[:TYPE]-&gt;:END_ID(Person) (Person) referring to missing node :TYPE\r\n\r\n\r\nThe above command works fine if I remove the header line from the second edges file (the same does not apply to nodes!!). This behavior is very confusing, since you would also need to account for the order of files regex will take in the input.  \r\n\r\n\r\n","link":"https://stackoverflow.com/questions/79389666/use-wildcard-characters-with-neo4j-admin","title":"Use wildcard characters with Neo4j admin"},{"tags":["neo4j","cypher"],"comments":[{"owner":{"reputation":293,"user_id":1405305,"user_type":"registered","profile_image":"https://i.sstatic.net/2mDfK.jpg?s=256","display_name":"norihide.shimatani","link":"https://stackoverflow.com/users/1405305/norihide-shimatani"},"reply_to_user":{"reputation":123876,"user_id":3001761,"user_type":"registered","profile_image":"https://i.sstatic.net/feZwC.jpg?s=256","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"edited":false,"score":0,"creation_date":1737794316,"post_id":79386360,"comment_id":139998773,"link":"https://stackoverflow.com/questions/79386360/difference-between-not-v-in-a-b-and-va-and-vb#comment139998773_79386360"},{"owner":{"reputation":123876,"user_id":3001761,"user_type":"registered","profile_image":"https://i.sstatic.net/feZwC.jpg?s=256","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"edited":false,"score":0,"creation_date":1737794358,"post_id":79386360,"comment_id":139998777,"link":"https://stackoverflow.com/questions/79386360/difference-between-not-v-in-a-b-and-va-and-vb#comment139998777_79386360"},{"owner":{"reputation":293,"user_id":1405305,"user_type":"registered","profile_image":"https://i.sstatic.net/2mDfK.jpg?s=256","display_name":"norihide.shimatani","link":"https://stackoverflow.com/users/1405305/norihide-shimatani"},"reply_to_user":{"reputation":123876,"user_id":3001761,"user_type":"registered","profile_image":"https://i.sstatic.net/feZwC.jpg?s=256","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"edited":false,"score":0,"creation_date":1737795636,"post_id":79386360,"comment_id":139998823,"link":"https://stackoverflow.com/questions/79386360/difference-between-not-v-in-a-b-and-va-and-vb#comment139998823_79386360"},{"owner":{"reputation":123876,"user_id":3001761,"user_type":"registered","profile_image":"https://i.sstatic.net/feZwC.jpg?s=256","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"edited":false,"score":0,"creation_date":1737795956,"post_id":79386360,"comment_id":139998837,"link":"https://stackoverflow.com/questions/79386360/difference-between-not-v-in-a-b-and-va-and-vb#comment139998837_79386360"},{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"edited":false,"score":0,"creation_date":1737978588,"post_id":79386360,"comment_id":140006634,"link":"https://stackoverflow.com/questions/79386360/difference-between-not-v-in-a-b-and-va-and-vb#comment140006634_79386360"}],"answers":[{"tags":[],"owner":{"reputation":386,"user_id":21624328,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AGNmyxZzl1uvGNT2Zj90oWIgnDozeOoiJzA7-rJgem4f=k-s256","display_name":"Christoffer Bergman","link":"https://stackoverflow.com/users/21624328/christoffer-bergman"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1737971769,"creation_date":1737971769,"answer_id":79390325,"question_id":79386360,"share_link":"https://stackoverflow.com/a/79390325","body_markdown":"First of all, thank you for including a query with test data to reproduce the issue, that is very helpful.\r\n\r\nThis seems to be a bug, those two (`NOT t.id IN [1,3]` and `t.id &lt;&gt; 1 AND t.id &lt;&gt; 3`) should result in the same thing. This is being investigated by the engineering team. I will post here when I hear something more.","link":"https://stackoverflow.com/questions/79386360/difference-between-not-v-in-a-b-and-va-and-vb/79390325#79390325","title":"Difference between &quot;NOT v IN [a,b]&quot; and &quot;v&lt;&gt;a AND v&lt;&gt;b&quot;"},{"tags":[],"owner":{"reputation":386,"user_id":21624328,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AGNmyxZzl1uvGNT2Zj90oWIgnDozeOoiJzA7-rJgem4f=k-s256","display_name":"Christoffer Bergman","link":"https://stackoverflow.com/users/21624328/christoffer-bergman"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1743151673,"creation_date":1743151673,"answer_id":79540929,"question_id":79386360,"share_link":"https://stackoverflow.com/a/79540929","body_markdown":"This bug has now been fixed and released. It is included in Neo4j version 2025.03.0, which is available for download from the deployment center (https://neo4j.com/deployment-center/), and it is also the current version on Aura (https://console.neo4j.io/).","link":"https://stackoverflow.com/questions/79386360/difference-between-not-v-in-a-b-and-va-and-vb/79540929#79540929","title":"Difference between &quot;NOT v IN [a,b]&quot; and &quot;v&lt;&gt;a AND v&lt;&gt;b&quot;"}],"owner":{"reputation":293,"user_id":1405305,"user_type":"registered","profile_image":"https://i.sstatic.net/2mDfK.jpg?s=256","display_name":"norihide.shimatani","link":"https://stackoverflow.com/users/1405305/norihide-shimatani"},"last_editor":{"reputation":123876,"user_id":3001761,"user_type":"registered","profile_image":"https://i.sstatic.net/feZwC.jpg?s=256","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"comment_count":5,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":111,"favorite_count":0,"down_vote_count":0,"up_vote_count":3,"accepted_answer_id":79540929,"answer_count":2,"score":3,"last_activity_date":1743151673,"creation_date":1737791256,"last_edit_date":1737795835,"question_id":79386360,"share_link":"https://stackoverflow.com/q/79386360","body_markdown":"\r\nIn Neo4j 5.26, the results of query 1 and 2 are different. Why is this?\r\nThe only difference between 1 and 2 is `AND ((t.id &lt;&gt; 1 AND t.id &lt;&gt; 3)` and `AND (NOT t.id IN [1,3])`, which should be semantically the same.\r\n\r\n1. Query 1\r\n\r\n    ```\r\n    MATCH(b:Bottom)\r\n    OPTIONAL MATCH(b:Bottom)&lt;-[:BOTTOM]-(m:Middle)\r\n    OPTIONAL MATCH(m:Middle)&lt;-[:MIDDLE]-(t:Top)\r\n    WITH DISTINCT b, m, t\r\n    WHERE (\r\n    \tm.id IN [21,22,31]\r\n    \tAND (NOT m.id IN [22,32])\r\n    \tAND (t.id &lt;&gt; 1 AND t.id &lt;&gt; 3)   // only this line differs \r\n    )\r\n    RETURN LABELS(t)[0], t.id, LABELS(m)[0], m.id, LABELS(b)[0], b.id;\r\n    ```\r\n \r\n\r\n    Result:\r\n    \r\n    ```\r\n    LABELS(t)[0]\tt.id\tLABELS(m)[0]\tm.id\tLABELS(b)[0]\tb.id\r\n    &quot;Top&quot;\t2\t&quot;Middle&quot;\t21\t&quot;Bottom&quot;\t211\r\n    &quot;Top&quot;\t2\t&quot;Middle&quot;\t21\t&quot;Bottom&quot;\t212\r\n    ```\r\n\r\n2. Query 2\r\n    ```\r\n    MATCH(b:Bottom)\r\n    OPTIONAL MATCH(b:Bottom)&lt;-[:BOTTOM]-(m:Middle)\r\n    OPTIONAL MATCH(m:Middle)&lt;-[:MIDDLE]-(t:Top)\r\n    WITH DISTINCT b, m, t\r\n    WHERE (\r\n    \tm.id IN [21,22,31]\r\n    \tAND (NOT m.id IN [22,32])\r\n    \tAND (NOT t.id IN [1,3])         // only this line differs \r\n    )\r\n    RETURN LABELS(t)[0], t.id, LABELS(m)[0], m.id, LABELS(b)[0], b.id;\r\n    ```\r\n    Result:\r\n    ```\r\n    (no changes, no records)\r\n    ```\r\n\r\nYou can create test data with the following Cypher statement:\r\n\r\n\r\n    WITH\r\n    \tRANGE(1,4) AS tops,\r\n    \tRANGE(1,3) AS middles,\r\n    \tRANGE(1,2) AS bottoms\r\n    FOREACH (top IN tops | \r\n    \tMERGE (t:Top{id:top})\r\n    \tFOREACH (middle IN middles | \r\n    \t\tCREATE (m:Middle{id:top*10 + middle})\r\n    \t\tMERGE (t)-[:MIDDLE]-&gt;(m)\r\n    \t\tFOREACH (bottom IN bottoms |\r\n    \t\t\tCREATE (b:Bottom{id:top*100 + middle*10 + bottom})\r\n    \t\t\tMERGE (m)-[:BOTTOM]-&gt;(b)\r\n    \t\t)\r\n    \t)\r\n    );\r\n\r\nDisplaying test data:\r\n\r\n    MATCH(t:Top)-[r1]-(m:Middle)-[r2]-(b:Bottom)\r\n    RETURN *;\r\n\r\nDeleting test data:\r\n\r\n    MATCH(n) WHERE (n:Top OR n:Middle OR n:Bottom)\r\n    DETACH DELETE n\r\n    RETURN n;","link":"https://stackoverflow.com/questions/79386360/difference-between-not-v-in-a-b-and-va-and-vb","title":"Difference between &quot;NOT v IN [a,b]&quot; and &quot;v&lt;&gt;a AND v&lt;&gt;b&quot;"},{"tags":["neo4j","cypher"],"comments":[{"owner":{"reputation":9115,"user_id":277128,"user_type":"registered","accept_rate":79,"profile_image":"https://www.gravatar.com/avatar/f06979a03b9b522c80cb12def209c31a?s=256&d=identicon&r=PG","display_name":"fbiville","link":"https://stackoverflow.com/users/277128/fbiville"},"edited":false,"score":1,"creation_date":1737714715,"post_id":79383573,"comment_id":139994285,"link":"https://stackoverflow.com/questions/79383573/why-do-neo4j-queries-return-different-results-with-semantically-equal-conditions#comment139994285_79383573"},{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"edited":false,"score":1,"creation_date":1737735196,"post_id":79383573,"comment_id":139996056,"link":"https://stackoverflow.com/questions/79383573/why-do-neo4j-queries-return-different-results-with-semantically-equal-conditions#comment139996056_79383573"},{"owner":{"reputation":293,"user_id":1405305,"user_type":"registered","profile_image":"https://i.sstatic.net/2mDfK.jpg?s=256","display_name":"norihide.shimatani","link":"https://stackoverflow.com/users/1405305/norihide-shimatani"},"reply_to_user":{"reputation":9115,"user_id":277128,"user_type":"registered","accept_rate":79,"profile_image":"https://www.gravatar.com/avatar/f06979a03b9b522c80cb12def209c31a?s=256&d=identicon&r=PG","display_name":"fbiville","link":"https://stackoverflow.com/users/277128/fbiville"},"edited":false,"score":0,"creation_date":1737783031,"post_id":79383573,"comment_id":139998477,"link":"https://stackoverflow.com/questions/79383573/why-do-neo4j-queries-return-different-results-with-semantically-equal-conditions#comment139998477_79383573"},{"owner":{"reputation":293,"user_id":1405305,"user_type":"registered","profile_image":"https://i.sstatic.net/2mDfK.jpg?s=256","display_name":"norihide.shimatani","link":"https://stackoverflow.com/users/1405305/norihide-shimatani"},"reply_to_user":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"edited":false,"score":0,"creation_date":1737783050,"post_id":79383573,"comment_id":139998478,"link":"https://stackoverflow.com/questions/79383573/why-do-neo4j-queries-return-different-results-with-semantically-equal-conditions#comment139998478_79383573"}],"owner":{"reputation":293,"user_id":1405305,"user_type":"registered","profile_image":"https://i.sstatic.net/2mDfK.jpg?s=256","display_name":"norihide.shimatani","link":"https://stackoverflow.com/users/1405305/norihide-shimatani"},"last_editor":{"reputation":123876,"user_id":3001761,"user_type":"registered","profile_image":"https://i.sstatic.net/feZwC.jpg?s=256","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"comment_count":4,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":44,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":0,"score":1,"last_activity_date":1737796210,"creation_date":1737704266,"last_edit_date":1737796210,"question_id":79383573,"share_link":"https://stackoverflow.com/q/79383573","body_markdown":"In Neo4j version 3.5, the results of query 1 and 2 are different. Why is this?\r\nThe only difference between 1 and 2 is `AND (t.id &lt;&gt; 3)` and `AND (NOT t.id = 3)`, which should be semantically the same.\r\n\r\n1. Query 1\r\n    ```\r\n    MATCH(b:Bottom)\r\n    OPTIONAL MATCH(b:Bottom)&lt;-[:BOTTOM]-(m:Middle)\r\n    OPTIONAL MATCH(m:Middle)&lt;-[:MIDDLE]-(t:Top)\r\n    WITH DISTINCT b, m, t\r\n    WHERE (\r\n    \tm.id IN [21,22,31]\r\n    \tAND (NOT m.id IN [22,32])\r\n    \tAND (t.id &lt;&gt; 3)          // only this line differs \r\n    )\r\n    RETURN LABELS(t)[0], t.id, LABELS(m)[0], m.id, LABELS(b)[0], b.id;\r\n    ```\r\n    Result:\r\n    ```\r\n    LABELS(t)[0]\tt.id\tLABELS(m)[0]\tm.id\tLABELS(b)[0]\tb.id\r\n    &quot;Top&quot;\t2\t&quot;Middle&quot;\t21\t&quot;Bottom&quot;\t211\r\n    &quot;Top&quot;\t2\t&quot;Middle&quot;\t21\t&quot;Bottom&quot;\t212\r\n    ```\r\n\r\n2. Query 2\r\n    ```\r\n    MATCH(b:Bottom)\r\n    OPTIONAL MATCH(b:Bottom)&lt;-[:BOTTOM]-(m:Middle)\r\n    OPTIONAL MATCH(m:Middle)&lt;-[:MIDDLE]-(t:Top)\r\n    WITH DISTINCT b, m, t\r\n    WHERE (\r\n    \tm.id IN [21,22,31]\r\n    \tAND (NOT m.id IN [22,32])\r\n    \tAND (NOT t.id = 3)          // only this line differs \r\n    )\r\n    RETURN LABELS(t)[0], t.id, LABELS(m)[0], m.id, LABELS(b)[0], b.id;\r\n    ```\r\n    Result:\r\n    ```\r\n    (no changes, no records)\r\n    ```\r\n\r\n\r\nYou can create test data with the following Cypher statement:\r\n\r\n    WITH\r\n    \tRANGE(1,4) AS tops,\r\n    \tRANGE(1,3) AS middles,\r\n    \tRANGE(1,2) AS bottoms\r\n    FOREACH (top IN tops | \r\n    \tMERGE (t:Top{id:top})\r\n    \tFOREACH (middle IN middles | \r\n    \t\tCREATE (m:Middle{id:top*10 + middle})\r\n    \t\tMERGE (t)-[:MIDDLE]-&gt;(m)\r\n    \t\tFOREACH (bottom IN bottoms |\r\n    \t\t\tCREATE (b:Bottom{id:top*100 + middle*10 + bottom})\r\n    \t\t\tMERGE (m)-[:BOTTOM]-&gt;(b)\r\n    \t\t)\r\n    \t)\r\n    );\r\n\r\nDisplaying test data:\r\n\r\n    MATCH(n) WHERE (n:Top OR n:Middle OR n:Bottom)\r\n    RETURN n;\r\n\r\nDeleting test data:\r\n\r\n    MATCH(n) WHERE (n:Top OR n:Middle OR n:Bottom)\r\n    DETACH DELETE n\r\n    RETURN n;","link":"https://stackoverflow.com/questions/79383573/why-do-neo4j-queries-return-different-results-with-semantically-equal-conditions","title":"Why do Neo4j queries return different results with semantically equal conditions?"},{"tags":["neo4j","cypher","relationship","neo4j-apoc","apoc"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1737659540,"last_edit_date":1737659540,"creation_date":1737653868,"answer_id":79382068,"question_id":79378953,"share_link":"https://stackoverflow.com/a/79382068","body_markdown":"This query may do what you want:\r\n\r\n    WITH source, candidates, exits, typesFilter\r\n    // Use APOC path expansion\r\n    CALL apoc.path.expandConfig(source, {\r\n        labelFilter: &#39;+Object|SubObject&#39;,\r\n        relationshipFilter: typesFilter,\r\n        terminatorNodes: exits,\r\n        whitelistNodes: candidates,\r\n        bfs: FALSE,\r\n        uniqueness: &quot;NODE_GLOBAL&quot;\r\n    }) YIELD path\r\n    WHERE ALL(r IN RELATIONSHIPS(path) WHERE r.NotValid IS NULL)\r\n    RETURN relationships(path) AS validRelationships, nodes(path)\r\n\r\nIt inserts a `WHERE` clause to filter for the desired the paths, simplifies the calculation of `validRelationships` (which you may want to rename as just `relationships`, since after filtering all relationships would be valid), and also eliminates the unnecessary `WITH` clause.","link":"https://stackoverflow.com/questions/79378953/neo4j-query-to-filter-out-paths-with-specific-relationship-property-using-apoc-p/79382068#79382068","title":"Neo4j query to filter out paths with specific relationship property using apoc.path.expandConfig"},{"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"last_editor":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":0,"down_vote_count":0,"up_vote_count":2,"is_accepted":false,"score":2,"last_activity_date":1737675590,"last_edit_date":1737675590,"creation_date":1737669672,"answer_id":79382693,"question_id":79378953,"share_link":"https://stackoverflow.com/a/79382693","body_markdown":"Using the uniqueness setting of `NODE_GLOBAL` in `apoc.path.expandConfig` means it will return at most one path for a given `exits` node. If you put a filter after the call, it may remove paths to `exits` nodes even though there exist valid paths to those nodes.\r\n\r\nTo illustrate, take this example:\r\n\r\n[![small graph from source to exit nodes][1]][1] \r\n\r\nThe following is an approximation of your query for this graph, minus a filter:\r\n```lang-cypher\r\nWITH COLLECT { MATCH (t:SubObject) RETURN t } AS exits,\r\n     COLLECT { MATCH (i:Object) RETURN i } AS candidates\r\nMATCH (source:A)\r\nCALL apoc.path.expandConfig(source, {\r\n    labelFilter: &quot;Object|SubObject&quot;,\r\n    terminatorNodes: exits,\r\n    whitelistNodes: candidates,\r\n    uniqueness: &quot;NODE_GLOBAL&quot;,\r\n    bfs: false\r\n}) YIELD path\r\nRETURN path\r\n```\r\nResult:\r\n```\r\n╒═══════════════════════════════════════════════════════════════════════════╕\r\n│path                                                                       │\r\n╞═══════════════════════════════════════════════════════════════════════════╡\r\n│(:A)-[:R {NotValid: false}]-&gt;(:Object)-[:R {NotValid: false}]-&gt;(:SubObject)│\r\n├───────────────────────────────────────────────────────────────────────────┤\r\n│(:A)-[:R {NotValid: false}]-&gt;(:Object)-[:R {NotValid: true}]-&gt;(:SubObject) │\r\n└───────────────────────────────────────────────────────────────────────────┘\r\n```\r\nBut if we add this filter between the apoc call and `RETURN`:\r\n```lang-cypher\r\n WITH path WHERE ALL(r IN relationships(path) WHERE NOT r.NotValid)\r\n```\r\nWe lose one of the paths, even though we can see from the graph that a valid path exists:\r\n```\r\n╒═══════════════════════════════════════════════════════════════════════════╕\r\n│path                                                                       │\r\n╞═══════════════════════════════════════════════════════════════════════════╡\r\n│(:A)-[:R {NotValid: false}]-&gt;(:Object)-[:R {NotValid: false}]-&gt;(:SubObject)│\r\n└───────────────────────────────────────────────────────────────────────────┘\r\n```\r\nChanging the `bfs` setting will not avoid the situation (and in my example, you will see it returns no paths with the filter).\r\n\r\nIt is better to use something like `SHORTEST`, which ensures that you get at least one path to each `exits` node, if a path exists:\r\n\r\n```lang-cypher\r\nMATCH path = ANY (source)\r\n  ( (m WHERE NOT m IN exits)-[r:$(typesFilter) WHERE NOT r.NotValid]-&gt;\r\n    (n:SubObject|Object WHERE n IN candidates + exits) )+ (e WHERE e IN exits)\r\nRETURN path\r\n```\r\n\r\nSHORTEST was introduced in 5.21 (see the [docs][2]). The query also uses dynamic labels, introduced in 5.26 (see [this blog][3]).\r\n\r\n\r\n  [1]: https://i.sstatic.net/LhyyIZfdl.png\r\n  [2]: https://neo4j.com/docs/cypher-manual/current/patterns/shortest-paths/?utm_source=GSearch&amp;utm_medium=PaidSearch&amp;utm_campaign=Evergreen&amp;utm_content=EMEA-Search-SEMCE-DSA-None-SEM-SEM-NonABM&amp;utm_term=&amp;utm_adgroup=DSA&amp;gad_source=1&amp;gclid=Cj0KCQiA7se8BhCAARIsAKnF3rzkub9aeoF5ATTtF2RtGD_H1fv3dZyd7pIQr1Sk4jQkxd_pdodEcRQaAt2BEALw_wcB\r\n  [3]: https://neo4j.com/developer-blog/cypher-dynamism/","link":"https://stackoverflow.com/questions/79378953/neo4j-query-to-filter-out-paths-with-specific-relationship-property-using-apoc-p/79382693#79382693","title":"Neo4j query to filter out paths with specific relationship property using apoc.path.expandConfig"}],"owner":{"reputation":392,"user_id":9569180,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/dc0d204273a6b029712f688b25f213b9?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Rohit Sharma","link":"https://stackoverflow.com/users/9569180/rohit-sharma"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":162,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":2,"score":0,"last_activity_date":1737675590,"creation_date":1737572845,"question_id":79378953,"share_link":"https://stackoverflow.com/q/79378953","body_markdown":"I have a use case where I want to filter the paths retrieved from `apoc.path.expandConfig` based on a relationship property. Below is my current query:  \r\n\r\n```cypher\r\nWITH source, candidates, exits, typesFilter\r\n// Use APOC path expansion\r\nCALL apoc.path.expandConfig(source, {\r\n    labelFilter: &#39;+Object|SubObject&#39;,\r\n    relationshipFilter: typesFilter,\r\n    terminatorNodes: exits,\r\n    whitelistNodes: candidates,\r\n    bfs: FALSE,\r\n    uniqueness: &quot;NODE_GLOBAL&quot;\r\n}) YIELD path\r\nWITH path, [r IN relationships(path) WHERE r.NotValid IS NULL] AS validRelationships\r\nRETURN validRelationships, nodes(path)\r\n```  \r\n\r\nIn this query, I want to filter out any paths where at least one relationship has the property `NotValid = true`.  \r\n\r\nFor example, consider the following graph:  \r\n\r\n```\r\n(a)-[r1]-&gt;(b)-[r2]-&gt;(c)-[r3]-&gt;(d)\r\n(a)-[r4]-&gt;(e)-[r5]-&gt;(f)\r\n```  \r\n\r\nHere:  \r\n- `d` and `f` are the exit nodes  \r\n- `a` is the source node  \r\n\r\nIf `r4` has the property `NotValid = true`, the second path should be excluded.  \r\n\r\nHow can I modify my query so that it only includes paths where all relationships have `NotValid IS NULL`?  ","link":"https://stackoverflow.com/questions/79378953/neo4j-query-to-filter-out-paths-with-specific-relationship-property-using-apoc-p","title":"Neo4j query to filter out paths with specific relationship property using apoc.path.expandConfig"},{"tags":["python","neo4j","cypher","ontology","graphrag"],"owner":{"reputation":11,"user_id":29196742,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/189c0873eb4817d15504b3446507ece4?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"mdz022","link":"https://stackoverflow.com/users/29196742/mdz022"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":101,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":0,"score":1,"last_activity_date":1737185092,"creation_date":1737185092,"question_id":79366711,"share_link":"https://stackoverflow.com/q/79366711","body_markdown":"I am working on a RAG Streamlit application that uploads an ontology file (RDF format), parses it using Owlready2, and populates a Neo4j graph database. The goal is to extract classes, object properties (relationships), and data properties (attributes) from the ontology to create nodes with detailed properties and relationships. After that you can chat with the data of the ontology\r\n\r\nThings i have done:\r\n\r\n1. Parsed classes and object properties using ontology.classes() and ontology.object_properties().\r\n2. Created nodes for classes and relationships for object properties in Neo4j using Cypher queries\r\n\r\n(Minimal Code Example)\r\n\r\n```\r\nfrom owlready2 import get_ontology\r\nfrom neo4j import GraphDatabase\r\n\r\ndef parse_ontology_and_create_graph(ontology_path, session):\r\n    ontology = get_ontology(ontology_path).load()\r\n    \r\n    # Create nodes for classes\r\n    for cls in ontology.classes():\r\n        session.run(&quot;CREATE (:Class {name: $name})&quot;, name=cls.name)\r\n    \r\n    # Create relationships for object properties\r\n    for prop in ontology.object_properties():\r\n        for domain in prop.domain:\r\n            for range_ in prop.range:\r\n                session.run(&quot;&quot;&quot;\r\n                    MATCH (d:Class {name: $domain_name}), (r:Class {name: $range_name})\r\n                    CREATE (d)-[:`{relationship}`]-&gt;(r)\r\n                &quot;&quot;&quot;, domain_name=domain.name, range_name=range_.name, relationship=prop.name)\r\n\r\n```\r\n\r\nProblems I’m Facing\r\n\r\n1. Missing Data Properties:\r\n   Some Attributes are defined in the ontology are not included in the exported graph maybe because my code does not handle data properties.\r\n\r\n2. Missing Relationships:\r\n   Some Relationships are specified in the ontology but are missing from the graph. My code only handles basic object properties and might be incomplete.\r\n\r\n3. Name Mismatches:\r\n   Some relationships are incorrectly named in Neo4j, which does not exist in the ontology. This might be caused by a misstep in the mapping logic.","link":"https://stackoverflow.com/questions/79366711/how-to-correctly-parse-and-map-ontology-relationships-and-data-properties-to-a-n","title":"How to correctly parse and map ontology relationships and data properties to a Neo4j graph using Owlready2?"},{"tags":["graph","neo4j","cypher"],"answers":[{"comments":[{"owner":{"reputation":5823,"user_id":323129,"user_type":"registered","accept_rate":90,"profile_image":"https://www.gravatar.com/avatar/df837a3ae490227608cc38a7c9edfc7a?s=256&d=identicon&r=PG","display_name":"filippo","link":"https://stackoverflow.com/users/323129/filippo"},"edited":false,"score":0,"creation_date":1737117317,"post_id":79363939,"comment_id":139958219,"link":"https://stackoverflow.com/questions/79363186/return-longest-chain-of-dependencies-in-neo4j/79363939#comment139958219_79363939"},{"owner":{"reputation":96,"user_id":16625291,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/8a80f7049929e4f158e7ecdc9921911d?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"valdrake","link":"https://stackoverflow.com/users/16625291/valdrake"},"edited":false,"score":1,"creation_date":1737367232,"post_id":79363939,"comment_id":139969641,"link":"https://stackoverflow.com/questions/79363186/return-longest-chain-of-dependencies-in-neo4j/79363939#comment139969641_79363939"}],"tags":[],"owner":{"reputation":386,"user_id":21624328,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AGNmyxZzl1uvGNT2Zj90oWIgnDozeOoiJzA7-rJgem4f=k-s256","display_name":"Christoffer Bergman","link":"https://stackoverflow.com/users/21624328/christoffer-bergman"},"last_editor":{"reputation":386,"user_id":21624328,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AGNmyxZzl1uvGNT2Zj90oWIgnDozeOoiJzA7-rJgem4f=k-s256","display_name":"Christoffer Bergman","link":"https://stackoverflow.com/users/21624328/christoffer-bergman"},"comment_count":2,"down_vote_count":0,"up_vote_count":2,"is_accepted":false,"score":2,"last_activity_date":1737099780,"last_edit_date":1737099780,"creation_date":1737099033,"answer_id":79363939,"question_id":79363186,"share_link":"https://stackoverflow.com/a/79363939","body_markdown":"Not sure I understand, it looks like you already cracked it yourself. The query you have there will do exactly that, return the longest path. However, it could be simplified a bit, if you add a LIMIT 1 you don&#39;t need the collect():\r\n\r\n    MATCH p = (f:Fund {id: 2163440 })-[:INVESTS_IN*]-&gt;(d)\r\n    WITH f, p, length(p) AS depth\r\n    ORDER BY depth DESC LIMIT 1\r\n    RETURN f.name AS Fund, nodes(p) AS Nodes, relationships(p) AS Relationships\r\n\r\nIf the problem you are having is that you want to do this for all funds, and not only for 2163440, you could do that like this:\r\n\r\n    MATCH (f:Fund)\r\n    CALL(f) {\r\n      MATCH p = (f)-[:INVESTS_IN*]-&gt;(d)\r\n      WITH f, p, length(p) AS depth\r\n      ORDER BY depth DESC LIMIT 1\r\n      RETURN f.name AS Fund, nodes(p) AS Nodes, relationships(p) AS Relationships\r\n    }\r\n    RETURN Fund, Nodes, Relationships\r\n\r\nNote that this syntax for CALL is new. If you are on an older version of Neo4j (older than 5.26 I think), you need to write it like this instead:\r\n\r\n    MATCH (f:Fund)\r\n    CALL {\r\n      WITH f\r\n      MATCH p = (f)-[:INVESTS_IN*]-&gt;(d)\r\n      WITH f, p, length(p) AS depth\r\n      ORDER BY depth DESC LIMIT 1\r\n      RETURN f.name AS Fund, nodes(p) AS Nodes, relationships(p) AS Relationships\r\n    }\r\n    RETURN Fund, Nodes, Relationships\r\n\r\nThis will return the longest path for each Fund. However, you won&#39;t get a result for the last one, 9806, since it doesn&#39;t have any outgoing relationships at all. (f)-[:INVESTS_IN*]-&gt;(d) assumes there is at least one. If you want to get 9806 included as well you can just change that pattern to\r\n\r\n    (f)-[:INVESTS_IN*0..]-&gt;(d)","link":"https://stackoverflow.com/questions/79363186/return-longest-chain-of-dependencies-in-neo4j/79363939#79363939","title":"Return longest chain of dependencies in neo4j"}],"owner":{"reputation":5823,"user_id":323129,"user_type":"registered","accept_rate":90,"profile_image":"https://www.gravatar.com/avatar/df837a3ae490227608cc38a7c9edfc7a?s=256&d=identicon&r=PG","display_name":"filippo","link":"https://stackoverflow.com/users/323129/filippo"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":86,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":1,"score":1,"last_activity_date":1737099780,"creation_date":1737065802,"question_id":79363186,"share_link":"https://stackoverflow.com/q/79363186","body_markdown":"Given the following simple graph schema\r\n\r\n    ╒════════════════════════════════════════════════════╤════════════════════════════════════╕\r\n    │nodes                                               │relationships                       │\r\n    ╞════════════════════════════════════════════════════╪════════════════════════════════════╡\r\n    │[(:Fund {name: &quot;Fund&quot;,indexes: [],constraints: []})]│[[:INVESTS_IN {name: &quot;INVESTS_IN&quot;}]]│\r\n    └────────────────────────────────────────────────────┴────────────────────────────────────┘\r\n\r\nI want to find, for each fund, the longest single chain of dependencies with all its nodes and relations.\r\n\r\nI&#39;ve managed to get this cypher to return me all the nodes and relations. I wish I could return only the longest path.\r\n\r\n    MATCH p = (f:Fund {id: 2163440 })-[:INVESTS_IN*]-&gt;(d)\r\n    WITH f, p, length(p) AS depth\r\n    ORDER BY depth DESC\r\n    WITH f, collect(p)[0] AS longestPath\r\n    RETURN f.name AS Fund, nodes(longestPath) AS Nodes, relationships(longestPath) AS Relationships\r\n\r\nexample of what I&#39;ve got vs. what I want.\r\n\r\n[![enter image description here][1]][1]\r\n\r\n  [1]: https://i.sstatic.net/bmhaICrU.jpg","link":"https://stackoverflow.com/questions/79363186/return-longest-chain-of-dependencies-in-neo4j","title":"Return longest chain of dependencies in neo4j"},{"tags":["python","docker","neo4j"],"answers":[{"comments":[{"owner":{"reputation":1023,"user_id":13266736,"user_type":"registered","profile_image":"https://i.sstatic.net/rObPz.jpg?s=256","display_name":"SebNik","link":"https://stackoverflow.com/users/13266736/sebnik"},"edited":false,"score":0,"creation_date":1737042329,"post_id":79362205,"comment_id":139953154,"link":"https://stackoverflow.com/questions/79362134/docker-custom-image-neo4j-password-login-not-working/79362205#comment139953154_79362205"}],"tags":[],"owner":{"reputation":9,"user_id":13398622,"user_type":"registered","profile_image":"https://lh6.googleusercontent.com/-2GFwx974YDE/AAAAAAAAAAI/AAAAAAAAACQ/AAKWJJMehlsNUka1eS7vSawzWydosAIhxQ/s256-rj/photo.jpg","display_name":"Kobina Folson","link":"https://stackoverflow.com/users/13398622/kobina-folson"},"comment_count":1,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1737042019,"creation_date":1737042019,"answer_id":79362205,"question_id":79362134,"share_link":"https://stackoverflow.com/a/79362205","body_markdown":"when creating the driver object, are you passing the parameter password=&quot;your_password&quot; on purpose because you&#39;ve already set the password in the method definition","link":"https://stackoverflow.com/questions/79362134/docker-custom-image-neo4j-password-login-not-working/79362205#79362205","title":"Docker Custom image neo4j, password login not working"},{"tags":[],"owner":{"reputation":13178,"user_id":3691891,"user_type":"registered","profile_image":"https://i.sstatic.net/dcCUM.jpg?s=256","display_name":"Arkadiusz Drabczyk","link":"https://stackoverflow.com/users/3691891/arkadiusz-drabczyk"},"last_editor":{"reputation":13178,"user_id":3691891,"user_type":"registered","profile_image":"https://i.sstatic.net/dcCUM.jpg?s=256","display_name":"Arkadiusz Drabczyk","link":"https://stackoverflow.com/users/3691891/arkadiusz-drabczyk"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":false,"score":1,"last_activity_date":1737051860,"last_edit_date":1737051860,"creation_date":1737050513,"answer_id":79362643,"question_id":79362134,"share_link":"https://stackoverflow.com/a/79362643","body_markdown":"You have to run it like that:\r\n\r\n    docker run --rm -it -p 8123:7687 -p 8124:7474 -e NEO4J_AUTH=neo4j/1234567890 my-neo4j:latest neo4j\r\n\r\ndue to\r\n[this](https://github.com/neo4j/docker-neo4j/blob/dfb491e3215cbba041b9742e4ffa6ace245e148a/docker-image-src/5/coredb/docker-entrypoint.sh#L303):\r\n\r\n    function set_initial_password\r\n    {\r\n        local _neo4j_auth=&quot;${1}&quot;\r\n\r\n        # set the neo4j initial password only if you run the database server\r\n        if [ &quot;${cmd}&quot; == &quot;neo4j&quot; ]; then\r\n\r\nPython script will now work:\r\n\r\n    $ ./connect.py\r\n    Connected!\r\n\r\n","link":"https://stackoverflow.com/questions/79362134/docker-custom-image-neo4j-password-login-not-working/79362643#79362643","title":"Docker Custom image neo4j, password login not working"}],"owner":{"reputation":1023,"user_id":13266736,"user_type":"registered","profile_image":"https://i.sstatic.net/rObPz.jpg?s=256","display_name":"SebNik","link":"https://stackoverflow.com/users/13266736/sebnik"},"last_editor":{"reputation":1023,"user_id":13266736,"user_type":"registered","profile_image":"https://i.sstatic.net/rObPz.jpg?s=256","display_name":"SebNik","link":"https://stackoverflow.com/users/13266736/sebnik"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":219,"favorite_count":0,"down_vote_count":1,"up_vote_count":1,"answer_count":2,"score":0,"last_activity_date":1737051860,"creation_date":1737040538,"last_edit_date":1737042350,"question_id":79362134,"share_link":"https://stackoverflow.com/q/79362134","body_markdown":"I have a custom docker image which looks like this:\r\n```docker\r\nFROM neo4j:latest\r\n\r\n# Copy the script into the container\r\nCOPY start-neo4j.sh /start-neo4j.sh\r\n\r\n# Make the script executable\r\nRUN chmod +x /start-neo4j.sh\r\n\r\n# Run the script as the container&#39;s main command\r\nCMD [&quot;/start-neo4j.sh&quot;]\r\n```\r\nThe idea behind it is just that it helps me create a neo4j instance in docker which does not stop the docker container when the database stops, and for later use I would like to use my custom image.\r\nThe startup script looks like this:\r\n```\r\n#!/bin/bash\r\n\r\n# Ensure any failure in the script stops the script\r\necho &quot;Starting Neo4j with NEO4J_AUTH set to: $NEO4J_AUTH&quot;\r\n# Start Neo4j in the foreground\r\nexec neo4j console\r\n```\r\n\r\nWhen I now run the docker container like this:\r\n```docker run -d --name neo4j-niklas-tem-main \\\r\n  -p 8123:7687 \\\r\n  -p 8124:7474 \\\r\n  -e NEO4J_AUTH=neo4j/1234567890 \\\r\n  --user $(id -u):$(id -g) \\\r\n  my-neo4j:latest\r\n```\r\nwith my custom image. It works but when trying to login I cant with the password 1234567890.\r\n\r\nNow I sat at this for ours and can&#39;t understand what I did wrong so any points are great!\r\n\r\nMy code to login:\r\n```python\r\nfrom neo4j import GraphDatabase\r\nfrom neo4j.exceptions import ServiceUnavailable\r\n\r\ndef connect_to_neo4j(uri=&quot;bolt://localhost:8123&quot;, user=&quot;neo4j&quot;, password=&quot;1234567890&quot;):\r\n    try:\r\n        # Create the driver\r\n        driver = GraphDatabase.driver(uri, auth=(user, password))\r\n        \r\n        # Verify the connection\r\n        with driver.session() as session:\r\n            result = session.run(&quot;RETURN &#39;Connected!&#39; as message&quot;)\r\n            print(result.single()[&#39;message&#39;])\r\n            \r\n        return driver\r\n    \r\n    except ServiceUnavailable:\r\n        print(&quot;Failed to connect to Neo4j. Make sure the database is running.&quot;)\r\n        return None\r\n    except Exception as e:\r\n        print(f&quot;An error occurred: {str(e)}&quot;)\r\n        return None\r\n\r\n# Connect to the database\r\ndriver = connect_to_neo4j(password=&quot;1234567890&quot;)\r\n\r\n# Don&#39;t forget to close the driver when you&#39;re done\r\nif driver:\r\n    driver.close()\r\n```\r\nWhich thorws the error: `An error occurred: {code: Neo.ClientError.Security.Unauthorized} {message: The client is unauthorized due to authentication failure.}`\r\n\r\nAnd the logs from docker:\r\n```\r\nStarting Neo4j with NEO4J_AUTH set to: neo4j/1234567890\r\nDirectories in use:\r\nhome:         /var/lib/neo4j\r\nconfig:       /var/lib/neo4j/conf\r\nlogs:         /logs\r\nplugins:      /var/lib/neo4j/plugins\r\nimport:       /var/lib/neo4j/import\r\ndata:         /var/lib/neo4j/data\r\ncertificates: /var/lib/neo4j/certificates\r\nlicenses:     /var/lib/neo4j/licenses\r\nrun:          /var/lib/neo4j/run\r\nStarting Neo4j.\r\n2025-01-16 15:15:53.874+0000 INFO  Logging config in use: File &#39;/var/lib/neo4j/conf/user-logs.xml&#39;\r\n2025-01-16 15:15:53.891+0000 INFO  Starting...\r\n2025-01-16 15:15:55.069+0000 INFO  This instance is ServerId{76436336} (76436336-1904-4f6f-a898-71082cd5bf7e)\r\n2025-01-16 15:15:56.335+0000 INFO  ======== Neo4j 5.26.0 ========\r\n2025-01-16 15:15:59.524+0000 INFO  Anonymous Usage Data is being sent to Neo4j, see https://neo4j.com/docs/usage-data/\r\n2025-01-16 15:15:59.610+0000 INFO  Bolt enabled on 0.0.0.0:7687.\r\n2025-01-16 15:16:00.315+0000 INFO  HTTP enabled on 0.0.0.0:7474.\r\n2025-01-16 15:16:00.316+0000 INFO  Remote interface available at http://localhost:7474/\r\n2025-01-16 15:16:00.319+0000 INFO  id: F5093BC561A00396AE5C94FA9F710E9085F0EA09F30D6B5B087DE9CC1AF9C7EF\r\n2025-01-16 15:16:00.319+0000 INFO  name: system\r\n2025-01-16 15:16:00.319+0000 INFO  creationDate: 2025-01-16T15:15:57.733Z\r\n2025-01-16 15:16:00.320+0000 INFO  Started.\r\n2025-01-16 15:16:03.399+0000 WARN  [bolt-0] The client is unauthorized due to authentication failure.\r\n```\r\n\r\nthanks!","link":"https://stackoverflow.com/questions/79362134/docker-custom-image-neo4j-password-login-not-working","title":"Docker Custom image neo4j, password login not working"},{"tags":["neo4j","configuration","graph-databases","neo4j-apoc"],"comments":[{"owner":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"edited":false,"score":0,"creation_date":1736261922,"post_id":79332692,"comment_id":139903770,"link":"https://stackoverflow.com/questions/79332692/setting-the-apoc-import-file-enabled-true-in-the-neo4j-conf#comment139903770_79332692"},{"owner":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"edited":false,"score":0,"creation_date":1736262321,"post_id":79332692,"comment_id":139903821,"link":"https://stackoverflow.com/questions/79332692/setting-the-apoc-import-file-enabled-true-in-the-neo4j-conf#comment139903821_79332692"},{"owner":{"reputation":1,"user_id":25693189,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5b47ba2f5a0737c784abf5f9e80ec9e2?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Aravind Viswanath","link":"https://stackoverflow.com/users/25693189/aravind-viswanath"},"reply_to_user":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"edited":false,"score":0,"creation_date":1736506464,"post_id":79332692,"comment_id":139921094,"link":"https://stackoverflow.com/questions/79332692/setting-the-apoc-import-file-enabled-true-in-the-neo4j-conf#comment139921094_79332692"},{"owner":{"reputation":1,"user_id":25693189,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5b47ba2f5a0737c784abf5f9e80ec9e2?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Aravind Viswanath","link":"https://stackoverflow.com/users/25693189/aravind-viswanath"},"reply_to_user":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"edited":false,"score":0,"creation_date":1736510016,"post_id":79332692,"comment_id":139921412,"link":"https://stackoverflow.com/questions/79332692/setting-the-apoc-import-file-enabled-true-in-the-neo4j-conf#comment139921412_79332692"},{"owner":{"reputation":1,"user_id":25693189,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5b47ba2f5a0737c784abf5f9e80ec9e2?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Aravind Viswanath","link":"https://stackoverflow.com/users/25693189/aravind-viswanath"},"reply_to_user":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"edited":false,"score":0,"creation_date":1737105997,"post_id":79332692,"comment_id":139957219,"link":"https://stackoverflow.com/questions/79332692/setting-the-apoc-import-file-enabled-true-in-the-neo4j-conf#comment139957219_79332692"}],"answers":[{"tags":[],"owner":{"reputation":81,"user_id":9050031,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b0d5bfaf3fe7d70eb4341613aec50307?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Gemma Lamont ","link":"https://stackoverflow.com/users/9050031/gemma-lamont"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1748330314,"creation_date":1748330314,"answer_id":79639978,"question_id":79332692,"share_link":"https://stackoverflow.com/a/79639978","body_markdown":"Since Neo4j/APOC 5.0 plugin config items are no longer allowed in neo4j.conf, so all APOC config must be in a file named apoc.conf, in the same directory as neo4j.conf. See the [APOC docs](https://neo4j.com/docs/apoc/current/config/) for more info and some more options with setting the config :)","link":"https://stackoverflow.com/questions/79332692/setting-the-apoc-import-file-enabled-true-in-the-neo4j-conf/79639978#79639978","title":"Setting the &quot;apoc.import.file.enabled=true&#39; in the neo4j.conf"}],"owner":{"reputation":1,"user_id":25693189,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5b47ba2f5a0737c784abf5f9e80ec9e2?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Aravind Viswanath","link":"https://stackoverflow.com/users/25693189/aravind-viswanath"},"last_editor":{"reputation":1341,"user_id":7562715,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/2080762f7dd97696c9c0c473740b35d3?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"dthorbur","link":"https://stackoverflow.com/users/7562715/dthorbur"},"comment_count":5,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":387,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1748330314,"creation_date":1736157771,"last_edit_date":1736181524,"question_id":79332692,"share_link":"https://stackoverflow.com/q/79332692","body_markdown":"I Just installed Neo4j 1.6.1 on Windows. I am trying to run `apoc.load.json`.\r\n\r\nI run it and I&#39;m getting this error:\r\n\r\n&gt; Failed to invoke procedure apoc.load.json: Caused by: java.lang.RuntimeException: Import from files not enabled, please set apoc.import.file.enabled=true in your neo4j.conf\r\n\r\nonly one problem, I&#39;ve added the `apoc.import.file.enabled=true` in the `neo4j.conf` but still am getting the same error, is that because of the version issue or Anyother?\r\n\r\nDatabase starts fine. I can run other statement, just not APOC procedures.\r\n\r\nAny ideas?\r\n\r\nI&#39;ve already added the required code in the conf file but still facing the same issue with the `neo4j.conf`.","link":"https://stackoverflow.com/questions/79332692/setting-the-apoc-import-file-enabled-true-in-the-neo4j-conf","title":"Setting the &quot;apoc.import.file.enabled=true&#39; in the neo4j.conf"},{"tags":["neo4j","neo4j-python-driver"],"answers":[{"tags":[],"owner":{"reputation":4375,"user_id":2205372,"user_type":"registered","profile_image":"https://graph.facebook.com/10102001794131537/picture?type=large","display_name":"Ambrose Leung","link":"https://stackoverflow.com/users/2205372/ambrose-leung"},"last_editor":{"reputation":4375,"user_id":2205372,"user_type":"registered","profile_image":"https://graph.facebook.com/10102001794131537/picture?type=large","display_name":"Ambrose Leung","link":"https://stackoverflow.com/users/2205372/ambrose-leung"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1735875789,"last_edit_date":1735875789,"creation_date":1735861230,"answer_id":79325200,"question_id":79325199,"share_link":"https://stackoverflow.com/a/79325200","body_markdown":"After stumbling upon the correct documentation, here is a helper method I wrote that respects the timeout value:\r\n\r\n```python\r\nfrom neo4j import unit_of_work\r\n\r\ndef execute_query_with_timeout(query, timeoutsec = 10):\r\n    @unit_of_work(timeout=timeoutsec)\r\n    def do_query(tx):\r\n        result = tx.run(query)\r\n        return result.data()\r\n    return neo4jclient.driver.session().execute_read(do_query)\r\n```\r\n\r\nedit: found something even better:\r\n\r\n```python\r\nfrom neo4j import Query\r\nneo4jclient.driver.session(database=&#39;dbname&#39;).execute_query(Query(querytext,timeout=10))\r\n```\r\n\r\nyou&#39;re welcome.","link":"https://stackoverflow.com/questions/79325199/neo4j-python-driver-how-do-you-set-a-timeout-for-a-query/79325200#79325200","title":"Neo4j Python driver: How do you set a timeout for a query?"},{"tags":[],"owner":{"reputation":1403,"user_id":2376882,"user_type":"registered","profile_image":"https://i.sstatic.net/zODdI.jpg?s=256","display_name":"Robsdedude","link":"https://stackoverflow.com/users/2376882/robsdedude"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1736411673,"creation_date":1736411673,"answer_id":79341905,"question_id":79325199,"share_link":"https://stackoverflow.com/a/79341905","body_markdown":"It depends on the API you are using (different APIs serve different purposes).\r\n\r\nAll snippets assume to be embedded in this code\r\n```python\r\nimport neo4j  # version 5.27\r\n\r\n\r\nURL = &quot;neo4j://neo4j.example.com:7687&quot;\r\nAUTH = (&quot;username&quot;, &quot;password&quot;)\r\nDB = &quot;neo4j&quot;  # best practice to specify database where possible\r\nTIMEOUT = 10  # seconds\r\n\r\n\r\nwith neo4j.GraphDatabase.driver(URL, auth=AUTH) as driver:\r\n    ...  # &lt;- the snippet goes here\r\n```\r\n\r\n## `driver.execute_query`\r\nThis is the API recommended for most use-cases.\r\nIt provides retries and manages sessions and transactions for you.\r\n\r\n```python\r\ndriver.execute_query(\r\n    neo4j.Query(\r\n        &quot;RETURN 1&quot;,\r\n        timeout=TIMEOUT,\r\n    ),\r\n    database_=DB,\r\n    routing_=&quot;r&quot;,  # if a read query\r\n)\r\n```\r\n\r\n## Managed Transaction\r\nThis is equivalent to the above except that it\r\n * allows for more complex logic within the transaction\r\n * allows for multiple queries within the transaction\r\n * is potentially less optimized because the driver can make fewer assumptions about the nature of the transaction.\r\n\r\n```python\r\n@neo4j.unit_of_work(timeout=TIMEOUT)\r\ndef work(tx: neo4j.ManagedTransaction):\r\n    return list(tx.run(&quot;RETURN 1&quot;))\r\n\r\n\r\nwith driver.session(database=DB) as session:\r\n    session.execute_read(work)\r\n    # or session.execute_write(work) depending on the type of query\r\n```\r\n\r\n## `session.run` a.k.a. auto-commit transactions\r\nThis API is primarily useful for queries that manage their own transactions server-side. E.g., `CALL { …​ } IN TRANSACTIONS`.\r\n\r\n```python\r\nwith driver.session(\r\n    database=DB,\r\n    default_access_mode=neo4j.READ_ACCESS,  # if a read query\r\n) as session:\r\n    session.run(\r\n        neo4j.Query(\r\n            &quot;RETURN 1&quot;,\r\n            timeout=TIMEOUT,\r\n        )\r\n    )\r\n```\r\n\r\n## Unmanaged transactions\r\nThis API is mostly for libraries wrapping the driver or for clients that need full control over transactions, e.g., because they want to roll their own retry logic.\r\n\r\n```python\r\nwith driver.session(\r\n    database=DB,\r\n    default_access_mode=neo4j.READ_ACCESS,  # if a read query\r\n) as session:\r\n    with session.begin_transaction(timeout=TIMEOUT) as tx:\r\n        list(tx.run(&quot;RETURN 1&quot;))\r\n```","link":"https://stackoverflow.com/questions/79325199/neo4j-python-driver-how-do-you-set-a-timeout-for-a-query/79341905#79341905","title":"Neo4j Python driver: How do you set a timeout for a query?"}],"owner":{"reputation":4375,"user_id":2205372,"user_type":"registered","profile_image":"https://graph.facebook.com/10102001794131537/picture?type=large","display_name":"Ambrose Leung","link":"https://stackoverflow.com/users/2205372/ambrose-leung"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":405,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79341905,"answer_count":2,"score":0,"last_activity_date":1736411673,"creation_date":1735861230,"question_id":79325199,"share_link":"https://stackoverflow.com/q/79325199","body_markdown":"How do you limit the query execution to say 10 seconds?\r\n\r\nThe scenario I&#39;m encountering is that I have a LOT of nodes in my graph and I want to see if a relationship exists between 2 nodes, if it takes longer than 10 seconds, the chances are that the relationship doesn&#39;t exist.   But without a timeout, the query doesn&#39;t terminate!","link":"https://stackoverflow.com/questions/79325199/neo4j-python-driver-how-do-you-set-a-timeout-for-a-query","title":"Neo4j Python driver: How do you set a timeout for a query?"},{"tags":["memory","neo4j"],"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":1,"creation_date":1736271314,"post_id":79323171,"comment_id":139904671,"link":"https://stackoverflow.com/questions/79323171/is-there-a-faster-way-to-calculate-memory-usage-for-a-given-number-of-nodes-rel#comment139904671_79323171"}],"answers":[{"tags":[],"owner":{"reputation":20225,"user_id":2662355,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/6ea0a9d988f145b0e666dfdd96374736?s=256&d=identicon&r=PG","display_name":"Christophe Willemsen","link":"https://stackoverflow.com/users/2662355/christophe-willemsen"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1735851723,"creation_date":1735851723,"answer_id":79324960,"question_id":79323171,"share_link":"https://stackoverflow.com/a/79324960","body_markdown":"You can get storage size metrics with the following procedure : \r\n\r\nReplace `&lt;mydb&gt;` with the name of your database :\r\n\r\n```\r\nCALL dbms.queryJmx(&#39;neo4j.metrics:name=neo4j.database.&lt;mydb&gt;.store.size.total&#39;)\r\n\r\n╒══════════════════════════════════════════════════════════════╤══════════════════════════════════════════════════════╤══════════════════════════════════════════════════════════════════════╕\r\n│name                                                          │description                                           │attributes                                                            │\r\n╞══════════════════════════════════════════════════════════════╪══════════════════════════════════════════════════════╪══════════════════════════════════════════════════════════════════════╡\r\n│&quot;neo4j.metrics:name=neo4j.database.docslogin.store.size.total&quot;│&quot;Information on the management interface of the MBean&quot;│{Value: {description: &quot;Attribute exposed for management&quot;, value: 15430│\r\n│                                                              │                                                      │044}, Number: {description: &quot;Attribute exposed for management&quot;, value:│\r\n│                                                              │                                                      │ 15430044}}                                                           │\r\n└──────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────┘\r\n```","link":"https://stackoverflow.com/questions/79323171/is-there-a-faster-way-to-calculate-memory-usage-for-a-given-number-of-nodes-rel/79324960#79324960","title":"Is there a faster way to calculate memory usage for a given number of nodes, relationships, and properties in Neo4j?"}],"owner":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"last_editor":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":140,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79324960,"answer_count":1,"score":0,"last_activity_date":1735894521,"creation_date":1735806648,"last_edit_date":1735894521,"question_id":79323171,"share_link":"https://stackoverflow.com/q/79323171","body_markdown":"I am currently calculating memory usage in my Neo4j database manually by adding data, running ``CALL db.checkpoint()``, shutting down the database, and checking the database file in the ``data/databases/neo4j`` directory. I then count the file size by hand. However, this process is very slow, especially when I need to measure memory usage multiple times.\r\n\r\nI came across [this question][1] where it&#39;s mentioned that the storage size for a node is 14 bytes, a relationship is 33 bytes, and a property is 41 bytes.\r\n\r\nIs there a more efficient way to calculate memory usage in Neo4j based on the number of nodes, relationships, and properties without needing to rely on this manual approach? Can I use the mentioned byte sizes as an estimate for quick calculations?\r\n\r\nMy Java code:\r\n\r\n    @Override\r\n    public long getDatabaseSize(Transaction transaction) {\r\n        String query = &quot;CALL dbms.queryJmx(&#39;neo4j.metrics:name=neo4j.database.neo4j.store.size.total&#39;)&quot;;\r\n        try (Result result = transaction.execute(query)) {\r\n            // TODO: end this block\r\n        } catch (Exception e) {\r\n            throw new RuntimeException(&quot;Failed to retrieve database size: &quot;, e);\r\n        }\r\n        return -1;\r\n    }\r\n\r\n  [1]: https://stackoverflow.com/questions/47145114/how-to-calculate-storage-requirement-for-neo4j","link":"https://stackoverflow.com/questions/79323171/is-there-a-faster-way-to-calculate-memory-usage-for-a-given-number-of-nodes-rel","title":"Is there a faster way to calculate memory usage for a given number of nodes, relationships, and properties in Neo4j?"},{"tags":["python","docker-compose","neo4j","langchain","ollama"],"answers":[{"tags":[],"owner":{"reputation":1892,"user_id":2651036,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/e1e3b8c6885e89c5c8a2bee3ba0bc0a1?s=256&d=identicon&r=PG","display_name":"Oskar Hane","link":"https://stackoverflow.com/users/2651036/oskar-hane"},"comment_count":0,"down_vote_count":1,"up_vote_count":0,"is_accepted":false,"score":-1,"last_activity_date":1739181524,"creation_date":1739181524,"answer_id":79426693,"question_id":79322243,"share_link":"https://stackoverflow.com/a/79426693","body_markdown":"Look at this for inspiration: https://github.com/docker/genai-stack/blob/main/docker-compose.yml\r\n\r\nThe issue might be `NEO4J_URI=bolt://172.20.0.3:7687`, try `NEO4J_URI=neo4j://neo4j:7687`","link":"https://stackoverflow.com/questions/79322243/neo4j-connection-refused-in-docker-compose-setup-with-langchain-integration/79426693#79426693","title":"Neo4j Connection Refused in Docker Compose Setup with LangChain Integration"},{"tags":[],"owner":{"reputation":1,"user_id":28929790,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/c3b5d49190910cea1c6c6fafe14bd2bc?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Markus 81","link":"https://stackoverflow.com/users/28929790/markus-81"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1739306564,"creation_date":1739306564,"answer_id":79431273,"question_id":79322243,"share_link":"https://stackoverflow.com/a/79431273","body_markdown":"I had a similar issue and was able to resolve it by checking the network configuration in Docker-Compose. Make sure Neo4j is running in the correct network and accessible from other containers.\r\n\r\nA useful approach is to set NEO4J_URI as bolt://neo4j:7687 if “neo4j” is the service name in your docker-compose.yml. Also, checking the container logs (docker logs &lt;neo4j-container-id&gt;) can provide more insights into potential errors.\r\n\r\nI documented a similar case here: [https://ollama.com/IBLAG/Certification][1]\r\n\r\n\r\n  [1]: https://ollama.com/IBLAG/Certification","link":"https://stackoverflow.com/questions/79322243/neo4j-connection-refused-in-docker-compose-setup-with-langchain-integration/79431273#79431273","title":"Neo4j Connection Refused in Docker Compose Setup with LangChain Integration"}],"owner":{"reputation":1,"user_id":28250394,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/80eb60f18f934ed426eb4a572f8ee1e5?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Binit Sapkota","link":"https://stackoverflow.com/users/28250394/binit-sapkota"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":91,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":2,"score":0,"last_activity_date":1739306564,"creation_date":1735761519,"question_id":79322243,"share_link":"https://stackoverflow.com/q/79322243","body_markdown":"I&#39;m working on a project using LangChain to connect to a Neo4j database hosted in a Docker container. I&#39;ve set up the environment using docker-compose, but I&#39;m encountering a Connection Refused error when attempting to interact with Neo4j through the Neo4jVector integration from LangChain.\r\n\r\nMy python worked properly when I used neo4j API and use cloud instance. But when I shifted to docker for neo4j. After than I am facing this error.\r\n\r\nI tested direct connectivity using `GraphDatabase.driver` and confirmed Neo4j is reachable and it works properly. Below is my working code:\r\n\r\n```python\r\nfrom neo4j import GraphDatabase\r\n\r\nuri = &quot;bolt://neo4j_database:7687&quot;\r\nusername = &quot;neo4j&quot;\r\npassword = &quot;neo4j_admin&quot;\r\n\r\ndriver = GraphDatabase.driver(uri, auth=(username, password))\r\n\r\ndef push_data(tx):\r\n    # Create historical figures as nodes\r\n    tx.run(&quot;&quot;&quot;\r\n        CREATE (mahendra:Person {name: &#39;King Mahendra&#39;, role: &#39;King of Nepal&#39;, reign: &#39;1955-1972&#39;})\r\n        CREATE (rana_regime:Event {name: &#39;Rana Regime&#39;, description: &#39;Autocratic rule by the Rana family in Nepal&#39;, period: &#39;1846-1951&#39;})\r\n        CREATE (tribhuvan:Person {name: &#39;King Tribhuvan&#39;, role: &#39;King of Nepal&#39;, reign: &#39;1911-1955&#39;})\r\n        CREATE (prithvi:Person {name: &#39;King Prithvi Narayan Shah&#39;, role: &#39;Founder of Unified Nepal&#39;, reign: &#39;1743-1775&#39;})\r\n        CREATE (bp_koirala:Person {name: &#39;BP Koirala&#39;, role: &#39;First Democratically Elected Prime Minister of Nepal&#39;, term: &#39;1959-1960&#39;})\r\n        CREATE (military_coup:Event {name: &#39;1960 Military Coup&#39;, description: &#39;King Mahendra’s coup that dissolved the democratic government&#39;, year: 1960})\r\n    &quot;&quot;&quot;)\r\n\r\n    # Create relationships\r\n    tx.run(&quot;&quot;&quot;\r\n        MATCH (mahendra:Person {name: &#39;King Mahendra&#39;}),\r\n              (tribhuvan:Person {name: &#39;King Tribhuvan&#39;}),\r\n              (rana_regime:Event {name: &#39;Rana Regime&#39;}),\r\n              (prithvi:Person {name: &#39;King Prithvi Narayan Shah&#39;}),\r\n              (bp_koirala:Person {name: &#39;BP Koirala&#39;}),\r\n              (military_coup:Event {name: &#39;1960 Military Coup&#39;})\r\n        CREATE (tribhuvan)-[:ENDED]-&gt;(rana_regime)\r\n        CREATE (mahendra)-[:CONDUCTED]-&gt;(military_coup)\r\n        CREATE (bp_koirala)-[:OVERTHROWN_BY]-&gt;(military_coup)\r\n        CREATE (prithvi)-[:FOUNDED]-&gt;(:Entity {name: &#39;Unified Nepal&#39;})\r\n        CREATE (mahendra)-[:SUCCEEDED]-&gt;(tribhuvan)\r\n    &quot;&quot;&quot;)\r\n\r\ntry:\r\n    with driver.session() as session:\r\n        session.execute_write(push_data)\r\n        print(&quot;Data pushed successfully!&quot;)\r\n        print(uri)\r\nexcept Exception as e:\r\n    print(f&quot;An error occurred: {e}&quot;)\r\nfinally:\r\n    driver.close()\r\n```\r\n\r\nError:\r\n\r\n```none\r\nEmbedding model initialized successfully.\r\nError creating vector index: [Errno 111] Connection refused\r\n```\r\n\r\nThese are my environment variables.\r\n\r\n```none\r\nlangchain == 0.3.13\r\nneo4j == 5.27.0\r\nlangchain_ollama == 0.2.2\r\n\r\nEnvironment Variables:\r\nNEO4J_URI=bolt://172.20.0.3:7687 \r\nNEO4J_USERNAME=neo4j \r\nNEO4J_PASSWORD=neo4j_admin\r\n```\r\n\r\nThe Neo4j browser is accessible at `http://localhost:7474` and `bolt://172.20.0.3:7687`.\r\n\r\nBut when I try to use it with LangChain and ollama I am facing this issue.\r\n\r\nThis is my LangChain code which isn&#39;t working:\r\n\r\n```python\r\nfrom langchain_ollama import OllamaEmbeddings\r\nfrom langchain_community.vectorstores.neo4j_vector import Neo4jVector\r\nimport os\r\nfrom dotenv import load_dotenv\r\nfrom langchain.schema import Document\r\n\r\nload_dotenv()\r\n\r\nURI = os.getenv(&quot;NEO4J_URL&quot;)\r\nusername = os.getenv(&quot;NEO4J_USERNAME&quot;)\r\npassword = os.getenv(&quot;NEO4J_PASSWORD&quot;)\r\nchunked_folder_path = os.getenv(&quot;CHUNK_FOLDER_PATH&quot;)\r\nindex = &quot;vector&quot;\r\nkeyword_index_name = &quot;keyword&quot;\r\n\r\nprint(&quot;neo4j url:&quot; ,URI)\r\nprint(&quot;neo4j username:&quot; ,username)\r\nprint(&quot;neo4j password:&quot; ,password)\r\n\r\ndef read_documents(chunked_folder_path):\r\n    docs = []\r\n    try:\r\n        for filename in os.listdir(chunked_folder_path):\r\n            if filename.endswith(&quot;.txt&quot;):\r\n                file_path = os.path.join(chunked_folder_path, filename)\r\n                with open(file_path, &#39;r&#39;, encoding=&#39;utf-8&#39;) as file:\r\n                    content = file.read()\r\n                    docs.append(Document(page_content=content, metadata={&quot;filename&quot;: filename}))\r\n            else:\r\n                print(f&quot;Skipped non-txt file: {filename}&quot;)\r\n    except Exception as e:\r\n        print(f&quot;Error reading documents from folder: {e}&quot;)\r\n    return docs\r\n\r\n\r\ndef retrieval_from_graph(documents):\r\n    try:\r\n        embedding_model = OllamaEmbeddings(model=&quot;mxbai-embed-large&quot;)\r\n        print(&quot;Embedding model initialized successfully.&quot;)\r\n    except Exception as e:\r\n        print(f&quot;Error initializing the embedding model: {e}&quot;)\r\n        return  None\r\n    \r\n    try:\r\n        vectorstore = Neo4jVector.from_existing_index(\r\n            embedding=embedding_model,\r\n            url=URI,\r\n            username=username,\r\n            password=password,\r\n            search_type=&quot;hybrid&quot;,\r\n            index_name = index,\r\n            keyword_index_name=keyword_index_name,\r\n            node_label=[&quot;Events&quot;, &quot;Person&quot;],\r\n            embedding_node_property=&quot;embedding&quot;,\r\n        )\r\n        print(&quot;Successfully connected to the existing Neo4j vector index.&quot;)\r\n        return vectorstore\r\n    except Exception as e:\r\n        print(f&quot;Existing index not found, Creating a new one ......: {e}&quot;)\r\n\r\n    documents = read_documents(chunked_folder_path)\r\n    if not documents:\r\n        print(&quot;No documents were loaded. Cannot create index&quot;)\r\n        return  None\r\n    try:\r\n        vectorstore = Neo4jVector.from_documents(\r\n            embedding=embedding_model,\r\n            documents=documents,\r\n            url=URI,\r\n            username=username,\r\n            password=password,\r\n            search_type=&quot;hybrid&quot;,\r\n            index_name = index,\r\n            keyword_index_name=keyword_index_name,\r\n            node_label=[&quot;Events&quot;, &quot;Person&quot;],\r\n            embedding_node_property=&quot;embedding&quot;,\r\n        )\r\n        print(&quot;New vector index created successfully&quot;)\r\n        return vectorstore\r\n    except Exception as creation_error:\r\n        print(f&quot;Error creating vector index: {creation_error}&quot;)\r\n\r\n\r\n\r\ndef similarity_search(vectorstore, query):\r\n    try:\r\n        docs_with_score = vectorstore.similarity_search_with_score(query, k=2)\r\n        for doc, score in docs_with_score:\r\n            print(f&quot;Document: {doc.page_content}\\nScore: {score}&quot;)\r\n    except Exception as e:\r\n        print(f&quot;Error during similarity search: {e}&quot;)\r\n\r\ndef query_similarity_search(query ):\r\n    documents = read_documents(chunked_folder_path)\r\n    if not documents:\r\n        print(&quot;No document found in the folder&quot;)\r\n        return\r\n    vectorstore = retrieval_from_graph(documents)\r\n\r\n    if not vectorstore:\r\n        print(&quot;Failed to create vector store&quot;)\r\n        return \r\n    result =similarity_search(vectorstore, query)\r\n    return result\r\n\r\nif __name__ == &quot;__main__&quot;:\r\n    query = &quot;Who is King Birendra&quot;\r\n    query_similarity_search(query)\r\n```\r\n\r\nThis is `my docker-compose.yaml`:\r\n\r\n```\r\nservices:\r\n  web:\r\n    build: \r\n      context: .\r\n      dockerfile: Dockerfile\r\n    environment:\r\n      DATABASE_URL: &quot;postgresql://postgres_user:postgres_password@db:5432/postgres_db&quot;\r\n      OLLAMA_URL: &quot;http://ollama:11434&quot;  \r\n      QDRANT_URL: &quot;http://qdrant_database:6333&quot;\r\n      NEO4J_URL: &quot;bolt://neo4j_database:7687&quot;\r\n    ports:\r\n      - &quot;8000:8000&quot;\r\n    depends_on:\r\n      - db\r\n      - ollama\r\n      - qdrant_database\r\n      - neo4j\r\n    volumes:\r\n      - .:/app\r\n    networks:\r\n      - my_network\r\n    command: [&quot;uvicorn&quot;, &quot;app.main:app&quot;, &quot;--host&quot;, &quot;0.0.0.0&quot;, &quot;--port&quot;, &quot;8000&quot;, &quot;--reload&quot;]\r\n    restart: always\r\n  \r\n  db:\r\n    image: postgres:13\r\n    environment:\r\n      POSTGRES_USER: postgres_user\r\n      POSTGRES_PASSWORD: postgres_password\r\n      POSTGRES_DB: postgres_db\r\n    volumes:\r\n      - pgdata:/var/lib/postgresql/data\r\n    ports:\r\n      - &quot;5432:5432&quot;\r\n    networks:\r\n      - my_network\r\n\r\n    \r\n  ollama:\r\n    image: ollama/ollama:latest\r\n    container_name: ollama\r\n    restart: unless-stopped\r\n    ports:\r\n      - &quot;11434:11434&quot;\r\n    volumes:\r\n    - ~/.ollama/models:/root/.ollama/models\r\n    deploy:\r\n      resources:\r\n        reservations:\r\n          devices:\r\n          - driver: nvidia\r\n            capabilities: [gpu]\r\n            count: all\r\n    networks:\r\n      - my_network\r\n\r\n\r\n  qdrant_database:\r\n    image: qdrant/qdrant:latest\r\n    container_name: qdrant_database\r\n    restart: unless-stopped\r\n    ports:\r\n      - &quot;6333:6333&quot;\r\n    environment:\r\n      QDRANT_CONFIG_PATH: /qdrant/config.yml\r\n    volumes:\r\n      - ./qdrant/config.yml:/qdrant/config.yml\r\n      - ./qdrant_data:/qdrant/storage/\r\n      - ./retrievers:/app/retrieval/\r\n    networks:\r\n      - my_network\r\n\r\n  neo4j:\r\n    image: neo4j:latest\r\n    container_name: neo4j_database\r\n    restart: unless-stopped\r\n    ports:\r\n      - &quot;7474:7474&quot;\r\n      - &quot;7687:7687&quot;\r\n    environment:\r\n      - NEO4J_AUTH=neo4j/neo4j_admin\r\n      - NEO4J_dbms_connector_bolt_listen__address=0.0.0.0:7687\r\n      - NEO4J_dbms_connector_bolt_advertised__address=:7687\r\n      - NEO4J_dbms_connector_http_advertised__address=:7474\r\n      - NEO4J_dbms_default__listen__address=0.0.0.0\r\n    volumes:\r\n      - ./neo4j/data:/data\r\n      - ./neo4j/logs:/logs\r\n      - ./neo4j/import:/neo4j/import\r\n      - ./neo4j/plugins:/plugins\r\n    networks:\r\n      - my_network\r\n\r\nvolumes:\r\n  pgdata:\r\n    driver: local\r\n  neo4j_data:\r\n    driver: local\r\n  neo4j_import:\r\n    driver: local\r\n  neo4j_plugins:\r\n    driver: local\r\n  neo4j_logs:\r\n    driver: local\r\nnetworks:\r\n  my_network:\r\n    driver: bridge\r\n```\r\n\r\nWhy am I getting a Connection Refused error when using LangChain&#39;s Neo4jVector? How can I resolve this issue while maintaining the current Docker setup?","link":"https://stackoverflow.com/questions/79322243/neo4j-connection-refused-in-docker-compose-setup-with-langchain-integration","title":"Neo4j Connection Refused in Docker Compose Setup with LangChain Integration"},{"tags":["neo4j","dump"],"answers":[{"tags":[],"owner":{"reputation":11,"user_id":21087064,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/93e1dd2720593420f4e00bad24334b18?s=256&d=identicon&r=PG","display_name":"Elika","link":"https://stackoverflow.com/users/21087064/elika"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1735155821,"creation_date":1735155821,"answer_id":79308229,"question_id":79306730,"share_link":"https://stackoverflow.com/a/79308229","body_markdown":"Alright, I found the answer to the question: Add the data file and then create the DBMS as mentioned in the post. That is it! No need to follow further steps; the graph is already created in the database. Hopefully this helps everyone. Also, I am using Neo4j Desktop and not aura.","link":"https://stackoverflow.com/questions/79306730/importing-dump-data-to-neo4j/79308229#79308229","title":"Importing dump data to neo4j"}],"owner":{"reputation":11,"user_id":21087064,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/93e1dd2720593420f4e00bad24334b18?s=256&d=identicon&r=PG","display_name":"Elika","link":"https://stackoverflow.com/users/21087064/elika"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":476,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1735155821,"creation_date":1735091310,"question_id":79306730,"share_link":"https://stackoverflow.com/q/79306730","body_markdown":"I am following the rules on here: https://github.com/neo4j-graph-examples/stackoverflow?tab=readme-ov-file\r\n\r\nAnd after implementing this command in terminal: NEO4J_HOME/bin/neo4j-admin load --from data/stackoverflow-4-3-1.dump [--database &quot;database&quot;]\r\n\r\nI get this error:-bash: NEO4J-HOME/bin/neo4j-admin: No such file or directory\r\n\r\nAlso, NEO4J_HOME is a variable that points to the directory where neo4j is installed and it is set properly. Any idea on how I can solve this?? Thanks in advance","link":"https://stackoverflow.com/questions/79306730/importing-dump-data-to-neo4j","title":"Importing dump data to neo4j"},{"tags":["python","neo4j","neo4j-python-driver"],"comments":[{"owner":{"reputation":21027,"user_id":2164365,"user_type":"registered","accept_rate":40,"profile_image":"https://i.sstatic.net/RKSgV.png?s=256","display_name":"Abra","link":"https://stackoverflow.com/users/2164365/abra"},"edited":false,"score":0,"creation_date":1734853602,"post_id":79300646,"comment_id":139839127,"link":"https://stackoverflow.com/questions/79300646/why-did-it-fail-when-trying-to-connect-to-a-neo4j-database-in-python-using-pytho#comment139839127_79300646"},{"owner":{"reputation":146,"user_id":13718162,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-PJEC9SDyGwE/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucmPufSPW6EGTVuGUXDcNmV28emoQg/s256-rj/photo.jpg","display_name":"Muhab Joumaa","link":"https://stackoverflow.com/users/13718162/muhab-joumaa"},"reply_to_user":{"reputation":21027,"user_id":2164365,"user_type":"registered","accept_rate":40,"profile_image":"https://i.sstatic.net/RKSgV.png?s=256","display_name":"Abra","link":"https://stackoverflow.com/users/2164365/abra"},"edited":false,"score":0,"creation_date":1734853729,"post_id":79300646,"comment_id":139839132,"link":"https://stackoverflow.com/questions/79300646/why-did-it-fail-when-trying-to-connect-to-a-neo4j-database-in-python-using-pytho#comment139839132_79300646"},{"owner":{"reputation":110532,"user_id":466862,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/d873f397779db38cd510d9ee5416fd43?s=256&d=identicon&r=PG","display_name":"Mark Rotteveel","link":"https://stackoverflow.com/users/466862/mark-rotteveel"},"edited":false,"score":0,"creation_date":1734871871,"post_id":79300646,"comment_id":139839792,"link":"https://stackoverflow.com/questions/79300646/why-did-it-fail-when-trying-to-connect-to-a-neo4j-database-in-python-using-pytho#comment139839792_79300646"},{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1735064427,"post_id":79300646,"comment_id":139849014,"link":"https://stackoverflow.com/questions/79300646/why-did-it-fail-when-trying-to-connect-to-a-neo4j-database-in-python-using-pytho#comment139849014_79300646"}],"answers":[{"comments":[{"owner":{"reputation":146,"user_id":13718162,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-PJEC9SDyGwE/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucmPufSPW6EGTVuGUXDcNmV28emoQg/s256-rj/photo.jpg","display_name":"Muhab Joumaa","link":"https://stackoverflow.com/users/13718162/muhab-joumaa"},"edited":false,"score":1,"creation_date":1734853590,"post_id":79300650,"comment_id":139839126,"link":"https://stackoverflow.com/questions/79300646/why-did-it-fail-when-trying-to-connect-to-a-neo4j-database-in-python-using-pytho/79300650#comment139839126_79300650"}],"tags":[],"owner":{"reputation":1,"user_id":28889931,"user_type":"registered","profile_image":"https://i.sstatic.net/bmo3ksqU.jpg?s=256","display_name":"James Smith","link":"https://stackoverflow.com/users/28889931/james-smith"},"comment_count":1,"down_vote_count":1,"up_vote_count":0,"is_accepted":false,"score":-1,"last_activity_date":1734853516,"creation_date":1734853516,"answer_id":79300650,"question_id":79300646,"share_link":"https://stackoverflow.com/a/79300650","body_markdown":"The connection to a Neo4j database on PythonAnywhere may fail due to network restrictions or firewall settings blocking the connection. PythonAnywhere typically doesn&#39;t allow outbound connections to external services like databases. To resolve this, ensure the Neo4j instance is accessible over a public IP and configure PythonAnywhere&#39;s outbound connection settings accordingly.","link":"https://stackoverflow.com/questions/79300646/why-did-it-fail-when-trying-to-connect-to-a-neo4j-database-in-python-using-pytho/79300650#79300650","title":"Why did it fail when trying to connect to a Neo4j database in Python using PythonAnywhere?"},{"tags":[],"owner":{"reputation":5846,"user_id":167813,"user_type":"registered","accept_rate":25,"profile_image":"https://www.gravatar.com/avatar/b7e42d7954660b54a29bff48043693a5?s=256&d=identicon&r=PG","display_name":"Glenn","link":"https://stackoverflow.com/users/167813/glenn"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1735035113,"creation_date":1735035113,"answer_id":79305314,"question_id":79300646,"share_link":"https://stackoverflow.com/a/79305314","body_markdown":"Free accounts cannot connect out of PythonAnywhere except using http(s) through the proxy. So database connections will not work from a free account. If you upgrade to a paid account, that restriction is removed.","link":"https://stackoverflow.com/questions/79300646/why-did-it-fail-when-trying-to-connect-to-a-neo4j-database-in-python-using-pytho/79305314#79305314","title":"Why did it fail when trying to connect to a Neo4j database in Python using PythonAnywhere?"}],"owner":{"reputation":146,"user_id":13718162,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-PJEC9SDyGwE/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucmPufSPW6EGTVuGUXDcNmV28emoQg/s256-rj/photo.jpg","display_name":"Muhab Joumaa","link":"https://stackoverflow.com/users/13718162/muhab-joumaa"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":4,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":130,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":2,"score":0,"last_activity_date":1735064084,"creation_date":1734853331,"last_edit_date":1735064084,"question_id":79300646,"share_link":"https://stackoverflow.com/q/79300646","body_markdown":"I wrote a simple Python script to connect to my Neo4j database instance and retrieve some data using the official Neo4j library. I am trying to run this script on PythonAnywhere, but it failed to connect to the database, printing &quot;Unable to retrieve routing information.&quot; The URI, username, and password are correct; it successfully connects to the database from my desktop application written in Java.\r\nHere is the full script in Python:\r\n```\r\nfrom neo4j import GraphDatabase\r\n\r\n\r\nURI = &quot;neo4j+s://uri:7687&quot;\r\nAUTH = (&quot;usn&quot;, &quot;pwd&quot;)\r\n\r\nclass PlayersNeo4jDatabaseManager:\r\n    def __init__(self):\r\n        try:\r\n            self.driver = GraphDatabase.driver(URI, auth=AUTH)\r\n        except Exception as ex:\r\n            print(ex)\r\n\r\n    def close(self):\r\n        self.driver.close()\r\n\r\n    def get_players_query(self, tx):\r\n        query = &quot;MATCH (p:Player) RETURN p LIMIT 1;&quot;\r\n        players = tx.run(query)\r\n        for player in players:\r\n            print(player)\r\n\r\n    def get_players(self):\r\n        with self.driver.session(database=&quot;neo4j&quot;) as session:\r\n            session.read_transaction(self.get_players_query)\r\n\r\nplayersNeo4jDatabaseManager = PlayersNeo4jDatabaseManager()\r\nplayersNeo4jDatabaseManager.get_players()\r\n```\r\n\r\nI tried neo4j://, neo4j+ssc, and bolt, but it did not work.","link":"https://stackoverflow.com/questions/79300646/why-did-it-fail-when-trying-to-connect-to-a-neo4j-database-in-python-using-pytho","title":"Why did it fail when trying to connect to a Neo4j database in Python using PythonAnywhere?"},{"tags":["graph","neo4j","cypher"],"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1735063816,"post_id":79298084,"comment_id":139848972,"link":"https://stackoverflow.com/questions/79298084/incremental-cound-of-child-nodes-in-neo4j#comment139848972_79298084"}],"answers":[{"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1734980353,"creation_date":1734980353,"answer_id":79303976,"question_id":79298084,"share_link":"https://stackoverflow.com/a/79303976","body_markdown":"In your `WITH` clause, `e` `r` and `ep` all act as grouping keys, and `COUNT(r)` will always return 1. To get the correct count, you need to group only on `e`.\r\n\r\nTo do this, and assuming you need to keep your `RETURN` as is, you can (1) aggregate all `r` and `ep` per `e` with `COLLECT`, (2) count the number of `ep` in  the collection of `r` with `size` and set the property `nr` to that value (3) `UNWIND` each collection to get each report on a separate row: \r\n\r\n```\r\nMATCH (e:Employee {name: &quot;john doe&quot;}) \r\nOPTIONAL MATCH (e)&lt;-[r:REPORTS_TO*]-(ep:Employee) \r\nWITH e, COLLECT(r) AS rs, COLLECT(ep) AS eps\r\nWITH *, size(rs) AS nr \r\nSET e.nr = nr\r\nWITH *\r\nUNWIND rs AS r \r\nUNWIND eps AS ep \r\nRETURN e, nr, r, ep\r\n```","link":"https://stackoverflow.com/questions/79298084/incremental-cound-of-child-nodes-in-neo4j/79303976#79303976","title":"Incremental cound of child nodes in neo4j"}],"owner":{"reputation":5823,"user_id":323129,"user_type":"registered","accept_rate":90,"profile_image":"https://www.gravatar.com/avatar/df837a3ae490227608cc38a7c9edfc7a?s=256&d=identicon&r=PG","display_name":"filippo","link":"https://stackoverflow.com/users/323129/filippo"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":32,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1734980353,"creation_date":1734718431,"question_id":79298084,"share_link":"https://stackoverflow.com/q/79298084","body_markdown":"My schema has ```employee``` nodes and ```reports_to``` relations.\r\n\r\nId like a cypher that adds a property for each node with with the number of nodes that report_to, considering all subnodes\r\n\r\nThis is my current attempt, but is not returning correcrly\r\n\r\n    MATCH (e:Employee {name: &quot;jhon doe&quot;})\r\n    OPTIONAL MATCH (e)&lt;-[r:REPORTS_TO*]-(ep:Employee)\r\n    WITH e, COUNT(r) AS nr, r, ep\r\n    SET e.nr = nr\r\n    RETURN e, nr, r, ep\r\n\r\nin my sample data the root node should count 250 but is only returning 1","link":"https://stackoverflow.com/questions/79298084/incremental-cound-of-child-nodes-in-neo4j","title":"Incremental cound of child nodes in neo4j"},{"tags":["neo4j","cypher"],"comments":[{"owner":{"reputation":32497,"user_id":4390160,"user_type":"registered","accept_rate":100,"profile_image":"https://lh4.googleusercontent.com/-ZHp9yDMYiGI/AAAAAAAAAAI/AAAAAAAAEsg/B9aVO59CDXU/s256-rj/photo.jpg","display_name":"Grismar","link":"https://stackoverflow.com/users/4390160/grismar"},"edited":false,"score":0,"creation_date":1734052453,"post_id":79274292,"comment_id":139796011,"link":"https://stackoverflow.com/questions/79274292/how-to-find-the-deepest-path-with-maximum-value-for-each-layer-of-relationship-i#comment139796011_79274292"},{"owner":{"reputation":133,"user_id":3081187,"user_type":"registered","profile_image":"https://i.sstatic.net/a1RaO.jpg?s=256","display_name":"ZhaiShang","link":"https://stackoverflow.com/users/3081187/zhaishang"},"reply_to_user":{"reputation":32497,"user_id":4390160,"user_type":"registered","accept_rate":100,"profile_image":"https://lh4.googleusercontent.com/-ZHp9yDMYiGI/AAAAAAAAAAI/AAAAAAAAEsg/B9aVO59CDXU/s256-rj/photo.jpg","display_name":"Grismar","link":"https://stackoverflow.com/users/4390160/grismar"},"edited":false,"score":0,"creation_date":1734054497,"post_id":79274292,"comment_id":139796113,"link":"https://stackoverflow.com/questions/79274292/how-to-find-the-deepest-path-with-maximum-value-for-each-layer-of-relationship-i#comment139796113_79274292"},{"owner":{"reputation":133,"user_id":3081187,"user_type":"registered","profile_image":"https://i.sstatic.net/a1RaO.jpg?s=256","display_name":"ZhaiShang","link":"https://stackoverflow.com/users/3081187/zhaishang"},"reply_to_user":{"reputation":32497,"user_id":4390160,"user_type":"registered","accept_rate":100,"profile_image":"https://lh4.googleusercontent.com/-ZHp9yDMYiGI/AAAAAAAAAAI/AAAAAAAAEsg/B9aVO59CDXU/s256-rj/photo.jpg","display_name":"Grismar","link":"https://stackoverflow.com/users/4390160/grismar"},"edited":false,"score":0,"creation_date":1734055882,"post_id":79274292,"comment_id":139796159,"link":"https://stackoverflow.com/questions/79274292/how-to-find-the-deepest-path-with-maximum-value-for-each-layer-of-relationship-i#comment139796159_79274292"},{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1734199405,"post_id":79274292,"comment_id":139803533,"link":"https://stackoverflow.com/questions/79274292/how-to-find-the-deepest-path-with-maximum-value-for-each-layer-of-relationship-i#comment139803533_79274292"},{"owner":{"reputation":133,"user_id":3081187,"user_type":"registered","profile_image":"https://i.sstatic.net/a1RaO.jpg?s=256","display_name":"ZhaiShang","link":"https://stackoverflow.com/users/3081187/zhaishang"},"reply_to_user":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1734310078,"post_id":79274292,"comment_id":139807731,"link":"https://stackoverflow.com/questions/79274292/how-to-find-the-deepest-path-with-maximum-value-for-each-layer-of-relationship-i#comment139807731_79274292"}],"owner":{"reputation":133,"user_id":3081187,"user_type":"registered","profile_image":"https://i.sstatic.net/a1RaO.jpg?s=256","display_name":"ZhaiShang","link":"https://stackoverflow.com/users/3081187/zhaishang"},"last_editor":{"reputation":133,"user_id":3081187,"user_type":"registered","profile_image":"https://i.sstatic.net/a1RaO.jpg?s=256","display_name":"ZhaiShang","link":"https://stackoverflow.com/users/3081187/zhaishang"},"comment_count":5,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":49,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":0,"score":1,"last_activity_date":1734074568,"creation_date":1733991663,"last_edit_date":1734074568,"question_id":79274292,"share_link":"https://stackoverflow.com/q/79274292","body_markdown":"For a given group of nodes, for each node, find its deepest path for relation `R`. The relation R has a property called `weight`. Also, for each layer of relations, always select the relation with the max `weight` value. Then return the start node, second last node and the last node for each path.\r\n\r\nI could only write this following code,I do not know how to implement the maximum value part:\r\n```\r\nwith [&#39;abc&#39;,&#39;def&#39;,&#39;wqe&#39;] as names\r\n\r\nmatch p=(A)-[:R*0..]-&gt;(B)-[:R]-&gt;(C)\r\nwhere A.name in names and xxx \r\nreturn A.name,B.name,C.name\r\n```\r\n\r\nFor example,\r\n```\r\nA-[r1:R]-&gt;B-[r2:R]-&gt;C-[r3:R]-&gt;D\r\nA-[r1:R]-&gt;B-[r2:R]-&gt;C-[r6:R]-&gt;K\r\nA-[r4:R]-&gt;E-[r5:R]-&gt;F\r\n```\r\n```\r\nr1.weight is 20\r\nr2.weight is 30\r\nr3.weight is 40\r\nr4.weight is 10\r\nr5.weight is 80\r\nr6.weight is 70\r\n```\r\n\r\nFor the first layer, because r1.weight&gt;r4.weight, so r1.weight is the maximum value, so we go for `A-[r1:R]-&gt;B`. So we can just ignore `A-[r4:R]-&gt;E-[r5:R]-&gt;F`\r\n\r\nFor the second layer, r2.weight is the maximum value, keep going.\r\n\r\nFor the third layer, r3.weight&lt;r6.weight, so r6.weight is the maximum value.\r\n\r\nSo finally the `A-[r1:R]-&gt;B-[r2:R]-&gt;C-[r6:R]-&gt;K` is the path we want, and return `A,C,K`. Then perform the same process for the rest of the nodes in the `names` list.\r\n\r\nEach layer&#39;s relation weight is evaluated independently. Only the relations within the same layer (i.e., from the same source node) are compared, and the one with the maximum weight is selected. Cross-layer or cross-branch comparisons do not occur. For example, we only compare (r1 and r4) or (r3 and r6), we do not compare (r1 and r2) or (r1 and r5)\r\n\r\nDoes anyone know how to solve this problem? I know `apoc` plugin may solve this, but I am not good at it. ","link":"https://stackoverflow.com/questions/79274292/how-to-find-the-deepest-path-with-maximum-value-for-each-layer-of-relationship-i","title":"How to find the deepest path with maximum value for each layer of relationship in Neo4j?"},{"tags":["database","neo4j","graph-databases"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1733882451,"creation_date":1733882451,"answer_id":79270285,"question_id":79270029,"share_link":"https://stackoverflow.com/a/79270285","body_markdown":"To get all the outgoing `KNOWS` paths from that specific `Person`, you can do a [variable-length relationship](https://neo4j.com/docs/cypher-manual/current/patterns/reference/#variable-length-relationships) search:\r\n\r\n    MATCH p=(a:Person {name: &#39;node3&#39;})-[:KNOWS*]-&gt;(b)\r\n    RETURN p\r\n\r\nHowever, best practice is to put a reasonable upper bound on the path length to avoid running out of memory or taking forever. For example, to set an upper bound of 7 steps from the starting node:\r\n\r\n    MATCH p=(a:Person {name: &#39;node3&#39;})-[:KNOWS*..7]-&gt;(b)\r\n    RETURN p","link":"https://stackoverflow.com/questions/79270029/neo4j-how-to-get-all-the-nodes-eventually-connected-to-a-give-node/79270285#79270285","title":"neo4j how to get all the nodes eventually connected to a give node?"}],"owner":{"reputation":833,"user_id":3822038,"user_type":"registered","accept_rate":67,"profile_image":"https://www.gravatar.com/avatar/d246d972a6e92c2a9067c2906dc17404?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"echo","link":"https://stackoverflow.com/users/3822038/echo"},"last_editor":{"reputation":833,"user_id":3822038,"user_type":"registered","accept_rate":67,"profile_image":"https://www.gravatar.com/avatar/d246d972a6e92c2a9067c2906dc17404?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"echo","link":"https://stackoverflow.com/users/3822038/echo"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":58,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79270285,"answer_count":1,"score":0,"last_activity_date":1733882451,"creation_date":1733870960,"last_edit_date":1733871575,"question_id":79270029,"share_link":"https://stackoverflow.com/q/79270029","body_markdown":"I am not trying to get all the connected nodes, \r\nwhen I run \r\n`MATCH (n:Person) RETURN n LIMIT 200`\r\nI can see all my nodes and relationships are separated to three groups, \r\n\r\n[![enter image description here][1]][1]\r\n\r\nI am trying to find all the nodes connected to a given node (through 1 or multiple relationships), like if I give node3 which is in the center of the bottom right group, can I get back all the nodes in group three? \r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\nso I tried \r\n\r\n    MATCH p=(a:Person {name:&#39;node3&#39;})-[:KNOWS]-&gt;(b) return p\r\nbut it only returns the node immediately connected to node3, is there anyway we can get all the nodes like shown in group3? \r\n\r\n\r\n[![enter image description here][3]][3]\r\n\r\n\r\n  [1]: https://i.sstatic.net/jyexY1YF.png\r\n  [2]: https://i.sstatic.net/lG1V6dl9.png\r\n  [3]: https://i.sstatic.net/A3FvvP8J.png","link":"https://stackoverflow.com/questions/79270029/neo4j-how-to-get-all-the-nodes-eventually-connected-to-a-give-node","title":"neo4j how to get all the nodes eventually connected to a give node?"},{"tags":["neo4j","cypher"],"comments":[{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"edited":false,"score":0,"creation_date":1733864915,"post_id":79269759,"comment_id":139782902,"link":"https://stackoverflow.com/questions/79269759/neo4j-query-on-the-equality-of-two-properties-of-two-nodes-of-the-same-label#comment139782902_79269759"},{"owner":{"reputation":11,"user_id":24780160,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/d477be8f38b372125a5f3c1ce2cca8ea?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Gwayns","link":"https://stackoverflow.com/users/24780160/gwayns"},"reply_to_user":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"edited":false,"score":0,"creation_date":1733865402,"post_id":79269759,"comment_id":139782934,"link":"https://stackoverflow.com/questions/79269759/neo4j-query-on-the-equality-of-two-properties-of-two-nodes-of-the-same-label#comment139782934_79269759"},{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"edited":false,"score":0,"creation_date":1733868862,"post_id":79269759,"comment_id":139783135,"link":"https://stackoverflow.com/questions/79269759/neo4j-query-on-the-equality-of-two-properties-of-two-nodes-of-the-same-label#comment139783135_79269759"}],"owner":{"reputation":11,"user_id":24780160,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/d477be8f38b372125a5f3c1ce2cca8ea?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Gwayns","link":"https://stackoverflow.com/users/24780160/gwayns"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":34,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1733863632,"creation_date":1733863632,"question_id":79269759,"share_link":"https://stackoverflow.com/q/79269759","body_markdown":"First of all I&#39;m sorry if a similar question has already been answered, but I haven&#39;t been able to find one.\r\nI&#39;m very new to neo4j, it&#39;s my first time using it and my teacher kind of let us fend for ourselves and I have a project where I must built a small database in both SQL and neo4j, and I&#39;m having trouble &quot;translating&quot; my queries from SQL to cypher.\r\n\r\nMy database has 5 node labels that correspond to their table counterpart in SQL : verb, noun, semantic class and two others which aren&#39;t involved here (It&#39;s complicated but it&#39;s a database on the semantic category of noun and verbs) \r\n\r\nEach noun and each verb has a semantic class and has a morphological root. Each semantic class has different properties including the one I&#39;m asking about : &quot;macrocategory&quot;. Because different semantic classes can have the same macrocategory.The verbs and the nouns cannot share a semantic class so there&#39;s no node related to both a verb and a noun.\r\nSo I have these relationships :\r\n(:Verbs)-[IS_A]-&gt;(:Semantic_class)\r\n(:Nouns)-[IS_A]-&gt;(:Semantic_class)\r\n\r\nI&#39;m trying to make a query to return the nouns and verbs which have the same root and have the same macrocategory.\r\nHere&#39;s what I tried to do : \r\n\r\n```\r\nMATCH (n:Noms),(v:Verbes) WHERE n.racine = v.racine \r\nWITH n,v \r\nMATCH (n)-[EST_UN]-&gt;(c:Cat&#233;gorie_S&#233;mantique), (v)-[EST_UN]-&gt;(d:Cat&#233;gorie_S&#233;mantique) \r\nWHERE c.macrocat&#233;gorie = d.macrocat&#233;gorie \r\nRETURN n,v\r\n```\r\nIt&#39;s in french but noms = nouns, racine = root, est_un = is_a, cat&#233;gorie_s&#233;mantique = semantic class, and the rest is self explanatory I think.\r\n\r\nThe query returns no error but returns nothing at all.\r\n\r\nThank you so much for reading and for your help.","link":"https://stackoverflow.com/questions/79269759/neo4j-query-on-the-equality-of-two-properties-of-two-nodes-of-the-same-label","title":"Neo4j query on the equality of two properties of two nodes of the same label"},{"tags":["java","spring-boot","neo4j","spring-data","neo4j-spatial"],"comments":[{"owner":{"reputation":17300,"user_id":10871900,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/720202b6e19abc330dcd92e6a1254562?s=256&d=identicon&r=PG","display_name":"dan1st","link":"https://stackoverflow.com/users/10871900/dan1st"},"edited":false,"score":0,"creation_date":1733663710,"post_id":79262482,"comment_id":139769595,"link":"https://stackoverflow.com/questions/79262482/exception-during-call-spatial-addnode-no-such-property-longitude#comment139769595_79262482"},{"owner":{"reputation":11,"user_id":28682920,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/9e804b9992724cf567cd5385511b9933?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Игорь Смолка","link":"https://stackoverflow.com/users/28682920/%d0%98%d0%b3%d0%be%d1%80%d1%8c-%d0%a1%d0%bc%d0%be%d0%bb%d0%ba%d0%b0"},"reply_to_user":{"reputation":17300,"user_id":10871900,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/720202b6e19abc330dcd92e6a1254562?s=256&d=identicon&r=PG","display_name":"dan1st","link":"https://stackoverflow.com/users/10871900/dan1st"},"edited":false,"score":0,"creation_date":1733668325,"post_id":79262482,"comment_id":139769820,"link":"https://stackoverflow.com/questions/79262482/exception-during-call-spatial-addnode-no-such-property-longitude#comment139769820_79262482"},{"owner":{"reputation":11,"user_id":28682920,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/9e804b9992724cf567cd5385511b9933?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Игорь Смолка","link":"https://stackoverflow.com/users/28682920/%d0%98%d0%b3%d0%be%d1%80%d1%8c-%d0%a1%d0%bc%d0%be%d0%bb%d0%ba%d0%b0"},"reply_to_user":{"reputation":17300,"user_id":10871900,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/720202b6e19abc330dcd92e6a1254562?s=256&d=identicon&r=PG","display_name":"dan1st","link":"https://stackoverflow.com/users/10871900/dan1st"},"edited":false,"score":0,"creation_date":1733668449,"post_id":79262482,"comment_id":139769827,"link":"https://stackoverflow.com/questions/79262482/exception-during-call-spatial-addnode-no-such-property-longitude#comment139769827_79262482"}],"owner":{"reputation":11,"user_id":28682920,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/9e804b9992724cf567cd5385511b9933?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Игорь Смолка","link":"https://stackoverflow.com/users/28682920/%d0%98%d0%b3%d0%be%d1%80%d1%8c-%d0%a1%d0%bc%d0%be%d0%bb%d0%ba%d0%b0"},"last_editor":{"reputation":11,"user_id":28682920,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/9e804b9992724cf567cd5385511b9933?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Игорь Смолка","link":"https://stackoverflow.com/users/28682920/%d0%98%d0%b3%d0%be%d1%80%d1%8c-%d0%a1%d0%bc%d0%be%d0%bb%d0%ba%d0%b0"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":63,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":0,"score":1,"last_activity_date":1733668430,"creation_date":1733662323,"last_edit_date":1733668430,"question_id":79262482,"share_link":"https://stackoverflow.com/q/79262482","body_markdown":"I use Neo4j 5.25 and write an application with Spring Data + Neo4j + Spatial extension.\r\nI get an exception when calling spatial.addNode.\r\n\r\nCreated a pointLayer via migration.\r\n\r\n```\r\nCALL spatial.addPointLayer(&#39;wayPoints&#39;);\r\n```\r\n\r\n```\r\n@Repository\r\npublic interface WayPointRepository extends Neo4jRepository&lt;WayPoint, String&gt; {\r\n\r\n    @Query(value = &quot;&quot;&quot;\r\n            CREATE (w:WayPoint {parentId: $wayPoint.parentId, level:$wayPoint.level, latitude:$wayPoint.latitude, longitude:$wayPoint.longitude, tags: $wayPoint.tags})\r\n            WITH w\r\n            CALL spatial.addNode(&#39;wayPoints&#39;, w) YIELD node\r\n            RETURN node\r\n            &quot;&quot;&quot;)\r\n    void saveWithIndexation(@Param(&quot;wayPoint&quot;) WayPoint wayPoint);\r\n}\r\n```\r\n\r\nThe &quot;saveWithIndexation&quot; method must create a node and add it to the index (layer &quot;wayPoints&quot;).\r\nThe structure of the query matches the example shown here.\r\nhttps://neo4j.com/labs/neo4j-spatial/5/overview/introduction/\r\n\r\nBut I get an exception:\r\n\r\norg.neo4j.driver.exceptions.ClientException: Failed to invoke procedure `spatial.addNode`: Caused by: org.neo4j.graphdb.NotFoundException: No such property, &#39;longitude&#39;.\r\nat org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:108) \\~\\[neo4j-java-driver-5.23.0.jar:5.23.0-9b266bcb3c88c01e72d7c925b7c9647b45f5027d\\]\r\nat org.neo4j.driver.internal.InternalResult.blockingGet(InternalResult.java:109) \\~\\[neo4j-java-driver-5.23.0.jar:5.23.0-9b266bcb3c88c01e72d7c925b7c9647b45f5027d\\]\r\nat org.neo4j.driver.internal.InternalResult.hasNext(InternalResult.java:51) \\~\\[neo4j-java-driver-5.23.0.jar:5.23.0-9b266bcb3c88c01e72d7c925b7c9647b45f5027d\\]\r\nat org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.one(DefaultNeo4jClient.java:443) \\~\\[spring-data-neo4j-7.3.3.jar:7.3.3\\]\r\nat java.base/java.util.Optional.flatMap(Optional.java:289) \\~\\[na:na\\]\r\nat org.springframework.data.neo4j.core.Neo4jTemplate$DefaultExecutableQuery.lambda$getSingleResult$3(Neo4jTemplate.java:1279) \\~\\[spring-data-neo4j-7.3.3.jar:7.3.3\\]\r\nat org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) \\~\\[spring-tx-6.1.12.jar:6.1.12\\]\r\nat org.springframework.data.neo4j.core.Neo4jTemplate$DefaultExecutableQuery.getSingleResult(Neo4jTemplate.java:1277) \\~\\[spring-data-neo4j-7.3.3.jar:7.3.3\\]\r\nat org.springframework.data.neo4j.repository.query.Neo4jQueryExecution$DefaultQueryExecution.execute(Neo4jQueryExecution.java:53) \\~\\[spring-data-neo4j-7.3.3.jar:7.3.3\\]\r\nat org.springframework.data.neo4j.repository.query.AbstractNeo4jQuery.execute(AbstractNeo4jQuery.java:93) \\~\\[spring-data-neo4j-7.3.3.jar:7.3.3\\]\r\nat org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170) \\~\\[spring-data-commons-3.3.3.jar:3.3.3\\]\r\nat org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158) \\~\\[spring-data-commons-3.3.3.jar:3.3.3\\]\r\nat org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:169) \\~\\[spring-data-commons-3.3.3.jar:3.3.3\\]\r\nat org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:148) \\~\\[spring-data-commons-3.3.3.jar:3.3.3\\]\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) \\~\\[spring-aop-6.1.12.jar:6.1.12\\]\r\nat org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70) \\~\\[spring-data-commons-3.3.3.jar:3.3.3\\]\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) \\~\\[spring-aop-6.1.12.jar:6.1.12\\]\r\nat org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:379) \\~\\[spring-tx-6.1.12.jar:6.1.12\\]\r\nat org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) \\~\\[spring-tx-6.1.12.jar:6.1.12\\]\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) \\~\\[spring-aop-6.1.12.jar:6.1.12\\]\r\nat org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138) \\~\\[spring-tx-6.1.12.jar:6.1.12\\]\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) \\~\\[spring-aop-6.1.12.jar:6.1.12\\]\r\nat org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) \\~\\[spring-aop-6.1.12.jar:6.1.12\\]\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) \\~\\[spring-aop-6.1.12.jar:6.1.12\\]\r\nat org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223) \\~\\[spring-aop-6.1.12.jar:6.1.12\\]\r\nat jdk.proxy2/jdk.proxy2.$Proxy77.saveWithIndexation(Unknown Source) \\~\\[na:na\\]\r\n\r\nBut I specified such properties (longitude, latitude) in the query?\r\nCan anyone tell me what the problem might be?\r\nThank you.\r\n\r\nupd\r\nhere is my model\r\n\r\n```\r\n@Node(&quot;WayPoint&quot;)\r\n@NoArgsConstructor\r\n@AllArgsConstructor\r\n@Data\r\npublic class WayPoint {\r\n\r\n    @Id\r\n    @GeneratedValue\r\n    private String id;\r\n\r\n    private String parentId;\r\n\r\n    private WayPointLevel level;\r\n\r\n    private Double latitude;\r\n\r\n    private Double longitude;\r\n\r\n    private List&lt;String&gt; tags;\r\n\r\n}\r\n```","link":"https://stackoverflow.com/questions/79262482/exception-during-call-spatial-addnode-no-such-property-longitude","title":"exception during call &quot;spatial.addNode&quot;: no such property &quot;longitude&quot;"},{"tags":["neo4j"],"comments":[{"owner":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"edited":false,"score":0,"creation_date":1733528011,"post_id":79257350,"comment_id":139764416,"link":"https://stackoverflow.com/questions/79257350/neo4j-vector-search-out-of-memory-issue#comment139764416_79257350"},{"owner":{"reputation":451,"user_id":14524588,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a035acee434d02ebd2e76ec8e5b67dce?s=256&d=identicon&r=PG","display_name":"py-r","link":"https://stackoverflow.com/users/14524588/py-r"},"reply_to_user":{"reputation":12742,"user_id":7371893,"user_type":"registered","profile_image":"https://i.sstatic.net/Ris3Z.png?s=256","display_name":"jose_bacoy","link":"https://stackoverflow.com/users/7371893/jose-bacoy"},"edited":false,"score":0,"creation_date":1733579766,"post_id":79257350,"comment_id":139766235,"link":"https://stackoverflow.com/questions/79257350/neo4j-vector-search-out-of-memory-issue#comment139766235_79257350"}],"owner":{"reputation":451,"user_id":14524588,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a035acee434d02ebd2e76ec8e5b67dce?s=256&d=identicon&r=PG","display_name":"py-r","link":"https://stackoverflow.com/users/14524588/py-r"},"last_editor":{"reputation":451,"user_id":14524588,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a035acee434d02ebd2e76ec8e5b67dce?s=256&d=identicon&r=PG","display_name":"py-r","link":"https://stackoverflow.com/users/14524588/py-r"},"comment_count":2,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":155,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1733579839,"creation_date":1733474759,"last_edit_date":1733579839,"question_id":79257350,"share_link":"https://stackoverflow.com/q/79257350","body_markdown":"I&#39;d like to use the handy vector embeddings in Neo4j, but I&#39;m getting an issue already with a simple case when searching on them. Thanks for your support !\r\n\r\nQuery\r\n\r\n```\r\nMATCH (n:Node)\r\nCALL db.index.vector.queryNodes(&#39;value_index&#39;, 5, [1.0,2.0,3.0,4.0])\r\nYIELD node, score\r\nRETURN node, score\r\n```\r\n\r\nError\r\n\r\n```\r\nFailed to execute &#39;postMessage&#39; on &#39;DedicatedWorkerGlobalScope&#39;: Data cannot be cloned, out of memory.\r\n```\r\n\r\nInstance\r\n\r\n```\r\nNb. of nodes in DB: 12048 nodes\r\nAura DB :\r\n- Memory: 1GB\r\n- CPU: 1CPU\r\n- Storage: 2GB\r\n```\r\n\r\nNote\r\n\r\nAll vectors were initialized to `[1.0,2.0,3.0,4.0]`.  \r\nStill, I&#39;m just asking for `5` matches here.\r\n\r\n\r\nThanks !","link":"https://stackoverflow.com/questions/79257350/neo4j-vector-search-out-of-memory-issue","title":"Neo4j - Vector search - Out-of-memory issue"},{"tags":["neo4j","neo4j-desktop"],"answers":[{"comments":[{"owner":{"reputation":12193,"user_id":1814420,"user_type":"registered","accept_rate":59,"profile_image":"https://www.gravatar.com/avatar/f42333f84c7e40dc9335028d6ccb13ca?s=256&d=identicon&r=PG","display_name":"Triet Doan","link":"https://stackoverflow.com/users/1814420/triet-doan"},"edited":false,"score":0,"creation_date":1733492810,"post_id":79245422,"comment_id":139761822,"link":"https://stackoverflow.com/questions/79245293/how-to-create-a-community-edition-database-using-neo4j-desktop/79245422#comment139761822_79245422"},{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"reply_to_user":{"reputation":12193,"user_id":1814420,"user_type":"registered","accept_rate":59,"profile_image":"https://www.gravatar.com/avatar/f42333f84c7e40dc9335028d6ccb13ca?s=256&d=identicon&r=PG","display_name":"Triet Doan","link":"https://stackoverflow.com/users/1814420/triet-doan"},"edited":false,"score":0,"creation_date":1733505221,"post_id":79245422,"comment_id":139762999,"link":"https://stackoverflow.com/questions/79245293/how-to-create-a-community-edition-database-using-neo4j-desktop/79245422#comment139762999_79245422"},{"owner":{"reputation":12193,"user_id":1814420,"user_type":"registered","accept_rate":59,"profile_image":"https://www.gravatar.com/avatar/f42333f84c7e40dc9335028d6ccb13ca?s=256&d=identicon&r=PG","display_name":"Triet Doan","link":"https://stackoverflow.com/users/1814420/triet-doan"},"edited":false,"score":0,"creation_date":1733736843,"post_id":79245422,"comment_id":139773148,"link":"https://stackoverflow.com/questions/79245293/how-to-create-a-community-edition-database-using-neo4j-desktop/79245422#comment139773148_79245422"}],"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":3,"down_vote_count":0,"up_vote_count":0,"is_accepted":true,"score":0,"last_activity_date":1733169214,"creation_date":1733169214,"answer_id":79245422,"question_id":79245293,"share_link":"https://stackoverflow.com/a/79245422","body_markdown":"Neo4j Desktop is is designed to help people work with Neo4j EE. To quote [the docs](https://neo4j.com/docs/desktop-manual/current/installation/):\r\n\r\n&gt; Neo4j Desktop is free to download and includes a Neo4j Enterprise\r\n&gt; Edition Developer license. This gives you access to all the\r\n&gt; capabilities and features of Neo4j Enterprise Edition ...\r\n\r\nAlthough Neo4j Desktop does not help you install Neo4j Community Edition instances, you can still use it to work with an already-installed Neo4j CE instance by [connecting to it via a Remote connection](https://neo4j.com/docs/desktop-manual/current/operations/remote-connect/). ","link":"https://stackoverflow.com/questions/79245293/how-to-create-a-community-edition-database-using-neo4j-desktop/79245422#79245422","title":"How to create a Community Edition database using Neo4j Desktop?"}],"owner":{"reputation":12193,"user_id":1814420,"user_type":"registered","accept_rate":59,"profile_image":"https://www.gravatar.com/avatar/f42333f84c7e40dc9335028d6ccb13ca?s=256&d=identicon&r=PG","display_name":"Triet Doan","link":"https://stackoverflow.com/users/1814420/triet-doan"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":162,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79245422,"answer_count":1,"score":0,"last_activity_date":1733169214,"creation_date":1733166561,"question_id":79245293,"share_link":"https://stackoverflow.com/q/79245293","body_markdown":"All databases created by Neo4j Desktop are in Enterprise Edition. How can I choose Community Edition instead?\r\n\r\nBelow is the screenshot of the software. Whatever version is chosen, the Enterprise Edition is always used.\r\n\r\n[![Neo4j Desktop Screenshot][1]][1]\r\n\r\nDid I miss something? Or it is not possible to use Community Edition via Neo4j Desktop at all?\r\n\r\n  [1]: https://i.sstatic.net/v8BJqGBo.png","link":"https://stackoverflow.com/questions/79245293/how-to-create-a-community-edition-database-using-neo4j-desktop","title":"How to create a Community Edition database using Neo4j Desktop?"},{"tags":["neo4j","gremlin","tinkerpop","gremlinpython"],"comments":[{"owner":{"reputation":270017,"user_id":112968,"user_type":"registered","accept_rate":68,"profile_image":"https://i.sstatic.net/zHTaT.png?s=256","display_name":"knittl","link":"https://stackoverflow.com/users/112968/knittl"},"edited":false,"score":1,"creation_date":1733147969,"post_id":79243826,"comment_id":139737595,"link":"https://stackoverflow.com/questions/79243826/neo4j-cypher-conversion-to-gremlin-query#comment139737595_79243826"},{"owner":{"reputation":1621,"user_id":16598470,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Gj-XzApvAvcP9YhYmOhQHr1_NvIh-E5uYAwub4L=k-s256","display_name":"HadoopMarc","link":"https://stackoverflow.com/users/16598470/hadoopmarc"},"edited":false,"score":0,"creation_date":1733209177,"post_id":79243826,"comment_id":139741312,"link":"https://stackoverflow.com/questions/79243826/neo4j-cypher-conversion-to-gremlin-query#comment139741312_79243826"},{"owner":{"reputation":642,"user_id":6385767,"user_type":"registered","profile_image":"https://graph.facebook.com/1028022830580876/picture?type=large","display_name":"Ravindra Gupta","link":"https://stackoverflow.com/users/6385767/ravindra-gupta"},"reply_to_user":{"reputation":1621,"user_id":16598470,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Gj-XzApvAvcP9YhYmOhQHr1_NvIh-E5uYAwub4L=k-s256","display_name":"HadoopMarc","link":"https://stackoverflow.com/users/16598470/hadoopmarc"},"edited":false,"score":0,"creation_date":1733316163,"post_id":79243826,"comment_id":139749390,"link":"https://stackoverflow.com/questions/79243826/neo4j-cypher-conversion-to-gremlin-query#comment139749390_79243826"}],"owner":{"reputation":642,"user_id":6385767,"user_type":"registered","profile_image":"https://graph.facebook.com/1028022830580876/picture?type=large","display_name":"Ravindra Gupta","link":"https://stackoverflow.com/users/6385767/ravindra-gupta"},"last_editor":{"reputation":270017,"user_id":112968,"user_type":"registered","accept_rate":68,"profile_image":"https://i.sstatic.net/zHTaT.png?s=256","display_name":"knittl","link":"https://stackoverflow.com/users/112968/knittl"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":77,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":0,"score":0,"last_activity_date":1733149657,"creation_date":1733137760,"last_edit_date":1733149657,"question_id":79243826,"share_link":"https://stackoverflow.com/q/79243826","body_markdown":"We are trying to convert the Neo4j cypher query into a Gremlin query, but we are stuck on some extract methods in the cypher query that need to be converted into the Gremlin query.\r\n\r\nThe cypher query that we are trying to convert is as follows:\r\n\r\n```\r\nMATCH (from: `Person` {title: &quot;John&quot;}), (to: `Location` {title: &quot;New York City&quot;})\r\nMATCH p = (from)-[rel*..5]-&gt;(to)\r\nRETURN extract(x IN nodes(p) | x.title) as title,\r\n            extract(i IN relationships(p)| type(i)) as relation,\r\n            extract(j IN nodes(p) | j.nt) as node,\r\n            length(p) as len,\r\n            extract(x IN nodes(p) | x) as node_data,\r\n            extract (i in nodes(p)| id(i)) as id,\r\n            extract(i IN relationships(p)| id(i)) as rel_id,\r\n            extract(rel IN relationships(p) | id(startNode(rel))) as start,\r\n            extract(rel IN relationships(p) | id(endNode(rel))) as end\r\n```\r\n\r\nOutput of the above query as follow:\r\n\r\n```\r\n[\r\n  {\r\n    &quot;title&quot;: [&quot;John&quot;, &quot;new york city&quot;],  // &#39;title&#39; is property of the vertices\r\n    &quot;relation&quot;: [&quot;WORKIGN_AT&quot;],          // Edge label between &#39;person&#39; and &#39;location&#39;\r\n    &quot;node&quot;: [&quot;Person&quot;, &quot;Location&quot;],      // List of labels\r\n    &quot;len&quot;: 1,                            // Node hop between two node label\r\n    &quot;node_data&quot;: [                       // List of node property data (valueMap())\r\n      {\r\n        &quot;Employee_Status&quot;: &quot;Active&quot;,\r\n        &quot;FT_or_PT&quot;: &quot;Full Time&quot;,\r\n        &quot;title&quot;: &quot;john&quot;\r\n      },\r\n      {\r\n        &quot;Office_Type&quot;: &quot;Headquarters&quot;,\r\n        &quot;Mailing_Code&quot;: 10022,\r\n        &quot;ISO_Alpha_Two_Country_Code&quot;: &quot;US&quot;,\r\n        &quot;City&quot;: &quot;New York&quot;,\r\n        &quot;title&quot;: &quot;New York City&quot;,\r\n        &quot;Display&quot;: &quot;New York City&quot;,\r\n        &quot;Name&quot;: &quot;New York City&quot;\r\n      }\r\n    ],\r\n    &quot;id&quot;: [5432,5125],                     // List of node id in the hopes\r\n    &quot;rel_id&quot;: [17409],                     // list of edge id in the hopes \r\n    &quot;start&quot;: [5432],                       // id of from nodes in the hopes\r\n    &quot;end&quot;: [5125]                          // id of to nodes in the l\r\n  }\r\n]\r\n\r\n```\r\nI&#39;m looking for a Gremlin query that can effectively replace the extract method for Neo4j and produce the same output. Your insights would be greatly appreciated.\r\n","link":"https://stackoverflow.com/questions/79243826/neo4j-cypher-conversion-to-gremlin-query","title":"Neo4j Cypher conversion to Gremlin query"},{"tags":["java","neo4j","transactions"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1733189938,"last_edit_date":1733189938,"creation_date":1733189437,"answer_id":79246034,"question_id":79241531,"share_link":"https://stackoverflow.com/a/79246034","body_markdown":"You can commit a batch of node creations per transaction like this:\r\n\r\n    private static final int BATCH_SIZE = 10000;\r\n    \r\n    private void saveNodes(List&lt;Person&gt; people) {\r\n        int count = 0;\r\n        Transaction tx = graphDb.beginTx();\r\n        try {\r\n            for (Person person : people) {\r\n                Node node = tx.createNode(NodeLabel.Person);\r\n                node.setProperty(&quot;id&quot;, person.getId().toString());\r\n                // 10+ properties\r\n\r\n                if (++count % BATCH_SIZE == 0) {\r\n                    tx.commit();\r\n                    tx.close();\r\n                    tx = graphDb.beginTx();\r\n                }\r\n            }\r\n            tx.commit();\r\n        } finally {\r\n            tx.close();\r\n        }\r\n    }","link":"https://stackoverflow.com/questions/79241531/how-to-batch-transaction-in-java-neo4j-api-using-call-in-transactions/79246034#79246034","title":"How to batch transaction in Java Neo4J API using CALL { } IN TRANSACTIONS?"}],"owner":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"last_editor":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":84,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79246034,"answer_count":1,"score":0,"last_activity_date":1733189938,"creation_date":1733055766,"last_edit_date":1733143479,"question_id":79241531,"share_link":"https://stackoverflow.com/q/79241531","body_markdown":"I am developing a Java application using Neo4j version 5.20.0 (```implementation &quot;org.neo4j:neo4j:5.20.0&quot;```) and I want to save a list of Person objects in the database.\r\n\r\nCurrently, I have a method for creating nodes that uses a single large transaction:\r\n\r\n```\r\nprivate void saveNodes(List&lt;Person&gt; people) {\r\n    try (Transaction tx = graphDb.beginTx()) {\r\n        for (Person person : people) {\r\n            Node node = tx.createNode(NodeLabel.Person);\r\n            node.setProperty(&quot;id&quot;, person.getId().toString());\r\n            // 10+ properties\r\n        }\r\n        tx.commit();\r\n    }\r\n}\r\n```\r\nHowever, I am saving a large number of nodes, and during the operation, I encounter the following error:\r\n\r\n```\r\nCaused by: org.neo4j.memory.MemoryLimitExceededException: The allocation of an extra 2.0 MiB would use more than the limit 11.1 GiB. Currently using 11.1 GiB. dbms.memory.transaction.total.max threshold reached\r\n```\r\n\r\nI understand that this is related to the data volume and transaction size.\r\n\r\nMy goal is to break this process into smaller transactions to avoid such issues. I know that in Cypher there is a CALL { ... } IN TRANSACTIONS statement that allows processing data in batches.\r\n\r\nIs it possible to implement a similar logic in Java code? If so, how can I do that?\r\n\r\n","link":"https://stackoverflow.com/questions/79241531/how-to-batch-transaction-in-java-neo4j-api-using-call-in-transactions","title":"How to batch transaction in Java Neo4J API using CALL { } IN TRANSACTIONS?"},{"tags":["python","neo4j","pipeline","knowledge-graph"],"owner":{"reputation":11,"user_id":22970329,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/86689b502c6c70720ca417e7287f2191?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Aravind_Sagar","link":"https://stackoverflow.com/users/22970329/aravind-sagar"},"last_editor":{"reputation":11,"user_id":22970329,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/86689b502c6c70720ca417e7287f2191?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Aravind_Sagar","link":"https://stackoverflow.com/users/22970329/aravind-sagar"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":64,"favorite_count":0,"down_vote_count":0,"up_vote_count":1,"answer_count":0,"score":1,"last_activity_date":1732796646,"creation_date":1732795162,"last_edit_date":1732796646,"question_id":79233806,"share_link":"https://stackoverflow.com/q/79233806","body_markdown":"I&#39;m building a pipeline to extract a knowledge graph from Program source files using neo4j-graphrag. While executing the pipeline, I&#39;m encountering the following error:\r\n\r\n    ERROR - Error during pipeline execution: Unexpected response type: &lt;class &#39;neo4j_graphrag.experimental.pipeline.pipeline.PipelineResult&#39;&gt;\r\nTraceback (most recent call last):\r\n  File &quot;path_to_script.py&quot;, line 189, in define_and_run_pipeline\r\n    raise ValueError(f&quot;Unexpected response type: {type(response)}&quot;)\r\nValueError: Unexpected response type: &lt;class &#39;neo4j_graphrag.experimental.pipeline.pipeline.PipelineResult&#39;&gt;\r\n\r\n\r\n**Relevant Code**\r\nHere is the relevant portion of my code:\r\n\r\n    async def define_and_run_pipeline(neo4j_driver, llm, text):\r\n    try:\r\n        kg_builder = SimpleKGPipeline(\r\n            llm=llm,\r\n            driver=neo4j_driver,\r\n            embedder=SentenceTransformerEmbeddings(),\r\n            entities=[&quot;File&quot;, &quot;Variable&quot;, &quot;Paragraph&quot;, &quot;Section&quot;],\r\n            relations=[&quot;CONTAINS&quot;, &quot;USED_IN&quot;, &quot;CALLS&quot;],\r\n            potential_schema=[\r\n                (&quot;File&quot;, &quot;CONTAINS&quot;, &quot;Section&quot;),\r\n                (&quot;Section&quot;, &quot;CONTAINS&quot;, &quot;Paragraph&quot;),\r\n                (&quot;Paragraph&quot;, &quot;CONTAINS&quot;, &quot;Variable&quot;),\r\n                (&quot;File&quot;, &quot;CALLS&quot;, &quot;Paragraph&quot;),\r\n            ],\r\n            from_pdf=False,\r\n        )\r\n        response = await kg_builder.run_async(text=text)\r\n\r\n        if isinstance(response, list):\r\n            processed_response = &quot; &quot;.join([item.text for item in response if hasattr(item, &quot;text&quot;)])\r\n        elif isinstance(response, str):\r\n            processed_response = response\r\n        else:\r\n            raise ValueError(f&quot;Unexpected response type: {type(response)}&quot;)\r\n\r\n        return processed_response\r\n\r\n    except Exception as e:\r\n        logger.error(f&quot;Error during pipeline execution: {e}&quot;)\r\n        raise\r\n\r\n**What I Tried**\r\nDebugging the response: I checked the type of response returned by kg_builder.run_async() and confirmed it&#39;s of type PipelineResult.\r\nDocumentation: I reviewed the neo4j-graphrag documentation but couldn&#39;t find details on how to handle PipelineResult.\r\n\r\n**Question**\r\nHow should I handle the PipelineResult object returned by SimpleKGPipeline.run_async()?\r\nIs there a standard way to process or convert PipelineResult into a format that I can work with (e.g., a string or dictionary)?\r\n\r\n**Desired Outcome**\r\nI want to process the PipelineResult object and extract the enriched knowledge graph data so it can be stored in Neo4j or further analyzed.","link":"https://stackoverflow.com/questions/79233806/valueerror-unexpected-response-type-class-pipelineresult-when-using-neo4j","title":"ValueError: Unexpected response type: &lt;class &#39;PipelineResult&#39;&gt; when using Neo4j Graphrag SimpleKGPipeline"},{"tags":["neo4j","cypher","neo4j-gds"],"comments":[{"owner":{"reputation":558,"user_id":2259302,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/aff4a398f6f272cbdb4dab0c4df4f3b2?s=256&d=identicon&r=PG","display_name":"H&#229;kan L&#246;fqvist","link":"https://stackoverflow.com/users/2259302/h%c3%a5kan-l%c3%b6fqvist"},"edited":false,"score":0,"creation_date":1732780239,"post_id":79231306,"comment_id":139718083,"link":"https://stackoverflow.com/questions/79231306/how-to-project-a-path-in-neo4j-for-topological-sorting#comment139718083_79231306"},{"owner":{"reputation":3,"user_id":16713325,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GgChbQQYE4dIKtJJ9NgWJpBay1bzzAUq53z-SwQhQ=k-s256","display_name":"Mohammed Hijazi","link":"https://stackoverflow.com/users/16713325/mohammed-hijazi"},"reply_to_user":{"reputation":558,"user_id":2259302,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/aff4a398f6f272cbdb4dab0c4df4f3b2?s=256&d=identicon&r=PG","display_name":"H&#229;kan L&#246;fqvist","link":"https://stackoverflow.com/users/2259302/h%c3%a5kan-l%c3%b6fqvist"},"edited":false,"score":0,"creation_date":1732827804,"post_id":79231306,"comment_id":139722292,"link":"https://stackoverflow.com/questions/79231306/how-to-project-a-path-in-neo4j-for-topological-sorting#comment139722292_79231306"}],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":true,"score":0,"last_activity_date":1733257658,"creation_date":1733257658,"answer_id":79249088,"question_id":79231306,"share_link":"https://stackoverflow.com/a/79249088","body_markdown":"You need to pass every adjacent pair of nodes in the path(s), not just the first and last node. This should work for you:\r\n\r\n    MATCH (:Package{name: &#39;neofetch&#39;})-[rels:DEPENDS_ON*]-&gt;(:Leaf)\r\n    UNWIND rels AS r\r\n    WITH DISTINCT r\r\n    RETURN gds.graph.project(&quot;g&quot;, STARTNODE(r), ENDNODE(r))","link":"https://stackoverflow.com/questions/79231306/how-to-project-a-path-in-neo4j-for-topological-sorting/79249088#79249088","title":"How to Project a path in NEO4J for topological sorting?"}],"owner":{"reputation":3,"user_id":16713325,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GgChbQQYE4dIKtJJ9NgWJpBay1bzzAUq53z-SwQhQ=k-s256","display_name":"Mohammed Hijazi","link":"https://stackoverflow.com/users/16713325/mohammed-hijazi"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":2,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":88,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79249088,"answer_count":1,"score":0,"last_activity_date":1733257658,"creation_date":1732728373,"last_edit_date":1732740671,"question_id":79231306,"share_link":"https://stackoverflow.com/q/79231306","body_markdown":"I am making a package manager using a neo4j database with packages as nodes and DEPENDS_ON relationships. To build package `A`, I first need to build packages `B` and `C`, for example. And to do that I need to do a topological sort, but IDK how to project the paths using `gds.graph.project()`.\r\n\r\nHere is how I get the paths that I need to project:\r\n\r\n```\r\nMATCH path = (n:Package{name: &#39;neofetch&#39;})-[r:DEPENDS_ON*]-&gt;(l:Leaf)\r\n```\r\n\r\nI project the above path to a GDS graph using:\r\n\r\n```\r\nRETURN gds.graph.project(&quot;g&quot;, n, l, {})\r\n```\r\n\r\nand then do topological sort:\r\n\r\n```\r\nCALL gds.dag.topologicalSort.stream(&quot;g&quot;, {computeMaxDistanceFromSource: true})\r\nYIELD nodeId, maxDistanceFromSource\r\nRETURN gds.util.asNode(nodeId).name AS name, maxDistanceFromSource\r\nORDER BY maxDistanceFromSource, name\r\n```\r\n\r\nThe result is only the first node and last nodes no intermediate nodes appear in the sort.","link":"https://stackoverflow.com/questions/79231306/how-to-project-a-path-in-neo4j-for-topological-sorting","title":"How to Project a path in NEO4J for topological sorting?"},{"tags":["python","neo4j","knowledge-graph","claude","graphrag"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":false,"score":1,"last_activity_date":1732670820,"last_edit_date":1732670820,"creation_date":1732668988,"answer_id":79228673,"question_id":79226666,"share_link":"https://stackoverflow.com/a/79228673","body_markdown":"`define_and_run_pipeline` seems to be passed a `text` value that is a list of `TextBlock`s.\r\n\r\nYour code already has logic for extracting a string from a list of `TextBlock`s, and you can put that in a function:\r\n\r\n    def str_from_textblocks(block_list) -&gt; str:\r\n        return &quot; &quot;.join(block.text for block in block_list if hasattr(block, &quot;text&quot;))\r\n\r\nTry replacing `text = str(text)` with `text = str_from_textblocks(text)`.","link":"https://stackoverflow.com/questions/79226666/error-during-pipeline-execution-with-simplekgpipeline-input-should-be-a-valid/79228673#79228673","title":"Error during pipeline execution with SimpleKGPipeline: &quot;Input should be a valid string&quot;"}],"owner":{"reputation":11,"user_id":22970329,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/86689b502c6c70720ca417e7287f2191?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Aravind_Sagar","link":"https://stackoverflow.com/users/22970329/aravind-sagar"},"last_editor":{"reputation":21327,"user_id":2756409,"user_type":"registered","accept_rate":100,"profile_image":"https://i.sstatic.net/UIrGI.jpg?s=256","display_name":"TylerH","link":"https://stackoverflow.com/users/2756409/tylerh"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":183,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1759162207,"creation_date":1732622971,"last_edit_date":1759162207,"question_id":79226666,"share_link":"https://stackoverflow.com/q/79226666","body_markdown":"I&#39;m trying to execute a knowledge graph pipeline using Claude in combination with `SimpleKGPipeline`. However, I’m encountering an error during the execution of the `run_async` method.\r\n\r\nHere is the error message:\r\n\r\n\r\n&gt;ERROR - Error during pipeline execution: 1 validation error for LLMResponse  \r\ncontent  \r\nInput should be a valid string [type=string_type, input_value=[TextBlock(text=&#39;{\\n  &quot;no...\\n  ]\\n}&#39;, type=&#39;text&#39;)], input_type=list]  \r\nFor further information visit https://errors.pydantic.dev/2.9/v/string_type  \r\n&gt;\r\n&gt;Traceback (most recent call last):  \r\nFile &quot;\\Local\\Temp\\ipykernel_28080\\1943368097.py&quot;, line 138, in define_and_run_pipeline  \r\nresponse = await kg_builder.run_async(text=text)  \r\n\r\n\r\nIt seems the pipeline expects a string, but the response being passed is a list instead. Here&#39;s the relevant code snippet where the error occurs:\r\n\r\n```\r\nresponse = await kg_builder.run_async(text=text)\r\n```\r\n\r\nI also created a custom LLM class to ensure proper handling of the LLM response. Here’s the implementation of the class:\r\n\r\n```\r\nclass CustomAnthropicLLM(AnthropicLLM):\r\n    def invoke(self, input: str) -&gt; str:\r\n        try:\r\n            logger.debug(f&quot;Sending input to Anthropic API: {input[:500]}...&quot;)  # Logging first 500 characters\r\n            response = self.client.messages.create(\r\n                model=self.model_name,\r\n                messages=[{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: input}],\r\n                **self.model_params,\r\n            )\r\n            logger.debug(f&quot;Raw Anthropic API response: {response}&quot;)\r\n\r\n            # Ensure the response content is processed correctly\r\n            logger.debug(f&quot;Response content type: {type(response.content)}&quot;)\r\n            if isinstance(response.content, list):\r\n                logger.debug(f&quot;First element of response content: {response.content[0]}&quot;)\r\n\r\n                # Concatenate TextBlock content into a single string\r\n                content = &quot; &quot;.join(block.text for block in response.content if hasattr(block, &quot;text&quot;))\r\n            elif isinstance(response.content, str):\r\n                content = response.content\r\n            else:\r\n                raise ValueError(f&quot;Unexpected response format: {response.content}&quot;)\r\n\r\n            logger.debug(f&quot;Processed LLM response: {content[:500]}...&quot;)  # Logging processed content\r\n            return content\r\n        except APIError as e:\r\n            logger.error(f&quot;Anthropic API Error: {e}&quot;)\r\n            raise\r\n        except Exception as ex:\r\n            logger.error(f&quot;Unexpected error during LLM invocation: {ex}&quot;)\r\n            raise\r\n```\r\n\r\nThe error seems to indicate that the `text` variable is expected to be a string but is instead being passed as a list.\r\n\r\nHere is the method that initializes and runs the pipeline:\r\n\r\n        async def define_and_run_pipeline(\r\n        neo4j_driver: GraphDatabase.driver,\r\n        llm: CustomAnthropicLLM,\r\n        text: str\r\n    ) -&gt; PipelineResult:\r\n        logger.info(&quot;Initializing SimpleKGPipeline...&quot;)\r\n        try:\r\n            # Make sure the text passed to the pipeline is a string and formatted correctly\r\n            text = str(text)  # Ensure text is a string\r\n            kg_builder = SimpleKGPipeline(\r\n                llm=llm,\r\n                driver=neo4j_driver,\r\n                embedder=SentenceTransformerEmbeddings(),\r\n                entities=[&quot;File&quot;, &quot;Variable&quot;, &quot;Paragraph&quot;, &quot;Section&quot;],\r\n                relations=[&quot;CONTAINS&quot;, &quot;USED_IN&quot;, &quot;CALLS&quot;],\r\n                potential_schema=[ \r\n                    (&quot;File&quot;, &quot;CONTAINS&quot;, &quot;Section&quot;),\r\n                    (&quot;Section&quot;, &quot;CONTAINS&quot;, &quot;Paragraph&quot;),\r\n                    (&quot;Paragraph&quot;, &quot;CONTAINS&quot;, &quot;Variable&quot;),\r\n                    (&quot;File&quot;, &quot;CALLS&quot;, &quot;Paragraph&quot;),\r\n                ],\r\n                from_pdf=False,\r\n            )\r\n            logger.info(&quot;SimpleKGPipeline initialized. Running pipeline...&quot;)\r\n            logger.debug(f&quot;Enriched text passed to pipeline: {text[:500]}...&quot;)  # Log first 500 characters of the text\r\n            response = await kg_builder.run_async(text=text)\r\n            logger.debug(f&quot;Pipeline raw response type: {type(response)}, content: {response}&quot;)\r\n    \r\n    \r\n            # Validate and debug response\r\n            # logger.debug(f&quot;Pipeline response: {response}&quot;)\r\n            # return response\r\n    \r\n            # Ensure response is processed as string\r\n            if isinstance(response, list):\r\n                processed_response = &quot; &quot;.join([item.text for item in response if hasattr(item, &quot;text&quot;)])\r\n            elif isinstance(response, str):\r\n                processed_response = response\r\n            else:\r\n                raise ValueError(f&quot;Unexpected response type: {type(response)}&quot;)\r\n    \r\n            logger.debug(f&quot;Processed response: {processed_response[:500]}...&quot;)\r\n            return processed_response\r\n        \r\n        except Exception as e:\r\n            logger.error(f&quot;Error during pipeline execution: {e}&quot;)\r\n            logger.error(&quot;Traceback: \\n&quot; + traceback.format_exc())\r\n            raise\r\n\r\n**What I&#39;ve tried:**\r\n\r\n- Ensured the input `text` passed to `run_async` is explicitly converted to a string.\r\n\r\n- Verified that the response from the LLM is either a string or a list and handled both cases in the custom LLM class.\r\n\r\nWhy might `response.content` be a list instead of a string in this context Could the issue be in how `SimpleKGPipeline` processes the `text` input or in how the LLM API responds?","link":"https://stackoverflow.com/questions/79226666/error-during-pipeline-execution-with-simplekgpipeline-input-should-be-a-valid","title":"Error during pipeline execution with SimpleKGPipeline: &quot;Input should be a valid string&quot;"},{"tags":["neo4j","cypher","neo4j-python-driver"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":true,"score":0,"last_activity_date":1732247269,"creation_date":1732247269,"answer_id":79213565,"question_id":79209680,"share_link":"https://stackoverflow.com/a/79213565","body_markdown":"While it would be possible to do that by changing your Python and Cypher code, it would be much simpler to just modify the JSON `Employee Vector Search Results`.\r\n\r\nFor example, here is a sample function that takes your `Employee Vector Search Results` and filters out, from every employee&#39;s `connections` list, all objects that have a `type` key and another key whose value is an empty list:\r\n\r\n    def filter_employee_connections(json_result):\r\n        result = json.loads(json_result)\r\n        for employee in result:\r\n            employee[&quot;connections&quot;] = [\r\n                c for c in employee[&quot;connections&quot;]\r\n                if not any(isinstance(val, list) and not val for key, val in c.items() if key != &quot;type&quot;)\r\n            ]\r\n        return json.dumps(result, indent=2)\r\n\r\nThe resulting JSON would look something like this:\r\n\r\n    [\r\n      {\r\n        &quot;employeeName&quot;: &quot;Emma Williams&quot;,\r\n        &quot;score&quot;: 0.6321649551391602,\r\n        &quot;employee&quot;: {\r\n          &quot;name&quot;: &quot;Emma Williams&quot;,\r\n          &quot;email&quot;: &quot;emma.w@hotelexample.com&quot;\r\n        },\r\n        &quot;connections&quot;: [\r\n          {\r\n            &quot;contract&quot;: {\r\n              &quot;contractType&quot;: &quot;Part-time&quot;\r\n            },\r\n            &quot;type&quot;: &quot;HAS_CONTRACT_TYPE&quot;\r\n          },\r\n          {\r\n            &quot;has_availability&quot;: [\r\n              {\r\n                &quot;employeeName&quot;: &quot;Emma Williams&quot;,\r\n                &quot;timeframe&quot;: {\r\n                  &quot;recurring&quot;: true,\r\n                  &quot;dateIndicator&quot;: &quot;Thu-Sat 16:00-00:00&quot;,\r\n                  &quot;type&quot;: &quot;DayOfWeek&quot;\r\n                }\r\n              }\r\n            ],\r\n            &quot;type&quot;: &quot;HAS_AVAILABILITY&quot;\r\n          },\r\n          {\r\n            &quot;team&quot;: {\r\n              &quot;name&quot;: &quot;F&amp;B&quot;\r\n            },\r\n            &quot;type&quot;: &quot;BELONGS_TO&quot;\r\n          },\r\n          {\r\n            &quot;type&quot;: &quot;HAS_CERTIFICATION&quot;,\r\n            &quot;certification&quot;: [\r\n              {\r\n                &quot;name&quot;: &quot;Alcohol Service&quot;\r\n              },\r\n              {\r\n                &quot;name&quot;: &quot;Mixology Certificate&quot;\r\n              }\r\n            ]\r\n          }\r\n        ]\r\n      }\r\n    ]\r\n\r\n","link":"https://stackoverflow.com/questions/79209680/best-way-to-exclude-null-or-empty-values-from-an-output-of-a-cypher-query/79213565#79213565","title":"Best way to exclude `null` or empty [] values from an output of a Cypher query"},{"tags":[],"owner":{"reputation":3,"user_id":23729669,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/57f52d7cd8b20a9f04c0590c35908d7d?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Manuel Maguga Darbinian","link":"https://stackoverflow.com/users/23729669/manuel-maguga-darbinian"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1732265860,"creation_date":1732265860,"answer_id":79214273,"question_id":79209680,"share_link":"https://stackoverflow.com/a/79214273","body_markdown":"Thanks a lot for the suggestion! it was indeed much simpler to just modify the JSON Employee Vector Search and the other vector index Results\r\n\r\nI implemented a solution that builds upon your approach while adding some additional robustness to handle different types of empty values in my Neo4j vector search results. \r\n\r\n    def filter_empty_connections(results):\r\n    &quot;&quot;&quot;\r\n    Filter out empty connections from vector search results across all data types\r\n    (Employee, Work, Project, WorkAllocation, WorkScheduleRule).\r\n    &quot;&quot;&quot;\r\n    if not results or &quot;results&quot; not in results:\r\n        return results\r\n    \r\n    def is_empty_value(val):\r\n        &quot;&quot;&quot;Check if a value is considered empty.&quot;&quot;&quot;\r\n        if isinstance(val, list):\r\n            # Check if list is empty or contains only empty/null values\r\n            return len(val) == 0 or all(is_empty_value(item) for item in val)\r\n        if isinstance(val, dict):\r\n            # Check if dict is empty or contains only empty/null values\r\n            return len(val) == 0 or all(is_empty_value(v) for v in val.values())\r\n        return val is None or val == &quot;&quot;\r\n    \r\n    def filter_single_item(item):\r\n        &quot;&quot;&quot;Filter empty connections from a single item&#39;s connections array.&quot;&quot;&quot;\r\n        if &quot;connections&quot; not in item:\r\n            return item\r\n            \r\n        filtered_connections = []\r\n        for conn in item[&quot;connections&quot;]:\r\n            # Skip the connection if all its non-type fields are empty\r\n            has_non_empty_value = False\r\n            for key, val in conn.items():\r\n                if key != &quot;type&quot; and not is_empty_value(val):\r\n                    has_non_empty_value = True\r\n                    break\r\n            \r\n            if has_non_empty_value:\r\n                filtered_connections.append(conn)\r\n        \r\n        item[&quot;connections&quot;] = filtered_connections\r\n        return item\r\n    \r\n    filtered_items = [\r\n        filter_single_item(item) \r\n        for item in results[&quot;results&quot;]\r\n    ]\r\n    \r\n    return {&quot;results&quot;: filtered_items}\r\n\r\nThen I integrated it into my index functions like this:\r\n\r\n    def employee_details_index(query, query_embedding, n_results=50):\r\n    # ... existing query execution code ...\r\n    \r\n    structured_results = []\r\n    for row in results:\r\n        employee_data = {\r\n            &quot;employeeName&quot;: row[&quot;employeeName&quot;],\r\n            &quot;score&quot;: row[&quot;score&quot;],\r\n            &quot;employee&quot;: json.loads(row[&quot;employeeJson&quot;]),\r\n            &quot;connections&quot;: json.loads(row[&quot;connectionsJson&quot;])\r\n        }\r\n        structured_results.append(employee_data)\r\n\r\n    # Apply filtering before returning\r\n    filtered_results = filter_empty_connections({&quot;results&quot;: structured_results})\r\n    return filtered_results\r\n\r\nThis approach successfully removed empty connections like &quot;education&quot;: [] and &quot;has_unavailability&quot;: [] from the results while keeping the connection entries that had actual data.\r\n\r\nThank you again for pointing me in the right direction! This solution worked perfectly for my use case.","link":"https://stackoverflow.com/questions/79209680/best-way-to-exclude-null-or-empty-values-from-an-output-of-a-cypher-query/79214273#79214273","title":"Best way to exclude `null` or empty [] values from an output of a Cypher query"}],"owner":{"reputation":3,"user_id":23729669,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/57f52d7cd8b20a9f04c0590c35908d7d?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Manuel Maguga Darbinian","link":"https://stackoverflow.com/users/23729669/manuel-maguga-darbinian"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":156,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79213565,"answer_count":2,"score":0,"last_activity_date":1732265860,"creation_date":1732163226,"last_edit_date":1732247259,"question_id":79209680,"share_link":"https://stackoverflow.com/q/79209680","body_markdown":"**CONTEXT**\r\nI have setup a neo4j vector index in combination with cypher query to fetch specific nodes and and traverse through their paths to return specific data. Given this data will be passed to an LLM for summarisation, the output should be as clean as possible.\r\n\r\n**FUNCTION**\r\n`def generate_employee_cypher_query(schema)`: fetches specific paths from entity &#200;mployee` by following the schema/ontology paths:\r\n\r\n```\r\ndef generate_employee_cypher_query(schema):\r\n    employee_schema = schema[&quot;Employee&quot;]\r\n    match_clauses = []\r\n    return_blocks = []\r\n    \r\n    # Initial vector search\r\n    base_query = &quot;&quot;&quot;\r\n    CALL db.index.vector.queryNodes($index_name, $n_results, $query_embedding)\r\n    YIELD node AS employee, score\r\n    WHERE employee:Employee AND employee.user_id = $user_id\r\n    \r\n    MATCH (employee)\r\n    &quot;&quot;&quot;\r\n    \r\n    # Generate MATCH clauses from schema relationships\r\n    for rel in employee_schema[&quot;relationships&quot;]:\r\n        rel_type = rel[&quot;type&quot;]\r\n        end_node = rel[&quot;endNode&quot;]\r\n        cardinality = rel.get(&quot;cardinality&quot;, &quot;0..n&quot;)  # Default to 0..n if not specified\r\n        \r\n        # Handle different cardinalities and relationship directions\r\n        if rel[&quot;startNode&quot;] == &quot;Employee&quot;:\r\n            # Outgoing relationship from Employee\r\n            match_clauses.append(\r\n                f&quot;OPTIONAL MATCH (employee)-[{rel_type.lower()}Rel:{rel_type}]-&gt;&quot;\r\n                f&quot;({rel_type.lower()}:{end_node})&quot;\r\n            )\r\n            \r\n            # Special handling for relationships with TimeFrame\r\n            if end_node in [&quot;Availability&quot;, &quot;Unavailability&quot;]:\r\n                match_clauses.append(\r\n                    f&quot;OPTIONAL MATCH ({rel_type.lower()})-[:HAS_TIMEFRAME]-&gt;&quot;\r\n                    f&quot;({rel_type.lower()}TimeFrame:TimeFrame)&quot;\r\n                )\r\n        else:\r\n            # Incoming relationship to Employee\r\n            match_clauses.append(\r\n                f&quot;OPTIONAL MATCH ({rel_type.lower()}:{end_node})&quot;\r\n                f&quot;-[{rel_type.lower()}Rel:{rel_type}]-&gt;(employee)&quot;\r\n            )\r\n    \r\n    # Generate return blocks for each relationship\r\n    return_blocks.append(&quot;&quot;&quot;\r\n    employee.name AS employeeName,\r\n    score,\r\n    apoc.convert.toJson(\r\n        CASE WHEN employee IS NOT NULL \r\n        THEN apoc.map.removeKeys(properties(employee), \r\n            [&#39;embedding&#39;, &#39;id&#39;, &#39;elementId&#39;, &#39;user_id&#39;, &#39;timestamp&#39;, &#39;created&#39;, &#39;updated&#39;]\r\n        )\r\n        ELSE {} \r\n        END\r\n    ) AS employeeJson,\r\n    &quot;&quot;&quot;)\r\n    \r\n    # Start connections array\r\n    return_blocks.append(&quot;apoc.convert.toJson([&quot;)\r\n    \r\n    # Generate individual connection blocks\r\n    connection_blocks = []\r\n    for rel in employee_schema[&quot;relationships&quot;]:\r\n        rel_type = rel[&quot;type&quot;]\r\n        end_node = rel[&quot;endNode&quot;]\r\n        cardinality = rel.get(&quot;cardinality&quot;, &quot;0..n&quot;)\r\n        \r\n        # Handle cardinality in return statement\r\n        is_single = cardinality in [&quot;1..1&quot;, &quot;0..1&quot;]\r\n        collection_suffix = &quot;[0]&quot; if is_single else &quot;&quot;\r\n        \r\n        if end_node in [&quot;Availability&quot;, &quot;Unavailability&quot;]:\r\n            # Special handling for timeframe relationships\r\n            connection_blocks.append(f&quot;&quot;&quot;{{\r\n                type: &#39;{rel_type}&#39;,\r\n                {rel_type.lower()}: collect(DISTINCT CASE WHEN {rel_type.lower()} IS NOT NULL \r\n                    THEN {{\r\n                        employeeName: {rel_type.lower()}.employeeName,\r\n                        timeframe: CASE WHEN {rel_type.lower()}TimeFrame IS NOT NULL \r\n                            THEN {{\r\n                                dateIndicator: {rel_type.lower()}TimeFrame.dateIndicator,\r\n                                type: {rel_type.lower()}TimeFrame.type,\r\n                                recurring: {rel_type.lower()}TimeFrame.recurring\r\n                            }}\r\n                            ELSE null \r\n                        END\r\n                    }}\r\n                    ELSE null END){collection_suffix}\r\n            }}&quot;&quot;&quot;)\r\n        else:\r\n            # Standard relationship handling\r\n            connection_blocks.append(f&quot;&quot;&quot;{{\r\n                type: &#39;{rel_type}&#39;,\r\n                {end_node.lower()}: collect(DISTINCT CASE WHEN {rel_type.lower()} IS NOT NULL \r\n                    THEN apoc.map.removeKeys(properties({rel_type.lower()}), \r\n                        [&#39;embedding&#39;, &#39;id&#39;, &#39;elementId&#39;, &#39;user_id&#39;, &#39;timestamp&#39;, &#39;created&#39;, &#39;updated&#39;]\r\n                    )\r\n                    ELSE null END){collection_suffix}\r\n            }}&quot;&quot;&quot;)\r\n    \r\n    # Close connections array\r\n    return_blocks.append(&quot;,\\n&quot;.join(connection_blocks))\r\n    return_blocks.append(&quot;]) AS connectionsJson&quot;)\r\n    \r\n    # Combine all query parts\r\n    full_query = (\r\n        base_query +\r\n        &quot;\\n&quot;.join(match_clauses) +\r\n        &quot;\\nRETURN &quot; +\r\n        &quot;\\n&quot;.join(return_blocks)\r\n    )\r\n    \r\n    return full_query\r\n```\r\n\r\n\r\nNow, the output of this specific function can be seen in the example below:\r\n\r\n```\r\nEmployee Vector Search Results:\r\n[\r\n  {\r\n    &quot;employeeName&quot;: &quot;Emma Williams&quot;,\r\n    &quot;score&quot;: 0.6321649551391602,\r\n    &quot;employee&quot;: {\r\n      &quot;name&quot;: &quot;Emma Williams&quot;,\r\n      &quot;email&quot;: &quot;emma.w@hotelexample.com&quot;\r\n    },\r\n    &quot;connections&quot;: [\r\n      {\r\n        &quot;contract&quot;: {\r\n          &quot;contractType&quot;: &quot;Part-time&quot;\r\n        },\r\n        &quot;type&quot;: &quot;HAS_CONTRACT_TYPE&quot;\r\n      },\r\n      {\r\n        &quot;has_unavailability&quot;: [],\r\n        &quot;type&quot;: &quot;HAS_UNAVAILABILITY&quot;\r\n      },\r\n      {\r\n        &quot;has_availability&quot;: [\r\n          {\r\n            &quot;employeeName&quot;: &quot;Emma Williams&quot;,\r\n            &quot;timeframe&quot;: {\r\n              &quot;recurring&quot;: true,\r\n              &quot;dateIndicator&quot;: &quot;Thu-Sat 16:00-00:00&quot;,\r\n              &quot;type&quot;: &quot;DayOfWeek&quot;\r\n            }\r\n          }\r\n        ],\r\n        &quot;type&quot;: &quot;HAS_AVAILABILITY&quot;\r\n      },\r\n      {\r\n        &quot;team&quot;: {\r\n          &quot;name&quot;: &quot;F&amp;B&quot;\r\n        },\r\n        &quot;type&quot;: &quot;BELONGS_TO&quot;\r\n      },\r\n      {\r\n        &quot;education&quot;: [],\r\n        &quot;type&quot;: &quot;HAS_EDUCATION&quot;\r\n      },\r\n      {\r\n        &quot;type&quot;: &quot;HAS_CERTIFICATION&quot;,\r\n        &quot;certification&quot;: [\r\n          {\r\n            &quot;name&quot;: &quot;Alcohol Service&quot;\r\n          },\r\n          {\r\n            &quot;name&quot;: &quot;Mixology Certificate&quot;\r\n          }\r\n        ]\r\n      },\r\n```\r\n\r\nnotice in the above output the empty strings in `&quot;education&quot;: [],` or `&quot;has_unavailability&quot;: [],`. I want those values to not be included in the output.\r\n\r\nthank you in advance\r\nManuel\r\n\r\nI tried using CASE expressions or apoc.map.clean but did not seem to lead to the results i wanted.","link":"https://stackoverflow.com/questions/79209680/best-way-to-exclude-null-or-empty-values-from-an-output-of-a-cypher-query","title":"Best way to exclude `null` or empty [] values from an output of a Cypher query"},{"tags":["neo4j"],"answers":[{"comments":[{"owner":{"reputation":4938,"user_id":100371,"user_type":"registered","accept_rate":51,"profile_image":"https://www.gravatar.com/avatar/ab5d80d800d0a3360178e6ecdd2eb485?s=256&d=identicon&r=PG","display_name":"sooon","link":"https://stackoverflow.com/users/100371/sooon"},"edited":false,"score":0,"creation_date":1732140248,"post_id":79208102,"comment_id":139675109,"link":"https://stackoverflow.com/questions/79207831/how-to-connect-to-neo4j-via-browser/79208102#comment139675109_79208102"}],"tags":[],"owner":{"reputation":26,"user_id":22214354,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/96faa0d16e180bc41836018844e66c62?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Jonathan Giffard","link":"https://stackoverflow.com/users/22214354/jonathan-giffard"},"comment_count":1,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1732119758,"creation_date":1732119758,"answer_id":79208102,"question_id":79207831,"share_link":"https://stackoverflow.com/a/79208102","body_markdown":"Assuming you have docker running locally, then you would use \r\n\r\nbolt://localhost:7687\r\n\r\nFYI- bolt+s would be used if you&#39;ve configure SSL support. \r\n\r\n","link":"https://stackoverflow.com/questions/79207831/how-to-connect-to-neo4j-via-browser/79208102#79208102","title":"How to connect to neo4j via browser?"}],"owner":{"reputation":4938,"user_id":100371,"user_type":"registered","accept_rate":51,"profile_image":"https://www.gravatar.com/avatar/ab5d80d800d0a3360178e6ecdd2eb485?s=256&d=identicon&r=PG","display_name":"sooon","link":"https://stackoverflow.com/users/100371/sooon"},"last_editor":{"reputation":123876,"user_id":3001761,"user_type":"registered","profile_image":"https://i.sstatic.net/feZwC.jpg?s=256","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":52,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1732119758,"creation_date":1732115676,"last_edit_date":1732115841,"question_id":79207831,"share_link":"https://stackoverflow.com/q/79207831","body_markdown":"I am running my neo4j with docker container.\r\n\r\nI can get everything to run no problem.\r\n\r\nBut I want to use the browser to connect but not sure what to put in the Connect URL.\r\n\r\n[![enter image description here][1]][1]\r\n\r\nI am using the default ports 8787. I try put `bolt+s://xxx.xxx.xxx.xxx:8787` not working. How can I resolve this?\r\n\r\n  [1]: https://i.sstatic.net/pBo9eKVf.png","link":"https://stackoverflow.com/questions/79207831/how-to-connect-to-neo4j-via-browser","title":"How to connect to neo4j via browser?"},{"tags":["node.js","concurrency","neo4j","locking"],"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1732122513,"post_id":79207261,"comment_id":139673520,"link":"https://stackoverflow.com/questions/79207261/neo4j-concurrency-issue-lock-unlock-nodes#comment139673520_79207261"}],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1732320910,"creation_date":1732320910,"answer_id":79216897,"question_id":79207261,"share_link":"https://stackoverflow.com/a/79216897","body_markdown":"For efficiency, neo4j uses the `read-committed` isolation level by default, which does not put a lock on everything that is read from the DB by a transaction. However, data that a transaction writes *is* automatically locked from that point in the transaction. [See here](https://neo4j.com/docs/operations-manual/5/database-internals/concurrent-data-access/#transactions-isolation-lostupdates) for more details.\r\n\r\nThe `apoc.lock.nodes` procedure places a write-lock on each of the nodes in the provided list, but those locks are released  at the end of the transaction that called the procedure. So, your &quot;handler&quot; must execute your `read` and `write` queries in the *same transaction* to prevent concurrent executions from stepping on each other. See the documentation for the [neo4j driver](https://neo4j.com/docs/bolt/current/neo4j-drivers/) for your programming language to see how to process queries in the same transaction.\r\n\r\nAlso, your `write` query does not need to call `apoc.lock.nodes`, since the immediately-following `SET` clause would lock the `n` node anyway (if the transaction had not locked it earlier). See the description and examples of &quot;direct dependencies&quot; in the [docs](https://neo4j.com/docs/bolt/current/neo4j-drivers/).","link":"https://stackoverflow.com/questions/79207261/neo4j-concurrency-issue-lock-unlock-nodes/79216897#79216897","title":"Neo4j - Concurrency issue (lock/unlock nodes)"}],"owner":{"reputation":679,"user_id":10036280,"user_type":"registered","profile_image":"https://lh6.googleusercontent.com/-Gz7r0bFN4DY/AAAAAAAAAAI/AAAAAAAAAAA/AB6qoq3NlMnEvfpK4qlZR3bvvbuDOAO2lw/mo/s256-rj/photo.jpg","display_name":"elli","link":"https://stackoverflow.com/users/10036280/elli"},"last_editor":{"reputation":679,"user_id":10036280,"user_type":"registered","profile_image":"https://lh6.googleusercontent.com/-Gz7r0bFN4DY/AAAAAAAAAAI/AAAAAAAAAAA/AB6qoq3NlMnEvfpK4qlZR3bvvbuDOAO2lw/mo/s256-rj/photo.jpg","display_name":"elli","link":"https://stackoverflow.com/users/10036280/elli"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":198,"favorite_count":0,"down_vote_count":0,"up_vote_count":3,"answer_count":1,"score":3,"last_activity_date":1732320910,"creation_date":1732106661,"last_edit_date":1732114600,"question_id":79207261,"share_link":"https://stackoverflow.com/q/79207261","body_markdown":"I have a project in nodejs and there are some concurrency issues. I have a handler that reads and then writes the updated state to my neo4j database for the same node. When 2 concurrent processes try to run the same handler, the processes read from db the state and then one process writes the updated state above the other. So I want to lock before the read and unlock after the write.\r\n\r\nDoes neo4j has something ready for this?\r\nI found [this][1] and tried it to both reads and writes queries:\r\n```\r\n// read\r\nMATCH (n:Account {id: $accountId})\r\nCALL apoc.lock.nodes([n])  // Attempt to lock the account node\r\nRETURN account.balance\r\n```\r\n```\r\n// write\r\nMATCH (n:Account {id: $accountId})\r\nCALL apoc.lock.nodes([n])  // Lock the account node\r\nSET n.balance = n.balance + $amount\r\nRETURN account\r\n// locks are released here??\r\n```\r\n\r\nbut with no result and there is no enough documentation to know how to use it.\r\n\r\nAny query example would be great! Thank you in advance!\r\n\r\n\r\n  [1]: https://neo4j.com/docs/apoc/current/overview/apoc.lock/apoc.lock.nodes/","link":"https://stackoverflow.com/questions/79207261/neo4j-concurrency-issue-lock-unlock-nodes","title":"Neo4j - Concurrency issue (lock/unlock nodes)"},{"tags":["spring-boot","neo4j","spring-data-neo4j"],"comments":[{"owner":{"reputation":6342,"user_id":907986,"user_type":"registered","accept_rate":67,"profile_image":"https://www.gravatar.com/avatar/7d2ea6f98a0680a0b53197d4fd7c25be?s=256&d=identicon&r=PG","display_name":"Marian Theisen","link":"https://stackoverflow.com/users/907986/marian-theisen"},"edited":false,"score":0,"creation_date":1732000546,"post_id":79202359,"comment_id":139663019,"link":"https://stackoverflow.com/questions/79202359/how-to-run-a-query-with-spring-neo4jclient-to-neo4jdb-at-the-start-of-spring-app#comment139663019_79202359"}],"answers":[{"tags":[],"owner":{"reputation":8282,"user_id":2650436,"user_type":"registered","accept_rate":80,"profile_image":"https://www.gravatar.com/avatar/34ecacd077244d141a23c46ea094df5c?s=256&d=identicon&r=PG","display_name":"meistermeier","link":"https://stackoverflow.com/users/2650436/meistermeier"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1732800879,"creation_date":1732800879,"answer_id":79234107,"question_id":79202359,"share_link":"https://stackoverflow.com/a/79234107","body_markdown":"I think that the best option to do this is to introduce neo4j-migrations (https://github.com/michael-simons/neo4j-migrations/) to your project.\r\nIt does exactly what you ask for (and even more).\r\n\r\nBasically it is a good idea to have some kind of migration tool within your application (like flyway or liquibase for relational databases) to not come to a state where you need to manually invoke Cypher statements to migrate your data.\r\n\r\nFor the last bit in your question regarding the scheme: Please be aware that a connection via the *bolt* scheme always connects directly to an instance if Neo4j whereas the *neo4j* scheme will create a routing driver instance that e.g. sends read-only transactions to the followers in the cluster, etc.","link":"https://stackoverflow.com/questions/79202359/how-to-run-a-query-with-spring-neo4jclient-to-neo4jdb-at-the-start-of-spring-app/79234107#79234107","title":"How to run a query with Spring Neo4jClient to Neo4jDB at the start of Spring Application automatically"}],"owner":{"reputation":23,"user_id":22523452,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AAcHTtcrIYxAUHFuLpGn4QhD4iig5CwEKNc42e5zRW8kHD52=k-s256","display_name":"Garv","link":"https://stackoverflow.com/users/22523452/garv"},"comment_count":1,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":80,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1732800879,"creation_date":1731999413,"question_id":79202359,"share_link":"https://stackoverflow.com/q/79202359","body_markdown":"I have a use case where I need to check if indexes and constraints are present in a neo4j database and add them if not present. This must be done when the spring application starts and cannot be done through an API call as I won&#39;t have access to the API on the server.\r\n\r\nI&#39;ve tried making use of `@PostConstruct` annotation, `CommandLineRunner`, `ApplicationRunner` and `ApplicationListener` to try and execute the query as soon as the Spring Boot application starts. But every time I&#39;m getting the following error during **Build** stage of the AWS CodePipeline:\r\n\r\n```\r\n2024-11-18T18:50:12.160+0000 ERROR Application run failed\r\njava.lang.RuntimeException: org.springframework.dao.TransientDataAccessResourceException: Could not perform discovery for database &#39;neo4j&#39;. No routing server available.; Error code &#39;N/A&#39;\r\n```\r\n\r\n```\r\nSuppressed: org.neo4j.driver.exceptions.DiscoveryException: Failed to update routing table with server &#39;XXX.XX.0.XX:7687&#39;.\r\n```\r\n\r\nIf I remove the code trying to insert the indexes at startup, then no error is encountered, and the application is successfully deployed with the db calls through API calls working fine.\r\nThis the neo4jClient configuration I&#39;m using:\r\n```\r\n@Configuration\r\npublic class Neo4jClientConfig {\r\n\r\n    private static final Logger logger = LogManager.getLogger(Neo4jClientConfig.class);\r\n\r\n    @Value(&quot;${neo4j.uri}&quot;)\r\n    private String dbURI;\r\n\r\n    @Value(&quot;${neo4j.authentication.username}&quot;)\r\n    private String username;\r\n\r\n    @Value(&quot;${neo4j.authentication.password}&quot;)\r\n    private String password;\r\n\r\n    @Value(&quot;${neo4j.database}&quot;)\r\n    private String dbName;\r\n\r\n    @Bean\r\n    public Neo4jClient neo4jClient () {\r\n        Driver driver = GraphDatabase\r\n                .driver(dbURI, AuthTokens.basic(username, password));\r\n        return Neo4jClient.create(driver);\r\n    }\r\n\r\n}\r\n```\r\nI have also tried changing the protocols between **bolt** and **neo4j** but both of them don&#39;t work.\r\n\r\nIs there some way to automatically call a method that would in turn insert indexes and constraints into the database whenever the spring application starts up?","link":"https://stackoverflow.com/questions/79202359/how-to-run-a-query-with-spring-neo4jclient-to-neo4jdb-at-the-start-of-spring-app","title":"How to run a query with Spring Neo4jClient to Neo4jDB at the start of Spring Application automatically"},{"tags":["database","graph","neo4j","nosql","cypher"],"answers":[{"comments":[{"owner":{"reputation":36,"user_id":16427588,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/00f547c1a947c940be8c61f37ded8b30?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Holyamirali","link":"https://stackoverflow.com/users/16427588/holyamirali"},"edited":false,"score":0,"creation_date":1732122104,"post_id":79201649,"comment_id":139673471,"link":"https://stackoverflow.com/questions/79201118/how-to-find-co-connected-nodes-with-k-relationships-neo4j/79201649#comment139673471_79201649"},{"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"reply_to_user":{"reputation":36,"user_id":16427588,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/00f547c1a947c940be8c61f37ded8b30?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Holyamirali","link":"https://stackoverflow.com/users/16427588/holyamirali"},"edited":false,"score":0,"creation_date":1732225326,"post_id":79201649,"comment_id":139681970,"link":"https://stackoverflow.com/questions/79201118/how-to-find-co-connected-nodes-with-k-relationships-neo4j/79201649#comment139681970_79201649"}],"tags":[],"owner":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"last_editor":{"reputation":1601,"user_id":2258090,"user_type":"registered","profile_image":"https://i.sstatic.net/g8J8h.jpg?s=256","display_name":"Finbar Good","link":"https://stackoverflow.com/users/2258090/finbar-good"},"comment_count":2,"down_vote_count":0,"up_vote_count":0,"is_accepted":true,"score":0,"last_activity_date":1732225261,"last_edit_date":1732225261,"creation_date":1731970643,"answer_id":79201649,"question_id":79201118,"share_link":"https://stackoverflow.com/a/79201649","body_markdown":"To get the paths to `Customer` nodes that are, for example, four degrees away from a `Customer` node with `id = &#39;c1&#39;`, you can use the following:\r\n```lang-cypher\r\nMATCH p =\r\n      (c1:Customer {id: &#39;c1&#39;})\r\n      (()-[:MADE]-&gt;(:Transaction)-[:AT]-&gt;(:Terminal)\r\n         &lt;-[:AT]-(:Transaction)&lt;-[:MADE]-(:Customer)){4} (c2)\r\nWHERE c1 &lt;&gt; c2\r\nRETURN p\r\n```\r\n\r\nNote here what you refer to as 2nd degree connection would here be 1st.\r\n\r\nThat solution ignores the fact that there may be multiple paths of varying length that connect a given pair of nodes. To only return the minimum degree for each `Customer` node, find the shortest path between each pair:\r\n\r\n```lang-cypher\r\nMATCH p = SHORTEST 1\r\n      (c1:Customer {id: &#39;c1&#39;})\r\n      (()-[:MADE]-&gt;(:Transaction)-[:AT]-&gt;(:Terminal)\r\n         &lt;-[:AT]-(:Transaction)&lt;-[:MADE]-(:Customer)){4} (c2)\r\nWHERE c1 &lt;&gt; c2\r\nRETURN p\r\n```\r\n\r\nThese solutions use [quantified path patterns][1] and [shortest paths][2].\r\n\r\n\r\n  [1]: https://neo4j.com/docs/cypher-manual/current/patterns/reference/#quantified-path-patterns\r\n  [2]: https://neo4j.com/docs/cypher-manual/current/patterns/reference/#shortest-paths","link":"https://stackoverflow.com/questions/79201118/how-to-find-co-connected-nodes-with-k-relationships-neo4j/79201649#79201649","title":"How to find co-connected nodes with &#39;k&#39; relationships? - Neo4j"}],"owner":{"reputation":36,"user_id":16427588,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/00f547c1a947c940be8c61f37ded8b30?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Holyamirali","link":"https://stackoverflow.com/users/16427588/holyamirali"},"last_editor":{"reputation":36,"user_id":16427588,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/00f547c1a947c940be8c61f37ded8b30?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Holyamirali","link":"https://stackoverflow.com/users/16427588/holyamirali"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":60,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79201649,"answer_count":1,"score":0,"last_activity_date":1732225261,"creation_date":1731956365,"last_edit_date":1732012079,"question_id":79201118,"share_link":"https://stackoverflow.com/q/79201118","body_markdown":"I&#39;m having a large Neo4j database, below is the small subset of nodes and relationships.\r\n[![enter image description here][1]][1]\r\n\r\n\r\n  [1]: https://i.sstatic.net/TpMuzAwJ.png\r\n\r\n\r\nI have 3 different kind of nodes:\r\n\r\n - (Pink) Customers\r\n - (Blue) Transactions\r\n - (Yellow) Terminals\r\n\r\n\r\nIt&#39;s easy to find the pattern below using Cypher, by just indicating the pattern using `MATCH`.\r\n\r\nc1 -[:MADE]-&gt; transaction1 -[:AT]-&gt; terminal &lt;-[:AT]- transaction2 &lt;-[:MADE]- c2\r\n\r\nWe consider that this means that `c2` node, is a 2nd connection degree neighbour to `c1`.\r\n\r\nBut this could be done simply for connection degree of 2. How can I find `k`th connection degree neighbours to a given customer node, for k&gt;2 ? I&#39;m looking for only `Customer` neigbour nodes.\r\n\r\nI&#39;m using Python to execute my cypher queries in neo4j. I know I can maybe append the pattern `k` times in my query string to achieve this goal, but I want to know if is it possible to just indicate this in one specific cypher query.\r\n\r\nIf there&#39;s any solutions that would let me choose `k` explicitly in my cypher query, that would be great. I couldn&#39;t find anything like that.\r\n\r\nUpdate: I would appreciate a query which can show me the path with the relationships as well, as I would like to check manually and make sure the path is a correct one. ","link":"https://stackoverflow.com/questions/79201118/how-to-find-co-connected-nodes-with-k-relationships-neo4j","title":"How to find co-connected nodes with &#39;k&#39; relationships? - Neo4j"},{"tags":["java","spring","neo4j","enums"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1731708911,"creation_date":1731708911,"answer_id":79194110,"question_id":79192603,"share_link":"https://stackoverflow.com/a/79194110","body_markdown":"`@Node` is supposed to be used to annotate a class that represents nodes in the  database, with each node representable as a separate instance of that class. Since an `enum` just contains a fixed set of constant values (and you can&#39;t create different instances on an `enum` class), it does not make sense to treat an `enum` as a node.\r\n\r\nTo fix your code, you can just remove the `@Node` annotation from the `enum`, and remove the @Relationship annotation as well. That would directly store the `type` as a property of each `Variation ` node. And, if necessary, you can optimize finding all the `Variation` nodes of any given `type` by creating an [index](https://neo4j.com/docs/cypher-manual/current/indexes/search-performance-indexes/overview/) on the `Variation` and `type` combination.","link":"https://stackoverflow.com/questions/79192603/spring-data-neo4j-findall-fails-with-required-property-enumname-not-found-w/79194110#79194110","title":"Spring Data Neo4j: findAll fails with &quot;Required property $enum$name not found&quot; when using enum as a @Node"}],"owner":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":55,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79194110,"answer_count":1,"score":0,"last_activity_date":1731708911,"creation_date":1731677652,"question_id":79192603,"share_link":"https://stackoverflow.com/q/79192603","body_markdown":"I am using Spring Data Neo4j to work with my Neo4j database. My application includes a Variation node entity that has a relationship with an enum called Type. Here is a simplified version of my code:\r\n```\r\n@Node\r\npublic class Variation extends BaseEntity {\r\n    private String title;\r\n\r\n    @Relationship(type = &quot;HAS_ATTRIBUTE&quot;, direction = Relationship.Direction.OUTGOING)\r\n    private Type type;\r\n\r\n    // Other fields and relationships...\r\n}\r\n@Node\r\npublic enum Type {\r\n    CUSTOM(0),\r\n    FIX(1),\r\n    // Other constants...\r\n\r\n    @Id\r\n    private final int id;\r\n\r\n    Type(int id) {\r\n        this.id = id;\r\n    }\r\n}\r\n```\r\n\r\nHere is my ```build.gradle``` dependencies:\r\n\r\n```\r\ndependencies {\r\n    implementation &#39;org.springframework.boot:spring-boot-starter-data-neo4j&#39;\r\n    implementation &#39;org.springframework.boot:spring-boot-starter-web&#39;\r\n    testImplementation &#39;org.springframework.boot:spring-boot-starter-test&#39;\r\n    testRuntimeOnly &#39;org.junit.platform:junit-platform-launcher&#39;\r\n\r\n    implementation &#39;org.projectlombok:lombok&#39;\r\n    annotationProcessor &#39;org.projectlombok:lombok&#39;\r\n}\r\n```\r\n\r\nI am also using a VariationService to create nodes and relationships. The ```findAll``` method on the VariationRepository fails with the following error:\r\n\r\n```\r\njava.lang.IllegalStateException: Required property $enum$name not found for class org.com.example.node.Type\r\n    at org.springframework.data.mapping.PersistentEntity.getRequiredPersistentProperty\r\n    ...\r\n\r\n```\r\nThe error seems to indicate an issue with the Type enum mapping.\r\n\r\nMy question is:\r\n\r\n - How can I configure Spring Data Neo4j to correctly map enums like\r\n   Type as nodes? \r\n - Is there a specific way to handle enum\r\n   properties in Neo4j when using Spring Data?","link":"https://stackoverflow.com/questions/79192603/spring-data-neo4j-findall-fails-with-required-property-enumname-not-found-w","title":"Spring Data Neo4j: findAll fails with &quot;Required property $enum$name not found&quot; when using enum as a @Node"},{"tags":["apache-kafka","neo4j","apache-kafka-connect"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1731623791,"last_edit_date":1731623791,"creation_date":1731616377,"answer_id":79190344,"question_id":79187479,"share_link":"https://stackoverflow.com/a/79190344","body_markdown":"See the doc for the Kafka connector&#39;s [Cypher strategy](https://neo4j.com/docs/kafka/5.1/sink/cypher/). It shows shows an example with 3 topics, one of which is `creates`. At the bottom of the doc is an example of the code generated by the connector to execute the Cypher code configured earlier in the doc for the `creates` topic - it also starts with `UNWIND $events AS message`.\r\n\r\nYour config file is defining the topic `&lt;topic_name&gt;`, which seems wrong. Also, your config file defines Cypher code for the topic `&lt;topic_name&gt;0` (note the extra &quot;0&quot; at the end), which seems even more wrong.\r\n\r\nMake sure you carefully follow the documentation.","link":"https://stackoverflow.com/questions/79187479/neo4j-seems-to-wrap-a-call-query-around-cypher-command/79190344#79190344","title":"Neo4j seems to wrap a CALL query around cypher command"}],"owner":{"reputation":1,"user_id":28277046,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/bafd96223e912597ee367b6f53ae7b78?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"aman suryavanshi","link":"https://stackoverflow.com/users/28277046/aman-suryavanshi"},"last_editor":{"reputation":193168,"user_id":2308683,"user_type":"registered","accept_rate":90,"profile_image":"https://www.gravatar.com/avatar/fb8f5877d244f223b4b6d29e0afb3a4e?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"OneCricketeer","link":"https://stackoverflow.com/users/2308683/onecricketeer"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":69,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1731659713,"creation_date":1731561348,"last_edit_date":1731659713,"question_id":79187479,"share_link":"https://stackoverflow.com/q/79187479","body_markdown":"I am using Kafka Connect for first time on a standalone machine with locally hosted kafka broker and neo4j database running on the same . I am trying to ingest data into neo4j using custom cypher queries , however I get the following error .-&gt;\r\n\r\n```\r\nERROR [neo4j-sink|task-0] WorkerSinkTask{id=neo4j-sink-0} Task threw an uncaught and unrecoverable exception. Task is being killed and will not recover until manually restarted (org.apache.kafka.connect.runtime.WorkerTask:212)\r\norg.apache.kafka.connect.errors.ConnectException: Exiting WorkerSinkTask due to unrecoverable exception.\r\n        at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:632)\r\n        at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:350)\r\n        at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:250)\r\n        at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:219)\r\n        at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:204)\r\n        at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:259)\r\n        at org.apache.kafka.connect.runtime.isolation.Plugins.lambda$withClassLoader$1(Plugins.java:237)\r\n        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\r\n        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\r\n        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\r\n        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\r\n        at java.base/java.lang.Thread.run(Thread.java:834)\r\nCaused by: org.apache.kafka.connect.errors.ConnectException: Tolerance exceeded in error handler\r\n        at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.executeFailed(RetryWithToleranceOperator.java:116)\r\n        at org.apache.kafka.connect.runtime.errors.WorkerErrantRecordReporter.report(WorkerErrantRecordReporter.java:109)\r\n        at org.neo4j.connectors.kafka.sink.Neo4jSinkTask.processMessages(Neo4jSinkTask.kt:73)\r\n        at org.neo4j.connectors.kafka.sink.Neo4jSinkTask.put(Neo4jSinkTask.kt:49)\r\n        at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:601)\r\n        ... 11 more\r\nCaused by: org.neo4j.driver.exceptions.ClientException: Query cannot conclude with CALL (must be a RETURN clause, a FINISH clause, an update clause, a unit subquery call, or a procedure call with no YIELD). (line 1, column 165 (offset: 164))\r\n&quot;UNWIND $events AS message WITH message.value AS event, message.timestamp AS __timestamp, message.header AS __header, message.key AS __key, message.value AS __value CALL {WITH * CREATE (n:Test {timestamp: __value.timestamp}) RETURN n}&quot;\r\n```\r\n\r\nMy Configuration file for kafka connect here is just a test file which contains the following -&gt;\r\n\r\n```\r\nname=neo4j-sink                                                                 \r\nconnector.class=org.neo4j.connectors.kafka.sink.Neo4jConnector                  \r\n#connector.class=streams.kafka.connect.sink.Neo4jSinkConnector                  \r\ntasks.max=1                                                                     \r\n                                                                                \r\n# Kafka configuration                                                           \r\nbootstrap.servers=localhost:9092                                                \r\nkey.converter=io.confluent.connect.avro.AvroConverter                           \r\nvalue.converter=io.confluent.connect.avro.AvroConverter                         \r\nkey.converter.schema.registry.url=http://localhost:8081                         \r\nvalue.converter.schema.registry.url=http://localhost:8081                       \r\n                                                                                \r\nerrors.tolerance=none                                                           \r\nerrors.log.enable=true                                                          \r\nerrors.log.include.messages=true                                                \r\n                                                                                \r\n# Topic configuration                                                           \r\ntopics=&lt;topic_name&gt;\r\n# Neo4j connection                                                              \r\nneo4j.uri=bolt://localhost:7687                                                 \r\nneo4j.authentication.basic.username=&lt;usename&gt;                                       \r\nneo4j.authentication.basic.password=&lt;pass&gt;                                    \r\n                                                                                \r\n# Simplified Cypher query that just creates a Check node for each message       \r\nneo4j.cypher.topic.&lt;topic_name&gt;0=CREATE (n:Test {timestamp: __value.timestamp}) RETURN n\r\n```\r\n\r\nCould someone help me with why my query being wrapped around by a CALL statement . and how does it expect me to give a RETURN to the same. Or am I missing something ? \r\n\r\n\r\n\r\nThis file is just a test file and I expected for a new node of TEST type to be formed for every message . My original cypher query is pretty complex which involves multiple nested calls as well . ","link":"https://stackoverflow.com/questions/79187479/neo4j-seems-to-wrap-a-call-query-around-cypher-command","title":"Neo4j seems to wrap a CALL query around cypher command"},{"tags":["algorithm","neo4j","nodes","relationship"],"comments":[{"owner":{"reputation":21212,"user_id":16582,"user_type":"registered","accept_rate":67,"profile_image":"https://www.gravatar.com/avatar/febff21383acf755f8b375c322e36f2b?s=256&d=identicon&r=PG","display_name":"ravenspoint","link":"https://stackoverflow.com/users/16582/ravenspoint"},"edited":false,"score":0,"creation_date":1731255892,"post_id":79174469,"comment_id":139613793,"link":"https://stackoverflow.com/questions/79174469/create-middle-nodes-on-all-interrelated-other-nodes#comment139613793_79174469"},{"owner":{"reputation":134717,"user_id":56778,"user_type":"registered","accept_rate":93,"profile_image":"https://www.gravatar.com/avatar/34b152ef95a49568ce45df38cd87e54b?s=256&d=identicon&r=PG","display_name":"Jim Mischel","link":"https://stackoverflow.com/users/56778/jim-mischel"},"edited":false,"score":0,"creation_date":1731255912,"post_id":79174469,"comment_id":139613795,"link":"https://stackoverflow.com/questions/79174469/create-middle-nodes-on-all-interrelated-other-nodes#comment139613795_79174469"},{"owner":{"reputation":21212,"user_id":16582,"user_type":"registered","accept_rate":67,"profile_image":"https://www.gravatar.com/avatar/febff21383acf755f8b375c322e36f2b?s=256&d=identicon&r=PG","display_name":"ravenspoint","link":"https://stackoverflow.com/users/16582/ravenspoint"},"edited":false,"score":0,"creation_date":1731256105,"post_id":79174469,"comment_id":139613805,"link":"https://stackoverflow.com/questions/79174469/create-middle-nodes-on-all-interrelated-other-nodes#comment139613805_79174469"}],"answers":[{"tags":[],"owner":{"reputation":21212,"user_id":16582,"user_type":"registered","accept_rate":67,"profile_image":"https://www.gravatar.com/avatar/febff21383acf755f8b375c322e36f2b?s=256&d=identicon&r=PG","display_name":"ravenspoint","link":"https://stackoverflow.com/users/16582/ravenspoint"},"comment_count":0,"down_vote_count":0,"up_vote_count":0,"is_accepted":true,"score":0,"last_activity_date":1731257018,"creation_date":1731257018,"answer_id":79175302,"question_id":79174469,"share_link":"https://stackoverflow.com/a/79175302","body_markdown":"I am thinking that what you call a &#39;cluster&#39; is what is called in graph theory a &#39;strongly connected component in a direct graph&#39;  https://en.wikipedia.org/wiki/Strongly_connected_component\r\n\r\n  You ask for a better performance than O(n) but you do not say what n is.  Perhaps it is the number of nodes?  The best algorithm for finding strongly connected components is O(V+E) where V is the number of nodes and E is the number of connections.  So what you ask for is impossible.","link":"https://stackoverflow.com/questions/79174469/create-middle-nodes-on-all-interrelated-other-nodes/79175302#79175302","title":"Create middle nodes on all interrelated other nodes"}],"owner":{"reputation":3,"user_id":19525790,"user_type":"registered","profile_image":"https://i.sstatic.net/u4RSk.jpg?s=256","display_name":"kommpn","link":"https://stackoverflow.com/users/19525790/kommpn"},"last_editor":{"reputation":3,"user_id":19525790,"user_type":"registered","profile_image":"https://i.sstatic.net/u4RSk.jpg?s=256","display_name":"kommpn","link":"https://stackoverflow.com/users/19525790/kommpn"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":60,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79175302,"answer_count":1,"score":0,"last_activity_date":1731257018,"creation_date":1731227965,"last_edit_date":1731245509,"question_id":79174469,"share_link":"https://stackoverflow.com/q/79174469","body_markdown":"I&#39;m having some troubles on creating a relationship-based program, what I need is to create a function to aggregate related nodes together, like this, if I have those 4 nodes:\r\n\r\n- A\r\n- B\r\n- C\r\n- D\r\n\r\nIf A -\\&gt; B, B -\\&gt; C, C -\\&gt; D, A -\\&gt; C, B -\\&gt; D, like this:\r\n[nodes](https://i.sstatic.net/UmbNZLzE.png)\r\n\r\nWhen A -\\&gt; D, I&#39;d like to create an intermediate Node, replacing all relationships between those nodes with a single connection from each node to this new one. Like this:\r\n\r\n@ \\&lt;- cluster\r\n\r\nA -\\&gt;@,  B -\\&gt; @,  C -\\&gt; @, D -\\&gt; @\r\n\r\nSo whoever is connected to @, has a relationship with all of its members\r\n\r\nThis to avoid 5x5, 10x10, 25x25 relationships, which is really heavy for memory.\r\n\r\nI&#39;ve achieved this goal in several steps, first I calculate common nodes between the twos who must be connected, if those common nodes are \\&gt; 5, then I cluster them in a group and delete their connections.\r\n\r\nAlso when a connection is removed, meaning that under a certain lower bound, the cluster must be dismantled and all single relationships between nodes must be recreated,\r\n\r\nIf common users are \\&gt; 100 this approach could be dangerous.\r\n\r\nI&#39;d like to know if someone could help me to do such things, as the creation of the cluster or dismantling it in reasonable time, because now my technique is O(n) and is very resource consuming\r\n\r\nThank you in advance","link":"https://stackoverflow.com/questions/79174469/create-middle-nodes-on-all-interrelated-other-nodes","title":"Create middle nodes on all interrelated other nodes"},{"tags":["neo4j","cypher"],"comments":[{"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1731099029,"post_id":79169028,"comment_id":139607305,"link":"https://stackoverflow.com/questions/79169028/unable-to-load-csv-via-https-private-url-neo4j-5-18#comment139607305_79169028"},{"owner":{"reputation":7012,"user_id":4672460,"user_type":"registered","accept_rate":100,"profile_image":"https://lh3.googleusercontent.com/-mB94BXJlMNQ/AAAAAAAAAAI/AAAAAAAAAJs/MHpWCe_NQJM/s256-rj/photo.jpg","display_name":"Selaka Nanayakkara","link":"https://stackoverflow.com/users/4672460/selaka-nanayakkara"},"reply_to_user":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"edited":false,"score":0,"creation_date":1731128470,"post_id":79169028,"comment_id":139608410,"link":"https://stackoverflow.com/questions/79169028/unable-to-load-csv-via-https-private-url-neo4j-5-18#comment139608410_79169028"}],"answers":[{"comments":[{"owner":{"reputation":7012,"user_id":4672460,"user_type":"registered","accept_rate":100,"profile_image":"https://lh3.googleusercontent.com/-mB94BXJlMNQ/AAAAAAAAAAI/AAAAAAAAAJs/MHpWCe_NQJM/s256-rj/photo.jpg","display_name":"Selaka Nanayakkara","link":"https://stackoverflow.com/users/4672460/selaka-nanayakkara"},"edited":false,"score":0,"creation_date":1731128565,"post_id":79171213,"comment_id":139608413,"link":"https://stackoverflow.com/questions/79169028/unable-to-load-csv-via-https-private-url-neo4j-5-18/79171213#comment139608413_79171213"}],"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":1,"down_vote_count":0,"up_vote_count":0,"is_accepted":false,"score":0,"last_activity_date":1731097044,"last_edit_date":1731097044,"creation_date":1731091355,"answer_id":79171213,"question_id":79169028,"share_link":"https://stackoverflow.com/a/79171213","body_markdown":"Assuming that the CSV file is on the same computer as the neo4j server, you are using the wrong [URI scheme](https://en.wikipedia.org/wiki/List_of_URI_schemes), &quot;https&quot;, and you should be using the [&quot;file&quot;](https://en.wikipedia.org/wiki/File_URI_scheme) scheme instead.\r\n\r\nFor example, if the local file were in the neo4j [import directory](https://neo4j.com/docs/operations-manual/5/configuration/file-locations/#neo4j-import), then use this clause:\r\n\r\n    LOAD CSV WITH HEADERS FROM &quot;file:///mysample.csv&quot; AS row\r\n\r\nSee the docs [here](https://neo4j.com/docs/cypher-manual/current/clauses/load-csv/#_import_local_files) and [here](https://neo4j.com/docs/getting-started/data-import/csv-import/#_reading_csv_files) for more info.","link":"https://stackoverflow.com/questions/79169028/unable-to-load-csv-via-https-private-url-neo4j-5-18/79171213#79171213","title":"Unable to LOAD CSV via https private URL neo4j 5.18"}],"owner":{"reputation":7012,"user_id":4672460,"user_type":"registered","accept_rate":100,"profile_image":"https://lh3.googleusercontent.com/-mB94BXJlMNQ/AAAAAAAAAAI/AAAAAAAAAJs/MHpWCe_NQJM/s256-rj/photo.jpg","display_name":"Selaka Nanayakkara","link":"https://stackoverflow.com/users/4672460/selaka-nanayakkara"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":2,"delete_vote_count":0,"close_vote_count":0,"is_answered":false,"view_count":61,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"answer_count":1,"score":0,"last_activity_date":1731098910,"creation_date":1731047490,"last_edit_date":1731098910,"question_id":79169028,"share_link":"https://stackoverflow.com/q/79169028","body_markdown":"I&#39;m using the below query to load CSV from a private URL, and am enabling imports from files in `neo4j.conf`:\r\n\r\n    dbms.security.allow_csv_import_from_file_urls=true\r\n\r\nBut this Cypher code:\r\n\r\n    LOAD CSV WITH HEADERS FROM &quot;https://mySample/api/File/DownloadFile/mysample.csv&quot; AS row\r\n\r\n\r\nfails with the error:\r\n\r\n&gt; Cypher Neo4j Couldn&#39;t load the external resource from URL\r\n&gt; https://mySample/api/File/DownloadFile/mysample.csv\r\n\r\nstacktraces:\r\n\r\n    Caused by: org.neo4j.exceptions.CypherExecutionException: Failed to parse query LOAD CSV FROM &quot;https://mySample/api/File/DownloadFile/mysample.csv.\r\n    at org.neo4j.cypher.internal.ast.factory.neo4j.JavaCCParser$.parse(JavaCCParser.scala:61) ~[neo4j-cypher-ast-factory-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.Parse$.process(Parse.scala:38) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.Parse$.process(Parse.scala:31) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.Phase.$anonfun$transform$1(Phase.scala:36) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.helpers.package$.$anonfun$closing$1(package.scala:25) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.helpers.package$.using(package.scala:34) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.helpers.package$.closing(package.scala:25) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.Phase.transform(Phase.scala:35) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.Phase.transform$(Phase.scala:33) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.Parse$.transform(Parse.scala:31) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.frontend.phases.PipeLine.transform(Transformer.scala:78) ~[neo4j-front-end-5.18.1.jar:5.18.1]\r\n    at org.neo4j.cypher.internal.compiler.CypherParsing.parseQuery(CypherParsing.scala:80) ~[neo4j-cypher-planner-5.18.1.jar:5.18.1]\r\n    at org.neo4j.router.impl.query.QueryProcessorImpl.parse(QueryProcessorImpl.java:271) ~[neo4j-query-router-5.18.1.jar:5.18.1]\r\n    at org.neo4j.router.impl.query.QueryProcessorImpl.prepareQueryForCache(QueryProcessorImpl.java:160) ~[neo4j-query-router-5.18.1.jar:5.18.1]\r\n    at org.neo4j.router.impl.query.QueryProcessorImpl.getFromCache(QueryProcessorImpl.java:144) ~[neo4j-query-router-5.18.1.jar:5.18.1]\r\n    at org.neo4j.router.impl.query.QueryProcessorImpl.processQuery(QueryProcessorImpl.java:104) ~[neo4j-query-router-5.18.1.jar:5.18.1]\r\n    at org.neo4j.router.impl.QueryRouterImpl.executeQuery(QueryRouterImpl.java:198) ~[neo4j-query-router-5.18.1.jar:5.18.1]\r\n    at org.neo4j.router.impl.bolt.QueryRouterBoltSpi$Transaction.executeQuery(QueryRouterBoltSpi.java:162) ~[neo4j-query-router-5.18.1.jar:5.18.1]\r\n    at org.neo4j.bolt.tx.TransactionImpl.run(TransactionImpl.java:136) ~[neo4j-bolt-5.18.1.jar:5.18.1]\r\n    at org.neo4j.bolt.protocol.common.fsm.transition.transaction.CreateStatementStateTransition.process(CreateStatementStateTransition.java:48) ~[neo4j-bolt-5.18.1.jar:5.18.1]\r\n\r\n\r\n\r\nExpected behavior\r\nneo4j 5.18 should load the csv file from the given private URL\r\n\r\nActual behavior\r\nUnable load neo4j 5.18 from the given private URL\r\n\r\nNote:\r\n\r\nSame private URL gets downloaded via accessing the browser.\r\nAlso other public csv url&#39;s gets loaded from neo4j as well.","link":"https://stackoverflow.com/questions/79169028/unable-to-load-csv-via-https-private-url-neo4j-5-18","title":"Unable to LOAD CSV via https private URL neo4j 5.18"},{"tags":["java","neo4j","spring-data"],"answers":[{"comments":[{"owner":{"reputation":3,"user_id":16556792,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-en4V_Vj0Ypw/AAAAAAAAAAI/AAAAAAAAScg/4wjUpa_5SHY/s256-rj/photo.jpg","display_name":"Vitalii Ungurean","link":"https://stackoverflow.com/users/16556792/vitalii-ungurean"},"edited":false,"score":0,"creation_date":1730929007,"post_id":79164134,"comment_id":139593642,"link":"https://stackoverflow.com/questions/79164066/how-to-map-element-id-to-dto-object-field/79164134#comment139593642_79164134"}],"tags":[],"owner":{"reputation":2968,"user_id":5719229,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/6ce9838b80ca63bca34363ae64e500a1?s=256&d=identicon&r=PG","display_name":"Sercan Noyan Germiyanoğlu","link":"https://stackoverflow.com/users/5719229/sercan-noyan-germiyano%c4%9flu"},"comment_count":1,"down_vote_count":0,"up_vote_count":0,"is_accepted":true,"score":0,"last_activity_date":1730923880,"creation_date":1730923880,"answer_id":79164134,"question_id":79164066,"share_link":"https://stackoverflow.com/a/79164134","body_markdown":"I can produce this solution way shown below\r\n\r\nBy using `@JsonProperty`, it can help clarify which JSON property maps to which field in `SynonymResponse` \r\n\r\n\r\n\r\n    @JsonInclude(JsonInclude.Include.NON_NULL)\r\n    @Builder\r\n    @NoArgsConstructor\r\n    @AllArgsConstructor\r\n    @Getter\r\n    @Setter\r\n    public class SynonymResponse {\r\n        @JsonProperty(&quot;id&quot;) // Ensure this matches what you want to map\r\n        private String id;\r\n        private String synonym;\r\n        private boolean autocomplete;\r\n    }","link":"https://stackoverflow.com/questions/79164066/how-to-map-element-id-to-dto-object-field/79164134#79164134","title":"How to map element ID to DTO object field?"}],"owner":{"reputation":3,"user_id":16556792,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-en4V_Vj0Ypw/AAAAAAAAAAI/AAAAAAAAScg/4wjUpa_5SHY/s256-rj/photo.jpg","display_name":"Vitalii Ungurean","link":"https://stackoverflow.com/users/16556792/vitalii-ungurean"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":38,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79164134,"answer_count":1,"score":0,"last_activity_date":1730923880,"creation_date":1730922545,"question_id":79164066,"share_link":"https://stackoverflow.com/q/79164066","body_markdown":"I&#39;m trying to map the elementId value in the DTO class field in Spring Data, but the mapping doesn&#39;t happen. If I change the field name to something other than id, the mapping is performed.\r\n```\r\n    @Query(&quot;&quot;&quot;\r\n        MATCH (s:Skill {id:$skillId})-[r]-(ss:Synonym)\r\n        RETURN elementId(ss) AS id,\r\n               ss.synonym AS synonym,\r\n               ss.autocomplete AS autocomplete\r\n    &quot;&quot;&quot;)\r\n    Collection&lt;SynonymResponse&gt; findSynonymsBySkill(String skillId);\r\n```\r\n\r\n```\r\nimport com.fasterxml.jackson.annotation.JsonInclude;\r\nimport lombok.*;\r\n\r\n@JsonInclude(JsonInclude.Include.NON_NULL)\r\n@Builder\r\n@NoArgsConstructor\r\n@AllArgsConstructor\r\n@Getter\r\n@Setter\r\npublic class SynonymResponse {\r\n    /** ID. */\r\n    private String id;\r\n    /** Tittle. */\r\n    private String synonym;\r\n    /** Show in autocomplete. */\r\n    private boolean autocomplete;\r\n}\r\n```\r\n```\r\n@Node({&quot;Synonym&quot;})\r\npublic class Synonym {\r\n    @Id\r\n    @GeneratedValue\r\n    private Long id;\r\n    @JsonProperty(\r\n        required = true\r\n    )\r\n    @Property(&quot;synonym&quot;)\r\n    private String title;\r\n    private boolean autocomplete;\r\n\r\n```\r\n\r\nI tried changing the name field in the DTO, but when the name is different, the display occurs.","link":"https://stackoverflow.com/questions/79164066/how-to-map-element-id-to-dto-object-field","title":"How to map element ID to DTO object field?"},{"tags":["neo4j","rdf","rdflib"],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1730926926,"last_edit_date":1730926926,"creation_date":1730924582,"answer_id":79164159,"question_id":79163993,"share_link":"https://stackoverflow.com/a/79164159","body_markdown":"Specify the [Neo4jStoreConfig option](https://neo4j.com/labs/rdflib-neo4j/1.0/neo4jstoreconfig/) `handle_multival_strategy=HANDLE_MULTIVAL_STRATEGY.ARRAY` to store a list of `keyword` values instead of just a single value.\r\n\r\nSee [this test file](https://github.com/neo4j-labs/rdflib-neo4j/blob/23d0635d677385c95f827a1587cf994f36a6355a/test/integration/multival_test.py) for some examples of code that does that.","link":"https://stackoverflow.com/questions/79163993/how-to-add-a-list-as-an-attribute-value-when-using-neo4js-rdflib-parser/79164159#79164159","title":"How to add a list as an attribute value when using Neo4j&#39;s rdflib parser"}],"owner":{"reputation":834,"user_id":3817651,"user_type":"registered","accept_rate":50,"profile_image":"https://www.gravatar.com/avatar/e87ae18415dc9361cc3a099652973983?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"Bahar","link":"https://stackoverflow.com/users/3817651/bahar"},"comment_count":0,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":56,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79164159,"answer_count":1,"score":0,"last_activity_date":1730926926,"creation_date":1730921026,"question_id":79163993,"share_link":"https://stackoverflow.com/q/79163993","body_markdown":"Suppose I have an RDF .ttl file that includes:\r\n\r\n```\r\n&lt;https://example/Product_1&gt; &lt;http://www.w3.org/ns/dcat#keyword&gt; &quot;health&quot;.\r\n&lt;https://example/Product_1&gt; &lt;http://www.w3.org/ns/dcat#keyword&gt; &quot;fitness&quot;.\r\n&lt;https://example/Product_1&gt; &lt;http://www.w3.org/ns/dcat#keyword&gt; &quot;sports&quot;.\r\n```\r\n\r\nI have noticed that if I use rdflib to import this data to Neo4j, using the code described [here][1], things work but only one of the values for the keyword is being imported for my product. Which makes sense because for the &quot;key&quot;  `keyword` we can only have one value. So is there a way that I can make parser parse my .ttl file such that it creates something like:\r\n\r\n`(n:Product {Keyword:[&quot;sports&quot;,&quot;fitness&quot;, &quot;health&quot;]})`\r\n\r\n\r\n  [1]: https://neo4j.com/labs/rdflib-neo4j/1.0/gettingstarted/","link":"https://stackoverflow.com/questions/79163993/how-to-add-a-list-as-an-attribute-value-when-using-neo4js-rdflib-parser","title":"How to add a list as an attribute value when using Neo4j&#39;s rdflib parser"},{"tags":["neo4j"],"comments":[{"owner":{"reputation":1280,"user_id":1132615,"user_type":"registered","profile_image":"https://i.sstatic.net/6XRH8.png?s=256","display_name":"nmervaillie","link":"https://stackoverflow.com/users/1132615/nmervaillie"},"edited":false,"score":1,"creation_date":1730963437,"post_id":79158146,"comment_id":139595336,"link":"https://stackoverflow.com/questions/79158146/why-doesn-t-my-neo4j-database-size-increase-after-adding-data#comment139595336_79158146"},{"owner":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"reply_to_user":{"reputation":1280,"user_id":1132615,"user_type":"registered","profile_image":"https://i.sstatic.net/6XRH8.png?s=256","display_name":"nmervaillie","link":"https://stackoverflow.com/users/1132615/nmervaillie"},"edited":false,"score":0,"creation_date":1730969246,"post_id":79158146,"comment_id":139595876,"link":"https://stackoverflow.com/questions/79158146/why-doesn-t-my-neo4j-database-size-increase-after-adding-data#comment139595876_79158146"},{"owner":{"reputation":1280,"user_id":1132615,"user_type":"registered","profile_image":"https://i.sstatic.net/6XRH8.png?s=256","display_name":"nmervaillie","link":"https://stackoverflow.com/users/1132615/nmervaillie"},"edited":false,"score":0,"creation_date":1731071994,"post_id":79158146,"comment_id":139604573,"link":"https://stackoverflow.com/questions/79158146/why-doesn-t-my-neo4j-database-size-increase-after-adding-data#comment139604573_79158146"}],"answers":[{"tags":[],"owner":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"last_editor":{"reputation":67344,"user_id":974731,"user_type":"registered","profile_image":"https://i.sstatic.net/oTDhd4cA.jpg?s=256","display_name":"cybersam","link":"https://stackoverflow.com/users/974731/cybersam"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1731007037,"last_edit_date":1731007037,"creation_date":1730936471,"answer_id":79164624,"question_id":79158146,"share_link":"https://stackoverflow.com/a/79164624","body_markdown":"Neo4j&#39;s [Space reuse](https://neo4j.com/docs/operations-manual/current/performance/space-reuse/) documentation says:\r\n\r\n&gt; Neo4j uses logical deletes to remove data from the database to achieve\r\n&gt; maximum performance and scalability. A logical delete means that all\r\n&gt; relevant records are marked as deleted, but the space they occupy is\r\n&gt; not immediately returned to the operating system. Instead, it is\r\n&gt; subsequently reused by the transactions creating data.\r\n\r\nand also:\r\n\r\n&gt; The store files [...] do not shrink when data is\r\n&gt; deleted. The space that the deleted records take up is kept in the\r\n&gt; store files. Until the space is reused, the store files are sparse and\r\n&gt; fragmented, but the performance impact of this is usually minimal.\r\n\r\nSo, the data that you added could have been stored in what was unused space in sparsely-populated store files.\r\n\r\nAlso, neo4j does not immediately persist writes to data store files. Instead, it keeps them in memory and also logs them in [transaction logs](https://neo4j.com/docs/operations-manual/current/database-internals/transaction-logs/), periodically doing a [checkpoint](https://neo4j.com/docs/operations-manual/current/database-internals/checkpointing/) to flush the latest writes to the data stores and reduce the size of the transaction log files. So, to see the ultimate effect of recent data changes to persisted data, you should so a checkpoint first (which will actually store the data and reduce the transaction log overhead). You can use the Cypher statement `CALL db.checkpoint()` to force a checkpoint.","link":"https://stackoverflow.com/questions/79158146/why-doesn-t-my-neo4j-database-size-increase-after-adding-data/79164624#79164624","title":"Why doesn’t my Neo4j database size increase after adding data?"}],"owner":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":111,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79164624,"answer_count":1,"score":0,"last_activity_date":1731007037,"creation_date":1730794140,"question_id":79158146,"share_link":"https://stackoverflow.com/q/79158146","body_markdown":"I’m using Neo4j to work with a graph, and I need to measure the database size to understand how much space my nodes and relationships occupy after adding new data. To do this, I go to the root folder data/databases and check the size of the data folders. However, after adding a large amount of data, I notice that the folder sizes remain the same.\r\n\r\nWhat could be causing this issue? Is Neo4j caching data or using some kind of optimization that prevents these changes from being reflected in the file system? Or is there an action I need to take to update the data on disk?\r\n\r\nAny hints or advice would be greatly appreciated.","link":"https://stackoverflow.com/questions/79158146/why-doesn-t-my-neo4j-database-size-increase-after-adding-data","title":"Why doesn’t my Neo4j database size increase after adding data?"},{"tags":["neo4j"],"comments":[{"owner":{"reputation":30487,"user_id":92359,"user_type":"registered","accept_rate":94,"profile_image":"https://www.gravatar.com/avatar/664d3d4c50c731d90a32db5f9e01b4b9?s=256&d=identicon&r=PG","display_name":"InverseFalcon","link":"https://stackoverflow.com/users/92359/inversefalcon"},"edited":false,"score":0,"creation_date":1730484492,"post_id":79148797,"comment_id":139564756,"link":"https://stackoverflow.com/questions/79148797/variable-execution-time-for-the-same-query-in-neo4j#comment139564756_79148797"},{"owner":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"reply_to_user":{"reputation":30487,"user_id":92359,"user_type":"registered","accept_rate":94,"profile_image":"https://www.gravatar.com/avatar/664d3d4c50c731d90a32db5f9e01b4b9?s=256&d=identicon&r=PG","display_name":"InverseFalcon","link":"https://stackoverflow.com/users/92359/inversefalcon"},"edited":false,"score":0,"creation_date":1730491000,"post_id":79148797,"comment_id":139565256,"link":"https://stackoverflow.com/questions/79148797/variable-execution-time-for-the-same-query-in-neo4j#comment139565256_79148797"},{"owner":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"reply_to_user":{"reputation":30487,"user_id":92359,"user_type":"registered","accept_rate":94,"profile_image":"https://www.gravatar.com/avatar/664d3d4c50c731d90a32db5f9e01b4b9?s=256&d=identicon&r=PG","display_name":"InverseFalcon","link":"https://stackoverflow.com/users/92359/inversefalcon"},"edited":false,"score":0,"creation_date":1730552374,"post_id":79148797,"comment_id":139567756,"link":"https://stackoverflow.com/questions/79148797/variable-execution-time-for-the-same-query-in-neo4j#comment139567756_79148797"}],"answers":[{"tags":[],"owner":{"reputation":30487,"user_id":92359,"user_type":"registered","accept_rate":94,"profile_image":"https://www.gravatar.com/avatar/664d3d4c50c731d90a32db5f9e01b4b9?s=256&d=identicon&r=PG","display_name":"InverseFalcon","link":"https://stackoverflow.com/users/92359/inversefalcon"},"comment_count":0,"down_vote_count":0,"up_vote_count":1,"is_accepted":true,"score":1,"last_activity_date":1730581130,"creation_date":1730581130,"answer_id":79151576,"question_id":79148797,"share_link":"https://stackoverflow.com/a/79151576","body_markdown":"The cause of the slowdown is that you do not have an index on `:Person(person_id)`, that would explain why early runs (with little data) execute fast, but become increasingly expensive as data is loaded, or over a larger CSV to ingest.\r\n\r\nWithout an index, the cost of the MATCH part of the MERGE (since a MERGE is like a MATCH and then a CREATE, if no matches were found) increases linearly with the number of :Person nodes in the graph. With an index, there is still a rising cost, but it&#39;s log(n) complexity due to index use, so should remain efficient.\r\n\r\nAdd the index, confirm that the index is used in the EXPLAIN plan (you should see a NodeIndexSeek operator and no NodeByLabelScan operators), then test again.","link":"https://stackoverflow.com/questions/79148797/variable-execution-time-for-the-same-query-in-neo4j/79151576#79151576","title":"Variable execution time for the same query in Neo4j"}],"owner":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"last_editor":{"reputation":63,"user_id":17017525,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/3d6b2b30dc673108dec570ea4cd0d1ec?s=256&d=identicon&r=PG&f=y&so-version=2","display_name":"it_would_be_better","link":"https://stackoverflow.com/users/17017525/it-would-be-better"},"comment_count":3,"delete_vote_count":0,"close_vote_count":0,"is_answered":true,"view_count":57,"favorite_count":0,"down_vote_count":0,"up_vote_count":0,"accepted_answer_id":79151576,"answer_count":1,"score":0,"last_activity_date":1730581130,"creation_date":1730479111,"last_edit_date":1730552356,"question_id":79148797,"share_link":"https://stackoverflow.com/q/79148797","body_markdown":"I am running the same query in Neo4j and noticing that the execution time varies significantly. For example, the query might execute in 5-6 seconds, while at another time it takes 2-3 minutes, even though the data remains unchanged.\r\n\r\n```\r\n:param {\r\n  idsToExclude: []\r\n};\r\n\r\n:auto LOAD CSV WITH HEADERS FROM (&#39;file:///PERSON_DATA.csv&#39;) AS row\r\nWITH row\r\nWHERE NOT row.`person_id` IN $idsToExclude AND NOT row.`person_id` IS NULL\r\nCALL {\r\n  WITH row\r\n  MERGE (n: `Person` { `person_id`: row.`person_id` })\r\n  SET n.`person_id` = row.`person_id`\r\n  SET n.`name` = row.`name`\r\n  SET n.`age` = toInteger(row.`age`)\r\n  SET n.`email` = row.`email`\r\n  SET n.`address` = row.`address`\r\n  SET n.`creation_date` = datetime(row.`creation_date`)\r\n  SET n.`last_modified_date` = datetime(row.`last_modified_date`)\r\n} IN TRANSACTIONS OF 5000 ROWS;\r\n```\r\nhere is some data from my config file that has been uncommented if needed \r\n```\r\nserver.memory.heap.initial_size=8G\r\nserver.memory.heap.max_size=16G\r\ndbms.memory.transaction.total.max=32G\r\n```\r\n\r\nEXPLAIN of my Query\r\n\r\n[![First part][1]][1]\r\n[![Second part][2]][2]\r\n[![Second part][3]][3]\r\n\r\nWhy can the execution of the same query in Neo4j take different amounts of time? What factors can influence this, and how can I optimize its performance?\r\n\r\n\r\n  [1]: https://i.sstatic.net/HP6Hr4Oy.png\r\n  [2]: https://i.sstatic.net/jiUGxyFd.png\r\n  [3]: https://i.sstatic.net/65b6kScB.png","link":"https://stackoverflow.com/questions/79148797/variable-execution-time-for-the-same-query-in-neo4j","title":"Variable execution time for the same query in Neo4j"}],"has_more":true,"quota_max":300,"quota_remaining":295}