@@ -746,7 +746,7 @@ describe('Parser', () => {
746
746
747
747
it ( 'should not parse a single opening brace' ,
748
748
shouldNotParse ( '{' ,
749
- 'Expected entity but got eof on line 1.' ) ) ;
749
+ 'Unexpected "{" on line 1.' ) ) ;
750
750
751
751
it ( 'should not parse a superfluous closing brace ' ,
752
752
shouldNotParse ( '{}}' ,
@@ -1044,6 +1044,46 @@ describe('Parser', () => {
1044
1044
shouldParse ( '<a> <b> <c> <g>.\n<<<a> <b> <c>>> <d> <e>.' ,
1045
1045
[ 'a' , 'b' , 'c' , 'g' ] ,
1046
1046
[ [ 'a' , 'b' , 'c' ] , 'd' , 'e' ] ) ) ;
1047
+
1048
+ it ( 'should parse an RDF* triple using annotation syntax with one predicate-object' ,
1049
+ shouldParse ( '<a> <b> <c> {| <b> <c> |}.' ,
1050
+ [ 'a' , 'b' , 'c' ] , [ [ 'a' , 'b' , 'c' ] , 'b' , 'c' ] ) ) ;
1051
+
1052
+ it ( 'should parse an RDF* triple using annotation syntax with two predicate-objects' ,
1053
+ shouldParse ( '<a> <b> <c> {| <b1> <c1>; <b2> <c2> |}.' ,
1054
+ [ 'a' , 'b' , 'c' ] , [ [ 'a' , 'b' , 'c' ] , 'b1' , 'c1' ] , [ [ 'a' , 'b' , 'c' ] , 'b2' , 'c2' ] ) ) ;
1055
+
1056
+ it ( 'should parse an RDF* triple using annotation syntax with one predicate-object followed by regular triples' ,
1057
+ shouldParse ( '<a> <b> <c> {| <b> <c> |}.\n<a2> <b2> <c2>.' ,
1058
+ [ 'a' , 'b' , 'c' ] , [ [ 'a' , 'b' , 'c' ] , 'b' , 'c' ] , [ 'a2' , 'b2' , 'c2' ] ) ) ;
1059
+
1060
+ it ( 'should not parse an RDF* triple using annotation syntax with zero predicate-objects' ,
1061
+ shouldNotParse ( '<a> <b> <c> {| |}' ,
1062
+ 'Expected entity but got |} on line 1.' ) ) ;
1063
+
1064
+ it ( 'should not parse an RDF* triple using an incomplete annotation syntax' ,
1065
+ shouldNotParse ( '<a> <b> <c> {| <b> |}' ,
1066
+ 'Expected entity but got |} on line 1.' ) ) ;
1067
+
1068
+ it ( 'should not parse an RDF* triple using an incomplete annotation syntax after a semicolon' ,
1069
+ shouldNotParse ( '<a> <b> <c> {| <b1> <c1>; |}' ,
1070
+ 'Expected entity but got |} on line 1.' ) ) ;
1071
+
1072
+ it ( 'should not parse an RDF* triple using an incomplete annotation syntax after a semicolon and entity' ,
1073
+ shouldNotParse ( '<a> <b> <c> {| <b1> <c1>; <b2> |}' ,
1074
+ 'Expected entity but got |} on line 1.' ) ) ;
1075
+
1076
+ it ( 'should not parse an RDF* triple using an incomplete annotation syntax that misses |}' ,
1077
+ shouldNotParse ( '<a> <b> <c> {| <b1> <c1>' ,
1078
+ 'Expected entity but got eof on line 1.' ) ) ;
1079
+
1080
+ it ( 'should not parse an RDF* triple using an incomplete annotation syntax that misses |} and starts a new subject' ,
1081
+ shouldNotParse ( '<a> <b> <c> {| <b1> <c1>. <a2> <b2> <c2>' ,
1082
+ 'Expected entity but got eof on line 1.' ) ) ;
1083
+
1084
+ it ( 'should not parse an out of place |}' ,
1085
+ shouldNotParse ( '<a> <b> <c> |}' ,
1086
+ 'Unexpected asserted triple closing on line 1.' ) ) ;
1047
1087
} ) ;
1048
1088
1049
1089
describe ( 'An Parser instance without document IRI' , ( ) => {
@@ -1227,6 +1267,10 @@ describe('Parser', () => {
1227
1267
it ( 'should not parse RDF* in the object position' ,
1228
1268
shouldNotParse ( parser , '<a> <b> <<a> <b> <c>>>.' ,
1229
1269
'Unexpected RDF* syntax on line 1.' ) ) ;
1270
+
1271
+ it ( 'should not parse RDF* with annotated syntax' ,
1272
+ shouldNotParse ( parser , '<a> <b> <c> {| <b> <c> |}.' ,
1273
+ 'Unexpected RDF* syntax on line 1.' ) ) ;
1230
1274
} ) ;
1231
1275
1232
1276
describe ( 'A Parser instance for the TurtleStar format' , ( ) => {
@@ -1288,6 +1332,10 @@ describe('Parser', () => {
1288
1332
it ( 'should not parse RDF* in the object position' ,
1289
1333
shouldNotParse ( parser , '<a> <b> <<<a> <b> <c>>>.' ,
1290
1334
'Unexpected RDF* syntax on line 1.' ) ) ;
1335
+
1336
+ it ( 'should not parse RDF* with annotated syntax' ,
1337
+ shouldNotParse ( parser , '<a> <b> <c> {| <b> <c> |}.' ,
1338
+ 'Unexpected RDF* syntax on line 1.' ) ) ;
1291
1339
} ) ;
1292
1340
1293
1341
describe ( 'A Parser instance for the TriGStar format' , ( ) => {
@@ -1375,6 +1423,10 @@ describe('Parser', () => {
1375
1423
it ( 'should not parse nested quads' ,
1376
1424
shouldNotParse ( parser , '<<_:a <http://ex.org/b> _:b <http://ex.org/b>>> <http://ex.org/b> "c" .' ,
1377
1425
'Expected >> to follow "_:b0_b" on line 1.' ) ) ;
1426
+
1427
+ it ( 'should not parse annotated triples' ,
1428
+ shouldNotParse ( parser , '_:a <http://ex.org/b> _:c {| <http://ex.org/b1> "c1" |} .' ,
1429
+ 'Unexpected "{|" on line 1.' ) ) ;
1378
1430
} ) ;
1379
1431
1380
1432
describe ( 'A Parser instance for the N-Quads format' , ( ) => {
@@ -1430,6 +1482,10 @@ describe('Parser', () => {
1430
1482
it ( 'should parse RDF*' ,
1431
1483
shouldParse ( parser , '<<_:a <http://example.org/b> _:c>> <http://example.org/a> _:c .' ,
1432
1484
[ [ '_:b0_a' , 'b' , '_:b0_c' ] , 'a' , '_:b0_c' ] ) ) ;
1485
+
1486
+ it ( 'should not parse annotated triples' ,
1487
+ shouldNotParse ( parser , '_:a <http://ex.org/b> _:c {| <http://ex.org/b1> "c1" |} .' ,
1488
+ 'Unexpected "{|" on line 1.' ) ) ;
1433
1489
} ) ;
1434
1490
1435
1491
describe ( 'A Parser instance for the N3 format' , ( ) => {
@@ -1777,6 +1833,10 @@ describe('Parser', () => {
1777
1833
it ( 'should not parse RDF* in the object position' ,
1778
1834
shouldNotParse ( parser , '<a> <b> <<<a> <b> <c>>>.' ,
1779
1835
'Unexpected RDF* syntax on line 1.' ) ) ;
1836
+
1837
+ it ( 'should not parse RDF* with annotated syntax' ,
1838
+ shouldNotParse ( parser , '<a> <b> <c> {| <b> <c> |}.' ,
1839
+ 'Unexpected RDF* syntax on line 1.' ) ) ;
1780
1840
} ) ;
1781
1841
1782
1842
describe ( 'A Parser instance for the N3Star format' , ( ) => {
0 commit comments