From texts to structured data: Building knowledge graphs through Computer-Assisted Semantic Text Modelling (CASTEMO)
David Zbíral, Robert L. J. Shaw, Petr Hanák, Tomáš Hampejs, and Adam Mertel
This manual documents:
- a data collection workflow of Computer-Assisted Semantic Text Modelling (CASTEMO);
- the conceptual as well as technical structure of CASTEMO knowledge graphs;
- the research environment implementing this workflow - InkVisitor (https://inkvisitor.net).
Cite this manual:
Zbíral, David, Robert L. J. Shaw, Petr Hanák, Tomáš Hampejs, and Adam Mertel. 2026. From Texts to Structured Data: Building Knowledge Graphs through Computer-Assisted Semantic Text Modelling (CASTEMO). Brno: Masaryk University. https://docs.religionistika.phil.muni.cz/books/from-texts-to-structured-data-building-knowledge-graphs-through-computer-assisted-semantic-text-modelling-castemo.
For any inquiries, contact the corresponding author, David Zbíral, at david.zbiral@mail.muni.cz.
- Funding and acknowledgements
- List of abbreviations
- Why knowledge graphs?
- Should I use InkVisitor?
- Editor Role — Rights guide for Admins & Owners
- Entities
- Entities overview
- Actions
- Concepts
- Attributes of entities
- Statements
- Persons
- Groups
- Living Beings
- Objects
- Locations
- Events
- Territories
- Resources
- Values
- Properties
- Relations
- Relations overview
- Superclass (SCL)
- Superordinate Entity (SOE)
- Classification (CLA)
- Identification (IDE)
- Synonym (SYN)
- Antonym (ANT)
- Holonym (HOL)
- Property Reciprocal (PRR)
- Action/Event Equivalent (AEE)
- Implication
- Subject/Actant1 Reciprocal (SAR)
- Actant semantics: Subject Semantics (SUS), Actant 1 Semantics (A1S), and Actant 2 Semantics (A2S)
- Related (REL)
- References
- Corpus in InkVisitor: Managing textual data and representing them in the CASTEMO ontology
- Corpus in the CASTEMO workflow
- General principles of corpus management
- Clean optically recognized texts
- Represent textual versions
- Import a full-text document and start annotating
- Annotate texts with Annotator
- Search and replace strings in full-text documents
- Add anchors using search
- Decide on the focus and extent of annotation
- Collect data in InkVisitor
- Describe your data collection choices
- Statements: entities with Action as their core
- Actants
- Time
- Location
- "Same as above": Referencing information content in CASTEMO knowledge graphs
- Territories and their relation to Resources
- Query, explore, review, and export data
- Query CASTEMO knowledge graphs
- Finding inconsistent and invalid data
- Querying CASTEMO knowledge graphs in Neo4j
- Querying with relations
- Get data of trial events and their participants (DISSINET-specific)
- Querying with counting
- Data import to InkVisitor
- InkVisitor installation on a server
- MedHate annotation instructions
Funding and acknowledgements
The CASTEMO data collection workflow and the InkVisitor research environment were developped by the Dissident Networks Project (DISSINET) research group at the Centre for the Digital Research of Religion, Department for the Study of Religions, Faculty of Arts, Masaryk University.
We gratefully acknowledge the generous financial support of the following institutions and funding schemes:
- European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No. 101000442, project "Networks of Dissent: Computational Modelling of Dissident and Inquisitorial Cultures in Medieval Europe"), 9/2021-9/2023 and the development of the geocoding module in 2026.
- European Regional Development Fund (grant agreement No. CZ.02.01.01/00/22_008/0004595, project “Beyond Security: Role of Conflict in Resilience-Building”), 10/2023-6/2028.
- Czech Science Foundation (EXPRO grant agreement No. GX19-26975X, project "Dissident Religious Cultures in Medieval Europe from the Perspective of Social Network Analysis and Geographic Information Systems"), 1/2019-8/2021
- Masaryk University, Faculty of Arts, Dean's Grant of Excellence in Research, project "InkVisitor Development: Towards a Project-Neutral Open-Source Research Application for the Collection of Structured Relational Data from Texts", 6/2022-6/2023.
List of abbreviations
| Abbreviation |
Meaning |
| A |
Action type |
| B |
Living Being |
| C |
Concept |
| E |
Event |
| G |
Group |
| L |
Location |
| O |
Object (i.e. physical thing) |
| P |
Person |
| R |
Resource |
| S |
Statement |
| T |
Territory |
| prop |
Property |
| metaprop |
Metalevel Property |
Why knowledge graphs?
Knowledge graphs are flexible data structures which store data as (1) nodes, and (2) ties between nodes (also known as edges). Knowledge graphs as a general data structure are not limited to any particular methodology of data analysis (such as network analysis) or to one type of database; rather, they allow the modelling of textual data in ways very close to original sources, enable various reasoning capabilities through logical inferences, and allow a flexible schema, which evolves with the progress of data collection and research.
CASTEMO (Computer-Assisted Semantic Text Modelling) is a workflow for the collection of structured data from textual sources. Its goal is to produce queryable, well-structured, multi-lingual, research-oriented knowledge graphs for long-term and versatile use, rather than for a single use in one publication. It is thus well-adapted, for instance, to historical research and projects which combine qualitative and quantitative methodologies.
The CASTEMO data model contains some pre-defined, and a large variety of flexible, user-defined features. It is based on 11 entity types (SPECTRABLOG – Statements, Persons, Events, Concepts, Territories / Texts, Resources, Actions, Living Beings, Locations, Physical Objects, and Groups) and three kinds of connection between entities: Properties, Relations, and References.
Properties are flexible and extensible structures composed of an origin (the entity to which the Property is being attached), property type, and property value, and read with a “has” logic: e.g.: P current U.S. president — PROP — C area of authority — L United States of America”.
Relations, of which there are seventeen types, serve to model core ontological (e.g. Classification, Identification) and semantic (e.g. Synonymy, Superclass) connections.
References serve to relate knowledge to a specific Resource from which it has been derived.
On the whole, knowledge graphs provide the best way of structuring complex data in ways close to the original expression in textual sources, keeping the analytical layers safely stored but neatly separated from the textual layer.
Should I use InkVisitor?
InkVisitor is excellent when you need to:
- create and manage entities;
- build typed relations between those entities;
- annotate source texts by anchoring entities to specific passages;
- model clauses as subject–verb–object–object quadruples.
Most database managers handle entity creation and relation-building; most annotation tools (such as CATMA) handle text annotation. InkVisitor's distinguishing feature is the combination of both within a single, semantically rich and historically sound data model (CASTEMO), which supports the capture of epistemic levels, modality, and other propositional attributes.
InkVisitor is data collection software, not analysis software. It provides no built-in analytical functions; quantitative analysis is performed subsequently in Python, R and graphical interface applications (Gephi etc.), where the available tooling is extensive and continuously growing. The decision to keep InkVisitor focused solely on data collection reflects a deliberate choice not to replicate what those ecosystems already do well.
Before committing to this approach, consider the following
Time taken to master. Both the application and the underlying data model are complex. Expect a substantial investment of time before the workflow becomes fluent.
Requirement for technical self-sufficiency. InkVisitor does not process or visualise your data for you. Users must be capable - or willing to become capable - of performing data transformations and downstream analysis independently. This remains non-trivial even with current AI assistance. (But it is true that large language models can help you a lot as a data transformation assistant.)
High time cost per unit of text. Encoding a text in CASTEMO is resource-intensive: as a rough estimate, the full modelling of 10 pages of source text require approximately two weeks of work. This investment is warranted only where the research question genuinely requires the granularity that structured semantic modelling provides and cannot be addressed by simpler methods. (But selective CASTEMO is quicker.)
The central question to ask before proceeding is therefore: does my research question require this level of structured representation, and does that justify the time cost? If the answer is yes, InkVisitor is there to help.
Editor Role — Rights guide for Admins & Owners
# What an Editor can do in InkVisitor
A quick, non-technical guide for Admins: what a user with the **Editor** role can and cannot do.
## The roles, briefly
InkVisitor has four roles, from most limited to most powerful:
- **Viewer** — can look around and read (search), but cannot change anything.
- **Editor** — can create and edit most content (this guide).
- **Admin** — everything an Editor can do, plus managing users and the whole tree.
- **Owner** — full control, including other Admins.
An Editor sits in the middle: they do the day-to-day research work, but a few administrative powers are reserved for Admins and Owners.
## Territories (the tree)
- They can **open and read** any Territory they've been given access to.
- In Territories where they have **edit access**, they can add sub-Territories,
rename them, reorder them, and edit their contents.
- They can **move a Territory** to a new place in the tree, as long as they have edit
access to both where it comes from and where it goes.
- They **cannot delete a whole Territory** — that stays with Admins and Owners (to
protect against removing large amounts of work by accident). The one exception
is Template Territories, described below.
Their access to a Territory is inherited: edit access to a Territory also covers
every sub-Territory and Statement within it.
## Statements
- They can **create, edit, and delete Statements only inside Territories they've been
assigned edit access to**. In other Territories they can read but not edit
Statements.
- They can **read Statements** in any Territory they have read or write access to.
- They can **move a Statement by dragging it onto another Territory in the tree**,
but only between Territories they can edit — both the one it's leaving and the one
it's going to. Territories they can't edit won't accept the drop.
### Statement list batch actions
Row of batch actions above the Statement list appears **only in a
Territory they can edit**.
- **move** — source T and the destination T has to be theirs to edit
- **duplicate** — source T and the destination T has to be theirs to edit
The following batch actions are allowed for Territories which Editor has write access to:
- **delete**
- **auto order**
- **replace a referenced Resource**
- **append a referenced Resource**
- **relate to superordinate entity**
- **classify as**
Picking a target for one of these four with **more than 10 Statements selected**
opens a confirmation asking whether to apply the action to that many Entities.
The last two create Relations, and this is where a Relation's rules meet the
tree: a Relation attached to a Statement shows up on that Statement, so it
follows the Territory holding it (see [Relations](#relations)).
## Resources
Resources represent external sources. What an Editor can do depends on whether a
Document is attached:
- **A Resource with no Document attached** — they can **edit and delete** it.
- **A Resource that has a Document attached** — they can edit it and delete it and work on its
Document only if that Resource has been **assigned to them** by an Admin / Owner. The
Resource holds the link to its Document, so editing it can detach that Document
and deleting it removes the link entirely. A Resource can also be assigned to
several people at once, so deleting it takes away Document access for all of
them — which is why the delete operation is limited to assigned people rather than
open to every Editor.
## Other Entities (Concepts, Persons, Objects, Actions, Values, and so on)
Territories, Statements, and Resources are Entity classes too, but they have their own rules.
This section is about the remaining classes.
- They can freely **create, edit, and delete** these Entities but with status pending and it’s up to the Admin / Owner to approve them.
- They aren't tied to a single Territory or Document, so their ability to edit them doesn't
depend on tree access or a Resource.
## Relations
An Editor can **create, edit, and delete any Relation between Entities that live
outside the Territory tree**. Like the Entities above, those are not tied to a Territory,
so this does not depend on their tree access.
A Relation that links a **Statement or a Territory** is the exception. It shows
up on that Entity, so writing it counts as editing the Entity and needs **edit
access to the Territory guarding it** — the Territory that includes the Statement, or the
Territory itself.
## Documents and annotation
Editor can:
- **read** all Documents
- **edit, annotate, export and delete a Document** when its Resource has been assigned to them
## Templates
Editor can:
- **create new Templates**
- **edit and delete Templates** — any Template, not only the ones they made
- **apply any Template**
## Explorer
The Explorer (Query page) is open to an Editor: they can build and run queries,
add columns, and edit some values directly in the table — Status, Label
language, Part of speech, Legacy ID, Detail, and alternative labels.
**Searching is not the same as editing.** A query can return Entities from
anywhere, including parts of the tree they have no access to. The table applies the
same rules as the rest of the app, row by row:
- a **Territory** row is editable only where they have edit access;
- a **Statement** row only when they can edit the Territory it sits in;
- a **Resource** row only when it has no Document, or when that Resource has been
assigned to them;
- **other Entities** (Concepts, Persons, and so on) are always editable.
Rows they cannot edit still appear, with their values shown as plain text instead
of editable fields, so a query still returns the full picture — they simply cannot
change what is outside their scope. This applies to every editable column,
including the ones that add or unlink related Entities, since those edit the row
Entity itself.
Of the batch actions offered above the results, they may use only:
- **open in detail**
- **copy UUIDs to clipboard**
The rest — **export as TSV**, **add new metaproperty**, **add new reference**,
and **add new relation** — are reserved for Admins and Owners, because they act
on a whole selection at once with no per-Entity confirmation.
Saved queries follow the same split: they can create and manage **their own private
queries**, while sharing a query with everyone, and moderating shared ones, stays
with Admins and Owners.
## Statistics
An Editor can open the **Statistics** page. It only aggregates data they can
already reach, so it is not restricted further.
## What an Editor cannot do
These stay with Admins and Owners:
- **Manage users** — creating, deleting, or changing other people's accounts and
their access rights.
- **Delete entire (non-Template) Territories** — even ones they have edit access to.
Editing a Territory's contents is allowed; deleting the whole Territory is not.
- **See the administration/user-management screens.**
- **Run the restricted Explorer batch actions** listed above.
- **Open Backups**, and (Owner only) **Global validations**.
They can always manage **their own** account: change their password, their display
options, and their bookmarks.
## What each assignment gives them (Admin's view)
As an Admin or Owner, you control an Editor's scope by assigning rights to
Territories and Resources. Here is what each assignment does.
- **Read access on a Territory** — they can open and read that Territory and
everything nested under it — including its Statements and their related
Documents — but cannot change anything there.
- **Write access on a Territory** — they can edit that Territory and its whole
subtree: edit the Territory's own detail (its Entity), create, edit, and delete
Statements; add, rename, and reorder sub-Territories; and move Statements in and
out. This applies to every sub-Territory beneath it as well. They still cannot
delete the Territory itself. They also get read-only visibility of the
Territories above it, so they can navigate down to reach their assigned area.
- **Annotate assignment on a Resource** — they can edit, annotate, export, and
delete that Resource Entity and its linked Document. This is how you hand a specific
Document over to the person responsible for it.
Two things to keep in mind:
- **Rights flow downward.** An assignment on a Territory automatically applies to
everything nested inside it — you don't assign each sub-Territory separately.
- **The closest assignment above wins.** A Territory uses the right assigned
directly on it, or — if it has none — the nearest one on a Territory above it.
So a more specific assignment lower in the branch overrides a broader one
higher up.
Entities
This chapter describes the different entity types of the CASTEMO data model, and their recommended usage.
Entities overview
CASTEMO recognizes 11 entity types (SPECTRABLOG – Statements, Persons, Events, Concepts, Territories / Texts, Resources, Actions, Living Beings, Locations, Physical Objects, and Groups). With this list, you should be able to do most of what a project needs.
Institutions are coded, depending on meaning and context, as Groups (e.g. if an institution is acting) or Locations (e.g. if it is institution in the sense of repository for a manuscript).
JSON Structure
The entity object is defined by the class IEntity see entity.ts file.
export interface IEntity {
id: string;
legacyId?: string;
class: EntityEnums.Class;
status: EntityEnums.Status;
data: any;
labels: string[];
detail: string;
language: EntityEnums.Language;
notes: string[];
props: IProp[];
references: IReference[];
isTemplate?: boolean;
usedTemplate?: string;
templateData?: object;
createdAt?: Date;
updatedAt?: Date;
}
Each entity type inherits attributes from the base object and defines a data object unique to that entity.
Actions
Actions (or more fully, Action types) represent individual semantically disambiguated verbs. They are lemma-meaning units, i.e. one meaning of a specific lemma corresponds to one Action. Thus, we can have many Actions labelled "to see": one for "be able of sight, not blind", one for "perceive with sight", one for "go to meet somebody".
Three valencies: Entity type valency, morphosyntactic valency, and semantic valency
Introduction
Actions acquire three kinds of valencies for any actant slot (subject, object 1, object 2; the data model is potentially extensible further, beyond trivalent verbs):
- entity type valency, which defines which entity type (Person, Concept, etc.) is allowed in the given actant slot;
- morphosyntactic valency, which is a free text field defining the prepositions and grammatical cases, but uses a formalized notation (grammatical cases are noted with numbers, prepositions are in quote marks "", alternative is marked with a pipe "|"); and
- semantic valency, i.e. what kind of role the entity occupying the given actant slot has by implication (e.g., the subject of the Action “to travel” would have the semantic valency C “traveller”).
The main benefits from valencies are that they:
- guide users in their choice of the correct Action (or creating a new one if none among the existing fits the meaning and syntactic structure);
- help users with validity of data in actant slots;
- allow InkVisitor to deploy data validation features;
- facilitate machine understanding of text, allowing semantic disambiguation of verbs based on their morphosyntactic valency (recognized by dependency parsing), and optionally, entity type valency (recognized e.g. through named entity recognition).
Morphosyntactic valency notation for Latin
In the field marking morphosyntactic valency, we use the following abbreviations and signs:
- Numbers 1-6: cases. E.g. "1" means nominative, "6" means ablative.
- Pipe sign ("|"): denotes the logical "OR", i.e. marks alternative morphosyntactic valencies.
- Plus sign ("+"): denotes concatenation, e.g. "de" + 6 means: "with preposition de and ablative case".
- Words in quote marks "": denote the actual words used in this valency, e.g. prepositions in this valency.
- inf: infinitive.
- 4inf: accusative with infinitive.
- "quod": content clause.
- "quia": causal clause.
- "ut": final clause.
- "ne": negative final clause.
E.g., 4 | 4inf | "quod" means that in this actant slot, this verb can only take either an accusative, or a sentence rendered as accusative with infinitive, or a clause starting with "quod".
1 = nominative
2 = genitive
3 = dative
4 = accusative
5 = vocative
6 = ablative
4inf = accusative with infinitive
Simplified valency notation in detail
To allow data collectors to quickly understand the meaning of an Action as well as its valency frame, it is recommended to add a minimalistic valency notation even to detail field, which appears as an info box upon mouseover. E.g., the detail field of the Latin Action percussit would start with "stroke (sb/slb - with st)"; see below. We recommend to use hyphen as separator between actant 1 and actant 2 valency, and the following abbreviations: sb for "somebody", slb for "some living being", and st for "something".
The addition of this simplified valency notation to detail, as well as the specific notation that we use in DISSINET, are obviously optional, and a different practice can be adopted by your project.
Recommended standards
Recommended standards for a finalized (approved) action
Before assigning an Action the approved status, it should meet the following standards:
-
Its meaning is described in the
detailfield. (You will benefit from the use of printed or online dictionaries or LLMs.) -
It has the Action/Event Equivalent relation filled in with a Concept which has its meaning defined in its own “detail” field.
-
It has full information on the three valencies for each actant slot (including the explicit declaration of
emptyin the entity type valency, if no entity is allowed in that slot). -
There is no remaining error message from InkVisitor validation.
It has a reference to an external lemma collection ID (in DISSINET, we use the LiLa Lemma Collection).
-
If you have found a corresponding meaning among WordNet synsets:
- It has a Reference to the corresponding WordNet synset.
- Its definition in the
detailfield takes the WordNet definition into account.
-
If you haven’t found a corresponding meaning among WordNet synsets:
-
You have defined the meaning yourself or based on dictionaries.
-
If there is any synset in WordNet which is a superclass of this (more specific) meaning, then an Action corresponding to the WordNet meaning is created (if Latin WordNet has it, then in Latin; if not, then in English), described, has a Reference to the WordNet synset, and it forms the Superclass of this more specific Action you are working on.
-
- All of this has been checked, i.e. it is not just a first draft of the Action that you still plan to come back to.
For something to be aligned with a synset definition in WordNet, it is not required that you accept its hypernyms or synonyms, just the definition needs to match.
Recommended linkage to external lemma and meaning banks
- Link each Action through a Reference to at least one external lemma bank. A major lemma bank is still WordNet for the given language. For Latin, we use the LiLa Lemma Collection in DISSINET.
- Link each Action through a Reference to at least one external bank of meanings/senses. A major meaning bank is still WordNet synsets.
- Such linkages are important for the interoperability of your data, and giving it meaning curated by bigger projects and infrastructures.
- Reference is a pair composed of a Resource entity representing the given resource, and its part (typically unique identifier).
- If the lemma or meaning is not found in the lemma or meaning bank you are normally using, it is useful to know that you checked: in such a case, add the Reference, but put Value "NA" as the Reference part.
- Also DISSINET Database (DDB) and MedHate database (MDB) are providers of identifiers (UUIDs) that you can link to. If upon its creation you request to have your CASTEMO database pre-populated with some entities from another deploy of InkVisitor, the UUIDs will be the same and the references will already be there.
Common imperfections in Actions
Underspecified actant semantic valencies
Semantic valencies for actant slots should be as specific as possible, even at the cost of coining semi-technical neologisms (e.g. permitter, grantee). For instance, if you underspecify it as person exercising authority, it (1) excludes groups (use human holder of authority instead to accommodate both individual and collective agents), and (2) is too broad to adequately characterise semantically distinct actions such as to permit, to prohibit, or to command. Each such action warrants its own precisely defined set of functor Concepts that reflect what the slot actually means in the context of that specific verb meaning.
JSON Structure of Action entities
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Action data object can be found in action.ts file.
export interface IAction extends IEntity {
class: EntityEnums.Class.Action;
data: IActionData;
}
export interface IActionData {
valencies: IActionValency;
entities: IActionEntity;
pos: EntityEnums.ActionPartOfSpeech.Verb;
}
export interface IActionValency {
s: string;
a1: string;
a2: string;
}
export interface IActionEntity {
s?: EntityEnums.ExtendedClass[];
a1?: EntityEnums.ExtendedClass[];
a2?: EntityEnums.ExtendedClass[];
}
Concepts
Concepts represent, alongside Action types, another generic entity type, which holds the data semantically together. Concepts are lemma-meaning units. That is, for any distinct lemma and meaning, you create a new Concept. This proliferation of Concepts is made manageable through various Relations, such as synonym, superclass (~ hypernym, genus proximum) etc., which place any Concept in a robust web of semantic relations.
One major function of Concepts is to serve as Property Type in Properties, which is a flexible yet reliable way of creating connections between entities.
CASTEMO knowledge graphs are multi-lingual; thus, Concepts from different languages can coexist, but are defined by semantic relations.
While CASTEMO knowledge graphs are multi-lingual, we recommend choosing one analytical language for higher levels of the conceptual taxonomies.
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Concept data object can be found in concept.ts file.
export interface IConcept extends IEntity {
class: EntityEnums.Class.Concept;
data: IConceptData;
}
export interface IConceptData {
pos: EntityEnums.ConceptPartOfSpeech;
}
Attributes of entities
Any entity type has some internal Attributes, which allow to characterize the entity. The InkVisitor interface guides users as to what attributes are expected for a given entity type.
A first and obvious Attribute is label, that is, the name of the entity. The name can change; it is the identifier (UUID) rather than the label which holds the semantic identity. However, label changes need to be done with consideration, as they influence the uses of this entity in already existing data.
The detail Attribute should be used to define the entity. This is especially important for Actions and Concepts, which keep the data semantically together.
Another attribute used in all entities is label language, which defines in what language the label is written.
Languages not available in the interface (including old development phases of modern languages) can be added upon request.
To further extend the possibilities of finding an entity rather than create duplicates e.g. for mere orthographic variants (e.g. democratisation vs. democratization), there are alternative labels, which means other labels than the main one, highlighted in label.
Alternative labels should not be used for labels in another language (create the entity in that language and link it with a SYN Relation to this one instead).
In Concepts and Actions, alternative labels should not be used for different lemmas.
Technically, the main label and alternative labels are one single field; the first position in this field is held by the main label. This is how the application ensures non-duplication between main label and alternative labels.
Apart from such internal Attributes, any entity can enter in three types of connections to different entities: Properties, Relations, and References.
Statements
Structure and purpose
Statements model the syntactic structure and semantics of clauses. They have a quadruple structure with action slot and three actant slots: subject, actant1, and actant2. The semantic core is the action slot, which holds the predicate of the clause, and is linked to actants as defined by the syntactic valency of the Action type used, up to trivalent verbs (for instance, ‘Peter received a gift from Elisabeth’). Any Action Type can define through its syntactic valency that an actant is required, optional, or forbidden (required empty).
While InkVisitor can be used for classical entity–relationship modelling done in any database, the CASTEMO data collection workflow is specific in its focus on modelling textual clauses through statements. In this sense, it is a statement-based data collection workflow. This allows texts to be comprehensively modelled, either selectively (based on what is relevant for specific research) or in entirety. CASTEMO is intended to keep the order of appearance and contextual embeddedness of information in the text.
Action attributes
Actant attributes
Pseudo-actant
Bundling actants and actions
Multiple actants in the same position (s / a1 / a2 / pa), or multiple actions, can be logically connected using bundleOperator. The operator on each element describes its relationship to the next element in the list (ordered by statement order). The last element in a group carries the default And value as a chain terminator — it does not express a conjunction with a following element.
Operators
| Operator | Latin equivalent | Meaning |
|---|---|---|
| And | et | Conjunction; also the default terminator on the last element in a group |
| Or | vel | Non-exclusive alternative |
| Xor | vel...vel | Exclusive alternative |
| Greater | quam | Comparative: the following element exceeds the current one |
Examples
"fratrem, vel unum filium, vel unam filiam" — Or
Three a1 actants (brother / son / daughter) connected by Or. The operator on each element connects it to the next; the last element carries And as a terminator:
frater [Or] → unus filius [Or] → una filia [And/end]
"vel ipsa testis vel dictus Andreas vel sorores" — Xor
Three s actants connected by Xor (exclusive alternatives):
Mayfreda [Xor] → Andreas [Xor] → sorores [Xor/end]
"nullus... fortius adhaesit... quam ipse" — Greater
Two s actants in a comparative construction. The Greater operator on the first element (the baseline) points to the second (the one who exceeds it):
nullus [Greater] → Bernardus Otho [And/end]
"sciret, crederet vel audivisset" — Or on actions
Three actions connected by Or:
scivit [Or] → credidit [Or] → audivit [And/end]
bundleStart / bundleEnd
The bundleStart and bundleEnd flags mark the explicit first and last member of a group and can be used to distinguish members acting as a collective unit from members acting individually. When both flags are absent (the common case), the logical grouping is fully expressed by the bundleOperator chain alone.
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Statement data object can be found in statement.ts file.
export interface IStatement extends IEntity {
class: EntityEnums.Class.Statement;
data: IStatementData;
}
export interface IStatementData {
text: string;
territory?: IStatementDataTerritory;
actions: IStatementAction[];
actants: IStatementActant[];
tags: string[]; // ids of IEntity;
}
export interface IStatementDataTerritory {
territoryId: string;
order: number;
}
export type StatementObject =
| IStatementClassification
| IStatementIdentification
| IProp
| IStatementActant
| IStatementAction;
export interface IStatementAction {
id: string;
actionId: string;
elvl: EntityEnums.Elvl;
certainty: EntityEnums.Certainty;
logic: EntityEnums.Logic;
mood: EntityEnums.Mood[];
moodvariant: EntityEnums.MoodVariant;
bundleOperator: EntityEnums.Operator;
bundleStart: boolean;
bundleEnd: boolean;
props: IProp[];
}
export interface IStatementActant {
id: string;
entityId: string;
position: EntityEnums.Position;
elvl: EntityEnums.Elvl;
logic: EntityEnums.Logic;
virtuality: EntityEnums.Virtuality;
partitivity: EntityEnums.Partitivity;
bundleOperator: EntityEnums.Operator;
bundleStart: boolean;
bundleEnd: boolean;
props: IProp[];
classifications: IStatementClassification[];
identifications: IStatementIdentification[];
}
export interface IStatementClassification {
id: string;
entityId: string;
elvl: EntityEnums.Elvl;
logic: EntityEnums.Logic;
certainty: EntityEnums.Certainty;
mood: EntityEnums.Mood[];
moodvariant: EntityEnums.MoodVariant;
}
export interface IStatementIdentification {
id: string;
entityId: string;
elvl: EntityEnums.Elvl;
logic: EntityEnums.Logic;
certainty: EntityEnums.Certainty;
mood: EntityEnums.Mood[];
moodvariant: EntityEnums.MoodVariant;
}
Persons
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Person data object can be found in person.ts file.
export interface IPerson extends IEntity {
class: EntityEnums.Class.Person;
data: IPersonData;
}
export interface IPersonData {
logicalType: EntityEnums.LogicalType;
}
Groups
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Group data object can be found in group.ts file.
export interface IGroup extends IEntity {
class: EntityEnums.Class.Group;
data: IGroupData;
}
export interface IGroupData {
logicalType: EntityEnums.LogicalType;
}
Living Beings
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Living Being data object can be found in being.ts file.
export interface IBeing extends IEntity {
class: EntityEnums.Class.Being;
data: IBeingData;
}
export interface IBeingData {
logicalType: EntityEnums.LogicalType;
}
Objects
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Object data object can be found in object.ts file.
export interface IObject extends IEntity {
class: EntityEnums.Class.Object;
data: IObjectData;
}
export interface IObjectData {
logicalType: EntityEnums.LogicalType;
}
Locations
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Location data object can be found in location.ts file.
export interface ILocation extends IEntity {
class: EntityEnums.Class.Location;
data: ILocationData;
}
export interface ILocationData {
logicalType: EntityEnums.LogicalType;
}
Events
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Event data object can be found in event.ts file.
export interface IEvent extends IEntity {
class: EntityEnums.Class.Event;
data: IEventData;
}
export interface IEventData {
logicalType: EntityEnums.LogicalType;
}
Territories
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Territory data object can be found in territory.ts file.
export interface ITerritory extends IEntity {
class: EntityEnums.Class.Territory;
data: ITerritoryData;
findChilds(
db: any,
isDeep?: boolean
): Promise>;
}
export interface ITerritoryData {
protocol?: ITerritoryProtocol;
parent: IParentTerritory | false; // TODO should be optional instead of false
validations?: ITerritoryValidation[];
}
export interface IParentTerritory {
territoryId: string;
order: number;
}
export interface ITerritoryProtocol {
project: string;
dataCollectionMethods: string[]; // C class entities
description: string;
guidelines: string[]; // R class entities
detailedProtocols: string[]; // R class entities
startDate: string; // V class entity
endDate: string; // V class entity
relatedDataPublications: string[]; // R class entities
}
export interface ITerritoryValidation {
active?: boolean;
territoryId?: string;
entityClasses?: EntityEnums.Class[];
entityClassifications?: string[];
entitySOEs?: string[];
entityLanguages?: EntityEnums.Language[];
entityStatuses?: EntityEnums.Status[];
tieType: EProtocolTieType; // default is property
propType?: string[]; // relevant only in case of Property is selected as a tie
allowedClasses?: EntityEnums.Class[]; // not relevant if allowedEntities is set
allowedEntities?: string[]; //
detail: string;
}
export enum EProtocolTieType {
Property = "Property",
Classification = "Classification",
Reference = "Reference",
}
Resources
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Resource data object can be found in resource.ts file.
export interface IResource extends IEntity {
class: EntityEnums.Class.Resource;
data: IResourceData;
}
export interface IResourceData {
url: string;
partValueLabel: string;
partValueBaseURL: string;
documentId?: string;
}
Values
JSON Structure
The general entity attributes are inherited from the base entity object, which is defined by the IEntity class (see entity.ts file).
Definition of Value data object can be found in value.ts file.
export interface IValue extends IEntity {
class: EntityEnums.Class.Value;
data: IValueData;
}
export interface IValueData {
logicalType: EntityEnums.LogicalType;
}
Properties
This chapter explains a vital kind of relation in the CASTEMO data model: properties, which serve to attach attributes to entities, and relate entities with one another.
Properties overview
Definition
Property
Property is the most fundamental and the most versatile relation in CASTEMO knowledge graphs which connects entities of different kinds.
Any property has:
- an origin, i.e. the entity to which it is attached,
- a property type, and
- a property value.
Properties serve for modelling:
- Adjectives, adjectival expressions, possessives, and appositions (e.g., qualities and inter-entity relations).
- Adverbs and adverbial expressions (e.g., time, space, and manner of action).
CASTEMO knowledge graphs give priority to the data-collection perspective, and attempt at creating a general framework for modelling information in the textual resources. That's why it does not have a comprehensive list of predefined properties but allows coders to fill them during data collection flexibly and dynamically.
Any entity can have any number of properties.
If an entity has more qualities of the same kind, those will be multiple properties with the same property type (e.g. if something is yellow and blue, it will have one property for yellow and the other for blue colour).
In CASTEMO knowledge graphs, a Property is always read with the verb "has".
E.g.:
O John's hat - [has] - C colour - C black
P Anna - [has] - C son - P Peter
There are two kinds of properties, which have the same structure but differ in the context from which they are attached to entities.
In-statement Properties
In-statement Properties are attached to entities contextually, from within a Statement - i.e. they are attached to entities, used as actants of a Statement (in the case of adjectival expressions and appositions) or actions (in the case of adverbial expressions). Thanks to the position of Statements in CASTEMO knowledge graphs, such Properties are included in a Territory hierarchy from which they stem, and usually accompanied with a either an anchor in a full-text document, or a Reference to the Resource which served for compiling a given Statement.
Meta-level Properties
Meta-level Properties (or, in short, Metaproperties), are properties attached globally rather than contextually to an entity, and represent general knowledge which applies to all uses of the entity independently from context. For instance:P Martha Wood - [has] - C sex - C female
Sometimes, one level is not enough to model a property. E.g., if Elizabeth II was Queen of the United Kingdom from 1952 to 2022, it is important to declare both the role and its temporal span, e.g. in the following way:
P Elizabeth II - [has] - C office - C Queen of the United Kingdom
PROP - C TRP yyyy-mm-dd: started exactly - V 1952PROP - C TRP yyyy-mm-dd: ended exactly - V 2022
It is not Elizabeth who has this time span, but her office as queen of the United Kingdom. Thus, CASTEMO knowledge graphs have second-level properties to be able to attach properties to properties, and they have even third-order properties to attach properties to properties of properties.
Technical specification
The data model of CASTEMO knowledge graphs is technically defined in the InkVisitor typescript *.ts files, which directly correspond to the JSON structure of the collected data in the corresponding database.
Each entity (e.g. Action) has its own ts file (e.g. action.ts); see the GitHub repository:
In the sense of object-oriented design, each specific entity (e.g. location, person) inherits the definition of the IEntity interface, which is in the entity.ts file. The IEntity is defined as follows:
export interface IEntity {
id: string;
legacyId?: string;
class: EntityEnums.Class;
status: EntityEnums.Status;
data: any;
labels: string[];
detail: string;
language: EntityEnums.Language;
notes: string[];
props: IProp[];
references: IReference[];
isTemplate?: boolean;
usedTemplate?: string;
templateData?: object;
createdAt?: Date;
updatedAt?: Date;
anchorTexts?: string[];
}
Example: location entity "Argentina"
Let's have a location entity with the label "Argentina".
In the InkVisitor GUI, the core entity is displayed like this:
...
In the InkVisitor GUI, the properties which hold its geospatial localisation are displayed like this:
There is one property record with type-value pair, i.e. Property Type "coordinates (lat; long)" (a Concept entity, an entity object of type C, which is taken is from the predefined ontology) and the Property Value, in this case a Value object with the string holding the decimal geographic coordinate pair. To this first-level property is attached a second-level property defining "localisation precision" of the stated coordinates, where both values of the type-value pair are filled with C entities.
For deeper conceptual understanding, the JSON structure can be more revealing, this is a full entity display:
The entity has class "L", i.e. it is an entity of type "location", and it has direct attributes, like label with the value "Argentina" and array attributes like props.
It has one property object in the props attribute. The main information is held in type and value attributes. And this property object also has one second-level property in the attribute children.
The property object is defined by the class IProp, see prop.ts file.
export interface IProp {
id: string;
elvl: EntityEnums.Elvl;
certainty: EntityEnums.Certainty;
logic: EntityEnums.Logic;
mood: EntityEnums.Mood[];
moodvariant: EntityEnums.MoodVariant;
bundleOperator: EntityEnums.Operator;
bundleStart: boolean;
bundleEnd: boolean;
children: IProp[];
type: IPropSpec;
value: IPropSpec;
}
export interface IPropSpec {
entityId: string;
elvl: EntityEnums.Elvl;
logic: EntityEnums.Logic;
virtuality: EntityEnums.Virtuality;
partitivity: EntityEnums.Partitivity;
}
Second-level properties
In the Argentina example above, the coordinates property record has one property object which extends the information.
This object is a normal instance of the IProp class. This means that its primary information is in type and value attributes. These hold IPropSpec objects, which refer to two concept entities, e.g. here, "localisation precision" and "precise".
Relations
Some core semantic and ontological relationships between entities are singled out as bespoke Relations rather than being constructed through Properties, to which they formally resemble.
Relations overview
Some core semantic and ontological relations between entities are highlighted in the CASTEMO data model. Their reserved nature - in ways unavailable for specific Property Types, which depend on specific UUIDs - ensures their compatibility across CASTEMO research databases (and InkVisitor deploys). The following table gives an overview of all the relations, the entity types which allow that relation, a brief definition, and an example.
Typescript definition
interface IRelation {
id: string;
type: RelationEnums.Type;
entityIds: string[];
order?: number;
}
Superclass (SCL)
Definition
Superclass (SCL) is a semantic relation which relates a Concept to one or more Concepts, or an Action to one or more Actions. It denotes hypernym (genus proximum), i.e. the more generic conceptual class to which a Concept or Action belongs. All Concepts should have SCL, while Actions only sometimes do. The reason is that while hypernymy is natural to nouns, adjectives, adverbs etc. (which are captured by Concepts), it is more rare that verbs have a transparent hypernym.
Concept Example: C apple - SCL - C fruit.
Action example: A run - SCL - A move.
False friends
SCL and CLA
Note that Superclass is different from Classification.
Do not confuse Superclass with Classification. Classification serves to relate specific entities (PLOGESTRB) to its class (C). All of these specific entities are then instances of this class.
SCL and HOL
Also, Superclass should not be used to relate an entity to something which the entity isn't fully, but is only a part thereof - in such situations, Holonym is the correct relation.
You need to distinguish two situations. If something is a manuscript fragment, it is still fully a manuscript in the sense of "physical medium holding handwritten text", and thus relating these two Concepts by C manuscript fragment - SCL - C manuscript is correct: a manuscript fragment is a manuscript in this sense.
On the other hand, most people would not consider
- ⦻ a C manuscript fragment to be a C manuscript codex,
- ⦻ a three-leaf fragment C fragment of a trial register to be a C trial register,
- ⦻ or a C fragment of a glass jar to be a C glass jar.
This is because these notions evoke a whole, to which the fragment does not amount. In such cases, you need to relate entities through the HOL relation: i.e., declare e.g. that C fragment of a glass jar - HOL - C glass jar, while picking a more appropriate SCL: C fragment of a glass jar - SCL - C glass shard.
If your definition for research is less strict than SCL-only, e.g. if you want to include both trial registers and fragments thereof in query results, don't forget to build your query accordingly, using HOL relation alongside SCL relation.
Technical Typescript definition
export interface ISuperclass extends IRelation {
type: RelationEnums.Type.Superclass;
entityIds: [string, string]; // `entity HAS superclass -> 0 element id abstract class, 1 element is super class`
order: number;
}
Superordinate Entity (SOE)
Superordinate Entity (SOE) is a Relation which connects a subordinate entity to an entity in which it is fully contained.
Example: L Milan - SOE - L Italy.
In CASTEMO, only the direction from the subordinate to the superordinate entity is being stored. However, subordinate entities are displayed in InkVisitor to give an overview of the data.
Typescript definition
export interface ISuperordinateEntity extends IRelation {
type: RelationEnums.Type.SuperordinateEntity;
entityIds: [string, string];
order: number;
}
Classification (CLA)
Classification (CLA) is a Relation between a specific PLOGESTRB entity and the class (Concept) to which it belongs.
Example: O this apple - CLA - C apple; O another apple - CLA - C apple.
Classification is vital for querying the database: it allows to find specific instances of a generic Concept (e.g., all apples) but also, through the Superclass tree of Concepts, more general classes (e.g., any instances of fruit).
Do not confuse Classification with Superclass.
Typescript definition
interface IClassification extends IRelation {
type: RelationEnums.Type.Classification;
entityIds: [string, string];
order: number;
}
Identification (IDE)
Identification (IDE) serves to declare the identity between PLOGESTRB entities, both within an entity type (e.g. P Rocket Man - IDE - P Elton John) and across entity types (L the boat on which we got married - IDE - O this same boat that we then sold).
Not unlike Synonymy, it helps preserving the original expressions used in the modelled Resources, while still keeping them identical. However, Synonymy pertains to Actions and Concepts and is a semantic relation, while Identification pertains to entities of this world, and is an ontological relation.
Unlike all other Relations, Identification can be done with a Certainty level, i.e. the identification can be done at a lower Certainty level, e.g. "probable", "possible", or even "false", which is a negative declaration that the two entities are certainly not identical, which can sometimes be useful if some resource has made this (erroneous) identification.
Any queries of entities must take into account the Identifications of the entity (usually including the definition of threshold certainty levels), if they want to include also all of its identificates in search results.
Entities with which an entity is identical are called identificates.
Typescript definition
interface IIdentification extends IRelation {
type: RelationEnums.Type.Identification;
certainty: EntityEnums.Certainty;
entityIds: [string, string];
}
Synonym (SYN)
The CASTEMO data model recommends a strong understanding of synonymy. For two lexemes to be related with the Synonym Relation, they need to have the same Superclass (if there are more superclasses, they need to share all of them). Also, if they are related to a meaning bank, the meaning ID in the relevant meaning bank needs to be the same.
This strong understanding allows to consider synonymy as transitive: if A is synonym of B and B is synonym of C, then A is synonym of C. (In semantic network terms, this would be described as triadic closure.)
The Synonym Relation is also used for cross-language equivalence, e.g. C dog (English) - SYN - C Hund (German).
The Synonym relation helps to extend database queries and also include the Synonyms of Concepts and Actions queried. Through Concepts used in Classification, synonymy can also help build sets of entities for analysis (e.g. including all Living Beings classified either as "dog (English)" or as "hound (English)" or as "Hund (German)").
Typescript definition
interface ISynonym extends IRelation {
type: RelationEnums.Type.Synonym;
entityIds: string[];
}
Antonym (ANT)
The CASTEMO data model recommends a strong understanding of antonymy, i.e. one which to some degree applies also to the Superclasses of both lexemes.
Through Concepts used for Classification, antonymy helps to build contrasting sets of entities for analysis. Through antonymous Actions, it helps to build contrasting sets of Events.
Typescript definition
interface IAntonym extends IRelation {
type: RelationEnums.Type.Antonym;
entityIds: [string, string];
order: number;
}
Holonym (HOL)
Holonym (HOL) Relation denotes the relation between a Concept representing a part of something to a Concept representing a whole.
Example: C door of a house - HOL - C house.
The reverse relation is called meronymy.
In CASTEMO knowledge graphs, we only store the relation from the part to the whole, not the other way around, but the reverse direction is displayed in InkVisitor.
This ontological relation between Concepts is analogical to what the SOE Relation is between PLOGESTRB entities.
Typescript definition
interface IHolonym extends IRelation {
type: RelationEnums.Type.Holonym;
entityIds: [string, string];
order: number;
}
Property Reciprocal (PRR)
Property Reciprocal (PRR) is a Relation connecting two Concepts which can feature as a Property Type. In a Property, composed of Origin, Property Type, and Property Value, it defines what Property Type the Property Value would give back to Origin if the Property would be stored the other way. For instance, the PRR of C "mother" will be "child", because if P Bernard - has - C mother - P Anna, then P Anna - has - C child - P Bernard. Similarly, the PRR of C "occupation" will be "occupation holder", because if P Bernard - has - C occupation - C baker, then C baker - has - C occupation holder - P Bernard.
Property Reciprocal serves to symmetrize the Properties in a knowledge graph derived from the Collected Data Database by enriching them with the Property sent the other way, thus enabling to query CASTEMO data more easily and avoid missing properties which happen to be encoded the other way around.
Typescript definition
interface IPropertyReciprocal extends IRelation {
type: RelationEnums.Type.PropertyReciprocal;
entityIds: [string, string];
}
Action/Event Equivalent (AEE)
Description and roles
The Action/Event Equivalent Relation (AEE) connects always one Action to one Concept, and it serves to translate between the world of verbs and the world of nouns. For instance, A "to baptize" would have the AEE C "baptism".
Since any specific Event which happens to be a baptism should have the Classification C "baptism", all specific "baptism" Events and all Statements with the Action "to baptize" used in the action slot can be queried together in the database, as long as they have the AEE and CLA properly set.
Just as importantly, AEE is a way for verbs to acquire coherent Superclasses. While the Superclass Relation is allowed for Actions, most verbs do not have manifest Superclasses. For instance, A "to baptize" does not have any Superclass such as *"to ritualize", while C "baptism" can acquire quite a straightforward Superclass tree (e.g. C "Christian ritual", which in turn will have the Superclass C "ritual"). These Superclasses propagated to Actions from Concepts through AEE are shown under Actions in InkVisitor, thereby helping coders to decide whether an Action fits the specific context. They are of course vital for analytical queries which aim at retrieving, for instance, all rituals, be they expressed through verbs (i.e., through an Action) or nouns (i.e., as Events).
FAQ
Recommended language for AEE
AEEs should be formulated in the analytical metalanguage of the given project (usually English). This is preferable to using the source language of the texts being analysed, because AEE serves mainly analytical purposes. English is specifically useful because its nominal gerunds such as giving, assigning, permitting signal more clearly the act rather than the outcome or object of action, which is essential given that the AEE Concept must represent the action or event as such.
An exception is warranted where a source-language technical term - particularly in multiword expression (MWE) verbs - is already established in the project or adds precision that a metalanguage equivalent would not easily capture. In such cases, the source-language term may be retained, but care must be taken to ensure the use of this Concept exists in the appropriate sense (about the act, not outcome or object) exists.
Thus, when reviewing older data, consider whether AEE in source language adds meaningful value; if not, create a metalanguage equivalent and use that instead.
Typescript definition
interface IActionEventEquivalent extends IRelation {
type: RelationEnums.Type.ActionEventEquivalent;
entityIds: [string, string];
}
Implication
Implication (IMP) is a Relation which connects an Action to one or more other Actions. It denotes an action which, by implication, must have happened because it is logically implied by the original action. For instance, A travelled (with sb) - IMP - A was in the company (of sb).
Implication allows to enrich data in the knowledge graph with actions which, while not explicitly denoted by the verbs used, happened by implication. This in turn helps to extend the query results in cases where the Action's Superclass or Action/Event Equivalent did not necessarily cover the implied action.
Depending on the strictness of use of IMP and the research purpose, IMP can be used to produce only the first-level implication directly appended to the Action, or to follow the implication chain even further (e.g. if action A implies action B, and action B implies action C, then we may decide to also make action A imply action C upon data projection).
In linguistics, this relation type is sometimes also called entailment.
Typescript definition
interface IImplication extends IRelation {
type: RelationEnums.Type.Implication;
entityIds: [string, string];
order: number;
}
Subject/Actant1 Reciprocal (SAR)
The Subject/Actant1 Reciprocal (SAR) Relation relates two Actions. It is a type of Implication, but one which goes in the reverse direction: from actant 1 to the subject. For instance, if P Peter - A accompanied - P Susan, then P Susan - A was accompanied - P Peter.
Some SAR are symmetrical, i.e. they imply the reciprocation of the same Action from actant 1 to the subject (e.g., "was in the company (of sb)"). Some are asymmetrical, i.e. the reciprocated Action is different.
Typescript definition
interface ISubjectActant1Reciprocal extends IRelation {
type: RelationEnums.Type.SubjectActant1Reciprocal;
entityIds: [string, string];
}
Actant semantics: Subject Semantics (SUS), Actant 1 Semantics (A1S), and Actant 2 Semantics (A2S)
Description
Subject Semantics (SUS), Actant 1 Semantics (A1S), and Actant 2 Semantics (A2S) are Relations each of which connects an Action to one or more Concepts describing semantically the role of the holder of the actant slot. E.g., A "to speak (to sb - about st/sb)" would have the SUS: C "speaker", A1S: C "participant in a conversation", and A2S: C "speech content".
These Relations describing actant semantics then allow to study the roles of entities holding that actant slot. E.g., we can inspect all women who have either the in-statement CLA C "preacher", or who are known to have A "preached", because A "preach" would have exactly the SUS: C "preacher". Therefore, the actant semantics enrich actant role holders with the respective roles implied by the Action.
These relations also allow to properly understand the direction of action: e.g., a text can say that P Lucy - A listened - (to) P Mary, or that P Mary - A spoke - (to) P Lucy. The relevant actant semantics will allow to identify, in both wordings, Mary as the speaker and Lucy as the listener. Thus, for research purposes, we can for instance safely produce a directed conversation tie going from Mary to Lucy rather than the other way round from any of the two wordings, and also harbour the passive and active voice correctly under the same roof.
Actant semantics are the CASTEMO way of ensuring semantic role labelling: it is done by properly defining any Action type's semantic valency, rather than losing time with labelling semantic roles in specific Statements.
Frequently asked questions
Multiple semantic valencies per actant slot?
CASTEMO allows more than one semantic valency to be assigned to any actant slot, and this is valid where genuinely needed. However, it is important to know that multiple semantic valencies always combine with AND logic: all apply simultaneously to the entity occupying that slot. They must not be used to introduce OR logic.
While multiple semantic valency is possible, always think first whether it is not possible to express the valency with a single Concept, common denominator, which can as usual fork further up the path into more Superclasses. Resort to multiple valencies only where genuinely needed.
Typescript definition
interface ISubjectSemantics extends IRelation {
type: RelationEnums.Type.SubjectSemantics;
entityIds: [string, string];
order: number;
};
interface IActant1Semantics extends IRelation {
type: RelationEnums.Type.Actant1Semantics;
entityIds: [string, string];
order: number;
};
interface IActant2Semantics extends IRelation {
type: RelationEnums.Type.Actant2Semantics;
entityIds: [string, string];
order: number;
};
Related (REL)
Example: C tea - REL - C afternoon
For more specific semantic relations, a relevant specific Relation or Property should be preferred.
Typescript definition
interface IRelated extends IRelation {
type: RelationEnums.Type.Related;
entityIds: [string, string];
order: number;
}
References
References overview
References allow you to link any entity (incl. statement) in the database to an external source of knowledge and a specific part of it.
Use
You will find them useful in two main ways:
- documenting the evidential basis of your claims (accountability), and
- connecting your data to external resources such as gazetteers or authority files (interoperability).
Any entity can carry any number of references.
Structure
A reference is a pair of two values: a Resource (any entity of the type Resource) and a part specifying the relevant segment of that resource — for example, a page number in a source edition, or an identifier in an external location list.
How to remind users to use References
As the owner of the instance, you can impose the addition of a Reference, or a Reference to a specific Resource, to entities in Global validations. For instance, you might want to trigger a warning when a Concept or an Action is not referenced to WordNet. Owner-role users can do this in the Global validations.
JSON Structure of References
Definition of Reference data object can be found in reference.ts file.
export interface IReference {
id: string;
resource: string; // resource entity id
value: string; // value entity id
}
Corpus in InkVisitor: Managing textual data and representing them in the CASTEMO ontology
The Annotator component of InkVisitor allows you to perform various operations with full-texts.
This chapter will teach you to:
- adopt best practices in managing versions of full-text documents;
- import full-text documents in InkVisitor;
- represent them in the CASTEMO ontology;
- edit (correct) texts in Annotator;
- add anchors, whether during sequential reading or more in a batch.
Corpus in the CASTEMO workflow
Constituting a corpus of full texts is a natural component of the CASTEMO workflow. Full-texts are typically used for annotation (i.e., adding anchors of different types of entities into full-texts). While is not meant as a fully-fledged corpus manager, with full capacities of querying a text with regular expressions, it has some basic corpus functionalities.
This chapter will explain both general principles of corpus data management and CASTEMO-specific guidelines.
CASTEMO can be done as external modelling of a text. However, anchoring entities (esp. Territories and Statements) in the text gives further opportunities for corpus research in combination with the CASTEMO ontology.
General principles of corpus management
Where to maintain my corpus? And how to keep track of versions?
Generally, a corpus is better maintained outside of InkVisitor, in a repository which allows systematic version control, such as GitHub.
How to describe texts in the repository itself?
In CASTEMO workflows, the best place to store metadata is neither the full-text itself (e.g., the document's TEI XML header, if you are using TEI XML) nor the repository, but the InkVisitor database, which holds such metadata close to other research data and in a readily machine-operable form.
Nevertheless, it is good practice to outline some basics and protocol your choices and general approach to text correction in a README.md file in the repository itself (e.g., GitHub), enclosing the README.md file (in Markdown formatting) with the full-text document in the folder of this document. It is a good idea to put in licence information, information on the edition used, and approach to text transformations and corrections.
An example of such a README.md file:
# License
All rights reserved. This digital text is intended exclusively for private research use in the DISSINET research group, and should not be shared or circulated.
# Edition used
The source for this digital text is an optically recognized and cleaned version (with editorial matter removed) of:
> Thouzellier, Christine, ed. *Une somme anti-cathare: Le Liber contra Manicheos de Durand de Huesca*. Spicilegium sacrum Lovaniense, 1964.
# Quotations
Quotations are preserved using the `<quote>` element. In the original edition, italics seems to be used only for biblical quotations, and thus, all italicized words were transformed into spans delimited specifically as biblical quotations: `<quote source="#Vulgate">` (citations from, e.g., Augustine were not marked by italics but by quotation marks). There are two sources referenced through the `<quote>` element.
* **Anonymous Cathar treatise:** Marked by `<quote source="#Cathar treatise">`. This separates quoted text from the polemicist's text.
* **Latin Bible:** Quotes are marked by `<quote source="#Vulgate">`.
Clean optically recognized texts
General information
In this manual, we count on the availability of edited text of a source, where characters have been optically recognized (OCR-ed) in specialised software.
Format and tools for cleaning
The cleaning of the text for research use depends on the form you receive. We generally recommend editing a .docx (Microsoft Word) output of optical character recognition software (such as ABBYY FineReader) in Microsoft Word, as this editor has powerful search & replace options combining regular expressions (called wildcards in the software) and search by formatting (e.g., italics, superscript etc.).
This does not prevent you from subsequently using AI-powered tools for text correction, just be mindful that if they don't work from the original images, they would be only guessing the most probable word, which might not be the one which actually is in the edition.
General workflow
You generally need to:
- Inspect the general OCR quality, and redo the scanning and/or OCR if it is below your needs and expectations. For older or low-quality prints, a manual transcription (e.g., by a commercial company) might still be the best choice.
- Remove CAFE - stands for Critical Apparatus, Footnotes and other Editorial matter.
- Restore the flow of text broken by page breaks and footnotes / critical apparatus.
- Remove footnote marks in the main text (usually numbers or letters in superscript, which your OCR software should preserve.
- Remove unwanted hyphens which break words into two.
- Remove unwanted brackets used e.g. for restoring text from another manuscript.
- Correct OCR errors, especially those which are widespread, such as lowercase l misrecognized as 1 or uppercase I, uppercase I misrecognized as lowercase L, etc. Also e/c is often misrecognized.
- Transform useful formatting into XML-like markup, e.g. if the edition marks biblical quotations by italics, this is a feature you don't want to lose in the plain text.
- Produce a plain text in Unicode UTF-8 encoding from the docx.
During this process, save versions often to your repository with good descriptions, and definitely after finishing each step.
More info
If you want more information, request access to DISSINET's guidelines for text cleaning.
Represent textual versions
Basics
The full text you plan to annotate has its often quite complex history of versions.
- At the origin might be a handwritten document; that phase you should represent in CASTEMO as a physical Object (which might be extant until the present day or not, and whose physical properties such as size, number of pages, writing material etc. might be known).
- Perhaps a photographic reproduction was made of this object, which should be represented as a Resource; different representations can exist (e.g. black and white vs. in colour; different resolutions; different times and technological means of production).
- Then, typically, somebody did a transcription (e.g., critical edition) either directly from the physical handwritten Object, or from a reproduction. This might be a typescript, i.e. a physical Object, or a computer file, i.e. another Resource.
- This would then lead to a published edition (generally a Resource, while a specific exemplar is an Object).
- In a project planning to do corpus research, you would then reproduce this edition (usually with a scanner). These scanned images are another Resource.
- Then you might remove some editorial matter, correct OCR errors, and create a plain-text or XML document, a derivative (usually for private research purposes because of the copyright limitations). This is yet another Resource, different from the original OCR.
For conceptual clarity, it is important that you properly represent those among such textual phases / versions which are relevant to your research separately.
Then, there is a more abstract entity of Territory, typically a written work. This again is distinct from its different representations (physical Objects or Resources).
In CASTEMO, it is good practice to build proper relations between these entities and not mix them.
Relate a text (work) in general, its textual versions, and physical medium
[To be written. Until then, this placeholder screenshot of a Territory entity, Bernard Gui's Book of Sentences, can explain a lot.]
Difference between OCR and project-curated digital text
Do not mix the original OCR with a its project-curated derivative. Represent the two with two different Resource entities.
- There is a physical and conceptual difference between the original OCR and the project-curated digital text (with OCR errors corrected, editorial matter removed, etc.). Ontologically, they are different Rs, and also physically, they are different files. They should therefore not be represented by the same R.
- The full-text imported in InkVisitor should be linked to the R representing the project-curated text, not the original OCR.
- The two Rs have the following relation among themselves:
R OCR - has - C derived version - R project-curated digital text. - For project-curated digital texts, check whether your project does not already havea template, and if so, use it when creating a new project-curated digital text. It will speed you up and the data will be more standardized.
Some complex relations between Rs and full-text documents
In most situations, we use only one project-curated digital text for one Territory (Text). However, there are some more complex situations. The well-developed CASTEMO data model should be able to handle all of them. The following text outlines such situations and gives guidance on how to solve them ontologically in the database.
The project-curated R is a division of one edition into two different Rs. This happens if the text has e.g. 4 texts in appendices and we separate them and give them specific names, but also have an R to represent the OCR of the original resource with all of them. Then, there will be one R for the OCR of all 4 texts together, but also the texts divided into different full-text files will each have their own R. Then:
- The R OCR will have those e.g. 4 Rs of project-curated digital texts as its derived versions (
R OCR - has - C derived version - R project-curated digital text). - They will not have a SOE relation, as the OCR is a different textual version than the project-curated R.
The project-curated R is a join of two editions. E.g., editor B edited an inquisition register apart from a section edited previously by editor A, and thus we join the editions. In such a situation:
- Cite both editors are cited in the label of the R entity, and in the folder and file name in the repository.
- A different R is created for edition A and edition B of this specific part of text, and thus are by definition covered in the project-curated R. They will thus have the project-curated R as their SOE.
Import a full-text document and start annotating
Before starting to annotate, you need to import a full text in InkVisitor, create a Resource representing this full text, and link it to a Territory. This page describes the process step by step.
1. Give a thought to your data management plan
Annotation creates an additional, XML-like markup layer over a full-text document. Therefore, you need to think early on about where the InkVisitor-managed full-text belongs in your data management plan. You can always export the full-text with all of your annotation (anchors) from InkVisitor, so in that sense you are safe. However, since the moment you start annotating and making text corrections in InkVisitor, this InkVisitor-managed version becomes the authoritative one, and should be updated with all enhancements.
Think about your full-text data management. Avoid creating two mutually outdated versions.
2. Clean the full-text document
You will usually want to import the main text of a source, excluding editorial text (we call it CAFE: Critical Apparatus, Footnotes, Editorial matter).
While you can also make edits in InkVisitor, it is generally advisable to import full-texts which are ready-enough for further work: with CAFE removed and the text (e.g. OCR) of sufficient quality.
InkVisitor accepts (1) plain text and (since Summer 2025) (2) text delimited by markup with pointed brackets (<>), such as XML.
The characters "<" and ">" are reserved markup delimiters and must not be used for anything else in the full text. Remove those which are not markup delimiters or replace them with another character before the full text import.
3. Import the full-text document
Open the document component from the main menu (top right corner).
Here, click on Upload document, locate the file on your drives, and confirm. Your document will be uploaded.
4. Represent the full text with a Resource entity
The full-text document needs to be represented by a Resource entity. Of course, this entity is not the source (text) in general; it is one specific textual version, edited by a specific editor and processed with a specific workflow (OCR-ed, transcribed, or digital-born).
Therefore, create an R entity representing the full-text document. The entity can be named e.g. "Letter of Ebervin of Steinfeld to Bernard of Clairvaux (ed. Migne, 1879), MedHate-curated version".
After you create this Resource, add a metadata description to it in this Resource's Detail.
Acknowledge the original editors and curators in the metaprops to give them proper credit in your data.
Save time and enhance data coherence by using a Resource template probably already created in your deploy for similar digitised resources.
5. Link your Territory to this Resource
This R (specific textual version) represents a Territory (text), which probably already exists (alternatively, you need to create it at this point). Now, you need to link the Resource to the Territory in two steps:
First, open the Territory, switch to Annotator view, and find the correct R representing the full-text document you want to link.
Second - in order to confirm the relation and save it permanently - add the anchor (start and end tag) of the Territory into the full-text itself as follows:
- Select the full text of this Territory in the full-text document displayed, from beginning to end (using Ctrl+A, Shift+PgDn, or mouse).
- A modal window appears. Anchor active territory in the full-text with the button "active territory" in the modal window.
6. Annotate
Now you are ready to annotate, that is, to add entity anchors in the full-text document. In the process, you will probably be creating new entities as you go, and using Relations to place them in proper semantic and ontological relations allowing you to then query them for research.
The anchors are the start and end tag of entities of any type, which are stored in the full-text document in an XML-like way using the entity's unique identifier (UUID). The following example shows the anchors visually in the InkVisitor Annotator interface, and in the XML-like code.
<002c9713-2513-418e-bece-b4df848ef27a>Pharisaeorum
</002c9713-2513-418e-bece-b4df848ef27a>: secunda, contra argumenta et
tormenta <5eb4bb80-18e2-4c99-a987-d317fe9acb8d>Gentilium
</5eb4bb80-18e2-4c99-a987-d317fe9acb8d>: tertia, contra
<f42d10f0-f8e1-4bb8-bb33-8792a889b801>subtiles deceptiones
<b5b3e40b-24d4-48bd-87da-0e9e4d547bae>haereticorum
</b5b3e40b-24d4-48bd-87da-0e9e4d547bae>
</f42d10f0-f8e1-4bb8-bb33-8792a889b801>: quarta, contra
<7cdd40ef-ea6b-4504-a789-a213976e380b>falsos Christianos
</7cdd40ef-ea6b-4504-a789-a213976e380b>: quinta, contra
<8328c68e-2fee-430d-bc4e-ecedc53b0ecc>
<66152db4-c21c-4986-811f-3f34d0e9d5eb>haereticos circa finem saeculi
venturos</8328c68e-2fee-430d-bc4e-ecedc53b0ecc>, p. 0676C | de quibus per
Apostolum manifeste Spiritus dicit: In novissimis temporibus discedent
quidam a fide, <2304a1c2-1a13-44ee-8051-8a1ccbd344fd>intendentes
spiritibus erroris et doctrinis daemoniorum
</2304a1c2-1a13-44ee-8051-8a1ccbd344fd>,
<f3e5fbc4-e6b9-44cb-99cc-2297705d8b65>in hypocrisi loquentium mendacium
</f3e5fbc4-e6b9-44cb-99cc-2297705d8b65>,
<949f9465-65b8-47eb-aada-4934183dd6c7>prohibentium nubere, abstinere a
cibis, quos Deus creavit ad percipiendum cum gratiarum actione
</949f9465-65b8-47eb-aada-4934183dd6c7>
</66152db4-c21c-4986-811f-3f34d0e9d5eb>.
InkVisitor is a tool for annotating digital texts, not images (e.g., manuscript reproductions). If you need to annotate images, you will need to use a different annotation software.
7. Export
For backup and analysis, you will need to export your full-text document alongside the anchors you created in the text. This is done in Documents (see the main menu in the top right) through the floppy disk icon. Typically, be sure to include all anchors in the export.
If you export the full text without including anchors of all entity types and then overwrite the InkVisitor-managed text by a reimported full text (e.g. after making some batch text corrections outside of InkVisitor), the anchors you haven't exported will obviously be lost forever.
Annotate texts with Annotator
Annotator is a component of the InkVisitor software adapted to the annotation of full-texts. Unlike most annotation tools, it is connected to a robust and historically informed entity–relationship data model, which allows you to smoothly create entities and build your ontology as you go.
After you have uploaded the full-text, linked it to a Resource, and added a Territory's anchor in the full-text, you will need to understand the Annotator component and start using it efficiently.
Annotator's function is annotation, i.e. adding entity anchors into full texts uploaded to InkVisitor. You can delimit the span and add anchors such as specific Persons, Places, Concepts, Events etc. in full-text documents.
Annotator has three modes: highlight mode, which serves to add and remove anchors, text edit mode, which serves to edit the text, and XML mode, which allows more advanced users knowledgeable of HTML or XML markup to view the raw text file and manually edit both the text and its markup.
Search text
In all its modes, Annotator offers the search function, with the possibility of setting whether the search should be case sensitive or insensitive. In addition, in text edit mode and XML mode, you can select whether you are searching only for the whole word.
InkVisitor allows to use regular expressions (regexes) in the searches. The regex set used is JavaScript regexes.
Add anchor
Terminology and principles
Terminology. Annotating in InkVisitor is done by pinning an entity into a text in Annotator. This entity pin an "anchor". Adding Territory anchors is also a way how to declare that a full-text document is a representation of a Territory, and to segment the text into Subterritories, e.g. chapters and subchapters, or to individual documents within a register.
What to anchor? Depending on your project and your needs, it can be enough to only anchor, for instance, Persons and Locations. If you are doing CASTEMO data collection, it is very useful to add Statement anchors - where does the Statement text start and end.
Add anchors one by one
Anchors are added by selecting text in Annotator (highlight mode) and selecting an entity in the empty suggester, or creating a new one from this suggester if the correct entity does not yet exist. You can also quite conveniently drag and drop the entity from other parts of the screen (e.g. Search or Territory tree) into the empty suggester. There are two special cases: adding Territory anchor for text identification, and adding Statement anchor. For existing Territories, you do it in the way just described. However, for not yet existing Territories, you select the appropriate span (you can use Ctrl+A, Shift+PgDn and other cursor keys) and create a new territory either as a child, or sibling of the current territory. This way you can save time, because you both create the new Subterritory and also add it to the Territory tree at a proper level of the structure (as child or sibling of the current one).
With Statement anchors, the most practical workflow is actually to create Statements from Annotator: you select the span, and press the button new statement. This will do two things at a time: add a new Statement to the Statement list, and anchor it in the text, which is the most economic way. However, you can also anchor statements created before.
When adding the anchor, always remember to select the epistemic level. You might already know the epistemic level attribute from other contexts in InkVisitor. If the expression is exactly in the text, set level to textual. If you are slightly changing the wording, e.g. from verbal to nominal, use the interpretive epistemic level. If you are annotating at a higher level of generalisation, departing from the text or anchor an entity with a different label language than the language your text is in (e.g. you use the English Concept "hate speech" to annotate Latin text), use inferential epistemic level.
Add more anchors through search
If you want to add the same anchor more than once, going through search results and choosing whether the anchor should be added or not, e.g. adding the anchor of a Location (e.g., Paris) throughout the document, then follow these steps:
- select the entity you want to anchor to more places in the document in the empty suggester on the right from the search box;
- fill in the text you want to find into the search box,
- move between hits by the up and down buttons next to the search box and if you want to add the anchor here, click on the anchor button: this will wrap this search result with the start and end anchor; if you don't want to add it, just press the down button to go to the next hit.
The settings "extend to whole word(s)" is often very useful here.
Regexes are often very handy too. Use your favourite AI to help you with building more complex regexes.
Locate anchor
Obviously, you often want to locate already added anchors. You can locate any anchor of any entity from this entity's Detail: you open the entity in the Detail, look at the list of its anchors in texts, and by clicking on the icon of the appropriate anchor, you navigate to Annotator view of the specific anchor in the given full text.
For Territories, there is also an alternative way, usually more at hand: you open the Territory in the Territory tree (leftmost column of the application) and click on the Locate anchor button.
Remove anchor
If you need to remove an anchor, you can do it either from the Detail of the given entity (see above), or from Annotator in the highlight mode. Here is how: select a span encompassing the anchor you want to remove; the anchor modal window will appear, and here you will see all anchors in this span, and you can click on the unlink button on the entity you want to remove.
Don't worry, removing an anchor does not remove the entity. Only one specific anchor in the given full-text document.
Edit text
It often happens that you spot errors in the text and you need to correct them. For this, use the text edit mode of Annotator. Correct the error and save the changes.
View/edit XML markup
There is a third view apart from highlight and text edit: XML view. At the background, InkVisitor operates with a pointed-brackets delimited markup - it can be XML markup or other markup. To avoid XML verbosity and the related drop in speed, InkVisitor anchors are not valid XML, but only the UUID enclosed in pointed brackets, e.g. <a6f9d39e-68cf-4970-b955-c4d50fd7b621> as the start anchor and </a6f9d39e-68cf-4970-b955-c4d50fd7b621> as the end anchor.
You might want to use XML view when you want to check the raw code of the file for exact placement of anchor, for whether it is actually there, or actually removed after you removed it, and also when something goes amiss. With proper care, you can edit the code here - move end or start anchors etc.
Search and replace strings in full-text documents
The Annotator component in InkVisitor has in-built functionalities for:
- searching text;
- replacing text, e.g. for making corrections of full-texts;
- adding anchors sequentially, rather than one by one.
The search box enables Javascript regular expressions.
Search is available in all three Annotator modes (highlight, text edit, and XML). It allows to check occurrences in context or jump to the right place in the text where you are currently working.
In the text edit mode, you can also perform replacement of text.
Another section explains how to add anchors using search.
Add anchors using search
Adding anchor to one search hit
In the highlight mode, it also allows you to add anchor to the search hit. If you do it through the regular modal to add anchors, you will add one anchor:
Adding anchor to more search hits sequentially
If you want to go through hits one by one and add anchors to more of them, deciding on each hit whether the anchor is appropriate, you can use the batch mode: in the header of the highlight mode , you can see a suggester field. If you add an entity here, you can use the anchor button to add anchor to the selected string and go to next hit:
Because of inflection, regular expressions can come in handy when adding anchors in a batch, because you would like to add them to the different forms of a word or multi-word expression.
Decide on the focus and extent of annotation
Any semantic annotation, as comprehensive as it might be, always has a purpose, that is, is connected to a set of research questions currently pursued or considered as relevant in future work. Therefore, at the early stages of annotation, you will need to make choices about the focus and extent of your full-text annotation:
- What entity types are relevant? Are you interested in capturing people? Places? Dates? Concepts?
- Do you need only to annotate entities, or you need to put them in clauses, statements?
1. What entities?
A first entity that needs to be put in the text is obviously the Territory you are annotating; and, if any subdivisions (into chapters in a book, individual documents within a notarial register etc.) can be relevant (usually they can), also the Subterritories, i.e. Territory entities which are children of the first-level Territory.
If you do only annotation without CASTEMO Statements, it is usually a good idea in most projects to annotate people (Persons) and places (Locations). These are the obvious candidates to include. However, if you are doing CASTEMO and anchoring Statements in full-text documents, you might not be interested in doing the further work of also delimiting the text spans for people and places.
Generally, if you want to understand meaning, you will not be able to miss Concepts from annotation.
If you are making CASTEMO Statements, there are several reasons why to also anchor them in full-text:
- Up-to-date text span, which will get updated even when you change the text (e.g. correct errors).
- Use as training data for generative LLMs, where a workflow can use your existing annotation to produce new, machine-generated annotation, check for inconsistencies etc.
2. Only collecting entities, or building clauses?
If your annotation has a clear focus, such as "this text is only on Hussites and I only annotate hate speech concepts related to them", then you might be fine with only annotating the Concepts used to denigrate them, without doing anything else. However, if you require more analytical opportunities, you will generally need to distinguish to whom such Concepts are applied, and in what way. If this is the case, you will generally need to use Statements. Statements are the way to distinguish e.g. "Hussites - are" from "Hussites - are similar to", and also to record, if needed, reported speech and other devices constituting narrative perspective.
Thus, shortly: if Concepts relate to more entities than one, you need Statements, and thus, a CASTEMO approach, actually modelling clauses as statements (whether summarized - SumCASTEMO, or selective - SelCASTEMO, or full sequential - FullCASTEMO).
Collect data in InkVisitor
Describe your data collection choices
Every data collection campaign, even the most comprehensive CASTEMO annotation, necessarily makes choices, and is selective.
In collaboration between several users, and also as time goes by, it becomes increasingly tricky to remember what data collection guidelines you used, what you included, what you skipped... while this is, obviously crucial for the interpretation of results based on the data collected. Therefore:
You should always describe your data collection choices.
Furthermore:
It is generally better to keep the description of data collection choices very close to the data themselves.
In CASTEMO knowledge graphs, we recommend to append the description of the collected data as part of the metadata of the Territory which holds this CASTEMO data. There is a pre-defined section Protocol under each Territory which allows you to capture the basic ones. Beyond that, you might want to describe your choices in a more narrative and comprehensive way in a document (webpage, Google Doc), which can be linked from the Protocol.
Statements: entities with Action as their core
Action is the core of any Statement. Actions as entities (Action types) are treated in the Entities section. Here, we will look at individual instances, that is, on Actions as used in Statements. You will understand how they form the semantic core of Statements - and usually also the core of your research data.
When to create a new statement?
Generally, any clause (segment of text with a verb in a definite form) amounts to a statement. But there is more to do, since when doing a statement-based data collection (such as CASTEMO), you are usually interested in actions that entities enter in, and interactions between entities (such as Persons or Groups). Thus, in addition to explicit clauses, it is recommended to also create a statement for each of the following structures:
- participles ("seing this, she..."; "requisitus de veritate dicenda, ...");
- infinitives ("[he finally decided] to go": this structure is implicitly transparent on who is meant to go, and this "to go" should thus - while receiving a proper mood and mood variant - should thus be transformed into a fully-fledged action);
- eliptic expressions with verbal meaning ("she answered that yes" - this "yes" should be developped into fully-fledged new statements, with Actions at interpretive epistemic level, denoting the content of what was the content of the decision, but not referring syntactically to the previous statements on this as actants of the "answered" statement - as they don't have this syntactic relation in the text - but "copying them" in a proper mood and modality, with only this "that yes" delimited in the text as the span of all of these statements).
Event, or Statement?
Events and Statements can work in synonymic ways, but when coding a text, follow the wording:
- for verbal expressions and their eliptic expressions (such as "Peter was baptized by a priest"), use a Statement;
- for nominal expressions (such as "baptism of Peter by a priest"), use an Event.
The Action-Event Equivalent (AEE) Relation is there to ensure full translatability between the verbal (Statement) and nominal (Event) rendering, you only need to be sure to include this in your queries and data transformation scripts.
Actants
Maximize coreference
Coreference resolution — identifying that different expressions, or absent expressions, refer to the same entity — is essential to producing dense, accurate interaction data. Annotators should resolve coreference actively and systematically, not only where referents are explicitly marked in the text.
Implicit actants. Latin prose, including inquisition records, routinely omits subject and object arguments recoverable from morphology or context (pro-drop, unexpressed objects). These should always be developed: where a verb's subject or object is recoverable, the corresponding entity must be added to the appropriate slot even if no overt nominal or pronominal expression appears in the clause.
Actants without any linguistic signal. A more demanding case arises where no linguistic signal whatsoever marks a participant, yet the participant is semantically required and contextually recoverable. The canonical example is the interlocutor in a reported-speech frame: Que respondit: "…" names the speaker but leaves the addressee entirely implicit. In such cases, however, the addressee is not unknown — it is the interrogating inquisitor (or equivalent interlocutor), whose presence as the recipient of the reply is a structural presupposition of the exchange. The addressee must be developed and added to the relevant actant slot. This principle generalises: wherever the communicative or actional structure of a clause entails a participant recoverable from context, that participant should be populated, so as to maximise the interactionality of the data — the degree to which interactions between specific entities are captured rather than left implicit.
Epistemic level. Resolving implicit or zero-signal coreferences does not amount to an interpretive or inferential claim about historical reality. The actant's involvement is established at the textual level by the logic of the clause and its immediate context. Accordingly, coreference resolution of this kind does not change the epistemic level of the actant involvement.
Time
Attribute of events, not people or objects directly
Time belongs under Events, not directly under Persons, Groups, Objects or Territories.
While the CASTEMO ontology technically allows you to attach dates and places directly to people or objects, it is more proper to attach time to Events. For instance:
- a Person can have the Event of birth (labelled for instance "birth of Alexander the Great"), death, etc., which will be classified as Event of that class (e.g. "birth", "death", with SCL something like "life-cycle event"), and will have its time (and place, and potentially other circumstances) attached;
- a manuscript (Object), or text (Territory) or textual version (Resource) can have the event of composition, which will again have its time (and place).
This is ontologically more appropriate, if you think what time and place really describes, but also practically, for instance if you need to treat more complicated temporal relations such as temporal range (some time between year 1250 and 1350) or uncertainty.
Such Event will be attached to the entity through a property in the usual way, e.g.:
P Alexander the Great - PROP - C event of birth - E birth of Alexander the Great
Location
Attribute of events or actions, not people or objects
While the CASTEMO ontology technically allows you to attach locations directly to people or objects, it is more proper to attach place to Events. For instance:
- a Person can have the Event of birth (labelled for instance "birth of Alexander the Great"), death, etc., which will be classified as Event of that class (e.g. "birth", "death", with SCL something like "life-cycle event"), and will have its place (and time and potentially other circumstances) attached;
- a manuscript (Object), or text (Territory) or textual version (Resource) can have the event of composition, which will again have its location (and time and other circumstances).
This is ontologically more appropriate, if you think what location really describes, but also practically, for instance if you need to treat more complicated spatial or temporal relations such as spatial uncertainty.
Such Event with a location will be attached to the entity through a property as usual, e.g.:
P Alexander the Great - PROP - C event of birth - E birth of Alexander the Great
Coordinates
Coordinates are generally quite a straightforward property - attach them a metaproperty to the location as a coordinate pair, with Concept such as "coordinates (lat; long)", and the value as Value entity:
It is a good idea to mark localisation precision, usually with values such as "precise" and "approximate", which are of course relation to the scale: for instance, but locating a settlement by the location of its oldest church is precise (because we are at settlement level), while locating a house by the location of the settlement it is in is only approximate (because we are geocoding a house, and thus are at house level).
If your data transformation pipeline counts on imputing missing coordinates also from superordinate or even nearby locations, it is advisable not to create artificial precision. For instance, if you have a house, but don't know where within a settlement it was, do not attach coordinates of the settlement to the house, but rather declare that this house - SOE - this settlement.
Another optional thing you might want to add esp. if the localisation is approximate is the source of knowledge - we call it epistemic source. See screenshot above: it says that the source of the coordinates of this location, which happens to be a region, is the coordinates of its administrative centre, rather than other options (e.g., centroid or an actual polyline defining its boundaries).
Spatial reference points
List of recommended spatial references
The CASTEMO data model is flexible: each project can have its own terminological preferences. Generally, any will have a set of spatial relations, which can be in any language, e.g., in the language of sources if used for coding a source. This is a set of spatial reference point (SRP) Concepts that you are likely to need in some terminological modification or another:
- SRP in
- SRP away from / disjoint
- SRP from
- SRP to
- SRP into
- SRP over
- SRP through
- SRP next to
- SRP between
- SRP in the midst
- SRP parallel
- SRP partial spatial overlap
- SRP same location / exact spatial overlap
Further dimensions of a spatial relation
You need to first relate the two entities, e.g. one settlement to another, then specify their relation in a subproperty. For instance, to declare that Brno is 206 km from Prague, you would first relate the two cities through a first-level property, and only then state their distance as a subproperty (child property). We usually do the first by the C SRP away from / disjoint, and the latter with the C distance in km.m.
Same identity vs. exact spatial overlap
The Identification (IDE) of two Locations and their exact spatial overlap come close to one another. Which one to use depends on what the source says and what exactly you want to say. If you want to make a statement about their spatial extent, we use the spatial relation. If, on the other hand, you want to declare the identity of two entities, we use Identification.
"Same as above": Referencing information content in CASTEMO knowledge graphs
Referring to the content of another statement
Basic logic
Statements often make references to other statements to express that the content is the same, different, or related in other ways. In those cases, people are not saying the same statements obviously: they are talking at a different time, and they are also different from the original utterers. What we need to record is simply that the source claims that their statements have the same content as some other statements in the data.
If it is important to note down such chains of reported speech in your research, we recommend a series of properties recording the stated relation to other content.
Syntax of links to similar content
Let's take the example: "Witness Jane said the same thing as witness Paul." You coded Peter's relevant content in three different statements, let's call them PS1, PS2 and PS3.
You will create two statements: "Witness Jane said" (JS1), and "the same thing as witness Paul". The links will be built in the referring statement "Jane said". In JS1, Jane will be the subject, and the slot for speech content (e.g., actant 2) will be filled in with JS2. JS2 will not be modelled syntactically, but within JS1 (sic), you will attach three properties to it, declaring that JS2 (actant) has same content as, in turn, PS1, PS2 and PS3.
You might want to do some replacements in the "same content" link. For example: "Witness Jane confessed about herself the same things as witness Paul about himself." Now in this case, if it si relevant for your project, you might want to preserve the backlink to same content, rather than repeat them as if Jane's testimony actually listed them, but at the same time, you need to say that Jane is confessing them about herself, not about Peter who features as actant of the original PS1, PS2, and PS3. You can code such things in CASTEMO very easily by setting a replacement rule (a property with proptype C "replacement rule"), which is composed of two subproperties: replacement condition value property, and replacement value property. The former is setting what should be replaced, and the latter for what new entity it should be replaced. E.g., in our example, you might want to take over content from Peter's testimony, but within this same content link, you might want to exchange Peter for Jane, telling your query or data projection script (that you need to develop yourself, this is not InkVisitor's work!): take over Peter's content, but within this link, consider it as concerning Jane. You can see a real-life example in the following screenshot.
While you can code very complex "similar content" references in CASTEMO, (1) it is not always useful, and (2) you need to have a way to extract them back from the coding into the data you will use for analysis.
Differentiate degrees of content similarity
The text (or you, at the inferential epistemic level) can posit different degrees of similarity, which should be properly differentiated. It can be really C same content, but also more generally only C similar content, and for that matter, the text (or you, at "inferential" epistemic level) can also posit that something is C partially similar content, or even C different content. That is, create a set of content similarity Concepts, relate them within a proper taxonomy, and use them to relate statements as required by your research.
Epistemic level in the referencing property
- If the reference is contained in the text, the whole property should be at the textual epistemic level.
- If in this property, you are using an analytical property type (e.g. C "same content") to which something corresponds in the text, but the reference is not done with these words and possibly even is done in a different language, the involvement of the "similar content" proptype will be at inferential level.
Referring to temporal, spatial and circumstantial information of another document or statement
Referring to temporal, spatial and other circumstantial information of another document ("Written in the same place, on the same date, and with same witnesses present") is a different case - this is not taking over content, but some circumstantial details. These details can be further modified: in the same year as above, but 1st October. In these cases, [... to be continued ...]
The more complicated is the encoding (data-in), the more complicated is specifying the data projection and writing the script to do the decoding (data-out). Consider your resources. InkVisitor is a data collection tool: you need to extract the right data set for analysis from it with your own means.
Territories and their relation to Resources
Query, explore, review, and export data
This chapter describes the Explorer section of InkVisitor, which provides a powerful capacities for querying the knowledge graph, visualising the data in exploratory and analytical views, and exporting the data as a table.
Query your knowledge graph
Show data as table, edit them, and export them as CSV
After filtering the data you want, you can perform various operations on them in the InkVisitor Explorer.
Build your table
You now have some entities as result of the conditions you have set for the query. Typically, what you want to do with them now is display some of their attributes.
For instance, you might want to see all Locations with their Classification (the type of location it is), all of their props generally as a field, and their geographic coordinate pair specifically. Use the New column button to add those columns one by one.
You will see something like this:
Edit data in a column
You might want to edit data - for instance, you want to see all Persons which do not have the property of sex set, and assign this property to them one by one. This you can as follows. When you are adding the column to the results table, tick Editable.
Now, you are able to add the missing values in the column, and add them.
Add Properties, Relations, and References in a batch
This operation is restricted to users with admin or owner rights.
Once you have your query results, you can select all of them, or those to which you want to apply some new Property, Relation, or Reference, select the relevant batch operation from the menu, and confirm.
Select what you want to add (for instance, you can only pre-fill the property type, or even apply the property value), and confirm. The data will be added.
Export data as CSV
Exporting data is simple. Once you have built your table, you check the rows you want to export (e.g., all of them), and select Export as CSV from the batch operations select.
Visualise data
Some cool visualisation features are currently under development:
- Map view, which shows all geocoded locations on a map. Of course, as elsewhere, you can build your results table, e.g. show the places of residence of Persons, rather than generally all Locations.
- Network view, which shows your data as a graph based on the connections you have used to build the table.
- Stats view, which shows user contributions to the data shown in the results table.
- Anchor view, which shows the anchors of entities in the results table in your full-text documents.
So keep tuned, we are working hard to give you these functionalities soon.
Query CASTEMO knowledge graphs
Now, time to get knowledge out of the knowledge graphs. This chapter categorizes some useful queries to validate your data, and start digging information from the CASTEMO knowledge graphs stored in RethinkDB.
Finding inconsistent and invalid data
This is the collapsible text.
For various reasons, such as data import or bugs of some version of the interface, a CASTEMO knowledge graph can contain inconsistent data. It is thus important to identify this data and correct the inconsistencies either manually or from a script.
Get all entities involved in more than one synonym cloud
In the CASTEMO data model, one entity can be only involved in one synonym cloud.
ReQL
r.db("inkvisitor")
.table("relations")
.filter({ type: "SYN" })
.getField("entityIds")
.reduce(function (acc, val) {
return acc.setUnion(val);
})
.default([])
.map(function (ide) {
return {
id: ide,
count: r
.db("inkvisitor")
.table("relations")
.filter({ type: "SYN" })
.getField("entityIds")
.filter(function (syn) {
return syn.contains(ide);
})
.count(),
};
})
.filter(function (a) {
return a("count").gt(1);
});
R
Empty language: get labels of all concepts with empty language
ReQL
r.db("inkvisitor")
.table("entities")
.filter({ language: "", class: "C" })
.getField("label");
Querying CASTEMO knowledge graphs in Neo4j
Querying with relations
Get data of trial events and their participants (DISSINET-specific)
How to match the person physically at trial (in a deposition, deponent)?
In DISSINET data, there are several concepts with different degree of generalization, which point to the person at trial. Generally, use this cascade of props under a trial event, preferring the first proptype match:
bed73d79-d3e7-4036-b357-42ec0da37c43(person at trial hearing - i edited the label today, but anyway the UUID is the holder of identity and should be used in all cases, not label)4e4b5f63-8eac-41ec-96d4-45cbd19ea8f6(deponent)06a4e252-d4fb-4956-9a9a-2614efb70351(witness)4e2bffec-ead1-499e-8bd2-81ba45602c9e(testis)9e17df82-83fc-440d-8353-0a9c31a3766c(participant in a trial)c5f3108d-d6ba-4ad7-afcc-2776ec9407ce(defendant)36082ea7-61aa-43b1-a6f3-9f07be17f59a(reus)
That is, if any "person at trial hearing" (bed73d79-d3e7-4036-b357-42ec0da37c43) is matched, don't continue and match this Person. Do not consider persons from different levels of the cascade, but only the first which is matched as proptype of a trial event, starting from no. 1 and continuing further. Because the point is not to match both deponent and defendant (the two can be different, e.g. if a witness gives testimony about another defendant in the trial of that defendant).
Querying with counting
Find Actions used in more than 20 statements
MATCH (s:Statement)-[:HAS_ACTION]-(a:Action)
WITH a, COUNT(DISTINCT s) AS st_count
WHERE st_count > 20
RETURN a.uuid as action_id, a.name as action_label, st_count as statement_count
Data import to InkVisitor
Parsing instructions for the import of tabular data
This doc describes the parsing/import instructions used in the google sheet tables meant to be imported to inkVisitor DDB1, which conforms to DDM (=DISSINET DATA MODEL).
The instructions were mostly improvised in the conversations between DZ and TH, they changed a lot during the development of the inkVisitor data model and parsing. E.g. the system and terminology probably are far from ideal. Sorry for that. :)
Prerequisites
It is helpful to understand the issues around properties, metaproperties and 2nd order metaproperties.
Basics
The first four rows of the google sheet table (designated for parsing+import to inkVisitor DDB1) form the parsing header.
The fifth row contains a header row with column labels.
Each other following row represents one main entity, e.g. "Person" or "Location".
The foundational part of import instructions parsing instruction keywords (e.g. discard, inside, ...), sitting in the 4th row.
The four rows are:
- comment- anything can be here, it is for humans, mostly used for the definition of the "special" instruction
- target object - for parameters of relational instructions, (e.g. "id"), signals target to which this column is supposed to hooked
- type - for parameters of relational instructions (e.g. "R0002"), for the first part of the property type-value pairs, i.e. dog has "color" (type) "brown" (value)
- parsing keyword (e.g. "reference_part") - primary information on what to do with the column data
- the label /name of the column
Generally, there are three types of instructions
- simple, they do not need other parameters (e.g. inside, discard)
- relational, they specify relational data and need other parameters (e.g. propvalue, relation)
- special, they are specified in natural language in the comment row
Here are all possible keywords:
| simple | inside, discard, hooked-inside |
| relational | relation, reference_part, propvalue, proptype, proptype_2nd, propvalue_2nd, hooked-relation, hooked-propvalue |
| special | special |
All columns in the table meant for parsing and import should have an instruction header!
Meaning of the parsing instruction keywords
Simple
| inside | the content in the column is meant to be directly inside the entity objects, e.g. for columns like "label" or "note", that target entity need to have such attribute specified by the data model |
| discard | the content in the column is just ignored |
| hooked-inside | the content in the column is meant to be inside of some "embedded object", which is always defined by the preceding special column |
Relational
| description | param1 type | param2 target object | the cell can contain | |
| relation | for making DDM "Relation" | name of the relational type (e.g. "Classification", "Identification") | can be empty but usually contains "id" as a signal that this entity is connected to the main entity | a concept legacyId, e.g. C3166 (defendant deposition) |
| reference_part | for making DDM references to resources | resource ID (e.g. R0002) | can be empty but usually contains "id" as a signal that this entity is connected to the main entity | string of the pages, e.g. "v216", which is transformed into Value object |
| propvalue | for making metaproperty, where the type is A. fixed for whole column OR B. defined by main entity field with proptype instruction | a concept, which defines the type, e.g. C0316 (occupation) | empty OR name of the column with proptype | entity legacyId, or string which is transformed into Value object |
| proptype | for making metaproperty, where the type can differ | empty or can contain "id" | the C entity | |
| proptype_2nd | for making 2nd metaproperty, where the type can differ | name of the propvalue column, to which this 2nd order property is hooked | ||
| propvalue_2nd | for making 2nd metaproperty, where the type is A. fixed for whole column OR B. defined by main entity field with proptype instruction | a concept, which defines type, e.g. C0316 (occupation) | name of the propvalue column, to which this 2nd order property is hooked | entity legacyId, or string which is transformed to Value object |
| hooked-relation | as relation, but it is controlled from special instruction | as relation | can be empty, but usually contains the name of the column, which has special instructions | |
| hooked-propvalue | as propvalue, but it is controlled from special instruction | as propvalue | can be empty, but usually contains the name of the column, which has special instructions |
Special
| special | Conforms to the particular parsing function, which is fully custom and based on the instructions. |
InkVisitor installation on a server
This chapter is intended for your IT support. It describes how to deploy the InkVisitor application on a server so that you can start using it. However, we are ready to discuss possibilities and help with this.
How to deploy your own instance of InkVisitor
This page describes how to deploy a self-hosted instance of InkVisitor. The recommended path is to use Docker, which packages the client, server and database into a single workflow. For setups that cannot run containers, the same components can be built and run as individual processes.
Components
InkVisitor consists of three interconnected packages located in packages/:
- client — React/Vite frontend (static files: HTML/CSS/JS)
- server — Node.js + Express API
- database — RethinkDB plus a CLI tool used to create the database structure and import datasets
The Docker image bundles the client (served as static files by the server) and the server into a single container. The database always runs as a separate service (either containerized RethinkDB or installed natively).
Prerequisites
Before you start, make sure you have:
- Docker + Docker Compose v2 — install instructions: Docker, Docker Compose. Note: Docker Compose v2 is invoked as
docker compose(with a space). The olderdocker-compose(with a hyphen) still works but is deprecated. - Node.js
^22.11.0and pnpm^10.1.0— required if you are building locally without Docker, or if you want to run the database CLI to import data. Switch pnpm versions withcorepack prepare pnpm@<version> --activate. - Access to a server with the required ports open (see Firewall).
- The InkVisitor source code — clone, fork or download from github.com/DISSINET/InkVisitor.
A. Deploy with Docker (recommended)
The InkVisitor application runs as a single Docker container (client static files served by the server) alongside a RethinkDB container. Both are orchestrated by docker-compose.yml.
You have two options:
- A.1 Use the published image — fastest path. Recommended unless you need to customise client-side configuration.
- A.2 Build the image locally — required when you need custom client
.envvalues (e.g. your ownAPIURL,ROOT_URL), because those are baked into the image at build time.
A.1 Use the published image (from Docker Hub)
Ready-to-run images are published at dissinet/inkvisitor (tags: latest, production, staging, sandbox, …). docker compose up pulls the image automatically — there is no build step.
The shipped docker-compose.yml defines all server environment variables inline with sensible defaults, so a basic setup needs no .env file.
1. Start the database
From the repository root:
docker compose up -d database
RethinkDB now runs in the inkvisitor-database container with its driver port on 28015 and its admin dashboard on http://localhost:8080.
2. Import the database schema and initial data
The database CLI runs on the host (not inside a container) and creates the database, tables and indexes — and optionally seeds example data. The target database does not need to exist beforehand; the CLI drops and recreates whatever DB_NAME it is configured for. The shipped defaults point at a database called inkvisitor.
cp packages/database/env/example.env packages/database/env/.env
cd packages/database
pnpm install
pnpm start
In the interactive prompt:
- Decline the SSH-tunnel prompt to stay on the local connection.
- Press
Dto pick a dataset — for a first run, useempty(just the schema, no data). - Press
Xto execute the import.
To target a different database name, either edit DB_NAME in packages/database/env/.env or pass it as a CLI argument: pnpm start <dbname>.
Verify in the RethinkDB data explorer at http://localhost:8080/#dataexplorer:
r.db('inkvisitor').table('entities')
3. Run the application
docker compose up -d inkvisitor
Compose pulls the image from Docker Hub (if not already cached) and starts the container. The server serves both the API and the client static files on port 3000. With a reverse proxy in front (see SSL), the application is reachable at the domain you configured.
To update later:
docker compose pull inkvisitor
docker compose up -d inkvisitor
Customising defaults
The environment: block in docker-compose.yml uses ${VAR:-default} substitution, so you can override any value via a top-level .env file (auto-loaded by docker compose) or shell environment, without editing the compose file.
Create a .env next to docker-compose.yml:
# Required before exposing publicly
SECRET=<long-random-string>
# Optional overrides
DOMAIN=inkvisitor.your-domain.tld
IMAGE_TAG=production # use a different published tag
DB_AUTH=<rethinkdb-password> # only if RethinkDB requires auth
# SMTP (optional, enables password reset and notifications)
SMTP_HOST=in-v3.mailjet.com
SMTP_PORT=587
SMTP_USER=<mailjet-api-key>
SMTP_SECRET=<mailjet-secret-key>
MAILER_SENDER=noreply@your-domain.tld
The variables you most commonly want to set:
SECRET— JWT signing key. The default is a placeholder; replace it before going public.DOMAIN— used in outgoing email links.IMAGE_TAG— picklatest(default),production,staging,sandbox, etc.DB_AUTH— RethinkDB password (leave unset if RethinkDB has no auth). ⚠ Same secret asDB_PASSin the database CLI's env file — the two use different variable names.SMTP_HOST/SMTP_PORT/SMTP_USER/SMTP_SECRET/MAILER_SENDER— SMTP relay for outgoing mail. Leave unset to disable mail features. Mailjet example shown above.
Less commonly overridden: NODE_ENV (default production), ENV (default production — server injects this as window.appConfig.env into the served index.html; required for the client to render), STATIC_PATH (default /), PORT (default 3000), DB_NAME (default inkvisitor), DB_PORT (default 28015), DB_POOL_CONNECTIONS (default 10).
A.2 Build the image locally
Build your own image when you need to customise the client .env — for example, to set a different APIURL or ROOT_URL. Client configuration is baked into the image at build time, so changes there require a rebuild.
The setup is identical to A.1 with two additions: prepare a client .env file, then build the image before running it.
Prepare the client .env file
The client is built at image build time. Vite reads packages/client/env/.env.<mode> where <mode> is picked by the ENV build argument:
ENV=latest(the default indocker-compose.yml) →packages/client/env/.envENV=production→packages/client/env/.env.productionENV=staging→packages/client/env/.env.staging- etc.
Copy packages/client/env/example.env to the matching path and fill in:
ENV— short identifier surfaced in the UI as the current environment (e.g.production,staging). Ignored forENV=latestbuilds, used everywhere else.ROOT_URL— base path the client is served from. Use empty (or/) for the root; use/inkvisitorif you serve it under a sub-path of your domain.APIURL— full URL of the server API. Leave empty to make the client call back to the same origin it was loaded from (this is what makes the publishedlatestimage work as-is when the server hosts both the static files and the API). Set explicitly to e.g.https://api.your-domain.tldonly if the API lives on a different host than the client.
These three are the only variables defined in example.env. The client source code reads a few more (GUEST_MODE, GUEST_MODE_USER, GUEST_MODE_PASS, LOGIN_TITLE, LOGIN_TEXT, LOGIN_CITATION, SHOW_LEGACY_ID) which are optional UX customisations — add them to your env file if you need them. See the client README for details.
Build the image
The Dockerfile builds the annotator, client and server packages into a single image:
docker compose build inkvisitor
This uses ENV=latest per docker-compose.yml. To build a different environment variant, either change the ENV: value in the compose file or use one of the helper targets in Makefile:
make build-inkvisitor # ENV=production
make build-inkvisitor-staging # ENV=staging
make build-inkvisitor-sandbox # ENV=sandbox
make build-latest # ENV=latest
After the build finishes, run docker compose up -d inkvisitor as in A.1. Compose uses the freshly built local image (tagged dissinet/inkvisitor:latest) rather than pulling from Docker Hub. If you built a different tag, set IMAGE_TAG=<tag> in your top-level .env so compose picks it up.
B. Deploy by packages (without Docker)
If containers are not an option, the three packages can be built and run individually. In every step, make sure the matching .env.<env> file is in the env/ folder of the package — see each package's README for the variables it expects.
1. Database
Two options:
- Containerized RethinkDB —
docker compose up -d databaseas above (still convenient even when client/server are not containerized). - Native install — follow the RethinkDB installation guide.
Create the database (r.dbCreate("inkvisitor") in the data explorer) and then run the import CLI:
cd packages/database
pnpm install
pnpm start
Use the empty dataset for a bare-minimum setup.
2. Client
The client is a Vite build that emits static files.
cd packages/client
pnpm install
pnpm build:<env> # e.g. pnpm build:production
Copy the contents of packages/client/dist to the directory served by your HTTP server.
3. Server
cd packages/server
pnpm install
pnpm build
ENV_FILE=<env> pnpm start:dist
ENV_FILE=<env> selects packages/server/env/.env.<env> (e.g. ENV_FILE=production reads .env.production). Make sure that file exists and is filled in.
For local development you can also skip the build and run pnpm start, which uses nodemon with .env.development.
SSL
For production, terminate SSL in a reverse proxy in front of the server — typically nginx — and forward to the API port. This is the recommended setup.
When the proxy serves both the client static files and the API on the same domain over https://, you can leave APIURL empty in the client .env — the client will call back to its own origin (window.location.origin), so HTTPS just works. Set APIURL explicitly only if the API is hosted on a different domain than the client.
The server also has an internal HTTPS=1 flag — set it via a top-level .env or shell env when running compose — that enables TLS using cert.pem/key.pem from the container's secret/ directory. The Docker image generates a self-signed certificate at build time, so this is suitable for local testing only; use a reverse proxy with a real certificate for anything public.
Firewall
The ports that need to be reachable are declared in docker-compose.yml. For a public InkVisitor instance you typically need:
3000— server API and (when using the Docker image) client static files. This is the only port that must be public.8080— RethinkDB admin dashboard. Open only if you need remote DB administration; otherwise keep it private.28015— RethinkDB driver port. Open only if you connect to the database from outside the host.
Example commands:
Setup of additional system-specific features (reverse proxies, fail2ban, etc.) is beyond the scope of this page.
Kubernetes
For Kubernetes-based deployments, example manifests live in the kube/ directory of the repository. The setup needs to be adapted to your cluster's capabilities (ingress, storage class, secrets management).
MedHate annotation instructions
Instructions for annotating within a special project, focused on medieval derogatory language and polemical rhetorical techniques.
MedHate Minimal Annotatables (MMA): the minimum to annotate in any MedHate subproject
To produce data useful for a reliable comparison, any MedHate annotation project should annotate fully - within any passage not marked in a protocol document as unannotated - at least the following MedHate Minimal Annotatables.
I. Negative attribution
We need to collect all negative attributions, i.e. attributions of a negative attribute to any adversary.
- Target (adversary): Groups (often generic, but sometimes also definite, indefinite or even hypothetical) or Persons to which any derogatory characteristic is attributed.
- Negative attributes applied to an adversary (Concepts as well as Actions; "they crawl from the abyss of hell" is a verbal example).
- Attribution type (i.e., the link between No. 1 and No. 2), typically through the Classification of a Statement (e.g., as C "polemical association with poison"). Remember that a Statement can have multiple Classifications, which is useful if an expression carries more connotations at once; but both must apply to the whole span.
- Speaker, i.e. the Person or Group who makes the attribution in the text: is it the author him/herself, his adversaries, "the people"? Do not rely on author being the default option, as it is generally problematic to produce reliable data from coder's silence.
- Speaker type, which is, in addition to the Person or Group, a broader category of voice, now with the following categories:
- Warrant for a claim, where given:
`scripture`,`tradition`(fathers, canons, custom of the Church),`doctrine`(a theological claim),`reason`(argument from logic, nature or consistency),`consequence`(harm or benefit that follows),`authority`(a present-day authority's office or decision),`none`,`undecidable`. Only the speaker's reasoning: the heretics' scriptural proof for their own practice is the ground of their proposition, never of the author's rebuttal, and vice versa.
II. Repressive action
Real, invited, or even completely hypothetical action against adversaries in the text.
- Target (adversary).
- Action (event) type. E.g.,
`public debate`, `burning`, `expulsion`, `imprisonment`... In InkVisitor, typically rendered as CLA. - Speaker. As above.
- Speaker type. As above.
- Speaker stance on the event:
`approved`, `condemned`, `ambivalent`, `undecidable`. - Repressor. Person or group mentioned in the text, lemmatized. Often definite or indefinite, less often hypothetical (a hypothetical action does not yet make the actor hypothetical).
- Repressor type:
`secular`, `ecclesiastical`, `popular`(mob),`mixed`(more types),or`undecidable`.
See medhate-annotation repository for the formulation and coding scheme.
This list is in constant relation with medhate-annotation prompts, which can offer useful definitions. This page and medhate-annotation prompts should be kept mutually up-to-date.