Skip to content

Persons

Christian Lück edited this page Jan 5, 2022 · 4 revisions

Persons

Default setting

If there is a <prefixDef> in the header, which defines a URI scheme with the prefix (protocol) psn, pers, prs, prsn or person, an author mode action icon for selecting a person from a personography is activated. For example, put this in the header:

...
<encodingDesc>
	...
	<listPrefixDef>
		<prefixDef
			matchPattern="([a-zA-Z0-9_-]+)"
			replacementPattern="persons.xml#$1"
			ident="psn"/>
	</listPrefixDef>
	...
</encodingDesc>

If the linked file persons.xml is present, then all the persones found in <listPerson> elements are presented in a selection dialog. If the caret (pointer) is on a <persName> or <person> element, the @ref attribute is updated by your selection (and deleted if you choose the empty name). If the caret is not in such a context, an empty fragment or a surrounding fragment like this is created:

<persName ref="psn:BadraddinbalAttar">Badraddīn</persName>

In oXygen's text mode, suggestions for the value of @ref of <persName> are offered.

Configuration

The source of suggestions and structure of the value of the @ref are completely configurable. It's not required to use <prefixDef> at all.

The only thing needed is to configure a plugin to provide a list of names and keys for the editing context persName/@ref, i.e. the value of the @ref attribute of an <persName> element. Here's the default config:

<plugins>
        <plugin>
            <class>de.wwu.scdh.teilsp.extensions.LabelledEntriesFromXMLByPrefixDef</class>
            <type>de.wwu.scdh.teilsp.services.extensions.ILabelledEntriesProvider</type>
            <configurations>
                <configuration>
                    <conditions>
                        <condition domain="context">self::*:persName and //*:teiHeader//*:prefixDef[matches(@ident, '^(psn|prs|pers|person)')]</condition>
                        <condition domain="priority">10</condition>
                        <condition domain="nodeType">attributeValue</condition>
                        <condition domain="nodeName">ref</condition>
                    </conditions>
                    <arguments>
                        <argument name="namespaces">t:http://www.tei-c.org/ns/1.0 xml:http://www.w3.org/XML/1998/namespace</argument>
                        <argument name="selection">//t:text/descendant::t:person[@xml:id]</argument>
                        <argument name="key">@xml:id</argument>
                        <argument name="label">normalize-space(concat(t:persName, ', *', t:birth))</argument>
                        <argument name="prefixDef">//t:teiHeader//t:prefixDef[matches(@ident, '(psn|prs|pers)')]</argument>
                        <argument name="prefixDefRef">tokenize(@replacementPattern, '#')[1]</argument>
                    </arguments>
                </configuration>
				...
			</configurations>
		</plugin>
		...
</plugins>

The editing context is given in the conditions section. See Configuration.

The argument section defines, how the external source is accessed. They are explained in the plugin specification.

Local norm data

I strongly encourage providing a personography in a local file as a broker to global norm data on the WWW, instead of linking to triple stores on the WWW directly from the TEI documents. See this discussion on the TEI mailing list on the subject. I also encourage defining URI schemes via <prefixDef>, instead of linking to external elements by IDs directly. The prefix definition serves as an abstraction layer, makes everything explicit, and thus enables us to write generic tools and actions like icon.

Clone this wiki locally