<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>IMPORT (JSON encoding), should it be an array or object in X3D
      JSON schema, previously discussed, Mantis issue present in JSON
      project.</p>
    <p><a class="moz-txt-link-freetext" href="https://www.web3d.org/member-only/mantis/view.php?id=1225">https://www.web3d.org/member-only/mantis/view.php?id=1225</a></p>
    <p>I need to look into previous emails, from months ago, will search
      my archives.<br>
    </p>
    <div class="moz-forward-container">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>My apologies for resend,  I'm trying to gain visibility for
        this Mantis issue.<br>
      </p>
      <p><br>
      </p>
      <p>0 Ajv 6.0 Validation failed on
/c/x3d-code/www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/X3dHeaderPrototypeSyntaxExamples.json<br>
        ^M<br>
         keyword: type^M<br>
         dataPath: X3D > Scene > -children > 18 > IMPORT^M<br>
         value:
{"@AS":"someInlineRoot","@importedDEF":"someName","@inlineDEF":"someInline"}^M<br>
         message: should be array^M<br>
         params: {"type":"array"}^M<br>
         file:
/c/x3d-code/www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/X3dHeaderPrototypeSyntaxExamples.json^M<br>
         version: 6.0^M</p>
      <p><br>
      </p>
      <p>Autogenerated IMPORT is:</p>
      <p>    "IMPORT": {<br>
              "type": "object",<br>
              "properties": {<br>
                "-children": {<br>
                  "$ref": "#/definitions/-childrenStatements"<br>
                },<br>
                "@AS": {<br>
                  "pattern": "^(\\s|\\S)*$",<br>
                  "type": "string"<br>
                },<br>
                "@importedDEF": {<br>
                  "pattern": "^(\\s|\\S)*$",<br>
                  "type": "string"<br>
                },<br>
                "@inlineDEF": {<br>
                  "pattern": "^(\\s|\\S)*$",<br>
                  "type": "string"<br>
                }<br>
              },<br>
              "required": [<br>
                "@importedDEF",<br>
                "@inlineDEF"<br>
              ],<br>
              "additionalProperties": false<br>
            },</p>
      <p><br>
      </p>
      <p><br>
      </p>
      <p><br>
      </p>
      <p>Roy's IMPORT is:</p>
      <p>                "IMPORT": {<br>
                                "type": "array",<br>
                                "minItems": 1,<br>
                                "items": {<br>
                                        "type": "object",<br>
                                        "properties": {<br>
                                                "@AS": {<br>
                                                        "type": "string"<br>
                                                },<br>
                                                "@importedDEF": {<br>
                                                        "type": "string"<br>
                                                },<br>
                                                "@inlineDEF": {<br>
                                                        "type": "string"<br>
                                                }<br>
                                        },<br>
                                        "required": [<br>
                                                "@importedDEF",<br>
                                                "@inlineDEF"<br>
                                        ],<br>
                                        "additionalProperties": false<br>
                                }<br>
                        },</p>
      <p><br>
      </p>
      <p>I have totally forgotten what the discussion about IMPORT was
        on the mailing list and what we decided.  I'm guessing that
        Roy's schema needs to be updated, but there are wiser minds than
        mine.<br>
      </p>
      <p><br>
      </p>
      <p>X3DUOM is:</p>
      <p>      <Statement name="IMPORT"><br>
                 <InterfaceDefinition
        specificationUrl=<a class="moz-txt-link-rfc2396E"
