SPARQL Endpoint への HTTP/HTTPS 接続テスト
Created
July 1, 2016 03:42
-
-
Save frogcat/36eca151d015f76cb39bc96913baaa85 to your computer and use it in GitHub Desktop.
SPARQL Endpoint への HTTP/HTTPS 接続テスト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>HTTPS and HTTPS SPARQL Endpoint Connection test</title> | |
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.0.0.css"> | |
</head> | |
<body> | |
<div id="qunit"></div> | |
<div id="qunit-fixture"></div> | |
<script src="https://code.jquery.com/qunit/qunit-2.0.0.js"></script> | |
<script> | |
QUnit.test("a test", function(assert) { | |
var done1 = assert.async(); | |
var done2 = assert.async(); | |
fetch("https://data.e-stat.go.jp/lod/sparql/query?query=" + | |
encodeURIComponent("select * where {?s ?p ?o.}limit 1")) | |
.then(a => a.json()) | |
.then(a => { | |
assert.ok(true, "get result from HTTPS sparql endoint"); | |
done1(); | |
}).catch(ex => { | |
assert.ok(false, "get result from HTTPS sparql endoint"); | |
console.log(ex); | |
done1(); | |
}); | |
fetch("http://data.e-stat.go.jp/lod/sparql/query?query=" + | |
encodeURIComponent("select * where {?s ?p ?o.}limit 1")) | |
.then(a => a.json()) | |
.then(a => { | |
assert.ok(true, "get result from HTTP sparql endoint"); | |
done2(); | |
}).catch(ex => { | |
assert.ok(false, "get result from HTTP sparql endoint"); | |
console.log(ex); | |
done2(); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment