rdf-n3 0.3.1.3 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (372) hide show
  1. data/.yardopts +2 -2
  2. data/History.md +12 -0
  3. data/README +153 -0
  4. data/README.md +26 -3
  5. data/Rakefile +6 -8
  6. data/VERSION +1 -1
  7. data/example-files/arnau-stack-overflow.ttl +12 -0
  8. data/example-files/dwbutler-mj.n3 +10 -0
  9. data/example-files/dwbutler-mj.ttl +8 -0
  10. data/example-files/lee-reilly-list.rb +40 -0
  11. data/lib/rdf/n3/reader.rb +8 -2
  12. data/lib/rdf/n3/reader/meta.rb +1 -1
  13. data/lib/rdf/n3/reader/parser.rb +18 -11
  14. data/lib/rdf/n3/writer.rb +54 -30
  15. data/rdf-n3.gemspec +18 -365
  16. data/script/parse +18 -12
  17. data/spec/reader_spec.rb +30 -29
  18. data/spec/spec_helper.rb +1 -1
  19. data/spec/writer_spec.rb +16 -0
  20. metadata +12 -359
  21. data/spec/rdfcore/Manifest.rdf +0 -5395
  22. data/spec/rdfcore/amp-in-url/test001.nt +0 -16
  23. data/spec/rdfcore/amp-in-url/test001.rdf +0 -40
  24. data/spec/rdfcore/datatypes-intensional/test001.nt +0 -18
  25. data/spec/rdfcore/datatypes-intensional/test002.nt +0 -18
  26. data/spec/rdfcore/datatypes/test001.nt +0 -15
  27. data/spec/rdfcore/datatypes/test001.rdf +0 -29
  28. data/spec/rdfcore/datatypes/test002.nt +0 -14
  29. data/spec/rdfcore/datatypes/test002.rdf +0 -27
  30. data/spec/rdfcore/datatypes/test002b.nt +0 -17
  31. data/spec/rdfcore/datatypes/test003a.nt +0 -16
  32. data/spec/rdfcore/datatypes/test003b.nt +0 -16
  33. data/spec/rdfcore/datatypes/test005a.nt +0 -16
  34. data/spec/rdfcore/datatypes/test005b.nt +0 -16
  35. data/spec/rdfcore/datatypes/test006.nt +0 -17
  36. data/spec/rdfcore/datatypes/test008a.nt +0 -15
  37. data/spec/rdfcore/datatypes/test008b.nt +0 -15
  38. data/spec/rdfcore/datatypes/test009a.nt +0 -15
  39. data/spec/rdfcore/datatypes/test009b.nt +0 -15
  40. data/spec/rdfcore/datatypes/test010.nt +0 -17
  41. data/spec/rdfcore/datatypes/test011a.nt +0 -17
  42. data/spec/rdfcore/datatypes/test011b.nt +0 -17
  43. data/spec/rdfcore/horst-01/test001.rdf +0 -38
  44. data/spec/rdfcore/horst-01/test002.rdf +0 -39
  45. data/spec/rdfcore/horst-01/test003.rdf +0 -40
  46. data/spec/rdfcore/horst-01/test004.rdf +0 -42
  47. data/spec/rdfcore/pfps-10/test001a.nt +0 -14
  48. data/spec/rdfcore/pfps-10/test001b.nt +0 -15
  49. data/spec/rdfcore/rdf-charmod-literals/test001.nt +0 -15
  50. data/spec/rdfcore/rdf-charmod-literals/test001.rdf +0 -34
  51. data/spec/rdfcore/rdf-charmod-uris/test001.nt +0 -14
  52. data/spec/rdfcore/rdf-charmod-uris/test001.rdf +0 -34
  53. data/spec/rdfcore/rdf-charmod-uris/test002.nt +0 -15
  54. data/spec/rdfcore/rdf-charmod-uris/test002.rdf +0 -33
  55. data/spec/rdfcore/rdf-containers-syntax-vs-schema/error001.rdf +0 -27
  56. data/spec/rdfcore/rdf-containers-syntax-vs-schema/error002.rdf +0 -34
  57. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test001.nt +0 -17
  58. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test001.rdf +0 -27
  59. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test002.nt +0 -19
  60. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test002.rdf +0 -37
  61. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test003.nt +0 -18
  62. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test003.rdf +0 -29
  63. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test004.nt +0 -29
  64. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test004.rdf +0 -33
  65. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test006.nt +0 -40
  66. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test006.rdf +0 -28
  67. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test007.nt +0 -20
  68. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test007.rdf +0 -32
  69. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test008.nt +0 -15
  70. data/spec/rdfcore/rdf-containers-syntax-vs-schema/test008.rdf +0 -28
  71. data/spec/rdfcore/rdf-element-not-mandatory/test001.nt +0 -10
  72. data/spec/rdfcore/rdf-element-not-mandatory/test001.rdf +0 -14
  73. data/spec/rdfcore/rdf-ns-prefix-confusion/test0001.nt +0 -14
  74. data/spec/rdfcore/rdf-ns-prefix-confusion/test0001.rdf +0 -35
  75. data/spec/rdfcore/rdf-ns-prefix-confusion/test0003.nt +0 -14
  76. data/spec/rdfcore/rdf-ns-prefix-confusion/test0003.rdf +0 -35
  77. data/spec/rdfcore/rdf-ns-prefix-confusion/test0004.nt +0 -14
  78. data/spec/rdfcore/rdf-ns-prefix-confusion/test0004.rdf +0 -34
  79. data/spec/rdfcore/rdf-ns-prefix-confusion/test0005.nt +0 -15
  80. data/spec/rdfcore/rdf-ns-prefix-confusion/test0005.rdf +0 -40
  81. data/spec/rdfcore/rdf-ns-prefix-confusion/test0006.nt +0 -14
  82. data/spec/rdfcore/rdf-ns-prefix-confusion/test0006.rdf +0 -32
  83. data/spec/rdfcore/rdf-ns-prefix-confusion/test0009.nt +0 -14
  84. data/spec/rdfcore/rdf-ns-prefix-confusion/test0009.rdf +0 -32
  85. data/spec/rdfcore/rdf-ns-prefix-confusion/test0010.nt +0 -14
  86. data/spec/rdfcore/rdf-ns-prefix-confusion/test0010.rdf +0 -38
  87. data/spec/rdfcore/rdf-ns-prefix-confusion/test0011.nt +0 -15
  88. data/spec/rdfcore/rdf-ns-prefix-confusion/test0011.rdf +0 -40
  89. data/spec/rdfcore/rdf-ns-prefix-confusion/test0012.nt +0 -15
  90. data/spec/rdfcore/rdf-ns-prefix-confusion/test0012.rdf +0 -40
  91. data/spec/rdfcore/rdf-ns-prefix-confusion/test0013.nt +0 -15
  92. data/spec/rdfcore/rdf-ns-prefix-confusion/test0013.rdf +0 -40
  93. data/spec/rdfcore/rdf-ns-prefix-confusion/test0014.nt +0 -15
  94. data/spec/rdfcore/rdf-ns-prefix-confusion/test0014.rdf +0 -42
  95. data/spec/rdfcore/rdfms-abouteach/error001.rdf +0 -35
  96. data/spec/rdfcore/rdfms-abouteach/error002.rdf +0 -35
  97. data/spec/rdfcore/rdfms-difference-between-ID-and-about/error1.rdf +0 -25
  98. data/spec/rdfcore/rdfms-difference-between-ID-and-about/test1.nt +0 -14
  99. data/spec/rdfcore/rdfms-difference-between-ID-and-about/test1.rdf +0 -22
  100. data/spec/rdfcore/rdfms-difference-between-ID-and-about/test2.nt +0 -14
  101. data/spec/rdfcore/rdfms-difference-between-ID-and-about/test2.rdf +0 -22
  102. data/spec/rdfcore/rdfms-difference-between-ID-and-about/test3.nt +0 -14
  103. data/spec/rdfcore/rdfms-difference-between-ID-and-about/test3.rdf +0 -22
  104. data/spec/rdfcore/rdfms-duplicate-member-props/test001.nt +0 -17
  105. data/spec/rdfcore/rdfms-duplicate-member-props/test001.rdf +0 -30
  106. data/spec/rdfcore/rdfms-empty-property-elements/error001.rdf +0 -33
  107. data/spec/rdfcore/rdfms-empty-property-elements/error002.rdf +0 -33
  108. data/spec/rdfcore/rdfms-empty-property-elements/error003.rdf +0 -39
  109. data/spec/rdfcore/rdfms-empty-property-elements/test001.nt +0 -14
  110. data/spec/rdfcore/rdfms-empty-property-elements/test001.rdf +0 -33
  111. data/spec/rdfcore/rdfms-empty-property-elements/test002.nt +0 -14
  112. data/spec/rdfcore/rdfms-empty-property-elements/test002.rdf +0 -31
  113. data/spec/rdfcore/rdfms-empty-property-elements/test003.nt +0 -14
  114. data/spec/rdfcore/rdfms-empty-property-elements/test003.rdf +0 -32
  115. data/spec/rdfcore/rdfms-empty-property-elements/test004.nt +0 -14
  116. data/spec/rdfcore/rdfms-empty-property-elements/test004.rdf +0 -32
  117. data/spec/rdfcore/rdfms-empty-property-elements/test005.nt +0 -18
  118. data/spec/rdfcore/rdfms-empty-property-elements/test005.rdf +0 -32
  119. data/spec/rdfcore/rdfms-empty-property-elements/test006.nt +0 -18
  120. data/spec/rdfcore/rdfms-empty-property-elements/test006.rdf +0 -32
  121. data/spec/rdfcore/rdfms-empty-property-elements/test007.nt +0 -14
  122. data/spec/rdfcore/rdfms-empty-property-elements/test007.rdf +0 -32
  123. data/spec/rdfcore/rdfms-empty-property-elements/test008.nt +0 -14
  124. data/spec/rdfcore/rdfms-empty-property-elements/test008.rdf +0 -31
  125. data/spec/rdfcore/rdfms-empty-property-elements/test009.nt +0 -14
  126. data/spec/rdfcore/rdfms-empty-property-elements/test009.rdf +0 -32
  127. data/spec/rdfcore/rdfms-empty-property-elements/test010.nt +0 -14
  128. data/spec/rdfcore/rdfms-empty-property-elements/test010.rdf +0 -31
  129. data/spec/rdfcore/rdfms-empty-property-elements/test011.nt +0 -18
  130. data/spec/rdfcore/rdfms-empty-property-elements/test011.rdf +0 -30
  131. data/spec/rdfcore/rdfms-empty-property-elements/test012.nt +0 -18
  132. data/spec/rdfcore/rdfms-empty-property-elements/test012.rdf +0 -30
  133. data/spec/rdfcore/rdfms-empty-property-elements/test013.nt +0 -15
  134. data/spec/rdfcore/rdfms-empty-property-elements/test013.rdf +0 -35
  135. data/spec/rdfcore/rdfms-empty-property-elements/test014.nt +0 -15
  136. data/spec/rdfcore/rdfms-empty-property-elements/test014.rdf +0 -34
  137. data/spec/rdfcore/rdfms-empty-property-elements/test015.nt +0 -15
  138. data/spec/rdfcore/rdfms-empty-property-elements/test015.rdf +0 -38
  139. data/spec/rdfcore/rdfms-empty-property-elements/test016.nt +0 -14
  140. data/spec/rdfcore/rdfms-empty-property-elements/test016.rdf +0 -31
  141. data/spec/rdfcore/rdfms-empty-property-elements/test017.nt +0 -14
  142. data/spec/rdfcore/rdfms-empty-property-elements/test017.rdf +0 -38
  143. data/spec/rdfcore/rdfms-identity-anon-resources/test001.nt +0 -14
  144. data/spec/rdfcore/rdfms-identity-anon-resources/test001.rdf +0 -33
  145. data/spec/rdfcore/rdfms-identity-anon-resources/test002.nt +0 -15
  146. data/spec/rdfcore/rdfms-identity-anon-resources/test002.rdf +0 -33
  147. data/spec/rdfcore/rdfms-identity-anon-resources/test003.nt +0 -14
  148. data/spec/rdfcore/rdfms-identity-anon-resources/test003.rdf +0 -31
  149. data/spec/rdfcore/rdfms-identity-anon-resources/test004.nt +0 -15
  150. data/spec/rdfcore/rdfms-identity-anon-resources/test004.rdf +0 -33
  151. data/spec/rdfcore/rdfms-identity-anon-resources/test005.nt +0 -14
  152. data/spec/rdfcore/rdfms-identity-anon-resources/test005.rdf +0 -31
  153. data/spec/rdfcore/rdfms-not-id-and-resource-attr/test001.nt +0 -19
  154. data/spec/rdfcore/rdfms-not-id-and-resource-attr/test001.rdf +0 -29
  155. data/spec/rdfcore/rdfms-not-id-and-resource-attr/test002.nt +0 -15
  156. data/spec/rdfcore/rdfms-not-id-and-resource-attr/test002.rdf +0 -29
  157. data/spec/rdfcore/rdfms-not-id-and-resource-attr/test004.nt +0 -18
  158. data/spec/rdfcore/rdfms-not-id-and-resource-attr/test004.rdf +0 -29
  159. data/spec/rdfcore/rdfms-not-id-and-resource-attr/test005.nt +0 -19
  160. data/spec/rdfcore/rdfms-not-id-and-resource-attr/test005.rdf +0 -29
  161. data/spec/rdfcore/rdfms-para196/test001.nt +0 -17
  162. data/spec/rdfcore/rdfms-para196/test001.rdf +0 -35
  163. data/spec/rdfcore/rdfms-rdf-id/error001.rdf +0 -26
  164. data/spec/rdfcore/rdfms-rdf-id/error002.rdf +0 -26
  165. data/spec/rdfcore/rdfms-rdf-id/error003.rdf +0 -29
  166. data/spec/rdfcore/rdfms-rdf-id/error004.rdf +0 -27
  167. data/spec/rdfcore/rdfms-rdf-id/error005.rdf +0 -31
  168. data/spec/rdfcore/rdfms-rdf-id/error006.rdf +0 -26
  169. data/spec/rdfcore/rdfms-rdf-id/error007.rdf +0 -29
  170. data/spec/rdfcore/rdfms-rdf-names-use/error-001.rdf +0 -23
  171. data/spec/rdfcore/rdfms-rdf-names-use/error-002.rdf +0 -23
  172. data/spec/rdfcore/rdfms-rdf-names-use/error-003.rdf +0 -23
  173. data/spec/rdfcore/rdfms-rdf-names-use/error-004.rdf +0 -23
  174. data/spec/rdfcore/rdfms-rdf-names-use/error-005.rdf +0 -23
  175. data/spec/rdfcore/rdfms-rdf-names-use/error-006.rdf +0 -23
  176. data/spec/rdfcore/rdfms-rdf-names-use/error-007.rdf +0 -23
  177. data/spec/rdfcore/rdfms-rdf-names-use/error-008.rdf +0 -23
  178. data/spec/rdfcore/rdfms-rdf-names-use/error-009.rdf +0 -23
  179. data/spec/rdfcore/rdfms-rdf-names-use/error-010.rdf +0 -23
  180. data/spec/rdfcore/rdfms-rdf-names-use/error-011.rdf +0 -25
  181. data/spec/rdfcore/rdfms-rdf-names-use/error-012.rdf +0 -25
  182. data/spec/rdfcore/rdfms-rdf-names-use/error-013.rdf +0 -25
  183. data/spec/rdfcore/rdfms-rdf-names-use/error-014.rdf +0 -25
  184. data/spec/rdfcore/rdfms-rdf-names-use/error-015.rdf +0 -25
  185. data/spec/rdfcore/rdfms-rdf-names-use/error-016.rdf +0 -25
  186. data/spec/rdfcore/rdfms-rdf-names-use/error-017.rdf +0 -25
  187. data/spec/rdfcore/rdfms-rdf-names-use/error-018.rdf +0 -25
  188. data/spec/rdfcore/rdfms-rdf-names-use/error-019.rdf +0 -25
  189. data/spec/rdfcore/rdfms-rdf-names-use/error-020.rdf +0 -25
  190. data/spec/rdfcore/rdfms-rdf-names-use/test-001.nt +0 -1
  191. data/spec/rdfcore/rdfms-rdf-names-use/test-001.rdf +0 -23
  192. data/spec/rdfcore/rdfms-rdf-names-use/test-002.nt +0 -1
  193. data/spec/rdfcore/rdfms-rdf-names-use/test-002.rdf +0 -23
  194. data/spec/rdfcore/rdfms-rdf-names-use/test-003.nt +0 -1
  195. data/spec/rdfcore/rdfms-rdf-names-use/test-003.rdf +0 -23
  196. data/spec/rdfcore/rdfms-rdf-names-use/test-004.nt +0 -1
  197. data/spec/rdfcore/rdfms-rdf-names-use/test-004.rdf +0 -23
  198. data/spec/rdfcore/rdfms-rdf-names-use/test-005.nt +0 -1
  199. data/spec/rdfcore/rdfms-rdf-names-use/test-005.rdf +0 -23
  200. data/spec/rdfcore/rdfms-rdf-names-use/test-006.nt +0 -1
  201. data/spec/rdfcore/rdfms-rdf-names-use/test-006.rdf +0 -23
  202. data/spec/rdfcore/rdfms-rdf-names-use/test-007.nt +0 -1
  203. data/spec/rdfcore/rdfms-rdf-names-use/test-007.rdf +0 -23
  204. data/spec/rdfcore/rdfms-rdf-names-use/test-008.nt +0 -1
  205. data/spec/rdfcore/rdfms-rdf-names-use/test-008.rdf +0 -23
  206. data/spec/rdfcore/rdfms-rdf-names-use/test-009.nt +0 -1
  207. data/spec/rdfcore/rdfms-rdf-names-use/test-009.rdf +0 -23
  208. data/spec/rdfcore/rdfms-rdf-names-use/test-010.nt +0 -1
  209. data/spec/rdfcore/rdfms-rdf-names-use/test-010.rdf +0 -23
  210. data/spec/rdfcore/rdfms-rdf-names-use/test-011.nt +0 -1
  211. data/spec/rdfcore/rdfms-rdf-names-use/test-011.rdf +0 -23
  212. data/spec/rdfcore/rdfms-rdf-names-use/test-012.nt +0 -1
  213. data/spec/rdfcore/rdfms-rdf-names-use/test-012.rdf +0 -23
  214. data/spec/rdfcore/rdfms-rdf-names-use/test-013.nt +0 -1
  215. data/spec/rdfcore/rdfms-rdf-names-use/test-013.rdf +0 -23
  216. data/spec/rdfcore/rdfms-rdf-names-use/test-014.nt +0 -1
  217. data/spec/rdfcore/rdfms-rdf-names-use/test-014.rdf +0 -23
  218. data/spec/rdfcore/rdfms-rdf-names-use/test-015.nt +0 -1
  219. data/spec/rdfcore/rdfms-rdf-names-use/test-015.rdf +0 -23
  220. data/spec/rdfcore/rdfms-rdf-names-use/test-016.nt +0 -1
  221. data/spec/rdfcore/rdfms-rdf-names-use/test-016.rdf +0 -23
  222. data/spec/rdfcore/rdfms-rdf-names-use/test-017.nt +0 -1
  223. data/spec/rdfcore/rdfms-rdf-names-use/test-017.rdf +0 -25
  224. data/spec/rdfcore/rdfms-rdf-names-use/test-018.nt +0 -1
  225. data/spec/rdfcore/rdfms-rdf-names-use/test-018.rdf +0 -25
  226. data/spec/rdfcore/rdfms-rdf-names-use/test-019.nt +0 -1
  227. data/spec/rdfcore/rdfms-rdf-names-use/test-019.rdf +0 -25
  228. data/spec/rdfcore/rdfms-rdf-names-use/test-020.nt +0 -1
  229. data/spec/rdfcore/rdfms-rdf-names-use/test-020.rdf +0 -25
  230. data/spec/rdfcore/rdfms-rdf-names-use/test-021.nt +0 -1
  231. data/spec/rdfcore/rdfms-rdf-names-use/test-021.rdf +0 -25
  232. data/spec/rdfcore/rdfms-rdf-names-use/test-022.nt +0 -1
  233. data/spec/rdfcore/rdfms-rdf-names-use/test-022.rdf +0 -25
  234. data/spec/rdfcore/rdfms-rdf-names-use/test-023.nt +0 -1
  235. data/spec/rdfcore/rdfms-rdf-names-use/test-023.rdf +0 -25
  236. data/spec/rdfcore/rdfms-rdf-names-use/test-024.nt +0 -1
  237. data/spec/rdfcore/rdfms-rdf-names-use/test-024.rdf +0 -25
  238. data/spec/rdfcore/rdfms-rdf-names-use/test-025.nt +0 -1
  239. data/spec/rdfcore/rdfms-rdf-names-use/test-025.rdf +0 -25
  240. data/spec/rdfcore/rdfms-rdf-names-use/test-026.nt +0 -1
  241. data/spec/rdfcore/rdfms-rdf-names-use/test-026.rdf +0 -25
  242. data/spec/rdfcore/rdfms-rdf-names-use/test-027.nt +0 -1
  243. data/spec/rdfcore/rdfms-rdf-names-use/test-027.rdf +0 -25
  244. data/spec/rdfcore/rdfms-rdf-names-use/test-028.nt +0 -1
  245. data/spec/rdfcore/rdfms-rdf-names-use/test-028.rdf +0 -25
  246. data/spec/rdfcore/rdfms-rdf-names-use/test-029.nt +0 -1
  247. data/spec/rdfcore/rdfms-rdf-names-use/test-029.rdf +0 -25
  248. data/spec/rdfcore/rdfms-rdf-names-use/test-030.nt +0 -1
  249. data/spec/rdfcore/rdfms-rdf-names-use/test-030.rdf +0 -25
  250. data/spec/rdfcore/rdfms-rdf-names-use/test-031.nt +0 -1
  251. data/spec/rdfcore/rdfms-rdf-names-use/test-031.rdf +0 -25
  252. data/spec/rdfcore/rdfms-rdf-names-use/test-032.nt +0 -1
  253. data/spec/rdfcore/rdfms-rdf-names-use/test-032.rdf +0 -24
  254. data/spec/rdfcore/rdfms-rdf-names-use/test-033.nt +0 -1
  255. data/spec/rdfcore/rdfms-rdf-names-use/test-033.rdf +0 -24
  256. data/spec/rdfcore/rdfms-rdf-names-use/test-034.nt +0 -1
  257. data/spec/rdfcore/rdfms-rdf-names-use/test-034.rdf +0 -24
  258. data/spec/rdfcore/rdfms-rdf-names-use/test-035.nt +0 -1
  259. data/spec/rdfcore/rdfms-rdf-names-use/test-035.rdf +0 -24
  260. data/spec/rdfcore/rdfms-rdf-names-use/test-036.nt +0 -1
  261. data/spec/rdfcore/rdfms-rdf-names-use/test-036.rdf +0 -24
  262. data/spec/rdfcore/rdfms-rdf-names-use/test-037.nt +0 -1
  263. data/spec/rdfcore/rdfms-rdf-names-use/test-037.rdf +0 -24
  264. data/spec/rdfcore/rdfms-rdf-names-use/warn-001.nt +0 -1
  265. data/spec/rdfcore/rdfms-rdf-names-use/warn-001.rdf +0 -23
  266. data/spec/rdfcore/rdfms-rdf-names-use/warn-002.nt +0 -1
  267. data/spec/rdfcore/rdfms-rdf-names-use/warn-002.rdf +0 -25
  268. data/spec/rdfcore/rdfms-rdf-names-use/warn-003.nt +0 -1
  269. data/spec/rdfcore/rdfms-rdf-names-use/warn-003.rdf +0 -24
  270. data/spec/rdfcore/rdfms-reification-required/test001.nt +0 -15
  271. data/spec/rdfcore/rdfms-reification-required/test001.rdf +0 -29
  272. data/spec/rdfcore/rdfms-seq-representation/empty.nt +0 -13
  273. data/spec/rdfcore/rdfms-seq-representation/test001.nt +0 -19
  274. data/spec/rdfcore/rdfms-seq-representation/test001.rdf +0 -33
  275. data/spec/rdfcore/rdfms-seq-representation/test002.nt +0 -14
  276. data/spec/rdfcore/rdfms-seq-representation/test003a.nt +0 -14
  277. data/spec/rdfcore/rdfms-seq-representation/test003b.nt +0 -14
  278. data/spec/rdfcore/rdfms-seq-representation/test004.nt +0 -14
  279. data/spec/rdfcore/rdfms-syntax-incomplete/error001.rdf +0 -26
  280. data/spec/rdfcore/rdfms-syntax-incomplete/error002.rdf +0 -26
  281. data/spec/rdfcore/rdfms-syntax-incomplete/error003.rdf +0 -29
  282. data/spec/rdfcore/rdfms-syntax-incomplete/error004.rdf +0 -25
  283. data/spec/rdfcore/rdfms-syntax-incomplete/error005.rdf +0 -25
  284. data/spec/rdfcore/rdfms-syntax-incomplete/error006.rdf +0 -28
  285. data/spec/rdfcore/rdfms-syntax-incomplete/test001.nt +0 -14
  286. data/spec/rdfcore/rdfms-syntax-incomplete/test001.rdf +0 -28
  287. data/spec/rdfcore/rdfms-syntax-incomplete/test002.nt +0 -19
  288. data/spec/rdfcore/rdfms-syntax-incomplete/test002.rdf +0 -38
  289. data/spec/rdfcore/rdfms-syntax-incomplete/test003.nt +0 -17
  290. data/spec/rdfcore/rdfms-syntax-incomplete/test003.rdf +0 -28
  291. data/spec/rdfcore/rdfms-syntax-incomplete/test004.nt +0 -21
  292. data/spec/rdfcore/rdfms-syntax-incomplete/test004.rdf +0 -36
  293. data/spec/rdfcore/rdfms-uri-substructure/error001.nt +0 -18
  294. data/spec/rdfcore/rdfms-uri-substructure/test001.nt +0 -17
  295. data/spec/rdfcore/rdfms-uri-substructure/test001.rdf +0 -29
  296. data/spec/rdfcore/rdfms-xml-literal-namespaces/test001.nt +0 -13
  297. data/spec/rdfcore/rdfms-xml-literal-namespaces/test001.rdf +0 -33
  298. data/spec/rdfcore/rdfms-xml-literal-namespaces/test002.nt +0 -14
  299. data/spec/rdfcore/rdfms-xml-literal-namespaces/test002.rdf +0 -47
  300. data/spec/rdfcore/rdfms-xmllang/test001.nt +0 -14
  301. data/spec/rdfcore/rdfms-xmllang/test001.rdf +0 -30
  302. data/spec/rdfcore/rdfms-xmllang/test002.nt +0 -14
  303. data/spec/rdfcore/rdfms-xmllang/test002.rdf +0 -29
  304. data/spec/rdfcore/rdfms-xmllang/test003.nt +0 -14
  305. data/spec/rdfcore/rdfms-xmllang/test003.rdf +0 -28
  306. data/spec/rdfcore/rdfms-xmllang/test004.nt +0 -14
  307. data/spec/rdfcore/rdfms-xmllang/test004.rdf +0 -28
  308. data/spec/rdfcore/rdfms-xmllang/test005.nt +0 -14
  309. data/spec/rdfcore/rdfms-xmllang/test005.rdf +0 -28
  310. data/spec/rdfcore/rdfms-xmllang/test006.nt +0 -14
  311. data/spec/rdfcore/rdfms-xmllang/test006.rdf +0 -29
  312. data/spec/rdfcore/rdfms-xmllang/test007a.nt +0 -14
  313. data/spec/rdfcore/rdfms-xmllang/test007b.nt +0 -14
  314. data/spec/rdfcore/rdfms-xmllang/test007c.nt +0 -14
  315. data/spec/rdfcore/rdfs-container-membership-superProperty/not1C.rdf +0 -13
  316. data/spec/rdfcore/rdfs-container-membership-superProperty/not1P.rdf +0 -14
  317. data/spec/rdfcore/rdfs-domain-and-range/nonconclusions005.rdf +0 -28
  318. data/spec/rdfcore/rdfs-domain-and-range/nonconclusions006.rdf +0 -28
  319. data/spec/rdfcore/rdfs-domain-and-range/premises005.rdf +0 -32
  320. data/spec/rdfcore/rdfs-domain-and-range/premises006.rdf +0 -32
  321. data/spec/rdfcore/rdfs-domain-and-range/test001.nt +0 -16
  322. data/spec/rdfcore/rdfs-domain-and-range/test001.rdf +0 -29
  323. data/spec/rdfcore/rdfs-domain-and-range/test002.nt +0 -16
  324. data/spec/rdfcore/rdfs-domain-and-range/test002.rdf +0 -29
  325. data/spec/rdfcore/rdfs-entailment/test001.nt +0 -16
  326. data/spec/rdfcore/rdfs-entailment/test002.nt +0 -15
  327. data/spec/rdfcore/rdfs-no-cycles-in-subClassOf/test001.nt +0 -18
  328. data/spec/rdfcore/rdfs-no-cycles-in-subClassOf/test001.rdf +0 -37
  329. data/spec/rdfcore/rdfs-no-cycles-in-subPropertyOf/test001.nt +0 -18
  330. data/spec/rdfcore/rdfs-no-cycles-in-subPropertyOf/test001.rdf +0 -40
  331. data/spec/rdfcore/rdfs-subClassOf-a-Property/test001.nt +0 -15
  332. data/spec/rdfcore/rdfs-subPropertyOf-semantics/test001.nt +0 -24
  333. data/spec/rdfcore/rdfs-subPropertyOf-semantics/test002.nt +0 -21
  334. data/spec/rdfcore/statement-entailment/test001a.nt +0 -12
  335. data/spec/rdfcore/statement-entailment/test001b.nt +0 -2
  336. data/spec/rdfcore/statement-entailment/test002a.nt +0 -2
  337. data/spec/rdfcore/statement-entailment/test002b.nt +0 -5
  338. data/spec/rdfcore/tex-01/test001.rdf +0 -34
  339. data/spec/rdfcore/tex-01/test002.rdf +0 -33
  340. data/spec/rdfcore/unrecognised-xml-attributes/test001.nt +0 -15
  341. data/spec/rdfcore/unrecognised-xml-attributes/test001.rdf +0 -31
  342. data/spec/rdfcore/unrecognised-xml-attributes/test002.nt +0 -14
  343. data/spec/rdfcore/unrecognised-xml-attributes/test002.rdf +0 -32
  344. data/spec/rdfcore/xml-canon/test001.nt +0 -16
  345. data/spec/rdfcore/xml-canon/test001.rdf +0 -28
  346. data/spec/rdfcore/xmlbase/test001.nt +0 -14
  347. data/spec/rdfcore/xmlbase/test001.rdf +0 -27
  348. data/spec/rdfcore/xmlbase/test002.nt +0 -14
  349. data/spec/rdfcore/xmlbase/test002.rdf +0 -28
  350. data/spec/rdfcore/xmlbase/test003.nt +0 -14
  351. data/spec/rdfcore/xmlbase/test003.rdf +0 -25
  352. data/spec/rdfcore/xmlbase/test004.nt +0 -18
  353. data/spec/rdfcore/xmlbase/test004.rdf +0 -27
  354. data/spec/rdfcore/xmlbase/test006.nt +0 -15
  355. data/spec/rdfcore/xmlbase/test006.rdf +0 -26
  356. data/spec/rdfcore/xmlbase/test007.nt +0 -14
  357. data/spec/rdfcore/xmlbase/test007.rdf +0 -25
  358. data/spec/rdfcore/xmlbase/test008.nt +0 -14
  359. data/spec/rdfcore/xmlbase/test008.rdf +0 -25
  360. data/spec/rdfcore/xmlbase/test009.nt +0 -14
  361. data/spec/rdfcore/xmlbase/test009.rdf +0 -26
  362. data/spec/rdfcore/xmlbase/test010.nt +0 -14
  363. data/spec/rdfcore/xmlbase/test010.rdf +0 -26
  364. data/spec/rdfcore/xmlbase/test011.nt +0 -14
  365. data/spec/rdfcore/xmlbase/test011.rdf +0 -27
  366. data/spec/rdfcore/xmlbase/test013.nt +0 -15
  367. data/spec/rdfcore/xmlbase/test013.rdf +0 -28
  368. data/spec/rdfcore/xmlbase/test014.nt +0 -15
  369. data/spec/rdfcore/xmlbase/test014.rdf +0 -28
  370. data/spec/rdfcore/xmlsch-02/test001.rdf +0 -34
  371. data/spec/rdfcore/xmlsch-02/test002.rdf +0 -34
  372. data/spec/rdfcore/xmlsch-02/test003.rdf +0 -37
