@@ -91,26 +91,22 @@ export default class N3Store {
9191 const varCount = ! key0 + ! key1 + ! key2 ,
9292 entityKeys = varCount > 1 ? Object . keys ( this . _ids ) : this . _entities ;
9393 const graph = termFromId ( graphId , this . _factory ) ;
94+ const parts = { subject : null , predicate : null , object : null } ;
9495
9596 // If a key is specified, use only that part of index 0.
9697 if ( key0 ) ( tmp = index0 , index0 = { } ) [ key0 ] = tmp [ key0 ] ;
9798 for ( const value0 in index0 ) {
98- const entity0 = entityKeys [ value0 ] ;
99-
10099 if ( index1 = index0 [ value0 ] ) {
100+ parts [ name0 ] = termFromId ( entityKeys [ value0 ] , this . _factory ) ;
101101 // If a key is specified, use only that part of index 1.
102102 if ( key1 ) ( tmp = index1 , index1 = { } ) [ key1 ] = tmp [ key1 ] ;
103103 for ( const value1 in index1 ) {
104- const entity1 = entityKeys [ value1 ] ;
105-
106104 if ( index2 = index1 [ value1 ] ) {
105+ parts [ name1 ] = termFromId ( entityKeys [ value1 ] , this . _factory ) ;
107106 // If a key is specified, use only that part of index 2, if it exists.
108107 const values = key2 ? ( key2 in index2 ? [ key2 ] : [ ] ) : Object . keys ( index2 ) ;
109108 // Create quads for all items found in index 2.
110109 for ( let l = 0 ; l < values . length ; l ++ ) {
111- const parts = { subject : null , predicate : null , object : null } ;
112- parts [ name0 ] = termFromId ( entity0 , this . _factory ) ;
113- parts [ name1 ] = termFromId ( entity1 , this . _factory ) ;
114110 parts [ name2 ] = termFromId ( entityKeys [ values [ l ] ] , this . _factory ) ;
115111 yield this . _factory . quad ( parts . subject , parts . predicate , parts . object , graph ) ;
116112 }
0 commit comments