/** * Running a validation and saying what came of it: the validate button and * the tracker behind it, the query tracker a slurp writes through, the * capture-and-replay debugger, and what a failure is reported as. Mixed * onto ShExBaseApp; see ShExBaseApp.js. * * This is doc/ShExBaseApp-validation.js's source (tsconfig.app.json compiles src/app/ into * doc/); edit here and run `npm run build`. */ mixin(ShExBaseApp, { // abstract getValidator (_validator) { } // overriden for ShExMap /** * resolve node and shape against input data and schema base and prefixes */ fixValidationShapeMapEntry(node, shape) { return { node: this.Caches.inputData.meta.lexToTerm(node), shape: this.Caches.inputSchema.meta.lexToTerm(shape) // resolve with this.Caches.outputSchema }; }, /** reveal the shared floating debug panel for `mode` ("replay" | * "live" | "materialize"): show the rows that mode uses, hide the rest, * enable the step verbs, and stand the trigger buttons down. */ showDebugPanel(mode) { $("#debugPanel").show(); // the card names which debugger it is driving (the title was a fixed // "debugger" before -- it now says what is being stepped) $("#debugPanelTitle").text(mode === "materialize" ? "materialization" : mode === "live" ? "live validation" : "validation"); this.setDebugRunnable(true); // a replay steps within one match, so it can't step out; validation and // materialization walk a call tree and can $("#dbgOut").toggle(mode !== "replay"); // the bp/bn breakpoint entry is the validators'; the recorded-match // picker is capture+replay's alone $("#dbgMatchesRow").toggle(mode !== "materialize"); $("#dbgMatches").toggle(mode === "replay"); $("#dbgStatusRow, #dbgThreadsRow").show(); $("#dbgOver").attr("title", mode === "live" ? "step over this shape's body" : mode === "materialize" ? "step over" : "run to the next generation"); $("#debugValidate, #debugValidateLive, #debugMaterialize").hide(); }, /** hide the panel and offer the triggers again (live only where the page * is cross-origin isolated) */ hideDebugPanel() { $("#debugPanel").hide(); $("#dbgStatus").text(""); $("#dbgThreads, #dbgBreakpoints").empty(); $("#debugValidate, #debugMaterialize").show(); // #debugMaterialize is a no-op without the plugin if (typeof SharedArrayBuffer !== "undefined" && typeof self !== "undefined" && self.crossOriginIsolated) $("#debugValidateLive").show(); }, /** enable or disable the step verbs (▶⤵⏭⤴): disabled once a search is * exhausted, so a dead button reads as done rather than doing nothing */ setDebugRunnable(runnable) { $("#dbgContinue, #dbgInto, #dbgOver, #dbgOut").prop("disabled", !runnable); }, /** end whichever debug session is running -- called when the ground moves * under it (the schema or data is re-picked) */ endActiveDebugSession() { if (this.activeDebugSession) this.activeDebugSession.end(); }, /* Executions */ // Validation UI /** a validation is starting: an app with results derived from the last * one says so here. Nothing to do for a validator. */ startingValidation() { pluginDescriptors().forEach(ext => { if (typeof ext.onStartingValidation === "function") ext.onStartingValidation(this); }); }, disableResultsAndValidate(evt) { if (new Date().getTime() - LastFailTime < 100) { this.resultsWidget.append($("
").addClass("warning").append($("

").text("see shape map errors above"), $("