[x3d-public] X3D Object Model and X3D XML Schema attributeGroup definitions for DEF, USE, class

Roy Walmsley roy.walmsley at ntlworld.com
Wed Oct 26 16:32:56 PDT 2016


Hi Don,

Yes, we have missed adding DEF/USE and class to the object model. With reference to your suggested methods of addition I do not favour a) adding them as a field. They are not fields, and I wouldn't like to raise confusion in the minds of those who might be struggling to understand everything clearly. In fact, I would probably go for c) something else, so as to identify them in an alternate manner. I have two half suggestions.

Consider the Object  Model schema. Here is an extract that  covers the InterfaceDefinition element within a ConcreteNode element.

	<xs:element name="InterfaceDefinition">
		<xs:annotation>
			<xs:documentation>This element contains an interface definition for an abstract object, abstract node, or concrete node</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="componentInfo" minOccurs="0"/>
				<xs:element ref="Inheritance" minOccurs="0"/>
				<xs:element ref="AdditionalInheritance" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="field" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="containerField" minOccurs="0"/>
				<xs:element ref="ContentModel" minOccurs="0"/>
			</xs:sequence>
			<xs:attribute name="specificationSection" type="xs:string" default=""/>
			<xs:attribute name="specificationUrl" type="xs:string" default=""/>
			<xs:attribute name="appinfo" type="xs:string" default=""/>
		</xs:complexType>
	</xs:element>

Notice that we have a separate element for containerField. So maybe we add them as separate entities, similarly. Or another approach might be to add them as attributes to the ConcreteNode element.

	<xs:element name="ConcreteNode">
		<xs:annotation>
			<xs:documentation>This element contains the definition for a single X3D concrete node type</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="InterfaceDefinition"/>
			</xs:sequence>
			<xs:attribute name="name" type="xs:token" default=""/>
		</xs:complexType>
	</xs:element>

We could add additional attributes, one each for the three items.

What do you think?

Roy

-----Original Message-----
From: Don Brutzman [mailto:brutzman at nps.edu] 
Sent: 26 October 2016 21:00
To: Roy Walmsley <roy.walmsley at ntlworld.com>
Cc: X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: X3D Object Model and X3D XML Schema attributeGroup definitions for DEF, USE, class

While using the X3D Object Model to autogenerate Java SAI Library, noticed some interesting omissions.

1. First, XML Schema has the following attributeGroup definitions for DEF, USE, class

	http://www.web3d.org/specifications/x3d-3.3.xsd
	<!--======================================================================-->
	<!--Attribute groups-->
	<!--DEF and USE are node-naming attributes common to all instantiable nodes. This attributeGroup is defined for all top-level node types in the node interface hierarchy.-->
	<xs:attributeGroup name="DEF_USE">
		<xs:annotation>
			<xs:documentation source="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#DEFL_USESemantics"/>
		</xs:annotation>
		<xs:attribute name="DEF" type="xs:ID">
			<xs:annotation>
				<xs:documentation source="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#DEFL_USESemantics"/>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="USE" type="xs:IDREF">
			<xs:annotation>
				<xs:documentation source="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#DEFL_USESemantics"/>
			</xs:annotation>
		</xs:attribute>
	</xs:attributeGroup>
	<xs:attributeGroup name="globalAttributes">
		<xs:attribute name="class" type="xs:NMTOKENS">
			<xs:annotation>
				<xs:appinfo>
					The class attribute is a space-separated list of classes, reserved for use by XML stylesheets.
				</xs:appinfo>
				<xs:documentation source="http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html#ClassAttributeSyntax"/>
			</xs:annotation>
		</xs:attribute>
	</xs:attributeGroup>
	<!--======================================================================-->


2. Second, these groups are referenced in X3DNode, X3DNodeMixedContent, ProtoInstance, MetadataSet, X3DProgrammableShaderObject, X3DScriptNode, ComposedShader.

- X3DNode, X3DNodeMixedContent are expected, they are topmost (mixed content refers to contained CDATA plain-text scripts).
- ProtoInstance is a special wild-card node that requires special handling in the node hierarchy.
- MetadataSet had some complications that we sorted out in this fashion, I believe 2 Mantis issues pertain to these.
	http://www.web3d.org/member-only/mantis/view.php?id=848
	http://www.web3d.org/member-only/mantis/view.php?id=834
- I think X3DProgrammableShaderObject, X3DScriptNode, ComposedShader relate to mixed content and special schema arrangements, for example:
	<!-- ComposedShader does not derive from X3DNode because of the need to have field children come first, before IS and ChildContentModelCore. -->

In short, all of these functionally derive from X3DNode, and any variations in the Schema are solely due to schema strictness (usually relating to avoidance of nondeterministic content models among the various cross-referencing inheritances).

Supporting reference for object model is abstract spec, 4.4.2.3 Interface hierarchy http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#InterfaceHierarchy

Related reference is X3D XML Schema Documentation http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3.html

Repeating key point: all three of these attributes functionally derive from X3DNode.


3.  In any case, these common attributes need to be listed in the X3D object model.

a. Am thinking that most consistent approach might simply be adding them to all nodes, e.g.

	<field type="SFString" accessType="" name="DEF"   default="" inheritedFrom="X3DNode"/>
	<field type="SFString" accessType="" name="USE"   default="" inheritedFrom="X3DNode"/>
	<field type="SFString" accessType="" name="class" default="" inheritedFrom="X3DNode"/>

b. Alternatively we might use type="NMTOKEN" for DEF/USE, and similarly use that definition elsewhere (e.g. name="name" attributes).

c. Something else?

All feedback welcome.  Thanks for considering this representation issue.

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman




More information about the x3d-public mailing list