# Should avoid duplicate results from Cypher queries in "Building Knowledge Graphs with LLMs"

**URL:** <https://community.neo4j.com/t/should-avoid-duplicate-results-from-cypher-queries-in-building-knowledge-graphs-with-llms/72859>\
**Category:** Graph Academy\
**Created:** [March 3, 2025, 4:04am UTC](https://community.neo4j.com/t/should-avoid-duplicate-results-from-cypher-queries-in-building-knowledge-graphs-with-llms/72859 "2025-03-03T04:04:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![astrosam](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/astrosam/32/26153_2.png) [@astrosam](https://community.neo4j.com/u/astrosam)\
**Post date:** [March 3, 2025, 4:04am UTC](https://community.neo4j.com/t/should-avoid-duplicate-results-from-cypher-queries-in-building-knowledge-graphs-with-llms/72859/1 "2025-03-03T04:04:51Z")

</div>

Course: Building Knowledge Graphs with LLMs  
Page: [https://graphacademy.neo4j.com/courses/llm-knowledge-graph-construction/2-llm-graph-builder/3-explore-graph/](https://graphacademy.neo4j.com/courses/llm-knowledge-graph-construction/2-llm-graph-builder/3-explore-graph/)

Issue 1: The first 2 Cypher queries on this page return some duplicate results -- they should return `DISTINCT` results instead.

Issue 2: The 3rd Cypher query must specify the label for `e`, as in: `MATCH p = (d)-[*0..3]-(e: __Entity__ )`, or else the query does not do what is claimed. (Also, `0..3` should really be `..3`, since a `Document` node will never be an ` __Entity__ ` node.)

---

<div class="post-metadata">

**Author:** ![martin.ohanlon](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/martin.ohanlon/32/35829_2.png) [@martin.ohanlon](https://community.neo4j.com/u/martin.ohanlon)\
**Post date:** [March 3, 2025, 9:37am UTC](https://community.neo4j.com/t/should-avoid-duplicate-results-from-cypher-queries-in-building-knowledge-graphs-with-llms/72859/2 "2025-03-03T09:37:48Z")

</div>

Hi,

Thanks for your comments.

re 1 - Ok. I think its important to show the raw output and let people observe what happens, individuals can add DISTINCT to the RETURN if they feel that is appropriate. I dont want to over sanitize hiding detail from people.

re 2 - Yes, when we created the course the ` __Entity__ ` label wasnt included by the LLM Graph Builder - we could improve that now.

Thanks again

Martin
