@@ -113,7 +113,7 @@ def create_relationship_examples(j1, from_entity_id, to_entity_id):
113113
114114 return basic_relationship , relationship_with_props , complex_relationship
115115
116- def update_relationship_examples (j1 , relationship_id ):
116+ def update_relationship_examples (j1 , relationship_id , from_entity_id , to_entity_id ):
117117 """Demonstrate relationship update operations."""
118118
119119 print ("=== Relationship Update Examples ===\n " )
@@ -122,6 +122,8 @@ def update_relationship_examples(j1, relationship_id):
122122 print ("1. Updating basic relationship properties:" )
123123 basic_update = j1 .update_relationship (
124124 relationship_id = relationship_id ,
125+ from_entity_id = from_entity_id ,
126+ to_entity_id = to_entity_id ,
125127 properties = {
126128 'accessLevel' : 'write' ,
127129 'lastModified' : int (time .time ()) * 1000
@@ -133,6 +135,8 @@ def update_relationship_examples(j1, relationship_id):
133135 print ("2. Updating with complex properties:" )
134136 j1 .update_relationship (
135137 relationship_id = relationship_id ,
138+ from_entity_id = from_entity_id ,
139+ to_entity_id = to_entity_id ,
136140 properties = {
137141 'accessLevel' : 'admin' ,
138142 'lastModified' : int (time .time ()) * 1000 ,
@@ -151,6 +155,8 @@ def update_relationship_examples(j1, relationship_id):
151155 print ("3. Updating relationship tags:" )
152156 j1 .update_relationship (
153157 relationship_id = relationship_id ,
158+ from_entity_id = from_entity_id ,
159+ to_entity_id = to_entity_id ,
154160 properties = {
155161 'tag.Status' : 'active' ,
156162 'tag.Priority' : 'high' ,
@@ -159,6 +165,19 @@ def update_relationship_examples(j1, relationship_id):
159165 }
160166 )
161167 print (f"Updated relationship tags\n " )
168+
169+ # 4. Update with custom timestamp
170+ print ("4. Updating with custom timestamp:" )
171+ j1 .update_relationship (
172+ relationship_id = relationship_id ,
173+ from_entity_id = from_entity_id ,
174+ to_entity_id = to_entity_id ,
175+ properties = {
176+ 'lastUpdated' : int (time .time ()) * 1000
177+ },
178+ timestamp = int (time .time ()) * 1000 # Custom timestamp
179+ )
180+ print (f"Updated with custom timestamp\n " )
162181
163182def delete_relationship_examples (j1 , relationship_id ):
164183 """Demonstrate relationship deletion."""
@@ -366,7 +385,7 @@ def main():
366385 basic_rel , props_rel , complex_rel = create_relationship_examples (j1 , from_entity_id , to_entity_id )
367386
368387 # Update examples (using the relationship with properties)
369- update_relationship_examples (j1 , props_rel ['relationship' ]['_id' ])
388+ update_relationship_examples (j1 , props_rel ['relationship' ]['_id' ], from_entity_id , to_entity_id )
370389
371390 # Complete lifecycle example
372391 relationship_lifecycle_example (j1 , from_entity_id , to_entity_id )
0 commit comments