Skip to content

Remove unique constraints, because we have xsd:key#998

Open
skinkie wants to merge 8 commits intov2.0from
v2_remove_unique
Open

Remove unique constraints, because we have xsd:key#998
skinkie wants to merge 8 commits intov2.0from
v2_remove_unique

Conversation

@skinkie
Copy link
Contributor

@skinkie skinkie commented Feb 26, 2026

Fix #994

With unique constraints:

real	4m5.527s
user	3m57.850s
sys	0m1.706s

Without unique constraints:

real	2m44.075s
user	2m39.062s
sys	0m1.093s

@skinkie skinkie self-assigned this Feb 26, 2026
@skinkie skinkie added the hygiene Technical dept, results in a breaking change. label Feb 26, 2026
@TuThoThai TuThoThai modified the milestones: netex_2.0, netex_2.1 Feb 26, 2026
@ue71603 ue71603 requested a review from trurlurl February 26, 2026 14:43
ue71603
ue71603 previously approved these changes Feb 26, 2026
trurlurl
trurlurl previously approved these changes Feb 27, 2026
@TuThoThai
Copy link
Collaborator

@skinkie,
Considering it is not a bug fix, only a redundance, would you prefer to it to be release with 2.0.1 or 2.1? In the latter case, we only change the target branch.
🙏

@skinkie
Copy link
Contributor Author

skinkie commented Mar 7, 2026

2.0.1

@TuThoThai TuThoThai modified the milestones: netex_2.1, netex_2.0 Mar 7, 2026
@thbar
Copy link
Collaborator

thbar commented Mar 8, 2026

I had a first look locally today; the branch is not up-to-date anymore, so I'll push the "update from v2.0" from my machine. @TuThoThai in order for GitHub to detect that a branch is not up-to-date, we'll have to (re?)-enable "check status updates" first.

For both files:
* adding in the metadata the changes made most recently on ref / key constraints
* changing status from 1.0 to 2.0
@TuThoThai TuThoThai dismissed stale reviews from ue71603 and trurlurl via 7a32074 March 8, 2026 15:05
@TuThoThai
Copy link
Collaborator

@skinkie, great work on this one! It definitly helped a lot with the validation speed, but also made the Schema much faster to load with tools like XMLSpy

I made a tiny commit to:

  • add your work on ref / constraints in the metadata
  • changed the status to 2.0

TuThoThai
TuThoThai previously approved these changes Mar 8, 2026
TuThoThai
TuThoThai previously approved these changes Mar 8, 2026
Copy link
Collaborator

@thbar thbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did manual + automated (AI) reviews. The vast majority (> 97%) of the stuff seems right to me. I have questions on a few remaining cases.

Can someone with more historical or functional context comment on these? (@skinkie and others!).

Unsure at this point if these are false positives / issues with the review, or something that deserves actual changes possibly.

Potentially (???) missing xsd:key Replacements

  • AlternativeName_UniqueBy_Id_Version_useForLanguage_ordered - Alternative names with language/order constraint
  • AlternativeText_UniqueBy_Id_AttributeName_UseForLanguage_Version - Alternative text with 4-field uniqueness (@id, @attributeName, @useForLanguage, @version)
  • Vehicle_UniqueRegistrationNumber - Vehicle registration number uniqueness constraint
  • Call_UniqueBy_Id_Version_Order - Call element uniqueness with ordering
  • DynamicDistanceMatrixElement_UniqueBy_Id_Version - Dynamic distance matrix element constraint

@thbar
Copy link
Collaborator

thbar commented Mar 9, 2026

And a quick performance test. It looks on this specific test we're back to v1.3.1 performance level. Nice work @skinkie, thanks for tackling this out.

❯ elixir compare.exs
xmllint --noout --schema NeTEx-v1.3.1/xsd/NeTEx_publication.xsd data/fr-nap-idfm.zip.unpack/arrets.xml 2>&1
NeTEx-v1.3.1 took 99.970771 seconds
xmllint --noout --schema NeTEx-v2.0.0/xsd/NeTEx_publication.xsd data/fr-nap-idfm.zip.unpack/arrets.xml 2>&1
NeTEx-v2.0.0 took 127.551984 seconds
xmllint --noout --schema NeTEx-v2_remove_unique/xsd/NeTEx_publication.xsd data/fr-nap-idfm.zip.unpack/arrets.xml 2>&1
NeTEx-v2_remove_unique took 100.858296 seconds

@Aurige
Copy link
Contributor

Aurige commented Mar 9, 2026

I did manual + automated (AI) reviews. The vast majority (> 97%) of the stuff seems right to me. I have questions on a few remaining cases.

Can someone with more historical or functional context comment on these? (@skinkie and others!).

Unsure at this point if these are false positives / issues with the review, or something that deserves actual changes possibly.

Potentially (???) missing xsd:key Replacements

* AlternativeName_UniqueBy_Id_Version_useForLanguage_ordered - Alternative names with language/order constraint

* AlternativeText_UniqueBy_Id_AttributeName_UseForLanguage_Version - Alternative text with 4-field uniqueness (`@id`, `@attributeName`, `@useForLanguage`, `@version`)

* Vehicle_UniqueRegistrationNumber - Vehicle registration number uniqueness constraint

* Call_UniqueBy_Id_Version_Order - Call element uniqueness with ordering

* DynamicDistanceMatrixElement_UniqueBy_Id_Version - Dynamic distance matrix element constraint

You are right @thbar whenever there is a unique, but no corresponding key, we need to keep the unique (unless there is a functional reason to drop it) .. so these unique need to be brought back (I only check a few from your list, but the principle is Ok)

@ue71603 ue71603 self-requested a review March 9, 2026 13:46
ue71603
ue71603 previously approved these changes Mar 9, 2026
@thbar
Copy link
Collaborator

thbar commented Mar 10, 2026

Ping @TuThoThai @skinkie @ue71603 regarding the potentially missing constraints (#998 (review)): for each of them, do you see the same issue as me? Do you consider we need to add a xsd:key for those, business-wise?

(I will try to look a bit closer as time permits, but your input will be definitely worthy).

@TuThoThai
Copy link
Collaborator

TuThoThai commented Mar 13, 2026

As of 13 March 2026:

  • roll back the deletion of unique constraints on AlternativeName, AlternativeText, Vehicle_UniqueRegistrationNumber, Call, DynamicDistanceMatrixElement
  • assess if any other are missing

@ue71603, @thbar & @TuThoThai

@TuThoThai TuThoThai self-requested a review March 21, 2026 19:22
NeTEx_publication.xsd: Roll-back for deletion of unique contraints that were not duplicated with key contraints
@TuThoThai TuThoThai dismissed stale reviews from ue71603 and themself via 83c522b March 21, 2026 20:28
NeTEx_publication_timetable.xsd : roll-back on deletion of unique constraints when there is no key constraints
@TuThoThai
Copy link
Collaborator

@skinkie, @thbar, @ue71603, I rolled-back some the deleted unique contraints when there was no matching ley contraints in 2 commits:

  • 83c522b is for NeTEx_publication.xsd
  • 9225c05 is of NeTEx_publication_timetable.xsd

TuThoThai
TuThoThai previously approved these changes Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hygiene Technical dept, results in a breaking change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redundant "key" and "unique" constraints

6 participants