I have 3 entities I want to pre-annotate with two reltionships like so:
e1–r1–>e2–>r2—>e3
I can do:
e1–r1–>e2 or e2–r2–>e3 separately, but doing the full relationship path returns error.
entity1 = lb.types.ObjectAnnotation(
name="entity1",
value=lb.types.TextEntity(
start=60,
end=80
)
)
entity2 = lb.types.ObjectAnnotation(
name="entity2",
value=lb.types.TextEntity(
start=200,
end=204
)
)
entity3 = lb.types.ObjectAnnotation(
name="entity3",
value=lb.types.TextEntity(
start=206,
end=208
)
)
r1 = lb.types.RelationshipAnnotation(
name="r1",
value=lb.types.Relationship(
source=entity1,
target=entity2,
type=lb.types.Relationship.Type.UNIDIRECTIONAL,
)
)
r2 = lb.types.RelationshipAnnotation(
name="r2",
value=lb.types.Relationship(
source=entity2,
target=entity3,
type=lb.types.Relationship.Type.UNIDIRECTIONAL,
)
)
#UPLOADING THIS WORKS FINE
label = lb.types.Label(
data=lb.types.TextData(global_key=GLOBAL_KEY),
annotations=[entity1, entity2, r1],,
)
#UPLOADING THIS WORKS FINE
label = lb.types.Label(
data=lb.types.TextData(global_key=GLOBAL_KEY),
annotations=[entity2, entity3, r2],,
)
#UPLOADING THIS DOES NOT WORK
label = lb.types.Label(
data=lb.types.TextData(global_key=GLOBAL_KEY),
annotations=[entity1, entity2, entity3, r1, r2],,
)
the error returned:
[{
'status': 'FAILURE',
'errors': [{'name': 'InvalidAnnotation',
'message': 'target annotation uuid was not found in current import',
'additionalInfo': None}]}]
What ends up happening is the all entities are pre-annotated, but r2 is not.