href="https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD3/Part01/concepts.html#IMPORTSemantics"
          moz-do-not-send="true">"https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD3/Part01/concepts.html#IMPORTSemantics"</a><br>
                                      appinfo="Functional summary:
        IMPORT provides ROUTE access to a node that has a corresponding
        EXPORT statement within an Inline scene. These connections allow
        event values to be exchanged via ROUTE statements between a
        parent model and a child Inline model."><br>
                    <componentInfo name="Networking" level="3"/><br>
                    <field name="AS"<br>
                           type="SFString"<br>
                           accessType="inputOutput"<br>
                           baseType="xs:ID"<br>
                           description="map importedDEF name AS a new
        name in current scene."/><br>
                    <field name="importedDEF"<br>
                           type="SFString"<br>
                           accessType="inputOutput"<br>
                           use="required"<br>
                           baseType="xs:NMTOKEN"<br>
                           description="importedDEF is DEF name of the
        node of interest that is contained in the remote inlineDEF
        scene."/><br>
                    <field name="inlineDEF"<br>
                           type="SFString"<br>
                           accessType="inputOutput"<br>
                           use="required"<br>
                           baseType="xs:IDREF"<br>
                           description="inlineDEF is the DEF name of
        Inline node in the same scene as this IMPORT statement."/><br>
                 </InterfaceDefinition><br>
              </Statement></p>
      <p><br>
      </p>
      <p>From the file itself:</p>
      <p><br>
      </p>
      <p>          { "IMPORT":<br>
                    {<br>
                      "@AS":"someInlineRoot",<br>
                      "@importedDEF":"someName",<br>
                      "@inlineDEF":"someInline"<br>
                    }<br>
                  },</p>
      <p><br>
      </p>
      <p>So this is definitely an object, not an array.   Is an array
        correct, or an object? I will check the v4 draft. I'm not seeing
        the data structure in 9.2.5, will check XML schema<br>
      </p>
      <p><br>
      </p>
      <p>    <xs:element name="IMPORT"><br>
                <xs:annotation><br>
                    <xs:appinfo><br>
                        <xs:attribute name="componentName"
        type="componentNameChoices" fixed="Networking"/><br>
                        <xs:attribute name="componentLevel"
        type="xs:positiveInteger" fixed="3"/><br>
                        Functional summary: IMPORT provides ROUTE access
        to a node that has a corresponding EXPORT statement within an
        Inline scene.<br>
                        These connections allow event values to be
        exchanged via ROUTE statements between a parent model and a
        child Inline model.<br>
                    </xs:appinfo><br>
                    <xs:documentation
        source=<a class="moz-txt-link-rfc2396E"
