[x3d-public] renewed development of X3D JSON support
Brutzman, Donald (Don) (CIV)
brutzman at nps.edu
Mon Oct 11 16:48:22 PDT 2021
Attendees: John Carlson, Don Brutzman
1. JSON Schema Status
- JSON Schema is a vocabulary that allows you to annotate and validate JSON documents.
- https://json-schema.org
Looks like they have an updated numbering scheme. Latest published IETF Draft is 2020-12. IETF requires that each draft gets updated each 6 months, but they have long missed meeting such goals. We have to settle on what has meaningful tool support.
* https://json-schema.org/specification-links.html#understanding-draft-names-and-numbers
Many implementations are listed at
* https://json-schema.org/iplementations.html
Looking at versions of Java implementations:
* We previously used Everit but that looks to be stopped 2 years ago
* Several implements support version 2019-09, only one reports 2020-12 support
* Snow https://github.com/ssilverman/snowy-json
* Vert.x json schema https://github.com/eclipse-vertx/vertx-json-schema (looks recent)
* Jsonschmafriend https://github.com/jimblackler/jsonschemafriend (looks recent, supports 2020-12)
* Gson https://en.wikipedia.org/wiki/Gson
Very interesting test page, can feed it a JSON schema and JSON file for validation:
* https://tryjsonschematypes.appspot.com
Interestingly the JSON Schema Store indicates 419 schemas are available, of various versions reaching back to draft-04..
Gson (aka Google Gson) is an open-source<https://en.wikipedia.org/wiki/Open-source_software> Java<https://en.wikipedia.org/wiki/Java_(programming_language)> library to serialize<https://en.wikipedia.org/wiki/Serialize> and deserialize Java objects to (and from) JSON<https://en.wikipedia.org/wiki/JSON>. Conceivably it might be integrated with X3DJSAIL objects for X3D nodes and statements. Supports many versions.
Conclusion #1: given multiple tool support, we will pursue JSON Schema 2020-12 for X3D JSON, and further test across multiple programming languages.
Reaction: thank goodness we waited a couple of years rather than dig a hole with prior versions of tools that are now apparently defunct. Latest version of JSON schema looks pretty stable and mature now, though we are certainly waiting for a stable standard (many years in development, still not done). Good enough to give it a shot again.
We are pretty adept at converting X3DUOM into other things. Once we have a good pattern for X3D JSON Schema matching 2020-12, we can easily (1 week’s effort) autogenerate it.
NPS will soon get an updated version of XML Spy. They appear to support 2020-12. Interesting they have a new feature, apparently matching what we want to do. Worth checking:
* Convert XML Schema to/from JSON Schema
* https://www.altova.com/manual/XMLSpy/spyenterprise/xsjson_schview_version.html
* https://www.altova.com/manual/XMLSpy/spyenterprise/urefconvert_xmlschematojsonschema.html
We will look at this in the next meeting.
---
1. John’s implementations
Existing X3D JSON Schema drafts by John are found at
- https://github.com/coderextreme/X3DJSONLD/tree/master/src/main/schema
John’s current autogenerated X3D JSON schema is draft-07, he has prior work that is 2019-09.
Looking at versions of JavaScript implementations:
* Ajv appears to support latest 2020-12 and 2019-09
* John will upgrade his use of this library to latest
Suggestion: let’s work on a X3D4 JSON Schema that also validates X3D versions 3.0-3.3. (This might be the case already.)
Plan: we will work on updating JSON Schema, then validating examples first with JavaScript and Java.
---
1. X3D JSON pages
Initial design-planning page:
* X3D JSON Encoding
* https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding
Detailed design and implementation:
* X3D to JSON Stylesheet Converter
* https://www.web3d.org/x3d/stylesheets/X3dToJson.html
These pages need to be reviewed and confirmed or updated. Upcoming meeting.
----
1. Library support
* X3DJSONLD
- https://github.com/coderextreme/X3DJSONLD
This is where John’s collected and latest work is found. This library runs under node.js and browsers, and has many features, and has many tests for X3D JSON in X3DOM and X_ITE.
We might try to document it better.
* X3DJSAIL Java
X3D Java Scene Access Interface Library (X3DJSAIL)
https://www.web3d.org/specifications/java/X3DJSAIL.html
John has written some Java code that might import JSON to create X3DJSAIL objects, that might work. However that works via the DOM, and we hope to avoid dual translations for one pass to avoid brittleness.
X3DJSAIL includes JSON output (export), which was pretty easy, but not parsing (import).
* https://www.web3d.org/specifications/java/X3DJSAIL.html#Conversions
We looked at whether Saxon library might work for JSON import, since X3DJSAIL already includes Saxon saxon-he-10.6 (HE = Home Edition = open source). Interestingly there is a function built in that might work,
* https://www.saxonica.com/html/documentation10/functions/fn/json-to-xml.html
* https://www.saxonica.com/html/documentation10/functions/fn/parse-json.html
* X3DPSAIL Python
There is a Python package “jsonschema” that appears to have 2020-12 support.
* Python package jsonschema, available on py
* https://github.com/Julian/jsonschema
----
1. Online examples
Once we get an updated java library, we will resume unit testing of all X3D JSON examples with Ant. Our build scripts currently support jslint only.
* X3D Resources: Examples
* https://www.web3d.org/x3d/content/examples/X3dResources.html#Examples
----
1. X3D JSON Specification plans
Still TODO is make the C/C++/C# draft specifications available in GitHub and web3d.org
We have to finish X3D Architecture specification before we can add a JSON specification.
See the following for the road map of all X3D Specifications.
* X3D Specifications: Schema and DOCTYPE Validation
* https://www.web3d.org/specifications
* X3D Graphics Standards Relationships
* https://www.web3d.org/specifications/X3dSpecificationRelationships.png
----
1. John’s movie recommendation
* "The Billion Dollar Code" NetFlix
* https://www.netflix.com/title/81074012
----
Having fun diversifying X3D4 again! 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 http://faculty.nps.edu/brutzman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20211011/7f713931/attachment-0001.html>
More information about the x3d-public
mailing list