Skip to content

Properties types labels loading inspect#32

Merged
brs96 merged 4 commits intoneo4j-contrib:mainfrom
IoannisPanagiotas:properties-types-labels-loading-inspect
Sep 24, 2025
Merged

Properties types labels loading inspect#32
brs96 merged 4 commits intoneo4j-contrib:mainfrom
IoannisPanagiotas:properties-types-labels-loading-inspect

Conversation

@IoannisPanagiotas
Copy link
Collaborator

No description provided.

@IoannisPanagiotas IoannisPanagiotas force-pushed the properties-types-labels-loading-inspect branch from 2278639 to fdb9d23 Compare September 24, 2025 11:21
@IoannisPanagiotas IoannisPanagiotas force-pushed the properties-types-labels-loading-inspect branch 3 times, most recently from 60568a1 to 41915e5 Compare September 24, 2025 12:45
@IoannisPanagiotas IoannisPanagiotas force-pushed the properties-types-labels-loading-inspect branch from 41915e5 to 6da7f29 Compare September 24, 2025 12:53
@IoannisPanagiotas IoannisPanagiotas marked this pull request as ready for review September 24, 2025 12:58
create_relationship_cypher_match_query(node_labels, [])
+ " RETURN DISTINCT TYPE(r) as relationship_types"
)
type_extractor = """
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the this type_extractor part need to be changed? I thought RETURN DISTINCT TYPE(r) as relationship_types worked.

Comment on lines +364 to +375
with driver.session() as session:
session.run("MATCH (n:Foo) DETACH DELETE n")
session.run("MATCH (n:Bar) DETACH DELETE n")

res = session.run(
"MATCH (n) WHERE 'Foo' IN labels(n) OR 'Bar' IN labels(n) RETURN count(n) as count"
)
existing_count2 = res.single()["count"]

driver.close()
# assertions at the end to ensure failures do not affect other tests
assert existing_count2 == 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this section trying to test..?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to ensure all data is deleted, because if something is forgotten to be deleted it will mess up any remaining tests run after it. just a safety check really !

gds = GraphDataScience(driver)
with driver.session() as session:
session.run(
"CREATE (:Foo{prop1:1})-[:R1{relprop1:2}]->(:Bar), (:Bar)-[:R2{relprop2:2}]->(:Bar{prop2:2})"
Copy link
Collaborator

@brs96 brs96 Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to extend this to cover the most general graph.
I believe the only missing case is multi-labelled nodes, and nodes/edges with multiple properties.

assert "relprop1" in rel_props
assert "relprop2" in rel_props
assert "prop1" in node_props
assert "prop2" in node_props
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we want to assert equality of set/multiset(whichever appropriate) for all of them.

UNWIND prop_keys_list AS prop_keys
WITH DISTINCT prop_keys
RETURN COLLECT(prop_keys) AS properties_keys
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test looks good so this should be correct. But I don't see why it had to be changed. Was the property_extractor wrong before?

WITH keys(properties(r)) AS prop_keys_list
UNWIND prop_keys_list AS prop_keys
WITH DISTINCT prop_keys
RETURN COLLECT(prop_keys) AS properties_keys
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test looks good so this should be correct. But I don't see why it had to be changed. Was the property_extractor wrong before?

@IoannisPanagiotas IoannisPanagiotas force-pushed the properties-types-labels-loading-inspect branch from 62056b3 to 1fd189f Compare September 24, 2025 13:26
@IoannisPanagiotas IoannisPanagiotas force-pushed the properties-types-labels-loading-inspect branch from 1fd189f to 74d80c7 Compare September 24, 2025 13:30
@brs96 brs96 merged commit 08ec26d into neo4j-contrib:main Sep 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants