[x3d-public] John tech report, X3DJSONLD, pythonSAI

John Carlson yottzumm at gmail.com
Tue Jun 20 22:02:55 PDT 2023


I think I’ve found this before:

https://openusd.org/dev/api/js_page_front.html

JSON I/O for USD

John

On Tue, Jun 20, 2023 at 11:41 PM John Carlson <yottzumm at gmail.com> wrote:

> I am taking out my JavaScript calling Java and Python calling Java, even
> though there are new versions of the npm java module and pyjnius.  Don
> called it right on that.  I am retaining Java code related to running
> stylesheets from bash.
>
> My current stumbling block in JSON validation is that webpack/babel blocks
> out the browser window variable.  I’m a bit lost there, but I need to do
> more searches.   Another case of, “If it ain’t broke, don’t fix it.”
>
> The good news is, JSONParser.js (X3DJSONLD.js) still seems to be working
> for X3DOM and X_ITE still seem to be working declaratively.  I’m not sure
> of the X3DOM JSON Prototype expander though.
> JSON validation another way might be in the works (or accomplished), but
> that doesn’t impact X3DOM or X_ITE that i know of, and we continue to wait
> on JSON schema while glTF runs towards the goal, which is fine.  You won’t
> find me coding by hand in glTF—that’s a separate market.  More likely I
> will be looking towards a USD/JSON solution for the metaverse.  Mojo
> promises to raise the level of abstraction for shaders to Python, so that’s
> way cool.  I don’t even really code JSON by hand either, mostly if i want
> to change something, I’ll go for the XML version.
>
> Is there any news on Script nodes for X3DOM?
>
> Expect to see an update to pythonSAI minus X3DJSAIL down the road.  I have
> adopted x3d.py, and will continue to develop the flat python serializer for
> Mojo.
>
> Converting JSON encoding to Python SAI and HAnim scaling of geometry are
> hot topics right now for me.  As far as I know, x3d.py doesn’t have any
> encoding import defs, instead X3dToPython.xslt is used AFAIK, with great
> success.
>
> It would seem that there are opportunities for iOS X3D.
>
> I have mostly handled the transition from #sourceText to #sourceCode in my
> python serializer.  I just need to run some tests converting back to XML
> and comparing.
>
> I’ll be looking for some USD examples if someone has them.  Does anyone
> want a VRML version of USD?
>
> John
>
> On Tue, Jun 20, 2023 at 12:19 PM Brutzman, Donald (Don) (CIV) <
> brutzman at nps.edu> wrote:
>
>> Hi John.  Small update:  latest build is using Saxon 12.1, as shown in
>>
>>
>>
>>    - (last release)https://www.web3d.org/x3d/stylesheets/python/build.xml
>>    - (latest dev)
>>    https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/python/build.xml
>>    - <property name="saxon.dir" location="../java/lib"
>>    description="relative path via stylesheets directory"/>
>>    - <property name="saxon.jar"           value="saxon-he-12.1.jar"/>
>>    - <!-- previously saxon-he-11.4.jar saxon-he-11.3.jar
>>    saxon-he-10.6.jar saxon9he.jar -->
>>
>>
>>
>> I only use the saxon-he “Home Edition” xslt engines because they are open
>> source and quite stable.  Tested version is included in our sourceforge
>> build so that you don’t have to hunt around to get things to work.
>>
>>
>>
>> Previous versions like 10.6  that you report using might still work, but
>> am not locking our XSLT stylesheets into any single version, always trying
>> to stay compliant for long-term reliability.  Further note that the
>> saxon-he distribution has a dependency on three .jar files that are shipped
>> with it (no longer internal) and so they have to be handled properly as
>> well.
>>
>>
>>
>> And looking online, Michael Kay and saxon team now have a version 12.2
>> and so will soon upgrade from 12.1 and test across multiple X3D
>> projects/stylesheets.
>>
>>
>>
>>    - https://github.com/Saxonica/Saxon-HE/tree/main/12/Java
>>
>>
>>
>> Recommendation: saxon xslt3 is untested and not a part of our current
>> XSLT version 2 stylesheet development.  Use at your own risk, experience
>> has shown that changing XSLT versions can be a major upgrade and change.
>> Since we don’t need any XSLT3 functionality currently, with a long TODO
>> list getting whittled down, that change won’t happen for X3D4 stylesheets
>> anytime soon.
>>
>>
>>
>> Have fun with stable X3D!  8)
>>
>>
>>
>> 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
>> https://faculty.nps.edu/brutzman
>>
>>
>>
>> *From:* John Carlson <yottzumm at gmail.com>
>> *Sent:* Tuesday, June 20, 2023 2:36 AM
>> *To:* X3D Graphics public mailing list <x3d-public at web3d.org>; Brutzman,
>> Donald (Don) (CIV) <brutzman at nps.edu>
>> *Subject:* problems with Saxon's xslt3 node module
>>
>>
>>
>> Saxon's xslt3 node.js module has serious issues using X3dToJson.xslt.
>>
>>
>>
>> For example, an entire ProtoInstance was deleted when converting to
>> abox.x3d to JSON.  (see attached abox.3d)
>>
>>
>>
>> Fortunately, their Java Saxon 10.6 HE is our primary stylesheet processor
>> and is working well.
>>
>>
>>
>> Here is some pseudocode for running xslt3. You will need some way to
>> install xslt3, like npm (part of node.js package).
>>
>>
>>
>> $ npm install -g xslt3
>>
>> $ xslt3 -xsl:X3dToJson.xslt -s:abox.x3d -o:abox.json
>>
>>
>>
>> Hmm!
>>
>>
>>
>> John
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230621/9dc02ce9/attachment-0001.html>


More information about the x3d-public mailing list