-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: CypherSyntaxError when storing Property Graph in Neo4j #16880
Comments
Hey @gideon772! I'm here to help you with any bugs, questions, or contributions you have. Let me know how I can assist you! A similar issue was reported in the LlamaIndex repository, where a In your case, the error message indicates a syntax issue with the Here's a general approach to address the issue:
By following these steps, you should be able to resolve the |
@dosu I'm using 5.20.0, then what is the issue, Should I need to update llama index version? |
Updating the LlamaIndex version might help resolve the issue, especially if there have been recent updates or bug fixes related to Neo4j integration. For instance, there have been updates in versions after 0.11.14 that address Neo4j integration issues, such as removing warnings from the dbms server in Neo4j queries and making Neo4j schema refresh configurable [1]. Consider updating to a newer version of LlamaIndex to see if it resolves the |
@dosu I think this query is the issue can you check and change Queryself.structured_query(
f"""
UNWIND $data AS row
MERGE (e:{BASE_NODE_LABEL} {{id: row.id}})
SET e += apoc.map.clean(row.properties, [], [])
SET e.name = row.name, e:`{BASE_ENTITY_LABEL}`
WITH e, row
CALL apoc.create.addLabels(e, [row.label])
YIELD node
WITH e, row
CALL (e, row) {{
WITH e, row
WHERE row.embedding IS NOT NULL
CALL db.create.setNodeVectorProperty(e, 'embedding', row.embedding)
RETURN count(*) AS count
}}
WITH e, row WHERE row.properties.triplet_source_id IS NOT NULL
MERGE (c:{BASE_NODE_LABEL} {{id: row.properties.triplet_source_id}})
MERGE (e)<-[:MENTIONS]-(c)
""",
param_map={"data": chunked_params},
) |
The issue in your query is with the self.structured_query(
f"""
UNWIND $data AS row
MERGE (e:{BASE_NODE_LABEL} {{id: row.id}})
SET e += apoc.map.clean(row.properties, [], [])
SET e.name = row.name, e:`{BASE_ENTITY_LABEL}`
WITH e, row
CALL apoc.create.addLabels(e, [row.label])
YIELD node
WITH e, row
WHERE row.embedding IS NOT NULL
CALL db.create.setNodeVectorProperty(e, 'embedding', row.embedding)
RETURN count(*) AS count
WITH e, row WHERE row.properties.triplet_source_id IS NOT NULL
MERGE (c:{BASE_NODE_LABEL} {{id: row.properties.triplet_source_id}})
MERGE (e)<-[:MENTIONS]-(c)
""",
param_map={"data": chunked_params},
) In this corrected version, the |
@dosu when I use this query getting |
The error you're encountering indicates that the variable self.structured_query(
f"""
UNWIND $data AS row
MERGE (e:{BASE_NODE_LABEL} {{id: row.id}})
SET e += apoc.map.clean(row.properties, [], [])
SET e.name = row.name, e:`{BASE_ENTITY_LABEL}`
WITH e, row
CALL apoc.create.addLabels(e, [row.label])
YIELD node
WITH e, row
WHERE row.embedding IS NOT NULL
CALL db.create.setNodeVectorProperty(e, 'embedding', row.embedding)
WITH e, row // Add this line to carry forward the variables
RETURN count(*) AS count
WITH e, row WHERE row.properties.triplet_source_id IS NOT NULL
MERGE (c:{BASE_NODE_LABEL} {{id: row.properties.triplet_source_id}})
MERGE (e)<-[:MENTIONS]-(c)
""",
param_map={"data": chunked_params},
) By adding a |
Bug Description
Hi,
When attempting to store a Property Graph in a Neo4j database, I have encountered a
CypherSyntaxError
with the messageInvalid input '(': expected "{" (line 10, column 26 (offset: 402))
.Llama Index Versions
Still, the graph was generated successfully.
Generation Status
When I tried to generate without graph store, it worked and I saved the graph using
graph_index.property_graph_store.save_networkx_graph(name=f"./KB_TEST_1.html")
Help me to solve this issue, Thanks in advance 💯
Version
llama-index-core=0.11.14
Steps to Reproduce
Steps to Reproduce
Sample Document Structure
Config
Graph Store Intialization
Graph Generation Code
Relevant Logs/Tracbacks
The text was updated successfully, but these errors were encountered: