Closed fabrizio-turchi closed 1 month ago
Thank you for reporting. I'll post a fix.
Fixed in #73 . Thanks again!
The code you pushed doesn't seems to solve the issue. If I put the following code in the example.py:
role_created_time = datetime.strptime("2024-09-24T21:38:19", "%Y-%m-%dT%H:%M:%S")
role_df_expert = uco.role.Role(
description="Digital Forensic Mobile Expert",
name="Digital Forensic Incident Response",
created_time=role_created_time
)
bundle.append_to_uco_object(role_df_expert)
has_role_relation = uco.observable.ObservableRelationship(
source=object_identity,
target=role_df_expert,
kind_of_relationship="Has_Role",
directional=True,
)
bundle.append_to_uco_object(has_role_relation)
It raises the TypeError: The target of an ObservableRelationship must be an Observable.
Moreover I realised that the relation "Has_Role" is not included in the list.
Role
s are not natively ObservableObject
s. If you instantiate a uco.core.Relationship
instead of uco.observableObservableRelationship
, you should be fine.
Has_Role
is known to be omitted, but that vocabulary is only suggestive. You can use any string you wish.
Thanks Alex!
The Role class is a subclass of Facet and it's not possible to create a Relation between an Identity (IdentityAbstraction subclass of UcoObject) and a Role , because the ObservableRelationship class expects an UcoObject as source and target properties.