href="https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD3/Part01/concepts.html#IMPORTSemantics"
          moz-do-not-send="true">"https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD3/Part01/concepts.html#IMPORTSemantics"</a>/><br>
                </xs:annotation><br>
                <xs:complexType><br>
                    <xs:complexContent><br>
                        <xs:extension
        base="SceneGraphStructureStatement"><br>
                            <xs:attribute name="inlineDEF"
        type="xs:IDREF" use="required"/><br>
                            <xs:attribute name="importedDEF"
        type="xs:NMTOKEN" use="required"/><br>
                            <xs:attribute name="AS" type="xs:ID"/><br>
                        </xs:extension><br>
                    </xs:complexContent><br>
                </xs:complexType><br>
            </xs:element></p>
      <p><br>
      </p>
      <p>Okay, I don't see anything like array in here, so I will check
        the JSON draft.</p>
      <p><br>
      </p>
      <p>The JSON encoding draft has:</p>
      <p> </p>
      <table class="highlight tab-size js-file-line-container"
        data-tab-size="8" data-paste-markdown-skip="">
        <tbody>
          <tr>
            <td id="LC1484" class="blob-code blob-code-inner
              js-file-line"> <br>
            </td>
          </tr>
          <tr>
          </tr>
        </tbody>
      </table>
      <table class="highlight tab-size js-file-line-container"
        data-tab-size="8" data-paste-markdown-skip="">
        <tbody>
          <tr>
            <td id="LC1485" class="blob-code blob-code-inner
              js-file-line"><span class="pl-kos"><</span><span
                class="pl-ent">p</span> <span class="pl-c1">class</span>="<span
                class="pl-s">ExampleCode</span>"<span class="pl-kos">></span>"IMPORT":
              [<span class="pl-kos"><</span><span class="pl-ent">br</span><span
                class="pl-kos">></span></td>
          </tr>
          <tr>
          </tr>
        </tbody>
      </table>
      <table class="highlight tab-size js-file-line-container"
        data-tab-size="8" data-paste-markdown-skip="">
        <tbody>
          <tr>
            <td id="LC1486" class="blob-code blob-code-inner
              js-file-line"> &nbsp;&nbsp;&nbsp;{<span
                class="pl-kos"><</span><span class="pl-ent">br</span><span
                class="pl-kos">></span></td>
          </tr>
          <tr>
          </tr>
        </tbody>
      </table>
      <table class="highlight tab-size js-file-line-container"
        data-tab-size="8" data-paste-markdown-skip="">
        <tbody>
          <tr>
            <td id="LC1487" class="blob-code blob-code-inner
              js-file-line">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"@AS":
              "myNodeAlias",<span class="pl-kos"><</span><span
                class="pl-ent">br</span><span class="pl-kos">></span></td>
          </tr>
          <tr>
          </tr>
        </tbody>
      </table>
      <table class="highlight tab-size js-file-line-container"
        data-tab-size="8" data-paste-markdown-skip="">
        <tbody>
          <tr>
            <td id="LC1488" class="blob-code blob-code-inner
              js-file-line">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"@importedDEF":
              "myImportNode",<span class="pl-kos"><</span><span
                class="pl-ent">br</span><span class="pl-kos">></span></td>
          </tr>
          <tr>
          </tr>
        </tbody>
      </table>
      <table class="highlight tab-size js-file-line-container"
        data-tab-size="8" data-paste-markdown-skip="">
        <tbody>
          <tr>
            <td id="LC1489" class="blob-code blob-code-inner
              js-file-line">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"@inlineDEF":
              "myInline"<span class="pl-kos"><</span><span
                class="pl-ent">br</span><span class="pl-kos">></span></td>
          </tr>
          <tr>
          </tr>
        </tbody>
      </table>
      <table class="highlight tab-size js-file-line-container"
        data-tab-size="8" data-paste-markdown-skip="">
        <tbody>
          <tr>
            <td id="LC1490" class="blob-code blob-code-inner
              js-file-line"> &nbsp;&nbsp;&nbsp;}<span
                class="pl-kos"><</span><span class="pl-ent">br</span><span
                class="pl-kos">></span></td>
          </tr>
          <tr>
          </tr>
        </tbody>
      </table>
      ]<span class="pl-kos"></</span><span class="pl-ent">p</span><span
        class="pl-kos">></span>
      <table class="highlight tab-size js-file-line-container"
        data-tab-size="8" data-paste-markdown-skip="">
        <tbody>
          <tr>
            <td id="LC1483" class="blob-code blob-code-inner
              js-file-line"><span class="pl-kos"><</span><span
                class="pl-ent">p</span><span class="pl-kos">></span>An
              example of the encoding of an "IMPORT" object is:<span
                class="pl-kos"></</span><span class="pl-ent">p</span><span
                class="pl-kos">></span></td>
          </tr>
          <tr>
          </tr>
        </tbody>
      </table>
      <p><br>
      </p>
      <p>Relevant Mantis Issue is:<br>
      </p>
      <p><a class="moz-txt-link-freetext"
          href="https://www.web3d.org/member-only/mantis/view.php?id=1225"
          moz-do-not-send="true">https://www.web3d.org/member-only/mantis/view.php?id=1225</a></p>
      <p><br>
      </p>
      <p>Based on the Mantis issue, we need to at least change
        X3dToJson.xslt to produce an array (please double-check my work
        here), and change schema auto-generator to conform to what Roy's
        schema does.  There may be some unknown changes to XML schema
        and X3DUOM required, but at this time, I am unsure.   File date
        of JSON is Mar 31, 2021.  Likely the file was generated by
        donall.sh.  I would love it if some change to X3DUOM would
        automatically fix the auto-generated schema, but somehow I doubt
        that this is possible.<br>
      </p>
      <p>This line in don.sh, was likely the line that produced the
        JSON:</p>
      <p>(ls "$@" | grep -v intermediate | grep -v "\.new") | xargs -P
        $PROCESSORS java net.coderextreme.RunSaxon ---overwrite
        ---silent --../lib/stylesheets/X3dToJson.xslt ---</p>
      <p>$ diff ../lib/stylesheets/X3dToJson.xslt
        /c/x3d-code/www.web3d.org/x3d/stylesheets/X3dToJson.xslt</p>
      <p>notes no differences between the stylesheet files.</p>
      <p>Found error in auto-generator (used NOde instead of Node), but
        no apparent changes to schemas detected.</p>
      <p>On to the next.<br>
      </p>
      <div class="moz-cite-prefix">On 3/30/21 9:52 PM, John Carlson
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:98ed4b2a-612a-7087-3f0f-1c0c52080165@gmail.com">These
        files threw a validation error when run against Roy's schema
        with my modifications. <br>
        <br>
        $ grep "^ file" ../x3dschema/results.txt <br>
         file:
