(evaluation: Evaluation, tokenId: string, spans: any[], extraInfo: any)
| 429 | } |
| 430 | |
| 431 | export function tokenInfo(evaluation: Evaluation, tokenId: string, spans: any[], extraInfo: any) { |
| 432 | let queryId = `query|${tokenId}`; |
| 433 | let query = {tag: "query", token: tokenId}; |
| 434 | let eve = doQuery(queryId, query, spans, extraInfo); |
| 435 | |
| 436 | // look at the results and find out which action node we were looking |
| 437 | // at |
| 438 | let sessionIndex = eve.getDatabase("session").index; |
| 439 | let queryInfo = sessionIndex.alookup("tag", "query"); |
| 440 | let evSession = evaluation.getDatabase("session"); |
| 441 | if(queryInfo) { |
| 442 | for(let entity of Object.keys(queryInfo.index)) { |
| 443 | let info = sessionIndex.asObject(entity); |
| 444 | |
| 445 | console.log("INFO", info); |
| 446 | // why is this failing? |
| 447 | let nodeArray = info.scan || info.action; |
| 448 | if(nodeArray) { |
| 449 | let node = sessionIndex.asObject(nodeArray[0]); |
| 450 | let blockId = node["block"][0]; |
| 451 | let found; |
| 452 | for(let block of evSession.blocks) { |
| 453 | console.log("BLOCK ID", block.id, node["block"]); |
| 454 | if(block.id === blockId) { |
| 455 | found = block; |
| 456 | break; |
| 457 | } |
| 458 | } |
| 459 | console.log("NODE BLOCK", blockId, found); |
| 460 | console.log("FAILING SCAN", blockToFailingScan(found)); |
| 461 | console.log("CARDINALITIES", resultsToCardinalities(found.results)) |
| 462 | console.log("SPECIFIC ROWS", findResultRows(found.results, 2, "cherry")) |
| 463 | } |
| 464 | |
| 465 | // look for the facts that action creates |
| 466 | if(info.action) { |
| 467 | for(let actionId of info.action) { |
| 468 | let action = sessionIndex.asObject(actionId); |
| 469 | let evIndex = evaluation.getDatabase(action.scopes[0]).index; |
| 470 | let nodeItems = evIndex.nodeLookup(action["build-node"][0]); |
| 471 | if(nodeItems) { |
| 472 | console.log("ACTION", action["build-node"][0]); |
| 473 | console.log(evIndex.toTriples(false, nodeItems.index)); |
| 474 | } |
| 475 | } |
| 476 | } |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | export function findCardinality(evaluation: Evaluation, info: any, spans: any[], extraInfo: any) { |
| 482 | let queryId = `query|${info.requestId}`; |
nothing calls this directly
no test coverage detected