Relational Tables and structured documents

MW info at riposte.com
Mon Mar 23 08:42:37 GMT 1998


Jonathan:

I was pondering about related problems the other day.
What I came up with - in the absence of any other solution
out there - was some kind of stylesheet language for mapping relational
data to XML/HTML.

It takes database information (e.g. ODBC DSN, table names)
as input and then defines the output in terms of group/detail elements.
A very rough example could be (XVSL: XML View Styleshett Language;
"View" stands for views on relational data):

<xvsl connection="DSN=mydsn;USER=myuser;PWD=xxxx" sql="select * from addr
inner join project on addr.ID=project.addrID">
  <MYXML>
  <group field="addr.id">
    <ADDR ID="=fields('ID')">
      <NAME><field name="addr.name" /></NAME>
    <detail>
      <PROJECT>
        <NUMBER><field name="project.number" /></NUMBER>
        <TOTAL><field name="project.total" /></TOTAL>
      </PROJECT>
    </detail>
      <PROJECTSUM><aggregate field="project.total" function="sum"
/></PROJECTSUM>
    </ADDR>
  </group>
  </MYXML>
</xvsl>

Lower case tags are supposed to be XVSL tags, upper case ones define the
output. The following could be an example of output genereated by the
XVSL stylesheet:

<MYXML>
  <ADDR ID="1">
    <NAME>Ralf Westphal</NAME>
    <PROJECT>
      <NUMBER>981212</NUMBER>
      <TOTAL>1234.12</TOTAL>
    </PROJECT>
    <PROJECT>
      <NUMBER>982555</NUMBER>
      <TOTAL>989.23</TOTAL>
    </PROJECT>
    <PROJECTSUM>2223.35</PROJECTSUM>
  </ADDR>
  <ADDR ID="45">
    <NAME>John Doe</NAME>
    <PROJECT>
      <NUMBER>971233</NUMBER>
      <TOTAL>4443.23</TOTAL>
    </PROJECT>
    <PROJECTSUM>4443.23</PROJECTSUM>
  </ADDR>
</MYXML>

(Maybe this way of converting "simple" relations to
XML is overkill, but it can be defined outside any
database, does not necessarily require any coding
in some programming language and uses a well known
paradigm (group-detail).)

If you (or anyone) should find this way of expressing relation
to XML mappings of interest, let´s get together on it.

Ralf Westphal
Mey & Westphal RIPOSTE Software


>At 10:55 AM 3/20/98, Peter Murray-Rust wrote:
>>At 22:37 21/03/98 -0500, Jonathan Robie wrote:
>>[... PeterMR...]
>>>
>>>This is rather analogous to the object-to-relational mapping problem. If
>>>you define schemas in XML and define a mapping onto the relational
>>>database, there is a solution. Or you can have someone define how the
joins
>>>should be made to create the XML elements. There is not, of course, a
>>
>>Thanks. This is indeed the solution I have been pursuing. My intention is
>>to control the joins through a set of declarations (in XML :-) - this
means
>>that they can be reconfigured by different people/clients. I wondered if
>>there was already a standard 'language' for this or whether I just hack my
>>own and hope.
>
>This is something I've been thinking about, but my thoughts are currently a
>bunch of notes on pieces of scrap paper. I would love to discuss this with
>anybody who is interested. I think that this is an extremely promising
>area; ideally, I would like to see a solution more general than just
>relational databases, but not as complicated as RDF.
>
>Jonathan
>
>jonathan at texcel.no
>Texcel Research
>http://www.texcel.no
>
>xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
>Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
>To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
>(un)subscribe xml-dev
>To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
message;
>subscribe xml-dev-digest
>List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
>


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list