Skip to content

Fix AccessEquipmentRef#168

Merged
skinkie merged 5 commits intomasterfrom
fix_access_equipmentref
Apr 15, 2022
Merged

Fix AccessEquipmentRef#168
skinkie merged 5 commits intomasterfrom
fix_access_equipmentref

Conversation

@skinkie
Copy link
Copy Markdown
Contributor

@skinkie skinkie commented Apr 25, 2021

Fix #167

(see issue, for documentation)

@skinkie skinkie added enhancement non semantic enhacement: technical enhancement, etc. bug Technical mistake, inconsistency with the documentation, etc. and removed enhancement non semantic enhacement: technical enhancement, etc. labels Apr 25, 2021
@Aurige
Copy link
Copy Markdown
Contributor

Aurige commented Apr 26, 2021

I approved this fix since it makes sense, but it may have some consequences on existing datasets (but quite unlikely since Equipment or not widely used yet)

@syversenkr
Copy link
Copy Markdown
Contributor

Hopefully I am not missing something here, but from what I can see in the XSD this bug fix will only allow for references previously not part of the placeEquipments refenece substitution (InstalledEquipmentRef), i.e. the AccessEquipmentRef subtypes. The element types themselves where already correctly of InstalledEquipment substitution type.

On the other hand: In order to align with the UML/spec, it seems these references should more appropriately have been of a PlaceEquipment(Ref) substitution group.

@syversenkr
Copy link
Copy Markdown
Contributor

equipment-highlight

On the other hand, both the InstalledEquipment type/ref and PlaceEquipment type/ref are abstract conceptual classes of super Equipment type/ref, and this has no practical implication other than adding an extra level of dummy element/reference in the XSD.

syversenkr
syversenkr approved these changes Apr 26, 2021
@skinkie
Copy link
Copy Markdown
Contributor Author

skinkie commented Apr 26, 2021

@syversenkr I did not find a PlaceEquipmentStructure did you?,

@syversenkr
Copy link
Copy Markdown
Contributor

syversenkr commented Apr 26, 2021

No, it is not yet added. A technical shortcut when implementing, I presume.

I believe there are similar technical simplifications elsewhere in the code, if we want to reflect this particular additional layer I can add it to the branch.

@skinkie
Copy link
Copy Markdown
Contributor Author

skinkie commented Apr 26, 2021

No, it was not yet added. A technical shortcut when implementing, I presume.

I can add if we want to reflect this additional layer.

I am checking SiteEquipmentRef and SignEquipmentRef which have exactly the same problem.

<xsd:element name="SiteEquipmentRef" type="SiteEquipmentRefStructure" substitutionGroup="EquipmentRef">
<xsd:element name="SignEquipmentRef" type="EquipmentRefStructure" substitutionGroup="EquipmentRef">

So the question is, should we create the PlaceEquipment as substitution?

@syversenkr
Copy link
Copy Markdown
Contributor

syversenkr commented Apr 26, 2021

Commit 047c548:
Should be specified as abstract, as its implementation type AccessEquipment_VersionStructure is abstract, and adding AccessEquipment as an explicit element in a list of AccessEquipment type elements is already inherently invalid.

PlaceEquipment substitution type:
Both results in the same XML, so no technical impact if wrapping in one or two abstract classes. More a discussion if worth the effort, i.e. should the XSD implement the spec technically or as close to the model as possible.

However, the additional incorrect references with substitution group Equipment should be fixed as part of this commit.

</xsd:group>
<!-- ====ACCESS=================================================================== -->
<xsd:element name="AccessEquipment" type="AccessEquipment_VersionStructure" substitutionGroup="InstalledEquipment">
<xsd:element name="AccessEquipment" type="AccessEquipment_VersionStructure" abstract="true" substitutionGroup="InstalledEquipment">
Copy link
Copy Markdown
Contributor Author

@skinkie skinkie Apr 26, 2021

Choose a reason for hiding this comment

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

What does this 'abstract' mean? "Optional. Specifies whether the element can be used in an instance document. True indicates that the element cannot appear in the instance document. Instead, another element whose substitutionGroup attribute contains the qualified name (QName) of this element must appear in this element's place. Default is false"

Copy link
Copy Markdown
Contributor

@syversenkr syversenkr Apr 26, 2021

Choose a reason for hiding this comment

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

see comment above
This is inherently abstract per type implementation, practical implication is that currently you can add AccessEquipment as a list element (and it is proposed as a code completion option in e.g. oXygen and XMLspy), but if you do add an explicit AccessEquipment element rather than one of its implementable subtypes you get a validation error.

Copy link
Copy Markdown
Contributor

@syversenkr syversenkr Apr 26, 2021

Choose a reason for hiding this comment

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

Before fix:

AccessEquipment-list-element

Adding as list element => Validation error: "The type definition cannot be abstract for element AccessEquipment."

@skinkie
Copy link
Copy Markdown
Contributor Author

skinkie commented Apr 26, 2021

@nick-knowles can you comment on the question @syversenkr raises?

@skinkie skinkie marked this pull request as draft April 26, 2021 20:16
@syversenkr
Copy link
Copy Markdown
Contributor

The question being: Should we create the PlaceEquipment as substitution to align with the UML model? Or keep the simpler implementation, skipping abstract types when it does not have a practical implication?

@Aurige
Copy link
Copy Markdown
Contributor

Aurige commented Apr 26, 2021

The question being: Should we create the PlaceEquipment as substitution to align with the UML model? Or keep the simpler implementation, skipping abstract types when it does not have a practical implication?

