Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
List the req profile titles via SPARQL
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminaaron committed Apr 25, 2024
1 parent e00b82c commit a9309f6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 21 additions & 7 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

MatchingEngine.validateOne(userProfile, "", "", shacl).then((report) => {
console.log(report)
document.getElementById("output").innerHTML = JSON.stringify(report, null, 2)
})

async function fetchTextFile(relPath) {
Expand All @@ -38,20 +37,35 @@
}

async function loadFiles() {
let turtleContents = {
let turtleMap = {
"datafields": await fetchTextFile("requirement-profiles/datafields.ttl"),
"materialization": await fetchTextFile("requirement-profiles/materialization.ttl"),
"shacl": {}
}
let shaclFiles = await fetchTextFile("shacl-files.txt")
for (let shaclFile of shaclFiles.split("\n")) {
if (!shaclFile) continue
turtleContents.shacl[shaclFile] = await fetchTextFile("requirement-profiles/shacl/" + shaclFile)
for (let filename of shaclFiles.split("\n")) {
if (!filename) continue
turtleMap.shacl[filename] = await fetchTextFile("requirement-profiles/shacl/" + filename)
}
return turtleContents
return turtleMap
}

loadFiles()
async function extractReqProfileNames() {
let turtleMap = await loadFiles()
let store = await MatchingEngine.rdfStringsToStore(Object.values(turtleMap.shacl))
let query = `
PREFIX ff: <https://foerderfunke.org/default#>
SELECT * WHERE {
ff:metadata ff:title ?title .
}
`
let result = await MatchingEngine.runSparqlSelectQueryOnStore(query, store)
for (let row of result) {
document.getElementById("output").innerHTML += row.title + "<br>"
}
}

extractReqProfileNames()

</script>
</body>
Expand Down

0 comments on commit a9309f6

Please sign in to comment.