Ticket #176 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

XML based Data Context Strategy

Reported by: kasper Owned by: kasper
Priority: high Milestone: MetaModel 1.1
Component: MetaModel Keywords:
Cc:
Influenced classes:

Description

Based on this discussion, we should add support for normalizing XML nodes into tables with relations and thereby including XML support in MetaModel.

Change History

comment:1 Changed 2 years ago by kasper

To clarify with an example, the following XML

<eobjects.dk website="http://www.eobjects.dk">
  <contributors>
    <person>
      <name>kasper</name>
      <address>My address</address>
      <address>Another address</address>
      <address>A third address</address>
    </person>
    <person>
      <name>asbjorn</name>
      <address>Asbjorns address</address>
    </person>
  </contributors>
  <projects>
    <project name="datacleaner">
      Here's a short description of DataCleaner, the the one for MetaModel is missing...
    </project>
    <project name="MetaModel" />
  </projects>
</eobjects.dk>

should be normalized as the following tables:

eobjects.dk

id website
1  http://www.eobjects.dk

contributors and projects should be omitted, since they have no attributes and no siblings.

contributors_person

id name
1 kasper
2 asbjorn

contributors_person_address

id address contributors_person_id
1 My address 1
2 Another address 1
3 A third address 1
4 Asbjorns address 2

projects_project

id name projects_project
1 datacleaner Here's a short desc...
2 MetaModel

comment:2 Changed 2 years ago by kasper

Added rev [477] which includes the first working version of this. One thing remains to be solved if we want it to be exactly like the example above; Detecting that the <name> tag inside the <person> tag has no multiplicity. In the current version a seperate contributors_person_name table will be generated instead. The good thing about this is that it would be more likely to reuse the same schema for several XML files if some of them contain multiplicity and some of them don't.

comment:3 Changed 2 years ago by kasper

  • Owner set to kasper
  • Status changed from new to assigned

Note for improvement: Also include native types. These could be something like:

  • XML attribute
  • XML text content
  • Auto-generated key

This could also be used to improve the getIdColumn() and getTextContentColumn() methods.

comment:4 Changed 2 years ago by kasper

  • Status changed from assigned to closed
  • Resolution set to fixed

Finished as of rev. [479].

comment:5 Changed 2 years ago by kasper

Added rev. [514]. with a little correction. The column type of text elements was set to VARBINARY instead of VARCHAR.

Note: See TracTickets for help on using tickets.