Skip to content

Commit f5cbdf1

Browse files
committed
Fixed issue with bool props when generating an enhanced schema
1 parent 8b163e4 commit f5cbdf1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/neo4j_graphrag/schema.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def get_structured_schema(
251251
],
252252
'metadata': {
253253
'constraint': [
254-
{'id': 7, 'name': 'person_id', 'type': 'UNIQUENESS', 'entityType': 'NODE', 'labelsOrTypes': ['Persno'], 'properties': ['id'], 'ownedIndex': 'person_id', 'propertyType': None},
254+
{'id': 7, 'name': 'person_id', 'type': 'UNIQUENESS', 'entityType': 'NODE', 'labelsOrTypes': ['Person'], 'properties': ['id'], 'ownedIndex': 'person_id', 'propertyType': None},
255255
],
256256
'index': [
257257
{'label': 'Person', 'properties': ['name'], 'size': 2, 'type': 'RANGE', 'valuesSelectivity': 1.0, 'distinctValues': 2.0},
@@ -753,8 +753,10 @@ def get_enhanced_schema_cypher(
753753
elif prop_type in ["BOOLEAN", "POINT", "DURATION"]:
754754
continue
755755
output_dict[prop_name] = "{" + return_clauses.pop() + "}"
756+
if not output_dict:
757+
return f"{match_clause}\nRETURN {{}} AS output"
756758
# Combine with and return clauses
757-
with_clause = "WITH " + ",\n ".join(with_clauses)
759+
with_clause = "WITH " + ",\n ".join(with_clauses) if with_clauses else ""
758760
return_clause = (
759761
"RETURN {"
760762
+ ", ".join(f"`{k}`: {v}" for k, v in output_dict.items())

0 commit comments

Comments
 (0)