"use strict";
import { tabulate } from './d3table.js';
import { drawGraph } from './d3graph.js';
import { drawTree } from './d3tree.js';
// import { treeTable } from './d3treetable.js';
import { data } from './results.js';
// import * as d3 from "https://cdn.jsdelivr.net/npm/d3@7/+esm";
// const div = d3.selectAll("div");
// tabulate(data, "#figure1");
// drawGraph(data, "#figure2", 1280, 650);
// drawTree(data, "#figure3", "root", false, 1280, 650, 150);
// treeTable(data, "#figure4");
class GraphPlugin {
priority = 10;
hideFromSelection = false;
constructor(yasr) {
this.yasr = yasr;
}
draw() {
const el = document.createElement("div");
console.log(this.yasr.results);
this.yasr.resultsEl.style.width = "100%";
drawGraph(this.yasr.results.json, this.yasr.resultsEl, this.yasr.resultsEl.offsetWidth, 650);
}
canHandleResults() {
return true;
return (
this.yasr.results.getBoolean &&
(this.yasr.results.getBoolean() === true || this.yasr.results.getBoolean() == false)
);
}
getIcon() {
const tabElement = document.createElement("div");
tabElement.classList.add("svgImg");
tabElement.innerHTML = ""
return tabElement;
}
}
Yasr.registerPlugin("Graph", GraphPlugin);
Yasqe.defaults.value = "PREFIX rdf: \n" +
"PREFIX rdfs: \n" +
"SELECT * WHERE {\n" +
" ?sub ?pred ?obj .\n" +
"} LIMIT 10";
// https://triply.cc/docs/yasgui-api/
const url = "https://fuseki.rys.app/example/";
const yasgui = new Yasgui(document.getElementById("yasgui"), {
requestConfig: {endpoint: url, copyEndpointOnNewTab: false},
});
// let tab = yasgui.getTab();
yasgui.on("queryResponse", (instance, tab) => {
console.log(instance);
console.log(tab);
});