@@ -1134,27 +1134,28 @@ class DatasetCoreAndReadableStream extends Readable {
11341134
11351135 const graphs = n3Store . _getGraphs ( graph ) ;
11361136 for ( const graphKey in graphs ) {
1137- let subjects , predicates , objects ;
1138-
1139- if ( ! subjectId && predicateId ) {
1140- if ( predicates = indexMatch ( graphs [ graphKey ] . predicates , [ predicateId , objectId , subjectId ] ) ) {
1141- subjects = indexMatch ( graphs [ graphKey ] . subjects , [ subjectId , predicateId , objectId ] ) ;
1142- objects = indexMatch ( graphs [ graphKey ] . objects , [ objectId , subjectId , predicateId ] ) ;
1137+ let subjects , predicates , objects , content ;
1138+ if ( content = graphs [ graphKey ] ) {
1139+ if ( ! subjectId && predicateId ) {
1140+ if ( predicates = indexMatch ( content . predicates , [ predicateId , objectId , subjectId ] ) ) {
1141+ subjects = indexMatch ( content . subjects , [ subjectId , predicateId , objectId ] ) ;
1142+ objects = indexMatch ( content . objects , [ objectId , subjectId , predicateId ] ) ;
1143+ }
11431144 }
1144- }
1145- else if ( objectId ) {
1146- if ( objects = indexMatch ( graphs [ graphKey ] . objects , [ objectId , subjectId , predicateId ] ) ) {
1147- subjects = indexMatch ( graphs [ graphKey ] . subjects , [ subjectId , predicateId , objectId ] ) ;
1148- predicates = indexMatch ( graphs [ graphKey ] . predicates , [ predicateId , objectId , subjectId ] ) ;
1145+ else if ( objectId ) {
1146+ if ( objects = indexMatch ( content . objects , [ objectId , subjectId , predicateId ] ) ) {
1147+ subjects = indexMatch ( content . subjects , [ subjectId , predicateId , objectId ] ) ;
1148+ predicates = indexMatch ( content . predicates , [ predicateId , objectId , subjectId ] ) ;
1149+ }
1150+ }
1151+ else if ( subjects = indexMatch ( content . subjects , [ subjectId , predicateId , objectId ] ) ) {
1152+ predicates = indexMatch ( content . predicates , [ predicateId , objectId , subjectId ] ) ;
1153+ objects = indexMatch ( content . objects , [ objectId , subjectId , predicateId ] ) ;
11491154 }
1150- }
1151- else if ( subjects = indexMatch ( graphs [ graphKey ] . subjects , [ subjectId , predicateId , objectId ] ) ) {
1152- predicates = indexMatch ( graphs [ graphKey ] . predicates , [ predicateId , objectId , subjectId ] ) ;
1153- objects = indexMatch ( graphs [ graphKey ] . objects , [ objectId , subjectId , predicateId ] ) ;
1154- }
11551155
1156- if ( subjects )
1157- newStore . _graphs [ graphKey ] = { subjects, predicates, objects } ;
1156+ if ( subjects )
1157+ newStore . _graphs [ graphKey ] = { subjects, predicates, objects } ;
1158+ }
11581159 }
11591160 newStore . _size = null ;
11601161 }
0 commit comments