<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">I'm not too worried about JSON schema, I just want to make sure that the X3D JSON is right, per the X3D4 standard architecture, with my own eyeballs. I may just have a misunderstanding of the following Shape standard.  I don't see a value field, just a metadata field.  I realize value may be otherwise specified, but it's not in X3D tooltips either, under Shape.<div><br></div><div><a href="https://www.web3d.org/documents/specifications/19775-1/V4.0/Part01/components/shape.html#Shape" target="_blank">https://www.web3d.org/documents/specifications/19775-1/V4.0/Part01/components/shape.html#Shape</a><br></div><div><br></div><div>I'm not seeing that Shape has a value field, but I'm not too clear on whether containerField equal to "metadata" or "value" should be used on MetadataXxx statements in Shape and Text nodes in JSON.  It's highly possible that I'm totally misunderstanding.</div><div><br>I understand that both -value and @value are likely possible at some point!</div><div><br></div><div>Here are my diffs to the HelloWorldProgramOutput.json to make it pass:</div><div><br></div><div><div>--- a/src/main/data/HelloWorldProgramOutput.json</div><div>+++ b/src/main/data/HelloWorldProgramOutput.json</div><div>@@ -156,7 +156,7 @@</div><div>           },</div><div>           {</div><div>             "@name":"translated",</div><div>-            "@content":"29 June 2023"</div><div>+            "@content":"30 June 2023"</div><div>           },</div><div>           {</div><div>             "@name":"generator",</div><div>@@ -950,15 +950,14 @@</div><div>               "-children":[</div><div>                 { "Shape":</div><div>                   {</div><div>-                    "-value":[</div><div>+                    "-metadata":</div><div>                       { "MetadataString":</div><div>                         {</div><div>                           "@name":"findThisNameValue",</div><div>                           "@DEF":"FindableMetadataStringTest",</div><div>                           "@value":["test case"]</div><div>                         }</div><div>-                      }</div><div>-                    ],</div><div>+                      },</div><div>                     "-appearance":</div><div>                       { "Appearance":</div><div>                         {</div><div>@@ -2206,15 +2205,14 @@</div><div>               "-children":[</div><div>                 { "Shape":</div><div>                   {</div><div>-                    "-value":[</div><div>+                    "-metadata":</div><div>                       { "MetadataString":</div><div>                         {</div><div>                           "@name":"findThisNameValue",</div><div>                           "@DEF":"FindableMetadataStringTest",</div><div>                           "@value":["test case"]</div><div>                         }</div><div>-                      }</div><div>-                    ],</div><div>+                      },</div><div>                     "-appearance":</div><div>                       { "Appearance":</div><div>                         {</div></div><div><br></div><div>Here's the diff to XML I have locally to make the JSON pass. See the blue containerField.</div><div><br></div><div><div>diff --git a/src/main/data/HelloWorldProgramOutput.x3d b/src/main/data/HelloWorldProgramOutput.x3d</div><div>index 99b309451..0d47bfed3 100644</div><div>--- a/src/main/data/HelloWorldProgramOutput.x3d</div><div>+++ b/src/main/data/HelloWorldProgramOutput.x3d</div><div>@@ -246,7 +246,7 @@ function clockTrigger (timeValue)</div><div>     <!-- Test success: declarative statement createDeclarativeShapeTests() --></div><div>     <Group DEF='DeclarativeGroupExample'></div><div>       <Shape></div><div>-        <MetadataString DEF='FindableMetadataStringTest' name='findThisNameValue' value='"test case"'/></div><div>+        <MetadataString DEF='FindableMetadataStringTest' <font color="#0000ff">containerField='metadata' </font>name='findThisNameValue' value='"test case"'/></div><div>         <Appearance DEF='DeclarativeAppearanceExample'></div><div>           <!-- DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance --></div><div>           <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/></div></div><div><br></div><div><br></div><div><br></div><div>Thanks for a second set of eyeballs on this.</div><div><br></div><div>My guess is that X3DJSAIL is not reporting a containerField when it should,  to produce a processable HelloWorldProgramOutput.x3d  that will produce good JSON.  I do not have intermediate code right now.</div><div><br></div><div>So actually, it has nothing to do with JSON and everything to do with X3DJSAIL XML output.  But yeah, if you want to fix it in X3DJSAIL instead of X3dToJson.xslt, that would probably be easier, and very cool.</div><div><br></div><div>John</div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 1, 2023 at 12:28 AM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div lang="EN-US"><div><p class="MsoNormal">Hi John.  All of the JSON that you find is produced by our X3dToJson.xslt stylesheet, which hopefully meets all patterns we derived and documented at<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li style="margin-left:0in">X3D to JSON Stylesheet Converter<u></u><u></u></li><li style="margin-left:0in"><a href="https://www.web3d.org/x3d/stylesheets/X3dToJson.html" target="_blank">https://www.web3d.org/x3d/stylesheets/X3dToJson.html</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Well-formed JSON can be checked.  All of our online examples have a link to check via JSONLint, though tonight it is saying “unable to connect” (while providing plenty of advertising).<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li style="margin-left:0in">X3D Example Archives: X3D4WA, X3D for Web Authors, Chapter 01 Technical Overview, Hello World<u></u><u></u></li><li style="margin-left:0in"><a href="https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorldIndex.html" target="_blank">https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorldIndex.html</a><u></u><u></u></li><li style="margin-left:0in">upper-right inset box of links: <a href="https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.json" title="JavaScript Object Notation (JSON) encoding of X3D model" target="_blank"><span style="font-size:13.5pt;font-family:"Times New Roman",serif">.json</span></a><span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:black"> (</span><a href="https://jsonlint.com/?json=https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.json" title="jsonlint validation" target="_blank"><span style="font-size:13.5pt;font-family:"Times New Roman",serif">check</span></a><span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:black">)</span><u></u><u></u></li><li style="margin-left:0in"><a href="https://jsonlint.com/?json=https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.json" target="_blank">https://jsonlint.com/?json=https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.json</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">If there are mistakes in our X3D .xml -> .json pattern or the conversion stylesheet, they can be fixed.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Strict JSON validation isn’t possible until a JSON Schema is approved.  If you think that there is a Java-based implementation of the draft JSON Schema that is mature and stable enough to deserve our time, we can try adding that to our various build tools for X3D Example Archives and X3DJSAIL.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li style="margin-left:0in"><a href="http://json-schema.org" target="_blank">http://json-schema.org</a><u></u><u></u></li></ul><div><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">all the best, Don<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">-- <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">Don Brutzman  Naval Postgraduate School, Code USW/Br        <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">X3D graphics, virtual worlds, navy robotics <a href="https://faculty.nps.edu/brutzman" target="_blank">https://faculty.nps.edu/brutzman</a><u></u><u></u></span></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in"><p class="MsoNormal"><b>From:</b> John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> <br><b>Sent:</b> Friday, June 30, 2023 8:24 PM<br><b>To:</b> Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>><br><b>Cc:</b> X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br><b>Subject:</b> Is <a href="https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.json" target="_blank">https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.json</a> valid?<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><div><div><div><div><div><div><p class="MsoNormal">Don, if<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><a href="https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.json" target="_blank">https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.json</a><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">is supposed to be valid X3D JSON, please inform me.  Thanks! <u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">To ensure that -value is not a field of Shape in JSON, I have added the following exception in x3djsonld.py.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><div><p class="MsoNormal">    <span style="color:lime">    if parent in ("Text", "Shape") and key in ("value"):  # don't have value yet, sorry</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:lime">            # do value later</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:lime">            raise "-value not a supported field of Text or Shape, try -metadata?"</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:lime">            continue</span><u></u><u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">I can revert the code if necessary.  I'm trying to follow the standard as I see it.</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">If -value under Shape is correct, then X3DJSAIL needs to support addValue (as I have it in Java) or setValue.  That's my opinion.</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="color:black">John</span><u></u><u></u></p></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div>