Skip to content

Commit

Permalink
trial and error
Browse files Browse the repository at this point in the history
  • Loading branch information
henriettelienrebnor committed Sep 3, 2024
1 parent cae972d commit b992658
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions rdfox/boundaries.rdfox
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ importaxioms asset:axioms
import > schema:shacl ../shacl/imf-dexpi.shacl.ttl
commitproc set commit-procedure.sparql

set access-control-allow-origin *
endpoint start
1 change: 1 addition & 0 deletions rdfox/connected.rdfox
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ boundaries.rdfox
import ../datalog/surrounding.datalog
import +p "../rml/pandid.trig"

set access-control-allow-origin *
endpoint start

set output out
Expand Down
2 changes: 0 additions & 2 deletions rdfox/dexpi.rdfox
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ import ../datalog/boundary.datalog
import ../datalog/interactive_boundary.datalog
import +p "../rml/pandid.trig"

endpoint start

set output out
select * where {?s a data:insideBoundaryX}
4 changes: 3 additions & 1 deletion www/dexpi.html
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@
</defs>
</g>
</svg>
<script src="script.js"></script>
<script src="script.js">
crossorigin="anonymous"</script>

</body>
</html>
24 changes: 22 additions & 2 deletions www/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ var nodes = document.querySelectorAll(".node");

document.addEventListener("keyup", (event) => {
if (event.key === "Enter") {
//TODO
console.log("Enter pressed, getting sparql result from rdfox")
console.log("enter pressed")
let query = 'SELECT ?node WHERE{?node a data:insideBoundary .}'
var result = queryTripleStore(query)
console.log(result.payload)
console.log("tried to log")
}
});

Expand Down Expand Up @@ -84,4 +87,21 @@ function updateTripleStore(sparql) {
.catch(error => {
console.error('Error:', error);
});
}

function queryTripleStore(sparql) {
var encoded = encodeURI(sparql)
fetch(`http://localhost:12110/datastores/boundaries/sparql?query=${encoded}`, {
method: 'GET',
})
.then(response => {
console.log("trying to log reposnse")
console.log(response.text())})
.then(data => {
console.log("trying to log response")
console.log(data);
})
.catch(error => {
console.error('Error:', error);
});
}
6 changes: 5 additions & 1 deletion www/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
}

.internal text {
fill: rgb(0, 255, 0);
fill: rgb(234, 255, 0);
transition: 0.6s;
}

.package text {
fill: rgb(5, 109, 5)
}

0 comments on commit b992658

Please sign in to comment.