Skip to content

Commit 9fa9e97

Browse files
authored
Merge pull request #975 from NeTEx-CEN/fix_missing_restriction_attributes
Ensuring all IDs are required by marking them as so in the XSD, along with all restrictions.
2 parents 8f86d3b + e9db2fc commit 9fa9e97

File tree

184 files changed

+15308
-1890
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+15308
-1890
lines changed

scripts/nameofclass.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ def update_nameofclass_ref_attributes(
159159
continue # nothing to add
160160

161161
# --- Generate or replace NameOfClassXXX simpleType in entity_file ---
162-
simple_type_name = f"NameOfClass{ref_name}"
162+
simple_type_name = f"NameOfClass{ref_name}Type"
163+
if simple_type_name == "NameOfClassType":
164+
simple_type_name = "NameOfClass"
163165
existing_st = entity_root.find(
164166
f".//xsd:simpleType[@name='{simple_type_name}']", namespaces=ns
165167
)
@@ -204,8 +206,8 @@ def update_nameofclass_ref_attributes(
204206
if parent_ref_name.endswith('_Dummy'):
205207
parent_ref_name = l[2]
206208

207-
if parent_ref_name == '':
208-
print(ref_name, l)
209+
# if parent_ref_name == '':
210+
# print(ref_name, l)
209211

210212
# print(ref_name, parent_ref_name, l)
211213
# if ref_name == 'LinkRefStructure':
@@ -214,10 +216,15 @@ def update_nameofclass_ref_attributes(
214216
# print(analyzer._get_type_chain(natural_class + "Ref"))
215217
# raise
216218

219+
if parent_ref_name == '':
220+
base = "NameOfClass"
221+
else:
222+
base = f"NameOfClass{parent_ref_name}Type"
223+
217224
restriction = etree.SubElement(
218225
new_simple_type,
219226
"{http://www.w3.org/2001/XMLSchema}restriction",
220-
base=f"NameOfClass{parent_ref_name}",
227+
base=base,
221228
)
222229
for cls in concrete_classes:
223230
etree.SubElement(
@@ -291,13 +298,6 @@ def update_nameofclass_ref_attributes(
291298
base="xsd:string",
292299
)
293300

294-
# --- Add or replace nameOfRefClass attribute ---
295-
existing_attr = parent_for_attr.find(
296-
"{http://www.w3.org/2001/XMLSchema}attribute[@name='nameOfRefClass']"
297-
)
298-
if existing_attr is not None:
299-
parent_for_attr.remove(existing_attr)
300-
301301
attrib = etree.Element(
302302
"{http://www.w3.org/2001/XMLSchema}attribute",
303303
name="nameOfRefClass",
@@ -317,7 +317,17 @@ def update_nameofclass_ref_attributes(
317317
)
318318
doc.text = f"Automatic reference class for {ref_name}"
319319

320-
parent_for_attr.append(attrib)
320+
# --- Add or replace nameOfRefClass attribute ---
321+
existing_attr = parent_for_attr.find(
322+
"{http://www.w3.org/2001/XMLSchema}attribute[@name='nameOfRefClass']"
323+
)
324+
if existing_attr is not None:
325+
index = parent_for_attr.index(existing_attr)
326+
parent_for_attr.remove(existing_attr)
327+
parent_for_attr.insert(index, attrib)
328+
else:
329+
parent_for_attr.append(attrib)
330+
321331
modified = True
322332
else:
323333
print(f"WARNING: {ref_name} has an unknown {natural_class}. Skipping")

xsd/netex_framework/netex_frames/netex_compositeFrame_version.xsd

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,27 @@ Rail transport, Roads and Road transport
7777
<xsd:documentation>Identifier of a COMPOSITE FRAME.</xsd:documentation>
7878
</xsd:annotation>
7979
</xsd:attribute>
80-
<xsd:attribute name="nameOfRefClass" type="NameOfClassCompositeFrameRefStructure" default="CompositeFrame">
80+
<xsd:attribute name="nameOfRefClass" type="NameOfClassCompositeFrameRefStructureType" default="CompositeFrame">
8181
<xsd:annotation>
8282
<xsd:documentation>Automatic reference class for CompositeFrameRefStructure</xsd:documentation>
8383
</xsd:annotation>
8484
</xsd:attribute>
85+
<xsd:attribute name="modification" type="ModificationEnumeration" use="optional">
86+
<xsd:annotation>
87+
<xsd:documentation>Nature of last modification: new, revise, delete, unchanged.</xsd:documentation>
88+
</xsd:annotation>
89+
</xsd:attribute>
90+
<xsd:attribute name="versionRef" type="VersionIdType" use="optional">
91+
<xsd:annotation>
92+
<xsd:documentation>Identifier of version of referenced entity. For use when reference is External and a specific version is required. Mutually exclusive with version</xsd:documentation>
93+
</xsd:annotation>
94+
</xsd:attribute>
95+
<xsd:attribute name="uri" type="xsd:anyURI" use="optional">
96+
<xsd:annotation>
97+
<xsd:documentation>Location of the external entity. +v2.0</xsd:documentation>
98+
</xsd:annotation>
99+
</xsd:attribute>
100+
<xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
85101
</xsd:restriction>
86102
</xsd:simpleContent>
87103
</xsd:complexType>

xsd/netex_framework/netex_frames/netex_generalFrame_version.xsd

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,27 @@ Rail transport, Roads and Road transport
123123
<xsd:documentation>Identifier of a GENERAL FRAME.</xsd:documentation>
124124
</xsd:annotation>
125125
</xsd:attribute>
126-
<xsd:attribute name="nameOfRefClass" type="NameOfClassGeneralFrameRefStructure" default="GeneralFrame">
126+
<xsd:attribute name="nameOfRefClass" type="NameOfClassGeneralFrameRefStructureType" default="GeneralFrame">
127127
<xsd:annotation>
128128
<xsd:documentation>Automatic reference class for GeneralFrameRefStructure</xsd:documentation>
129129
</xsd:annotation>
130130
</xsd:attribute>
131+
<xsd:attribute name="modification" type="ModificationEnumeration" use="optional">
132+
<xsd:annotation>
133+
<xsd:documentation>Nature of last modification: new, revise, delete, unchanged.</xsd:documentation>
134+
</xsd:annotation>
135+
</xsd:attribute>
136+
<xsd:attribute name="versionRef" type="VersionIdType" use="optional">
137+
<xsd:annotation>
138+
<xsd:documentation>Identifier of version of referenced entity. For use when reference is External and a specific version is required. Mutually exclusive with version</xsd:documentation>
139+
</xsd:annotation>
140+
</xsd:attribute>
141+
<xsd:attribute name="uri" type="xsd:anyURI" use="optional">
142+
<xsd:annotation>
143+
<xsd:documentation>Location of the external entity. +v2.0</xsd:documentation>
144+
</xsd:annotation>
145+
</xsd:attribute>
146+
<xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
131147
</xsd:restriction>
132148
</xsd:simpleContent>
133149
</xsd:complexType>
@@ -218,11 +234,32 @@ Rail transport, Roads and Road transport
218234
</xsd:annotation>
219235
<xsd:simpleContent>
220236
<xsd:restriction base="VersionOfObjectRefStructure">
221-
<xsd:attribute name="nameOfRefClass" type="NameOfClassGeneralFrameMemberRefStructure" default="GeneralFrameMember">
237+
<xsd:attribute name="nameOfRefClass" type="NameOfClassGeneralFrameMemberRefStructureType" default="GeneralFrameMember">
222238
<xsd:annotation>
223239
<xsd:documentation>Automatic reference class for GeneralFrameMemberRefStructure</xsd:documentation>
224240
</xsd:annotation>
225241
</xsd:attribute>
242+
<xsd:attribute name="modification" type="ModificationEnumeration" use="optional">
243+
<xsd:annotation>
244+
<xsd:documentation>Nature of last modification: new, revise, delete, unchanged.</xsd:documentation>
245+
</xsd:annotation>
246+
</xsd:attribute>
247+
<xsd:attribute name="ref" type="ObjectIdType" use="required">
248+
<xsd:annotation>
249+
<xsd:documentation>Identifier of referenced entity.</xsd:documentation>
250+
</xsd:annotation>
251+
</xsd:attribute>
252+
<xsd:attribute name="versionRef" type="VersionIdType" use="optional">
253+
<xsd:annotation>
254+
<xsd:documentation>Identifier of version of referenced entity. For use when reference is External and a specific version is required. Mutually exclusive with version</xsd:documentation>
255+
</xsd:annotation>
256+
</xsd:attribute>
257+
<xsd:attribute name="uri" type="xsd:anyURI" use="optional">
258+
<xsd:annotation>
259+
<xsd:documentation>Location of the external entity. +v2.0</xsd:documentation>
260+
</xsd:annotation>
261+
</xsd:attribute>
262+
<xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
226263
</xsd:restriction>
227264
</xsd:simpleContent>
228265
</xsd:complexType>

xsd/netex_framework/netex_frames/netex_resourceFrame_support.xsd

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,27 @@ Rail transport, Roads and Road transport
7676
<xsd:documentation>Identifier of referenced entity.</xsd:documentation>
7777
</xsd:annotation>
7878
</xsd:attribute>
79-
<xsd:attribute name="nameOfRefClass" type="NameOfClassResourceFrameRefStructure" default="ResourceFrame">
79+
<xsd:attribute name="nameOfRefClass" type="NameOfClassResourceFrameRefStructureType" default="ResourceFrame">
8080
<xsd:annotation>
8181
<xsd:documentation>Automatic reference class for ResourceFrameRefStructure</xsd:documentation>
8282
</xsd:annotation>
8383
</xsd:attribute>
84+
<xsd:attribute name="modification" type="ModificationEnumeration" use="optional">
85+
<xsd:annotation>
86+
<xsd:documentation>Nature of last modification: new, revise, delete, unchanged.</xsd:documentation>
87+
</xsd:annotation>
88+
</xsd:attribute>
89+
<xsd:attribute name="versionRef" type="VersionIdType" use="optional">
90+
<xsd:annotation>
91+
<xsd:documentation>Identifier of version of referenced entity. For use when reference is External and a specific version is required. Mutually exclusive with version</xsd:documentation>
92+
</xsd:annotation>
93+
</xsd:attribute>
94+
<xsd:attribute name="uri" type="xsd:anyURI" use="optional">
95+
<xsd:annotation>
96+
<xsd:documentation>Location of the external entity. +v2.0</xsd:documentation>
97+
</xsd:annotation>
98+
</xsd:attribute>
99+
<xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
84100
</xsd:restriction>
85101
</xsd:simpleContent>
86102
</xsd:complexType>

xsd/netex_framework/netex_frames/netex_serviceCalendarFrame_support.xsd

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,27 @@ Rail transport, Roads and Road transport
8282
<xsd:documentation>Identifier of SERVICE CALENDAR FRAME.</xsd:documentation>
8383
</xsd:annotation>
8484
</xsd:attribute>
85-
<xsd:attribute name="nameOfRefClass" type="NameOfClassServiceCalendarFrameRefStructure" default="ServiceCalendarFrame">
85+
<xsd:attribute name="nameOfRefClass" type="NameOfClassServiceCalendarFrameRefStructureType" default="ServiceCalendarFrame">
8686
<xsd:annotation>
8787
<xsd:documentation>Automatic reference class for ServiceCalendarFrameRefStructure</xsd:documentation>
8888
</xsd:annotation>
8989
</xsd:attribute>
90+
<xsd:attribute name="modification" type="ModificationEnumeration" use="optional">
91+
<xsd:annotation>
92+
<xsd:documentation>Nature of last modification: new, revise, delete, unchanged.</xsd:documentation>
93+
</xsd:annotation>
94+
</xsd:attribute>
95+
<xsd:attribute name="versionRef" type="VersionIdType" use="optional">
96+
<xsd:annotation>
97+
<xsd:documentation>Identifier of version of referenced entity. For use when reference is External and a specific version is required. Mutually exclusive with version</xsd:documentation>
98+
</xsd:annotation>
99+
</xsd:attribute>
100+
<xsd:attribute name="uri" type="xsd:anyURI" use="optional">
101+
<xsd:annotation>
102+
<xsd:documentation>Location of the external entity. +v2.0</xsd:documentation>
103+
</xsd:annotation>
104+
</xsd:attribute>
105+
<xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
90106
</xsd:restriction>
91107
</xsd:simpleContent>
92108
</xsd:complexType>

xsd/netex_framework/netex_genericFramework/netex_accessibility/netex_acsb_support.xsd

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,27 @@ Rail transport, Roads and Road transport
7272
<xsd:documentation>Identifier of referenced entity.</xsd:documentation>
7373
</xsd:annotation>
7474
</xsd:attribute>
75+
<xsd:attribute name="nameOfRefClass" type="NameOfClass" use="optional">
76+
<xsd:annotation>
77+
<xsd:documentation>Name of Class of the referenced entity. Allows reflection. Fixed for each entity type.</xsd:documentation>
78+
</xsd:annotation>
79+
</xsd:attribute>
80+
<xsd:attribute name="modification" type="ModificationEnumeration" use="optional">
81+
<xsd:annotation>
82+
<xsd:documentation>Nature of last modification: new, revise, delete, unchanged.</xsd:documentation>
83+
</xsd:annotation>
84+
</xsd:attribute>
85+
<xsd:attribute name="versionRef" type="VersionIdType" use="optional">
86+
<xsd:annotation>
87+
<xsd:documentation>Identifier of version of referenced entity. For use when reference is External and a specific version is required. Mutually exclusive with version</xsd:documentation>
88+
</xsd:annotation>
89+
</xsd:attribute>
90+
<xsd:attribute name="uri" type="xsd:anyURI" use="optional">
91+
<xsd:annotation>
92+
<xsd:documentation>Location of the external entity. +v2.0</xsd:documentation>
93+
</xsd:annotation>
94+
</xsd:attribute>
95+
<xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
7596
</xsd:restriction>
7697
</xsd:simpleContent>
7798
</xsd:complexType>
@@ -98,11 +119,27 @@ Rail transport, Roads and Road transport
98119
<xsd:documentation>Identifier of referenced entity.</xsd:documentation>
99120
</xsd:annotation>
100121
</xsd:attribute>
101-
<xsd:attribute name="nameOfRefClass" type="NameOfClassAccessibilityAssessmentRefStructure" default="AccessibilityAssessment">
122+
<xsd:attribute name="nameOfRefClass" type="NameOfClassAccessibilityAssessmentRefStructureType" default="AccessibilityAssessment">
102123
<xsd:annotation>
103124
<xsd:documentation>Automatic reference class for AccessibilityAssessmentRefStructure</xsd:documentation>
104125
</xsd:annotation>
105126
</xsd:attribute>
127+
<xsd:attribute name="modification" type="ModificationEnumeration" use="optional">
128+
<xsd:annotation>
129+
<xsd:documentation>Nature of last modification: new, revise, delete, unchanged.</xsd:documentation>
130+
</xsd:annotation>
131+
</xsd:attribute>
132+
<xsd:attribute name="versionRef" type="VersionIdType" use="optional">
133+
<xsd:annotation>
134+
<xsd:documentation>Identifier of version of referenced entity. For use when reference is External and a specific version is required. Mutually exclusive with version</xsd:documentation>
135+
</xsd:annotation>
136+
</xsd:attribute>
137+
<xsd:attribute name="uri" type="xsd:anyURI" use="optional">
138+
<xsd:annotation>
139+
<xsd:documentation>Location of the external entity. +v2.0</xsd:documentation>
140+
</xsd:annotation>
141+
</xsd:attribute>
142+
<xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
106143
</xsd:restriction>
107144
</xsd:simpleContent>
108145
</xsd:complexType>

xsd/netex_framework/netex_genericFramework/netex_alternativeName_support.xsd

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,27 @@ Rail transport, Roads and Road transport
7878
<xsd:documentation>Identifier of an ALTERNATIVE NAME.</xsd:documentation>
7979
</xsd:annotation>
8080
</xsd:attribute>
81-
<xsd:attribute name="nameOfRefClass" type="NameOfClassAlternativeNameRefStructure" default="AlternativeName">
81+
<xsd:attribute name="nameOfRefClass" type="NameOfClassAlternativeNameRefStructureType" default="AlternativeName">
8282
<xsd:annotation>
8383
<xsd:documentation>Automatic reference class for AlternativeNameRefStructure</xsd:documentation>
8484
</xsd:annotation>
8585
</xsd:attribute>
86+
<xsd:attribute name="modification" type="ModificationEnumeration" use="optional">
87+
<xsd:annotation>
88+
<xsd:documentation>Nature of last modification: new, revise, delete, unchanged.</xsd:documentation>
89+
</xsd:annotation>
90+
</xsd:attribute>
91+
<xsd:attribute name="versionRef" type="VersionIdType" use="optional">
92+
<xsd:annotation>
93+
<xsd:documentation>Identifier of version of referenced entity. For use when reference is External and a specific version is required. Mutually exclusive with version</xsd:documentation>
94+
</xsd:annotation>
95+
</xsd:attribute>
96+
<xsd:attribute name="uri" type="xsd:anyURI" use="optional">
97+
<xsd:annotation>
98+
<xsd:documentation>Location of the external entity. +v2.0</xsd:documentation>
99+
</xsd:annotation>
100+
</xsd:attribute>
101+
<xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
86102
</xsd:restriction>
87103
</xsd:simpleContent>
88104
</xsd:complexType>

xsd/netex_framework/netex_genericFramework/netex_assignment_support.xsd

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,27 @@ Rail transport, Roads and Road transport
7474
<xsd:documentation>Identifier of referenced entity.</xsd:documentation>
7575
</xsd:annotation>
7676
</xsd:attribute>
77-
<xsd:attribute name="nameOfRefClass" type="NameOfClassAssignmentRefStructure">
77+
<xsd:attribute name="nameOfRefClass" type="NameOfClassAssignmentRefStructureType">
7878
<xsd:annotation>
7979
<xsd:documentation>Automatic reference class for AssignmentRefStructure</xsd:documentation>
8080
</xsd:annotation>
8181
</xsd:attribute>
82+
<xsd:attribute name="modification" type="ModificationEnumeration" use="optional">
83+
<xsd:annotation>
84+
<xsd:documentation>Nature of last modification: new, revise, delete, unchanged.</xsd:documentation>
85+
</xsd:annotation>
86+
</xsd:attribute>
87+
<xsd:attribute name="versionRef" type="VersionIdType" use="optional">
88+
<xsd:annotation>
89+
<xsd:documentation>Identifier of version of referenced entity. For use when reference is External and a specific version is required. Mutually exclusive with version</xsd:documentation>
90+
</xsd:annotation>
91+
</xsd:attribute>
92+
<xsd:attribute name="uri" type="xsd:anyURI" use="optional">
93+
<xsd:annotation>
94+
<xsd:documentation>Location of the external entity. +v2.0</xsd:documentation>
95+
</xsd:annotation>
96+
</xsd:attribute>
97+
<xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
8298
</xsd:restriction>
8399
</xsd:simpleContent>
84100
</xsd:complexType>

0 commit comments

Comments
 (0)