rdfobjects 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,308 @@
1
+ <?xml version="1.0" ?>
2
+
3
+ <!-- RDFT 2.0 by Jason Diamond <http://injektilo.org/>
4
+ |
5
+ | Transforms RDF/XML into N-Triples. See <http://www.w3.org/TR/rdf-syntax-grammar>
6
+ | and <http://www.w3.org/TR/rdf-testcases/#ntriples> for more information.
7
+ |
8
+ | This version requires that all RDF attributes be qualified!
9
+ |
10
+ | Specify the base-uri parameter as the URI for the source document in
11
+ | order to resolve relative URIs (currently just rdf:ID attributes).
12
+ |
13
+ | Import this transform and override the output-statement and
14
+ | output-literal-statement named templates to create your own output
15
+ | formats.
16
+ |
17
+ | TODO:
18
+ |
19
+ | * Reification.
20
+ | * Correct URI resolution.
21
+ | * Fix bugs.
22
+ | * Track RDF Working Draft changes.
23
+ | * More helpful error checking.
24
+ | * Documentation.
25
+ | * More?
26
+ |
27
+ | HISTORY:
28
+ |
29
+ | 2002-01-02:
30
+ | * First Draft.
31
+ +-->
32
+
33
+ <xsl:transform version="1.0"
34
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
35
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
36
+ >
37
+ <xsl:output method="text" encoding="utf-8" />
38
+
39
+ <xsl:param name="base-uri" />
40
+
41
+ <xsl:template match="text()" />
42
+ <xsl:template match="text()" mode="node" />
43
+ <xsl:template match="text()" mode="property" />
44
+
45
+ <xsl:template match="rdf:RDF">
46
+ <xsl:apply-templates mode="node" />
47
+ </xsl:template>
48
+
49
+ <!-- node elements -->
50
+
51
+ <xsl:template match="*" mode="node">
52
+ <xsl:param name="subject" />
53
+ <xsl:param name="predicate" />
54
+
55
+ <xsl:variable name="id">
56
+ <xsl:choose>
57
+ <xsl:when test="@rdf:ID">
58
+ <xsl:value-of select="concat($base-uri, '#', @rdf:ID)" />
59
+ </xsl:when>
60
+ <xsl:when test="@rdf:about">
61
+ <xsl:value-of select="@rdf:about" />
62
+ </xsl:when>
63
+ <xsl:when test="@ID">
64
+ <xsl:message terminate="yes">error: encountered unqualified ID attribute!</xsl:message>
65
+ </xsl:when>
66
+ <xsl:when test="@about">
67
+ <xsl:message terminate="yes">error: encountered unqualified about attribute!</xsl:message>
68
+ </xsl:when>
69
+ <xsl:otherwise>
70
+ <xsl:value-of select="concat('_:', generate-id())" />
71
+ </xsl:otherwise>
72
+ </xsl:choose>
73
+ </xsl:variable>
74
+
75
+ <xsl:if test="not(self::rdf:Description)">
76
+ <xsl:call-template name="output-type-statement">
77
+ <xsl:with-param name="subject" select="$id" />
78
+ <xsl:with-param name="object">
79
+ <xsl:call-template name="check-li" />
80
+ </xsl:with-param>
81
+ </xsl:call-template>
82
+ </xsl:if>
83
+
84
+ <xsl:if test="$subject and $predicate">
85
+ <xsl:call-template name="output-statement">
86
+ <xsl:with-param name="subject" select="$subject" />
87
+ <xsl:with-param name="predicate" select="$predicate" />
88
+ <xsl:with-param name="object" select="$id" />
89
+ </xsl:call-template>
90
+ </xsl:if>
91
+
92
+ <xsl:apply-templates select="@*" mode="property">
93
+ <xsl:with-param name="subject" select="$id" />
94
+ </xsl:apply-templates>
95
+
96
+ <xsl:apply-templates mode="property">
97
+ <xsl:with-param name="subject" select="$id" />
98
+ </xsl:apply-templates>
99
+
100
+ </xsl:template>
101
+
102
+ <!-- property elements -->
103
+
104
+ <xsl:template match="*[*]" mode="property">
105
+ <xsl:param name="subject" />
106
+
107
+ <xsl:variable name="predicate">
108
+ <xsl:call-template name="check-li" />
109
+ </xsl:variable>
110
+
111
+ <xsl:apply-templates mode="node">
112
+ <xsl:with-param name="subject" select="$subject" />
113
+ <xsl:with-param name="predicate" select="$predicate" />
114
+ </xsl:apply-templates>
115
+
116
+ </xsl:template>
117
+
118
+ <xsl:template match="*[not(*)][text()]" mode="property">
119
+ <xsl:param name="subject" />
120
+
121
+ <xsl:variable name="predicate">
122
+ <xsl:call-template name="check-li" />
123
+ </xsl:variable>
124
+
125
+ <xsl:call-template name="output-literal-statement">
126
+ <xsl:with-param name="subject" select="$subject" />
127
+ <xsl:with-param name="predicate" select="$predicate" />
128
+ <xsl:with-param name="object" select="." />
129
+ </xsl:call-template>
130
+
131
+ </xsl:template>
132
+
133
+ <xsl:template match="*[not(node())]" mode="property">
134
+ <xsl:param name="subject" />
135
+
136
+ <xsl:variable name="predicate">
137
+ <xsl:call-template name="check-li" />
138
+ </xsl:variable>
139
+
140
+ <xsl:choose>
141
+
142
+ <xsl:when test="not(@*) or (@rdf:ID and count(@*) = 1)">
143
+ <xsl:call-template name="output-literal-statement">
144
+ <xsl:with-param name="subject" select="$subject" />
145
+ <xsl:with-param name="predicate" select="$predicate" />
146
+ <xsl:with-param name="object" select="''" />
147
+ </xsl:call-template>
148
+ </xsl:when>
149
+
150
+ <xsl:when test="@rdf:resource and count(@*) = 1">
151
+ <xsl:call-template name="output-statement">
152
+ <xsl:with-param name="subject" select="$subject" />
153
+ <xsl:with-param name="predicate" select="$predicate" />
154
+ <xsl:with-param name="object" select="@rdf:resource" />
155
+ </xsl:call-template>
156
+ </xsl:when>
157
+
158
+ <xsl:otherwise>
159
+ <xsl:variable name="id">
160
+ <xsl:choose>
161
+ <xsl:when test="@rdf:resource">
162
+ <xsl:value-of select="@rdf:resource" />
163
+ </xsl:when>
164
+ <xsl:when test="@rdf:ID">
165
+ <xsl:value-of select="concat($base-uri, '#', @rdf:ID)" />
166
+ </xsl:when>
167
+ <xsl:otherwise>
168
+ <xsl:value-of select="concat('_:', generate-id())" />
169
+ </xsl:otherwise>
170
+ </xsl:choose>
171
+ </xsl:variable>
172
+ <xsl:variable name="property-attributes">
173
+ <xsl:apply-templates select="@*" mode="property">
174
+ <xsl:with-param name="subject" select="$id" />
175
+ </xsl:apply-templates>
176
+ </xsl:variable>
177
+ <xsl:if test="$property-attributes">
178
+ <xsl:call-template name="output-statement">
179
+ <xsl:with-param name="subject" select="$subject" />
180
+ <xsl:with-param name="predicate" select="$predicate" />
181
+ <xsl:with-param name="object" select="$id" />
182
+ </xsl:call-template>
183
+ <xsl:copy-of select="$property-attributes" />
184
+ </xsl:if>
185
+ </xsl:otherwise>
186
+
187
+ </xsl:choose>
188
+
189
+ </xsl:template>
190
+
191
+ <!-- property attributes -->
192
+
193
+ <xsl:template match="@rdf:RDF" mode="property" />
194
+ <xsl:template match="@rdf:Description" mode="property" />
195
+ <xsl:template match="@rdf:ID" mode="property" />
196
+ <xsl:template match="@rdf:about" mode="property" />
197
+ <xsl:template match="@rdf:bagID" mode="property" />
198
+ <xsl:template match="@rdf:parseType" mode="property" />
199
+ <xsl:template match="@rdf:resource" mode="property" />
200
+ <xsl:template match="@rdf:li" mode="property" />
201
+
202
+ <xsl:template match="@rdf:type" mode="property">
203
+ <xsl:param name="subject" />
204
+
205
+ <xsl:call-template name="output-type-statement">
206
+ <xsl:with-param name="subject" select="$subject" />
207
+ <xsl:with-param name="object" select="." />
208
+ </xsl:call-template>
209
+
210
+ </xsl:template>
211
+
212
+ <xsl:template match="@*" mode="property">
213
+ <xsl:param name="subject" />
214
+
215
+ <xsl:call-template name="output-literal-statement">
216
+ <xsl:with-param name="subject" select="$subject" />
217
+ <xsl:with-param name="predicate" select="concat(namespace-uri(), local-name())" />
218
+ <xsl:with-param name="object" select="." />
219
+ </xsl:call-template>
220
+
221
+ </xsl:template>
222
+
223
+ <!-- helper templates -->
224
+
225
+ <xsl:template name="check-li">
226
+
227
+ <xsl:variable name="id" select="concat(namespace-uri(), local-name())" />
228
+
229
+ <xsl:choose>
230
+ <xsl:when test="$id = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#li'">
231
+ <xsl:value-of select="concat('http://www.w3.org/1999/02/22-rdf-syntax-ns#_', 1 + count(preceding-sibling::rdf:li))" />
232
+ </xsl:when>
233
+ <xsl:otherwise>
234
+ <xsl:value-of select="$id" />
235
+ </xsl:otherwise>
236
+ </xsl:choose>
237
+
238
+ </xsl:template>
239
+
240
+ <xsl:template name="output-type-statement">
241
+ <xsl:param name="subject" />
242
+ <xsl:param name="object" />
243
+
244
+ <xsl:call-template name="output-statement">
245
+ <xsl:with-param name="subject" select="$subject" />
246
+ <xsl:with-param name="predicate" select="'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'" />
247
+ <xsl:with-param name="object" select="$object" />
248
+ </xsl:call-template>
249
+
250
+ </xsl:template>
251
+
252
+ <xsl:template name="output-statement">
253
+ <xsl:param name="subject" />
254
+ <xsl:param name="predicate" />
255
+ <xsl:param name="object" />
256
+
257
+ <xsl:if test="not(starts-with($subject, '_:'))">
258
+ <xsl:text>&lt;</xsl:text>
259
+ </xsl:if>
260
+
261
+ <xsl:value-of select="$subject" />
262
+
263
+ <xsl:if test="not(starts-with($subject, '_:'))">
264
+ <xsl:text>&gt;</xsl:text>
265
+ </xsl:if>
266
+
267
+ <xsl:text> &lt;</xsl:text>
268
+ <xsl:value-of select="$predicate" />
269
+ <xsl:text>&gt; </xsl:text>
270
+
271
+ <xsl:if test="not(starts-with($object, '_:'))">
272
+ <xsl:text>&lt;</xsl:text>
273
+ </xsl:if>
274
+
275
+ <xsl:value-of select="$object" />
276
+
277
+ <xsl:if test="not(starts-with($object, '_:'))">
278
+ <xsl:text>&gt;</xsl:text>
279
+ </xsl:if>
280
+
281
+ <xsl:text> .&#10;</xsl:text>
282
+
283
+ </xsl:template>
284
+
285
+ <xsl:template name="output-literal-statement">
286
+ <xsl:param name="subject" />
287
+ <xsl:param name="predicate" />
288
+ <xsl:param name="object" />
289
+
290
+ <xsl:if test="not(starts-with($subject, '_:'))">
291
+ <xsl:text>&lt;</xsl:text>
292
+ </xsl:if>
293
+
294
+ <xsl:value-of select="$subject" />
295
+
296
+ <xsl:if test="not(starts-with($subject, '_:'))">
297
+ <xsl:text>&gt;</xsl:text>
298
+ </xsl:if>
299
+
300
+ <xsl:text> &lt;</xsl:text>
301
+ <xsl:value-of select="$predicate" />
302
+ <xsl:text>&gt; "</xsl:text>
303
+ <xsl:value-of select="$object" />
304
+ <xsl:text>" .&#10;</xsl:text>
305
+
306
+ </xsl:template>
307
+
308
+ </xsl:transform>
@@ -0,0 +1,219 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ rdf2r3x v1.2
4
+
5
+ XSLT for transforming RDF/XML as output from Redland into R3X,
6
+ a syntactic profile of RDF/XML with the following characteristics:
7
+ * Statements are grouped by subject.
8
+ * The RSS 1.0 syntactic profile (including the content module) is respected
9
+ if a channel with rss:items is present.
10
+ * rss:title and rss:description elements are added for RSS classes, if not
11
+ already present, based on dc:title and dc:description.
12
+ * dc:date elements are added when dcterms:created, dcterms:modified, and
13
+ dcterms:issued are encountered and there isn?t already a dc:date element
14
+ present with the same value.
15
+ * The RDF properties rdf:_1, rdf:_2, etc. are converted to rdf:li.
16
+
17
+ See: http://www.wasab.dk/morten/blog/archives/2004/05/30/transforming-rdfxml-with-xslt
18
+
19
+ Copyright (c) 2003-2008 Morten Frederiksen
20
+ License: http://www.gnu.org/licenses/gpl
21
+
22
+ Changes:
23
+ * 1.2: dc:date elements are not created if the parameter dates is set to a false value.
24
+ * 1.1: A maximum of one dc:date element is now created, with dcterms:modified taking
25
+ precedence over dcterms:issued which takes precedence over dcterms:created.
26
+
27
+ -->
28
+ <!DOCTYPE rdf:RDF [
29
+ <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
30
+ <!ENTITY dc 'http://purl.org/dc/elements/1.1/'>
31
+ <!ENTITY dcterms 'http://purl.org/dc/terms/'>
32
+ <!ENTITY rss 'http://purl.org/rss/1.0/'>
33
+ <!ENTITY content 'http://purl.org/rss/1.0/modules/content/'>
34
+ ]>
35
+ <xsl:stylesheet
36
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
37
+ xmlns:rdf="&rdf;"
38
+ xmlns:dc="&dc;"
39
+ xmlns:dcterms="&dcterms;"
40
+ xmlns:rss="&rss;"
41
+ xmlns:content="&content;"
42
+ version="1.0">
43
+ <xsl:output
44
+ method="xml"
45
+ indent="yes"
46
+ omit-xml-declaration="no"
47
+ encoding="utf-8"/>
48
+
49
+ <xsl:key name="resources" match="/*/*[@rdf:about]" use="@rdf:about"/>
50
+ <xsl:key name="bnodes" match="/*/*[@rdf:nodeID]" use="@rdf:nodeID"/>
51
+
52
+ <xsl:param name="dates" select="'yes'"/>
53
+
54
+ <xsl:template match="/">
55
+ <xsl:apply-templates select="rdf:RDF"/>
56
+ </xsl:template>
57
+
58
+ <!-- Root element, output RSS channel element first, then items, then the rest. -->
59
+ <xsl:template match="rdf:RDF">
60
+ <xsl:copy>
61
+ <xsl:for-each select="*[@rdf:about and rdf:type[@rdf:resource='&rss;channel'] and key('resources',@rdf:about)/rss:items]">
62
+ <xsl:apply-templates mode="subject" select="."/>
63
+ </xsl:for-each>
64
+ <xsl:for-each select="*[@rdf:about and rdf:type[@rdf:resource='&rss;item']]">
65
+ <xsl:apply-templates mode="subject" select="."/>
66
+ </xsl:for-each>
67
+ <xsl:for-each select="*[not(key('resources',@rdf:about)/rdf:type[@rdf:resource='&rss;channel'] and key('resources',@rdf:about)/rss:items or key('resources',@rdf:about)/rdf:type[@rdf:resource='&rss;item'])]">
68
+ <xsl:if test="not(@rdf:about and following-sibling::*/@rdf:about=@rdf:about or @rdf:nodeID and following-sibling::*/@rdf:nodeID=@rdf:nodeID)">
69
+ <xsl:apply-templates mode="subject" select="."/>
70
+ </xsl:if>
71
+ </xsl:for-each>
72
+ </xsl:copy>
73
+ </xsl:template>
74
+
75
+ <!-- Skip an rdf:Seq that is the object of rss:items in an rss:channel. -->
76
+ <xsl:template mode="subject" priority="0.9" match="*[@rdf:nodeID and key('bnodes',@rdf:nodeID)/rdf:type[@rdf:resource='&rdf;Seq'] and @rdf:nodeID=key('resources',/*/*[rdf:type[@rdf:resource='&rss;channel']]/@rdf:about)/rss:items/@rdf:nodeID]">
77
+ </xsl:template>
78
+
79
+ <!-- Skip an rdf:Bag with content:item objects. -->
80
+ <xsl:template mode="subject" priority="0.9" match="*[@rdf:nodeID and key('bnodes',@rdf:nodeID)/rdf:type[@rdf:resource='&rdf;Bag'] and key('bnodes',key('bnodes',@rdf:nodeID)/rdf:_1/@rdf:nodeID)/rdf:type[@rdf:resource='&content;item']]">
81
+ </xsl:template>
82
+
83
+ <!-- Skip a content:item. -->
84
+ <xsl:template mode="subject" priority="0.9" match="*[@rdf:nodeID and key('bnodes',@rdf:nodeID)/rdf:type[@rdf:resource='&content;item']]">
85
+ </xsl:template>
86
+
87
+ <!-- Used named nodes for RSS classes. -->
88
+ <xsl:template mode="subject" priority="0.3" match="*[@rdf:about and key('resources',@rdf:about)/rdf:type[@rdf:resource='&rss;channel' or @rdf:resource='&rss;item' or @rdf:resource='&rss;image' or @rdf:resource='&rss;textinput']]">
89
+ <xsl:element name="rss:{substring-after(key('resources',@rdf:about)/rdf:type[@rdf:resource='&rss;channel' or @rdf:resource='&rss;item' or @rdf:resource='&rss;image' or @rdf:resource='&rss;textinput']/@rdf:resource,'&rss;')}">
90
+ <xsl:copy-of select="@*"/>
91
+ <xsl:apply-templates mode="properties" select="."/>
92
+ </xsl:element>
93
+ </xsl:template>
94
+
95
+ <!-- All other subject node elements. -->
96
+ <xsl:template mode="subject" priority="0.1" match="*">
97
+ <xsl:copy>
98
+ <xsl:copy-of select="@*"/>
99
+ <xsl:apply-templates mode="properties" select="."/>
100
+ </xsl:copy>
101
+ </xsl:template>
102
+
103
+ <!-- Properties for a node element, with sorted rdf:li properties. -->
104
+ <xsl:template mode="properties" match="*">
105
+ <xsl:apply-templates mode="property" select="key('bnodes',@rdf:nodeID)/rdf:*[starts-with(local-name(),'_')]|key('resources',@rdf:about)/rdf:*[starts-with(local-name(),'_')]">
106
+ <xsl:sort select="substring(local-name(),2)" data-type="number"/>
107
+ </xsl:apply-templates>
108
+ <xsl:apply-templates mode="property" select="node()|key('bnodes',@rdf:nodeID)/*[namespace-uri()!='&rdf;' or not(starts-with(local-name(),'_'))]|key('resources',@rdf:about)/*[namespace-uri()!='&rdf;' or not(starts-with(local-name(),'_'))]"/>
109
+ </xsl:template>
110
+
111
+ <!-- XML Literal. -->
112
+ <xsl:template mode="property" priority="0.2" match="*[@rdf:parseType='Literal']">
113
+ <xsl:copy>
114
+ <xsl:copy-of select="@*"/>
115
+ <xsl:copy-of select="node()"/>
116
+ </xsl:copy>
117
+ </xsl:template>
118
+
119
+ <!-- Title and description properties for RSS classes. -->
120
+ <xsl:template mode="property" priority="0.2" match="dc:title[key('resources',../@rdf:about)/rdf:type[@rdf:resource='&rss;channel' or @rdf:resource='&rss;item' or @rdf:resource='&rss;image' or @rdf:resource='&rss;textinput'] and not(key('resources',../@rdf:about)/rss:title)]">
121
+ <rss:title>
122
+ <xsl:value-of select="."/>
123
+ </rss:title>
124
+ <dc:title>
125
+ <xsl:value-of select="."/>
126
+ </dc:title>
127
+ </xsl:template>
128
+
129
+ <xsl:template mode="property" priority="0.2" match="dc:description[key('resources',../@rdf:about)/rdf:type[@rdf:resource='&rss;channel' or @rdf:resource='&rss;item' or @rdf:resource='&rss;image' or @rdf:resource='&rss;textinput'] and not(key('resources',../@rdf:about)/rss:description)]">
130
+ <rss:description>
131
+ <xsl:value-of select="."/>
132
+ </rss:description>
133
+ <dc:description>
134
+ <xsl:value-of select="."/>
135
+ </dc:description>
136
+ </xsl:template>
137
+
138
+ <!-- Dublin Core date sub properties. -->
139
+ <xsl:template mode="property" priority="0.2" match="
140
+ dcterms:modified[
141
+ not(../dc:date=.)
142
+ and (not(../@rdf:about) or not(key('resources',../@rdf:about)/dc:date=.))
143
+ and (not(../@rdf:nodeID) or not(key('bnodes',../@rdf:nodeID)/dc:date=.))]
144
+ |dcterms:issued[
145
+ not(../dc:date=.)
146
+ and (not(../@rdf:about) or not(key('resources',../@rdf:about)/dc:date=.))
147
+ and (not(../@rdf:nodeID) or not(key('bnodes',../@rdf:nodeID)/dc:date=.))
148
+ and not(../dcterms:modified)
149
+ and (not(../@rdf:about) or not(key('resources',../@rdf:about)/dcterms:modified))
150
+ and (not(../@rdf:nodeID) or not(key('bnodes',../@rdf:nodeID)/dcterms:modified))]
151
+ |dcterms:created[
152
+ not(../dc:date=.)
153
+ and (not(../@rdf:about) or not(key('resources',../@rdf:about)/dc:date=.))
154
+ and (not(../@rdf:nodeID) or not(key('bnodes',../@rdf:nodeID)/dc:date=.))
155
+ and not(../dcterms:modified)
156
+ and (not(../@rdf:about) or not(key('resources',../@rdf:about)/dcterms:modified))
157
+ and (not(../@rdf:nodeID) or not(key('bnodes',../@rdf:nodeID)/dcterms:modified))
158
+ and not(../dcterms:issued)
159
+ and (not(../@rdf:about) or not(key('resources',../@rdf:about)/dcterms:issued))
160
+ and (not(../@rdf:nodeID) or not(key('bnodes',../@rdf:nodeID)/dcterms:issued))]">
161
+ <xsl:element name="dcterms:{local-name()}">
162
+ <xsl:value-of select="."/>
163
+ </xsl:element>
164
+ <xsl:if test="$dates='yes'">
165
+ <dc:date>
166
+ <xsl:value-of select="."/>
167
+ </dc:date>
168
+ </xsl:if>
169
+ </xsl:template>
170
+
171
+ <!-- Don't output type statements for RSS classes already named. -->
172
+ <xsl:template mode="property" priority="0.2" match="rdf:type[@rdf:resource='&rss;channel' or @rdf:resource='&rss;item' or @rdf:resource='&rss;image' or @rdf:resource='&rss;textinput' or @rdf:resource='&content;item']">
173
+ </xsl:template>
174
+
175
+ <!-- Handle syntax profile for content:items. -->
176
+ <xsl:template mode="property" priority="0.2" match="content:items[@rdf:nodeID]">
177
+ <content:items>
178
+ <rdf:Bag>
179
+ <xsl:for-each select="key('bnodes',@rdf:nodeID)/rdf:*[starts-with(local-name(),'_')]">
180
+ <xsl:sort select="substring(local-name(),2)" data-type="number"/>
181
+ <rdf:li>
182
+ <content:item>
183
+ <xsl:apply-templates mode="property" select="key('bnodes',@rdf:nodeID)/*"/>
184
+ </content:item>
185
+ </rdf:li>
186
+ </xsl:for-each>
187
+ </rdf:Bag>
188
+ </content:items>
189
+ </xsl:template>
190
+
191
+ <!-- Handle syntax profile for rss:items. -->
192
+ <xsl:template mode="property" priority="0.2" match="rss:items[@rdf:nodeID and key('resources',../@rdf:about)/rdf:type[@rdf:resource='&rss;channel']]">
193
+ <rss:items>
194
+ <rdf:Seq>
195
+ <xsl:for-each select="key('bnodes',@rdf:nodeID)/rdf:*[starts-with(local-name(),'_')]">
196
+ <xsl:sort select="substring(local-name(),2)" data-type="number"/>
197
+ <rdf:li rdf:resource="{@rdf:resource}"/>
198
+ </xsl:for-each>
199
+ </rdf:Seq>
200
+ </rss:items>
201
+ </xsl:template>
202
+
203
+ <!-- Transform rdf:_n into rdf:li. -->
204
+ <xsl:template mode="property" priority="0.2" match="rdf:*[substring(local-name(),1,1)='_']">
205
+ <rdf:li>
206
+ <xsl:copy-of select="@*"/>
207
+ <xsl:copy-of select="node()"/>
208
+ </rdf:li>
209
+ </xsl:template>
210
+
211
+ <!-- Handle other properties. -->
212
+ <xsl:template mode="property" priority="0.1" match="*">
213
+ <xsl:copy>
214
+ <xsl:copy-of select="@*"/>
215
+ <xsl:apply-templates mode="subject" select="node()"/>
216
+ </xsl:copy>
217
+ </xsl:template>
218
+
219
+ </xsl:stylesheet>
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdfobjects
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Ross Singer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-06 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: nokogiri
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rsinger-curies
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: json
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ description: RDFObjects are intended to simplify working with RDF data by providing a (more) Ruby-like interface to resources (thanks to OpenStruct).
46
+ email: rossfsinger@gmail.com
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files:
52
+ - LICENSE
53
+ - README
54
+ files:
55
+ - LICENSE
56
+ - README
57
+ - lib/rdf_objects.rb
58
+ - lib/rdf_objects/curies.rb
59
+ - lib/rdf_objects/data_types.rb
60
+ - lib/rdf_objects/http_client.rb
61
+ - lib/rdf_objects/parsers.rb
62
+ - lib/rdf_objects/rdf_resource.rb
63
+ - lib/rdf_objects/serializers.rb
64
+ - lib/xsl/RDFa2RDFXML.xsl
65
+ - lib/xsl/rdf2nt.xsl
66
+ - lib/xsl/rdf2r3x.xsl
67
+ has_rdoc: true
68
+ homepage: http://github.com/rsinger/RDFObjects/tree
69
+ licenses: []
70
+
71
+ post_install_message:
72
+ rdoc_options:
73
+ - --charset=UTF-8
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ version:
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ version:
88
+ requirements: []
89
+
90
+ rubyforge_project:
91
+ rubygems_version: 1.3.5
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: A DSL for working with RDF resources.
95
+ test_files: []
96
+