/c/x3d-code/www.web3d.org/x3d/content/examples/Basic/development/MetadataExamples.json<br>
         file:
/c/x3d-code/www.web3d.org/x3d/content/examples/Basic/development/RenderingComponentPrototypes.json<br>
         file:
/c/x3d-code/www.web3d.org/x3d/content/examples/Basic/development/ImportExportSyntax.json<br>
         file:
/c/x3d-code/www.web3d.org/x3d/content/examples/Basic/development/TestMetadataNodes.json<br>
         file:
/c/x3d-code/www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/X3dHeaderPrototypeSyntaxExamples.json<br>
         file:
/c/x3d-code/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamples.json<br>
         file:
/c/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Scanning/X3dMeshDesignPattern.json<br>
        <br>
        <br>
        Anyone care to look to see if it's Roy's schema that's the
        problem, or the files (look at the last 3 files)? I'm about
        pooped out for the evening.  I have not run these under Java
        with Roy's schema yet, but I will if someone wants me to. 
        Someone could set up org.everit on their own system, download
        draft-07 JSON schema (found in x3dschema) and do the testing
        with x3d-6.0-JSONSchema.json -- roy's schema (you'll need to
        modify the *.java files found in x3dschema--no worries, they're
        extremely simple). <br>
        <br>
        <br>
        To run this test in your own x3dschema folder, do the following
        patch, then run bash validate.sh (after modifying per your
        environment).   Collect errors in results.txt and other txt
        files.   Results are stored in results3.txt (autogenerated) and
        results6.txt (roy's schema).  Everything should be checked in
        now, under <a class="moz-txt-link-freetext"
          href="https://github.com/coderextreme/x3dschema"
          moz-do-not-send="true">https://github.com/coderextreme/x3dschema</a>
        <br>
        <br>
        <br>
        diff --git a/validatex3djson.js b/validatex3djson.js <br>
        index bafb455..fcc05ca 100644 <br>
        --- a/validatex3djson.js <br>
        +++ b/validatex3djson.js <br>
        @@ -26,7 +26,7 @@ for (var sversion in overallversions) { <br>
         function testValid(versions, valids, v, file, ajvValidate,
        hello) { <br>
                // console.log(valids[0], valids[1], v); <br>
                // change v == ? and set ? to 0 for my schema reports
        and set ? to 1 for roy's schema reports <br>
        -       if (valids[0] !== valids[1] && v == 0) { <br>
        +       if (valids[0] !== valids[1] && v == 1) { <br>
                    var errs = ajvValidate[versions[v]].errors; <br>
                    for (var e in errs) { <br>
                        if (e == 0) { <br>
        <br>
        <br>
        If the 3 last JSON files are the problem, there's a problem with
        the autogenerated schema.  I just don't have the heart to look
        right now. <br>
        <br>
        <br>
        So I think we're really close to a good X3D JSON schema, we just
        need to check these 3 files I think. Then we choose
        hand-generated (one version) or auto-generated (separate schemas
        per version, pretty much auto-update as X3DUOM is changed). <br>
        <br>
        <br>
        Thanks, <br>
        <br>
        John <br>
        <br>
      </blockquote>
    </div>
  </body>
</html>