AW: AW: [Objectbridge-developers] [Fwd: [objectbridge - Open Disc ussi on] New repository.xml/dtd
Brought to you by:
thma
From: Mahler T. <tho...@it...> - 2001-09-03 07:45:44
|
Hi Ivan, I had a look at your dtd over the weekend I made some minor corrections/additions. See attached dtd. I also modified the = repository.xml accordingly but could not finish it due to lack of time. but you will = get an impression... > -----Urspr=FCngliche Nachricht----- > Von: Ivan Toshkov [mailto:to...@cr...] > Gesendet: Freitag, 31. August 2001 16:37 > An: Mahler Thomas > Cc: objectbridge > Betreff: Re: AW: [Objectbridge-developers] [Fwd: [objectbridge - Open > Discussi on] New repository.xml/dtd proposal.] >=20 >=20 > Hi all, >=20 > Hopefully, I've changed everything as we discussed, added the missing > `size' and `nullable' attributes and made the xml a little bit more > readable. >=20 > Please review it, to see if there is something wrong or missing. > Especially with the `ref-id' elements, cause I'm not sure=20 > I've done them > right. >=20 > Is it correct that `ReferenceDescriptor/descriptor_ids'=20 > points to fields > in the current class, and for `CollectionDescriptor/descriptor_ids' = -- > to fields in the referenced class? > yes that's right. I tried to make this even clearer by calling the = ref-ids "foreignkey". The foreignkey attribute is always in the table on the = N-side of the 1-N relationship. >=20 > Also, I see that the method > ObjectReferenceDescriptor.getForeignKeyFields() returns a=20 > list of ids. I > can preserve it's semantics, but I wonder if this is realy needed. >=20 It's possible to have compound primary keys. Thus it's also possible to = have compound foreign keys.=20 See my changes to your DTD and my comments below <?xml version=3D"1.0" encoding=3D"UTF-8" ?> <!ELEMENT mapping-repository ( jdbc-connection+, table+, class+, class-extent* ) > <!ELEMENT jdbc-connection EMPTY > <!ATTLIST jdbc-connection id ID #REQUIRED name CDATA #REQUIRED driver CDATA #REQUIRED protocol CDATA #REQUIRED subprotocol CDATA #REQUIRED dbalias CDATA #REQUIRED username CDATA #IMPLIED password CDATA #IMPLIED > <!ELEMENT table ( column+ ) > <!ATTLIST table id ID #REQUIRED schema CDATA #IMPLIED <!-- we had a schema sttribute = with the jdbc-connection,=20 but it has to be assigned = to the table.--> name CDATA #REQUIRED jdbc-ref IDREF #REQUIRED > <!ELEMENT column EMPTY > <!ATTLIST column id ID #REQUIRED <!-- columns need an ID to be referenced from field decriptors --> name CDATA #REQUIRED type ( BIT | TINYINT | SMALLINT | INTEGER | BIGINT | = DOUBLE | FLOAT | REAL | NUMERIC | DECIMAL | CHAR | = VARCHAR | LONGVARCHAR | DATE | TIME | TIMESTAMP | = BINARY | VARBINARY | LONGVARBINARY) #REQUIRED primary-key ( yes | no ) "no" nullable ( yes | no ) "yes" indexed ( yes | no ) "no" size CDATA #IMPLIED > <!ELEMENT class ( extent*, field+, reference*, collection* ) > <!-- a persistence class must=20 = have at least one field descriptor --> <!ATTLIST class name ID #REQUIRED table-ref IDREF #REQUIRED orderby-field-ref IDREF #IMPLIED <!-- you ommited the orderby atribute. it's a reference=20 to a field descriptor --> conversion-strategy CDATA #IMPLIED proxy CDATA #IMPLIED > <!ELEMENT extent EMPTY > <!ATTLIST extent class-ref IDREF #REQUIRED > <!-- we only allow classes = in an extend definition that are=20 explained somewhere = else in the repository --> <!ELEMENT field EMPTY > <!ATTLIST field id ID #REQUIRED <!-- we need references to fields in foreignkey-elements --> name CDATA #REQUIRED column-ref IDREF #REQUIRED <!-- reference to column element --> conversion-strategy CDATA #IMPLIED > <!-- I'd like to = have a conversion strategy possible=20 for = attributes too --> <!ELEMENT reference (foreignkey+) > <!-- renamed the ref-id element --> <!ATTLIST reference name CDATA #REQUIRED class-ref IDREF #REQUIRED <!-- reference = to a class element --> auto-retrieve ( yes | no ) "yes" auto-update ( yes | no ) "no" auto-delete ( yes | no ) "no" > <!-- thma: renamed ref-id -> <!ELEMENT foreignkey EMPTY > <!ATTLIST foreignkey field-ref IDREF #REQUIRED > <!-- reference to a = field descriptor that contains a foreign key--> <!ELEMENT collection ( foreignkey+ ) > <!-- renamed the ref-id element = --> <!ATTLIST collection name CDATA #REQUIRED item-class-ref IDREF #REQUIRED <!-- this = holds a reference to the item class description --> =20 collection-class CDATA #IMPLIED auto-retrieve ( yes | no ) "yes" auto-update ( yes | no ) "no" auto-delete ( yes | no ) "no" > <!ELEMENT class-extent ( extent+ ) > <!ATTLIST class-extent name CDATA #REQUIRED > I have a question: What is the scope of an XML ID? The whole xml = document or only the enclosing element? As far as I know they have document scope. thus I had to use fully = qualified names in the ID fields (for example for fields and columns), which make = the repository quite verbose and redundant. Do you see any solution to this? Thomas > -- > Ivan >=20 |