(multiIndex, resolved)
| 218 | // make a proposal for, what index we'd use to get the values for it, and what the cardinality |
| 219 | // of the proposal is. |
| 220 | getProposal(multiIndex, resolved) { |
| 221 | let [e,a,v,node] = resolved; |
| 222 | const lookupType = this.toLookupType(resolved); |
| 223 | let proposal = this.proposalObject; |
| 224 | proposal.providing = undefined; |
| 225 | proposal.indexType = undefined; |
| 226 | proposal.cardinality = 0; |
| 227 | let scopeIx = 0; |
| 228 | for(let scope of this.scopes) { |
| 229 | let curIndex = multiIndex.getIndex(scope); |
| 230 | switch(lookupType) { |
| 231 | case "e***": |
| 232 | this.setProposal(curIndex.eavIndex.lookup(e), this.a, scopeIx); |
| 233 | break; |
| 234 | case "ea**": |
| 235 | this.setProposal(curIndex.eavIndex.lookup(e,a), this.v, scopeIx); |
| 236 | break; |
| 237 | case "eav*": |
| 238 | this.setProposal(curIndex.eavIndex.lookup(e,a,v), this.node, scopeIx); |
| 239 | break; |
| 240 | case "*a**": |
| 241 | this.setProposal(curIndex.aveIndex.lookup(a), this.v, scopeIx); |
| 242 | break; |
| 243 | case "*av*": |
| 244 | this.setProposal(curIndex.aveIndex.lookup(a,v), this.e, scopeIx); |
| 245 | break; |
| 246 | case "***n": |
| 247 | this.setProposal(curIndex.neavIndex.lookup(node), this.e, scopeIx); |
| 248 | break; |
| 249 | case "e**n": |
| 250 | this.setProposal(curIndex.neavIndex.lookup(node,e), this.a, scopeIx); |
| 251 | break; |
| 252 | case "ea*n": |
| 253 | this.setProposal(curIndex.neavIndex.lookup(node,e,a), this.v, scopeIx); |
| 254 | break; |
| 255 | default: |
| 256 | if(proposal.providing === undefined) { |
| 257 | let providing = proposal.providing = []; |
| 258 | if(a === undefined) providing.push(this.a); |
| 259 | if(v === undefined) providing.push(this.v); |
| 260 | if(e === undefined) providing.push(this.e); |
| 261 | if(node === undefined && this.node !== undefined) providing.push(this.node); |
| 262 | } |
| 263 | // full scan |
| 264 | proposal.index[scopeIx] = curIndex; |
| 265 | proposal.cardinality += curIndex.cardinalityEstimate; |
| 266 | proposal.indexType = "fullScan"; |
| 267 | break; |
| 268 | } |
| 269 | scopeIx++; |
| 270 | } |
| 271 | return proposal; |
| 272 | } |
| 273 | |
| 274 | // Return a proposal or nothing based on the currently solved prefix of variables. |
| 275 | propose(tripleIndex, prefix) : Proposal | undefined { |
no test coverage detected