Thread: 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
Attachments:
new-rep-gen.dtd
new-rep-gen.xml
|
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 |
From: Ivan T. <to...@cr...> - 2001-09-03 08:48:28
|
On Mon, 2001-09-03 at 10:45, Mahler Thomas wrote: > Hi Ivan, >=20 > I had a look at your dtd over the weekend I made some minor > corrections/additions. See attached dtd. I also modified the repository.x= ml > accordingly but could not finish it due to lack of time. but you will get= an > impression... >=20 > > -----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? > > >=20 > yes that's right. I tried to make this even clearer by calling the ref-id= s > "foreignkey". The foreignkey attribute is always in the table on the N-si= de > of the 1-N relationship. >=20 > >=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 >=20 > It's possible to have compound primary keys. Thus it's also possible to h= ave > compound foreign keys. Perhaps, I hadn't formulated my question right. Returning a list is ok, but why should it contains IDs? Why not list of FieldDescriptors? =20 >=20 > See my changes to your DTD and my comments below >=20 > <?xml version=3D"1.0" encoding=3D"UTF-8" ?> >=20 > <!ELEMENT mapping-repository ( jdbc-connection+, table+, class+, > class-extent* ) > >=20 > <!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 > >=20 > <!ELEMENT table ( column+ ) > > <!ATTLIST table id ID #REQUIRED > schema CDATA #IMPLIED <!-- we had a schema sttribute wi= th > the jdbc-connection,=20 > but it has to be assigned to > the table.--> > name CDATA #REQUIRED > jdbc-ref IDREF #REQUIRED > >=20 > <!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 | DOU= BLE > | FLOAT | REAL | NUMERIC | DECIMAL | CHAR | VARCH= AR > | LONGVARCHAR | DATE | TIME | TIMESTAMP | BINARY > | VARBINARY | LONGVARBINARY) #REQUIRED > primary-key ( yes | no ) "no" > nullable ( yes | no ) "yes" > indexed ( yes | no ) "no" > size CDATA #IMPLIED > >=20 > <!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 > >=20 > <!ELEMENT extent EMPTY > > <!ATTLIST extent class-ref IDREF #REQUIRED > <!-- we only allow classes i= n > an extend definition that are=20 > explained somewhere els= e > in the repository --> >=20 > <!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 hav= e a > conversion strategy possible=20 > for attributes = too > --> >=20 > <!ELEMENT reference (foreignkey+) > <!-- renamed the ref-id element --> I would preffer to call it foreign-key if that's ok? :) > <!ATTLIST reference name CDATA #REQUIRED > class-ref IDREF #REQUIRED <!-- reference t= o a > class element --> > auto-retrieve ( yes | no ) "yes" > auto-update ( yes | no ) "no" > auto-delete ( yes | no ) "no" > >=20 > <!-- thma: renamed ref-id -> > <!ELEMENT foreignkey EMPTY > > <!ATTLIST foreignkey field-ref IDREF #REQUIRED > <!-- reference to a fiel= d > descriptor that contains a foreign key--> >=20 > <!ELEMENT collection ( foreignkey+ ) > <!-- renamed the ref-id element -= -> > <!ATTLIST collection name CDATA #REQUIRED > item-class-ref IDREF #REQUIRED <!-- this hold= s 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" > >=20 > <!ELEMENT class-extent ( extent+ ) > > <!ATTLIST class-extent name CDATA #REQUIRED > >=20 >=20 > I have a question: What is the scope of an XML ID? The whole xml document= or > only the enclosing element? The scope is the full document. > As far as I know they have document scope. thus I had to use fully qualif= ied > names in the ID fields (for example for fields and columns), which make t= he > repository quite verbose and redundant. >=20 > Do you see any solution to this? There are perhaps two solutions: 1) Use XML Schema rather than DTD. I think it supports that kind of refernces. 2) Check the consistency in the code. That is, no ID attribute for fields, only name. The foriegn-key element will always be a child of reference element, which has a class-ref attribute. I'd vote for the second solution, because it is simpler, cleaner and later can be extended with the first. >=20 > Thomas >=20 >=20 >=20 > > -- > > Ivan > >=20 >=20 |