[x3d-public] sort of patch for X3DUOM for fieldValue.IS field separate from children field
John Carlson
yottzumm at gmail.com
Fri Sep 3 09:11:04 PDT 2021
First, I admit, the problem is in *my* XML code. I am very confused but
happy that my changes seem to work for compiling my Java code. I
attempt an IS statement inside a fieldValue. I doubt if that is
acceptable, but I still try! Add below patch to the fieldValue
statement in X3DUOM v4.0. Then you don't have to come up with a single
acceptableNodeType for the children field to encompass Nodes and
Statements...can one have both SFNode and MFNode fields? So fieldValue
may have children, IS, or value, exclusively? I'm not really sure how
to do that in X3DUOM (probably needs work), but I can probably do it in
JSON Schema. Anyway, somehow in X3DJSAIL stylesheet, if nodes and IS
statements inherit from X3DConcreteElement (probably not in standard?,
but IS does!), then it's possible you could combine IS and other
statements with children. I tried providing an alternate
acceptableNodeType for the children node in X3DUOM 4 in the fieldValue
statement, but it felt like I was digging a deeper hole. A mouse told me
that we were trying to come up with a unified schema for abstract
classes or interfaces above nodes and statements, so here we are!
diff --git a/src/specifications/X3dUnifiedObjectModel-4.0.xml
b/src/specifications/X3dUnifiedObjectModel-4.0.xml
index 4cb5df50f..dc43f4dbd 100644
--- a/src/specifications/X3dUnifiedObjectModel-4.0.xml
+++ b/src/specifications/X3dUnifiedObjectModel-4.0.xml
@@ -41490,6 +41490,12 @@
type="MFNode"
accessType="inputOutput"
acceptableNodeTypes="X3DNode"/>
+ <field name="IS"
+ type="SFNode"
+ accessType="inputOutput"
+ default="NULL"
+ acceptableNodeTypes="IS"
+ inheritedFrom="X3DNode"/>
<field name="class"
type="SFString"
accessType="inputOutput"
Don's compile is below John's log. Attaching original .x3d which doesn't
validate, that I know of.
I have not checked in all my JS code. If someone wants to explore some
boundaries of X3D, let me know. Log of John's code test script
(success? round trips working):
John's log:
$ bash several.sh ../data/rubik2x2x2.x3d
BEGIN ../data/rubik2x2x2.x3d > json, END ../data/rubik2x2x2.x3d
================================================================================
/home/coderextreme/X3DJSONLD/src/main/node/xmldiff.js
../data/rubik2x2x2.x3d ../data/rubik2x2x2.x3d.new
@5 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
@8 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/Shape/0/Box/0
/X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/Shape/0/Box/0
< ""
> {"$":{"containerField":"geometry"}}
@5 /X3D/Scene/0/ProtoDeclare/1/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
@5 /X3D/Scene/0/ProtoDeclare/2/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
@5 /X3D/Scene/0/ProtoDeclare/3/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
Different
~/X3DJSONLD/src/main/java/net/coderextreme/data ~/X3DJSONLD/src/main/shell
../java/net/coderextreme/data/rubik2x2x2.java
~/X3DJSONLD/src/main/shell
~/X3DJSONLD/src/main/java ~/X3DJSONLD/src/main/shell
net/coderextreme/data/rubik2x2x2
Note: toFileStylesheetConversion(X3dToJson.xslt) is overwriting prior
file ../data/rubik2x2x2.new.json
~/X3DJSONLD/src/main/shell
================================================================================
/home/coderextreme/X3DJSONLD/src/main/node/xmldiff.js
../data/rubik2x2x2.x3d ../data/rubik2x2x2.newPrettyPrint.intermediate.x3d
@7/X3D/Scene/0/NavigationInfo/0/$/avatarSize
>"0.25 1.6 0.75"
@7/X3D/Scene/0/NavigationInfo/0/$/transitionType
>"\"LINEAR\""
@5 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
@5 /X3D/Scene/0/ProtoDeclare/1/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
@5 /X3D/Scene/0/ProtoDeclare/2/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
@5 /X3D/Scene/0/ProtoDeclare/3/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
Different
~/X3DJSONLD/src/main/node ~/X3DJSONLD/src/main/shell
../node/net/coderextreme/data/rubik2x2x2.js
Warning: ../data/rubik2x2x2.new.x3d does not meet suggested X3D naming
conventions, continuing...
Note: toFileX3D() is overwriting prior file ../data/rubik2x2x2.new.x3d
~/X3DJSONLD/src/main/shell
node /home/coderextreme/X3DJSONLD/src/main/node/xmldiff.js
../data/rubik2x2x2.x3d ../data/rubik2x2x2.new.x3d
================================================================================
/home/coderextreme/X3DJSONLD/src/main/node/xmldiff.js
../data/rubik2x2x2.x3d ../data/rubik2x2x2.new.x3d
@7/X3D/Scene/0/NavigationInfo/0/$/avatarSize
>"0.25 1.6 0.75"
@7/X3D/Scene/0/NavigationInfo/0/$/transitionType
>"\"LINEAR\""
@5 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
@5 /X3D/Scene/0/ProtoDeclare/1/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
@5 /X3D/Scene/0/ProtoDeclare/2/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
@5 /X3D/Scene/0/ProtoDeclare/3/ProtoBody/0/Transform/0/$
< {"translation":"0 0 0"}
Different
===========================================================
Note: Don's code doesn't compile! Attached. Log:
$ javac -cp
/c/x3d-code/www.web3d.org/x3d/stylesheets/java/jars/X3DJSAIL.4.0.full.jar:.
net/x3djsonld/data/rubik2x2x2.java
net/x3djsonld/data/rubik2x2x2.java:104: error: incompatible types: IS
cannot be converted to X3DNode
.addConnect(new
connect().setNodeField("diffuseColor").setProtoField("diffuseColor")))))
^
net/x3djsonld/data/rubik2x2x2.java:109: error: incompatible types: IS
cannot be converted to X3DNode
.addConnect(new
connect().setNodeField("diffuseColor").setProtoField("diffuseColor"))))))))
^
net/x3djsonld/data/rubik2x2x2.java:123: error: incompatible types: IS
cannot be converted to X3DNode
.addConnect(new
connect().setNodeField("diffuseColor").setProtoField("x1diffuseColor")))))
^
net/x3djsonld/data/rubik2x2x2.java:128: error: incompatible types: IS
cannot be converted to X3DNode
.addConnect(new
connect().setNodeField("diffuseColor").setProtoField("x2diffuseColor"))))))))
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose
to get full output
4 errors
$ javac -cp
/c/x3d-code/www.web3d.org/x3d/stylesheets/java/jars/X3DJSAIL.4.0.full.jar:.
-Xdiags:verbose net/x3djsonld/data/rubik2x2x2.java
net/x3djsonld/data/rubik2x2x2.java:103: error: method addChild in class
fieldValue cannot be applied to given types;
.addChild(new IS()
^
required: X3DNode
found: IS
reason: argument mismatch; IS cannot be converted to X3DNode
net/x3djsonld/data/rubik2x2x2.java:108: error: method addChild in class
fieldValue cannot be applied to given types;
.addChild(new IS()
^
required: X3DNode
found: IS
reason: argument mismatch; IS cannot be converted to X3DNode
net/x3djsonld/data/rubik2x2x2.java:122: error: method addChild in class
fieldValue cannot be applied to given types;
.addChild(new IS()
^
required: X3DNode
found: IS
reason: argument mismatch; IS cannot be converted to X3DNode
net/x3djsonld/data/rubik2x2x2.java:127: error: method addChild in class
fieldValue cannot be applied to given types;
.addChild(new IS()
^
required: X3DNode
found: IS
reason: argument mismatch; IS cannot be converted to X3DNode
4 errors
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210903/3e018f3b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rubik2x2x2.x3d
Type: model/x3d+xml
Size: 6032 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210903/3e018f3b/attachment-0001.x3d>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rubik2x2x2.java
Type: text/x-java
Size: 12004 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210903/3e018f3b/attachment-0001.bin>
More information about the x3d-public
mailing list