- From: Alexandre Martins <alex.martins@netc.pt>
- Date: Fri, 25 Oct 2002 22:52:18 +0100
- To: <xmlschema-dev@w3.org>
Hi! I've been trying to write a XML vocabulary to describe a relational database schema, for example: <DataBase id="teste" url="jdbc:mysql://localhost/teste" user="xano" passwd="xpto" driver="com.mysql.jdbc.Driver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="bd-v2.xsd"> <Table id="Film"> <Field id="idFilm" type="INTEGER">Film Number</Field> <Field id="title" type="VARCHAR" size="40">Title</Field> <Field id="year" type="INTEGER">Year</Field> <PrimaryKey> <KeyField fieldId="idFilm"/> </PrimaryKey> </Table> <Table id="Actor"> <Field id="idActor" type="INTEGER">Actor Number</Field> <Field id="name" type="VARCHAR" size="25">Name</Field> <Field id="birthDate" type="DATE">Birthdate</Field> <PrimaryKey> <KeyField fieldId="idActor"/> </PrimaryKey> </Table> <Table id="FilmActor"> <Field id="idFilm" type="INTEGER">Film Number</Field> <Field id="idActor" type="INTEGER">Actor Number</Field> <Field id="character" type="VARCHAR" size="20">Character</Field> <PrimaryKey> <KeyField fieldId="idFilm"/> <KeyField fieldId="idActor"/> </PrimaryKey> <ForeignKey> <FieldRef fieldId="idFilm"/> <ForeignTable tableId="Film"> <ForeignField fieldId="idFilm"/> </ForeignTable> </ForeignKey> <ForeignKey> <FieldRef fieldId="idActor"/> <ForeignTable tableId="Actor"> <ForeignField fieldId="idActor"/> </ForeignTable> </ForeignKey> </Table> </DataBase> In order to validate certain constraints related with the relational model rules, I've been developing a XML Schema. But I've not been able to write a XML Schema constraint to guarantee that a ForeignKey element content must be a PrimaryKey on the other table (i've trying with key and keyref). Is it possible to write this using XML Schema or must I use Relax NG?? Thanks, Alexandre Martins _______________________________________________________ Vizzavi Mail powered by Vodafone - http://www.vizzavi.pt Virus protected by TrendMicro - http://www.antivirus.com
Received on Friday, 25 October 2002 17:51:09 UTC