[x3d-public] Stylesheet X3DUOM to JSON Schema
John Carlson
yottzumm at gmail.com
Sun Jan 25 07:11:11 PST 2026
Here's a refreshed mapping (include JSON schema prefixItems, I'm not sure
about this).
raw.githubusercontent.com/coderextreme/X3DJSONLD/refs/heads/master/src/main/python/index.html
Typically, there's a node or statement, with X3DUOM description in XML, and
then the JSON schema, then each field has X3DUOM and JSON schema.
At the end is JSONEX-tra stuff. It is important, and likely referenced
from above. They should be linked in the JSON schema. This avoids code
duplication, but isn't strictly necessary.
Here's the code that created the mapping. The code might be useful for
creating changes to the mapping, just request changes, and I'll try to pick
them up.
https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/python/schemamapping.py
John
On Sun, Jan 25, 2026 at 8:31 AM John Carlson <yottzumm at gmail.com> wrote:
> I have noticed that oneOf JSON schema properties are empty arrays. I'm
> guessing that this isn't feasible, and if we're going to construct a
> stylesheet using AI, we're going to have to make a bunch of small mappings,
> which is what Don requested originally.
>
> That has been done, but there might have been some changes. I will
> refresh the mapping.
>
> John
>
> On Sun, Jan 25, 2026 at 6:14 AM John Carlson <yottzumm at gmail.com> wrote:
>
>> Okay. I have a "schema" which is JSON, but I've not confirmed that it
>> passes JSON meta-schema:
>>
>> https://github.com/coderextreme/X3DJSONLD/blob/master/src/specifications/X3dUnifiedObjectModel-4.1.json
>>
>> (sorry, bad name, please rename if you download it. I will need to make
>> modifications to my Java code in order to change the base name).
>>
>> I have also not confirmed if it validates any "X3D" JSON. That is next.
>>
>> The modified XSLT which generates the schema from X3DUOM (imperfectly) is
>> here:
>>
>> https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/xslt/generateJSONschema2020-12.xslt
>> I have gone into the schema and made edits, because I can't figure out
>> the logic to or not to put a comma after the default value in JSON Schema.
>> The logic involved is here:
>>
>>
>> https://github.com/coderextreme/X3DJSONLD/blob/23a53eb9f8835632fcad0a55087c86f284271fbb/src/main/xslt/generateJSONschema2020-12.xslt#L328
>>
>> Copied below:
>> <xsl:if test="
>> not($fieldName = 'language' and local-name() =
>> 'PackagedShader' and not(@default)) and
>> not($fieldName = 'language' and local-name() =
>> 'ProgramShader' and not(@default)) and
>> not($fieldName = 'language' and local-name() =
>> 'X3DShaderNode' and not(@default)) and
>> not($fieldName = 'name' and local-name() = 'meta'
>> and not(@default)) and
>> not($fieldName = 'name' and local-name() =
>> 'HAnimDisplacer' and not(@default)) and
>> not($fieldName = 'name' and local-name() = 'HAnimJoint'
>> and not(@default)) and
>> not($fieldName = 'name' and local-name() =
>> 'HAnimSegment' and not(@default)) and
>> not($fieldName = 'name' and local-name() = 'HAnimSite'
>> and not(@default)) and
>> (
>> $fieldType = 'SFColor' or
>> $fieldType = 'SFColorRGBA' or
>> $fieldType = 'SFDouble' or
>> $fieldType = 'SFFloat' or
>> $fieldType = 'SFImage' or
>> $fieldType = 'SFInt32' or
>> $fieldType = 'SFMatrix3f' or
>> $fieldType = 'SFMatrix4f' or
>> $fieldType = 'SFRotation' or
>> $fieldType = 'SFTime' or
>> $fieldType = 'SFVec2f' or
>> $fieldType = 'SFVec3d' or
>> $fieldType = 'SFVec3f' or
>> $fieldType = 'SFVec4f' or
>> @default = 'NULL' or
>> @default = '-1' or
>> @default = '0' or
>> @default = '1' or
>> @default = '2.0' or
>> @default = '3' or
>> @default = '4.0' or
>> @default = 'false' or
>> @default = 'true' or
>> @default = 'AUTO' or
>> @default = 'BASIC' or
>> @default = 'CONSTANT' or
>> @default = 'FASTEST' or
>> @default = 'Full' or
>> @default = 'INVERSE' or
>> @default = 'LINEAR' or
>> @default = 'LOWPASS' or
>> @default = 'MATCH_ANY' or
>> @default = 'MAX' or
>> @default = 'NONE' or
>> @default = 'PIE' or
>> @default = 'PLAIN' or
>> @default = 'REPEAT' or
>> @default = 'SPEAKERS' or
>> @default = 'SPHERE' or
>> @default = 'SQUARE' or
>> @default = 'localhost' or
>> @default = 'standAlone' or
>> (@default != 'BOUNDS' and @default != 'CLOSEST' and not(@default)))">
>> <xsl:text>,
</xsl:text>
>>
>> Frankly, I am puzzled. The problem involves absent default values for
>> meta name, shader language and HAnim name fields.
>>
>> If someone wants to help with my logic, great.
>>
>> I created a shell script to run the stylesheet, here:
>>
>>
>> https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/shell/schema.sh
>>
>> The stylesheet should work with any XSLT 2.0 processor.
>>
>> Note that this schema varies wildly from the one generated by python.
>> I'm not quite sure why Claude.ai borked. It was a one shot deal. What I
>> can do is try with X3DUOM, the Python XSLT generator, and a real JSON
>> schema next (lots of tokens).
>>
>> John
>>
>> On Sun, Jan 25, 2026 at 1:27 AM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> First cut at an XSLT stylesheet for converting X3DUOM to JSON schema.
>>>
>>> It’s got a web3d license.
>>>
>>> I’ve not tried it at all, that takes more work! It’s 3/7th’s the size
>>> of the python, so that’s impressive!
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20260125/8ee9a860/attachment.html>
More information about the x3d-public
mailing list