forked from SWI-Prolog/packages-RDF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrdf.html
156 lines (132 loc) · 4.76 KB
/
rdf.html
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>Online SWI-Prolog RDF parser demo</title>
</head>
<body>
<h1 align=center>Online SWI-Prolog RDF parser demo</h1>
<p>
This page provides an online demonstration of an RDF parser written in
<a href="http://www.swi.psy.uva.nl/projects/SWI-Prolog/">SWI-Prolog</a>.
This RDF parser has a couple of attractive properties:
<dl>
<dt><b>Small</b><dd>
Both in terms of source-code (< 700 lines) and executable.
<dt><b>Fast</b><dd>
Parses about 400 Kbytes/sec on a Pentium-II/450.
<dt><b>Conforming</b><dd>
This parser conforms to <a href="http://www.w3.org/TR/REC-rdf-syntax">
http://www.w3.org/TR/REC-rdf-syntax</a>.
<dt><b>Prolog based</b><dd>
Many people regard the Prolog programming language a good vehicle to
reason about RDF statements. Having a simple and fast Prolog-based RDF
parser makes life easier.
<dt><b>Portability</b><dd>
The RDF parser itself is written in ISO Prolog. The XML parser is
written in ANSI-C. There is no standard for interfacing Prolog and C,
but the interface is relatively small.
</dl>
A more detailed description of this packages is available in <a
href="rdf2pl.html">in this document</a>. The sources of the parser are
included into the <a
href="http://www.swi.psy.uva.nl/projects/SWI-Prolog/packages/sgml/">sgml</a>
packages for SWI-Prolog. The individual source files can also be
examined through the <a
href="http://gollem.swi.psy.uva.nl/cgi-bin/pl-cvsweb/packages/sgml/RDF">
cvsweb service</a>, which also provides access to the most recent
<a
href="http://gollem.swi.psy.uva.nl/cgi-bin/pl-cvsweb/packages/sgml/RDF/ChangeLog">
changes</a>
<p>
<hr>
Please write your RDF description into the text-area below or select a
local file using the <b>File:</b> item and submit it. If anything goes
wrong, please mail <a href="mailto:[email protected]">Jan
Wielemaker</a>.
<p>
<em>The RDF-data submitted is kept <b>anonymously</b> on our server and
might be used by us to examine problems with our RDF parser. We do not
publish this material.</em> The result-page provides a form for
attaching a comment to the stored RDF statement.
<!-- enctype="multipart/form-data" -->
<p>
<form
name=rdf
method=get
action="http://localhost:8000/rdf">
<table align=center>
<tr><td colspan=2>
<textarea name=rdf rows=15 cols=72 wrap=off></textarea>
<tr><td>File: <input name=attachment type=file>
<td align=right>
<input type=button value='Example 1' onClick="ex1()">
<input type=button value='Example 2' onClick="ex2()">
<input type=button value='Example 3' onClick="ex3()">
<tr><td align=left><input type=reset value="Clear Text">
<td align=right><input type=submit value="Parse RDF">
</table>
</form>
<h4><hr>Notes<hr></h4
<dl>
<dt><b><em>rdf:</em>resource, etc.</b><dd>
The specification and discussion on the rdf interest group yielded no
satisfactory solution how to deal with RDF attributes that are not in
the RDF namespace such as <b>ID</b>, <b>resource</b>, etc. This parser
interprets such attributes in the namespace of the element, so the
statement below is not interpreted as a <b>propertyElt</b> with value
<code>me</code> but as a <b>typedNode</b> with predicate
<code>resource</code> and value <b>literal(</b>me<b>)</b>.
<pre>
<s:Creator resource="#me">
</pre>
</dl>
<!---------------------------------------------------------------->
<!-- EXAMPLES -->
<!---------------------------------------------------------------->
<script language="JavaScript">
function ex1()
{ document.rdf.rdf.value='<?xml version="1.0"?>\
\
<!-- Example from REC-rdf-syntax -->\
\
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\
xmlns:s="http://description.org/schema/">\
<rdf:Description about="http://www.w3.org/Home/Lassila">\
<s:Creator>Ora Lassila</s:Creator>\
</rdf:Description>\
</rdf:RDF>';
}
function ex2()
{ document.rdf.rdf.value='<?xml version="1.0"?>\
\
<!-- Example from REC-rdf-syntax, demonstrating reification -->\
\
<rdf:RDF\
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\
xmlns:s="http://description.org/schema/">\
<rdf:Description about="http://www.w3.org/Home/Lassila" bagID="D_001">\
<s:Creator>Ora Lassila</s:Creator>\
<s:Title>Ora\'s Home Page</s:Title>\
</rdf:Description>\
</rdf:RDF>';
}
function ex3()
{ document.rdf.rdf.value='<?xml version="1.0"?>\
\
<!-- Example from REC-rdf-syntax, non-binary relations -->\
\
<RDF\
xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\
xmlns:n="http://www.nist.gov/units/">\
<Description about="John_Smith">\
<n:weight rdf:parseType="Resource">\
<rdf:value>200</rdf:value>\
<n:units rdf:resource="http://www.nist.gov/units/Pounds"/>\
</n:weight>\
</Description>\
</RDF>';
}
</script>
</body>
</html>