[x3d-public] x3d.py roundtrip for Metadata nodes in v.3.3 and v.4.0

Vincent Marchetti vmarchetti at kshell.com
Tue Oct 31 12:39:01 PDT 2023


I have another set of example files reproducing the issue that Andreas and John have identified with creating X3D xml encoding files using the x3d.py package.These examples are a little bit simpler in that the python code which uses the x3d.py is more explicitly available as an illustrative example. I believe it's been clarified in Andreas' and John's messages that the problem is not that x3d.py produces invalid X3D, it is that the X3D output from x3d.py produces valid X3D that does not represent the meaning that the author desired.

As has been noted, the problem arises in representing a MetadataSet node that itself has a non-null metadata field value. 
The file CalendarMetadara.x3d is an X3D file that correctly represents my intent

The relevant X3D fragment from this file is:
<MetadataSet containerField='metadata' name="birthday" reference="https://www.archives.gov/legislative/features/washington">
<MetadataString containerField='metadata' name="calendar" value='"Julian"'/>
<MetadataInteger containerField="value" name="day" value="11"/>
<MetadataInteger containerField="value" name="month" value="2"/>
<MetadataInteger containerField="value" name="year" value="1731"/>

To make the purpose of each Metadata node I have by hand added a containerField xml attribute to each element.
This file is not part of my example set; I am not concerned . at least here, with how this can be converted to python encoding. This file just shows what I am trying to generate using x3d.py


The python code, which I judge should reproduce this example, or at least equivalent X3D depending on choice of defaults, is in file GenerateCalendarMetadata.py, with the relevant section 

    WorldInfo(      metadata = MetadataSet(
                    name="birthday",
                    reference="https://www.archives.gov/legislative/features/washington",
                    metadata=MetadataString(name="calendar", value=["Julian"]),
                    value=[ MetadataInteger(name="day" ,  value=[11]),
                            MetadataInteger(name="month", value=[2]),
                            MetadataInteger(name="year", value=[1731])
                          ]
                    )
            )

The output of the completed script is in file GeneratedCalendarMetadata.x3d, relevant section is:
    
  <MetadataSet name='birthday' reference='http://www.americaslibrary.gov/jb/colonial/jb_colonial_washingtn_2.html'>
        <MetadataString name='calendar' value='"Julian"'/>
        <MetadataInteger name='day' value='11'/>
        <MetadataInteger name='month' value='2'/>
        <MetadataInteger name='year' value='1731'/>
      </MetadataSet>

The point of the example is that there is no general choice of default values of containerField attribute in which this X3D fragment has the same meaning as in CalendarMetadata.x3d or with the intent as represented in the python code.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: CalendarMetadata.x3d
Type: model/x3d+xml
Size: 1175 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231031/1fa87d77/attachment-0002.x3d>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GenerateCalendarMetadata.py
Type: text/x-python-script
Size: 804 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231031/1fa87d77/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GeneratedCalendarMetadata.x3d
Type: model/x3d+xml
Size: 814 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231031/1fa87d77/attachment-0003.x3d>
-------------- next part --------------





Vince Marchetti




More information about the x3d-public mailing list