About the rendition of records and similar structures in HTML. [] (Records, HTML, definition list, definition lists, DL, DD, DT, term definition, record, pair, tuple, relation, mapping, function, namespace, namespaces, functions), Article, page 721838
https://www.purl.org/stefan_ram/pub/records_in_html (permalink) is the canonical URI of this page.
Stefan Ram

Records in HTML

This article treats the question how to represent records  (such as records of a database) with the means of HTML.

Introduction

Records  (such as records of a database) can be regarded to be tuples or namespaces. Namespaces are mappings from a set of names.

How can these fundamental structures be expressed in HTML ?

A set  of entries can be rendered as an unordered list  (element type name »UL«).

Mappings, namespaces, records, and graphs all are relations. A relation is a set of pairs. But it is not obvious how to render a pair in HTML.

The solution suggested here is to use the element type »DL« for pairs.

Some Prerequisites

When natural-language text is combined with formal markup, a semi-formal document  is being created. The document constitutes a structure  made from several basic structural elements.

Formal and informal languages used in mathematics, programming and other areas hint what those basic structural elements are: Sets, pairs (or tuples), relations, mappings, and graphs. Graphs and mappings both are relations. A Relation is a set of pairs. So sets and pairs can be used to build the other structures.

A set  is an entity containing other entities (possibly 0, 1, or more) which are called “elements” of the set. The only information about a set is, whether something is contained in the set, there is no more information available, for example, there is no ordering of the elements.

A pair  is an entity containing two entities in a specific order, which are called “components” of the pair, so that it is always known, which entity is the first and which entity is the second component of the pair. A triple is like a pair, but with three components, and such an ordered list, generally is called a tuple, when one does not want to think of a specific number of components.

Definitions Lists for Pairs

In spite of its name and common believe, definitions lists are not intended to be used for definitions in a certain restricted sense of the word only. In formal languages, the meaning and intended use of a keyword of the language is not given by the meaning of name of the keyword in the English language, but by the specification of the formal language.

