<div dir="auto">Do we have an xml example of IMPORT/EXPORT mixed with Protos? I may need to change my protoexpander.<div dir="auto"><br></div><div dir="auto">John</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Jul 10, 2017 11:22 AM, "Don Brutzman" <<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">thanks for checking these.<br>
<br>
On 7/10/2017 6:17 AM, Roy Walmsley wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Don,<br>
<br>
Agreed with John's later comment that @class is not included in JSON. In fact, let's take that one step further and note that it is not included in the abstract standard. Words containing the letters "class" only appear four times in clause 4 of 19775-1 V3.3, and not at all in clause 7. None of the instances is concerned with the "class" attribute that is included in 19776-1. And looking at 19776-1, clause 4.3.6 class attribute syntax, the text states:<br>
<br>
“The class attribute is reserved for use with XML Cascading Style Sheets (see [CSS]).”<br>
<br>
So the class attribute is only for the XML encoding (and anything derived from it). Therefore it should not appear in JSON. And it doesn't.<br>
</blockquote>
<br>
I had thought we had a Mantis issue about elevating the 'class' attribute to Abstract specification, and other encodings, since it seems to be essential to HTML5/CSS integration and we typically make all encodings fully symmetric in terms of expressive power.<br>
<br>
Searched but couldn't find the Mantis issue however. Perhaps I overlooked it and you can locate it?<br>
<br>
If not then I can post a specification comment so that the issue gets fully considered in Mantis as part of X3D v4 design.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Now what about IMPORT and EXPORT.<br>
<br>
Let's look at the draft text in the working draft for ISO/IEC CD 19776-5, clause 4.3.2.15 "IMPORT" property syntax. The text reads:<br>
<br>
“The "IMPORT" property is an optional property of the "Scene" object. It is an array type, where each item is an object having the properties listed in Table 4.13. The first column lists the name of the property. The second column indicates whether the property is optional or required. The third column lists the reference to the detailed encoding of the property.”<br>
<br>
Table 4.13 lists three properties "@AS" which is optional, and "@importedDEF" and "@inlineDEF", both of which are required. No other properties are permitted.<br>
<br>
The "EXPORT" property is defined in an analogous manner. Here is an example from the draft standard:<br>
<br>
"EXPORT": [<br>
<br>
{<br>
<br>
"@AS": "myNodeAlias",<br>
<br>
"@localDEF": "myNode",<br>
<br>
}<br>
<br>
]<br>
<br>
Why is it done like that? Because JSON recommends, and we have followed this recommendation, that the property keys in any given object should not be duplicated. So, any single object, like "Scene", cannot have multiple IMPORT or EXPORT statements. They have to be collected together into an array. Each IMPORT statement has three properties, so needs to be an object.<br>
<br>
Hope this helps,<br>
<br>
All the best,<br>
<br>
Roy<br>
</blockquote>
<br>
Thanks Roy. This will be good to sort out more closely. I don't think this draft JSON specification is entirely correct; IMPORT and EXPORT statements can appear multiple times and anywhere in the scene graph, not just with the Scene (root) element. Good practice for DEF readability/confirmation is to put each of them near their corresponding Inline node, but that isn't explicitly required.<br>
<br>
==============================<wbr>==============================<wbr>===============<br>
9.2.5 IMPORT statement<br>
<a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/networking.html#IMPORTStatement" rel="noreferrer" target="_blank">http://www.web3d.org/documents<wbr>/specifications/19775-1/V3.3/<wbr>Part01/components/networking.<wbr>html#IMPORTStatement</a><br>
<br>
The following example illustrates the use of the IMPORT statement (Classic VRML encoding syntax):<br>
<br>
DEF I1 Inline {<br>
url "someurl.x3d"<br>
}<br>
. . .<br>
<br>
IMPORT I1.rootTransform AS I1Root<br>
DEF PI PositionInterpolator { ... }<br>
ROUTE PI.value_changed TO I1Root.set_translation<br>
<br>
==============================<wbr>==============================<wbr>===============<br>
9.2.6 EXPORT statement<br>
<a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/networking.html#EXPORTStatement" rel="noreferrer" target="_blank">http://www.web3d.org/documents<wbr>/specifications/19775-1/V3.3/<wbr>Part01/components/networking.<wbr>html#EXPORTStatement</a><br>
<br>
The following example illustrates the use of the EXPORT statement (Classic VRML encoding):<br>
<br>
DEF T1 Transform {<br>
...<br>
}<br>
. . .<br>
<br>
EXPORT T1 AS rootTransform<br>
<br>
==============================<wbr>==============================<wbr>===============<br>
<br>
and related links<br>
<br>
<a href="http://www.web3d.org/x3d/tooltips/X3dTooltips.html#IMPORT" rel="noreferrer" target="_blank">http://www.web3d.org/x3d/toolt<wbr>ips/X3dTooltips.html#IMPORT</a><br>
<a href="http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_IMPORT.html" rel="noreferrer" target="_blank">http://www.web3d.org/specifica<wbr>tions/X3dSchemaDocumentation3.<wbr>3/x3d-3.3_IMPORT.html</a><br>
<a href="http://www.web3d.org/specifications/X3dDoctypeDocumentation3.3.html#IMPORT" rel="noreferrer" target="_blank">http://www.web3d.org/specifica<wbr>tions/X3dDoctypeDocumentation3<wbr>.3.html#IMPORT</a><br>
etc.<br>
<br>
We should probably check the encoding documents further to ensure that each DEF precedes IMPORT/EXPORT, just as DEF precedes USE. Or else NOTE that prior DEF definition is not a requirement.<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-----Original Message-----<br>
From: Don Brutzman [mailto:<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>]<br>
Sent: 09 July 2017 23:55<br>
To: Roy Walmsley <<a href="mailto:roy.walmsley@ntlworld.com" target="_blank">roy.walmsley@ntlworld.com</a>>; John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>><br>
Cc: X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>
Subject: X3D JSON schema validation problems: @class and IMPORT/EXPORT attributes<br>
<br>
Finally getting "back up on the horse" to test JSON conversions using X3dToJson.xslt (hooray!)<br>
<br>
Attached please find current version of X3DJSAIL output .x3d test scene, plus corresponding .json version.<br>
<br>
Roy, it looks like there may be several omissions in the X3D JSON Schema:<br>
<br>
a. @class attribute (previously untested) not recognized<br>
<br>
b. IMPORT/EXPORT statements (previously untested) are apparently expecting an array when simple attributes are provided<br>
<br>
{ "IMPORT":<br>
<br>
{<br>
<br>
"@AS":"WorldInfoDEF2",<br>
<br>
"@importedDEF":"WorldInfoDEF"<wbr>,<br>
<br>
"@inlineDEF":"inlineSceneDef"<br>
<br>
}<br>
<br>
},<br>
<br>
{ "EXPORT":<br>
<br>
{<br>
<br>
"@AS":"WorldInfoDEF3",<br>
<br>
"@localDEF":"WorldInfoDEF"<br>
<br>
}<br>
<br>
},<br>
<br>
Console output follows. Please advise, TIA.<br>
<br>
==============================<wbr>=======<br>
<br>
translation input: test/HelloWorldProgramOutput.x<wbr>3d ..expected output: test/HelloWorldProgramOutput.j<wbr>son Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode ..error checking with jslint jslint:test/HelloWorldProgramO<wbr>utput.json:447:1:JavaScript URL.<br>
<br>
jslint:test/HelloWorldProgramO<wbr>utput.json:812:1:JavaScript URL.<br>
<br>
Java Result: 1<br>
<br>
..error checking with json-schema-validator<br>
<br>
--- BEGIN C:\x3d-code\<a href="http://www.web3d.org" rel="noreferrer" target="_blank">www.web3d.org</a>\x3d\<wbr>stylesheets\test\HelloWorldPro<wbr>gramOutput.json---<br>
<br>
validation: FAILURE<br>
<br>
[ {<br>
<br>
"level" : "error",<br>
<br>
"schema" : {<br>
<br>
"loadingURI" : "file:/C:/x3d-code/<a href="http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json#" rel="noreferrer" target="_blank">www.web3d.o<wbr>rg/specifications/x3d-3.3-JSON<wbr>Schema.json#</a>",<br>
<br>
"pointer" : "/definitions/Box"<br>
<br>
},<br>
<br>
"instance" : {<br>
<br>
"pointer" : "/X3D/Scene/-children/5/Transf<wbr>orm/-children/0/Anchor/-childr<wbr>en/0/Shape/-geometry/Box"<br>
<br>
},<br>
<br>
"domain" : "validation",<br>
<br>
"keyword" : "additionalProperties",<br>
<br>
"message" : "object instance has properties which are not allowed by the schema: [\"@class\"]",<br>
<br>
"unwanted" : [ "@class" ]<br>
<br>
}, {<br>
<br>
"level" : "error",<br>
<br>
"schema" : {<br>
<br>
"loadingURI" : "file:/C:/x3d-code/<a href="http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json#" rel="noreferrer" target="_blank">www.web3d.o<wbr>rg/specifications/x3d-3.3-JSON<wbr>Schema.json#</a>",<br>
<br>
"pointer" : "/definitions/IMPORT"<br>
<br>
},<br>
<br>
"instance" : {<br>
<br>
"pointer" : "/X3D/Scene/-children/24/IMPOR<wbr>T"<br>
<br>
},<br>
<br>
"domain" : "validation",<br>
<br>
"keyword" : "type",<br>
<br>
"message" : "instance type (object) does not match any allowed primitive type (allowed: [\"array\"])",<br>
<br>
"found" : "object",<br>
<br>
"expected" : [ "array" ]<br>
<br>
}, {<br>
<br>
"level" : "error",<br>
<br>
"schema" : {<br>
<br>
"loadingURI" : "file:/C:/x3d-code/<a href="http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json#" rel="noreferrer" target="_blank">www.web3d.o<wbr>rg/specifications/x3d-3.3-JSON<wbr>Schema.json#</a>",<br>
<br>
"pointer" : "/definitions/EXPORT"<br>
<br>
},<br>
<br>
"instance" : {<br>
<br>
"pointer" : "/X3D/Scene/-children/25/EXPOR<wbr>T"<br>
<br>
},<br>
<br>
"domain" : "validation",<br>
<br>
"keyword" : "type",<br>
<br>
"message" : "instance type (object) does not match any allowed primitive type (allowed: [\"array\"])",<br>
<br>
"found" : "object",<br>
<br>
"expected" : [ "array" ]<br>
<br>
} ]<br>
<br>
--- END C:\x3d-code\<a href="http://www.web3d.org" rel="noreferrer" target="_blank">www.web3d.org</a>\x3d\<wbr>stylesheets\test\HelloWorldPro<wbr>gramOutput.json---<br>
<br>
Java Result: 100<br>
<br>
==============================<wbr>=======<br>
<br>
p.s. John it looks like MetadataString "@value conversion is incorrectly encoding " as " instead of \" (though #comment and other values look OK), will work on it.<br>
<br>
all the best, Don<br>
<br>
-- <br>
<br>
Don Brutzman Naval Postgraduate School, Code USW/Br <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a> <mailto:<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>><br>
<br>
Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA <a href="tel:%2B1.831.656.2149" value="+18316562149" target="_blank">+1.831.656.2149</a><br>
<br>
X3D graphics, virtual worlds, navy robotics <a href="http://faculty.nps.edu/brutzman" rel="noreferrer" target="_blank">http://faculty.nps.edu/brutzma<wbr>n</a><br>
<br>
</blockquote>
<br>
<br>
all the best, Don<br>
-- <br>
Don Brutzman Naval Postgraduate School, Code USW/Br <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><br>
Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA <a href="tel:%2B1.831.656.2149" value="+18316562149" target="_blank">+1.831.656.2149</a><br>
X3D graphics, virtual worlds, navy robotics <a href="http://faculty.nps.edu/brutzman" rel="noreferrer" target="_blank">http://faculty.nps.edu/brutzma<wbr>n</a><br>
</blockquote></div></div>