Skip to content

Commit c8e0c58

Browse files
committed
Fix rel type setting to cypher call
Call properly the rel_id in kge notebook
1 parent 9c74e2a commit c8e0c58

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

examples/kge-predict-transe-pyg-train.ipynb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,16 +307,13 @@
307307
"outputs": [],
308308
"source": [
309309
"def create_data_from_graph(relationship_type):\n",
310-
" rels_tmp = gds.graph.relationshipProperties.stream(\n",
311-
" ttv_G, [\"rel_id\"], relationship_type, separate_property_columns=True\n",
312-
" )\n",
313-
" # print(rels_tmp)\n",
310+
" rels_tmp = gds.graph.relationshipProperty.stream(ttv_G, \"rel_id\", relationship_type)\n",
314311
" topology = [\n",
315312
" rels_tmp.sourceNodeId.map(lambda x: nodeId_to_id[x]),\n",
316313
" rels_tmp.targetNodeId.map(lambda x: nodeId_to_id[x]),\n",
317314
" ]\n",
318315
" edge_index = torch.tensor(topology, dtype=torch.long)\n",
319-
" edge_type = torch.tensor(rels_tmp.rel_id.astype(int), dtype=torch.long)\n",
316+
" edge_type = torch.tensor(rels_tmp.propertyValue.astype(int), dtype=torch.long)\n",
320317
" data = Data(edge_index=edge_index, edge_type=edge_type)\n",
321318
" data.num_nodes = len(nodeId_to_id)\n",
322319
" display(data)\n",

graphdatascience/graph/base_graph_proc_runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
from ..server_version.compatible_with import compatible_with
1616
from ..server_version.server_version import ServerVersion
1717
from .graph_entity_ops_runner import (
18-
GraphElementPropertyRunner,
1918
GraphLabelRunner,
2019
GraphNodePropertiesRunner,
2120
GraphNodePropertyRunner,
2221
GraphPropertyRunner,
2322
GraphRelationshipPropertiesRunner,
23+
GraphRelationshipPropertyRunner,
2424
GraphRelationshipRunner,
2525
GraphRelationshipsRunner,
2626
)
@@ -390,9 +390,9 @@ def nodeProperties(self) -> GraphNodePropertiesRunner:
390390
return GraphNodePropertiesRunner(self._query_runner, self._namespace, self._server_version)
391391

392392
@property
393-
def relationshipProperty(self) -> GraphElementPropertyRunner:
393+
def relationshipProperty(self) -> GraphRelationshipPropertyRunner:
394394
self._namespace += ".relationshipProperty"
395-
return GraphElementPropertyRunner(self._query_runner, self._namespace, self._server_version)
395+
return GraphRelationshipPropertyRunner(self._query_runner, self._namespace, self._server_version)
396396

397397
@property
398398
def relationshipProperties(self) -> GraphRelationshipPropertiesRunner:

graphdatascience/graph/graph_entity_ops_runner.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@ def _handle_properties(
7070
)
7171

7272

73-
class GraphElementPropertyRunner(GraphEntityOpsBaseRunner):
74-
@compatible_with("stream", min_inclusive=ServerVersion(2, 2, 0))
75-
def stream(self, G: Graph, node_properties: str, node_labels: Strings = ["*"], **config: Any) -> DataFrame:
76-
self._namespace += ".stream"
77-
return self._handle_properties(G, node_properties, node_labels, config)
78-
79-
8073
class GraphNodePropertyRunner(GraphEntityOpsBaseRunner):
8174
@compatible_with("stream", min_inclusive=ServerVersion(2, 2, 0))
8275
@filter_id_func_deprecation_warning()
@@ -197,6 +190,16 @@ def drop(self, G: Graph, node_properties: List[str], **config: Any) -> "Series[A
197190
).squeeze()
198191

199192

193+
class GraphRelationshipPropertyRunner(GraphEntityOpsBaseRunner):
194+
@compatible_with("stream", min_inclusive=ServerVersion(2, 2, 0))
195+
def stream(
196+
self, G: Graph, relationship_property: str, relationship_types: Strings = ["*"], **config: Any
197+
) -> DataFrame:
198+
self._namespace += ".stream"
199+
relationship_types = [relationship_types] if isinstance(relationship_types, str) else relationship_types
200+
return self._handle_properties(G, relationship_property, relationship_types, config)
201+
202+
200203
class GraphRelationshipPropertiesRunner(GraphEntityOpsBaseRunner):
201204
@compatible_with("stream", min_inclusive=ServerVersion(2, 2, 0))
202205
def stream(

graphdatascience/session/aura_api_responses.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def from_json(cls, json: Dict[str, Any]) -> TenantDetails:
164164

165165
# datetime.fromisoformat only works with Python version > 3.9
166166
class TimeParser:
167+
167168
@staticmethod
168169
def fromisoformat(date: str) -> datetime:
169170
if sys.version_info >= (3, 11):

graphdatascience/tests/unit/test_aura_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def test_create_session(requests_mock: Mocker) -> None:
5353

5454

5555
def test_list_session(requests_mock: Mocker) -> None:
56+
5657
api = AuraApi(client_id="", client_secret="", tenant_id="some-tenant")
5758

5859
mock_auth_token(requests_mock)

0 commit comments

Comments
 (0)