Qanary Annotations
This page documents the annotation types that are actively written into the Qanary triplestore by the current components in this repository. The examples below follow the shape that the code writes today, even where that differs from older or more idealized examples.
Prefixes
Section titled “Prefixes”PREFIX qa: <http://www.wdaqua.eu/qa#>PREFIX qanary: <urn:qanary#>PREFIX oa: <http://www.w3.org/ns/openannotation/core/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>Storage Patterns
Section titled “Storage Patterns”The current components use two annotation target patterns:
- Span-based annotations target a text span inside the stored question. These
annotations are written through
createAnnotationInKnowledgeGraphand use anoa:SpecificResourcewith anoa:TextPositionSelector. - Question-level annotations target the question resource directly. These
annotations are written by manual SPARQL
INSERTqueries and pointoa:hasTargetstraight to the question URI.
For the active writers in this repository:
- Span-based:
AnnotationOfSpotInstance,AnnotationOfInstance,AnnotationOfExpectedAnswerType - Question-level:
AnnotationOfRelation,AnnotationOfAnswerJson,AnnotationOfClarification
All current writers store confidence using oa:score when a score is present.
AnnotationOfClarification currently has no score field.
1. AnnotationOfSpotInstance
Section titled “1. AnnotationOfSpotInstance”Producer: qanary-component-nerd-simple
Main consumer: qanary-component-dis
rdf:type:qanary:AnnotationOfSpotInstanceoa:hasTarget: span-basedoa:SpecificResourceoa:hasBody: JSON string with the detected surface form and entity typeoa:score: NER confidence
<urn:qanary:annotation:0.1234> a qanary:AnnotationOfSpotInstance ; oa:hasTarget [ a oa:SpecificResource ; oa:hasSource <urn:qanary:question:xyz> ; oa:hasSelector [ a oa:TextPositionSelector ; oa:start "12"^^xsd:nonNegativeInteger ; oa:end "19"^^xsd:nonNegativeInteger ] ] ; oa:hasBody "{\"entity\":\"Leipzig\",\"type\":\"CITY\"}" ; oa:score "0.99"^^xsd:double ; oa:annotatedBy <urn:qanary-component-nerd-simple> ; oa:annotatedAt "2026-03-22T10:00:00Z"^^xsd:dateTime .Supported body values
Section titled “Supported body values”The NER component stores a JSON object with this shape:
{ "entity": "Leipzig", "type": "CITY" }Entity types currently produced by the NER component include at least:
TREE, KITA, DISTRICT, STREET, STREET_NUMBER, ZIP, and CITY.
Current limitation: the disambiguation component only implements downstream
support for TREE, KITA, and DISTRICT.
2. AnnotationOfInstance
Section titled “2. AnnotationOfInstance”Producer: qanary-component-dis
Main consumer: qanary-component-sparql-generation
rdf:type:qanary:AnnotationOfInstanceoa:hasTarget: span-basedoa:SpecificResourceoa:hasBody: resolved entity URN stored as a string literaloa:score: disambiguation confidence
<urn:qanary:annotation:0.5678> a qanary:AnnotationOfInstance ; oa:hasTarget [ a oa:SpecificResource ; oa:hasSource <urn:qanary:question:xyz> ; oa:hasSelector [ a oa:TextPositionSelector ; oa:start "12"^^xsd:nonNegativeInteger ; oa:end "19"^^xsd:nonNegativeInteger ] ] ; oa:hasBody "urn:leipzig:trees:entity:12345" ; oa:score "0.85"^^xsd:double ; oa:annotatedBy <urn:leipzigtreechat:component:disambiguation> ; oa:annotatedAt "2026-03-22T10:00:01Z"^^xsd:dateTime .The body is not stored as an RDF IRI node. It is stored as a string literal and later read back as text.
3. AnnotationOfExpectedAnswerType
Section titled “3. AnnotationOfExpectedAnswerType”Producer: qanary-component-eat-simple
rdf:type:qanary:AnnotationOfExpectedAnswerTypeoa:hasTarget: span-basedoa:SpecificResourcecovering the full questionoa:hasBody: Qanary EAT URI stored as a string literaloa:score: classifier confidence
<urn:qanary:annotation:0.9012> a qanary:AnnotationOfExpectedAnswerType ; oa:hasTarget [ a oa:SpecificResource ; oa:hasSource <urn:qanary:question:xyz> ; oa:hasSelector [ a oa:TextPositionSelector ; oa:start "0"^^xsd:nonNegativeInteger ; oa:end "42"^^xsd:nonNegativeInteger ] ] ; oa:hasBody "urn:qanary:eat#number" ; oa:score "0.92"^^xsd:double ; oa:annotatedBy <urn:qanary-component-eat-simple> ; oa:annotatedAt "2026-03-22T10:00:02Z"^^xsd:dateTime .Supported body values
Section titled “Supported body values”The EAT component maps the following values into the urn:qanary:eat#...
namespace:
objectlistnumberboolstringdatetimedatetimetimestampenumeration
4. AnnotationOfRelation
Section titled “4. AnnotationOfRelation”Producer: qanary-component-relation-detection
Main consumer: qanary-component-sparql-generation
rdf:type:qanary:AnnotationOfRelationoa:hasTarget: question URI directlyoa:hasBody: uppercase relation type stringoa:score: classifier confidence
<urn:qanary:annotation:relation-1111> a qanary:AnnotationOfRelation ; oa:hasTarget <urn:qanary:question:xyz> ; oa:hasBody "AMOUNT_WATERED_DISTRICT"^^xsd:string ; oa:score "0.92"^^xsd:double ; oa:annotatedBy <urn:leipzigtreechat:component:relation-detection> ; oa:annotatedAt "2026-03-22T10:00:03Z"^^xsd:dateTime .Supported body values
Section titled “Supported body values”UNKNOWNAMOUNT_WATERED_DISTRICTAMOUNT_SPONSORED_TREESWATERABLE_TREES_AT_ADDRESSTREES_BY_SPECIES_DISTRICTWATERABLE_TREES_AT_KITA
The body is currently a string literal, not a relation URI.
5. AnnotationOfAnswerJson
Section titled “5. AnnotationOfAnswerJson”Producer: qanary-component-sparql-generation
Main consumer: chatbot triplestore service
rdf:type:qanary:AnnotationOfAnswerJsonoa:hasTarget: question URI directlyoa:hasBody: serialized SPARQL JSON result as a string literaloa:score: currently always written as1.0
<urn:qanary:annotation:ans-2222> a qanary:AnnotationOfAnswerJson ; oa:hasTarget <urn:qanary:question:xyz> ; oa:hasBody "{\"head\":{\"vars\":[\"tree\"]},\"results\":{\"bindings\":[{\"tree\":{\"type\":\"uri\",\"value\":\"http://example.org/tree/123\"}}]}}"^^xsd:string ; oa:score "1.0"^^xsd:double ; oa:annotatedBy <urn:leipzigtreechat:component:query_builder> ; oa:annotatedAt "2026-03-22T10:00:04Z"^^xsd:dateTime .The body contains the final answer payload returned from the generated SPARQL query, stored as JSON text.
6. AnnotationOfClarification
Section titled “6. AnnotationOfClarification”Producers: currently written by clarification flows in
qanary-component-dis, qanary-component-eat-simple, and
qanary-component-relation-detection
Main consumer: chatbot triplestore service
rdf:type:qanary:AnnotationOfClarificationoa:hasTarget: question URI directlyoa:hasBody: clarification question text- score: not currently stored
<urn:qanary:annotation:clarification-3333> a qanary:AnnotationOfClarification ; oa:hasBody """Did you mean the oak near the lake or the oak in the city center?""" ; oa:hasTarget <urn:qanary:question:xyz> ; oa:annotatedBy <urn:qanary-component-relation-detection> ; oa:annotatedAt "2026-03-22T10:00:05Z"^^xsd:dateTime .The current helper writes the clarification body as plain text and does not add
oa:score.
Notes and Current Limitations
Section titled “Notes and Current Limitations”- The current repository uses
oa:scorefor scored annotations. Older docs or examples that showqa:scoredo not match the active writers. - The active writers in this repository use
urn:qanary#...annotation class IRIs. Older Qanary examples that use the WDAquaqa:namespace for annotation classes do not match the current stored shape here. AnnotationOfExpectedAnswerTypeis the active EAT annotation type in this codebase.AnnotationOfAnswerTypeis not what the current EAT component writes.- Several bodies that conceptually reference URIs are still stored as string
literals rather than RDF IRI nodes. This applies to at least
AnnotationOfInstanceandAnnotationOfExpectedAnswerType. - The span-based helper currently writes only
oa:TextPositionSelector. It does not persistoa:TextQuoteSelector. AnnotationOfClarificationis intentionally documented without a score, because the active writer does not store one.