Is there a way to change a relationship property once it has been set using py2neo or cypher? I'm creating an inventory tracker and once an item is "CHECKED_OUT" a property called "status" in the relationship is set to "True". Ideally, once the item is returned or checked in, I'd like to change the "status" property to "False". This way I can keep track of the item and prevent it from being checked out twice.
Here is my code for creating the relationship for a checkout transaction:
def check_out(self, barcode):
emp = self
item = barcode
id = str(uuid.uuid4())
timestamp = int(datetime.now().strftime("%s"))
date = datetime.now().strftime("%F")
status=True
rel = Relationship(emp, "CHECKED_OUT", item, id=id, timestamp=timestamp, date=date, status=status)
if not(graph.create_unique(rel)):
return True
else:
return False
I've read through the py2neo API and I can't seem to find the answer. If modifying the relationship is the wrong approach, can you offer a better one?