I'm trying to use Javascript for querying my local Stardog database. To do this, I'm using the code from here: https://gist.github.com/ronmichael/4281566. I've installed npm, stardog, require without problems. However, when I try to run the following code:
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/require.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</head>
<script>
const { Connection, query } = require('stardog');
const conn = new Connection({
username: 'admin',
password: 'admin',
endpoint: 'http://localhost:5820',
});
query.execute(conn, 'select distinct ?s where { ?s ?p ?o }', {
limit: 10,
offset: 0
}).then(({ result }) => {
console.log(result.results.bindings);
});
</script>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
I get the following error in my console:
Uncaught Error: Module name "stardog" has not been loaded yet for context: _. Use require([])
http://requirejs.org/docs/errors.html#notloaded
at F (require.js:7)
at Object.m [as require] (require.js:26)
at requirejs (require.js:32)
at (index):22.
As far as I'm aware, I'm using require in the right way and since I've installed stardog properly, it should run. Could anyone point me in the right direction what I'm doing wrong here?
Edit: answer can be found here: Karma unit testing: Module name "react" has not been loaded yet for context: _. Use require([])