Skip to content

Commit

Permalink
Adding unique constraints for the elements that actually exists in ou…
Browse files Browse the repository at this point in the history
…r examples (#464)

* Add DatedServiceJourney_UniqueBy_Id_Version

* Lint and update documentation tables

* Add AccessibilityAssessment and AccessibilityLimitation unique constraints

* Lint and update documentation tables

* Add AvailabilityCondition Unique constraint as part of the ValidityCondition constraint

* Put AvailabilityCondition in a new unique constraint because of AvailabilityConditionIdType

* Lint and update documentation tables

* Add DatedVehicleJourney and NormalDatedVehicleJourney constraints

* Add FlexibleRoute, FlexibleQuay, FlexibleLine, FlexibleStopAssignment

* Fix typo

* Fix FlexibleStopAssignment in examples for missing order attribute

* Lint and update documentation tables

* Introduce SitePathLink unique as path of PathLinkIdType

* Introduce unique constraint for ValidityPeriod which uses ValidityConditionIdType

* Introduce unique constraint for ValidDuring which uses AvailabilityConditionIdType

* Introduce unique constraint for ValidyPeriod which uses UsageValidityPeriodIdType, fix ValidBetween

* Fix broken example, due to the assignment within a single unique constraint

* Reintroduce OperatingDay unique constraints

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matthias Günter <[email protected]>
  • Loading branch information
3 people authored Apr 17, 2024
1 parent a3ba1e5 commit de9d705
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ The Calendar is shown coded as
</connections>
<!--- =========STOP ASSIGNMENTs=========== -->
<stopAssignments>
<FlexibleStopAssignment version="any" id="hde:fsa_SSP_021+fsp_Quebec">
<FlexibleStopAssignment version="any" id="hde:fsa_SSP_021+fsp_Quebec" order="1">
<Description lang="en">Assigns Quebec to flexibleHail and ride section</Description>
<ScheduledStopPointRef version="any" ref="mybus:SSP_021"/>
<FlexibleStopPlaceRef version="any" ref="mybus:fsp_Quebec"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ The Calendar is shown coded as
</servicePatterns>
<!--- =========STOP ASSIGNMENTs=========== -->
<stopAssignments>
<FlexibleStopAssignment version="any" id="hde:fsa_SSP_077+fsp_Sigma">
<FlexibleStopAssignment version="any" id="hde:fsa_SSP_077+fsp_Sigma" order="1">
<Description lang="en">Assigns Charley to Tau Zone </Description>
<ScheduledStopPointRef version="any" ref="mybus:SSP_077"/>
<FlexibleStopPlaceRef version="any" ref="mybus:fsp_Tau"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/functions/versioning/Netex_Uniqueness_01.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ This is part 1 of a multistep example on versioning
</operatingDays>
</AvailabilityCondition>
<ValidDuring version="001" id="bar:foo"/>
<ValidBetween version="001" id="bar:foo"/>
<ValidBetween version="001" id="bar:foo2"/>
</validityConditions>
<alternativeTexts>
<AlternativeText version="001" id="bar:foo" attributeName="Name" order="1">
Expand Down
168 changes: 146 additions & 22 deletions xsd/NeTEx_publication.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,12 @@
CR00310 add constraints on JOURNEY PART POSITION
</Date>
<Date><Modified>2017-05-09</Modified>
Correct COnstraints for PointOnRoute
Add Missing Constraints For CommonSectionMember / PointOnSection and LinkOnSection er
Add Missing Constraints For GroupOfServicesMember , JourneyAccounting
DelegatedResponsibilitySet
Reinstate Constraints for CAll
Fix constraints that were missing namespace on subpart
</Date>
Correct Constraints for PointOnRoute
Add Missing Constraints For CommonSectionMember / PointOnSection and LinkOnSection er
Add Missing Constraints For GroupOfServicesMember , JourneyAccounting DelegatedResponsibilitySet
Reinstate Constraints for CAll
Fix constraints that were missing namespace on subpart
</Date>
<Date><Modified>2017-03-27</Modified>
Various 1.1 changes see CRS.
CR0038 revise constraints on ResponsibilityRole
Expand Down Expand Up @@ -3218,6 +3217,14 @@
</xsd:key>
<!-- =====ACCESSIBILITY Constraints========================= -->
<!-- =====AccessibilityAssessment============================ -->
<xsd:unique name="AccessibilityAssessment_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [AccessibilityAssessment Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:AccessibilityAssessment"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<xsd:keyref name="AccessibilityAssessment_AnyKeyRef" refer="netex:AccessibilityAssessment_AnyVersionedKey">
<xsd:selector xpath=".//netex:AccessibilityAssessmentRef"/>
<xsd:field xpath="@ref"/>
Expand All @@ -3228,6 +3235,15 @@
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:key>
<!-- =====AccessibilityLimitation============================ -->
<xsd:unique name="AccessibilityLimitation_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [AccessibilityLimitation Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:AccessibilityLimitation"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<!-- =====SERVICE CALENDAR Constraints========================= -->
<!-- =====DayType============================== -->
<!-- =====DayType unique========================== -->
Expand Down Expand Up @@ -3326,14 +3342,14 @@
</xsd:key>
<!-- =====OperatingDay============================== -->
<!-- =====OperatingDay unique========================== -->
<!-- <xsd:unique name="OperatingDay_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [OperatingDay Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:OperatingDay"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>-->
<xsd:unique name="OperatingDay_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [OperatingDay Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:OperatingDay"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<!-- =====OperatingDay unique==In Calendar======================== -->
<xsd:unique name="OperatingDay_UniqueCalendarDateInCalendar">
<xsd:annotation>
Expand Down Expand Up @@ -3426,7 +3442,7 @@
<xsd:annotation>
<xsd:documentation>Every [ValidityCondition Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:ValidityCondition | .//netex:ValidityTrigger | .//netex:ValidityRuleParameter"/>
<xsd:selector xpath=".//netex:ValidityCondition | .//netex:ValidityTrigger | .//netex:ValidityRuleParameter | .//netex:ValidBetween"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
Expand All @@ -3442,6 +3458,15 @@
<xsd:field xpath="@version"/>
</xsd:key>
<!-- =====AvailabilityCondition============================== -->
<!-- =====AvailabilityCondition unique========================== -->
<xsd:unique name="AvailabilityCondition_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [AvailabilityCondition Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:AvailabilityCondition | .//netex:ValidDuring"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<xsd:keyref name="AvailabilityCondition_AnyKeyRef" refer="netex:AvailabilityCondition_AnyVersionedKey">
<xsd:selector xpath=".//netex:AvailabilityConditionRef"/>
<xsd:field xpath="@ref"/>
Expand Down Expand Up @@ -4286,6 +4311,48 @@
<xsd:field xpath="@version"/>
<xsd:field xpath="@order"/>
</xsd:key>
<!-- =====FlexibleRoute============================== -->
<!-- =====FlexibleRoute unique========================== -->
<xsd:unique name="FlexibleRoute_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [FlexibleRoute Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:FlexibleRoute"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<!-- =====FlexibleRoute Key ========================== -->
<xsd:keyref name="FlexibleRoute_KeyRef" refer="netex:FlexibleRoute_AnyVersionedKey">
<xsd:selector xpath=".//netex:FlexibleRouteRef"/>
<xsd:field xpath="@ref"/>
<xsd:field xpath="@version"/>
</xsd:keyref>
<xsd:key name="FlexibleRoute_AnyVersionedKey">
<xsd:selector xpath=".//netex:FlexibleRoute"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:key>
<!-- =====FlexibleQuay============================== -->
<!-- =====FlexibleQuay unique========================== -->
<xsd:unique name="FlexibleQuay_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [FlexibleQuay Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:FlexibleQuay"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<!-- =====FlexibleQuay Key ========================== -->
<xsd:keyref name="FlexibleQuay_KeyRef" refer="netex:FlexibleQuay_AnyVersionedKey">
<xsd:selector xpath=".//netex:FlexibleQuayRef"/>
<xsd:field xpath="@ref"/>
<xsd:field xpath="@version"/>
</xsd:keyref>
<xsd:key name="FlexibleQuay_AnyVersionedKey">
<xsd:selector xpath=".//netex:FlexibleQuay"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:key>
<!-- =====FlexibleStopPlace============================== -->
<!-- =====FlexibleStopPlace unique========================== -->
<xsd:unique name="FlexibleStopPlace_UniqueBy_Id_Version">
Expand Down Expand Up @@ -4929,7 +4996,7 @@
<xsd:field xpath="@version"/>
<xsd:field xpath="@order"/>
</xsd:key>
<!-- =====CHECK CONSTRAINT COnstraints============== -->
<!-- =====CHECK CONSTRAINT Constraints============== -->
<!-- =====CheckConstraint============================== -->
<!-- =====CheckConstraint unique========================== -->
<xsd:unique name="CheckConstraint_UniqueBy_Id_Version">
Expand Down Expand Up @@ -4993,14 +5060,14 @@
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:key>
<!-- =====PATH COnstraints============== -->
<!-- =====PATH Constraints============== -->
<!-- =====PathLink============================== -->
<!-- =====PathLink unique========================== -->
<xsd:unique name="PathLink_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [PathLink Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:PathLink"/>
<xsd:selector xpath=".//netex:PathLink | .//netex:SitePathLink"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
Expand Down Expand Up @@ -5547,6 +5614,15 @@
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<!-- =====FlexibleLine unique========================== -->
<xsd:unique name="FlexibleLine_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [FlexibleLine Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:FlexibleLine"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<!-- =====Line Key ========================== -->
<xsd:keyref name="Line_KeyRef" refer="netex:Line_AnyVersionedKey">
<xsd:selector xpath=".//netex:LineRef | .//netex:FlexibleLineRef | .//netex:MainLineRef"/>
Expand Down Expand Up @@ -6399,6 +6475,30 @@
<xsd:field xpath="@version"/>
</xsd:key>
<!-- =====STOP ASSIGNMENT Constraints============================== -->
<!-- =====FlexibleStopAssignment============================== -->
<!-- =====FlexibleStopAssignment unique========================== -->
<xsd:unique name="FlexibleStopAssignment_UniqueBy_Id_Version_Order">
<xsd:annotation>
<xsd:documentation>Every [FlexibleStopAssignment Id + Version + order] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:FlexibleStopAssignment"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
<xsd:field xpath="@order"/>
</xsd:unique>
<!-- =====FlexibleStopAssignment Key ========================== -->
<xsd:keyref name="FlexibleStopAssignment_KeyRef" refer="netex:FlexibleStopAssignment_AnyVersionedKey_ordered">
<xsd:selector xpath=".//netex:FlexibleStopAssignmentRef"/>
<xsd:field xpath="@ref"/>
<xsd:field xpath="@version"/>
<xsd:field xpath="@order"/>
</xsd:keyref>
<xsd:key name="FlexibleStopAssignment_AnyVersionedKey_ordered">
<xsd:selector xpath=".//netex:FlexibleStopAssignment"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
<xsd:field xpath="@order"/>
</xsd:key>
<!-- =====PassengerStopAssignment============================== -->
<!-- =====PassengerStopAssignment unique========================== -->
<xsd:unique name="PassengerStopAssignment_UniqueBy_Id_Version_Order">
Expand Down Expand Up @@ -7028,6 +7128,22 @@
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<xsd:unique name="DatedVehicleJourney_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [DatedVehicleJourney Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:DatedVehicleJourney"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<xsd:unique name="NormalDatedVehicleJourney_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [NormalDatedVehicleJourney Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:NormalDatedVehicleJourney"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<xsd:unique name="ServiceJourney_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [ServiceJourney Id + Version] must be unique within document.</xsd:documentation>
Expand All @@ -7036,7 +7152,15 @@
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<xsd:unique name="TemplateVehicleourney_UniqueBy_Id_Version">
<xsd:unique name="DatedServiceJourney_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [DatedServiceJourney Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:DatedServiceJourney"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
<xsd:unique name="TemplateVehicleJourney_UniqueBy_Id_Version">
<xsd:annotation>
<xsd:documentation>Every [TemplateVehicleJourney Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
Expand All @@ -7059,7 +7183,7 @@
<xsd:field xpath="@version"/>
</xsd:keyref>
<xsd:key name="Journey_AnyVersionedKey">
<xsd:selector xpath=".//netex:ServiceJourney | .//netex:VehicleJourney | .//netex:DeadRun | .//netex:SpecialService | .//netex:TemplateServiceJourney | .//netex:DatedServiceJourney"/>
<xsd:selector xpath=".//netex:ServiceJourney | .//netex:VehicleJourney | .//netex:DeadRun | .//netex:SpecialService | .//netex:TemplateServiceJourney | .//netex:DatedServiceJourney | .//netex:DatedVehicleJourney | .//netex:NormalDatedVehicleJourney"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:key>
Expand Down Expand Up @@ -9603,7 +9727,7 @@
<xsd:annotation>
<xsd:documentation>Every [UsageValidityPeriod Id + Version] must be unique within document.</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath=".//netex:UsageValidityPeriod"/>
<xsd:selector xpath=".//netex:UsageValidityPeriod | .//netex:ValidityPeriod"/>
<xsd:field xpath="@id"/>
<xsd:field xpath="@version"/>
</xsd:unique>
Expand Down
Loading

0 comments on commit de9d705

Please sign in to comment.