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

Commit

Permalink
Print validateAll details
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminaaron committed Apr 30, 2024
1 parent be56c9a commit 23e5a1c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea/
node_modules/
package-lock.json

public/*
!public/index.html
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "FörderFunke as a web app, the data only lives within the browser session locally",
"dependencies": {
"@foerderfunke/matching-engine": "*"
"@foerderfunke/matching-engine": "0.3.3"
},
"scripts": {
"cloneRepo": "rm -rf public/requirement-profiles && git clone https://github.com/Citizen-Knowledge-Graph/requirement-profiles public/requirement-profiles",
Expand Down
44 changes: 38 additions & 6 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
<title>FörderFunke</title>
</head>
<body>
<div id="output"></div>
<h3>User profile</h3>
<div id="userProfileDiv"></div>
<h4>Missing data points</h4>
<div id="missingDataPointsDiv"></div>
<h3>Report</h3>
<table id="reportTable"></table>

<script src="./bundle.js"></script>
<script>
let userProfile = `
@prefix ff: <https://foerderfunke.org/default#> .
ff:mainPerson a ff:Citizen ;
ff:hasAge 24 .
ff:mainPerson a ff:Citizen .
`

let shacl = `
Expand All @@ -24,6 +29,8 @@
sh:property [
sh:path ff:hasAge ;
sh:maxExclusive 18 ;
sh:minCount 1 ;
sh:maxCount 1 ;
] .
`

Expand Down Expand Up @@ -60,13 +67,38 @@
}
`
let result = await MatchingEngine.runSparqlSelectQueryOnStore(query, store)
for (let row of result) {
document.getElementById("output").innerHTML += row.title + "<br>"
}
console.log("Req profile titles", result)
}

extractReqProfileNames()

async function validateAll() {
document.getElementById("userProfileDiv").textContent = userProfile

let turtleMap = await loadFiles()
let validateAllReport = await MatchingEngine.validateAll(userProfile, turtleMap.shacl, turtleMap.datafields, turtleMap.materialization)
console.log(validateAllReport)

for (let report of validateAllReport.reports) {
let tr = document.createElement("tr")
let td = document.createElement("td")
td.textContent = report.title ? report.title : report.filename
tr.appendChild(td)
td = document.createElement("td")
td.textContent = report.result
tr.appendChild(td)
document.getElementById("reportTable").appendChild(tr)
}

let missingData = validateAllReport.missingUserInputsAggregated
let missingDataPoints = []
for (let key of Object.keys(missingData)) {
document.getElementById("missingDataPointsDiv").innerHTML += missingData[key].usedIn.length + ": " + missingData[key].predicate.split("#")[1] + "<br>"
}
}

validateAll()

</script>
</body>
</html>

0 comments on commit 23e5a1c

Please sign in to comment.