rdf-rdfa 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/History.txt +2 -0
  2. data/README.rdoc +59 -0
  3. data/Rakefile +46 -0
  4. data/VERSION +1 -0
  5. data/example.rb +27 -0
  6. data/lib/rdfa/format.rb +19 -0
  7. data/lib/rdfa/reader.rb +798 -0
  8. data/lib/rdfa/reader/exceptions.rb +14 -0
  9. data/lib/rdfa/reader/namespace.rb +72 -0
  10. data/lib/rdfa/reader/version.rb +23 -0
  11. data/spec/namespaces_spec.rb +112 -0
  12. data/spec/rdfa-triples/0001.nt +1 -0
  13. data/spec/rdfa-triples/0006.nt +2 -0
  14. data/spec/rdfa-triples/0007.nt +3 -0
  15. data/spec/rdfa-triples/0008.nt +1 -0
  16. data/spec/rdfa-triples/0009.nt +1 -0
  17. data/spec/rdfa-triples/0010.nt +2 -0
  18. data/spec/rdfa-triples/0011.nt +3 -0
  19. data/spec/rdfa-triples/0012.nt +1 -0
  20. data/spec/rdfa-triples/0013.nt +1 -0
  21. data/spec/rdfa-triples/0014.nt +1 -0
  22. data/spec/rdfa-triples/0015.nt +2 -0
  23. data/spec/rdfa-triples/0017.nt +3 -0
  24. data/spec/rdfa-triples/0018.nt +1 -0
  25. data/spec/rdfa-triples/0019.nt +1 -0
  26. data/spec/rdfa-triples/0020.nt +1 -0
  27. data/spec/rdfa-triples/0021.nt +1 -0
  28. data/spec/rdfa-triples/0023.nt +1 -0
  29. data/spec/rdfa-triples/0025.nt +2 -0
  30. data/spec/rdfa-triples/0026.nt +1 -0
  31. data/spec/rdfa-triples/0027.nt +1 -0
  32. data/spec/rdfa-triples/0029.nt +1 -0
  33. data/spec/rdfa-triples/0030.nt +1 -0
  34. data/spec/rdfa-triples/0031.nt +1 -0
  35. data/spec/rdfa-triples/0032.nt +1 -0
  36. data/spec/rdfa-triples/0033.nt +2 -0
  37. data/spec/rdfa-triples/0034.nt +1 -0
  38. data/spec/rdfa-triples/0035.nt +1 -0
  39. data/spec/rdfa-triples/0036.nt +1 -0
  40. data/spec/rdfa-triples/0037.nt +1 -0
  41. data/spec/rdfa-triples/0038.nt +1 -0
  42. data/spec/rdfa-triples/0039.nt +1 -0
  43. data/spec/rdfa-triples/0040.nt +1 -0
  44. data/spec/rdfa-triples/0041.nt +1 -0
  45. data/spec/rdfa-triples/0042.nt +0 -0
  46. data/spec/rdfa-triples/0046.nt +3 -0
  47. data/spec/rdfa-triples/0047.nt +3 -0
  48. data/spec/rdfa-triples/0048.nt +3 -0
  49. data/spec/rdfa-triples/0049.nt +2 -0
  50. data/spec/rdfa-triples/0050.nt +2 -0
  51. data/spec/rdfa-triples/0051.nt +2 -0
  52. data/spec/rdfa-triples/0052.nt +1 -0
  53. data/spec/rdfa-triples/0053.nt +2 -0
  54. data/spec/rdfa-triples/0054.nt +2 -0
  55. data/spec/rdfa-triples/0055.nt +2 -0
  56. data/spec/rdfa-triples/0056.nt +3 -0
  57. data/spec/rdfa-triples/0057.nt +4 -0
  58. data/spec/rdfa-triples/0058.nt +6 -0
  59. data/spec/rdfa-triples/0059.nt +6 -0
  60. data/spec/rdfa-triples/0060.nt +2 -0
  61. data/spec/rdfa-triples/0061.nt +1 -0
  62. data/spec/rdfa-triples/0062.nt +1 -0
  63. data/spec/rdfa-triples/0063.nt +1 -0
  64. data/spec/rdfa-triples/0064.nt +1 -0
  65. data/spec/rdfa-triples/0065.nt +3 -0
  66. data/spec/rdfa-triples/0066.nt +1 -0
  67. data/spec/rdfa-triples/0067.nt +1 -0
  68. data/spec/rdfa-triples/0068.nt +1 -0
  69. data/spec/rdfa-triples/0069.nt +1 -0
  70. data/spec/rdfa-triples/0070.nt +1 -0
  71. data/spec/rdfa-triples/0071.nt +1 -0
  72. data/spec/rdfa-triples/0072.nt +1 -0
  73. data/spec/rdfa-triples/0073.nt +1 -0
  74. data/spec/rdfa-triples/0074.nt +1 -0
  75. data/spec/rdfa-triples/0075.nt +1 -0
  76. data/spec/rdfa-triples/0076.nt +23 -0
  77. data/spec/rdfa-triples/0077.nt +23 -0
  78. data/spec/rdfa-triples/0078.nt +6 -0
  79. data/spec/rdfa-triples/0079.nt +3 -0
  80. data/spec/rdfa-triples/0080.nt +1 -0
  81. data/spec/rdfa-triples/0081.nt +6 -0
  82. data/spec/rdfa-triples/0082.nt +8 -0
  83. data/spec/rdfa-triples/0083.nt +6 -0
  84. data/spec/rdfa-triples/0084.nt +8 -0
  85. data/spec/rdfa-triples/0085.nt +4 -0
  86. data/spec/rdfa-triples/0086.nt +0 -0
  87. data/spec/rdfa-triples/0087.nt +23 -0
  88. data/spec/rdfa-triples/0088.nt +3 -0
  89. data/spec/rdfa-triples/0089.nt +1 -0
  90. data/spec/rdfa-triples/0090.nt +1 -0
  91. data/spec/rdfa-triples/0091.nt +3 -0
  92. data/spec/rdfa-triples/0092.nt +3 -0
  93. data/spec/rdfa-triples/0093.nt +2 -0
  94. data/spec/rdfa-triples/0094.nt +3 -0
  95. data/spec/rdfa-triples/0099.nt +1 -0
  96. data/spec/rdfa-triples/0100.nt +3 -0
  97. data/spec/rdfa-triples/0101.nt +3 -0
  98. data/spec/rdfa-triples/0102.nt +1 -0
  99. data/spec/rdfa-triples/0103.nt +1 -0
  100. data/spec/rdfa-triples/0104.nt +3 -0
  101. data/spec/rdfa-triples/0105.nt +1 -0
  102. data/spec/rdfa-triples/0106.nt +1 -0
  103. data/spec/rdfa-triples/0107.nt +0 -0
  104. data/spec/rdfa-triples/0108.nt +1 -0
  105. data/spec/rdfa-triples/0109.nt +1 -0
  106. data/spec/rdfa-triples/0110.nt +1 -0
  107. data/spec/rdfa-triples/0111.nt +2 -0
  108. data/spec/rdfa-triples/0112.nt +1 -0
  109. data/spec/rdfa-triples/0113.nt +2 -0
  110. data/spec/rdfa-triples/0114.nt +3 -0
  111. data/spec/rdfa-triples/0115.nt +4 -0
  112. data/spec/rdfa-triples/0116.nt +2 -0
  113. data/spec/rdfa-triples/0117.nt +2 -0
  114. data/spec/rdfa-triples/0118.nt +1 -0
  115. data/spec/rdfa-triples/0119.nt +1 -0
  116. data/spec/rdfa-triples/0120.nt +1 -0
  117. data/spec/rdfa-triples/0121.nt +2 -0
  118. data/spec/rdfa-triples/0122.nt +1 -0
  119. data/spec/rdfa-triples/0123.nt +3 -0
  120. data/spec/rdfa-triples/0124.nt +4 -0
  121. data/spec/rdfa-triples/0125.nt +1 -0
  122. data/spec/rdfa-triples/0126.nt +3 -0
  123. data/spec/rdfa-triples/1001.nt +6 -0
  124. data/spec/rdfa_helper.rb +188 -0
  125. data/spec/rdfa_parser_spec.rb +146 -0
  126. data/spec/spec.opts +1 -0
  127. data/spec/spec_helper.rb +8 -0
  128. 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,3 @@
