Ontologies
If XML lets you create your own tags, how do you know
what tags to create?
The answer can be found in the
idea of an ontology, which can be defined as
"
a specification of a conceptualization". We
collect and organize information based on sets of
related concepts. A structure of variables (labelled
with tags) is a specification that tries to capture
those concepts both in the variables themselves and
in the structure in which they are organized.
As an example, consider the following use of a
heirarchical (tree) data structure to
represent a 3D graphical image.
A 3D Graphical Object
Suppose that a group of computer graphics experts convened
and decided that all 3D graphic scenes could, and should,
be represented by a hierarchical tree structure. So they
create a generic tree structure which defines the syntax
(the connections) and the semantics (the types and ranges
of allowable values) of the tree.
|
Generic Tree Structure
|
<scene>
|
|
o---------------------o--------------------------o
| | |
| | |
<object> <object> . . . <object>
... | ...
|
o----------------------o---------------------o
| | . . . |
| | |
<subobj> <subobj> <subobj>
... | ...
|-<shape>
|
|-<size>
|
|-<color>
|
This serves as a standard template for all 3D graphics
representations on the WWW. Now suppose that I wish to create
a particular 3D scene with, say, a house and a tree. Then I
would create a structure like this:
|
A 3D Scene With House And Tree
|
<scene>
|
|
o------------------------o
| |
| |
<object=House/> <object=Tree/>
| |
| |
o----------------o---------------o |
| | | |
| | | |
<subobj=wndw/> <subobj=door/> <subobj=door/> |
| | | |
| | | |
|-<shape=rect/> |-<shape=rect/> |-<shape=rect/> |
| | | |
|-<size=2x3/> |-<size=8x3/> |-<size=8x3/> |
| | | |
|-<color=trans/> |-<color=blue/> |-<color=gray/> |
|
|
o--------------------o
| |
| |
<subobj=trunk/> <subobj=canopy/>
| |
|-<shape=cylind/> |-<shape=ball/>
| |
|-<size=3x40/> |-<size=80/>
| |
|-<color=brown/> |-<color=green/>
|
My house and tree can be considered an
instance of the generic 3D graphic structure
designed by the expert 3D committee. I can test my instance
by validating it against the syntax and semantics of the
generic 3D structure, and if it validates successfully, I
know that my scene can be displayed by the standard rendering
engines created by the same committee.
Now the final scene can be displayed on the WWW using
either HTML or XML, but there is a very major difference.
In HTML, you merely get the final rendered scene, but with
XML you get not only the final scene, but the entire
hierarchical structure that created it. As a result, you
can operate on this structure and modify, add, or delete
branches. Thus you can change the color of the canopy of
the tree (the tree in the picture and not the XML tree)
from green to gold, can change the size of the window, add
more windows, etc.
In more abstract terms we can say that XML allows
individuals (or more usually, large user communities) to
develop an information structure that is appropriate for
their particular discipline. This structure is in the
strict form of a hierarchical tree, and the user community
determines the syntax of the tree and its semantics (what
type of values are allowed, what range or number of values,
etc).
Individuals who use this structure create
instances of it that are populated with
the specific nodes and values appropriate to their needs.
The XML processor assures that any instance conforms both
to the syntactical and semantic rules designed by the user
community. Thus all members of this community posses a
universal means of expressing and processing the
information that is germane to their field.
Furthermore. although each discipline would develop a
different information structure, that is, a different DTD,
all such structures would have important properties in
common, so that many concepts, and even some specific
script programs, would apply to any field, be it physics,
economics, entertainment, medicine, shopping, etc.
We can translate the above into XML parlance as follows:
-
The generic tree structure created by the committee is
the Document Type Definition (DTD) or
XML Schema that defines information
structure
-
The "House and Tree" is a particular XML file which can
be validated against the DTD
-
The branches of the tree are known as elements or
elementNodes and have childNodes and parentNodes
And the specific XML data structure along with its DTD
looks like this:
|
3D DTD
|
<?xml version="1.0" ?>
<!-- Simple picture of house and tree -->
<!DOCTYPE scene [
<!ELEMENT scene (object+)>
<!ATTLIST object Id (House | Tree) "House">
<!ELEMENT object (subobj+)>
<!ATTLIST subobj id (wndw|door|trunk|canopy) "door">
<!ELEMENT subobj (shape, size, color)>
<!ELEMENT shape (#PCDATA)>
<!ELEMENT size (#PCDATA)>
<!ELEMENT color (#PCDATA)>
]>
|
|
3D XML
|
<scene>
<object Id="House">
<subobj id="wndw">
<shape>rect</shape>
<size>2x3</size>
<color>trans</color>
</subobj>
<subobj id="door">
<shape>rect</shape>
<size>8x3</size>
<color>blue</color>
</subobj>
<subobj id="door">
<shape>rect</shape>
<size>8x3</size>
<color>gray</color>
</subobj>
</object>
<object Id="Tree">
<subobj id="trunk">
<shape>cylind</shape>
<size>3x40</size>
<color>brown</color>
</subobj>
<subobj id="canopy">
<shape>ball</shape>
<size>80</size>
<color>green</color>
</subobj>
</object>
</scene>
|
The illustration of 3D graphics by way of a tree structure
is not just an academic example: real 3D graphic systems
have long been defined in terms of tree structures, even
before XML was conceived. Here is an actual example of a 3D
graphic being designed in a VRML program.
|
VRML Example Of A 3D Graphic
|
|
Resources