<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1065909969;
        mso-list-type:hybrid;
        mso-list-template-ids:1074410932 134807567 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Let’s say, for the sake of discussion and greater understanding, that you wanted to build an Object Model for X3D from scratch. Where would you start?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In the first instance let’s confine our work to the requirements of the abstract standard ISO/IEC 19775-1:2013. We’ll add in the requirements from the SAI in ISO/IEC 19775-2:2015 in later steps.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Let’s start with the abstract standard ISO/IEC 19775-1:2013, clause 4.4.2.1 Overview, which is the first subclause in clause 4.4.2 Object model.<o:p></o:p></p><p class=MsoNormal>Reference: <a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#ObjectmodelOverview">http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#ObjectmodelOverview</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The opening words read: “The X3D system is made up of abstract individual entities called <i>objects</i>.” What, in X3D, constitutes an object? The answer is in paragraph two, which introduces two types of objects. These are “fields”, derived from  the X3DField object, and “nodes”, derived from the X3DNode object. Furthermore, nodes contain fields.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So, since nodes contain fields, let’s start with fields. What characteristics are common to all fields? Let’s look at the fifth paragraph. It states “Each object has the following common characteristics:”, and lists two characteristics, namely “A type name”, and “An implementation”. But, wait a minute, the second sentence of the opening paragraph states “This part of ISO/IEC 19775 defines a functional specification for each object type but does not dictate implementation.”.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b>Problem 1</b>: The use of the term implementation is confusing. According to that second sentence each object has “A functional specification”. That should be list item b.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b>Problem 2</b>: There is a further problem with the use of the term “implementation”. The seventh paragraph states “Node implementations can come from two sources, built-in nodes and prototypes.”. “Implementations” is the wrong word. What is really meant is “instantiations”, which is a term that is already defined at 3.1.39 in the standard.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Solely considering fields, what are the other characteristics common to all fields? Clause 4.4.2.2 Field semantics has some. The first one it describes is the type of access. The second one, which is not explicitly stated, but assumed, is that it has a value (or values, depending on the type). The third one, again not explicitly stated, is that it has a name.<o:p></o:p></p><p class=MsoNormal>Reference: <a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#FieldSemantics">http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#FieldSemantics</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So, from the perspective of an object model, we have identified four characteristics that are common to all fields, namely:<o:p></o:p></p><ol style='margin-top:0cm' start=1 type=1><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'>Type<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'>Access type<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'>Value(s)<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'>Name<o:p></o:p></li></ol><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>However, the “value” characteristic varies with the field type, so we’ll leave that to each individual field type. So, our object model for the X3DField class, from which all fields are defined is:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>X3DField {<o:p></o:p></p><p class=MsoNormal>    type;<o:p></o:p></p><p class=MsoNormal>    accessType;<o:p></o:p></p><p class=MsoNormal>    name;<o:p></o:p></p><p class=MsoNormal>};<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>However, we also need to indicate the data type of each of these characteristics, i.e. what data type is “type”? And so on. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Starting with “accessType”, we’ll define an enumeration named AccessType, that has the four values defined in 4.4.2.2, and we’ll use the term “enum” to represent an enumeration. The definition then becomes:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>enum AccessType {<o:p></o:p></p><p class=MsoNormal>    initializeOnly,<o:p></o:p></p><p class=MsoNormal>    inputOnly,<o:p></o:p></p><p class=MsoNormal>    outputOnly,<o:p></o:p></p><p class=MsoNormal>    inputOutput<o:p></o:p></p><p class=MsoNormal>};<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>[<o:p></o:p></p><p class=MsoNormal><i>For reference, we’ll also define a grammar for an enumeration within the object model as follows:<o:p></o:p></i></p><p class=MsoNormal><i>enumeration -> <b>enum</b> <name> <b>{</b> enumerationValues <b>}</b> <b>;</b> <o:p></o:p></i></p><p class=MsoNormal><i>enumerationValues -> <enumValue> | <enumValue> <b>,</b> enumerationValues<o:p></o:p></i></p><p class=MsoNormal>]<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Similar to “accessType” we can define an enumeration for “type”, as follows, taking the types from clause 5 Field type reference:<o:p></o:p></p><p class=MsoNormal>Reference: <a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fieldsDef.html">http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fieldsDef.html</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>enum Type {<o:p></o:p></p><p class=MsoNormal>    SFBool,<o:p></o:p></p><p class=MsoNormal>    MFBool,<o:p></o:p></p><p class=MsoNormal>    SFColor,<o:p></o:p></p><p class=MsoNormal>   …<o:p></o:p></p><p class=MsoNormal>};<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Finally, lets define a primitive data type called “string”, and use this as the data type the name characteristic.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Our object model definition for the X3DField object now looks like:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>X3DField {<o:p></o:p></p><p class=MsoNormal>    enum Type type;<o:p></o:p></p><p class=MsoNormal>    enum AccessType accessType;<o:p></o:p></p><p class=MsoNormal>    string name;<o:p></o:p></p><p class=MsoNormal>};<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Now let’s look at the object X3DArrayField, which is defined in clause 5.2.2 X3DArrayField<o:p></o:p></p><p class=MsoNormal>Reference: <a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fieldsDef.html#X3DArrayField">http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fieldsDef.html#X3DArrayField</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>We note that all fields that hold an array of values are derived from this class. Furthermore, referring back to the second paragraph of clause 4.4.2.1, we see that “Objects … called <i>fields</i> … are derived from the <i><a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fieldsDef.html#X3DField">X3DField</a></i> object. So,  although not explicitly stated, we can conclude that X3DArrayField must derive from X3DField. So does X3DArrayField need any additional characteristics to those defined in X3DField. For now, the answer is no. So the definition for X3DArrayField is as follows:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>X3DArrayField : X3DField {<o:p></o:p></p><p class=MsoNormal>};<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Step 2, to follow, will add the abstract functionality defined in ISO/IEC 19775-2:2015. Scene access interface (SAI).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>All the best,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Roy<o:p></o:p></p></div></body></html>