Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: projects / idan / manual / 04-phs-and-refs / 03-named-ref /

02-plref.mdwn

[[!meta title=“4.3.2 | Prefix-Label References”]]

Prefix-Label References

Prefix-label references, or PLrefs, are part of Idan’s human language interface. This interface provides a way to tag resources with names, and group them into logical units. The details are in another section, and this section only deals briefly with the PLrefs themselves.

Concept

The human interface system assigns labels to resources, and arranges them in namespaces. A namespace may contain sub-namespaces, thus forming a hierarchy of namespaces. It’s technically possible for a namespace to have more than one parent namespace, but the hierarchy is generally indeed a tree, with labels being the leaves.

A PLref is a sequence of alphanumeric names, representing a path in the tree, starting at the top, and ending with a leaf. The PLref refers to the resource to which the leaf label belongs.

Resolution

The sequence consists of at least 2 names. The first name in the sequence is a namespace prefix. The other names are labels. The algorithm for resolving a PLref (i.e. determining to which resource Uid it refers) can be described in two parts, resolvePair and resolveRef, explained below. However the description below isn’t accurate because it doesn’t take languages into account, and several other elements. A more accurate algorithm is presented in the section about the namespace-label system.

First, the resolvePair algorithm:

  1. Suppose we have a pair (u, l) where u is a Uid and l is a label.
  2. If u is a namespace which contains a label l, and l is the label of a resource z, then return z.
  3. If u isn’t a namespace or doesn’t contain l, resolution has failed.

Then, the resolveRef algorithm:

  1. Suppose we have a sequence of names (a_1, a_2, ... a_n) where a >= 2.
  2. Find a namespace resource u whose prefix is a_1. If failed, the resolution has failed.
  3. Apply resolvePair to (u, a_2). If failed, resolution has failed. Otherwise, denote the result with z.
  4. If we already used all the n items of a, return z.
  5. Pick the next unused a_i and apply resolvePair to (z, a_i). If failed, resolution has failed. Otherwise, the result is the new value of z.
  6. Jump tp step 4.

Here is a more intuitive description. The sequence consists of a single prefix, followed by a sequence of one or more labels. After resolving the prefix, each resoltion step finds the label in a namespace and picks the resource it belongs to, which is itself a namespace, to which the next label is matched, and so on. See below for examples.

Syntax

PLrefs can be used as subjects, predicates and objects - not identifiers. > PLref parts are separated by colons (:). For example, suppose there is a namespace containing definitions related to people, and we assign it a prefix ppl. It contains a label Person which refers to the Person class, the class of all people. Then a PLref ppl:Person can be used to refer to that class:

<%> smaoin:is_a ppl:Person

In this example there is also a namespace smaoin, and a property with label is_a, which is a member of it. PLrefs with more parts are possible too, e.g. animals:mammals:Human.

When the default prefix is used in a PLref, it may be omitted, in which case the PLref begins with a colon. For example :mammals:Human.

Note that this syntax doesn’t cover the case of referring to a declared namespace itself. This is covered in the next section.

[See repo JSON]