Skip to content

Commit

Permalink
renamed type parameter of Relationship to relationship_type to avoid …
Browse files Browse the repository at this point in the history
…naming conflicts with relationship properties
  • Loading branch information
jkminder committed Mar 18, 2024
1 parent f07c226 commit 4a9f9f4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ The library is built specifically for converting data into a [neo4j](https://neo


## Installation
If you have setup a private ssh key for your github, copy-paste the command below to install the latest version ([v1.2.0][latest_tag]):
If you have setup a private ssh key for your github, copy-paste the command below to install the latest version ([v1.2.1][latest_tag]):
```
pip install git+ssh://[email protected]/sg-dev/[email protected].0
pip install git+ssh://[email protected]/sg-dev/[email protected].1
```

If you don't have ssh set up, download the latest wheel [here][latest_wheel] and install the wheel with:
Expand Down Expand Up @@ -93,7 +93,7 @@ converter()
# Known issues
If you encounter a bug or an unexplainable behavior, please check the [known issues](https://github.com/sg-dev/rel2graph/labels/bug) list. If your issue is not found, submit a new one.

[latest_version]: v1.2.0
[latest_tag]: https://github.com/sg-dev/rel2graph/releases/tag/v1.2.0
[latest_wheel]: https://github.com/sg-dev/rel2graph/releases/download/v1.2.0/rel2graph-1.0.1-py3-none-any.whl
[latest_version]: v1.2.1
[latest_tag]: https://github.com/sg-dev/rel2graph/releases/tag/v1.2.1
[latest_wheel]: https://github.com/sg-dev/rel2graph/releases/download/v1.2.1/rel2graph-1.0.1-py3-none-any.whl
[wiki]: https://rel2graph.jkminder.ch/index.html
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------

project = 'rel2graph'
copyright = '2023, Julian Minder'
copyright = '2024, Julian Minder'
author = 'Julian Minder'

# The full version, including alpha/beta/rc tags
Expand Down
18 changes: 9 additions & 9 deletions rel2graph/neo4j/graph_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,41 +547,41 @@ def __hash__(self):

class Relationship(PropertyDict, Subgraph):
@staticmethod
def from_attributes(start_node: Node, type: Attribute, end_node: Node, attributes: List[Attribute] = [], primary_key: str = None):
def from_attributes(start_node: Node, relationship_type: Attribute, end_node: Node, attributes: List[Attribute] = [], primary_key: str = None):
"""Creates a Relationship from a list of attributes and labels
Args:
start_node: Origin of the relationship
type: Type of the relationship
relationship_type: Type of the relationship
end_node: Destination of the relationship
attributes: List of attributes for the relationship
primary_key: Optional key of the primary attribute. Used to merge the Relationship with existing relationships in the graph (default: None)
"""
properties = dict((attr.key, attr.value) for attr in attributes)
relationship = Relationship(start_node, type.value, end_node, **properties)
relationship = Relationship(start_node, relationship_type.value, end_node, **properties)
if primary_key:
relationship.set_primary_key(primary_key)
return relationship

@staticmethod
def from_dict(start_node: Node, end_node: Node, type: str, properties: dict, primary_key: str = None, identity: str = None):
def from_dict(start_node: Node, end_node: Node, relationship_type: str, properties: dict, primary_key: str = None, identity: str = None):
"""Creates a Relationship from a list of attributes and labels
Args:
start_node: Origin of the relationship
end_node: Destination of the relationship
type: Type of the relationship
relationship_type: Type of the relationship
properties: Dictionary of attributes for the relationship
primary_key: Optional key of the primary attribute. Used to merge the relationship with existing relations in the graph (default: None)
"""
relationship = Relationship(start_node, type, end_node, **properties)
relationship = Relationship(start_node, relationship_type, end_node, **properties)
if primary_key:
relationship.set_primary_key(primary_key)
if identity is not None:
relationship.identity = identity
return relationship

def __init__(self, start_node: Node, type: str, end_node: Node, **attributes) -> None:
def __init__(self, start_node: Node, relationship_type: str, end_node: Node, **attributes) -> None:
""" A relationship represents a typed connection between a pair of nodes.
The positional arguments passed to the constructor identify the nodes to
Expand All @@ -596,10 +596,10 @@ def __init__(self, start_node: Node, type: str, end_node: Node, **attributes) ->
Args:
start_node: Origin of the relationship
end_node: Destination of the relationship
type: Type of the relationship
relationship_type: Type of the relationship
attributes: Key value pairs of attributes for the Relationship
"""
self._type = type
self._type = relationship_type

self._start_node = start_node
self._end_node = end_node
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
setup(
name = "rel2graph",
packages = find_packages(),
version = "1.2.0",
version = "1.2.1",
description = "Library for converting relational data into graph data (neo4j)",
author = "Julian Minder",
author_email = "[email protected]",
Expand Down

0 comments on commit 4a9f9f4

Please sign in to comment.