Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate nested properties when generating DSA from XSD #622

Closed
sirex opened this issue May 27, 2024 · 0 comments · Fixed by #645
Closed

Generate nested properties when generating DSA from XSD #622

sirex opened this issue May 27, 2024 · 0 comments · Fixed by #645

Comments

@sirex
Copy link
Collaborator

sirex commented May 27, 2024

When generating DSA from XSD, generate nested structure for the first element
in XML tree.

For example, if we have following XML file:

<STREETS>
    <STREET id="1" name="Gedimino g.">
        <CITY id="1" name="Vilnius">
            <COUNTRY id="1" name="Lithuania" />
        </CITY>
        <BUILDINGS>
            <BUILDING id="1" number="10" />
            <BUILDING id="1" number="11" />
            <BUILDING id="1" number="12" />
        </BUILDINGS>
    </STREET>
</STREETS>

Then generated DSA should look like this:

d | r | m | property             | type    | ref        | source
example                          |         |            |
  | resource1                    | xml     |            |
  |   | Country                  |         | id         | /STREETS/STREET/CITY/COUNTRY
  |   |   | id                   | integer |            | @id
  |   |   | name@lt              | string  |            | @name
  |   |   |                      |         |            |
  |   | City                     |         | id         | /STREETS/STREET/CITY
  |   |   | id                   | integer |            | @id
  |   |   | name@lt              | string  |            | @name
  |   |   | country              | ref     | Country    | COUNTRY/@id
  |   |   |                      |         |            |
  |   | Building                 |         | id         | /STREETS/STREET/BUILDINGS/BUILDING
  |   |   | id                   | integer |            | @id
  |   |   | number               | string  |            | @number
  |   |   | street               | ref     |            | ../../@id
  |   |   |                      |         |            |
  |   | Street                   |         | id         | /STREETS/STREET
  |   |   | id                   | integer |            | @id
  |   |   | name@lt              | string  |            | @name
  |   |   | city                 | ref     | City       | CITY/@id
  |   |   | city.id              | integer |            | CITY/@id
  |   |   | city.name@lt         | string  |            | CITY/@name
  |   |   | city.country         | ref     | Country    | CITY/COUNTRY/@id
  |   |   | city.country.id      | integer |            | CITY/COUNTRY/@id
  |   |   | city.country.name@lt | string  |            | CITY/COUNTRY/@name
  |   |   | buildings[]          | backref | Building   |
  |   |   | buildings[].id       | integer |            | BUILDINGS/BUILDING/@id
  |   |   | buildings[].name@lt  | string  |            | BUILDINGS/BUILDING/@name
  |   |   | buildings[].street   | ref     | Street     | @id

STREET is the first element in tree, so it has all the nested elements, like
buildings[].name@lt. Other elements in the XML tree have separate models in
DSA, just to be able to reference them from the main Street model.

@karina-klinkeviciute karina-klinkeviciute self-assigned this May 31, 2024
karina-klinkeviciute added a commit that referenced this issue Jun 7, 2024
karina-klinkeviciute added a commit that referenced this issue Jul 5, 2024
karina-klinkeviciute added a commit that referenced this issue Aug 21, 2024
karina-klinkeviciute added a commit that referenced this issue Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants