rdf-turtle 1.1.0p0 → 1.1.0p1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -4
- data/VERSION +1 -1
- data/lib/rdf/turtle/meta.rb +135 -117
- data/lib/rdf/turtle/reader.rb +10 -30
- data/lib/rdf/turtle/terminals.rb +5 -5
- metadata +74 -74
data/README.md
CHANGED
@@ -45,16 +45,18 @@ Full documentation available on [Rubydoc.info][Turtle doc]
|
|
45
45
|
### Variations from the spec
|
46
46
|
In some cases, the specification is unclear on certain issues:
|
47
47
|
|
48
|
-
*
|
49
|
-
|
50
|
-
|
48
|
+
* The LC version of the [Turtle][] specification separates rules for `@base` and `@prefix` with
|
49
|
+
closing '.' from the
|
50
|
+
SPARQL-like `BASE` and `PREFIX` without closing '.'. This version implements a more flexible
|
51
|
+
syntax where the `@` and closing `.` are optional and `base/prefix` are matched case independently.
|
52
|
+
* Additionally, both `a` and `A` match `rdf:type`.
|
51
53
|
|
52
54
|
### Freebase-specific Reader
|
53
55
|
There is a special reader useful for processing [Freebase Dumps][]. To invoke
|
54
56
|
this, add the `:freebase => true` option to the {RDF::Turtle::Reader.new}, or
|
55
57
|
use {RDF::Turtle::FreebaseReader} directly. As with {RDF::Turtle::Reader},
|
56
58
|
prefix definitions may be passed in using the `:prefixes` option to
|
57
|
-
|
59
|
+
RDF::Turtle::FreebaseReader} using the standard mechanism defined
|
58
60
|
for `RDF::Reader`.
|
59
61
|
|
60
62
|
The [Freebase Dumps][] have a very normalized form, similar to N-Triples but
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.0p1
|
data/lib/rdf/turtle/meta.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is automatically generated by /Users/gregg/.rvm/gems/ruby-1.9.3-
|
1
|
+
# This file is automatically generated by /Users/gregg/.rvm/gems/ruby-1.9.3-p392/bundler/gems/ebnf-af9a669d518f/bin/ebnf
|
2
2
|
# BRANCH derived from etc/turtle.bnf
|
3
3
|
module RDF::Turtle::Meta
|
4
4
|
START = :turtleDoc
|
@@ -66,7 +66,19 @@ module RDF::Turtle::Meta
|
|
66
66
|
:STRING_LITERAL_SINGLE_QUOTE => [:STRING_LITERAL_SINGLE_QUOTE],
|
67
67
|
},
|
68
68
|
:base => {
|
69
|
-
|
69
|
+
:BASE => [:BASE, :IRIREF, :_base_1],
|
70
|
+
},
|
71
|
+
:_base_1 => {
|
72
|
+
"(" => [],
|
73
|
+
"." => ["."],
|
74
|
+
:ANON => [],
|
75
|
+
:BASE => [],
|
76
|
+
:BLANK_NODE_LABEL => [],
|
77
|
+
:IRIREF => [],
|
78
|
+
:PNAME_LN => [],
|
79
|
+
:PNAME_NS => [],
|
80
|
+
:PREFIX => [],
|
81
|
+
"[" => [],
|
70
82
|
},
|
71
83
|
:blankNodePropertyList => {
|
72
84
|
"[" => ["[", :predicateObjectList, "]"],
|
@@ -112,10 +124,10 @@ module RDF::Turtle::Meta
|
|
112
124
|
"true" => [:object, :_collection_1],
|
113
125
|
},
|
114
126
|
:directive => {
|
115
|
-
|
116
|
-
|
117
|
-
:
|
118
|
-
:
|
127
|
+
:BASE => [:base],
|
128
|
+
:PREFIX => [:prefixID],
|
129
|
+
:sparqlBase => [:sparqlBase],
|
130
|
+
:sparqlPrefix => [:sparqlPrefix],
|
119
131
|
},
|
120
132
|
:iri => {
|
121
133
|
:IRIREF => [:IRIREF],
|
@@ -187,6 +199,7 @@ module RDF::Turtle::Meta
|
|
187
199
|
:PNAME_NS => [:iri],
|
188
200
|
},
|
189
201
|
:predicateObjectList => {
|
202
|
+
"A" => [:verb, :objectList, :_predicateObjectList_1],
|
190
203
|
:IRIREF => [:verb, :objectList, :_predicateObjectList_1],
|
191
204
|
:PNAME_LN => [:verb, :objectList, :_predicateObjectList_1],
|
192
205
|
:PNAME_NS => [:verb, :objectList, :_predicateObjectList_1],
|
@@ -206,6 +219,7 @@ module RDF::Turtle::Meta
|
|
206
219
|
:_predicateObjectList_4 => {
|
207
220
|
"." => [],
|
208
221
|
";" => [],
|
222
|
+
"A" => [:_predicateObjectList_5],
|
209
223
|
:IRIREF => [:_predicateObjectList_5],
|
210
224
|
:PNAME_LN => [:_predicateObjectList_5],
|
211
225
|
:PNAME_NS => [:_predicateObjectList_5],
|
@@ -213,31 +227,36 @@ module RDF::Turtle::Meta
|
|
213
227
|
"a" => [:_predicateObjectList_5],
|
214
228
|
},
|
215
229
|
:_predicateObjectList_5 => {
|
230
|
+
"A" => [:verb, :objectList],
|
216
231
|
:IRIREF => [:verb, :objectList],
|
217
232
|
:PNAME_LN => [:verb, :objectList],
|
218
233
|
:PNAME_NS => [:verb, :objectList],
|
219
234
|
"a" => [:verb, :objectList],
|
220
235
|
},
|
221
236
|
:prefixID => {
|
222
|
-
|
223
|
-
},
|
224
|
-
:sparqlBase => {
|
225
|
-
:SPARQL_BASE => [:SPARQL_BASE, :IRIREF],
|
237
|
+
:PREFIX => [:PREFIX, :PNAME_NS, :IRIREF, :_prefixID_1],
|
226
238
|
},
|
227
|
-
:
|
228
|
-
|
239
|
+
:_prefixID_1 => {
|
240
|
+
"(" => [],
|
241
|
+
"." => ["."],
|
242
|
+
:ANON => [],
|
243
|
+
:BASE => [],
|
244
|
+
:BLANK_NODE_LABEL => [],
|
245
|
+
:IRIREF => [],
|
246
|
+
:PNAME_LN => [],
|
247
|
+
:PNAME_NS => [],
|
248
|
+
:PREFIX => [],
|
249
|
+
"[" => [],
|
229
250
|
},
|
230
251
|
:statement => {
|
231
252
|
"(" => [:_statement_1],
|
232
|
-
"@base" => [:directive],
|
233
|
-
"@prefix" => [:directive],
|
234
253
|
:ANON => [:_statement_1],
|
254
|
+
:BASE => [:directive],
|
235
255
|
:BLANK_NODE_LABEL => [:_statement_1],
|
236
256
|
:IRIREF => [:_statement_1],
|
237
257
|
:PNAME_LN => [:_statement_1],
|
238
258
|
:PNAME_NS => [:_statement_1],
|
239
|
-
:
|
240
|
-
:SPARQL_PREFIX => [:directive],
|
259
|
+
:PREFIX => [:directive],
|
241
260
|
"[" => [:_statement_1],
|
242
261
|
},
|
243
262
|
:_statement_1 => {
|
@@ -279,6 +298,7 @@ module RDF::Turtle::Meta
|
|
279
298
|
},
|
280
299
|
:_triples_3 => {
|
281
300
|
"." => [],
|
301
|
+
"A" => [:predicateObjectList],
|
282
302
|
:IRIREF => [:predicateObjectList],
|
283
303
|
:PNAME_LN => [:predicateObjectList],
|
284
304
|
:PNAME_NS => [:predicateObjectList],
|
@@ -286,31 +306,28 @@ module RDF::Turtle::Meta
|
|
286
306
|
},
|
287
307
|
:turtleDoc => {
|
288
308
|
"(" => [:_turtleDoc_1],
|
289
|
-
"@base" => [:_turtleDoc_1],
|
290
|
-
"@prefix" => [:_turtleDoc_1],
|
291
309
|
:ANON => [:_turtleDoc_1],
|
310
|
+
:BASE => [:_turtleDoc_1],
|
292
311
|
:BLANK_NODE_LABEL => [:_turtleDoc_1],
|
293
312
|
:IRIREF => [:_turtleDoc_1],
|
294
313
|
:PNAME_LN => [:_turtleDoc_1],
|
295
314
|
:PNAME_NS => [:_turtleDoc_1],
|
296
|
-
:
|
297
|
-
:SPARQL_PREFIX => [:_turtleDoc_1],
|
315
|
+
:PREFIX => [:_turtleDoc_1],
|
298
316
|
"[" => [:_turtleDoc_1],
|
299
317
|
},
|
300
318
|
:_turtleDoc_1 => {
|
301
319
|
"(" => [:statement, :turtleDoc],
|
302
|
-
"@base" => [:statement, :turtleDoc],
|
303
|
-
"@prefix" => [:statement, :turtleDoc],
|
304
320
|
:ANON => [:statement, :turtleDoc],
|
321
|
+
:BASE => [:statement, :turtleDoc],
|
305
322
|
:BLANK_NODE_LABEL => [:statement, :turtleDoc],
|
306
323
|
:IRIREF => [:statement, :turtleDoc],
|
307
324
|
:PNAME_LN => [:statement, :turtleDoc],
|
308
325
|
:PNAME_NS => [:statement, :turtleDoc],
|
309
|
-
:
|
310
|
-
:SPARQL_PREFIX => [:statement, :turtleDoc],
|
326
|
+
:PREFIX => [:statement, :turtleDoc],
|
311
327
|
"[" => [:statement, :turtleDoc],
|
312
328
|
},
|
313
329
|
:verb => {
|
330
|
+
"A" => ["A"],
|
314
331
|
:IRIREF => [:predicate],
|
315
332
|
:PNAME_LN => [:predicate],
|
316
333
|
:PNAME_NS => [:predicate],
|
@@ -323,9 +340,9 @@ module RDF::Turtle::Meta
|
|
323
340
|
",",
|
324
341
|
".",
|
325
342
|
";",
|
326
|
-
"
|
327
|
-
"@prefix",
|
343
|
+
"A",
|
328
344
|
:ANON,
|
345
|
+
:BASE,
|
329
346
|
:BLANK_NODE_LABEL,
|
330
347
|
:DECIMAL,
|
331
348
|
:DOUBLE,
|
@@ -334,8 +351,7 @@ module RDF::Turtle::Meta
|
|
334
351
|
:LANGTAG,
|
335
352
|
:PNAME_LN,
|
336
353
|
:PNAME_NS,
|
337
|
-
:
|
338
|
-
:SPARQL_PREFIX,
|
354
|
+
:PREFIX,
|
339
355
|
:STRING_LITERAL_LONG_QUOTE,
|
340
356
|
:STRING_LITERAL_LONG_SINGLE_QUOTE,
|
341
357
|
:STRING_LITERAL_QUOTE,
|
@@ -385,12 +401,19 @@ module RDF::Turtle::Meta
|
|
385
401
|
:STRING_LITERAL_LONG_SINGLE_QUOTE,
|
386
402
|
:STRING_LITERAL_LONG_QUOTE],
|
387
403
|
:base => [
|
388
|
-
|
404
|
+
:BASE],
|
389
405
|
:_base_1 => [
|
406
|
+
".",
|
407
|
+
:_eps],
|
408
|
+
:_base_2 => [
|
390
409
|
:IRIREF],
|
410
|
+
:_base_3 => [
|
411
|
+
".",
|
412
|
+
:_eps],
|
391
413
|
:blankNodePropertyList => [
|
392
414
|
"["],
|
393
415
|
:_blankNodePropertyList_1 => [
|
416
|
+
"A",
|
394
417
|
"a",
|
395
418
|
:IRIREF,
|
396
419
|
:PNAME_LN,
|
@@ -473,10 +496,8 @@ module RDF::Turtle::Meta
|
|
473
496
|
:_collection_5 => [
|
474
497
|
")"],
|
475
498
|
:directive => [
|
476
|
-
|
477
|
-
|
478
|
-
:SPARQL_PREFIX,
|
479
|
-
:SPARQL_BASE],
|
499
|
+
:PREFIX,
|
500
|
+
:BASE],
|
480
501
|
:_empty => [
|
481
502
|
:_eps],
|
482
503
|
:iri => [
|
@@ -562,6 +583,7 @@ module RDF::Turtle::Meta
|
|
562
583
|
:PNAME_LN,
|
563
584
|
:PNAME_NS],
|
564
585
|
:predicateObjectList => [
|
586
|
+
"A",
|
565
587
|
"a",
|
566
588
|
:IRIREF,
|
567
589
|
:PNAME_LN,
|
@@ -575,11 +597,13 @@ module RDF::Turtle::Meta
|
|
575
597
|
";"],
|
576
598
|
:_predicateObjectList_4 => [
|
577
599
|
:_eps,
|
600
|
+
"A",
|
578
601
|
"a",
|
579
602
|
:IRIREF,
|
580
603
|
:PNAME_LN,
|
581
604
|
:PNAME_NS],
|
582
605
|
:_predicateObjectList_5 => [
|
606
|
+
"A",
|
583
607
|
"a",
|
584
608
|
:IRIREF,
|
585
609
|
:PNAME_LN,
|
@@ -606,6 +630,7 @@ module RDF::Turtle::Meta
|
|
606
630
|
";"],
|
607
631
|
:_predicateObjectList_8 => [
|
608
632
|
:_eps,
|
633
|
+
"A",
|
609
634
|
"a",
|
610
635
|
:IRIREF,
|
611
636
|
:PNAME_LN,
|
@@ -628,22 +653,20 @@ module RDF::Turtle::Meta
|
|
628
653
|
:STRING_LITERAL_LONG_SINGLE_QUOTE,
|
629
654
|
:STRING_LITERAL_LONG_QUOTE],
|
630
655
|
:prefixID => [
|
631
|
-
|
656
|
+
:PREFIX],
|
632
657
|
:_prefixID_1 => [
|
658
|
+
".",
|
659
|
+
:_eps],
|
660
|
+
:_prefixID_2 => [
|
633
661
|
:PNAME_NS],
|
634
|
-
:
|
635
|
-
:SPARQL_BASE],
|
636
|
-
:_sparqlBase_1 => [
|
662
|
+
:_prefixID_3 => [
|
637
663
|
:IRIREF],
|
638
|
-
:
|
639
|
-
|
640
|
-
|
641
|
-
:PNAME_NS],
|
664
|
+
:_prefixID_4 => [
|
665
|
+
".",
|
666
|
+
:_eps],
|
642
667
|
:statement => [
|
643
|
-
|
644
|
-
|
645
|
-
:SPARQL_PREFIX,
|
646
|
-
:SPARQL_BASE,
|
668
|
+
:PREFIX,
|
669
|
+
:BASE,
|
647
670
|
"[",
|
648
671
|
:IRIREF,
|
649
672
|
:BLANK_NODE_LABEL,
|
@@ -687,27 +710,28 @@ module RDF::Turtle::Meta
|
|
687
710
|
"["],
|
688
711
|
:_triples_3 => [
|
689
712
|
:_eps,
|
713
|
+
"A",
|
690
714
|
"a",
|
691
715
|
:IRIREF,
|
692
716
|
:PNAME_LN,
|
693
717
|
:PNAME_NS],
|
694
718
|
:_triples_4 => [
|
719
|
+
"A",
|
695
720
|
"a",
|
696
721
|
:IRIREF,
|
697
722
|
:PNAME_LN,
|
698
723
|
:PNAME_NS],
|
699
724
|
:_triples_5 => [
|
700
725
|
:_eps,
|
726
|
+
"A",
|
701
727
|
"a",
|
702
728
|
:IRIREF,
|
703
729
|
:PNAME_LN,
|
704
730
|
:PNAME_NS],
|
705
731
|
:turtleDoc => [
|
706
732
|
:_eps,
|
707
|
-
|
708
|
-
|
709
|
-
:SPARQL_PREFIX,
|
710
|
-
:SPARQL_BASE,
|
733
|
+
:PREFIX,
|
734
|
+
:BASE,
|
711
735
|
"[",
|
712
736
|
:IRIREF,
|
713
737
|
:BLANK_NODE_LABEL,
|
@@ -716,10 +740,8 @@ module RDF::Turtle::Meta
|
|
716
740
|
:PNAME_LN,
|
717
741
|
:PNAME_NS],
|
718
742
|
:_turtleDoc_1 => [
|
719
|
-
|
720
|
-
|
721
|
-
:SPARQL_PREFIX,
|
722
|
-
:SPARQL_BASE,
|
743
|
+
:PREFIX,
|
744
|
+
:BASE,
|
723
745
|
"[",
|
724
746
|
:IRIREF,
|
725
747
|
:BLANK_NODE_LABEL,
|
@@ -729,10 +751,8 @@ module RDF::Turtle::Meta
|
|
729
751
|
:PNAME_NS],
|
730
752
|
:_turtleDoc_2 => [
|
731
753
|
:_eps,
|
732
|
-
|
733
|
-
|
734
|
-
:SPARQL_PREFIX,
|
735
|
-
:SPARQL_BASE,
|
754
|
+
:PREFIX,
|
755
|
+
:BASE,
|
736
756
|
"[",
|
737
757
|
:IRIREF,
|
738
758
|
:BLANK_NODE_LABEL,
|
@@ -741,6 +761,7 @@ module RDF::Turtle::Meta
|
|
741
761
|
:PNAME_LN,
|
742
762
|
:PNAME_NS],
|
743
763
|
:verb => [
|
764
|
+
"A",
|
744
765
|
"a",
|
745
766
|
:IRIREF,
|
746
767
|
:PNAME_LN,
|
@@ -748,6 +769,7 @@ module RDF::Turtle::Meta
|
|
748
769
|
}.freeze
|
749
770
|
FOLLOW = {
|
750
771
|
:BlankNode => [
|
772
|
+
"A",
|
751
773
|
"a",
|
752
774
|
")",
|
753
775
|
",",
|
@@ -815,6 +837,7 @@ module RDF::Turtle::Meta
|
|
815
837
|
:STRING_LITERAL_LONG_SINGLE_QUOTE,
|
816
838
|
:STRING_LITERAL_LONG_QUOTE],
|
817
839
|
:PrefixedName => [
|
840
|
+
"A",
|
818
841
|
"a",
|
819
842
|
:IRIREF,
|
820
843
|
:BLANK_NODE_LABEL,
|
@@ -973,10 +996,8 @@ module RDF::Turtle::Meta
|
|
973
996
|
:STRING_LITERAL_LONG_QUOTE],
|
974
997
|
:base => [
|
975
998
|
:_eof,
|
976
|
-
|
977
|
-
|
978
|
-
:SPARQL_PREFIX,
|
979
|
-
:SPARQL_BASE,
|
999
|
+
:PREFIX,
|
1000
|
+
:BASE,
|
980
1001
|
"[",
|
981
1002
|
:IRIREF,
|
982
1003
|
:BLANK_NODE_LABEL,
|
@@ -986,10 +1007,30 @@ module RDF::Turtle::Meta
|
|
986
1007
|
:PNAME_NS],
|
987
1008
|
:_base_1 => [
|
988
1009
|
:_eof,
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
:
|
1010
|
+
:PREFIX,
|
1011
|
+
:BASE,
|
1012
|
+
"[",
|
1013
|
+
:IRIREF,
|
1014
|
+
:BLANK_NODE_LABEL,
|
1015
|
+
:ANON,
|
1016
|
+
"(",
|
1017
|
+
:PNAME_LN,
|
1018
|
+
:PNAME_NS],
|
1019
|
+
:_base_2 => [
|
1020
|
+
:_eof,
|
1021
|
+
:PREFIX,
|
1022
|
+
:BASE,
|
1023
|
+
"[",
|
1024
|
+
:IRIREF,
|
1025
|
+
:BLANK_NODE_LABEL,
|
1026
|
+
:ANON,
|
1027
|
+
"(",
|
1028
|
+
:PNAME_LN,
|
1029
|
+
:PNAME_NS],
|
1030
|
+
:_base_3 => [
|
1031
|
+
:_eof,
|
1032
|
+
:PREFIX,
|
1033
|
+
:BASE,
|
993
1034
|
"[",
|
994
1035
|
:IRIREF,
|
995
1036
|
:BLANK_NODE_LABEL,
|
@@ -999,6 +1040,7 @@ module RDF::Turtle::Meta
|
|
999
1040
|
:PNAME_NS],
|
1000
1041
|
:blankNodePropertyList => [
|
1001
1042
|
".",
|
1043
|
+
"A",
|
1002
1044
|
"a",
|
1003
1045
|
")",
|
1004
1046
|
",",
|
@@ -1022,6 +1064,7 @@ module RDF::Turtle::Meta
|
|
1022
1064
|
:STRING_LITERAL_LONG_QUOTE],
|
1023
1065
|
:_blankNodePropertyList_1 => [
|
1024
1066
|
".",
|
1067
|
+
"A",
|
1025
1068
|
"a",
|
1026
1069
|
")",
|
1027
1070
|
",",
|
@@ -1045,6 +1088,7 @@ module RDF::Turtle::Meta
|
|
1045
1088
|
:STRING_LITERAL_LONG_QUOTE],
|
1046
1089
|
:_blankNodePropertyList_2 => [
|
1047
1090
|
".",
|
1091
|
+
"A",
|
1048
1092
|
"a",
|
1049
1093
|
")",
|
1050
1094
|
",",
|
@@ -1067,6 +1111,7 @@ module RDF::Turtle::Meta
|
|
1067
1111
|
:STRING_LITERAL_LONG_SINGLE_QUOTE,
|
1068
1112
|
:STRING_LITERAL_LONG_QUOTE],
|
1069
1113
|
:collection => [
|
1114
|
+
"A",
|
1070
1115
|
"a",
|
1071
1116
|
")",
|
1072
1117
|
",",
|
@@ -1094,6 +1139,7 @@ module RDF::Turtle::Meta
|
|
1094
1139
|
:_collection_2 => [
|
1095
1140
|
")"],
|
1096
1141
|
:_collection_3 => [
|
1142
|
+
"A",
|
1097
1143
|
"a",
|
1098
1144
|
")",
|
1099
1145
|
",",
|
@@ -1119,6 +1165,7 @@ module RDF::Turtle::Meta
|
|
1119
1165
|
:_collection_4 => [
|
1120
1166
|
")"],
|
1121
1167
|
:_collection_5 => [
|
1168
|
+
"A",
|
1122
1169
|
"a",
|
1123
1170
|
")",
|
1124
1171
|
",",
|
@@ -1143,10 +1190,8 @@ module RDF::Turtle::Meta
|
|
1143
1190
|
:STRING_LITERAL_LONG_QUOTE],
|
1144
1191
|
:directive => [
|
1145
1192
|
:_eof,
|
1146
|
-
|
1147
|
-
|
1148
|
-
:SPARQL_PREFIX,
|
1149
|
-
:SPARQL_BASE,
|
1193
|
+
:PREFIX,
|
1194
|
+
:BASE,
|
1150
1195
|
"[",
|
1151
1196
|
:IRIREF,
|
1152
1197
|
:BLANK_NODE_LABEL,
|
@@ -1155,6 +1200,7 @@ module RDF::Turtle::Meta
|
|
1155
1200
|
:PNAME_LN,
|
1156
1201
|
:PNAME_NS],
|
1157
1202
|
:iri => [
|
1203
|
+
"A",
|
1158
1204
|
"a",
|
1159
1205
|
:IRIREF,
|
1160
1206
|
:BLANK_NODE_LABEL,
|
@@ -1310,10 +1356,8 @@ module RDF::Turtle::Meta
|
|
1310
1356
|
"]"],
|
1311
1357
|
:prefixID => [
|
1312
1358
|
:_eof,
|
1313
|
-
|
1314
|
-
|
1315
|
-
:SPARQL_PREFIX,
|
1316
|
-
:SPARQL_BASE,
|
1359
|
+
:PREFIX,
|
1360
|
+
:BASE,
|
1317
1361
|
"[",
|
1318
1362
|
:IRIREF,
|
1319
1363
|
:BLANK_NODE_LABEL,
|
@@ -1323,23 +1367,8 @@ module RDF::Turtle::Meta
|
|
1323
1367
|
:PNAME_NS],
|
1324
1368
|
:_prefixID_1 => [
|
1325
1369
|
:_eof,
|
1326
|
-
|
1327
|
-
|
1328
|
-
:SPARQL_PREFIX,
|
1329
|
-
:SPARQL_BASE,
|
1330
|
-
"[",
|
1331
|
-
:IRIREF,
|
1332
|
-
:BLANK_NODE_LABEL,
|
1333
|
-
:ANON,
|
1334
|
-
"(",
|
1335
|
-
:PNAME_LN,
|
1336
|
-
:PNAME_NS],
|
1337
|
-
:sparqlBase => [
|
1338
|
-
:_eof,
|
1339
|
-
"@prefix",
|
1340
|
-
"@base",
|
1341
|
-
:SPARQL_PREFIX,
|
1342
|
-
:SPARQL_BASE,
|
1370
|
+
:PREFIX,
|
1371
|
+
:BASE,
|
1343
1372
|
"[",
|
1344
1373
|
:IRIREF,
|
1345
1374
|
:BLANK_NODE_LABEL,
|
@@ -1347,12 +1376,10 @@ module RDF::Turtle::Meta
|
|
1347
1376
|
"(",
|
1348
1377
|
:PNAME_LN,
|
1349
1378
|
:PNAME_NS],
|
1350
|
-
:
|
1379
|
+
:_prefixID_2 => [
|
1351
1380
|
:_eof,
|
1352
|
-
|
1353
|
-
|
1354
|
-
:SPARQL_PREFIX,
|
1355
|
-
:SPARQL_BASE,
|
1381
|
+
:PREFIX,
|
1382
|
+
:BASE,
|
1356
1383
|
"[",
|
1357
1384
|
:IRIREF,
|
1358
1385
|
:BLANK_NODE_LABEL,
|
@@ -1360,12 +1387,10 @@ module RDF::Turtle::Meta
|
|
1360
1387
|
"(",
|
1361
1388
|
:PNAME_LN,
|
1362
1389
|
:PNAME_NS],
|
1363
|
-
:
|
1390
|
+
:_prefixID_3 => [
|
1364
1391
|
:_eof,
|
1365
|
-
|
1366
|
-
|
1367
|
-
:SPARQL_PREFIX,
|
1368
|
-
:SPARQL_BASE,
|
1392
|
+
:PREFIX,
|
1393
|
+
:BASE,
|
1369
1394
|
"[",
|
1370
1395
|
:IRIREF,
|
1371
1396
|
:BLANK_NODE_LABEL,
|
@@ -1373,12 +1398,10 @@ module RDF::Turtle::Meta
|
|
1373
1398
|
"(",
|
1374
1399
|
:PNAME_LN,
|
1375
1400
|
:PNAME_NS],
|
1376
|
-
:
|
1401
|
+
:_prefixID_4 => [
|
1377
1402
|
:_eof,
|
1378
|
-
|
1379
|
-
|
1380
|
-
:SPARQL_PREFIX,
|
1381
|
-
:SPARQL_BASE,
|
1403
|
+
:PREFIX,
|
1404
|
+
:BASE,
|
1382
1405
|
"[",
|
1383
1406
|
:IRIREF,
|
1384
1407
|
:BLANK_NODE_LABEL,
|
@@ -1388,10 +1411,8 @@ module RDF::Turtle::Meta
|
|
1388
1411
|
:PNAME_NS],
|
1389
1412
|
:statement => [
|
1390
1413
|
:_eof,
|
1391
|
-
|
1392
|
-
|
1393
|
-
:SPARQL_PREFIX,
|
1394
|
-
:SPARQL_BASE,
|
1414
|
+
:PREFIX,
|
1415
|
+
:BASE,
|
1395
1416
|
"[",
|
1396
1417
|
:IRIREF,
|
1397
1418
|
:BLANK_NODE_LABEL,
|
@@ -1401,10 +1422,8 @@ module RDF::Turtle::Meta
|
|
1401
1422
|
:PNAME_NS],
|
1402
1423
|
:_statement_1 => [
|
1403
1424
|
:_eof,
|
1404
|
-
|
1405
|
-
|
1406
|
-
:SPARQL_PREFIX,
|
1407
|
-
:SPARQL_BASE,
|
1425
|
+
:PREFIX,
|
1426
|
+
:BASE,
|
1408
1427
|
"[",
|
1409
1428
|
:IRIREF,
|
1410
1429
|
:BLANK_NODE_LABEL,
|
@@ -1414,10 +1433,8 @@ module RDF::Turtle::Meta
|
|
1414
1433
|
:PNAME_NS],
|
1415
1434
|
:_statement_2 => [
|
1416
1435
|
:_eof,
|
1417
|
-
|
1418
|
-
|
1419
|
-
:SPARQL_PREFIX,
|
1420
|
-
:SPARQL_BASE,
|
1436
|
+
:PREFIX,
|
1437
|
+
:BASE,
|
1421
1438
|
"[",
|
1422
1439
|
:IRIREF,
|
1423
1440
|
:BLANK_NODE_LABEL,
|
@@ -1426,6 +1443,7 @@ module RDF::Turtle::Meta
|
|
1426
1443
|
:PNAME_LN,
|
1427
1444
|
:PNAME_NS],
|
1428
1445
|
:subject => [
|
1446
|
+
"A",
|
1429
1447
|
"a",
|
1430
1448
|
:IRIREF,
|
1431
1449
|
:PNAME_LN,
|
data/lib/rdf/turtle/reader.rb
CHANGED
@@ -67,26 +67,26 @@ module RDF::Turtle
|
|
67
67
|
end
|
68
68
|
|
69
69
|
# String terminals
|
70
|
-
terminal(nil, %r([\(\),.;\[\]
|
70
|
+
terminal(nil, %r([\(\),.;\[\]Aa]|\^\^|true|false)) do |prod, token, input|
|
71
71
|
case token.value
|
72
|
-
when 'a'
|
72
|
+
when 'A', 'a' then input[:resource] = RDF.type
|
73
73
|
when 'true', 'false' then input[:resource] = RDF::Literal::Boolean.new(token.value)
|
74
74
|
when '@base', '@prefix' then input[:lang] = token.value[1..-1]
|
75
75
|
else input[:string] = token.value
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
terminal(:
|
80
|
-
input[:lang] = token.value[1..-1]
|
81
|
-
end
|
82
|
-
|
83
|
-
terminal(:SPARQL_PREFIX, SPARQL_PREFIX) do |prod, token, input|
|
79
|
+
terminal(:PREFIX, PREFIX) do |prod, token, input|
|
84
80
|
input[:string_value] = token.value.downcase
|
85
81
|
end
|
86
|
-
terminal(:
|
82
|
+
terminal(:BASE, BASE) do |prod, token, input|
|
87
83
|
input[:string_value] = token.value.downcase
|
88
84
|
end
|
89
85
|
|
86
|
+
terminal(:LANGTAG, LANGTAG) do |prod, token, input|
|
87
|
+
input[:lang] = token.value[1..-1]
|
88
|
+
end
|
89
|
+
|
90
90
|
# Productions
|
91
91
|
# [4] prefixID defines a prefix mapping
|
92
92
|
production(:prefixID) do |input, current, callback|
|
@@ -103,21 +103,6 @@ module RDF::Turtle
|
|
103
103
|
options[:base_uri] = iri
|
104
104
|
end
|
105
105
|
|
106
|
-
# [28s] sparqlPrefix ::= [Pp][Rr][Ee][Ff][Ii][Xx] PNAME_NS IRIREF
|
107
|
-
production(:sparqlPrefix) do |input, current, callback|
|
108
|
-
prefix = current[:prefix]
|
109
|
-
iri = current[:resource]
|
110
|
-
debug("sparqlPrefix") {"Defined prefix #{prefix.inspect} mapping to #{iri.inspect}"}
|
111
|
-
prefix(prefix, iri)
|
112
|
-
end
|
113
|
-
|
114
|
-
# [29s] sparqlBase ::= [Bb][Aa][Ss][Ee] IRIREF
|
115
|
-
production(:sparqlBase) do |input, current, callback|
|
116
|
-
iri = current[:resource]
|
117
|
-
debug("base") {"Defined base as #{iri}"}
|
118
|
-
options[:base_uri] = iri
|
119
|
-
end
|
120
|
-
|
121
106
|
# [6] triples
|
122
107
|
start_production(:triples) do |input, current, callback|
|
123
108
|
# Note production as triples for blankNodePropertyList
|
@@ -176,20 +161,15 @@ module RDF::Turtle
|
|
176
161
|
|
177
162
|
production(:collection) do |input, current, callback|
|
178
163
|
# Create an RDF list
|
179
|
-
bnode = self.bnode
|
180
164
|
objects = current[:object_list]
|
181
|
-
list = RDF::List
|
165
|
+
list = RDF::List[*objects]
|
182
166
|
list.each_statement do |statement|
|
183
|
-
# Spec Confusion, referenced section "Collection" is missing from the spec.
|
184
|
-
# Anicdodal evidence indicates that some expect each node to be of type rdf:list,
|
185
|
-
# but existing Notation3 and Turtle tests (http://www.w3.org/2001/sw/DataAccess/df1/tests/manifest.ttl) do not.
|
186
167
|
next if statement.predicate == RDF.type && statement.object == RDF.List
|
187
168
|
callback.call(:statement, "collection", statement.subject, statement.predicate, statement.object)
|
188
169
|
end
|
189
|
-
bnode = RDF.nil if list.empty?
|
190
170
|
|
191
171
|
# Return bnode as resource
|
192
|
-
input[:resource] =
|
172
|
+
input[:resource] = list.subject
|
193
173
|
end
|
194
174
|
|
195
175
|
# [16] RDFLiteral ::= String ( LanguageTag | ( "^^" IRIref ) )?
|
data/lib/rdf/turtle/terminals.rb
CHANGED
@@ -56,22 +56,22 @@ module RDF::Turtle
|
|
56
56
|
# 21
|
57
57
|
DOUBLE = /[+-]?(?:[0-9]+\.[0-9]*#{EXPONENT}|\.?[0-9]+#{EXPONENT})/.freeze
|
58
58
|
# 22
|
59
|
-
|
59
|
+
STRING_LITERAL_SINGLE_QUOTE = /'(?:[^\'\\\n\r]|#{ECHAR}|#{UCHAR})*'/.freeze
|
60
60
|
# 23
|
61
|
-
|
61
|
+
STRING_LITERAL_QUOTE = /"(?:[^\"\\\n\r]|#{ECHAR}|#{UCHAR})*"/.freeze.freeze
|
62
62
|
# 24
|
63
63
|
STRING_LITERAL_LONG_SINGLE_QUOTE = /'''(?:(?:'|'')?(?:[^'\\]|#{ECHAR}|#{UCHAR}))*'''/m.freeze
|
64
64
|
# 25
|
65
|
-
STRING_LITERAL_LONG_QUOTE
|
65
|
+
STRING_LITERAL_LONG_QUOTE = /"""(?:(?:"|"")?(?:[^"\\]|#{ECHAR}|#{UCHAR}))*"""/m.freeze
|
66
66
|
|
67
67
|
# 161s
|
68
68
|
WS = / |\t|\r|\n /.freeze
|
69
69
|
# 162s
|
70
70
|
ANON = /\[#{WS}*\]/m.freeze
|
71
71
|
# 28t
|
72
|
-
|
72
|
+
PREFIX = /@?prefix/i.freeze
|
73
73
|
# 29t
|
74
|
-
|
74
|
+
BASE = /@?base/i.freeze
|
75
75
|
|
76
76
|
end
|
77
77
|
end
|
metadata
CHANGED
@@ -1,160 +1,160 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-turtle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.0p1
|
5
5
|
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Gregg Kellogg
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|
16
|
-
|
17
|
-
none: false
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
|
-
- -
|
18
|
+
- - '>='
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: '1.1'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
21
|
none: false
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.1'
|
27
|
+
none: false
|
28
|
+
prerelease: false
|
29
|
+
type: :runtime
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: ebnf
|
32
|
-
|
33
|
-
none: false
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
34
33
|
requirements:
|
35
|
-
- -
|
34
|
+
- - '>='
|
36
35
|
- !ruby/object:Gem::Version
|
37
36
|
version: 0.3.0
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
37
|
none: false
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
42
39
|
requirements:
|
43
|
-
- -
|
40
|
+
- - '>='
|
44
41
|
- !ruby/object:Gem::Version
|
45
42
|
version: 0.3.0
|
43
|
+
none: false
|
44
|
+
prerelease: false
|
45
|
+
type: :runtime
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: open-uri-cached
|
48
|
-
|
49
|
-
none: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
49
|
requirements:
|
51
|
-
- -
|
50
|
+
- - '>='
|
52
51
|
- !ruby/object:Gem::Version
|
53
52
|
version: 0.0.5
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
53
|
none: false
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
58
55
|
requirements:
|
59
|
-
- -
|
56
|
+
- - '>='
|
60
57
|
- !ruby/object:Gem::Version
|
61
58
|
version: 0.0.5
|
59
|
+
none: false
|
60
|
+
prerelease: false
|
61
|
+
type: :development
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rspec
|
64
|
-
|
65
|
-
none: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
65
|
requirements:
|
67
|
-
- -
|
66
|
+
- - '>='
|
68
67
|
- !ruby/object:Gem::Version
|
69
68
|
version: 2.12.0
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
69
|
none: false
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
74
71
|
requirements:
|
75
|
-
- -
|
72
|
+
- - '>='
|
76
73
|
- !ruby/object:Gem::Version
|
77
74
|
version: 2.12.0
|
75
|
+
none: false
|
76
|
+
prerelease: false
|
77
|
+
type: :development
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: rdf-isomorphic
|
80
|
-
|
81
|
-
none: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
81
|
requirements:
|
83
|
-
- -
|
82
|
+
- - '>='
|
84
83
|
- !ruby/object:Gem::Version
|
85
84
|
version: '0'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
85
|
none: false
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
90
87
|
requirements:
|
91
|
-
- -
|
88
|
+
- - '>='
|
92
89
|
- !ruby/object:Gem::Version
|
93
90
|
version: '0'
|
91
|
+
none: false
|
92
|
+
prerelease: false
|
93
|
+
type: :development
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: json-ld
|
96
|
-
|
97
|
-
none: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
98
97
|
requirements:
|
99
|
-
- -
|
98
|
+
- - '>='
|
100
99
|
- !ruby/object:Gem::Version
|
101
100
|
version: '0'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
101
|
none: false
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
106
103
|
requirements:
|
107
|
-
- -
|
104
|
+
- - '>='
|
108
105
|
- !ruby/object:Gem::Version
|
109
106
|
version: '0'
|
107
|
+
none: false
|
108
|
+
prerelease: false
|
109
|
+
type: :development
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: yard
|
112
|
-
|
113
|
-
none: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
113
|
requirements:
|
115
|
-
- -
|
114
|
+
- - '>='
|
116
115
|
- !ruby/object:Gem::Version
|
117
116
|
version: 0.8.3
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
117
|
none: false
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
122
119
|
requirements:
|
123
|
-
- -
|
120
|
+
- - '>='
|
124
121
|
- !ruby/object:Gem::Version
|
125
122
|
version: 0.8.3
|
123
|
+
none: false
|
124
|
+
prerelease: false
|
125
|
+
type: :development
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: rdf-spec
|
128
|
-
|
129
|
-
none: false
|
128
|
+
version_requirements: !ruby/object:Gem::Requirement
|
130
129
|
requirements:
|
131
|
-
- -
|
130
|
+
- - '>='
|
132
131
|
- !ruby/object:Gem::Version
|
133
132
|
version: '1.1'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
133
|
none: false
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
138
135
|
requirements:
|
139
|
-
- -
|
136
|
+
- - '>='
|
140
137
|
- !ruby/object:Gem::Version
|
141
138
|
version: '1.1'
|
139
|
+
none: false
|
140
|
+
prerelease: false
|
141
|
+
type: :development
|
142
142
|
- !ruby/object:Gem::Dependency
|
143
143
|
name: rake
|
144
|
-
|
145
|
-
none: false
|
144
|
+
version_requirements: !ruby/object:Gem::Requirement
|
146
145
|
requirements:
|
147
|
-
- -
|
146
|
+
- - '>='
|
148
147
|
- !ruby/object:Gem::Version
|
149
148
|
version: '0'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
149
|
none: false
|
150
|
+
requirement: !ruby/object:Gem::Requirement
|
154
151
|
requirements:
|
155
|
-
- -
|
152
|
+
- - '>='
|
156
153
|
- !ruby/object:Gem::Version
|
157
154
|
version: '0'
|
155
|
+
none: false
|
156
|
+
prerelease: false
|
157
|
+
type: :development
|
158
158
|
description: RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.
|
159
159
|
email: public-rdf-ruby@w3.org
|
160
160
|
executables: []
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- History
|
167
167
|
- UNLICENSE
|
168
168
|
- VERSION
|
169
|
+
- lib/rdf/turtle.rb
|
169
170
|
- lib/rdf/turtle/format.rb
|
170
171
|
- lib/rdf/turtle/freebase_reader.rb
|
171
172
|
- lib/rdf/turtle/meta.rb
|
@@ -173,30 +174,29 @@ files:
|
|
173
174
|
- lib/rdf/turtle/terminals.rb
|
174
175
|
- lib/rdf/turtle/version.rb
|
175
176
|
- lib/rdf/turtle/writer.rb
|
176
|
-
- lib/rdf/turtle.rb
|
177
177
|
homepage: http://ruby-rdf.github.com/rdf-turtle
|
178
178
|
licenses:
|
179
179
|
- Public Domain
|
180
|
-
post_install_message:
|
180
|
+
post_install_message:
|
181
181
|
rdoc_options: []
|
182
182
|
require_paths:
|
183
183
|
- lib
|
184
184
|
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
185
|
requirements:
|
187
|
-
- -
|
186
|
+
- - '>='
|
188
187
|
- !ruby/object:Gem::Version
|
189
188
|
version: 1.9.2
|
190
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
189
|
none: false
|
190
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
191
|
requirements:
|
193
|
-
- -
|
192
|
+
- - '>'
|
194
193
|
- !ruby/object:Gem::Version
|
195
194
|
version: 1.3.1
|
195
|
+
none: false
|
196
196
|
requirements: []
|
197
197
|
rubyforge_project: rdf-turtle
|
198
|
-
rubygems_version: 1.8.
|
199
|
-
signing_key:
|
198
|
+
rubygems_version: 1.8.24
|
199
|
+
signing_key:
|
200
200
|
specification_version: 3
|
201
201
|
summary: Turtle reader/writer for Ruby.
|
202
202
|
test_files: []
|