@@ -199,7 +199,7 @@ export default class N3Parser {
199199 case '(' :
200200 // Lists are not allowed inside quoted triples
201201 if ( this . _contextStack . length > 0 && this . _contextStack [ this . _contextStack . length - 1 ] . type === '<<' ) {
202- return this . _error ( ` Unexpected list inside quoted triple` , token ) ;
202+ return this . _error ( ' Unexpected list inside quoted triple' , token ) ;
203203 }
204204 // Start a new list
205205 this . _saveContext ( 'list' , this . _graph , this . RDF_NIL , null , null ) ;
@@ -321,7 +321,7 @@ export default class N3Parser {
321321 case '(' :
322322 // Lists are not allowed inside quoted triples
323323 if ( this . _contextStack . length > 0 && this . _contextStack [ this . _contextStack . length - 1 ] . type === '<<' ) {
324- return this . _error ( ` Unexpected list inside quoted triple` , token ) ;
324+ return this . _error ( ' Unexpected list inside quoted triple' , token ) ;
325325 }
326326 // Start a new list
327327 this . _saveContext ( 'list' , this . _graph , this . _subject , this . _predicate , this . RDF_NIL ) ;
@@ -370,9 +370,11 @@ export default class N3Parser {
370370 if ( token . type === ']' ) {
371371 this . _subject = null ;
372372 return this . _readBlankNodeTail ( token ) ;
373- } else if ( this . _contextStack . length > 1 && this . _contextStack [ this . _contextStack . length - 2 ] . type === '<<' ) {
374- return this . _error ( 'Compound blank node expressions not permitted within quoted triples' , token )
375- } else {
373+ }
374+ else if ( this . _contextStack . length > 1 && this . _contextStack [ this . _contextStack . length - 2 ] . type === '<<' ) {
375+ return this . _error ( 'Compound blank node expressions not permitted within quoted triples' , token ) ;
376+ }
377+ else {
376378 this . _predicate = null ;
377379 return this . _readPredicate ( token ) ;
378380 }
@@ -896,10 +898,21 @@ export default class N3Parser {
896898
897899 // ### `_readRDFStarTail` reads the end of a nested RDF* triple
898900 _readAnnotatedTail ( token ) {
899- this . _emit ( this . _subject , this . _predicate , this . _object , this . _graph ) ;
900901 // if (this._subject && this._predicate && this._object) {
901902 // this._emit(this._subject, this._predicate, this._object, this._graph);
902903 // }
904+ if ( token . type === '{|' ) {
905+ this . _saveContext ( '{|' , this . _graph , this . _subject , this . _predicate , this . _object ) ;
906+
907+ // Note - we always use the default graph for the quoted triple component
908+ this . _subject = this . _quad ( this . _subject , this . _predicate , this . _object , this . DEFAULTGRAPH ) ;
909+ this . _predicate = null ;
910+ this . _object = null ;
911+ return this . _readPredicate ;
912+ } else {
913+ this . _emit ( this . _subject , this . _predicate , this . _object , this . _graph ) ;
914+ }
915+
903916 if ( token . type !== '|}' )
904917 return this . _readPredicate ;
905918 this . _restoreContext ( '{|' , token ) ;
0 commit comments