Next: , Previous: , Up: Annotation schema   [Contents]


7.3.2 Defining a schema using Emacs lisp

You can use Emacs lisp, a LISP dialect, to define an annotation schema. We recommend Generating an annotation schema from OWL, but even then, you should have read about definition in lisp, because that is, what standoff mode effectively reads. All of the code below must go into your init file (or a file loaded by the init file).

User Option: standoff-markup-types-allowed
User Option: standoff-relations-allowed
User Option: standoff-literal-keys-allowed

These user options each take a list of allowed types, predicates of attribute names. Default is the empty list '(). Here is an example definition:

(setq standoff-markup-types-allowed '(
  "http://arb.fernuni-hagen.de/owl/beispiel#Beispiel"
  "http://arb.fernuni-hagen.de/owl/beispiel#Marker"
  "http://xmlns.com/foaf/0.1/Person"
  ))

(setq standoff-relations-allowed '(
  (("http://arb.fernuni-hagen.de/owl/beispiel#Beispiel" "http://arb.fernuni-hagen.de/owl/beispiel#Person" "http://arb.fernuni-hagen.de/owl/beispiel#Werk" ) "http://arb.fernuni-hagen.de/owl/beispiel#hatMarker" ("http://arb.fernuni-hagen.de/owl/beispiel#Marker" ))
))

(setq standoff-literal-keys-allowed '(
  (("http://arb.fernuni-hagen.de/owl/beispiel#Beispiel" "http://arb.fernuni-hagen.de/owl/beispiel#Kontext" "http://arb.fernuni-hagen.de/owl/beispiel#Konzept" ) "http://arb.fernuni-hagen.de/owl/beispiel#paraphrase" )
  ))

Instead of displaying these long IRIs on the UI, you can define labels.

User Option: standoff-markup-types-labels
User Option: standoff-relations-labels
User Option: standoff-literal-keys-labels

See the example below.

(setq standoff-markup-labels '(
  ("http://arb.fernuni-hagen.de/owl/beispiel#Beispiel" . "Beispiel")
  ("http://xmlns.com/foaf/0.1/Person" . "Person")
  ))

(setq standoff-predicate-labels '(
  ("http://arb.fernuni-hagen.de/owl/beispiel#markiert" . "markiert")
)

(setq standoff-literal-key-labels '(
  ("http://arb.fernuni-hagen.de/owl/beispiel#paraphrase" . "Paraphrase")
  ))

Customizing the face of annotated text ranges depending on markup type makes a usable a tagger:

User Option: standoff-markup-overlays
User Option: standoff-markup-overlays-front
User Option: standoff-markup-overlays-after

Use these user options to set font faces and text properties. Example:

(setq standoff-markup-overlays '(
  ("http://arb.fernuni-hagen.de/owl/beispiel#Beispiel" ('face 'standoff-arb-beispiel))
      standoff-markup-overlays-front '(
  ("http://arb.fernuni-hagen.de/owl/beispiel#Beispiel" ('face 'standoff-arb-beispiel))
      standoff-markup-overlays-after '(
  ("http://arb.fernuni-hagen.de/owl/beispiel#Beispiel" ('face 'standoff-arb-beispiel))
  ))

Note that the face names must be defined to:

    (defface standoff-arb-beispiel
      '((((type x))
	 (:family
	  "misc-fixed"
	  :foreground
	  "dark red"
	  :weight
	  normal
	  :slant
	  normal))
	(t
	 (:foreground
	  "dark red"
	  :weight
	  normal
	  :slant
	  normal)))
      "Face used \"beispiel\" markup type."
      :group 'standoff-faces)

Next: , Previous: , Up: Annotation schema   [Contents]