<KBRef>
Category: Control tag Β· AfriAnnotate-specific
Lets an annotator attach a concept from a Knowledge Base to a region
(or to the whole task). Type into the search box; results autocomplete
against the KB's entries (label + aliases + external_id). Pick one and
the annotation stores the concept's external_id + label for later
downstream use.
This is the standard building block for entity linking / concept normalisation / grounding β the layer that lives above plain NER. NER answers "is this a gene?"; KBRef answers "which specific gene is this β HGNC:11998 or HGNC:11999?" Standard for biomedical, legal, historical, and cross-lingual annotation where consistent identifiers matter more than raw text.
Setupβ
Before you can reference a KB from a tag, create the KB itself:
- Open Organization β Settings β Knowledge Bases.
- Click + New KB β name it, pick
local(managed here) /remote(external endpoint) /wikidata. - Add entries directly, or paste TSV/CSV via Bulk importβ¦
(
external_id,label, optionaldescription, optional pipe- or-semicolon-separatedaliases). - Note the
kb=<id>chip on the KB row and use that number in the tag attribute below.
Attributesβ
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | yes | β | Name of the element. |
| toName | string | yes | β | Name of the object tag the KB linking targets (usually the same <Text> / <HyperText> a companion <Labels> tag targets). |
| kb | integer | yes | β | Numeric ID of the Knowledge Base (see Organization β Settings β Knowledge Bases). |
| limit | integer | no | 10 | Maximum number of autocomplete rows to show at once (1β100). |
| placeholder | string | no | Search knowledge base⦠| Placeholder text for the search input. |
| required | boolean | no | false | Whether a KB link is required for this region before submit. |
| requiredMessage | string | no | β | Message to show if validation fails. |
| perRegion | boolean | no | false | Attach the KB link to a specific region (span) instead of the whole task. Set true for entity linking; leave false for task-level classification. |
| perItem | boolean | no | false | Attach the KB link per-item in multi-item objects. |
Result payloadβ
{
"from_name": "concept",
"to_name": "txt",
"type": "kbref",
"value": {
"kbref": {
"external_id": "HGNC:11998",
"label": "TP53",
"description": "Cellular tumor antigen p53",
"aliases": ["p53", "P53_HUMAN"]
}
}
}
Autocomplete rankingβ
Results are ranked in this order:
labelstarts with the query.labelcontains the query anywhere.- Any alias matches the query.
external_idcontains the query.
Example β named-entity linkingβ
Span picker + label + KB search on one canvas. Annotator drags a span, applies the label, then picks the matching KB entry:
<View>
<Labels name="ent" toName="txt">
<Label value="Gene" background="#f2b6c8"/>
<Label value="Disease" background="#f7c5a3"/>
<Label value="Drug" background="#c3e2c2"/>
</Labels>
<Text name="txt" value="$text"/>
<KBRef name="concept" toName="txt" kb="1" perRegion="true"/>
</View>
For a ready-made starting point, pick the Named Entity Linking (KB-backed) template under Natural Language Processing on the project creation Labeling Interface picker.