You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "von Schwerdtner, Thomas (GXS, FPI)" <Th...@gxs.ge.com> on 2002/03/19 14:37:58 UTC
RE: [OT] XML for describing databases?
Glenn is using a setup a little different than what I had in mind.
I have not been able to find what I wanted online anywhere (though I have
found numerous others looking for the same thing), so I have started playing
with my own schema. Personnaly, I have no formal database
training/education and only have a little over a years worth of experience
playing around with databases, so my database designs are failry simple and
do not make use of any advanced concepts (mostly because I do not know what
the advanced concepts are).
What I have come up with so far works for me...the basic idea is that I want
to store the same information that would be available in a schema dump from
a database (the design, not the contents) along with a little extra
information such as the database DSN...
A small database amounts to:
<database name="sample">
<!-- could store hostname instead and 'figure out' the dsn -->
<parameter name="dsn" value="postgresql://localhost/sample"/>
<parameter name="description" value="Store the name and favorite
color of some people"/>
<object type="table" name="some_data">
<column name="Id" sqltype="integer">
<parameter name="primary_key" value="true"/>
<!-- don't show this when rendering this table
(sloppy way to do this) -->
<parameter name="visible" value="false"/>
</column>
<column name="FirstName" sqltype="varchar" alias="First
Name"/>
<column name="LastName" sqltype="varchar" alias="First
Name"/>
<column name="FavoriteColorId" sqltype="integer">
<paramater name="link" value="colors.Id"/>
</column>
</object>
<object type="table" name="colors">
<column name="Id" sqltype="integer">
<parameter name="primary_key" value="true"/>
<parameter name="visible" value="false"/>
</column>
<column name="Color" sqltype="varchar"/>
</object>
</database>
.....once I figure out how to get esql to work right, I'll have a xsl
document that can parse a larger version of the above into seperate views
for each table and proper linking between related tables (through the 'link'
parameter...what I guess is a relation). A little later this week I'm going
to look into PostgreSQL 'views' and see about adding in some <object
type="view"....> tags, and as I may need them in the database, some <object
type="function"..> tags....(though I'm not sure how I could describe a
function in a manner that would be useful to a xslt that has not been
customized for a specific database)...
Anyways...someone who has taken "RDBMS's 101" could likely do much better
with something like this.....but the above sample is the sort of thing I was
looking for...and what I have come up with works for the databases I am
currently working with.....and since I have to build web interfaces to 6 or
so databases, using a XML setup like this is very helpful when working with
Cocoon...for me anyways...
-Tom
> -----Original Message-----
> From: Derek Hohls [mailto:dhohls@csir.co.za]
>
> Glenn
>
> I would definitely be interested in this - tho' I am not sure that I
> fully understand the approach you have taken eg. " submit
> queries using that format"?
>
> I am also curious as to how you format your output to make it
> human-readable if you do not use XSLT?
>
> Cheers
> Derek
>
> >>> gcling@telocity.com 18/03/2002 05:38:08 >>>
> I have been working on a similar problem but approaching it in a
> slightly different way. I have taken more of an object-relational
> mapping approach similar to products such as TopLink. Using this
> approach you define your database schema and your XML result schema
> separately and then map them together. For instance, the SQL tables
> for
> Employees (i.e. Employee, Department, Person) will be mapped directly
> to
> your resulting XML document and that document can be structured like:
> <department>
> <name>accounting</name>
> <employee>
> <firstName>John</firstName>
> <lastName>Doe</lastName>
> <employeeId>1234</employeeId>
> </employee>
> <employee>
> .
> </employee>
> </department>
>
> or it could be structured like:
> <employee deptName="accounting" id="1234">
> <firstName>John</firstName>
> <lastName>Doe</lastName>
> </employee>
>
> or any other variation.
>
> The mapping (created against a defined mapping schema as an XML
> document) provides the information that is needed to build the queries
> and create the resulting documents. XSLT is not used and the typical
> result type from an XML query (<table name="department"><row><column
> name="deptId">360</column>.</row>.</table><table>.</table>) is not
> used.
> The query is truly symmetric. You can define the result format, submit
> queries using that format, and receive responses in that format. To
> qualify your query you include the known data elements and the query
> will be built to find those.
>
> I have been working on this independently and would be interested in
> comments. I currently have the query definition, submit, and response
> working for moderately complex data sets (involving many-to-many
> relations that can be brought to multiple places in the XML document)
> and will work on defining insert and update as well.
>
> - Glenn
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
Re: [OT] XML for describing databases?
Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 19.Mar.2002 -- 08:37 AM, von Schwerdtner, Thomas (GXS, FPI) wrote:
> I have not been able to find what I wanted online anywhere (though I have
> found numerous others looking for the same thing), so I have started playing
> with my own schema. Personnaly, I have no formal database
So, if there's not a standard to it, I would suggest to go along the
lines the Cocoon database actions are taking. If you augment that
descriptor format with the information you need you will profit later
on when modifying your data.
Please have a look at the database actions from main trunk and the
modular database actions that you can find in the scratchpad area as
they differ in some points. A thoroughly commented descriptor file is
in the scratchpad/webapps/mount/mod-db directory.
For the scratchpad you should obtain a nightly snapshot or an
up-to-date CVS checkout.
If you need help figuring the format out, please post your questions
in this thread.
Chris.
--
C h r i s t i a n H a u l
haul@informatik.tu-darmstadt.de
fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>