Previous: Defining a schema using Emacs lisp, Up: Annotation schema [Contents]
You can use the expressiveness of the web ontology language (OWL) to define your annotation schema. standoff mode comes with some XSL style sheets for transforming OWL/XML into a schema definition in Emacs lisp which can be loaded by standoff mode.
The main idea is, to use
owl:Classto define the types of markup elements
owl:ObjectPropertyto define the predicates for relations
owl:DatatypePropertyto define the attributes for markup elements
rdfs:labelto define labels on all such definitions. These labels are displayed in
the UI of standoff mode instead of the IRIs. You can also
internationalize your OWL labels using the xml:lang
attribute. The transformation will pick the label in the right language,
when you pass a parameter to the style sheet processor.
There are three style sheets and a file with a few OWL definitions:
As expressed in the name, this style sheet mistakes the semantics of the
OWL, namely in the context of relations. It uses rdfs:domain and
rdfs:range to restrict a predicate to a combination of
rdfs:domain as markup type of the object and rdfs:range as
the markup type of the subject. Strictly speaking, this does not make
sense, but is rather redundant: These constructs are for reasoning, not
for restriction. But it might serve you well.
This style sheet introduces annotation properties to restrict predicates of relations to certain combinations of markup types of subject and object while following the rules of OWL. These annotations are defined in standoff.owl.
http://github.com/lueck/standoff-mode/owl#allowedSubject can be
used to define allowed subject type for a relation predicate.
http://github.com/lueck/standoff-mode/owl#allowedObject can be
used to define allowed object type for a relation predicate.
http://github.com/lueck/standoff-mode/owl#face is also defined,
and lets you define a highlighting face for a markup type.
This generates a TeX file from OWL which can be used to generate a PDF of your annotation schema. The OWL annotation properties defined in standoff.owl are evaluated, so that the restrictions expressed with them go into the document.
See the http://github.com/lueck/standoff-mode/arb/ for an example schema definition using OWL and standoff.owl: arb.owl defines an schema for annotating examples in scholar texts about aesthetics in the 18th century Germany. Generate a Emacs lisp schema with german labels e.g. by running this command in a terminal:
xsltproc --output standoff-arb-schema.el \ --param config-file \"standoff-arb-schema.el\" \ --param lang \"de\" \ --param provide \"true\" \ owl2config.xsl \ arb.owl
Put the following line into your Emacs init file, in order to load the schema in generated standoff-arb-schema.el:
;; set how restrictive markup types and predicates and attribute
;; keys are handled depending on presence of annotation schema
(if (featurep 'standoff-arb-schema)
(setq standoff-markup-type-require-match t
standoff-predicate-require-match t
standoff-literal-key-require-match t)
(setq standoff-markup-type-require-match 'confirm
standoff-predicate-require-match 'confirm
standoff-literal-key-require-match 'confirm))
Previous: Defining a schema using Emacs lisp, Up: Annotation schema [Contents]