[x3d-public] Progress on X3D JSON schema creation rules from X3DUOM (not min/max)

John Carlson yottzumm at gmail.com
Wed Feb 2 19:13:18 PST 2022


I don't think this includes field specific min/max (enums yes) or number of
items in an array, I think.

Here is the first cut at rules in play, embedded in the X3D JSON schema
generator.

Let me know if you want something different, maybe we can work on writing
out XSLT.

The gist is, I don't have field level info yet.  TBD.

The text below is the difference from the rules generator and the schema
generator.  There should only be rules listed here.

Thanks!

< rules = ""
<
<
<                 rules += "If "+k+" starts with X3D, put out reference\n"
<                 rules += "put out  "+self.name+" reference\n"
<             rules += "put out @geoSystem reference\n"
<         rules += "For class "+self.name+"\n"
<             rules += "If class "+self.name+" startswith X3D but is not
X3D, return empty string\n"
<             rules += "If class "+self.name+" has already be written out,
issue empty string\n"
<         rules += "For class "+self.name+"\n"
<             rules += "If class "+self.name+" is meta, component, connect,
unit, field or fieldValue, the type is array\n"
<             rules += "Compute whether this node has a field declaration:
"+str(foundFieldDeclaration)+"\n"
<                     rules += "If name field is USE: foundUse = True\n"
<                 else:
<                     rules += "foundUse = False\n"
<                     rules += "If name field is childrne: foundChildren =
True\n"
<                 else:
<                     rules += "foundChildren = False\n"
<             rules += "If foundUse, type = object, output @USE+ at class
schema\n"
<         rules += "If foundUse, type = object, regular schema, start
properties\n"
<             rules += "If name "+self.name+" is Script, ShaderProgram or
ShaderPart, emit #sourceCode\n"
<             rules += "If foundFieldDeclaration =
"+foundFieldDeclaration+" emit field property reference pointing at
#/$defs/field\n"
<             rules += "If name "+self.name+" is X3D, emit schema and
encoding properties\n"
<             rules += "If name "+self.name+" is ProtoInstance, emit
-children property\n"
<             rules += "If not foundChildren ==  "+foundChildren+" emit
-children property reference\n"
<             rules += "If self node is not None, start processesing
fields\n"
<                 rules += "If self.hasIs ==  "+self.hasIS+" emit IS
property reference\n"
<                     rules += "If field name starts with X3D, field name
is X3D, or field name is USE\n"
<                             rules += "if field use is required, append
@fieldname to required\n"
<                             rules += "if field name is Scene, append
fieldname and encoding to required\n"
<                         rules += "If field name is address or not (field
starts with add and not field starts with remove)\n"
<                             rules += "If field type is MFNode or field
type is SFNode, catch around the following\n"
<                                     rules += "if field name is a class
and field name is not X3D, emit def for reference for
"+field.get("name")+"\n"
<                                         rules += "if field synonym is not
None, but "+field.get("synonym")+", emit reference\n"
<                                 rules += "Except, emit def for reference
for "+field.get("name")+", with acceptable node types "+
field.get("acceptableNodeTypes").replace("|", "-") + field.get("type")
+'"\n'
<                                     rules += "if field synonym is not
None, but "+field.get("synonym")+", emit reference with acceptable node
types "+ field.get("acceptableNodeTypes").replace("|", "-") +
field.get("type") +'"\n'
<                                 rules += "for containerField, declare
acceptable node types "+ field.get("acceptableNodeTypes").replace("|", "-")
+ field.get("type") +'"\n'
<                                     rules += "If field type is MFNode,
put out $comment with type and accessType, set type to array wiht minItems
1\n"
<                                 rules += "Fill in items in array with
type = object and the followin properties\n"
<                                     rules += "Create #comment type with
string type\n"
<                                 rules += "Get list of acceptable node
types, and add ProtoInstance to the list\n"
<                                 rules += "For each acceptable node type
(or ProtoInstance), add to containerField string\n"
<                                 rules += "No additional properties\n"
<                                     rules += "If field type is MFNode,
end\n"
<                                 rules += "end\n"
<                                 rules += "assign container field for
"+field.get("acceptableNodeTypes").replace("|", "-") + field.get("type")+"
to "+cf+"\n"
<                             rules += "If field name,
"+field.get("name")+" is not USE\n"
<                             rules += "print out field\n"
<                                 rules += "print out synonym\n"
<             rules += "end\n"
<             rules += "required fields: "+(", ").join(required)+"\n"
<         rules += "no additional properties\n"
<             rules += "if foundUse, end, end\n"
<             rules += "If class "+self.name+" is meta, component, connect,
unit, field or fieldValue, end\n"
<         rules += "end\n"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220202/82d36371/attachment.html>


More information about the x3d-public mailing list