rdf-rdfa 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -0
- data/README.rdoc +59 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/example.rb +27 -0
- data/lib/rdfa/format.rb +19 -0
- data/lib/rdfa/reader.rb +798 -0
- data/lib/rdfa/reader/exceptions.rb +14 -0
- data/lib/rdfa/reader/namespace.rb +72 -0
- data/lib/rdfa/reader/version.rb +23 -0
- data/spec/namespaces_spec.rb +112 -0
- data/spec/rdfa-triples/0001.nt +1 -0
- data/spec/rdfa-triples/0006.nt +2 -0
- data/spec/rdfa-triples/0007.nt +3 -0
- data/spec/rdfa-triples/0008.nt +1 -0
- data/spec/rdfa-triples/0009.nt +1 -0
- data/spec/rdfa-triples/0010.nt +2 -0
- data/spec/rdfa-triples/0011.nt +3 -0
- data/spec/rdfa-triples/0012.nt +1 -0
- data/spec/rdfa-triples/0013.nt +1 -0
- data/spec/rdfa-triples/0014.nt +1 -0
- data/spec/rdfa-triples/0015.nt +2 -0
- data/spec/rdfa-triples/0017.nt +3 -0
- data/spec/rdfa-triples/0018.nt +1 -0
- data/spec/rdfa-triples/0019.nt +1 -0
- data/spec/rdfa-triples/0020.nt +1 -0
- data/spec/rdfa-triples/0021.nt +1 -0
- data/spec/rdfa-triples/0023.nt +1 -0
- data/spec/rdfa-triples/0025.nt +2 -0
- data/spec/rdfa-triples/0026.nt +1 -0
- data/spec/rdfa-triples/0027.nt +1 -0
- data/spec/rdfa-triples/0029.nt +1 -0
- data/spec/rdfa-triples/0030.nt +1 -0
- data/spec/rdfa-triples/0031.nt +1 -0
- data/spec/rdfa-triples/0032.nt +1 -0
- data/spec/rdfa-triples/0033.nt +2 -0
- data/spec/rdfa-triples/0034.nt +1 -0
- data/spec/rdfa-triples/0035.nt +1 -0
- data/spec/rdfa-triples/0036.nt +1 -0
- data/spec/rdfa-triples/0037.nt +1 -0
- data/spec/rdfa-triples/0038.nt +1 -0
- data/spec/rdfa-triples/0039.nt +1 -0
- data/spec/rdfa-triples/0040.nt +1 -0
- data/spec/rdfa-triples/0041.nt +1 -0
- data/spec/rdfa-triples/0042.nt +0 -0
- data/spec/rdfa-triples/0046.nt +3 -0
- data/spec/rdfa-triples/0047.nt +3 -0
- data/spec/rdfa-triples/0048.nt +3 -0
- data/spec/rdfa-triples/0049.nt +2 -0
- data/spec/rdfa-triples/0050.nt +2 -0
- data/spec/rdfa-triples/0051.nt +2 -0
- data/spec/rdfa-triples/0052.nt +1 -0
- data/spec/rdfa-triples/0053.nt +2 -0
- data/spec/rdfa-triples/0054.nt +2 -0
- data/spec/rdfa-triples/0055.nt +2 -0
- data/spec/rdfa-triples/0056.nt +3 -0
- data/spec/rdfa-triples/0057.nt +4 -0
- data/spec/rdfa-triples/0058.nt +6 -0
- data/spec/rdfa-triples/0059.nt +6 -0
- data/spec/rdfa-triples/0060.nt +2 -0
- data/spec/rdfa-triples/0061.nt +1 -0
- data/spec/rdfa-triples/0062.nt +1 -0
- data/spec/rdfa-triples/0063.nt +1 -0
- data/spec/rdfa-triples/0064.nt +1 -0
- data/spec/rdfa-triples/0065.nt +3 -0
- data/spec/rdfa-triples/0066.nt +1 -0
- data/spec/rdfa-triples/0067.nt +1 -0
- data/spec/rdfa-triples/0068.nt +1 -0
- data/spec/rdfa-triples/0069.nt +1 -0
- data/spec/rdfa-triples/0070.nt +1 -0
- data/spec/rdfa-triples/0071.nt +1 -0
- data/spec/rdfa-triples/0072.nt +1 -0
- data/spec/rdfa-triples/0073.nt +1 -0
- data/spec/rdfa-triples/0074.nt +1 -0
- data/spec/rdfa-triples/0075.nt +1 -0
- data/spec/rdfa-triples/0076.nt +23 -0
- data/spec/rdfa-triples/0077.nt +23 -0
- data/spec/rdfa-triples/0078.nt +6 -0
- data/spec/rdfa-triples/0079.nt +3 -0
- data/spec/rdfa-triples/0080.nt +1 -0
- data/spec/rdfa-triples/0081.nt +6 -0
- data/spec/rdfa-triples/0082.nt +8 -0
- data/spec/rdfa-triples/0083.nt +6 -0
- data/spec/rdfa-triples/0084.nt +8 -0
- data/spec/rdfa-triples/0085.nt +4 -0
- data/spec/rdfa-triples/0086.nt +0 -0
- data/spec/rdfa-triples/0087.nt +23 -0
- data/spec/rdfa-triples/0088.nt +3 -0
- data/spec/rdfa-triples/0089.nt +1 -0
- data/spec/rdfa-triples/0090.nt +1 -0
- data/spec/rdfa-triples/0091.nt +3 -0
- data/spec/rdfa-triples/0092.nt +3 -0
- data/spec/rdfa-triples/0093.nt +2 -0
- data/spec/rdfa-triples/0094.nt +3 -0
- data/spec/rdfa-triples/0099.nt +1 -0
- data/spec/rdfa-triples/0100.nt +3 -0
- data/spec/rdfa-triples/0101.nt +3 -0
- data/spec/rdfa-triples/0102.nt +1 -0
- data/spec/rdfa-triples/0103.nt +1 -0
- data/spec/rdfa-triples/0104.nt +3 -0
- data/spec/rdfa-triples/0105.nt +1 -0
- data/spec/rdfa-triples/0106.nt +1 -0
- data/spec/rdfa-triples/0107.nt +0 -0
- data/spec/rdfa-triples/0108.nt +1 -0
- data/spec/rdfa-triples/0109.nt +1 -0
- data/spec/rdfa-triples/0110.nt +1 -0
- data/spec/rdfa-triples/0111.nt +2 -0
- data/spec/rdfa-triples/0112.nt +1 -0
- data/spec/rdfa-triples/0113.nt +2 -0
- data/spec/rdfa-triples/0114.nt +3 -0
- data/spec/rdfa-triples/0115.nt +4 -0
- data/spec/rdfa-triples/0116.nt +2 -0
- data/spec/rdfa-triples/0117.nt +2 -0
- data/spec/rdfa-triples/0118.nt +1 -0
- data/spec/rdfa-triples/0119.nt +1 -0
- data/spec/rdfa-triples/0120.nt +1 -0
- data/spec/rdfa-triples/0121.nt +2 -0
- data/spec/rdfa-triples/0122.nt +1 -0
- data/spec/rdfa-triples/0123.nt +3 -0
- data/spec/rdfa-triples/0124.nt +4 -0
- data/spec/rdfa-triples/0125.nt +1 -0
- data/spec/rdfa-triples/0126.nt +3 -0
- data/spec/rdfa-triples/1001.nt +6 -0
- data/spec/rdfa_helper.rb +188 -0
- data/spec/rdfa_parser_spec.rb +146 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +8 -0
- metadata +246 -0
@@ -0,0 +1 @@
|
|
1
|
+
<http://www.example.org/faq> <http://purl.org/dc/elements/1.1/title> "Example FAQ" .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://www.example.org/> <http://purl.org/dc/elements/1.1/creator> <http://www.example.org/jane> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://www.example.org/> <http://purl.org/dc/elements/1.1/creator> <http://www.example.org/jane> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://www.example.org/> <http://www.w3.org/1999/xhtml/vocab#license> <http://creativecommons.org/licenses/by-nd/3.0/> .
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#alternate> <http://example.org/alternate> .
|
2
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#appendix> <http://example.org/appendix> .
|
3
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#bookmark> <http://example.org/bookmark> .
|
4
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#cite> <http://example.org/cite> .
|
5
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#chapter> <http://example.org/chapter> .
|
6
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#contents> <http://example.org/contents> .
|
7
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#copyright> <http://example.org/copyright> .
|
8
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#glossary> <http://example.org/glossary> .
|
9
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#help> <http://example.org/help> .
|
10
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#icon> <http://example.org/icon> .
|
11
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#index> <http://example.org/index> .
|
12
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#meta> <http://example.org/meta> .
|
13
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/next> .
|
14
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#p3pv1> <http://example.org/p3pv1> .
|
15
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#prev> <http://example.org/prev> .
|
16
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#role> <http://example.org/role> .
|
17
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#section> <http://example.org/section> .
|
18
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#subsection> <http://example.org/subsection> .
|
19
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#start> <http://example.org/start> .
|
20
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#license> <http://example.org/license> .
|
21
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#up> <http://example.org/up> .
|
22
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#last> <http://example.org/last> .
|
23
|
+
<$TCPATH/0076.xhtml> <http://www.w3.org/1999/xhtml/vocab#stylesheet> <http://example.org/stylesheet> .
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#alternate> <http://example.org/alternate> .
|
2
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#appendix> <http://example.org/appendix> .
|
3
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#bookmark> <http://example.org/bookmark> .
|
4
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#cite> <http://example.org/cite> .
|
5
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#chapter> <http://example.org/chapter> .
|
6
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#contents> <http://example.org/contents> .
|
7
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#copyright> <http://example.org/copyright> .
|
8
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#glossary> <http://example.org/glossary> .
|
9
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#help> <http://example.org/help> .
|
10
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#icon> <http://example.org/icon> .
|
11
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#index> <http://example.org/index> .
|
12
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#meta> <http://example.org/meta> .
|
13
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/next> .
|
14
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#p3pv1> <http://example.org/p3pv1> .
|
15
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#prev> <http://example.org/prev> .
|
16
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#role> <http://example.org/role> .
|
17
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#section> <http://example.org/section> .
|
18
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#subsection> <http://example.org/subsection> .
|
19
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#start> <http://example.org/start> .
|
20
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#license> <http://example.org/license> .
|
21
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#up> <http://example.org/up> .
|
22
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#last> <http://example.org/last> .
|
23
|
+
<$TCPATH/0077.xhtml> <http://www.w3.org/1999/xhtml/vocab#stylesheet> <http://example.org/stylesheet> .
|
@@ -0,0 +1,6 @@
|
|
1
|
+
_:a <http://xmlns.com/foaf/0.1/name> "Ivan Herman" .
|
2
|
+
_:a <http://xmlns.com/foaf/0.1/mailbox> <mailto:ivan@w3.org> .
|
3
|
+
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
4
|
+
_:b <http://xmlns.com/foaf/0.1/name> "Mark Birbeck" .
|
5
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> _:a .
|
6
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> _:b .
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> <http://www.ivan-herman.org/Ivan_Herman> .
|
2
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> <http://www.w3.org/People/Berners-Lee/card#i> .
|
3
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> <http://danbri.org/foaf.rdf#danbri> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> <http://danbri.org/foaf.rdf#danbri> .
|
@@ -0,0 +1,6 @@
|
|
1
|
+
_:a <http://xmlns.com/foaf/0.1/knows> <http://www.example.org/#somebody> .
|
2
|
+
_:a <http://xmlns.com/foaf/0.1/mailbox> <mailto:ivan@w3.org> .
|
3
|
+
_:a <http://xmlns.com/foaf/0.1/name> "Ivan Herman" .
|
4
|
+
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
5
|
+
_:b <http://xmlns.com/foaf/0.1/knows> <http://www.example.org/#somebody> .
|
6
|
+
_:b <http://xmlns.com/foaf/0.1/name> "Mark Birbeck" .
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> _:a .
|
2
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> _:b .
|
3
|
+
_:a <http://xmlns.com/foaf/0.1/knows> <http://www.example.org/#somebody> .
|
4
|
+
_:a <http://xmlns.com/foaf/0.1/mailbox> <mailto:ivan@w3.org> .
|
5
|
+
_:a <http://xmlns.com/foaf/0.1/name> "Ivan Herman" .
|
6
|
+
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
7
|
+
_:b <http://xmlns.com/foaf/0.1/knows> <http://www.example.org/#somebody> .
|
8
|
+
_:b <http://xmlns.com/foaf/0.1/name> "Mark Birbeck" .
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> _:a .
|
2
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> <http://danbri.org/foaf.rdf#danbri> .
|
3
|
+
_:a <http://xmlns.com/foaf/0.1/name> "Ivan Herman" .
|
4
|
+
_:a <http://xmlns.com/foaf/0.1/mailbox> <mailto:ivan@w3.org> .
|
5
|
+
<http://danbri.org/foaf.rdf#danbri> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
6
|
+
<http://danbri.org/foaf.rdf#danbri> <http://xmlns.com/foaf/0.1/name> "Dan Brickley" .
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> _:a .
|
2
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> <http://danbri.org/foaf.rdf#danbri> .
|
3
|
+
_:a <http://xmlns.com/foaf/0.1/knows> <http://www.example.org/#somebody> .
|
4
|
+
_:a <http://xmlns.com/foaf/0.1/mailbox> <mailto:ivan@w3.org> .
|
5
|
+
_:a <http://xmlns.com/foaf/0.1/name> "Ivan Herman" .
|
6
|
+
<http://danbri.org/foaf.rdf#danbri> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
7
|
+
<http://danbri.org/foaf.rdf#danbri> <http://xmlns.com/foaf/0.1/knows> <http://www.example.org/#somebody> .
|
8
|
+
<http://danbri.org/foaf.rdf#danbri> <http://xmlns.com/foaf/0.1/name> "Dan Brickley" .
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> _:a .
|
2
|
+
_:a <http://xmlns.com/foaf/0.1/knows> <http://www.ivan-herman.org/Ivan_Herman> .
|
3
|
+
_:a <http://xmlns.com/foaf/0.1/knows> <http://www.w3.org/People/Berners-Lee/card#i> .
|
4
|
+
_:a <http://xmlns.com/foaf/0.1/knows> <http://danbri.org/foaf.rdf#danbri> .
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#alternate> <http://example.org/alternate> .
|
2
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#appendix> <http://example.org/appendix> .
|
3
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#bookmark> <http://example.org/bookmark> .
|
4
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#cite> <http://example.org/cite> .
|
5
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#chapter> <http://example.org/chapter> .
|
6
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#contents> <http://example.org/contents> .
|
7
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#copyright> <http://example.org/copyright> .
|
8
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#glossary> <http://example.org/glossary> .
|
9
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#help> <http://example.org/help> .
|
10
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#icon> <http://example.org/icon> .
|
11
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#index> <http://example.org/index> .
|
12
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#meta> <http://example.org/meta> .
|
13
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/next> .
|
14
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#p3pv1> <http://example.org/p3pv1> .
|
15
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#prev> <http://example.org/prev> .
|
16
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#role> <http://example.org/role> .
|
17
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#section> <http://example.org/section> .
|
18
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#subsection> <http://example.org/subsection> .
|
19
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#start> <http://example.org/start> .
|
20
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#license> <http://example.org/license> .
|
21
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#up> <http://example.org/up> .
|
22
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#last> <http://example.org/last> .
|
23
|
+
<$TCPATH/0087.xhtml> <http://www.w3.org/1999/xhtml/vocab#stylesheet> <http://example.org/stylesheet> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://example.org/example.png> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Image> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://example.org/example.png> <http://www.w3.org/1999/xhtml/vocab#license> <http://creativecommons.org/licenses/by-nc-sa/2.0/> .
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<$TCPATH/0092.xhtml> <http://purl.org/dc/elements/1.1/creator> "Albert Einstein" .
|
2
|
+
# One of the allowed results
|
3
|
+
<$TCPATH/0092.xhtml> <http://purl.org/dc/elements/1.1/title> "E = mc<sup xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">2</sup>: The Most Urgent Problem of Our Time"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<$TCPATH/0094.xhtml> <http://purl.org/dc/elements/1.1/creator> "Albert Einstein" .
|
2
|
+
# One of the allowed results
|
3
|
+
<$TCPATH/0094.xhtml> <http://purl.org/dc/elements/1.1/title> "E = mc<sup xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:bla=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">2</sup>: The Most Urgent Problem of Our Time"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://www.cwi.nl/~steven/> <http://www.example.org/likes> "\n We put thirty spokes together and call it a wheel;\n But it is on the space where there is nothing that the usefulness of the wheel depends.\n We turn clay to make a vessel;\n But it is on the space where there is nothing that the usefulness of the vessel depends.\n We pierce doors and windows to make a house;\n And it is on these spaces where there is nothing that the usefulness of the house depends.\n Therefore just as we take advantage of what is, we should recognize the usefulness of what is not.\n\n Lao Tzu: Tao Te Ching" .
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<http://www.example.org> <http://example.org/rdf/example> "Some text here in <strong xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:ex=\"http://example.org/rdf/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:svg=\"http://www.w3.org/2000/svg\">bold</strong> and an svg rectangle: <svg:svg xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:ex=\"http://example.org/rdf/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:svg=\"http://www.w3.org/2000/svg\"><svg:rect svg:width=\"200\" svg:height=\"100\"></svg:rect></svg:svg>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
|
2
|
+
# Another
|
3
|
+
# <http://www.example.org> <http://example.org/rdf/example> "Some text here in <strong xmlns=\"http://www.w3.org/1999/xhtml\">bold</strong> and an svg rectangle: <svg:svg xmlns:svg=\"http://www.w3.org/2000/svg\"><svg:rect svg:height=\"100\" svg:width=\"200\"></svg:rect></svg:svg>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<http://www.example.org> <http://example.org/rdf/example> "Du texte ici en <strong xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:ex=\"http://example.org/rdf/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:svg=\"http://www.w3.org/2000/svg\" xml:lang=\"fr\">gras</strong> et un rectangle en svg: <svg:svg xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:ex=\"http://example.org/rdf/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:svg=\"http://www.w3.org/2000/svg\" xml:lang=\"fr\"><svg:rect svg:width=\"200\" svg:height=\"100\"></svg:rect></svg:svg>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
|
2
|
+
# Another
|
3
|
+
# <http://www.example.org> <http://example.org/rdf/example> "Du texte ici en <strong xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"fr\">gras</strong> et un rectangle en svg: <svg:svg xmlns:svg=\"http://www.w3.org/2000/svg\" xml:lang=\"fr\"><svg:rect svg:height=\"100\" svg:width=\"200\"></svg:rect></svg:svg>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://www.example.org> <http://example.org/rdf/example> "Du texte ici en <strong xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:ex=\"http://example.org/rdf/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xml:lang=\"fr\">gras</strong> et un rectangle en svg: <svg:svg xml:lang=\"hu\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:ex=\"http://example.org/rdf/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><svg:rect svg:height=\"100\" svg:width=\"200\"></svg:rect></svg:svg>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://www.example.org> <http://example.org/rdf/example> "Some text here in <strong xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:ex=\"http://example.org/rdf/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">bold</strong> and an svg rectangle: <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:ex=\"http://example.org/rdf/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><rect width=\"200\" height=\"100\"></rect></svg>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<$TCPATH/0105.xhtml> <http://purl.org/dc/elements/1.1/creator> _:a .
|
@@ -0,0 +1 @@
|
|
1
|
+
<$TCPATH/0106.xhtml> <http://purl.org/dc/elements/1.1/creator> _:a .
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://example.org/node> <http://example.org/property> "\u03B5\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03CC\n\u03AC\u03C3\u03C0\u03C1\u03BF \u03B4\u03B9\u03AC\u03C3\u03C4\u03B7\u03BC\u03B1\n"@el .
|
@@ -0,0 +1 @@
|
|
1
|
+
<$TCPATH/0109.xhtml> <http://purl.org/dc/elements/1.1/title> "Test 0109" .
|
@@ -0,0 +1 @@
|
|
1
|
+
<$TCPATH/0110.xhtml> <http://www.w3.org/1999/xhtml/vocab#next> _:a .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://example.org/node> <http://example.org/property> "not an XML Literal,\nwhitespace preserved\n" .
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<$TCPATH/0114.xhtml> <http://www.w3.org/1999/xhtml/vocab#up> <$TCPATH/rdfa-xhtml1-test-manifest.rdf> .
|
2
|
+
<$TCPATH/0114.xhtml> <http://www.w3.org/1999/xhtml/vocab#prev> <$TCPATH/0113.xhtml> .
|
3
|
+
<$TCPATH/0114.xhtml> <http://creativecommons.org/ns#attributionURL> <http://www.w3.org/> .
|
@@ -0,0 +1 @@
|
|
1
|
+
<$TCPATH/0118.xhtml> <http://purl.org/dc/elements/1.1/creator> "Ben" .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://example.org/> <http://purl.org/dc/elements/1.1/title> "Example Website" .
|
@@ -0,0 +1 @@
|
|
1
|
+
<http://www.w3.org/1999/xhtml/vocab#> <http://purl.org/dc/elements/1.1/title> "The XHTML Vocabulary Document" .
|
@@ -0,0 +1 @@
|
|
1
|
+
# This is a negative test. No triples should be generated from the XHTML+RDFa input document.
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<http://www.example.org#sub> <http://www.example.org/lower#one> <http://www.example.org#lower> .
|
2
|
+
<http://www.example.org#sub> <http://www.example.org/upper#two> <http://www.example.org#UPPER> .
|
3
|
+
<http://www.example.org#sub> <http://www.example.org/mixed#three> <http://www.example.org#MiXeD> .
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<http://www.example.org/me#shane> <http://xmlns.com/foaf/0.1/firstName> "Shane" .
|
2
|
+
<http://www.example.org/me#shane> <http://xmlns.com/foaf/0.1/surname> "McCarron" .
|
3
|
+
<http://www.example.org/me#shane> <http://xmlns.com/foaf/0.1/name> "Shane McCarron" .
|
4
|
+
<http://www.example.org/me#shane> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
@@ -0,0 +1 @@
|
|
1
|
+
# This is a negative test. No triples should be generated from the XHTML+RDFa input document.
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<http://www.example.org/#article> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Document> .
|
2
|
+
<http://www.example.org/#article> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#Post> .
|
3
|
+
<http://www.example.org/#article> <http://purl.org/dc/terms/title> "My article" .
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<$TCPATH/1001.xhtml#event1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/12/cal/icaltzd#Vevent> .
|
2
|
+
<$TCPATH/1001.xhtml#event1> <http://www.w3.org/2002/12/cal/icaltzd#summary> "Weekend off in Iona" .
|
3
|
+
<$TCPATH/1001.xhtml#event1> <http://www.w3.org/2002/12/cal/icaltzd#dtstart> "2006-10-21"^^<http://www.w3.org/2001/XMLSchema#date> .
|
4
|
+
<$TCPATH/1001.xhtml#event1> <http://www.w3.org/2002/12/cal/icaltzd#dtend> "2006-10-23"^^<http://www.w3.org/2001/XMLSchema#date> .
|
5
|
+
<$TCPATH/1001.xhtml#event1> <http://www.w3.org/2002/12/cal/icaltzd#url> <http://freetime.example.org/> .
|
6
|
+
<$TCPATH/1001.xhtml#event1> <http://www.w3.org/2002/12/cal/icaltzd#location> "Iona, UK" .
|
data/spec/rdfa_helper.rb
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
module RdfaHelper
|
2
|
+
# Class representing test cases in format http://www.w3.org/2006/03/test-description#
|
3
|
+
class TestCase
|
4
|
+
include Matchers
|
5
|
+
|
6
|
+
HTMLRE = Regexp.new('([0-9]{4,4})\.xhtml')
|
7
|
+
TCPATHRE = Regexp.compile('\$TCPATH')
|
8
|
+
|
9
|
+
attr_accessor :about
|
10
|
+
attr_accessor :name
|
11
|
+
attr_accessor :contributor
|
12
|
+
attr_accessor :title
|
13
|
+
attr_accessor :informationResourceInput
|
14
|
+
attr_accessor :informationResourceResults
|
15
|
+
attr_accessor :purpose
|
16
|
+
attr_accessor :reviewStatus
|
17
|
+
attr_accessor :suite
|
18
|
+
attr_accessor :specificationReference
|
19
|
+
attr_accessor :expectedResults
|
20
|
+
attr_accessor :parser
|
21
|
+
|
22
|
+
@@suite = ""
|
23
|
+
|
24
|
+
def initialize(statements, suite)
|
25
|
+
self.suite = suite
|
26
|
+
self.expectedResults = true
|
27
|
+
statements.each do |statement|
|
28
|
+
next if statement.subject.is_a?(BNode)
|
29
|
+
#next unless statement.subject.uri.to_s.match(/0001/)
|
30
|
+
unless self.about
|
31
|
+
self.about = Addressable::URI.parse(statement.subject.uri.to_s)
|
32
|
+
self.name = statement.subject.short_name || self.about
|
33
|
+
end
|
34
|
+
|
35
|
+
if statement.predicate.short_name == "expectedResults"
|
36
|
+
self.expectedResults = statement.object.contents == "true"
|
37
|
+
#puts "expectedResults = #{statement.object.literal.value}"
|
38
|
+
elsif self.respond_to?("#{statement.predicate.short_name}=")
|
39
|
+
self.send("#{statement.predicate.short_name}=", statement.object.to_s)
|
40
|
+
#puts "#{statement.predicate.uri.short_name} = #{s.to_s}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def inspect
|
46
|
+
"[Test Case " + %w(
|
47
|
+
about
|
48
|
+
name
|
49
|
+
contributor
|
50
|
+
title
|
51
|
+
informationResourceInput
|
52
|
+
informationResourceResults
|
53
|
+
purpose
|
54
|
+
reviewStatus
|
55
|
+
specificationReference
|
56
|
+
expectedResults
|
57
|
+
).map {|a| v = self.send(a); "#{a}='#{v}'" if v}.compact.join(", ") +
|
58
|
+
"]"
|
59
|
+
end
|
60
|
+
|
61
|
+
def status
|
62
|
+
reviewStatus.to_s.split("#").last
|
63
|
+
end
|
64
|
+
|
65
|
+
def compare; :graph; end
|
66
|
+
|
67
|
+
def information
|
68
|
+
%w(purpose specificationReference).map {|a| v = self.send(a); "#{a}: #{v}" if v}.compact.join("\n")
|
69
|
+
end
|
70
|
+
|
71
|
+
def tcpath
|
72
|
+
RDFA_TEST_CASE_URL + (suite == "xhtml" ? "xhtml1" : suite)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Read in file, and apply modifications to create a properly formatted HTML
|
76
|
+
def input
|
77
|
+
f = self.inputDocument
|
78
|
+
found_head = false
|
79
|
+
namespaces = ""
|
80
|
+
body = File.readlines(File.join(RDFA_DIR, "tests", f)).map do |line|
|
81
|
+
found_head ||= line.match(/<head/)
|
82
|
+
if found_head
|
83
|
+
line.chop
|
84
|
+
else
|
85
|
+
namespaces << line
|
86
|
+
nil
|
87
|
+
end
|
88
|
+
end.compact.join("\n")
|
89
|
+
|
90
|
+
namespaces.chop! # Remove trailing newline
|
91
|
+
|
92
|
+
case suite
|
93
|
+
when "xhtml"
|
94
|
+
head = "" +
|
95
|
+
%(<?xml version="1.0" encoding="UTF-8"?>\n) +
|
96
|
+
%(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">\n) +
|
97
|
+
%(<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0"\n)
|
98
|
+
head + "#{namespaces}>\n#{body.gsub(TCPATHRE, tcpath)}\n</html>"
|
99
|
+
when "html4"
|
100
|
+
head ="" +
|
101
|
+
%(<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n) +
|
102
|
+
%(<html version="XHTML+RDFa 1.0"\n)
|
103
|
+
head + "#{namespaces}>\n#{body.gsub(TCPATHRE, tcpath).gsub(HTMLRE, '\1.html')}\n</html>"
|
104
|
+
when "html5"
|
105
|
+
head = "<!DOCTYPE html>\n"
|
106
|
+
head += namespaces.empty? ? %(<html version="HTML+RDFa 1.0">) : "<html\n#{namespaces}>"
|
107
|
+
head + "\n#{body.gsub(TCPATHRE, tcpath).gsub(HTMLRE, '\1.html')}\n</html>"
|
108
|
+
else
|
109
|
+
nil
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Read in file, and apply modifications reference either .html or .xhtml
|
114
|
+
def results
|
115
|
+
f = self.name + ".sparql"
|
116
|
+
body = File.read(File.join(RDFA_DIR, "tests", f)).gsub(TCPATHRE, tcpath)
|
117
|
+
|
118
|
+
suite == "xhtml" ? body : body.gsub(HTMLRE, '\1.html')
|
119
|
+
end
|
120
|
+
|
121
|
+
def triples
|
122
|
+
f = self.name + ".nt"
|
123
|
+
body = File.read(File.join(RDFA_NT_DIR, f)).gsub(TCPATHRE, tcpath)
|
124
|
+
suite == "xhtml" ? body : body.gsub(HTMLRE, '\1.html')
|
125
|
+
end
|
126
|
+
|
127
|
+
def inputDocument; self.name + ".txt"; end
|
128
|
+
def outputDocument; self.name + ".sparql"; end
|
129
|
+
|
130
|
+
# Run test case, yields input for parser to create triples
|
131
|
+
def run_test
|
132
|
+
rdfa_string = input
|
133
|
+
|
134
|
+
# Run
|
135
|
+
@parser = RdfaParser::RdfaParser.new(:graph => Graph.new(:identifier => about))
|
136
|
+
yield(rdfa_string, @parser)
|
137
|
+
|
138
|
+
query_string = results
|
139
|
+
|
140
|
+
triples = self.triples rescue nil
|
141
|
+
|
142
|
+
if (query_string.match(/UNION|OPTIONAL/) || title.match(/XML/)) && triples
|
143
|
+
# Check triples, as Rasql doesn't implement UNION
|
144
|
+
@parser.graph.should be_equivalent_graph(triples, self)
|
145
|
+
elsif $redland_enabled
|
146
|
+
# Run SPARQL query
|
147
|
+
@parser.graph.should pass_query(query_string, self)
|
148
|
+
else
|
149
|
+
raise SparqlException, "Query skipped, Redland not installed"
|
150
|
+
end
|
151
|
+
|
152
|
+
@parser.graph.to_rdfxml.should be_valid_xml
|
153
|
+
end
|
154
|
+
|
155
|
+
def trace
|
156
|
+
@parser.debug.to_a.join("\n")
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.test_cases(suite)
|
160
|
+
@test_cases = [] unless @suite == suite
|
161
|
+
return @test_cases unless @test_cases.empty?
|
162
|
+
|
163
|
+
@suite = suite # Process the given test suite
|
164
|
+
@manifest_url = "#{RDFA_MANIFEST_URL}#{suite}-manifest.rdf"
|
165
|
+
|
166
|
+
manifest_str = File.read(File.join(RDFA_DIR, "#{suite}-manifest.rdf"))
|
167
|
+
parser = RdfXmlParser.new
|
168
|
+
|
169
|
+
begin
|
170
|
+
parser.parse(manifest_str, @manifest_url)
|
171
|
+
rescue
|
172
|
+
raise "Parse error: #{$!}\n\t#{parser.debug.to_a.join("\t\n")}\n\n"
|
173
|
+
end
|
174
|
+
graph = parser.graph
|
175
|
+
|
176
|
+
# Group by subject
|
177
|
+
test_hash = graph.triples.inject({}) do |hash, st|
|
178
|
+
a = hash[st.subject] ||= []
|
179
|
+
a << st
|
180
|
+
hash
|
181
|
+
end
|
182
|
+
|
183
|
+
@test_cases = test_hash.values.map {|statements| TestCase.new(statements, suite)}.
|
184
|
+
compact.
|
185
|
+
sort_by{|t| t.name }
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|