I would keep it simple

@skinkie
Copy link
Copy Markdown
Contributor Author

skinkie commented May 12, 2021

I think the only practical implementation this will have is if we are to be generating UML diagrams from the XSD, it must be modeled.

@skinkie
Copy link
Copy Markdown
Contributor Author

skinkie commented May 21, 2021

I suggest we are going to do PlantUML, hence do it via the long way.

@nick-knowles
Copy link
Copy Markdown
Contributor

The AccessEquipment should also be abstract (not just the AccessEquipmentRef)

@nick-knowles
Copy link
Copy Markdown
Contributor

XML has some almost unfathomable extra restrictions on type substitution, so it is not always possible to simply encode the UML.

@ue71603
Copy link
Copy Markdown
Contributor

ue71603 commented Jan 4, 2022

@skinkie This is still blocked?

@skinkie
Copy link
Copy Markdown
Contributor Author

skinkie commented Jan 4, 2022

@skinkie This is still blocked?

Not blocked, but a suggestion what a solution would be, would be appreciated. I am happy to add abstract=true to all the blue classes.

@ue71603
Copy link
Copy Markdown
Contributor

ue71603 commented Jan 4, 2022

@Aurige @nick-knowles : Could you give your opinion to Stefan?

@Aurige
Copy link
Copy Markdown
Contributor

Aurige commented Jan 4, 2022

yes according to the UML they look abstract

<xsd:documentation>Type for a reference to an ACCESS EQUIPMENT.</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:restriction base="EquipmentRefStructure">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is done in #293

<xsd:documentation>Type for a reference to an ACCESS EQUIPMENT.</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:restriction base="EquipmentRefStructure">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is done in #293

</xsd:sequence>
</xsd:group>
<!-- ====ACCESS=================================================================== -->
<xsd:element name="AccessEquipment" type="AccessEquipment_VersionStructure" substitutionGroup="InstalledEquipment">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

already done in master

</xsd:sequence>
</xsd:group>
<!-- ====ACCESS=================================================================== -->
<xsd:element name="AccessEquipment" type="AccessEquipment_VersionStructure" substitutionGroup="InstalledEquipment">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

already done in master

<xsd:restriction base="InstalledEquipmentRefStructure">
<xsd:attribute name="ref" type="AccessEquipmentIdType" use="required">
<xsd:annotation>
<xsd:documentation>Identifier of a TICKETING EQUIPMENT.</xsd:documentation>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wrong in master. This some documentation change should be done.

<xsd:restriction base="InstalledEquipmentRefStructure">
<xsd:attribute name="ref" type="AccessEquipmentIdType" use="required">
<xsd:annotation>
<xsd:documentation>Identifier of a TICKETING EQUIPMENT.</xsd:documentation>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wrong in master. This some documentation change should be done.

</xsd:annotation>
<xsd:restriction base="InstalledEquipmentIdType"/>
</xsd:simpleType>
<xsd:element name="AccessEquipmentRef" type="AccessEquipmentRefStructure" substitutionGroup="EquipmentRef">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is new. It currently works with EquipmentRef (as this is the more generalized class). However, to be very in line, whe should probably keep this change. How pedantic do we want to be.

</xsd:annotation>
<xsd:restriction base="InstalledEquipmentIdType"/>
</xsd:simpleType>
<xsd:element name="AccessEquipmentRef" type="AccessEquipmentRefStructure" substitutionGroup="EquipmentRef">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is new. It currently works with EquipmentRef (as this is the more generalized class). However, to be very in line, whe should probably keep this change. How pedantic do we want to be.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

https://github.com/NeTEx-CEN/NeTEx/pull/293/files contains an example. Therefore it should break master, if we have a problem there.

Copy link
Copy Markdown
Contributor

@ue71603 ue71603 left a comment

Choose a reason for hiding this comment

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

Changing <xsd:element name="AccessEquipmentRef" type="AccessEquipmentRefStructure" substitutionGroup="EquipmentRef"> we should consider. Correcting the documentation TICKETING to ACCESS. The rest should be thrown out.

@ue71603 ue71603 assigned skinkie and unassigned nick-knowles and Aurige Apr 14, 2022
@skinkie skinkie marked this pull request as ready for review April 15, 2022 21:08
@skinkie skinkie requested a review from ue71603 April 15, 2022 21:15
@skinkie skinkie dismissed ue71603’s stale review April 15, 2022 21:17

Already fixed

@skinkie skinkie merged commit 45162f2 into master Apr 15, 2022
erlendnils1 pushed a commit to entur/NeTEx that referenced this pull request Jun 29, 2023
* Fix AccessEquipmentRef

Fix TransmodelEcosystem#167

* Should be abstract as this element cannot be implemented (only its subtypes can)

* Honest attempt to change the model to the UML description.

Co-authored-by: Kristian Syversen <kristian.syversen@entur.org>
erlendnils1 pushed a commit to entur/NeTEx that referenced this pull request Oct 31, 2023
* Fix AccessEquipmentRef

Fix TransmodelEcosystem#167

* Should be abstract as this element cannot be implemented (only its subtypes can)

* Honest attempt to change the model to the UML description.

Co-authored-by: Kristian Syversen <kristian.syversen@entur.org>
@skinkie skinkie deleted the fix_access_equipmentref branch November 19, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Technical mistake, inconsistency with the documentation, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FIX] AccessEquipmentRef incorrently subsitutes EquipmentRef

5 participants