Skip to content
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

cypher响应不规范 #336

Open
zhang-jinqi opened this issue Nov 28, 2023 · 7 comments
Open

cypher响应不规范 #336

zhang-jinqi opened this issue Nov 28, 2023 · 7 comments
Labels
bug Something isn't working cypher the cypher query language

Comments

@zhang-jinqi
Copy link

cql = f"CALL db.createLabel('edge','{edge_name}', '{json.dumps([[vertex_name, target]], ensure_ascii=False)}')'"
responses = run_cypher_by_name(kg_name, cql)
print(responses)
在使用cypher进行数据查询、插入操作时,发现响应结果会缺少错误码,或是输出无关的信息:
{'error_message': 'Label[测试]: Duplicate property definition: [name]'}
{'error_message': 'No such vertex label: 会议'}
{'elapsed': 0.0008828639984130859, 'header': [{'name': '', 'type': 0}], 'result': [], 'size': 0}

@qishipengqsp
Copy link
Collaborator

最后实际传递给tugraph-db执行的cypher是什么?

Copy link

github-actions bot commented Jan 4, 2024

Hello @zhang-jinqi. Please provide more info for debugging. Issues labeled by more info needed will be closed if no activities in 7 days.

你好 @zhang-jinqi, 我们需要你提供更多信息以便于排查问题。7 天内未跟进此 issue 将会被自动关闭。

@zhang-jinqi
Copy link
Author

是这样的cql:cql = f'match (n)-[r]-(l) where n.name CONTAINS "{item[1]}" return n,r,l'

@qishipengqsp
Copy link
Collaborator

cql = f'match (n)-[r]-(l) where n.name CONTAINS "{item[1]}" return n,r,l'

这个cypher好像和下面的response对不上啊。

{'error_message': 'Label[测试]: Duplicate property definition: [name]'}
{'error_message': 'No such vertex label: 会议'}
{'elapsed': 0.0008828639984130859, 'header': [{'name': '', 'type': 0}], 'result': [], 'size': 0}

{item[1]}的值是什么?

@zhang-jinqi
Copy link
Author

具体的隔得有点久,找不到了,是类似查询实体关系、顶点标签、关联实体之间的信息、插入数据等等,但是发现返回的信息中错误情况下和正确情况下,信息格式不统一,对业务上面去判断不太友好。
cql如下:
cql = f"CALL db.createVertexLabel('{vertex_name}','name','name',string,false, "
cql = f"CALL db.createLabel('edge','{edge_name}', '{json.dumps([[vertex_name, target]], ensure_ascii=False)}')'"
cql1 = f'MATCH p=(m)-[r2:{relation}]-(l:{label}) where id(m)={entity_id} RETURN count(p)'
类似于这些

@qishipengqsp
Copy link
Collaborator

嗯,好吧。那可以不管具体的case,我们后面看一下cypher的返回结果的格式统一问题

@qishipengqsp qishipengqsp added bug Something isn't working cypher the cypher query language and removed to be closed labels Jan 5, 2024
@ljcui
Copy link
Collaborator

ljcui commented Jan 11, 2024

具体的隔得有点久,找不到了,是类似查询实体关系、顶点标签、关联实体之间的信息、插入数据等等,但是发现返回的信息中错误情况下和正确情况下,信息格式不统一,对业务上面去判断不太友好。 cql如下: cql = f"CALL db.createVertexLabel('{vertex_name}','name','name',string,false, " cql = f"CALL db.createLabel('edge','{edge_name}', '{json.dumps([[vertex_name, target]], ensure_ascii=False)}')'" cql1 = f'MATCH p=(m)-[r2:{relation}]-(l:{label}) where id(m)={entity_id} RETURN count(p)' 类似于这些

最新的 4.1.0 版本支持使用neo4j的客户端访问,可以试用下,response format 会好很多。
https://github.com/TuGraph-family/tugraph-db/blob/master/docs/zh-CN/source/5.developer-manual/4.client-tools/6.bolt-client.md
https://github.com/TuGraph-family/tugraph-db/tree/master/demo/Bolt
有问题,感谢反馈,会及时修复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cypher the cypher query language
Projects
None yet
Development

No branches or pull requests

3 participants