skos | http//www.w3.org/2004/02/skos/core#
|
dct | http//purl.org/dc/terms/
|
dc | http//purl.org/dc/elements/1.1/
|
rdf | http//www.w3.org/1999/02/22-rdf-syntax-ns#
|
rdfs | http//www.w3.org/2000/01/rdf-schema#
|
dm | https//owasp.org/www-project-devsecops-maturity-model/
|
iso | https//par-tec.github.io/security-ontologies/onto/iso#
|
import logging
log = logging.getLogger()
from pyodide import create_proxy
from rdflib import Graph
import sparql
graph = Graph()
graph.parse("./dsomm.ttl", format="turtle")
graph.parse("./iso27001-data.ttl", format="turtle")
graph.parse("./samm.ttl", format="turtle")
def on_apply(event):
global code, graph
text = code.value
ret = sparql.query(graph, text, sparql.INITNS)
Element("query-result").write(ret)
def create_f(query):
return lambda event: Element("code").write(query)
code = Element("code")
button = document.querySelector("button")
button.addEventListener("click", create_proxy(on_apply))
if True:
for button_id, query in sparql.QUERIES.items():
log.info("button_id" + button_id)
b = document.querySelector(f'#{button_id}')
if not b:
log.info("button not found")
continue
# log.warning("Button %r", dir(b))
b.innerHTML = query["label"]
b.addEventListener("click", create_proxy(create_f(query["query"])))