ZedAI Primer: Adding Semantic Inflections

From zedwiki

Jump to: navigation, search

Contents

  1. 3.1. A more meaningful example
  2. 3.2. The role attribute
  3. 3.3. Role vocabularies
  4. 3.4. Using role in Z39.98-AI documents
  5. 3.5. Custom role vocabularies

3.1 A more meaningful example

Let us look at an example which provides more detailed information about the front parts of the book:

Example 3.1 - A document with detailed frontmatter

<document xmlns="http://www.daisy.org/ns/z3998/authoring/" xml:lang="en">
  <head>
    <meta rel="z3998:profile" resource="http://www.daisy.org/z3998/2012/auth/profiles/book/1.0/">
        <meta property="z3998:name" content="book"/>
        <meta property="z3998:version" content="1.0"/>
    </meta>
    <meta rel="z3998:rdfa-context" resource="http://www.daisy.org/z3998/2012/vocab/context/default/"/>
    <meta property="dc:identifier" content="daisy-z2011-role-001" />
    <meta property="dc:publisher" content="DAISY Consortium" />
    <meta property="dc:date" content="2005-07-27T18:50:05Z" />
  </head>
  <body>
    <frontmatter>
      <section role="titlepage">
        <object xml:id="imgfpiece" role="frontispiece" src="fpiece.jpg">
          A picture of Sir Henry Jowls with his arm around the author
        </object>
        <caption ref="imgfpiece">Sir Henry Jowls with the author</caption>
        <h property="dc:title">
          <hpart role="title">A true adventurer:</hpart>
          <hpart role="subtitle">The story of Sir Henry Jowls</hpart>
        </h>
        <p>By his nephew, <name property="dc:creator">Jack Flanders</name></p>
      </section>
    </frontmatter>
    <bodymatter>
      <section role="chapter">
        <h>Chapter 1</h>
        <p>The story begins at Inverness ...</p>
      </section>
    </bodymatter>
  </body>
</document>

This document identifies the title page as a special structure, and provides even more detail within that, identifying an image that acts as a frontispiece, for example.

3.2 The role attribute

The Z39.98-AI book profile provides a rich set of elements to use when representing book structures, but one may encounter cases where more subtle refinements of these structures are required. To support this, Z39.98-AI profiles, in addition to elements, can reference vocabularies of semantic roles that elements may play within the structure of the document. These roles are identified using the role attribute, which is available on every element in every Z39.98-AI profile. In our example, "title page" is one such role that is being played by a section element, and is identified by the role attribute value "titlepage". The use of the role attribute in this manner thus allows for a finer-grained differentiation of structures within the set of elements in the schema.

3.3 Role vocabularies

For the role attribute to be at all useful, its values must be generally understood by authors and processing agents, which suggests standardization. To this end, profiles may define specific role vocabularies that extend their markup model to provide more detail about the semantics of the markup. Vocabularies are expressed using the Resource Description Framework (RDF). RDF is the technology behind the "semantic web" and is a means of expressing information about elements and the data they contain. In the Z39.98-AI Framework, RDF is used to define semantic properties, describe their meaning, and to relate them to other constructs.

Role vocabularies defined by Z39.98 are typically expressed via RDFa, which uses special attributes to express RDF within the well-known structure of XHTML. Here, for example, is the definition of the "title page" role in the Z39.98-2012 core vocabulary:

Example 3.2 - RDFa representation of "title page" role

<div id="frontmatter-properties" about="#frontmatter-properties" typeof="rdf:Bag">
    <h2>Frontmatter</h2>
    <dl about="#frontmatter-properties" rev="rdfs:member">
        <dt id="titlepage" about="#titlepage" typeof="rdf:Property">titlepage</dt>
        <dd about="#titlepage" property="rdfs:comment" datatype="xsd:string">
            Analogous to a print book's title page.
        </dd>
    </dl>
</div>

The syntax above says that the element whose id is titlepage is also an RDF property. This means it can be used as a role value in a document and traced back to the definition given here. There is also a human-readable comment which says what the meaning of titlepage is.

Each profile may define a default role vocabulary, which in that case is referenced in the profile's resource directory. However, Z39.98-AI documents are not limited to using the role vocabulary referenced by the resource directory, nor to use only vocabularies defined within the Z39.98-AI Framework. In our example document above, the Dublin Core roles of "title" and "creator" are examples of non-Z39.98-AI roles.

3.4 Using role in Z39.98-AI documents

As stated previously, the role value titlepage is defined in the Z39.98-2012 core vocabulary. This example shows how to use this role value in a document to identify a section as a "title page".

Example 3.3 - Section with titlepage role

<section role="titlepage">
  …
</section>

Any element in a Z39.98-AI document can reference a role via the role attribute. The value of role is a CURIE (short for "Compact URI"), as defined in CURIE Syntax 1.0. Simply described, CURIEs consist of a prefix and a local part that creates a unique identifier (URI) in a manner similar to the way that qualified names (QNames) are created using XML namespaces. In our example document, we find CURIEs such as book:frontispiece, where book: is the prefix and frontispiece is the local part.

You have already noted that the role attribute value in the example above does not have a prefix (role="titlepage" for example). This is because a Z39.98-AI profile via its resource directory can define one vocabulary to be the default. Roles from the default vocabulary do not need prefixes.

All CURIEs belonging to other vocabularies than the default one however, need to be prefixed, and the association between the prefix and a vocabulary URI must be declared in the document. In the example document above, the initial context document declares the association between the prefix dc and the URI http://purl.org/dc/elements/1.1/ (which is an RDF vocabulary URI), and the same mechanism is used to associate the z3998 prefix with the vocabulary URI corresponding to the Z39.98-2012 Instance Metadata Vocabulary.

3.5 Custom role vocabularies

The role-defining mechanism of the Z39.98-AI Framework is inherently extensible: the role attribute can reference any role vocabulary, not just the ones defined by the Z39.98-2012 specification or the various profiles and features. If a particular information resource or collection of resources require highly specialized semantic inflections, the document author can create a role vocabulary in RDFa that is tailored for that specific purpose. Conforming Z39.98-AI documents can then reference this custom vocabulary. Processing agents can discover the RDFa documents to find further information about the roles used and respond appropriately.


Primer Table of Contents

  1. Z39.98-AI_Profiles
  2. Modules and Namespaces
  3. Adding Semantic Inflections
  4. Features
  5. Metadata
Personal tools