Syntax.html
12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 13), see www.w3.org" />
<title>
Strawman simpler syntax for RDF
</title>
<style type="text/css">
/*<![CDATA[*/
detail { font-size: 10pt}
.detail { }
/*]]>*/
</style>
<link rel="stylesheet" href="di.css" type="text/css" />
<!-- Changed by: tbl 19990524 -->
<meta http-equiv="Content-Type" content="text/html" />
</head>
<body>
<p>
<a href="../"><img alt="W3" border="0" src=
"/Icons/WWW/w3c_home" width="72" height="48" /></a>
</p>
<p>
<em>Status: Obsolete.</em>
</p>
<p>
This was written as part of the Semantic Web <a href=
"Toolbox.html">Toolbox</a> page and spun off. It investigated
a syntax for RDF/XML which would be simpler for users than
the 'striped' syntax of RDF M&S 1.0. It also looks at the
rules for extracting RDF semantics from other non-RDF markup.
In this sense it connects with the <a href=
"XML.html">Top-down functional interpretation of XML</a> You
can think of this syntax as Notation 2. A later syntax,
<a href="Notation3.html">Notation 3</a>, was much more
successful.
</p>
<hr />
<h1>
A strawman Unstriped syntax for RDF in XML
</h1>
<p>
(Within this document, XML elements with namespace prefix are
assumed to be defined as pointing to something the reader can
figure out, and unprefixed element names are used for new
features which are introduced in this document. ).
</p>
<p>
The major difference between this syntax and <a href=
"/TR/REC-rdf-syntax/">RDF 1.0 M&S</a> is that RDF edges
correspond to elements, and RDF nodes are implicit. It is
basically as the M&S syntax with
<code>parseType=resource</code> is a default.
</p>
<h3>
Syntax requirements
</h3>
<p>
Basically the things which drove this particular syntax are
</p>
<ol>
<li>A requirement to use XML as W3C policy for serialisations
(except where excruciatingly painful)
</li>
<li>A non-requirement to have the "striping" of RDF M&S
1.0 where nested elements describe alternately nodes and
arcs;
</li>
<li>RDF can be carried within other XML information and can
have other XML information inserted within the syntax;
</li>
<li>It should be possible to make a document which
efficiently expresses information and allows an RDF parser
aware of the syntax to extract the RDF graph without needing
to read the namespace schema.
</li>
<li>RDF can carry extensions which can be optional.
</li>
</ol>
<h2>
Assumed syntax
</h2>
<p>
I assume for the purposes of the <a href=
"Toolbox.html">Toolbox</a> page a syntax for data in XML in
which XML elements be classified into the following
categories.
</p>
<h3>
RDF-Property element
</h3>
<p>
The element introduces information about an arc in the graph.
As nodes in RDF do not inherently have any information apart
from their arcs, properties are the only way RDF information
actually described. Property elements work as follows:
</p>
<ol>
<li>XML elements may be declared in a schema to be RDF
assertions and to therefore be treatable as such. These are
known as <em>property elements</em>.
</li>
<li>At any point in an XML document there may by a
<em>default subject</em> set. This is the subject of any
property element where not indicated otherwise.
</li>
<li>An <code>rdf:for</code> attribute indicates otherwise for
the subject for one property element. (This is a shortcut)
</li>
<li>An <code>rdf:about</code> attribute on any element sets
the default subject for any contained elements. (Equivalent
to RDF M&S)
</li>
<li>An <code>rdf:fyi</code> attribute on an element removes
any default subject for the element and its descendants
unless otherwise specified. The RDF parser may ignore the
element and its contents as far as RDF semantics go.
</li>
<li>An <code>rdf:extend</code> attribute on any element
indicates that the semantics of the element are of relevance
to the RDF parser and must be interpreted according to the
specification, and where this cannot be done the RDF
semantics are undefined (and typically an error condition
will result from an attempt at evaluation). The element is
known as an RDF-opaque element
</li>
<li>If a property element has an <code>rdf:value</code>
attribute that indicates the value of the property. This is
just a shortcut for having it in the element content.
</li>
<li>If a property element has atomic (string) content then
that is the object of the statement. (If this and the
previous exist they must match).
</li>
<li>If a property element has child elements then its value
is an RDF node which becomes the default subject (unless the
parsetype is used to declare the content to be literal XML)
</li>
</ol>
<h3>
RDF-Transparent
</h3>
<p>
The Semantic context is not changed. And example might be all
HTML tags, to make it simple to include RDF in HTML documents
(and extract it).
</p>
<h3>
RDF-Opaque
</h3>
<p>
The RDF parser can deduce nothing about the element or its
contents, unless it knows the semantics of the element.
Example: <sense:room-temperature/>
</p>
<p>
RDF-Opaque tags are understood by parsers conforming to the
namespace they are in.
</p>
<p>
In the <a href="Toolbox.html">toolbox</a> we will introduce
new features which, while they indeed be expressed longhand
in the existing XML-RDF notation, in practice need to
available in a more concise form at a high level. These are
therefore extensions to the RDF-XML syntax for logic.
Example: <not>
</p>
<p>
RDF-Opaque tags in the RDF space are understood by conforming
parsers. Other tags are assumed to be property elements if
there is subject defined (default or otherwise) and otherwise
RDF-Transparent (by default) or Opaque (if specified).
Information as to whether tags are RDF-Opaque may be given in
the document using them or in a schema (or indeed in
principle anywhere else). It may be done element by element,
or if applicable, to an en entire namespace.
</p>
<p>
This syntax was written as have something for examples, and
part of the purpose of this is a feasibility of writing logic
in XML. I apologise to the reader for the effort required to
work in a strange syntax. There was later a call for a
simpler syntax and so this was cleaned up a little as a
strawman.
</p>
<hr />
<h3>
Examples for rdf:for and rdf:about
</h3>
<p>
Sometimes the effort of creating an element just in order
only to define the subject for a following assertion is a bit
heavy. Making a standard well-known and mandatory understood
attribute would make this easier. Suppose, for example that
<code>rdf:about=foo</code> always sets the thing to which a
contained property element refers by default, and
<code>rdf:for=bar</code> overrode it for the element itself.
(<code>rdf:for</code> would also imply that the element was
an RDF property)
</p>
<pre>
<dc:author rdf:for="thebook" value="Ora"/>
</pre>
<p>
is an easier way of specifying a single property.
</p>
<pre>
<frontm rdf:about="theBook">
<z:date>sdfghjk</z:date>
<z:title>Makeing more pancakes</z:title>
<z:obsoletes>
<!-- default subject is no longer theBook --!>
<z:title>Making pankakes</z:title>
<z:price>$3.00</z:price>
</z:obsoletes>
<z:price>$6.00</z:price>
<z:price for="anotherBook">$78.00</z:price>
</frontm>
</pre>
<p>
(The only problem I have with <code>rdf:about</code> and
<code>rdf:for</code> is that it becomes mandatory for any
semantically aware parser to be able to handle this, as
ignoring it is of course impossible.)
</p>
<h3>
RDF:Description
</h3>
<p>
When one wants to introduce information about an RDF node,
this is basically done by any element with an rdf:about
attribute. When there is no other element which conveniently
provides a placeholder, the rdf:description element may be
used.
</p>
<pre>
<rdf:description rdf:about="theBook">
<dc:author>Ralph</dc:author>
<http:from>swick@w3.org</http:from>
</rdf:description>
</pre>
<p>
If the <code>rdf:about</code> attribute is present it
indicates that the node represents a resource (document)
whose URI is that give. That attribute may be omitted.
</p>
<h3>
RDF:Property
</h3>
<p>
There are times when using an XML element name for a property
may be difficult or impossible, such as when there are many
properties to be listed, each from different namespaces, or
when the property must take the value of the variable.
<span class="detail">(Yes, I understand this takes RDF out of
first order logic but our ability to quote statements and
refer to them I think makes that step anyway).</span>
</p>
<pre>
<rdf:property pname="http://dc.org/dc1#author"
rdf:for="theBook"
rdf:value="Ralph">
</pre>
<p>
This is also useful as a serialisation syntax when dumping
the output of a parser, for example.
</p>
<hr />
<h2>
NOTES
</h2>
<p>
See also
</p>
<p>
<a href="Identity.html">Identifying things in RDF</a>
</p>
<h3>
RDF in HTML - Transparent or not?
</h3>
<p>
There are two ways to put RDF into HTML using these
conventions. One could declare that all HTML elements are
RDF-transparent, in which case RDF can be stuck in anywhere.
</p>
<p>
One could bring them closer, so that the RDF subject is set
to appropriate URI by convention by declaring them (in RDF
schema code inserted into the XHTML schema) to be opaque. In
this case, I would propose that HTML's HEAD (or maybe even
the HTML document container) be considered as a Node element
whose context is the document itself. I would propose that A
switch context to the destination of the link - as one often
wants a neat way of putting in information about it.
</p>
<p>
Examples:
</p>
<table border="1">
<tbody>
<tr>
<th>
Element
</th>
<th>
RDF subject (URI)
</th>
</tr>
<tr>
<td>
HTML:HTML
</td>
<td>
The document itself ("")
</td>
</tr>
<tr>
<td>
HTML:HEAD
</td>
<td>
The document itself ("")
</td>
</tr>
<tr>
<td>
HTML:A
</td>
<td>
The linked document (value of <em>href</em>)
</td>
</tr>
<tr>
<td>
HTML:BLOCKQUOTE
</td>
<td>
The quoted document
</td>
</tr>
</tbody>
</table>
<p>
References
</p>
<p>
See also:
</p>
<ul>
<li>
<a href=
"http://www-db.stanford.edu/~melnik/rdf/syntax.html">Sergy's
proposal</a>
</li>
</ul>
<p>
So much for syntax: on to the <a href="Toolbox.html">semantic
toolbox</a>.
</p>
<hr />
<small>Last change $Id: Syntax.html,v 1.21 2007/03/22 20:31:40
timbl Exp $</small>
<address>
Tim BL
</address>
</body>
</html>