@@ -746,7 +746,7 @@ describe('Parser', () => {
746746
747747 it ( 'should not parse a single opening brace' ,
748748 shouldNotParse ( '{' ,
749- 'Expected entity but got eof on line 1.' ) ) ;
749+ 'Unexpected "{" on line 1.' ) ) ;
750750
751751 it ( 'should not parse a superfluous closing brace ' ,
752752 shouldNotParse ( '{}}' ,
@@ -1044,6 +1044,46 @@ describe('Parser', () => {
10441044 shouldParse ( '<a> <b> <c> <g>.\n<<<a> <b> <c>>> <d> <e>.' ,
10451045 [ 'a' , 'b' , 'c' , 'g' ] ,
10461046 [ [ '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.' ) ) ;
10471087 } ) ;
10481088
10491089 describe ( 'An Parser instance without document IRI' , ( ) => {
@@ -1227,6 +1267,10 @@ describe('Parser', () => {
12271267 it ( 'should not parse RDF* in the object position' ,
12281268 shouldNotParse ( parser , '<a> <b> <<a> <b> <c>>>.' ,
12291269 '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.' ) ) ;
12301274 } ) ;
12311275
12321276 describe ( 'A Parser instance for the TurtleStar format' , ( ) => {
@@ -1288,6 +1332,10 @@ describe('Parser', () => {
12881332 it ( 'should not parse RDF* in the object position' ,
12891333 shouldNotParse ( parser , '<a> <b> <<<a> <b> <c>>>.' ,
12901334 '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.' ) ) ;
12911339 } ) ;
12921340
12931341 describe ( 'A Parser instance for the TriGStar format' , ( ) => {
@@ -1375,6 +1423,10 @@ describe('Parser', () => {
13751423 it ( 'should not parse nested quads' ,
13761424 shouldNotParse ( parser , '<<_:a <http://ex.org/b> _:b <http://ex.org/b>>> <http://ex.org/b> "c" .' ,
13771425 '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.' ) ) ;
13781430 } ) ;
13791431
13801432 describe ( 'A Parser instance for the N-Quads format' , ( ) => {
@@ -1430,6 +1482,10 @@ describe('Parser', () => {
14301482 it ( 'should parse RDF*' ,
14311483 shouldParse ( parser , '<<_:a <http://example.org/b> _:c>> <http://example.org/a> _:c .' ,
14321484 [ [ '_: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.' ) ) ;
14331489 } ) ;
14341490
14351491 describe ( 'A Parser instance for the N3 format' , ( ) => {
@@ -1777,6 +1833,10 @@ describe('Parser', () => {
17771833 it ( 'should not parse RDF* in the object position' ,
17781834 shouldNotParse ( parser , '<a> <b> <<<a> <b> <c>>>.' ,
17791835 '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.' ) ) ;
17801840 } ) ;
17811841
17821842 describe ( 'A Parser instance for the N3Star format' , ( ) => {
0 commit comments