Skip to content

Conversation

@orazve
Copy link
Contributor

@orazve orazve commented Jun 7, 2024

The problem from issue #554 was reproduced locally and showed that gds.graph.relationshipProperties.stream has different API in Cypher and Python Client sides: Cypher can get list[str] as relationshipType, but Python Client can get str and list[str].

This PR contain:

  • Fix for issue #554 - usage gds.graph.relationshipProperty.stream without calling separate_property_columns=True parameter
  • Update PyG test version to get all metrics for test step
  • Add tests for gds.graph.relationshipProperties.stream with relationshipType as str

Question: why this problem is not reproduced by CI, where we run kge-predict-transe-pyg-train.ipynb which calls gds.graph.relationshipProperties.stream function with relationshipType as str, not with list[str]?

Before submitting this PR, please read Contributing to the Neo4j Ecosystem.

Make sure:

  • You signed the Neo4j CLA (Contributor License Agreement) so that we are allowed to ship your code in our library
  • Your contribution is covered by tests

@netlify
Copy link

netlify bot commented Jun 7, 2024

Deploy Preview for neo4j-graph-data-science-client canceled.

Name Link
🔨 Latest commit f1cd3eb
🔍 Latest deploy log https://app.netlify.com/sites/neo4j-graph-data-science-client/deploys/66719b6353511b00083ecaa0

@orazve orazve marked this pull request as draft June 7, 2024 17:18
@orazve orazve changed the title Add test to reproduce the problem Support relationshipType set as str, not as list in gds.graph.relationshipPropert[y|ies].stream Jun 14, 2024
@orazve orazve changed the title Support relationshipType set as str, not as list in gds.graph.relationshipPropert[y|ies].stream Support relationshipType as str, not as list only in gds.graph.relationshipPropert[y|ies].stream Jun 14, 2024
@orazve orazve changed the title Support relationshipType as str, not as list only in gds.graph.relationshipPropert[y|ies].stream Support relationship type as str in gds.graph.relationshipProperties.stream Jun 14, 2024
@orazve orazve force-pushed the rel-prop-error branch 2 times, most recently from 6dae722 to b64bdae Compare June 18, 2024 12:23
@orazve orazve marked this pull request as ready for review June 18, 2024 12:39
)


class GraphElementPropertyRunner(GraphEntityOpsBaseRunner):
Copy link
Contributor

Choose a reason for hiding this comment

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

The def relationshipProperty is the only one what uses this runner..? 😮

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, so it was renamed, moved closer to GraphRelationshipPropertiesRunner and added wrapping into a list if string was passed.

@brs96
Copy link
Contributor

brs96 commented Jun 18, 2024

and changelog entries, I think it's two separate bug fixes?

Copy link
Contributor

@FlorentinD FlorentinD left a comment

Choose a reason for hiding this comment

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

Great find!

I have a small suggestion to transform the parameter later.

self, G: Graph, relationship_property: str, relationship_types: Strings = ["*"], **config: Any
) -> DataFrame:
self._namespace += ".stream"
relationship_types = [relationship_types] if isinstance(relationship_types, str) else relationship_types
Copy link
Contributor

Choose a reason for hiding this comment

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

i would suggest to do this transformation as part of _handle_properties.
In our signature, we have Strings here, but these procedures do not always handle both str and list of str.
Such as https://neo4j.com/docs/graph-data-science/current/management-ops/graph-reads/graph-stream-relationships/#_syntax.
For nodeLabels we do support both str and list of str

Copy link
Contributor

Choose a reason for hiding this comment

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

created a card to fix this inconsistency as well in gds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I've made an experiment where I put this wrapping into a list in _handle_properties and it breaks nodeProperty.stream and relationshipProperty.stream cases. And I think we won't need this wrapping when we align APIs after getting this card done.
So I prefer to leave it as it is now and merge.

@orazve orazve merged commit 60ec5da into neo4j:main Jun 24, 2024
@orazve orazve deleted the rel-prop-error branch June 24, 2024 09:41
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.

3 participants