-
Notifications
You must be signed in to change notification settings - Fork 21
/
rdfxml_test.go
3915 lines (3510 loc) · 127 KB
/
rdfxml_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package rdf
import (
"bytes"
"io"
"strings"
"testing"
)
func BenchmarkDecodeRDFXML(b *testing.B) {
input := `<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xml:base="http://www.gutenberg.org/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:pgterms="http://www.gutenberg.org/2009/pgterms/"
xmlns:dcam="http://purl.org/dc/dcam/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<pgterms:ebook rdf:about="ebooks/1401">
<dcterms:license rdf:resource="license"/>
<dcterms:publisher>Project Gutenberg</dcterms:publisher>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/1401.epub.noimages">
<dcterms:isFormatOf rdf:resource="ebooks/1401"/>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">245821</dcterms:extent>
<dcterms:format>
<rdf:Description rdf:nodeID="Nb46390c65b94400cb3c45afb7036fb76">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/epub+zip</rdf:value>
</rdf:Description>
</dcterms:format>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-30T09:25:34.452918</dcterms:modified>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/files/1401/1401-h/1401-h.htm">
<dcterms:isFormatOf rdf:resource="ebooks/1401"/>
<dcterms:format>
<rdf:Description rdf:nodeID="Nf1374551f7d7427eb919455f56f9ebf3">
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/html; charset=iso-8859-1</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
</rdf:Description>
</dcterms:format>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-29T09:31:34</dcterms:modified>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">661872</dcterms:extent>
</pgterms:file>
</dcterms:hasFormat>
<pgterms:downloads rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">183</pgterms:downloads>
<dcterms:subject>
<rdf:Description rdf:nodeID="Nb52def5a42284aeb89f3b9353b37f44b">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/LCSH"/>
<rdf:value>Tarzan (Fictitious character) -- Fiction</rdf:value>
</rdf:Description>
</dcterms:subject>
<dcterms:type>
<rdf:Description rdf:nodeID="Nb9fcaa2b8fdf431fb0bc5a2c369e4680">
<rdf:value>Text</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/DCMIType"/>
</rdf:Description>
</dcterms:type>
<dcterms:subject>
<rdf:Description rdf:nodeID="Nb307a550edb3499ba2eb148af1f11280">
<rdf:value>Fantasy fiction</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/LCSH"/>
</rdf:Description>
</dcterms:subject>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/1401.plucker">
<dcterms:isFormatOf rdf:resource="ebooks/1401"/>
<dcterms:format>
<rdf:Description rdf:nodeID="N001c92dd22ee4517a16e0cf46137df26">
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/prs.plucker</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
</rdf:Description>
</dcterms:format>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-30T09:25:42.164430</dcterms:modified>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">361242</dcterms:extent>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/files/1401/1401.txt">
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-29T09:31:40</dcterms:modified>
<dcterms:isFormatOf rdf:resource="ebooks/1401"/>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">636082</dcterms:extent>
<dcterms:format>
<rdf:Description rdf:nodeID="N278115d13cca4a2ca64950e9c20fdf48">
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/plain; charset=us-ascii</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/1401.qioo">
<dcterms:isFormatOf rdf:resource="ebooks/1401"/>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-30T09:25:33.573357</dcterms:modified>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">294903</dcterms:extent>
<dcterms:format>
<rdf:Description rdf:nodeID="Nb6f86e1bda1c4c6b9d04b1b736240fa7">
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/x-qioo-ebook</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:subject>
<rdf:Description rdf:nodeID="N62d27de7b67d4bb2a7deaaf573728d88">
<rdf:value>Adventure stories</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/LCSH"/>
</rdf:Description>
</dcterms:subject>
<dcterms:title>Tarzan the Untamed</dcterms:title>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/files/1401/1401.zip">
<dcterms:format>
<rdf:Description rdf:nodeID="N376fc5f5c83442fdbb282837c5a6f548">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/zip</rdf:value>
</rdf:Description>
</dcterms:format>
<dcterms:isFormatOf rdf:resource="ebooks/1401"/>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">232967</dcterms:extent>
<dcterms:format>
<rdf:Description rdf:nodeID="N56bb3cef5fce45aabf0dfd6ea08e6bd2">
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/plain; charset=us-ascii</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
</rdf:Description>
</dcterms:format>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-29T09:32:04</dcterms:modified>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:creator>
<pgterms:agent rdf:about="2009/agents/48">
<pgterms:name>Burroughs, Edgar Rice</pgterms:name>
<pgterms:birthdate rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1875</pgterms:birthdate>
<pgterms:deathdate rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1950</pgterms:deathdate>
<pgterms:webpage rdf:resource="http://en.wikipedia.org/wiki/Edgar_Rice_Burroughs"/>
</pgterms:agent>
</dcterms:creator>
<dcterms:subject>
<rdf:Description rdf:nodeID="N50cc1255b7ef484cbe22f3d63a00fdaf">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/LCC"/>
<rdf:value>PS</rdf:value>
</rdf:Description>
</dcterms:subject>
<dcterms:language>
<rdf:Description rdf:nodeID="N891b552e92d24ac5b201c7354e5cc5c8">
<rdf:value rdf:datatype="http://purl.org/dc/terms/RFC4646">en</rdf:value>
</rdf:Description>
</dcterms:language>
<dcterms:rights>Public domain in the USA.</dcterms:rights>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/1401.txt.utf-8">
<dcterms:isFormatOf rdf:resource="ebooks/1401"/>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">636054</dcterms:extent>
<dcterms:format>
<rdf:Description rdf:nodeID="Nbd9fc4e881e24448b5595cf9069a3d1e">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/plain</rdf:value>
</rdf:Description>
</dcterms:format>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-30T09:25:32.973525</dcterms:modified>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/1401.kindle.noimages">
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-30T09:25:38.741381</dcterms:modified>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1014124</dcterms:extent>
<dcterms:isFormatOf rdf:resource="ebooks/1401"/>
<dcterms:format>
<rdf:Description rdf:nodeID="N44904e6d853f43b9926ddc60463d45ad">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/x-mobipocket-ebook</rdf:value>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/files/1401/1401-h.zip">
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-29T09:32:04</dcterms:modified>
<dcterms:format>
<rdf:Description rdf:nodeID="N3339d80d716845ebb8a1ed3c977f22da">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/html; charset=iso-8859-1</rdf:value>
</rdf:Description>
</dcterms:format>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">235966</dcterms:extent>
<dcterms:isFormatOf rdf:resource="ebooks/1401"/>
<dcterms:format>
<rdf:Description rdf:nodeID="Ncc2c14b838514a1ca95b06778018e522">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/zip</rdf:value>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">1998-07-01</dcterms:issued>
</pgterms:ebook>
<cc:Work rdf:about="">
<cc:license rdf:resource="http://www.gnu.org/licenses/gpl.html"/>
</cc:Work>
<rdf:Description rdf:about="http://en.wikipedia.org/wiki/Edgar_Rice_Burroughs">
<dcterms:description>Wikipedia</dcterms:description>
</rdf:Description>
</rdf:RDF>`
b.ResetTimer()
for n := 0; n < b.N; n++ {
dec := NewTripleDecoder(bytes.NewBufferString(input), RDFXML)
for _, err := dec.Decode(); err != io.EOF; _, err = dec.Decode() {
if err != nil {
b.Fatal(err)
}
}
}
b.SetBytes(int64(len(input)))
}
func TestRDFXMLExamples(t *testing.T) {
for i, test := range rdfxmlExamples {
dec := NewTripleDecoder(bytes.NewBufferString(test.rdfxml), RDFXML)
dec.SetOption(Base, IRI{str: "http://www.w3.org/2013/RDFXMLTests/" + test.file})
ts, err := dec.DecodeAll()
if err != nil {
t.Fatalf("[%d] parseRDFXML(%s).Serialize(NTriples) => %v, want %q", i, test.rdfxml, err, test.nt)
continue
}
var b bytes.Buffer
enc := NewTripleEncoder(&b, NTriples)
err = enc.EncodeAll(ts)
enc.Close()
if err != nil {
t.Fatalf("[%d] parseRDFXML(%s).Serialize(NTriples) => %v, want %q", i, test.rdfxml, err, test.nt)
}
if b.String() != test.nt {
t.Fatalf("[%d] parseRDFXML(%s).Serialize(NTriples) => %v, want %v", i, test.rdfxml, b.String(), test.nt)
}
}
}
func TestRDFXML(t *testing.T) {
for i, test := range rdfxmlTestSuite {
dec := NewTripleDecoder(bytes.NewBufferString(test.rdfxml), RDFXML)
dec.SetOption(Base, IRI{str: "http://www.w3.org/2013/RDFXMLTests/" + test.file})
ts, err := dec.DecodeAll()
if test.err == "TODO" {
continue
}
if test.err != "" && err == nil {
t.Fatalf("[%d] parseRDFXML(%s).Serialize(NTriples) => <no error>, want %q", i, test.rdfxml, test.err)
continue
}
if test.err != "" && err != nil {
if !strings.HasSuffix(err.Error(), test.err) {
t.Fatalf("[%d] parseRDFXML(%s).Serialize(NTriples) => %s, want %q", i, test.rdfxml, err, test.err)
}
continue
}
if test.err == "" && err != nil {
t.Fatalf("[%d] parseRDFXML(%s).Serialize(NTriples) => %v, want %q", i, test.rdfxml, err, test.nt)
continue
}
var b bytes.Buffer
enc := NewTripleEncoder(&b, NTriples)
err = enc.EncodeAll(ts)
enc.Close()
if err != nil {
t.Fatalf("[%d] parseRDFXML(%s).Serialize(NTriples) => %v, want %q", i, test.rdfxml, err, test.nt)
}
if b.String() != test.nt {
t.Fatalf("[%d] parseRDFXML(%s).Serialize(NTriples) => %v, want %v", i, test.rdfxml, b.String(), test.nt)
}
}
}
var rdfxmlExamples = []struct {
file string
rdfxml string
nt string
}{
{
// [0]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example07.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"
dc:title="RDF/XML Syntax Specification (Revised)">
<ex:editor>
<rdf:Description ex:fullName="Dave Beckett">
<ex:homePage rdf:resource="http://purl.org/net/dajobe/" />
</rdf:Description>
</ex:editor>
</rdf:Description>
</rdf:RDF>
`,
`<http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> "RDF/XML Syntax Specification (Revised)" .
<http://www.w3.org/TR/rdf-syntax-grammar> <http://example.org/stuff/1.0/editor> _:b0 .
_:b0 <http://example.org/stuff/1.0/fullName> "Dave Beckett" .
_:b0 <http://example.org/stuff/1.0/homePage> <http://purl.org/net/dajobe/> .
`,
},
{
// [1]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example08.rdf",
`<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar">
<dc:title>RDF/XML Syntax Specification (Revised)</dc:title>
<dc:title xml:lang="en">RDF/XML Syntax Specification (Revised)</dc:title>
<dc:title xml:lang="en-US">RDF/XML Syntax Specification (Revised)</dc:title>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/buecher/baum" xml:lang="de">
<dc:title>Der Baum</dc:title>
<dc:description>Das Buch ist außergewöhnlich</dc:description>
<dc:title xml:lang="en">The Tree</dc:title>
</rdf:Description>
</rdf:RDF>
`,
`<http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> "RDF/XML Syntax Specification (Revised)" .
<http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> "RDF/XML Syntax Specification (Revised)"@en .
<http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> "RDF/XML Syntax Specification (Revised)"@en-US .
<http://example.org/buecher/baum> <http://purl.org/dc/elements/1.1/title> "Der Baum"@de .
<http://example.org/buecher/baum> <http://purl.org/dc/elements/1.1/description> "Das Buch ist außergewöhnlich"@de .
<http://example.org/buecher/baum> <http://purl.org/dc/elements/1.1/title> "The Tree"@en .
`,
},
{
// [2]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example09.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://example.org/item01">
<ex:prop rdf:parseType="Literal"
xmlns:a="http://example.org/a#"><a:Box required="true">
<a:widget size="10" />
<a:grommit id="23" /></a:Box>
</ex:prop>
</rdf:Description>
</rdf:RDF>
`,
`<http://example.org/item01> <http://example.org/stuff/1.0/prop> "<a:Box xmlns:a=\"http://example.org/a#\" required=\"true\">\n <a:widget size=\"10\"></a:widget>\n <a:grommit id=\"23\"></a:grommit></a:Box>\n "^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
`,
},
{
// [3]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example10.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://example.org/item01">
<ex:size rdf:datatype="http://www.w3.org/2001/XMLSchema#int">123</ex:size>
</rdf:Description>
</rdf:RDF>
`,
`<http://example.org/item01> <http://example.org/stuff/1.0/size> "123"^^<http://www.w3.org/2001/XMLSchema#int> .
`,
},
{
// [4]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example11.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"
dc:title="RDF/XML Syntax Specification (Revised)">
<ex:editor rdf:nodeID="abc"/>
</rdf:Description>
<rdf:Description rdf:nodeID="abc"
ex:fullName="Dave Beckett">
<ex:homePage rdf:resource="http://purl.org/net/dajobe/"/>
</rdf:Description>
</rdf:RDF>
`,
`<http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> "RDF/XML Syntax Specification (Revised)" .
<http://www.w3.org/TR/rdf-syntax-grammar> <http://example.org/stuff/1.0/editor> _:abc .
_:abc <http://example.org/stuff/1.0/fullName> "Dave Beckett" .
_:abc <http://example.org/stuff/1.0/homePage> <http://purl.org/net/dajobe/> .
`,
},
{
// [5]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example12.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"
dc:title="RDF/XML Syntax Specification (Revised)">
<ex:editor rdf:parseType="Resource">
<ex:fullName>Dave Beckett</ex:fullName>
<ex:homePage rdf:resource="http://purl.org/net/dajobe/"/>
</ex:editor>
</rdf:Description>
</rdf:RDF>
`,
`<http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> "RDF/XML Syntax Specification (Revised)" .
<http://www.w3.org/TR/rdf-syntax-grammar> <http://example.org/stuff/1.0/editor> _:b0 .
_:b0 <http://example.org/stuff/1.0/fullName> "Dave Beckett" .
_:b0 <http://example.org/stuff/1.0/homePage> <http://purl.org/net/dajobe/> .
`,
},
{
// [6]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example13.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"
dc:title="RDF/XML Syntax Specification (Revised)">
<ex:editor ex:fullName="Dave Beckett" />
<!-- Note the ex:homePage property has been ignored for this example -->
</rdf:Description>
</rdf:RDF>
`,
`<http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> "RDF/XML Syntax Specification (Revised)" .
<http://www.w3.org/TR/rdf-syntax-grammar> <http://example.org/stuff/1.0/editor> _:b0 .
_:b0 <http://example.org/stuff/1.0/fullName> "Dave Beckett" .
`,
},
{
// [7]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example14.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://example.org/thing">
<rdf:type rdf:resource="http://example.org/stuff/1.0/Document"/>
<dc:title>A marvelous thing</dc:title>
</rdf:Description>
</rdf:RDF>
`,
`<http://example.org/thing> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/stuff/1.0/Document> .
<http://example.org/thing> <http://purl.org/dc/elements/1.1/title> "A marvelous thing" .
`,
},
{
// [8]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example15.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ex="http://example.org/stuff/1.0/">
<ex:Document rdf:about="http://example.org/thing">
<dc:title>A marvelous thing</dc:title>
</ex:Document>
</rdf:RDF>
`,
`<http://example.org/thing> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/stuff/1.0/Document> .
<http://example.org/thing> <http://purl.org/dc/elements/1.1/title> "A marvelous thing" .
`,
},
{
// [9]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example16.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.org/stuff/1.0/"
xml:base="http://example.org/here/">
<rdf:Description rdf:ID="snack">
<ex:prop rdf:resource="fruit/apple"/>
</rdf:Description>
</rdf:RDF>`,
`<http://example.org/here/#snack> <http://example.org/stuff/1.0/prop> <http://example.org/here/fruit/apple> .
`,
},
{
// [10]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example17.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Seq rdf:about="http://example.org/favourite-fruit">
<rdf:_1 rdf:resource="http://example.org/banana"/>
<rdf:_2 rdf:resource="http://example.org/apple"/>
<rdf:_3 rdf:resource="http://example.org/pear"/>
</rdf:Seq>
</rdf:RDF>`,
`<http://example.org/favourite-fruit> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq> .
<http://example.org/favourite-fruit> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> <http://example.org/banana> .
<http://example.org/favourite-fruit> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> <http://example.org/apple> .
<http://example.org/favourite-fruit> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_3> <http://example.org/pear> .
`,
},
{
// [11]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example18.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Seq rdf:about="http://example.org/favourite-fruit">
<rdf:li rdf:resource="http://example.org/banana"/>
<rdf:li rdf:resource="http://example.org/apple"/>
<rdf:li rdf:resource="http://example.org/pear"/>
</rdf:Seq>
</rdf:RDF>`,
`<http://example.org/favourite-fruit> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq> .
<http://example.org/favourite-fruit> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> <http://example.org/banana> .
<http://example.org/favourite-fruit> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> <http://example.org/apple> .
<http://example.org/favourite-fruit> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_3> <http://example.org/pear> .
`,
},
{
// [12]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example19.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://example.org/basket">
<ex:hasFruit rdf:parseType="Collection">
<rdf:Description rdf:about="http://example.org/banana"/>
<rdf:Description rdf:about="http://example.org/apple"/>
<rdf:Description rdf:about="http://example.org/pear"/>
</ex:hasFruit>
</rdf:Description>
</rdf:RDF>`,
`<http://example.org/basket> <http://example.org/stuff/1.0/hasFruit> _:b0 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/banana> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/apple> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/pear> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
`,
},
{
// [13]
"http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/example20.rdf",
`<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.org/stuff/1.0/"
xml:base="http://example.org/triples/">
<rdf:Description rdf:about="http://example.org/">
<ex:prop rdf:ID="triple1">blah</ex:prop>
</rdf:Description>
</rdf:RDF>
`,
`<http://example.org/> <http://example.org/stuff/1.0/prop> "blah" .
<http://example.org/triples/#triple1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> .
<http://example.org/triples/#triple1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://example.org/> .
<http://example.org/triples/#triple1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://example.org/stuff/1.0/prop> .
<http://example.org/triples/#triple1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> "blah" .
`,
},
}
var rdfxmlTestSuite = []struct {
file string
rdfxml string
nt string
err string
}{
{
// [0] #amp-in-url-test001
//
// Description: the purpose of this test case is to show how one
// of XML's Predefined Entities - in this case the ampersand - is
// represented when it is used in the value of an rdf:about
// attribute. The ampersand is represented by its numeric
// character reference as specified in:
// http://www.w3.org/TR/REC-xml#sec-predefined-ent In the
// associated N-Triples file, the ampersand will be represented
// with a single ampersand character (and not the ampersand's
// numeric character reference). Note: when a XML/HTML browser is
// used to display this file, a single ampersand character may be
// displayed and not the ampersand's numeric character reference.
// In this case, the browser may provide an alternate way to view
// the file (such as viewing the file's source or saving to a
// file).
//
"amp-in-url/test001.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://example/q?abc=1&def=2">
<rdf:value>xxx</rdf:value>
</rdf:Description>
</rdf:RDF>`,
`<http://example/q?abc=1&def=2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "xxx" .
`,
"",
},
{
// [1] #datatypes-test001
//
// A simple datatype production; a language+datatype production.
//
"datatypes/test001.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/">
<rdf:Description rdf:about="http://example.org/foo">
<eg:bar rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">10</eg:bar>
<eg:baz rdf:datatype="http://www.w3.org/2001/XMLSchema#integer" xml:lang="fr">10</eg:baz>
</rdf:Description>
</rdf:RDF>`,
`<http://example.org/foo> <http://example.org/bar> "10"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.org/foo> <http://example.org/baz> "10"^^<http://www.w3.org/2001/XMLSchema#integer> .
`,
"",
},
{
// [2] #datatypes-test002
//
// A parser is not required to know about well-formed datatyped
// literals.
//
"datatypes/test002.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/">
<rdf:Description rdf:about="http://example.org/foo">
<eg:bar rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">flargh</eg:bar>
</rdf:Description>
</rdf:RDF>`,
`<http://example.org/foo> <http://example.org/bar> "flargh"^^<http://www.w3.org/2001/XMLSchema#integer> .
`,
"",
},
{
// [3] #rdf-charmod-literals-test001
//
// Does the treatment of literals conform to charmod ? Test for
// success of legal Normal Form C literal
//
"rdf-charmod-literals/test001.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/">
<!-- Dürst registers himself as a creator of the Charmod WD. -->
<rdf:Description rdf:about="http://www.w3.org/TR/2002/WD-charmod-20020220">
<!-- The ü below is a single character #xFC in NFC
(encoded as two UTF-8 octets #xC3 #xBC) -->
<eg:Creator eg:named="Dürst"/>
</rdf:Description>
</rdf:RDF>`,
`<http://www.w3.org/TR/2002/WD-charmod-20020220> <http://example.org/Creator> _:b0 .
_:b0 <http://example.org/named> "Dürst" .
`,
"",
},
{
// [4] #rdf-charmod-uris-test001
//
// A uriref is allowed to match non-US ASCII forms conforming to
// Unicode Normal Form C. No escaping algorithm is applied.
//
"rdf-charmod-uris/test001.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/#">
<!-- The é below is a single Unicode character #xE9 in
Unicode Normal Form C, NFC (here encoded as
two UTF-8 octets #C3,#A9) -->
<rdf:Description rdf:about="http://example.org/#André">
<eg:owes>2000</eg:owes>
</rdf:Description>
</rdf:RDF>`,
`<http://example.org/#André> <http://example.org/#owes> "2000" .
`,
"",
},
{
// [5] #rdf-charmod-uris-test002
//
// A uriref which already has % escaping is permitted. No
// unescaping algorithm is applied.
//
"rdf-charmod-uris/test002.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/#">
<!-- The %C3%A9 below corresponds to é under the standard
%-escaping algorithm for URIs. -->
<rdf:Description rdf:about="http://example.org/#Andr%C3%A9">
<eg:owes>2000</eg:owes>
</rdf:Description>
</rdf:RDF>`,
`<http://example.org/#Andr%C3%A9> <http://example.org/#owes> "2000" .
`,
"",
},
{
// [6] #rdf-containers-syntax-vs-schema-error001
//
// rdf:li is not allowed as as an attribute
//
"rdf-containers-syntax-vs-schema/error001.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foo="http://foo/">
<foo:bar rdf:li="1"/>
</rdf:RDF>`,
"",
"unexpected as attribute: rdf:li",
},
{
// [7] #rdf-containers-syntax-vs-schema-error002
//
// rdf:li elements as typed nodes - a bizarre case As specified
// in
// http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2001Nov/0651.html
// is not an error.
//
"rdf-containers-syntax-vs-schema/error002.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foo="http://foo/">
<rdf:li/>
</rdf:RDF>`,
"",
"disallowed as node element name: rdf:li",
},
{
// [8] #rdf-containers-syntax-vs-schema-test001
//
// Simple container
//
"rdf-containers-syntax-vs-schema/test001.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Bag>
<rdf:li>1</rdf:li>
<rdf:li>2</rdf:li>
</rdf:Bag>
</rdf:RDF>`,
`_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "1" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "2" .
`,
"",
},
{
// [9] #rdf-containers-syntax-vs-schema-test002
//
// rdf:li is unaffected by other rdf:_nnn properties. This test
// case is concerned only with defining the triples that this
// particular example RDF/XML represents. It is not concerned
// with whether that collection of triples violates any other
// constraints, e.g. restrictions on the number of rdf:_1
// properties that may be defined for a resource.
//
"rdf-containers-syntax-vs-schema/test002.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foo="http://foo/">
<foo:Bar>
<rdf:_1>_1</rdf:_1>
<rdf:li>1</rdf:li>
<rdf:_3>_3</rdf:_3>
<rdf:li>2</rdf:li>
</foo:Bar>
</rdf:RDF>`,
`_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://foo/Bar> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "_1" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "1" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_3> "_3" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "2" .
`,
"",
},
{
// [10] #rdf-containers-syntax-vs-schema-test003
//
// rdf:li elements can exist in any description element
//
"rdf-containers-syntax-vs-schema/test003.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foo="http://foo/">
<foo:Bar>
<rdf:li>1</rdf:li>
<rdf:li>2</rdf:li>
</foo:Bar>
</rdf:RDF>`,
`_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://foo/Bar> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "1" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "2" .
`,
"",
},
{
// [11] #rdf-containers-syntax-vs-schema-test004
//
// rdf:li elements match any of the property element productions
//
"rdf-containers-syntax-vs-schema/test004.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foo="http://foo/">
<foo:Bar>
<rdf:li rdf:ID="e1">1</rdf:li>
<rdf:li rdf:parseType="Literal">2</rdf:li>
<rdf:li rdf:parseType="Resource">
<rdf:type rdf:resource="http://foo/Bar"/>
</rdf:li>
<rdf:li rdf:ID="e4" foo:bar="foobar"/>
</foo:Bar>
</rdf:RDF>`,
`_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://foo/Bar> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "1" .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test004.rdf#e1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test004.rdf#e1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> _:b0 .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test004.rdf#e1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test004.rdf#e1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> "1" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "2"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_3> _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://foo/Bar> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_4> _:b2 .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test004.rdf#e4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test004.rdf#e4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> _:b0 .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test004.rdf#e4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_4> .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test004.rdf#e4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> _:b2 .
_:b2 <http://foo/bar> "foobar" .
`,
"",
},
{
// [12] #rdf-containers-syntax-vs-schema-test006
//
// containers match the typed node production
//
"rdf-containers-syntax-vs-schema/test006.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foo="http://foo/">
<rdf:Seq rdf:ID="e1" rdf:_3="3" rdf:value="foobar"/>
<rdf:Alt rdf:about="#e2" rdf:_2="2" rdf:value="foobar">
<rdf:value>barfoo</rdf:value>
</rdf:Alt>
<rdf:Bag />
</rdf:RDF>`,
`<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test006.rdf#e1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq> .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test006.rdf#e1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_3> "3" .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test006.rdf#e1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "foobar" .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test006.rdf#e2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt> .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test006.rdf#e2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "2" .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test006.rdf#e2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "foobar" .
<http://www.w3.org/2013/RDFXMLTests/rdf-containers-syntax-vs-schema/test006.rdf#e2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "barfoo" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> .
`,
"",
},
{
// [13] #rdf-containers-syntax-vs-schema-test007
//
// rdf:li processing within each element is independent
//
"rdf-containers-syntax-vs-schema/test007.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foo="http://foo/">
<rdf:Description>
<rdf:li>
<rdf:Description>
<rdf:li>1</rdf:li>
<rdf:li>2</rdf:li>
</rdf:Description>
</rdf:li>
<rdf:li>2</rdf:li>
</rdf:Description>
</rdf:RDF>`,
`_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "1" .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "2" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> "2" .
`,
"",
},
{
// [14] #rdf-containers-syntax-vs-schema-test008
//
// rdf:li processing is per element, not per resource.
//
"rdf-containers-syntax-vs-schema/test008.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://desc">
<rdf:li>1</rdf:li>
</rdf:Description>
<rdf:Description rdf:about="http://desc">
<rdf:li>1-again</rdf:li>
</rdf:Description>
</rdf:RDF>`,
`<http://desc> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "1" .
<http://desc> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> "1-again" .
`,
"",
},
{
// [15] #rdf-element-not-mandatory-test001
//
// A surrounding rdf:RDF element is no longer mandatory.
//
"rdf-element-not-mandatory/test001.rdf",
`<Book xmlns="http://example.org/terms#">
<title>Dogs in Hats</title>
</Book>`,
`_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/terms#Book> .
_:b0 <http://example.org/terms#title> "Dogs in Hats" .
`,
"",
},
{
// [16] #rdf-ns-prefix-confusion-test0001
//
// RDF attributes that are required to have an rdf: prefix about
// aboutEach ID bagID type resource parseType
//
"rdf-ns-prefix-confusion/test0001.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/">
<!--
Test case for
Issue http://www.w3.org/2000/03/rdf-tracking/#rdf-ns-prefix-confusion
List of RDF attributes that are required to have an rdf: prefix
about aboutEach
ID bagID type resource parseType
Dave Beckett - http://purl.org/net/dajobe/
-->
<!-- Test rdf:about attribute - expect 1 triple -->
<!-- 6.3 description, part 2; 6.7 aboutAttr -->
<rdf:Description rdf:about="http://example.org/resource1/">
<eg:property>bar</eg:property>
</rdf:Description>
</rdf:RDF>`,
`<http://example.org/resource1/> <http://example.org/property> "bar" .
`,
"",
},
{
// [17] #rdf-ns-prefix-confusion-test0003
//
// RDF attributes that are required to have an rdf: prefix about
// aboutEach ID bagID type resource parseType
//
"rdf-ns-prefix-confusion/test0003.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/">
<!--
Test case for
Issue http://www.w3.org/2000/03/rdf-tracking/#rdf-ns-prefix-confusion
List of RDF attributes that are required to have an rdf: prefix
about aboutEach
ID bagID type resource parseType
Dave Beckett - http://purl.org/net/dajobe/
-->
<!-- Test rdf:resource - expect 1 triple -->
<!-- 6.3 description, part 2 -->
<rdf:Description rdf:about="http://example.org/resource1/">
<!-- 6.12 propertyElt part 4; 6.16 idRefAttr; 6.18 resourceAttr -->
<eg:property rdf:resource="http://example.org/resource2/"/>
</rdf:Description>
</rdf:RDF>`,
`<http://example.org/resource1/> <http://example.org/property> <http://example.org/resource2/> .
`,
"",
},
{
// [18] #rdf-ns-prefix-confusion-test0004
//
// RDF attributes that are required to have an rdf: prefix about
// aboutEach ID bagID type resource parseType
//
"rdf-ns-prefix-confusion/test0004.rdf",
`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/">
<!--
Test case for