1
+ <http://www.example.org/#somebody> <http://xmlns.com/foaf/0.1/knows> _:a .
2
+ _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
3
+ _:a <http://xmlns.com/foaf/0.1/name> "Dan Brickley" .
@@ -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
+ _:human <http://www.w3.org/1999/xhtml/vocab#definition> "a bi-pedal primate" .
2
+ _:human <http://www.w3.org/1999/xhtml/vocab#note> "confused animal" .
3
+ _:human <http://www.w3.org/1999/xhtml/vocab#foo> "Milky Way" .
@@ -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,2 @@
1
+ <$TCPATH/0093.xhtml> <http://purl.org/dc/elements/1.1/creator> "Albert Einstein" .
2
+ <$TCPATH/0093.xhtml> <http://purl.org/dc/elements/1.1/title> "E = mc2: The Most Urgent Problem of Our Time"^^<http://www.example.org/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,3 @@
1
+ <$TCPATH/0104.xhtml#interfenestration> <http://www.example.org/size> _:a .
2
+ _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "17" .
3
+ _:a <http://www.example.org/unit> "character" .
@@ -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,2 @@
1
+ <$TCPATH/0111.xhtml> <http://www.w3.org/1999/xhtml/vocab#next> _:a .
2
+ _:a <http://www.w3.org/1999/xhtml/vocab#next> _:b .
@@ -0,0 +1 @@
1
+ <http://example.org/node> <http://example.org/property> "not an XML Literal,\nwhitespace preserved\n" .
@@ -0,0 +1,2 @@
1
+ <$TCPATH/0113.xhtml#a> <http://purl.org/dc/elements/1.1/title> "" .
2
+ <$TCPATH/0113.xhtml#b> <http://purl.org/dc/elements/1.1/title> "" .
@@ -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,4 @@
1
+ <$TCPATH/0115.xhtml> <http://www.example.com/entity1> ">" .
2
+ <$TCPATH/0115.xhtml> <http://www.example.com/entity2> "Ben & Co." .
3
+ <$TCPATH/0115.xhtml> <http://www.example.com/entity3> "@" .
4
+ <$TCPATH/0115.xhtml> <http://www.example.com/entity4> "@" .
@@ -0,0 +1,2 @@
1
+ # This is a negative test case, the following triple should not be generated.
2
+ #<$TCPATH/0116.xhtml> <http://www.w3.org/1999/xhtml/vocab#next> "invalid property" .
@@ -0,0 +1,2 @@
1
+ <http://www.example.org/tc117.xhtml> <http://purl.org/dc/elements/1.1/title> "Test 0117" .
2
+ <http://www.example.org/tc117.xhtml> <http://purl.org/dc/elements/1.1/contributor> "Mark Birbeck" .
@@ -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,2 @@
1
+ <http://example.org/> <http://purl.org/dc/elements/1.1/title> "Test Case 0121" .
2
+ <http://example.org/> <http://purl.org/dc/elements/1.1/contributor> "Shane McCarron" .
@@ -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" .
@@ -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