    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: 4DML Revisited</title>
        <link>https://members.accu.org/index.php/articles/1194</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">Programming Topics + CVu Journal Vol 14, #5 - Oct 2002</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c65/">Programming</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c112/">145</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/c65-112/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/articles/c65+112/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;4DML Revisited</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 October 2002 13:15:54 +01:00 or Thu, 03 October 2002 13:15:54 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e20" id="d0e20"></a></h2>
</div>
<p>I'm not happy with the way I explained 4DML in C Vu 14.4 p26,
particularly the way the &quot;depth'' dimension seemed to be grafted on
to the design almost arbitrarily. My description followed the
historical order of the design process, but it would perhaps be
clearer if we ignored this and took another approach.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e24" id="d0e24"></a>Attributes as
Co-ordinates</h2>
</div>
<p>If you want to represent a sparse N-dimensional matrix of
objects (i.e. an N-dimensional space that contains objects), then
each object must somehow be associated with N numerical values, to
position it on each of the N dimensions. You can think of these N
values as extra attributes that the object has. You can also do the
reverse: Take a collection of objects that all possess certain
numerical attributes, and treat these attributes as dimensions in
N-space; an object's co-ordinates are given by its values of the
said attributes.</p>
<p>It is, of course, possible to do this with attributes that are
not numerical, so long as they are sortable, or at least comparable
so that two objects that are equal in some attribute can be put at
the same co-ordinate on the axis (dimension) that corresponds with
that attribute. However, 4DML only uses numerical values, for
reasons I'll come back to later.</p>
<p>More generally, objects can have differing numbers of
attributes; they are not limited to having a fixed number of them.
If we imagine a non- Euclidean space in which objects can have
positions on some dimensions but not others, then this space can
represent a general collection of objects with arbitrary
(numerical) attributes. Working with a non-Euclidean space does
make the geometry slightly more interesting, but it turns out that
a surprising number of operations are conceptually unchanged.</p>
<p>We now have a way of taking a near-arbitrary collection of
objects, arranging them (in N-space) by their attributes, and doing
geometric operations on this arrangement. This does not add any
functionality, but a lot of people find geometry easier to think
about than algebra, so expressing a problem in geometric terms can
help.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e35" id="d0e35"></a>Trees as
Attributes</h2>
</div>
<p>The next thing to note is that an object's position in a tree
can be represented by a list of attributes. For example, one
attribute can indicate which one of the top-level branches the
object is to be found under; another attribute can represent which
one of the second-level branches to go down; and so on. Since these
attributes can also correspond to positions in the non-Euclidean
N-space, this shows that the N-space has all the functionality of a
tree.</p>
<p>This is significant, because matrix-like data (such as a musical
score) is often marshallised (that's &quot;serialized'' in Java-speak)
into a hierarchical (tree- like) representation such as XML, and
then programmers try to work with it as a tree (by using re-writing
systems and so forth) without being free to perform as many
geometric operations as they could have done on the geometric
representation. However, the above method, of representing the tree
as attributes and attributes as geometry, provides a `natural' way
of converting between the two representations. This can make
serialized matrix-like data considerably easier to process (and to
transform into completely different serializations), and it can
also manifest benefits when working with data that would not
normally be thought of as matrix-like. As a bonus, it is possible
to represent several independent hierarchies over the same data
just by merging their attribute lists (so long as there are no
naming ambiguities).</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e42" id="d0e42"></a>Labels for
Co-ordinates</h2>
</div>
<p>The next thing to note is that an object's position in a tree
can be represented Now, the problem is that having attributes such
as &quot;which top-level branch to go down'', &quot;which second-level branch
to go down'' and so on is not sufficient if those branches have
names as well as numbers and we want to be able to set constraints
on both. It is, of course, possible to store these names in extra
attributes, or additional objects, or in some other manner, and all
kinds of complex constraints could be designed into the system to
make sure that they are used sensibly, but that might make the
design too complicated. I preferred to support attributes with
pairs of values, that is, each attribute can have both a named
value and a numerical value. This can be regarded as attaching a
label to each one of an object's co-ordinates in the N-space. One
obvious way of extending this is to support more than one label on
each co-ordinate, but people who need that functionality perhaps
really should be thinking about using additional attributes
instead.</p>
<p>4DML (four-dimensional markup language) is so-called because the
prototype represents its non-Euclidean N-space as a set of
four-dimensional points; each one of those points gives a reference
to the object that it is helping to describe, the attribute that it
is setting, the value, and the label. For historical reasons the
prototype calls these &quot;scope'', &quot;depth'', &quot;position'' and &quot;name''
respectively, and lists them in reverse order. 4DML can represent
trees and matrices, and blurs the distinction between the two; it
can also be hacked to represent arbitrary relationships between
objects (objects can be regarded as related if they share a common
value of a certain attribute, i.e. they are at the same position on
a certain dimension).</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e49" id="d0e49"></a>Not a `Real'
Database</h2>
</div>
<p>Earlier, I mentioned that 4DML only treats numerical values as
co- ordinates, although it does support labels. It is important to
realise that 4DML is somewhat different from a conventional
database. In most databases, an object can have attributes of
various types and the attributes store the data; for example, a
record about a book might have as an attribute (or `field') the
author's name(s). It might then be possible to sort the database by
the &quot;author names'' attribute. If you wanted to do the equivalent
in 4DML, you would have to give each author a position number
(effectively pre-sorting them), and then arrange for the name and
any other information, including all of the books that s/he wrote,
to be stored at that position on an &quot;author'' axis of the N-space.
The point is that there is no information conveyed in the position
(possibly excepting positioning information); it only serves to
categorise and structure the information that is stored in the
objects themselves (usually strings) which are opaque to 4DML's
organisation. It's like using a database system in which everything
is indexed by unique identifier. This keeps the design simpler and
also helps prevent certain kinds of mistake (such as assuming that
people's names are unique).</p>
<p>Although 4DML can be used for database-like applications, its
main purpose is to represent documents in various notations.
Documents are essentially collections of symbols with one or more
reading orders (that is, sequences in which the symbols can be
arranged); any markup over the symbols should reflect the arranging
and interpretation of the symbols in the document, not the symbols
themselves, and by extension, any values of any attributes
associated with such markup should also reflect only this. It is
possible to hack things differently, but I'd call that an improper
use of the design. Perhaps I was wrong to use the analogy of
objects and attributes to explain 4DML (it wasn't the way I
designed it); it might make things easier to understand, but only
if taken in the proper context.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