The wording of the HTML-4.01  specification for definition lists is: “list items consist of two parts: a term and a description.” (http://www.w3.org/TR/html401/struct/lists.html) Note that this wording uses “description” not “definition”. Nowhere is it said that the description has to be “the definition” of the term in a certain restricted sense. Any doubts about this are dispelled by an example given in the HTML-4.01  specification that clearly is not a list of definitions in the restricted sense some people perceive it.

An example from the HTML-4.01  specification
<DL>
<DT><STRONG>Lower cost</STRONG>
<DD>The new version of this product costs significantly less than the
previous one!
<DT><STRONG>Easier to use</STRONG>
<DD>We've changed the product so that it's much easier to use!
<DT><STRONG>Safe for kids</STRONG>
<DD>You can leave your kids alone in a room with this product and
they won't get hurt (not a guarantee).
</DL>

A list item of a definition list is the only means provided in HTML  to denote a pair of two texts, and the example shows that this is intended to be used for any relationship, not just a definition in a certain sense, so a definition list item clearly is the notation to be used to render pairs in HTML.

A Pair is  a Definition

We know from the specification of HTML 4.01 that a DD-element contains a description, not a definition. Still some people insist that it needs to give a definition. So this section shows that even if they were right, a definition list can be used for arbitrary pairs, because any pair is a definition in the strict mathematical sense of the word.

A definition list item can be used to give a mathematical function. For example the list "<dl><dt>0</dt><dd>1</dd></dl>" defines a function mapping the value 0 to the value 1. Thus, for the domain value  »0«, we  define the function value to be 1. In this sense, this list indeed gives a definition. »1« is the definition of the function value for the argument (or “term”) »0«.

It is not the definition of the “value 0” independently of any function, but such a definition never  occurs naturally, because usually all terms have multiple meanings (definitions) depending on the terminology (context). So, “the definition” always depends on the terminology, and a terminology can be chosen at will.

A definition of “record” in one terminology
<DL>
<DT>record
<DD>A vinyl disc on which sound is recorded and
may be replayed on a phonograph.
</DL>
A definition of “record” in another terminology
<DL>
<DT>record
<DD>The most extreme known value of some achievement,
particularly in competitive events.
</DL>
The identifier »record« might be defined as the number 5343 in a certain computer program
<DL>
<DT>record
<DD>5343
</DL>
The identifier »record« might be defined as the text »ejew5« in a certain computer program
<DL>
<DT>record
<DD>ejew5
</DL>

But a terminology is nothing else than a function mapping a term to a meaning, and one is free to define a terminology or function as one pleases. Insofar every pair or function is  a definition. By this, "<dl><dt>0</dt><dd>1</dd></dl>" or any other definition list is a definition in the strictest mathematical sense.

A relation  is similar to a function, but might define more than one value for each term.

Records in HTML

A record bears the structure of a namespace or a function, mapping certain field names to certain field values and thus can be rendered as a definition list in HTML.

The following example “defines” or “gives” a number of items (»5« and »12«) available for each kind (»BOLT« and »SCREW«, respectively) of item.

A record in plain text
BOLT
5 SCREW
12
A record in HTML
<DL>
<DT>BOLT
<DD>5
<DT>SCREW
<DD>12
</DL>

This resembles the following code in a programming language, which surely is deemed to be a list of definitions:

Definitions in a programming language
BOLT := 5;
SCREW := 12;

So this representation of a record in HTML is  is a list of definitions in the strict sense. (But it would even suffice, if it were a list of descriptions.) Thus it its semantics is in perfect agreement with the HTML -specification.

The following example shows the representation of a record about a person from a database.

A record in the database
Name: Sullivan
Phone: 5050011
A record in HTML
<DL>
<DT>Name
<DD>Sullivaan
<DT>Phone
<DD>5050011
</DL>

Strict Records

Unfortunately, HTML does not specify which DT element of a DL element belongs to which DD element. Therefore, to make sure that elements are related as intended, one can use at most as many subelements in a single DL element as are intended to be directly related. Using this strict conformance to HTML  semantics a record should be rendered as follows.

A record in the database
Name: Sullivan
Phone: 5050011
A record in HTML
<UL>
<LI>
<DL>
<DT>Name
<DD>Sullivan
</DL>
</LI>
<LI>
<DL>
<DT>Phone
<DD>5050011
</DL>
</LI>
</UL>

The above HTML  structure represents the record as a mapping, that is, a set of pairs. The set is being represented by the UL element for the set and one LI elements per element of the set, and each pair is being represented by a DL element, where the first component is being represented by a DT element, and the second component is being represented by a DD element.

A record as a set of pairs
<UL>                     <!-- start of set -->
<LI> <!-- start of element -->
<DL> <!-- start of pair -->
<DT>Name <!-- component -->
<DD>Sullivan <!-- component -->
</DL> <!-- end of pair -->
</LI> <!-- end of element -->
<LI> <!-- element -->
<DL> <!-- pair -->
<DT>Phone <!-- component -->
<DD>5050011 <!-- component -->
</DL> <!-- end of pair -->
</LI> <!-- end of element -->
</UL> <!-- end of set -->

A whole database table then is a set of such records.

About this page, Impressum  |   Form for messages to the publisher regarding this page  |   "ram@zedat.fu-berlin.de" (without the quotation marks) is the email-address of Stefan Ram.   |   A link to the start page of Stefan Ram appears at the top of this page behind the text "Stefan Ram".)  |   Copyright 1998-2008 Stefan Ram, Berlin. All rights reserved. This page is a publication by Stefan Ram. Stefan Ram Berlin slrprd slrprd stefanramberlin spellched stefanram721838 stefan_ram:721838 slrprd, slrprdqxx, slrprddoc, slrprd721838, slrprddef721838, PbclevtugFgrsnaEnz

Der Urheber dieses Textes ist Stefan Ram. Alle Rechte sind vorbehalten.
https://www.purl.org/stefan_ram/pub/records_in_html