Mercurial > emacs
annotate etc/schema/rdfxml.rnc @ 110963:8e3439ed2228
* lisp/Makefile.in (compile-clean): Use `` instead of $().
(Former is more portable than the latter.)
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 12 Oct 2010 20:23:47 -0700 |
parents | 3b42757aabec |
children |
rev | line source |
---|---|
99428
3b42757aabec
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
1 # RELAX NG Compact Schema for RDF/XML Syntax |
86361 | 2 # |
99428
3b42757aabec
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
3 # Copyright (C) 2001-2008 World Wide Web Consortium, (Massachusetts |
3b42757aabec
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
4 # Institute of Technology, European Research Consortium for |
3b42757aabec
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
5 # Informatics and Mathematics, Keio University). All Rights Reserved. |
3b42757aabec
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
6 # This work is distributed under the W3C(R) Software License in the |
3b42757aabec
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
7 # hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
3b42757aabec
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
8 # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
3b42757aabec
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
9 # PURPOSE. |
86361 | 10 # |
11 # This schema is for information only and NON-NORMATIVE | |
12 # | |
13 # It is based on one originally written by James Clark in | |
14 # http://lists.w3.org/Archives/Public/www-rdf-comments/2001JulSep/0248.html | |
15 # and updated with later changes. | |
16 | |
17 namespace local = "" | |
18 namespace rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |
19 datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" | |
20 | |
21 | |
22 start = doc | |
23 | |
24 | |
25 # I cannot seem to do this in RNGC so they are expanded in-line | |
26 | |
27 # coreSyntaxTerms = rdf:RDF | rdf:ID | rdf:about | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | |
28 # syntaxTerms = coreSyntaxTerms | rdf:Description | rdf:li | |
29 # oldTerms = rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID | |
30 # nodeElementURIs = * - ( coreSyntaxTerms | rdf:li | oldTerms ) | |
31 # propertyElementURIs = * - ( coreSyntaxTerms | rdf:Description | oldTerms ) | |
32 # propertyAttributeURIs = * - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms ) | |
33 | |
34 # Also needed to allow rdf:li on all property element productions | |
35 # since we can't capture the rdf:li rewriting to rdf_<n> in relaxng | |
36 | |
37 # Need to add these explicitly | |
38 xmllang = attribute xml:lang { text } | |
39 xmlbase = attribute xml:base { text } | |
40 # and to forbid every other xml:* attribute, element | |
41 | |
42 doc = | |
43 RDF | |
44 | |
45 RDF = | |
46 element rdf:RDF { | |
47 xmllang?, xmlbase?, nodeElementList | |
48 } | |
49 | |
50 nodeElementList = | |
51 nodeElement* | |
52 | |
53 # Should be something like: | |
54 # ws* , ( nodeElement , ws* )* | |
55 # but RELAXNG does this by default, ignoring whitespace separating tags. | |
56 | |
57 nodeElement = | |
58 element * - ( local:* | rdf:RDF | rdf:ID | rdf:about | rdf:parseType | | |
59 rdf:resource | rdf:nodeID | rdf:datatype | rdf:li | | |
60 rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID ) { | |
61 (idAttr | nodeIdAttr | aboutAttr )?, xmllang?, xmlbase?, propertyAttr*, propertyEltList | |
62 } | |
63 | |
64 # It is not possible to say "and not things | |
65 # beginning with _ in the rdf: namespace" in RELAX NG. | |
66 | |
67 ws = | |
68 " " | |
69 | |
70 # Not used in this RELAX NG schema; but should be any legal XML | |
71 # whitespace defined by http://www.w3.org/TR/2000/REC-xml-20001006#NT-S | |
72 | |
73 | |
74 propertyEltList = | |
75 propertyElt* | |
76 | |
77 # Should be something like: | |
78 # ws* , ( propertyElt , ws* )* | |
79 # but RELAXNG does this by default, ignoring whitespace separating tags. | |
80 | |
81 propertyElt = | |
82 resourcePropertyElt | | |
83 literalPropertyElt | | |
84 parseTypeLiteralPropertyElt | | |
85 parseTypeResourcePropertyElt | | |
86 parseTypeCollectionPropertyElt | | |
87 parseTypeOtherPropertyElt | | |
88 emptyPropertyElt | |
89 | |
90 resourcePropertyElt = | |
91 element * - ( local:* | rdf:RDF | rdf:ID | rdf:about | rdf:parseType | | |
92 rdf:resource | rdf:nodeID | rdf:datatype | | |
93 rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID | | |
94 xml:* ) { | |
95 idAttr?, xmllang?, xmlbase?, nodeElement | |
96 } | |
97 | |
98 literalPropertyElt = | |
99 element * - ( local:* | rdf:RDF | rdf:ID | rdf:about | rdf:parseType | | |
100 rdf:resource | rdf:nodeID | rdf:datatype | | |
101 rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID | | |
102 xml:* ) { | |
103 (idAttr | datatypeAttr )?, xmllang?, xmlbase?, text | |
104 } | |
105 | |
106 parseTypeLiteralPropertyElt = | |
107 element * - ( local:* | rdf:RDF | rdf:ID | rdf:about | rdf:parseType | | |
108 rdf:resource | rdf:nodeID | rdf:datatype | | |
109 rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID | | |
110 xml:* ) { | |
111 idAttr?, parseLiteral, xmllang?, xmlbase?, literal | |
112 } | |
113 | |
114 parseTypeResourcePropertyElt = | |
115 element * - ( local:* | rdf:RDF | rdf:ID | rdf:about | rdf:parseType | | |
116 rdf:resource | rdf:nodeID | rdf:datatype | | |
117 rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID | | |
118 xml:* ) { | |
119 idAttr?, parseResource, xmllang?, xmlbase?, propertyEltList | |
120 } | |
121 | |
122 parseTypeCollectionPropertyElt = | |
123 element * - ( local:* | rdf:RDF | rdf:ID | rdf:about | rdf:parseType | | |
124 rdf:resource | rdf:nodeID | rdf:datatype | | |
125 rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID | | |
126 xml:* ) { | |
127 idAttr?, xmllang?, xmlbase?, parseCollection, nodeElementList | |
128 } | |
129 | |
130 parseTypeOtherPropertyElt = | |
131 element * - ( local:* | rdf:RDF | rdf:ID | rdf:about | rdf:parseType | | |
132 rdf:resource | rdf:nodeID | rdf:datatype | | |
133 rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID | | |
134 xml:* ) { | |
135 idAttr?, xmllang?, xmlbase?, parseOther, any | |
136 } | |
137 | |
138 emptyPropertyElt = | |
139 element * - ( local:* | rdf:RDF | rdf:ID | rdf:about | rdf:parseType | | |
140 rdf:resource | rdf:nodeID | rdf:datatype | | |
141 rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID | | |
142 xml:* ) { | |
143 idAttr?, (resourceAttr | nodeIdAttr)?, xmllang?, xmlbase?, propertyAttr* | |
144 } | |
145 | |
146 idAttr = | |
147 attribute rdf:ID { | |
148 IDsymbol | |
149 } | |
150 | |
151 nodeIdAttr = | |
152 attribute rdf:nodeID { | |
153 IDsymbol | |
154 } | |
155 | |
156 aboutAttr = | |
157 attribute rdf:about { | |
158 URI-reference | |
159 } | |
160 | |
161 propertyAttr = | |
162 attribute * - ( local:* | rdf:RDF | rdf:ID | rdf:about | rdf:parseType | | |
163 rdf:resource | rdf:nodeID | rdf:datatype | rdf:li | | |
164 rdf:Description | rdf:aboutEach | | |
165 rdf:aboutEachPrefix | rdf:bagID | | |
166 xml:* ) { | |
167 string | |
168 } | |
169 | |
170 resourceAttr = | |
171 attribute rdf:resource { | |
172 URI-reference | |
173 } | |
174 | |
175 datatypeAttr = | |
176 attribute rdf:datatype { | |
177 URI-reference | |
178 } | |
179 | |
180 parseLiteral = | |
181 attribute rdf:parseType { | |
182 "Literal" | |
183 } | |
184 | |
185 parseResource = | |
186 attribute rdf:parseType { | |
187 "Resource" | |
188 } | |
189 | |
190 parseCollection = | |
191 attribute rdf:parseType { | |
192 "Collection" | |
193 } | |
194 | |
195 parseOther = | |
196 attribute rdf:parseType { | |
197 text | |
198 } | |
199 | |
200 URI-reference = | |
201 string | |
202 | |
203 literal = | |
204 any | |
205 | |
206 IDsymbol = | |
207 xsd:NMTOKEN | |
208 | |
209 any = | |
210 mixed { element * { attribute * { text }*, any }* } | |
211 |