MCPcopy
hub / github.com/witheve/Eve / tokenInfo

Function tokenInfo

src/runtime/analyzer.ts:431–479  ·  view source on GitHub ↗
(evaluation: Evaluation, tokenId: string, spans: any[], extraInfo: any)

Source from the content-addressed store, hash-verified

429}
430
431export 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
481export function findCardinality(evaluation: Evaluation, info: any, spans: any[], extraInfo: any) {
482 let queryId = `query|${info.requestId}`;

Callers

nothing calls this directly

Calls 9

doQueryFunction · 0.85
blockToFailingScanFunction · 0.85
resultsToCardinalitiesFunction · 0.85
findResultRowsFunction · 0.85
getDatabaseMethod · 0.80
alookupMethod · 0.80
nodeLookupMethod · 0.80
asObjectMethod · 0.45
toTriplesMethod · 0.45

Tested by

no test coverage detected