Merge branch 'maint-rel-1.6' into develop
This commit is contained in:
commit
0acebdb665
2 changed files with 171 additions and 0 deletions
|
@ -0,0 +1,115 @@
|
|||
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<script src="js/jquery.js"></script>
|
||||
|
||||
<script>
|
||||
function TestLOD() {
|
||||
self = this;
|
||||
|
||||
this.setup = setupButtons;
|
||||
|
||||
this.uri = "lodFacultyMember";
|
||||
|
||||
function setupButtons() {
|
||||
document.getElementById("RDFXML_button").onclick = function() {
|
||||
requestWithAcceptHeader(self.uri, "application/rdf+xml");
|
||||
}
|
||||
document.getElementById("N3_button").onclick = function() {
|
||||
requestWithAcceptHeader(self.uri, "text/n3");
|
||||
}
|
||||
document.getElementById("TTL_button").onclick = function() {
|
||||
requestWithAcceptHeader(self.uri, "text/turtle");
|
||||
}
|
||||
document.getElementById("JSONLD_button").onclick = function() {
|
||||
requestWithAcceptHeader(self.uri, "application/json");
|
||||
}
|
||||
|
||||
document.getElementById("BOGUS_URI_button").onclick = function() {
|
||||
requestWithAcceptHeader(self.uri + "XX", "application/rdf+xml");
|
||||
}
|
||||
document.getElementById("BOGUS_ACCEPT_button").onclick = function() {
|
||||
requestWithAcceptHeader(self.uri, "image/png");
|
||||
}
|
||||
document.getElementById("BOGUS_FORMAT_button").onclick = function() {
|
||||
requestWithFormat(self.uri, "bogus");
|
||||
}
|
||||
document.getElementById("BOGUS_EXTENSION_button").onclick = function() {
|
||||
requestWithExtension(self.uri, "bogus");
|
||||
}
|
||||
|
||||
document.getElementById("CLEAR_button").onclick = clearResult
|
||||
}
|
||||
|
||||
function requestWithAcceptHeader(uri, mimetype) {
|
||||
$.ajax({
|
||||
url: "individual/" + uri,
|
||||
headers: {Accept: mimetype},
|
||||
dataType: "text",
|
||||
complete: displayResult
|
||||
});
|
||||
}
|
||||
|
||||
function requestWithFormat(uri, format) {
|
||||
$.ajax({
|
||||
url: "individual/" + uri + "?format=" + format,
|
||||
dataType: "text",
|
||||
complete: displayResult
|
||||
});
|
||||
}
|
||||
|
||||
function requestWithExtension(uri, extension) {
|
||||
$.ajax({
|
||||
url: "individual/" + uri + "/" + uri + "." + extension,
|
||||
dataType: "text",
|
||||
complete: displayResult
|
||||
});
|
||||
}
|
||||
|
||||
function displayResult(xhr, status) {
|
||||
$("#responseCode").text(xhr.status);
|
||||
$("#mimeType").text(getMimeType(xhr));
|
||||
$("#responseText").text(xhr.responseText);
|
||||
}
|
||||
|
||||
function clearResult() {
|
||||
$("#responseCode").text("000");
|
||||
$("#mimeType").text("No type");
|
||||
$("#responseText").text("No text");
|
||||
}
|
||||
|
||||
function getMimeType(xhr) {
|
||||
var header = xhr.getResponseHeader("Content-Type");
|
||||
var where = header.indexOf(";");
|
||||
if (where == -1) {
|
||||
return header;
|
||||
} else {
|
||||
return header.substring(0, where);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
new TestLOD().setup();
|
||||
});
|
||||
</script>
|
||||
|
||||
<h1>Test the Linked Open Data requests</h1>
|
||||
|
||||
<h3>Try various accept headers</h3>
|
||||
<input type="submit" value="get RDFXML" id="RDFXML_button">
|
||||
<input type="submit" value="get N3" id="N3_button">
|
||||
<input type="submit" value="get TTL" id="TTL_button">
|
||||
<input type="submit" value="get JSONLD" id="JSONLD_button">
|
||||
|
||||
<h3>Try non-existent URI with RDFXML accept header</h3>
|
||||
<input type="submit" value="get BOGUS Individual" id="BOGUS_URI_button">
|
||||
<input type="submit" value="use BOGUS Accept header" id="BOGUS_ACCEPT_button">
|
||||
<input type="submit" value="use BOGUS format" id="BOGUS_FORMAT_button">
|
||||
<input type="submit" value="use BOGUS extension" id="BOGUS_EXTENSION_button">
|
||||
|
||||
<h3>Response data</h3>
|
||||
<input type="submit" value="CLEAR response" id="CLEAR_button">
|
||||
<div>Response code is <b><span id="responseCode">000</span></b></div>
|
||||
<div>MIME type is <b><span id="mimeType">No type</span></b></div>
|
||||
<div>Text is:</div>
|
||||
<div id="responseText" style="font-size:small;">No text</div>
|
|
@ -0,0 +1,56 @@
|
|||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||
@prefix xmls: <http://www.w3.org/2001/XMLSchema#> .
|
||||
@prefix local: <http://vivo.mydomain.edu/individual/> .
|
||||
@prefix vivo: <http://vivoweb.org/ontology/core#> .
|
||||
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
|
||||
@prefix obo: <http://purl.obolibrary.org/obo/> .
|
||||
|
||||
|
||||
local:lodFacultyMember
|
||||
a vivo:FacultyMember ;
|
||||
rdfs:label "Example, Bad "^^xmls:string ;
|
||||
obo:ARG_2000028 local:lodVcard ;
|
||||
obo:RO_0000053 local:lodMembership ;
|
||||
vivo:overview "Not someone on whom you should base your actions." ;
|
||||
vivo:scopusId "10982375409" ;
|
||||
vivo:eRACommonsId "My_eRA_ID" .
|
||||
|
||||
local:lodVcard
|
||||
a vcard:Kind , vcard:Individual ;
|
||||
obo:ARG_2000029 local:lodFacultyMember ;
|
||||
vcard:hasName local:lodName ;
|
||||
vcard:hasURL local:lodWebsite .
|
||||
|
||||
local:lodName
|
||||
a vcard:Name ;
|
||||
vcard:familyName "Example"^^xmls:string ;
|
||||
vcard:givenName "Bad"^^xmls:string ;
|
||||
vcard:honorificPrefix "Mr."^^xmls:string .
|
||||
|
||||
local:lodWebsite
|
||||
a vcard:URL ;
|
||||
rdfs:label "Slashdot" ;
|
||||
vivo:rank "1"^^xmls:int ;
|
||||
vcard:url "http://www.slashdot.org"^^xmls:anyURI .
|
||||
|
||||
local:lodMembership
|
||||
a vivo:MemberRole ;
|
||||
rdfs:label "Bozo"^^xmls:string ;
|
||||
obo:RO_0000052 local:lodFacultyMember ;
|
||||
vivo:dateTimeInterval local:lodInterval ;
|
||||
vivo:roleContributesTo local:lodDepartment .
|
||||
|
||||
local:lodInterval
|
||||
a vivo:DateTimeInterval ;
|
||||
vivo:start local:lodStartDate .
|
||||
|
||||
local:lodStartDate
|
||||
a vivo:DateTimeValue ;
|
||||
vivo:dateTime "1992-01-01T00:00:00"^^xmls:dateTime ;
|
||||
vivo:dateTimePrecision vivo:yearPrecision .
|
||||
|
||||
local:lodDepartment
|
||||
a vivo:AcademicDepartment ;
|
||||
rdfs:label "Department of Redundancy Department"^^xmls:string ;
|
||||
vivo:contributingRole local:lodMembership .
|
||||
|
Loading…
Add table
Reference in a new issue