data/.yardopts CHANGED
@@ -1,9 +1,9 @@
1
- --title "Notation-3 (n3-rdf) and Turtle reader/writer for RDF.rb."
1
+ --title "Notation-3 and Turtle reader/writer for RDF.rb."
2
2
  --output-dir doc/yard
3
3
  --protected
4
4
  --no-private
5
5
  --hide-void-return
6
- --markup rdoc
6
+ --markup markdown
7
7
  --readme README.md
8
8
  -
9
9
  History.md
data/History.md CHANGED
@@ -1,3 +1,15 @@
1
+ 0.3.3
2
+ -----
3
+ * Update dependencies to RDF.rb 0.3.3
4
+ * Update specs to use open-uri-cached and Spira; no longer directly include W3C test cases.
5
+ * Use Bundler when running specs.
6
+ * Only output prefix definitions used in serialization.
7
+ * Fixed stack overflow in regular expression when matching long multi-line literals.
8
+ * Fixed bug (issue 14) where illegal QNames were generated in writer.
9
+
10
+ 0.3.2
11
+ -----
12
+ * Skipped
1
13
  0.3.1.3
2
14
  -----
3
15
  * Normalize language tags to lower case (only when canonicalizing). SPARQL specs expect the reader
data/README ADDED
@@ -0,0 +1,153 @@
1
+ RDF::N3 reader/writer
2
+ =====================
3
+ Notation-3 and Turtle reader/writer for [RDF.rb][RDF.rb] .
4
+
5
+ Description
6
+ -----------
7
+ RDF::N3 is an Notation-3 parser for Ruby using the [RDF.rb][RDF.rb] library suite.
8
+
9
+ Reader inspired from TimBL predictiveParser and Python librdf implementation.
10
+
11
+ Features
12
+ --------
13
+ RDF::N3 parses [Notation-3][N3], [Turtle][Turtle] and [N-Triples][N-Triples] into statements or triples. It also serializes to Turtle.
14
+
15
+ Install with `gem install rdf-n3`
16
+
17
+ ## Limitations
18
+ * Full support of Unicode input requires Ruby version 1.9 or greater.
19
+ * Support for Variables in Formulae dependent on underlying repository. Existential variables are quantified to RDF::Node instances, Universals to RDF::Query::Variable, with the URI of the variable target used as the variable name.
20
+ * No support for N3 Reification. If there were, it would be through a :reify option to the reader.
21
+
22
+ ## Usage
23
+ Instantiate a reader from a local file:
24
+
25
+ RDF::N3::Reader.open("etc/foaf.n3") do |reader|
26
+ reader.each_statement do |statement|
27
+ puts statement.inspect
28
+ end
29
+ end
30
+
31
+ Define `@base` and `@prefix` definitions, and use for serialization using `:base_uri` an `:prefixes` options
32
+
33
+ Write a graph to a file:
34
+
35
+ RDF::N3::Writer.open("etc/test.n3") do |writer|
36
+ writer << graph
37
+ end
38
+
39
+ ### Formulae
40
+ N3 Formulae are introduced with the { statement-list } syntax. A given formula is assigned an RDF::Node instance, which is also used as the context for RDF::Statement instances provided to RDF::N3::Reader#each_statement. For example, the following N3 generates the associated statements:
41
+
42
+ { [ x:firstname "Ora" ] dc:wrote [ dc:title "Moby Dick" ] } a n3:falsehood .
43
+
44
+ results in
45
+
46
+ f = RDF::Node.new
47
+ s = RDF::Node.new
48
+ o = RDF::Node.new
49
+ RDF::Statement(f, rdf:type n3:falsehood)
50
+ RDF::Statement(s, x:firstname, "Ora", :context => f)
51
+ RDF::Statement(s, dc:wrote, o, :context => f)
52
+ RDF::Statement(o, dc:title, "Moby Dick", :context => f)
53
+
54
+ ### Variables
55
+ N3 Variables are introduced with @forAll, @forEach, or ?x. Variables reference URIs described in formulae, typically defined in the default vocabulary (e.g., ":x"). Existential variables are replaced with an allocated RDF::Node instance. Universal variables are replaced with a RDF::Query::Variable instance. For example, the following N3 generates the associated statements:
56
+
57
+ @forAll <#h>. @forSome <#g>. <#g> <#loves> <#h> .
58
+
59
+ results in:
60
+
61
+ h = RDF::Query::Variable.new(<#h>)
62
+ g = RDF::Node.new()
63
+ RDF::Statement.new(f, <#loves>, h)
64
+
65
+ ## Implementation Notes
66
+ The parser is driven through a rules table contained in lib/rdf/n3/reader/meta.rb. This includes
67
+ branch rules to indicate productions to be taken based on a current production. Terminals are denoted
68
+ through a set of regular expressions used to match each type of terminal.
69
+
70
+ The [meta.rb][file:lib/rdf/n3/reader/meta.rb] file is generated from lib/rdf/n3/reader/n3-selectors.n3
71
+ (taken from http://www.w3.org/2000/10/swap/grammar/n3-selectors.n3) which is the result of parsing
72
+ http://www.w3.org/2000/10/swap/grammar/n3.n3 (along with bnf-rules.n3) using cwm using the following command sequence:
73
+
74
+ cwm n3.n3 bnf-rules.n3 --think --purge --data > n3-selectors.n3
75
+
76
+ [n3-selectors.n3][file:lib/rdf/n3/reader/n3-selectors.rb] is itself used to generate meta.rb using script/build_meta.
77
+
78
+ ## TODO
79
+ * Generate Formulae and solutions using BGP and SPARQL CONSTRUCT mechanisms
80
+ * Create equivalent to `--think` to iterate on solutions.
81
+
82
+ ## Dependencies
83
+ * [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.1)
84
+
85
+ ## Documentation
86
+ Full documentation available on [RubyForge](http://rdf.rubyforge.org/n3)
87
+
88
+ ### Principle Classes
89
+ * {RDF::N3}
90
+ * {RDF::N3::Format}
91
+ * {RDF::N3::Reader}
92
+ * {RDF::N3::Writer}
93
+
94
+ ### Additional vocabularies
95
+ * {RDF::LOG}
96
+ * {RDF::REI}
97
+
98
+ ### Patches
99
+ * {Array}
100
+ * {RDF::Graph}
101
+
102
+ ## Resources
103
+ * [RDF.rb][RDF.rb]
104
+ * [Distiller](http://distiller.kellogg-assoc)
105
+ * [Documentation](http://rdf.rubyforge.org/n3)
106
+ * [History](file:file.History.html)
107
+ * [Notation-3][N3]
108
+ * [N3 Primer](http://www.w3.org/2000/10/swap/Primer.html)
109
+ * [N3 Reification](http://www.w3.org/DesignIssues/Reify.html)
110
+ * [Turtle][Turtle]
111
+ * [W3C SWAP Test suite](http://www.w3.org/2000/10/swap/test/README.html)
112
+ * [W3C Turtle Test suite](http://www.w3.org/2001/sw/DataAccess/df1/tests/README.txt)
113
+ * [N-Triples][N-Triples]
114
+
115
+ ## Author
116
+ * [Gregg Kellogg](http://github.com/gkellogg) - <http://kellogg-assoc.com/>
117
+
118
+ ## Contributors
119
+ * [Nicholas Humfrey](http://github.com/njh)
120
+
121
+ ## Contributing
122
+
123
+ * Do your best to adhere to the existing coding conventions and idioms.
124
+ * Don't use hard tabs, and don't leave trailing whitespace on any line.
125
+ * Do document every method you add using [YARD][] annotations. Read the
126
+ [tutorial][YARD-GS] or just look at the existing code for examples.
127
+ * Don't touch the `.gemspec`, `VERSION` or `AUTHORS` files. If you need to
128
+ change them, do so on your private branch only.
129
+ * Do feel free to add yourself to the `CREDITS` file and the corresponding
130
+ list in the the `README`. Alphabetical order applies.
131
+ * Do note that in order for us to merge any non-trivial changes (as a rule
132
+ of thumb, additions larger than about 15 lines of code), we need an
133
+ explicit [public domain dedication][PDD] on record from you.
134
+
135
+ ## License
136
+
137
+ This is free and unencumbered public domain software. For more information,
138
+ see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
139
+
140
+ Feedback
141
+ --------
142
+ * <gregg@kellogg-assoc.com>
143
+ * <http://rubygems.org/gem/rdf-n3>
144
+ * <http://github.com/gkellogg/rdf-n3>
145
+ * <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
146
+
147
+ [RDF.rb]: http://rdf.rubyforge.org/
148
+ [N3]: http://www.w3.org/DesignIssues/Notation3.html "Notation-3"
149
+ [Turtle]: http://www.w3.org/TeamSubmission/turtle/
150
+ [N-Triples]: http://www.w3.org/2001/sw/RDFCore/ntriples/
151
+ [YARD]: http://yardoc.org/
152
+ [YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
153
+ [PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
data/README.md CHANGED
@@ -112,6 +112,26 @@ Full documentation available on [RubyForge](http://rdf.rubyforge.org/n3)
112
112
  * [W3C Turtle Test suite](http://www.w3.org/2001/sw/DataAccess/df1/tests/README.txt)
113
113
  * [N-Triples][N-Triples]
114
114
 
115
+ ## Author
116
+ * [Gregg Kellogg](http://github.com/gkellogg) - <http://kellogg-assoc.com/>
117
+
118
+ ## Contributors
119
+ * [Nicholas Humfrey](http://github.com/njh)
120
+
121
+ ## Contributing
122
+
123
+ * Do your best to adhere to the existing coding conventions and idioms.
124
+ * Don't use hard tabs, and don't leave trailing whitespace on any line.
125
+ * Do document every method you add using [YARD][] annotations. Read the
126
+ [tutorial][YARD-GS] or just look at the existing code for examples.
127
+ * Don't touch the `.gemspec`, `VERSION` or `AUTHORS` files. If you need to
128
+ change them, do so on your private branch only.
129
+ * Do feel free to add yourself to the `CREDITS` file and the corresponding
130
+ list in the the `README`. Alphabetical order applies.
131
+ * Do note that in order for us to merge any non-trivial changes (as a rule
132
+ of thumb, additions larger than about 15 lines of code), we need an
133
+ explicit [public domain dedication][PDD] on record from you.
134
+
115
135
  ## License
116
136
 
117
137
  This is free and unencumbered public domain software. For more information,
@@ -124,7 +144,10 @@ Feedback
124
144
  * <http://github.com/gkellogg/rdf-n3>
125
145
  * <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
126
146
 
127
- [RDF.rb]: http://rdf.rubyforge.org/
128
- [N3]: http://www.w3.org/DesignIssues/Notation3.html "Notation-3"
129
- [Turtle]: http://www.w3.org/TeamSubmission/turtle/
147
+ [RDF.rb]: http://rdf.rubyforge.org/
148
+ [N3]: http://www.w3.org/DesignIssues/Notation3.html "Notation-3"
149
+ [Turtle]: http://www.w3.org/TeamSubmission/turtle/
130
150
  [N-Triples]: http://www.w3.org/2001/sw/RDFCore/ntriples/
151
+ [YARD]: http://yardoc.org/
152
+ [YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
153
+ [PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
data/Rakefile CHANGED
@@ -6,17 +6,17 @@ begin
6
6
  require 'jeweler'
7
7
  Jeweler::Tasks.new do |gemspec|
8
8
  gemspec.name = "rdf-n3"
9
- gemspec.summary = "Notation-3 (n3-rdf) and Turtle reader/writer for RDF.rb."
10
- gemspec.description = %q(RDF::N3 is an Notation-3 (n3-rdf) parser for Ruby using the RDF.rb library suite.)
9
+ gemspec.summary = "N3/Turtle reader/writer for RDF.rb."
10
+ gemspec.description = %q(RDF::N3 is an Notation-3 and Turtle reader/writer for the RDF.rb library suite.)
11
11
  gemspec.email = "gregg@kellogg-assoc.com"
12
12
  gemspec.homepage = "http://github.com/gkellogg/rdf-n3"
13
13
  gemspec.authors = ["Gregg Kellogg"]
14
- gemspec.add_dependency('rdf', '>= 0.3.1')
14
+ gemspec.add_dependency('rdf', '>= 0.3.3')
15
15
  gemspec.add_development_dependency('open-uri-cached')
16
16
  gemspec.add_development_dependency('spira', '>= 0.0.12')
17
17
  gemspec.add_development_dependency('rspec', '>= 2.5.0')
18
- gemspec.add_development_dependency('rdf-spec', '>= 0.3.1')
19
- gemspec.add_development_dependency('rdf-rdfxml', '>= 0.3.1')
18
+ gemspec.add_development_dependency('rdf-spec', '>= 0.3.3')
19
+ gemspec.add_development_dependency('rdf-rdfxml', '>= 0.3.3')
20
20
  gemspec.add_development_dependency('rdf-isomorphic', '>= 0.3.4')
21
21
  gemspec.add_development_dependency('yard')
22
22
  gemspec.extra_rdoc_files = %w(README.md History.md AUTHORS VERSION UNLICENSE)
@@ -40,8 +40,6 @@ RSpec::Core::RakeTask.new("doc:spec") do |spec|
40
40
  spec.rspec_opts = ["--format", "html", "-o", "doc/spec.html"]
41
41
  end
42
42
 
43
- YARD::Rake::YardocTask.new do |t|
44
- t.files = %w(lib/**/*.rb README.md History.md AUTHORS VERSION) # optional
45
- end
43
+ YARD::Rake::YardocTask.new
46
44
 
47
45
  task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1.3
1
+ 0.3.3
@@ -0,0 +1,12 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+
3
+ :foo rdf:value """Lorem ipsum dolor sit amet "consectetur adipisicing elit" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
4
+ Lorem ipsum dolor sit amet "consectetur adipisicing elit" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
5
+ Lorem ipsum dolor sit amet "consectetur adipisicing elit" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
6
+ Lorem ipsum dolor sit amet "consectetur adipisicing elit" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
7
+ Lorem ipsum dolor sit amet "consectetur adipisicing elit" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
8
+ Lorem ipsum dolor sit amet "consectetur adipisicing elit" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
9
+ Lorem ipsum dolor sit amet "consectetur adipisicing elit" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
10
+ Lorem ipsum dolor sit amet "consectetur adipisicing elit" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
11
+ Lorem ipsum dolor sit amet, co.""", """foo"""; a :bar .
12
+ :t1049 rdf:value """sameDan.n3 sameThing.n3 --think --apply=forgetDups.n3 --purge --n3="/" """.
@@ -0,0 +1,10 @@
1
+ @base <http://example.com> .
2
+ @prefix db: <http://dbpedia.org/resource/> .
3
+ @prefix dbo: <http://dbpedia.org/ontology/> .
4
+
5
+ db:Michael_Jackson dbo:activeYearsEndYear "2009-01-01T00:00:00Z";
6
+ dbo:activeYearsStartYear "1964-01-01T00:00:00Z";
7
+ dbo:artistOf db:%28I_Can%27t_Make_It%29_Another_Day .
8
+
9
+ Parsed 3 statements in 0.044056 seconds @ 68.0951516252043 statements/second.
10
+
@@ -0,0 +1,8 @@
1
+ @prefix db: <http://dbpedia.org/resource/> .
2
+ @prefix dbm: <http://dbpedia.org/meta/> .
3
+ @prefix dbo: <http://dbpedia.org/ontology/> .
4
+
5
+ db:Michael_Jackson dbo:activeYearsEndYear "2009-01-01T00:00:00Z";
6
+ dbo:activeYearsStartYear "1964-01-01T00:00:00Z";
7
+ dbo:artistOf <http://dbpedia.org/resource/%28I_Can%27t_Make_It%29_Another_Day> .
8
+
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rdf'
4
+ require 'rdf/n3'
5
+
6
+ doc = %q(
7
+ @prefix dms: <http://example.stanford.edu/ns/> .
8
+ @prefix ore: <http://www.openarchives.org/ore/terms/> .
9
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
10
+
11
+ <http://dmstech.groups.stanford.edu/ccc001/manifest/NormalSequence> a dms:Sequence,
12
+ ore:Aggregation,
13
+ rdf:List;
14
+ ore:aggregates (
15
+ <http://example.stanford.edu/item/DOC001/fob>
16
+ <http://example.stanford.edu/item/DOC001/fib>
17
+ <http://example.stanford.edu/item/DOC001/iR>
18
+ <http://example.stanford.edu/item/DOC001/iV>
19
+ <http://example.stanford.edu/item/DOC001/iiR>
20
+ <http://example.stanford.edu/item/DOC001/iiV>
21
+ <http://example.stanford.edu/item/DOC001/1R>
22
+ <http://example.stanford.edu/item/DOC001/1V>
23
+ <http://example.stanford.edu/item/DOC001/2R>
24
+ <http://example.stanford.edu/item/DOC001/2V>
25
+ <http://example.stanford.edu/item/DOC001/iiiR>
26
+ <http://example.stanford.edu/item/DOC001/iiiV>
27
+ <http://example.stanford.edu/item/DOC001/ivR>
28
+ <http://example.stanford.edu/item/DOC001/ivV>
29
+ <http://example.stanford.edu/item/DOC001/bib>
30
+ <http://example.stanford.edu/item/DOC001/bob> ) .
31
+ )
32
+
33
+ r = RDF::N3::Reader.new(doc)
34
+ g = RDF::Graph.new << r
35
+
36
+ puts "NTriples Representation"
37
+ puts g.dump(:ntriples)
38
+
39
+ puts "Turtle/N3 Representation"
40
+ puts g.dump(:n3, :prefixes => r.prefixes)
@@ -9,7 +9,8 @@ module RDF::N3
9
9
  # Separate pass to create branch_table from n3-selectors.n3
10
10
  #
11
11
  # @todo
12
- # Existentials, Universals and Formulae
12
+ # * Formulae as RDF::Query representations
13
+ # * Formula expansion similar to SPARQL Construct
13
14
  #
14
15
  # @author [Gregg Kellogg](http://kellogg-assoc.com/)
15
16
  class Reader < RDF::Reader
@@ -45,7 +46,8 @@ module RDF::N3
45
46
  # @raise [Error]:: Raises RDF::ReaderError if _validate_
46
47
  def initialize(input = $stdin, options = {}, &block)
47
48
  super do
48
- @input = input.respond_to?(:read) ? (input.rewind; input) : StringIO.new(input.to_s)
49
+ input.rewind if input.respond_to?(:rewind)
50
+ @input = input.respond_to?(:read) ? input : StringIO.new(input.to_s)
49
51
  @lineno = 0
50
52
  readline # Prime the pump
51
53
 
@@ -82,6 +84,10 @@ module RDF::N3
82
84
  end
83
85
  end
84
86
 
87
+ def inspect
88
+ sprintf("#<%s:%#0x(%s)>", self.class.name, __id__, base_uri.to_s)
89
+ end
90
+
85
91
  ##
86
92
  # XXX Remove when added to RDF::Reader
87
93
  # Returns the base URI determined by this reader.
@@ -632,7 +632,7 @@ module RDF::N3::Meta
632
632
  :"http://www.w3.org/2000/10/swap/grammar/n3#prefix" => Regexp.compile(%(^([#{BARENAME_START}][#{BARENAME_TAIL}]*)?:)),
633
633
  :"http://www.w3.org/2000/10/swap/grammar/n3#qname" => Regexp.compile(%(^(([#{BARENAME_START}][#{BARENAME_TAIL}]*)?:)?([#{BARENAME_START}][#{BARENAME_TAIL}]*)?)),
634
634
  :"http://www.w3.org/2000/10/swap/grammar/n3#quickvariable" => Regexp.compile(%(^\\?[#{BARENAME_START}][#{BARENAME_TAIL}]*)),
635
- :"http://www.w3.org/2000/10/swap/grammar/n3#string" => Regexp.compile("(\"\"\"[^\"\\\\]*(?:(?:\\\\.|\"(?!\"\"))[^\"\\\\]*)*\"\"\")|(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\")"),
635
+ :"http://www.w3.org/2000/10/swap/grammar/n3#string" => Regexp.compile("(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\")"),
636
636
 
637
637
  # Hack to replace integer|double|decimal with numericliteral
638
638
  :"http://www.w3.org/2000/10/swap/grammar/n3#numericliteral" => Regexp.compile(%(^[-+]?[0-9]+(\\.[0-9]+)?(e[-+]?[0-9]+)?))
@@ -3,7 +3,7 @@ module RDF::N3
3
3
  module Parser
4
4
  START = 'http://www.w3.org/2000/10/swap/grammar/n3#document'
5
5
  R_WHITESPACE = Regexp.compile('\A\s*(?:#.*$)?')
6
- R_MLSTRING = Regexp.compile("(\"\"\"[^\"\\\\]*(?:(?:\\\\.|\"(?!\"\"))[^\"\\\\]*)*\"\"\")")
6
+ R_MLSTRING = Regexp.compile("^.*([^\"\\\\]*)\"\"\"")
7
7
  SINGLE_CHARACTER_SELECTORS = %{\t\r\n !\"#$\%&'()*.,+/;<=>?[\\]^`{|}~}
8
8
  NOT_QNAME_CHARS = SINGLE_CHARACTER_SELECTORS + "@"
9
9
  NOT_NAME_CHARS = NOT_QNAME_CHARS + ":"
@@ -56,22 +56,29 @@ module RDF::N3
56
56
  elsif regexp = @regexps[term]
57
57
  if abbr(term) == 'string' && buffer[0, 3] == '"""'
58
58
  # Read until end of multi-line comment if this is the start of a multi-line comment
59
- until R_MLSTRING.match(buffer)
59
+ string = '"""'
60
+ consume(3)
61
+ next_line = buffer
62
+ #puts "ml-str(start): #{next_line.dump}" if $verbose
63
+ until md = R_MLSTRING.match(next_line)
60
64
  begin
61
- next_line = @input.readline
62
- @line += next_line
63
- @lineno += 1
65
+ string += next_line
66
+ next_line = readline
64
67
  rescue EOFError => e
65
68
  error("EOF reached searching for end of multi-line comment")
66
69
  end
67
70
  end
71
+ string += md[0].to_s
72
+ consume(md[0].to_s.length)
73
+ onToken('string', string)
68
74
  #puts "ml-str now #{buffer.dump}"
75
+ else
76
+ md = regexp.match(buffer)
77
+ error("Token(#{abbr(term)}) '#{buffer[0, 10]}...' should match #{regexp}") unless md
78
+ puts "parse term(#{abbr(term)}:regexp): #{term}, #{regexp}.match('#{buffer[0, 10]}...') => '#{md.inspect}'" if $verbose
79
+ onToken(abbr(term), md.to_s)
80
+ consume(md[0].length)
69
81
  end
70
- md = regexp.match(buffer)
71
- error("Token(#{abbr(term)}) '#{buffer[0, 10]}...' should match #{regexp}") unless md
72
- puts "parse term(#{abbr(term)}:regexp): #{term}, #{regexp}.match('#{buffer[0, 10]}...') => '#{md.inspect}'" if $verbose
73
- onToken(abbr(term), md.to_s)
74
- consume(md[0].length)
75
82
  else
76
83
  puts "parse term(push): #{term}" if $verbose
77
84
  todo_stack << {:prod => term, :terms => nil}
@@ -159,7 +166,7 @@ module RDF::N3
159
166
  @line = @input.readline
160
167
  @lineno += 1
161
168
  @line.force_encoding(Encoding::UTF_8) if @line.respond_to?(:force_encoding) # for Ruby 1.9+
162
- puts "readline[#{@lineno}]: '#{@line}'" if $verbose
169
+ puts "readline[#{@lineno}]: #{@line.dump}" if $verbose
163
170
  @pos = 0
164
171
  @line
165
172
  rescue EOFError => e
@@ -53,6 +53,7 @@ module RDF::N3
53
53
  # @author [Gregg Kellogg](http://kellogg-assoc.com/)
54
54
  class Writer < RDF::Writer
55
55
  format RDF::N3::Format
56
+ QNAME = Meta::REGEXPS[:"http://www.w3.org/2000/10/swap/grammar/n3#qname"]
56
57
 
57
58
  # @return [Graph] Graph of statements serialized
58
59
  attr_accessor :graph
@@ -89,7 +90,7 @@ module RDF::N3
89
90
  super do
90
91
  @graph = RDF::Graph.new
91
92
  @uri_to_qname = {}
92
- prefix(nil, @options[:default_namespace]) if @options[:default_namespace]
93
+ @uri_to_prefix = {}
93
94
  if block_given?
94
95
  case block.arity
95
96
  when 0 then instance_eval(&block)
@@ -154,35 +155,44 @@ module RDF::N3
154
155
  end
155
156
 
156
157
  # Return a QName for the URI, or nil. Adds namespace of QName to defined prefixes
157
- # @param [URI,#to_s] uri
158
- # @return [Array<Symbol,Symbol>, nil] Prefix, Suffix pair or nil, if none found
159
- def get_qname(uri)
160
- uri = RDF::URI.intern(uri.to_s) unless uri.is_a?(URI)
158
+ # @param [RDF::Resource] resource
159
+ # @return [String, nil] value to use to identify URI
160
+ def get_qname(resource)
161
+ case resource
162
+ when RDF::Node
163
+ return resource.to_s
164
+ when RDF::URI
165
+ uri = resource.to_s
166
+ else
167
+ return nil
168
+ end
161
169
 
162
- unless @uri_to_qname.has_key?(uri)
163
- # Find in defined prefixes
164
- prefixes.each_pair do |prefix, vocab|
165
- if uri.to_s.index(vocab.to_s) == 0
166
- local_name = uri.to_s[(vocab.to_s.length)..-1]
167
- add_debug "get_qname(ns): #{prefix}:#{local_name}"
168
- return @uri_to_qname[uri] = "#{prefix}:#{local_name}"
169
- end
170
- end
171
-
172
- # Use a default vocabulary
173
- if @options[:standard_prefixes] && vocab = RDF::Vocabulary.detect {|v| uri.to_s.index(v.to_uri.to_s) == 0}
174
- prefix = vocab.__name__.to_s.split('::').last.downcase
175
- prefixes[prefix.to_sym] = vocab.to_uri
176
- suffix = uri.to_s[vocab.to_uri.to_s.size..-1]
177
- return @uri_to_qname[uri] = "#{prefix}:#{suffix}"
178
- end
179
-
180
- @uri_to_qname[uri] = nil
170
+ qname = case
171
+ when @uri_to_qname.has_key?(uri)
172
+ return @uri_to_qname[uri]
173
+ when u = @uri_to_prefix.keys.detect {|u| uri.index(u.to_s) == 0}
174
+ # Use a defined prefix
175
+ prefix = @uri_to_prefix[u]
176
+ prefix(prefix, u) # Define for output
177
+ uri.sub(u.to_s, "#{prefix}:")
178
+ when @options[:standard_prefixes] && vocab = RDF::Vocabulary.detect {|v| uri.index(v.to_uri.to_s) == 0}
179
+ prefix = vocab.__name__.to_s.split('::').last.downcase
180
+ @uri_to_prefix[vocab.to_uri.to_s] = prefix
181
+ prefix(prefix, vocab.to_uri) # Define for output
182
+ uri.sub(vocab.to_uri.to_s, "#{prefix}:")
183
+ else
184
+ nil
181
185
  end
182
186
 
183
- @uri_to_qname[uri]
187
+ # Make sure qname is a valid qname
188
+ if qname
189
+ md = QNAME.match(qname)
190
+ qname = nil unless md.to_s.length == qname.length
191
+ end
192
+
193
+ @uri_to_qname[uri] = qname
184
194
  rescue Addressable::URI::InvalidURIError => e
185
- @uri_to_qname[uri] = nil
195
+ raise RDF::WriterError, "Invalid URI #{resource.inspect}: #{e.message}"
186
196
  end
187
197
 
188
198
  # Take a hash from predicate uris to lists of values.
@@ -242,7 +252,7 @@ module RDF::N3
242
252
  # @return [String]
243
253
  def format_uri(uri, options = {})
244
254
  md = relativize(uri)
245
- md && md != uri.to_s ? "<#{md}>" : (get_qname(uri) || "<#{uri_for(uri)}>")
255
+ md && md != uri.to_s ? "<#{md}>" : (get_qname(uri) || "<#{uri}>")
246
256
  end
247
257
 
248
258
  ##
@@ -287,17 +297,24 @@ module RDF::N3
287
297
 
288
298
  # Order subjects for output. Override this to output subjects in another order.
289
299
  #
290
- # Uses top_classes
300
+ # Uses #top_classes and #base_uri.
291
301
  # @return [Array<Resource>] Ordered list of subjects
292
302
  def order_subjects
293
303
  seen = {}
294
304
  subjects = []
295
305
 
306
+ # Start with base_uri
307
+ if base_uri && @subjects.keys.include?(base_uri)
308
+ subjects << base_uri
309
+ seen[subject] = true
310
+ end
311
+
312
+ # Add distinguished classes
296
313
  top_classes.each do |class_uri|
297
314
  graph.query(:predicate => RDF.type, :object => class_uri).map {|st| st.subject}.sort.uniq.each do |subject|
298
315
  #add_debug "order_subjects: #{subject.inspect}"
299
316
  subjects << subject
300
- seen[subject] = @top_levels[subject] = true
317
+ seen[subject] = true
301
318
  end
302
319
  end
303
320
 
@@ -312,6 +329,14 @@ module RDF::N3
312
329
 
313
330
  # Perform any preprocessing of statements required
314
331
  def preprocess
332
+ # Load defined prefixes
333
+ (@options[:prefixes] || {}).each_pair do |k, v|
334
+ @uri_to_prefix[v.to_s] = k
335
+ end
336
+ @options[:prefixes] = {} # Will define actual used when matched
337
+
338
+ prefix(nil, @options[:default_namespace]) if @options[:default_namespace]
339
+
315
340
  @graph.each {|statement| preprocess_statement(statement)}
316
341
  end
317
342
 
@@ -353,7 +378,6 @@ module RDF::N3
353
378
  @references = {}
354
379
  @serialized = {}
355
380
  @subjects = {}
356
- @top_levels = {}
357
381
  @shortNames = {}
358
382
  @started = false
359
383
  end