XML Schema for RDF
Subject: Re: new public working draft of XML Schema From: Rick JELLIFFE <ricko@allette.com.au> To: xml-dev@xml.org Date: Sat, 26 Feb 2000 23:05:20 +0800
"C. M. Sperberg-McQueen" wrote: > Those interested in XML Schema may want to take a look at the new > draft before the town-meeting on XML Schema Tuesday night at > XTech. For anyone interested, appended is a stab at an XML Schema for RDF. It shows how abstract elements and equivClass is useful for constructing frameworks. For this kind of schema, it seems that there is an order to it: * first define the complex types, * then declare any abstract element which use the type * then declare the elements that use the complex types or which have an equivClass. (where this is a logical order, not a lexical order: you do not need to declare something before you reference it in XML Schemas, AFAIK.) (I couldn't help thinking when making it that the US military IETM DTD would have been much simpler using this: it defines "templates" in comments to give the element architecture that IETM DTDs should conform to {IETM=Interactive Electronic Technical Manual}. These are what XML Schemas calls abstract elements, I think.) In the documentation is a reference to a DTD I made for RDF too. I would say that the XML Schema is much more useful than the DTD: I think everything that was in a comment in the DTD version can be put into a declaration in the XML Schema. (Except, of course, for the RDF abbreviated syntax, but that is no surprise.) Also noteworthy is that this XML Schema seems comparable, in line count, to the DTD version. I have repeatedly in the past pointed out how excellent DTDs are for terseness, so it is nice to see that for at least some schemas XML Schemas is not bad. Rick Jelliffe GeoTempo, Inc. <schema xmlns="http://www.w3.org/1999/XMLSchema" xmlns:html="URL for HTML goes here" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" targetNamespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <annotation> <documentation> <html:p>XML Schema for RDF,<html:br /> created 2000-12-25, <html:br /> Rick Jelliffe, <html:br /> Academia Sinica Computing Centre. <html:br /> Thanks to Henry Thompson for help. </html:p> <html:p>RDF Specification at <html:a href="http://www.w3.org/TR">W3C</html:a>. </html:p> <html:p>DTD version at <html:a href="http://www.ascc.net/xml/resource/rdf.txt" >Academia Sinica</html:a>. </html:p> </documentation> </annotation> <!-- Top-level of RDF Document --> <element name="RDF"> <complexType content="elementOnly" > <sequence maxOccurs="*" > <choice> <element ref="rdf:TypedNode" /><!-- abstract !--> <element ref="rdf:Bag" /> <element ref="rdf:Seq" /> <element ref="rdf:Alt" /> </choice> </sequence> </complexType> </element> <!-- RDF Typed nodes --> <complexType name="TypedNodeType" content="elementOnly" > <sequence maxOccurs="*" > <element ref="rdf:PropertyElt" /><!--abstract !--> </sequence> <attribute name="id" minOccurs="0" type="ID" /> <attribute name="type" minOccurs="0" type="string" /> <attribute name="about" minOccurs="0" type="string" /> <attribute name="aboutEach" minOccurs="0" type="string" /> <attribute name="aboutEachPrefix" minOccurs="0" type="string" /> <attribute name="badID" minOccurs="0" type="ID" /> </complexType> <element name="TypedNode" abstract="true" type="rdf:TypedNodeType" /> <element name="Description" type="rdf:TypedNodeType" equivClass="rdf:TypedNode" /> <!-- RDF Property Elements --> <complexType name="PropertyEltType" > <any minOccurs="0" /> <attribute name="id" minOccurs="0" type="ID" /> <attribute name="resource" minOccurs="0" type="string" /> <attribute name="value" minOccurs="0" type="string" /> <attribute name="badID" minOccurs="0" type="ID" /> <attribute name="parseType" minOccurs="0" > <simpleType base="NMTOKEN"> <enumeration value="Resource"/> <enumeration value="Literal" /> </simpleType> </attribute> <anyAttribute /> </complexType> <element name="PropertyElt" abstract="true" type="rdf:PropertyEltType" /> <element name="subject" equivClass="rdf:PropertyElt" /> <element name="predicate" equivClass="rdf:PropertyElt" /> <element name="object" equivClass="rdf:PropertyElt" /> <element name="type" equivClass="rdf:PropertyElt" /> <element name="value"> <complexType> <any /> <anyAttribute /> </complexType> </element> <!-- RDF Containers --> <complexType name="Container" abstract="true" content="elementOnly" > <sequence maxOccurs="*"> <element name="li"> <complexType> <any/> <attribute name="id" minOccurs="0" type="ID" /> <attribute name="parseType" minOccurs="0" > <simpleType base="NMTOKEN"> <enumeration value="Resource"/> <enumeration value="Literal" /> </simpleType> </attribute> <anyAttribute /> </complexType> </element> </sequence> <attribute name="id" type="ID" /> <anyAttribute /> </complexType> <element name="Alt" type="rdf:Container" /> <element name="Bag" type="rdf:Container" /> <element name="Seq" type="rdf:Container" /> </schema> <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <Description about="foo"> <predicate value="prop"/> <object value="http:whoknows"/> </Description> </RDF>
Source: http://lists.xml.org/archives/xml-dev/200002/msg00618.html
Prepared by Robin Cover for The XML Cover Pages archive. For schema description and references, see "XML Schemas."