Relation extraction
After marking spans, reviewers link two of them with a named relation, such as works for or capital of.
When to use it
- Knowledge graph construction
- Who did what to whom in news text
- Drug and dosage links in clinical notes
- Contract parties and obligations
What your file looks like
The file looks like a span file: one passage per row. The links between marked spans are made on the screen, not in the data. A file like this is enough:
id,text
1,Ahmad Shah joined Azmaval in 2026
2,Zarghona works for the universityWhat reviewers see
The text with the span tools, then a Link control with From, relation and To drop-downs listing the marked spans.
What a reviewer submits
A relation points from one span to another by their character ranges and carries a relation label.
{
"answer": {
"spans": [
{
"start": 0,
"end": 10,
"label": "PERSON"
},
{
"start": 18,
"end": 25,
"label": "ORG"
}
],
"relations": [
{
"from": {
"start": 0,
"end": 10
},
"to": {
"start": 18,
"end": 25
},
"label": "works for"
}
]
}
}What you get back
relations lists the links a majority of reviewers drew between spans that themselves reached consensus.
{
"n": 3,
"value": [
{
"start": 0,
"end": 10,
"label": "PERSON",
"text": "Ahmad Shah"
},
{
"start": 18,
"end": 25,
"label": "ORG",
"text": "Azmaval"
}
],
"agreement": null,
"tie": false,
"relations": [
{
"from": {
"start": 0,
"end": 10
},
"to": {
"start": 18,
"end": 25
},
"label": "works for"
}
]
}Quality checks
- Relations are only as good as the spans under them, so train reviewers on spans first.
- Define direction in the guidelines: does works for point from person to organisation?
- Use three or more reviewers, because links are rarer than spans and easy to miss.
Tips
- Keep the relation list short. Three or four relation labels is a realistic target for a first run.
- If your relations always connect the same two labels, say so in the question. It reduces wrong-direction links.
- Check a few rows by hand before the full run.
Limits
Relation labels are optional on a span question. Relations are exported to Label Studio JSON with the spans they connect.
Frequently asked questions
Does the Label Studio export keep relations?
Yes. Each reviewer's annotation exports as Label Studio results, with relation records linking the span records.
Can a relation point to the same span?
No. A relation needs two different spans, and a duplicate of an existing link is rejected.