Home

MS Base

  • prefix: ms:
  • schema: b:

Categories (Data):

Categories (Governance):

definitions:

 
 

Schema element "b:shadow"

Map the name of one Unit to something else, or all units in a collection to units in a different collection.

Definitions

<element name="shadow" type="b:Shadow" />

<complexType name="Shadow">
  <sequence />
  <attribute name="map" type="b:Expression" default="unit.id" />
  <attributeGroup ref="b:selector" />
</complexType>

Description

There are a few situations where a Unit needs to refer to

  • some other Unit (in different Collection), or
  • a Fragment in another Unit (in a different Collection)

Instead of specifying this relation for each Unit separately, it can also be written genericly in the rules of Collection. In that case, the shadow parameter maps Unit facts (usually simple the unit.id) to a (relative) Unit address to indicate an end-point. Each of the Units casts a shadow over data on the other spot.

Some examples for map expressions:

  • unit.id (default), maps unit names from one collection one-on-one to some names in the other collection
  • unit.id ~ ".doc" will map product to product.doc, which can reside in this or a different collection
  • unit.id =~ "^(\w+)\.(.*)" -> $1 ~ '-src.zip' will map windows11.pl123 into unit-id windows11-src.zip
  • unit.type like "*.jpg" -> 'jpegs.doc' only defines the relation for jpeg images. Other types return "undefined" here. Often, using when is easier to read.

Examples

refer to documentation organized by language

In the following example, the Collection explains that all Units have documentation organized per language in a separate Collection which is dedicated to that task.

The Application which wants to present the documentation, will need to search through the content of the destination Unit by itself. See msc:manual. The unit.id can appear more than once inside one manual, hence cannot be used as fragment indicator.

<has unitref="Docs" type="ms:Type/Collection" role="ms:Role/Documentation" >
  <shadow map="client.lang" />
</has>
"has" : {
  "unitref" : "Docs",
  "type" : "ms:Type/Collection",
  "role" : "ms:Role/Documentation",
  "shadow" : {
     "map" : "client.lang"
  }
}

The expression client.lang produces the abbreviated name for the language constant, for instance nl-NL. In search of the optimal translation, the client application MAY need to attempt different values for the language.

This relation is declared in the Collection Rules, hence apply to all Units which are in that Collection (this can be restricted using the selector attributes when or unless). For any Unit (which do not provide documentation itself), the Rules explain to the client application to look into collection "Docs" (relative to this Collection) in the Unit with a name equivalent to the clients language.

When my client.lang is nl-NL and my Collection is app:picts, then Unit abc.jpg is redirecting to Unit app:picts/nl-NL


mark@overmeer.net      Web-pages generated on 2023-12-19