[x3d-public] X3D JSON schema, identifying element type for items within an array.

Don Brutzman brutzman at nps.edu
Tue Apr 6 17:07:33 PDT 2021


thanks for review and progress

On 4/6/2021 4:08 PM, John Carlson wrote:
> 
> 
> Decision should be made whether array X3D type to array item X3D type
> map should be in X3D JSON schema generator or X3DUOM.

all types (array or singleton) already defined in X3DUOM so no decision needed.

what question do you have?

> As discussed in our meeting today, I am adding a $comment with X3D type
> before "type": occurs in the X3D JSON schema.
> 
> This will require more work than initially required, although the
> changes so far have been fairly straightforward in the somewhat messy code.
> 
> For example:
> 
>              "@url": {
>                "pattern": "^(\\s|\\S)*$",
> +              "$comment": "X3D type: MFString",
>                "type": "array",
>                "minItems": 1,
>                "items": {
>                  "format": "uri-reference",
> +                "$comment": "X3D type: MFString",
>                  "type": "string"
>                }
>              },
> 
> 
> The X3D type for the items object, should be SFString one would think.
> So I'll have to check to see if I'm in an array.

Great.  No need to say "X3D type: "

I would add accessType as well please.

example: "$comment": "MFString inputOutput",

> Probably by looking for "items".  Then I'll look for MF in the field
> type, and replace the first M with an S.
> 
> 
> But here are added problems looking at arrays:
> 
> 
>              "@bboxSize": {
>                "pattern":
> "^\\s*(([+-]?((0|[1-9][0-9]*)(\\.[0-9]*)?|\\.[0-9]+)([Ee][+-]?[0-9]+)?)\\s+){2}([+-]?((0|[1-9][0-9]*)(\\.[0-9]*)?|\\.[0-9]+)([Ee][+-]?[0-9]+)?)\\s*$",
> +              "$comment": "X3D type: SFVec3f",
>                "type": "array",
>                "minItems": 3,
>                "maxItems": 3,
>                "items": {
>                  "default": -1,
> +                "$comment": "X3D type: SFVec3f",
>                  "type": "number"
>                }
>              },
> 
> 
> In this case, the SFVec3f would be found, and a mapping between SFVec3f
> to SFFloat for individual items should be made.

I think your actual mapping is SFVec3f to Javascript "type": "number" with min/maxItems 3  which appears above.

> So perhaps a simple map could be constructed which maps array type to
> item type.
> 
> 
> Does this sound pretty feasible, essentially a hard coded map from array
> type to item type in the generator code?

sounds trivially simple and workable

> I will look for additional issues now.  I'm not seeing much right away.
> I know I ignore some of the "type" fields right now, particularly in
> hard coded definitions.
> 
> Note that I'm inserting documentation.  This shouldn't affect the
> running of the generator.
> 
> My main question is, where does the information reside?  Should it be in
> X3DUOM?

(on loudspeaker) "I Say Again" all of the needed information is already in X3DUOM.

> Does anyone mind if I start calling my generators "synthesizers"?  I'm
> on a new kick!

yes, please don't kick us with mixed terms...

> Note that we are moving towards XSL for our primary JSON schema
> synthesizer, lessening requirements on future maintainers.   We're
> currently using python to suss out patterns and requirements for
> X3DUOM.   The python pretty much is impossible to maintain (even the guy
> that wrote it admits that).  If you know any "younguns" who love XSL,
> encourage them to join and contribute to X3D!

when you have a good pattern in a good draft-07 schema, i will create an XSLT autogenerator that converts X3DUOM XML to build an X3D JSON schema.

> Building holistic schema synthesizers.
> 
> My next job will be to build holistic spaceship synthesizers.

please leave me behind

> If anyone wants to write a validator which validates the X3D JSON
> schemas against X3DUOM, that would be WAY cool!

Since we are going from X3DUOM to X3D JSON schema, validation seems redundant and not very informative either.

> In my dreams,
> 
> Johnnyhehehe

good night

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



More information about the x3d-public mailing list