UNPKG

@triply/yasqe

Version:

Yet Another SPARQL Query Editor

108 lines (105 loc) 5.47 kB
<!doctype html><html><head><meta charset="UTF-8"/><style>body { font-family: "Roboto", sans-serif; margin: 0px; } .navItem a { color: #555; text-decoration: none; padding: 5px; padding-right: 15px; } .navItem a:hover { color: #222; } .navItem.active a { color: black; font-size: 110%; }</style><link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"/><style></style><link href="/yasqe.min.css" rel="stylesheet"></head><body><div style="background:#eee"><nav style="display: flex"><img src="webpack/yasgui.png" style="max-height:50px;padding:5px;margin-left: 10px" alt="Yasgui Logo"/><ul style="display: flex; list-style: none; align-self: center"><li class="navItem false"><a class="nav-link" href="yasgui.html">Yasgui</a></li><li class="navItem active"><a class="nav-link" href="yasqe.html">Yasqe</a></li><li class="navItem false"><a class="nav-link" href="yasr.html">Yasr</a></li></ul></nav></div><div style="display:none; background-color: grey; color:yellow" id="noExternalServicesWarning">Running yasqe without references to external services such as LOV and prefix.cc Mainly useful for test-suite purposes</div><a id="noExternalServicesToggle" style="display:none;" href="/yasqe.html?noExternalServices=1">Run yasqe without references to external services</a><div id="yasqe"></div><script>var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; if (isIE11) { var polyfills = document.createElement("script"); polyfills.setAttribute("src", "//yasgui.triply.cc/yasgui.polyfill.min.js"); document.head.appendChild(polyfills); } window.onpageshow = function() { const noExternalServices = document.location.search.indexOf("noExternalServices") >= 0; if (noExternalServices) { document.getElementById('noExternalServicesWarning').style.display = 'block' //avoid references to external services such as lov and prefix.cc //Useful for unit-testing purposes Yasqe.defaults.autocompleters.splice(Yasqe.defaults.autocompleters.indexOf("prefixes"), 1); Yasqe.forkAutocompleter("prefixes", { name: "prefixes-local", persistenceId: null, get: () => { return new Promise(resolve => { setTimeout(() => { resolve( [ "foaf: <http://xmlns.com/foaf/0.1/>", "geo: <http://www.opengis.net/ont/geosparql#>", "rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>", "rdfa: <http://www.w3.org/ns/rdfa#>", "rdfdata: <http://rdf.data-vocabulary.org/rdf.xml#>", "rdfdf: <http://www.openlinksw.com/virtrdf-data-formats#>", "rdfg: <http://www.w3.org/2004/03/trix/rdfg-1/>", "rdfp: <https://w3id.org/rdfp/>", "rdfs: <http://www.w3.org/2000/01/rdf-schema#>", "testa: <https://test.a.com/>", "testb: <https://test.b.com/>", "testc: <https://test.c.com/>" ], 20 ); }); }); } }); Yasqe.defaults.autocompleters.splice(Yasqe.defaults.autocompleters.indexOf("property"), 1); const propCompletions = [ "http://www.opengis.net/ont/geosparql#defaultGeometry", "http://www.opengis.net/ont/geosparql#asWKT", "http://www.opengis.net/ont/geosparql#asGML" ]; for (let i = 0; i < 1000; i++) { propCompletions.push("https://test.a.com/" + i); } Yasqe.forkAutocompleter("property", { name: "property-local", get: function(yasqe, token) { console.log( propCompletions, propCompletions.filter(iri => token.autocompletionString.indexOf(iri) === 0) ); return new Promise(resolve => { setTimeout(() => { resolve(propCompletions.filter(iri => iri.indexOf(token.autocompletionString) === 0)); }); }); } }); const classCompletions = []; for (let i = 0; i < 1000; i++) { classCompletions.push("https://test.b.com/" + i); } Yasqe.defaults.autocompleters.splice(Yasqe.defaults.autocompleters.indexOf("class"), 1); Yasqe.forkAutocompleter("class", { name: "class-local", get: function(yasqe, token) { return new Promise(resolve => { setTimeout(() => { resolve(classCompletions.filter(iri => iri.indexOf(token.autocompletionString) === 0)); }); }); } }); } else { document.getElementById('noExternalServicesToggle').style.display = 'block' } window.yasqe = new Yasqe(document.getElementById("yasqe")); window.yasqe.on("queryResponse", function() { console.log("response event", arguments); }); window.yasqe.on("query", function() { console.log("query event", arguments); }); };</script><script src="/yasqe.min.js"></script></body></html>