[x3d-public] x3d-public Digest, Vol 170, Issue 2
Andreas Plesch
andreasplesch at gmail.com
Tue May 2 15:25:02 PDT 2023
I was able to use
https://github.com/sagold/json-schema-library/tree/main#gettemplate
to generate a giant 3.3 MB x3d json template from the json schema:
https://gist.github.com/andreasplesch/eb344010e0d292bca6181dfaf115b43e#file-x3d-3-3-jsonschema-template-json
Not sure exactly what it generated but probably something which
validates. Not sure how useful that will be. See
Steps:
execute
https://github.com/sagold/json-schema-library/blob/main/dist/jsonSchemaLibrary.js
This produces a global jlib variable.
schema = JSON.parse( content from
https://www.web3d.org/specifications/x3d-3.3-JSONSchema.json )
tool = new jlib.Draft04(schema)
template = tool.getTemplate()
Before that, I had to change the schema where it complained about
undefined data:
@Matrix3f items
Extrusion. at orientation.items
Viewpoint. at orientation.items
These had less items than required (8, or 3) which did not seem right
but may be intentional. I added an item to each. Not sure how the
additionalItems is supposed to work.
The changed schema is here:
https://gist.github.com/andreasplesch/eb344010e0d292bca6181dfaf115b43e#file-x3d-3-3-jsonschema-ap-json
-Andreas
On Tue, May 2, 2023 at 3:00 PM <x3d-public-request at web3d.org> wrote:
>
> Send x3d-public mailing list submissions to
> x3d-public at web3d.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> or, via email, send a message with subject or body 'help' to
> x3d-public-request at web3d.org
>
> You can reach the person managing the list at
> x3d-public-owner at web3d.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of x3d-public digest..."
>
>
> Today's Topics:
>
> 1. x3d document structure for autocomplete (Andreas Plesch)
> 2. Re: x3d document structure for autocomplete (John Carlson)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 2 May 2023 13:57:17 -0400
> From: Andreas Plesch <andreasplesch at gmail.com>
> To: X3D Graphics public mailing list <x3d-public at web3d.org>
> Subject: [x3d-public] x3d document structure for autocomplete
> Message-ID:
> <CAKdk67spDw9D5=Ji8ozko15t82xh2F5X+q5S6Nf0xn9q5xE48w at mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> The editor which is used for
>
> https://andreasplesch.github.io/Library/Viewer/index.html
>
> has autocomplete functionality for xml. It is based on a json data
> structure as a source to suggest completions. The json data looks like
> this:
>
> x3d_tags = {
> X3D: {
> children: ["Scene"]
> },
> Transform: {
> attrs: {
> rotation: ["0 1 0 0"],
> scale: ["1 1 1"],
> translation: ["0 0 0 0"]
> }
> },
> Shape: {
> children: ["Appearance", "IndexedLineSet", "Box",
> "Extrusion"],
> },
> Appearance: {
> children: ["Material", "ImageTexture", "PixelTexture"],
> },
> Material: {
> attrs: {
> "diffuseColor": ["0.8 0.8 0.8"],
> "emissiveColor": ["0 0 0"],
> "specularColor": ["0.1 0.1 0.1"],
> "shininess": ["0.1"],
> "transparency": ["0"]
> }
> }
> };
>
> Hopefully, this will not be mangled too badly. Possible tags are
> listed as keys which then have possible attribute options and children
> tag options as values.
>
> What would be the closest x3d document structure definition to
> construct a complete autocomplete from ?
>
> Thanks, Andreas
>
>
>
> --
> Andreas Plesch
> Waltham, MA 02453
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 2 May 2023 13:27:16 -0500
> From: John Carlson <yottzumm at gmail.com>
> To: Andreas Plesch <andreasplesch at gmail.com>
> Cc: X3D Graphics public mailing list <x3d-public at web3d.org>
> Subject: Re: [x3d-public] x3d document structure for autocomplete
> Message-ID:
> <CAGC3UE=341i_Jdf=2Rz3i5BHUSpg256upmNDvKeG31VLR4_9hg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> It?s not JSON. Property names in JSON have double quotes.
>
> My advice is to generate the JavaScript from X3DUOM. Examples are in
> X3DJSONLD/src/main/python.
>
> I realize this is using way too many languages. Please provide a
> JavaScript generator instead of Python.
>
> It kind of looks like you?re trying to duplicate JSON Schema. I believe
> there are additional parts beyond JSON Schema core for creating GUIs.
>
> Let?s continue the discussion.
>
> John
>
> On Tue, May 2, 2023 at 12:56 PM Andreas Plesch <andreasplesch at gmail.com>
> wrote:
>
> > The editor which is used for
> >
> > https://andreasplesch.github.io/Library/Viewer/index.html
> >
> > has autocomplete functionality for xml. It is based on a json data
> > structure as a source to suggest completions. The json data looks like
> > this:
> >
> > x3d_tags = {
> > X3D: {
> > children: ["Scene"]
> > },
> > Transform: {
> > attrs: {
> > rotation: ["0 1 0 0"],
> > scale: ["1 1 1"],
> > translation: ["0 0 0 0"]
> > }
> > },
> > Shape: {
> > children: ["Appearance", "IndexedLineSet", "Box",
> > "Extrusion"],
> > },
> > Appearance: {
> > children: ["Material", "ImageTexture", "PixelTexture"],
> > },
> > Material: {
> > attrs: {
> > "diffuseColor": ["0.8 0.8 0.8"],
> > "emissiveColor": ["0 0 0"],
> > "specularColor": ["0.1 0.1 0.1"],
> > "shininess": ["0.1"],
> > "transparency": ["0"]
> > }
> > }
> > };
> >
> > Hopefully, this will not be mangled too badly. Possible tags are
> > listed as keys which then have possible attribute options and children
> > tag options as values.
> >
> > What would be the closest x3d document structure definition to
> > construct a complete autocomplete from ?
> >
> > Thanks, Andreas
> >
> >
> >
> > --
> > Andreas Plesch
> > Waltham, MA 02453
> >
> > _______________________________________________
> > x3d-public mailing list
> > x3d-public at web3d.org
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230502/41e30616/attachment-0001.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
> ------------------------------
>
> End of x3d-public Digest, Vol 170, Issue 2
> ******************************************
--
Andreas Plesch
Waltham, MA 02453
More information about the x3d-public
mailing list