-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa951c2
commit 5c8710f
Showing
9 changed files
with
6,093 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
{ | ||
"@context": { | ||
"Action": "http://data.europa.eu/2qy/rrmv#Action", | ||
"ActionResult": "http://data.europa.eu/2qy/rrmv#ActionResult", | ||
"Agent": "http://data.europa.eu/eli/ontology#Agent", | ||
"AgentRole": "http://data.europa.eu/2qy/rrmv#AgentRole", | ||
"AgentType": "http://data.europa.eu/2qy/rrmv#AgentType", | ||
"Expression": "http://data.europa.eu/eli/ontology#Expression", | ||
"Frequency": "http://data.europa.eu/2qy/rrmv#Frequency", | ||
"Manifestation": "http://data.europa.eu/eli/ontology#Manifestation", | ||
"Organization": "http://data.europa.eu/eli/ontology#Organization", | ||
"PeriodOfTime": "http://www.w3.org/2006/time#ProperInterval", | ||
"Person": "http://data.europa.eu/eli/ontology#Person", | ||
"Request": "http://data.europa.eu/2qy/rrmv#Request", | ||
"ResultType": "http://example.com/rrmv/ResultType", | ||
"Role": "http://example.com/rrmv/Role", | ||
"RoleType": "http://example.com/rrmv/RoleType", | ||
"Status": "http://data.europa.eu/2qy/rrmv#Status", | ||
"TemporalFunction": "http://data.europa.eu/2qy/rrmv#TemporalFunction", | ||
"Work": "http://data.europa.eu/eli/ontology#Work", | ||
"eli:changes": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/eli/ontology#changes", | ||
"@type": "@id" | ||
}, | ||
"eli:cites": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/eli/ontology#cites", | ||
"@type": "@id" | ||
}, | ||
"eli:embodies": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/eli/ontology#embodies", | ||
"@type": "@id" | ||
}, | ||
"eli:isEmbodiedBy": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/eli/ontology#is_embodied_by", | ||
"@type": "@id" | ||
}, | ||
"eli:isPartOf": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/eli/ontology#is_part_of", | ||
"@type": "@id" | ||
}, | ||
"eli:isRealizedBy": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/eli/ontology#is_realized_by", | ||
"@type": "@id" | ||
}, | ||
"eli:relatedTo": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/eli/ontology#related_to", | ||
"@type": "@id" | ||
}, | ||
"hasAnnotation": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#hasAnnotation", | ||
"@type": "http://www.w3.org/2001/XMLSchema#string" | ||
}, | ||
"hasURI": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/eli/ontology#hasURI", | ||
"@type": "http://www.w3.org/2001/XMLSchema#anyURI" | ||
}, | ||
"rrmv:forAgent": { | ||
"@container": "@set", | ||
"@id": "http://example.com/rrmv/forAgent", | ||
"@type": "@id" | ||
}, | ||
"rrmv:hasAgentRole": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#rrmv:hasAgentRole", | ||
"@type": "@id" | ||
}, | ||
"rrmv:hasAnnotation": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#rrmv:hasAnnotation", | ||
"@type": "http://www.w3.org/2001/XMLSchema#string" | ||
}, | ||
"rrmv:hasFunction": { | ||
"@container": "@set", | ||
"@id": "http://example.com/rrmv/hasFunction", | ||
"@type": "@id" | ||
}, | ||
"rrmv:hasNext": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#rrmv:hasNext", | ||
"@type": "@id" | ||
}, | ||
"rrmv:hasResult": { | ||
"@container": "@set", | ||
"@id": "http://example.com/rrmv/hasResult", | ||
"@type": "@id" | ||
}, | ||
"rrmv:hasStatus": { | ||
"@container": "@set", | ||
"@id": "http://example.com/rrmv/hasStatus", | ||
"@type": "@id" | ||
}, | ||
"rrmv:hasTitle": { | ||
"@container": "@set", | ||
"@id": "http://example.com/rrmv/hasTitle", | ||
"@type": "http://www.w3.org/2001/XMLSchema#string" | ||
}, | ||
"rrmv:hasTopic": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#rrmv:hasTopic", | ||
"@type": "@id" | ||
}, | ||
"rrmv:hasType": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#rrmv:hasType", | ||
"@type": "@id" | ||
}, | ||
"rrmv:hasUnit": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#rrmv:hasUnit", | ||
"@type": "@id" | ||
}, | ||
"rrmv:hasUri": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#rrmv:hasUri", | ||
"@type": "http://www.w3.org/2001/XMLSchema#anyURI" | ||
}, | ||
"rrmv:hasValue": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#rrmv:hasValue", | ||
"@type": "@id" | ||
}, | ||
"rrmv:isIncomplete": { | ||
"@container": "@set", | ||
"@id": "http://fixme.com#rrmv:isIncomplete", | ||
"@type": "http://www.w3.org/2001/XMLSchema#boolean" | ||
}, | ||
"rrmv:produces": { | ||
"@container": "@set", | ||
"@id": "http://example.com/rrmv/produces", | ||
"@type": "@id" | ||
}, | ||
"rrmv:withRole": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/2qy/rrmv#rrmv:withRole", | ||
"@type": "@id" | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
function example_structure(exampleid){ | ||
structure=` | ||
<div id="` + exampleid + `-tabs" exampleid="` + exampleid + `" class="tabs tabsstyle"> | ||
<ul> | ||
<li><a href="#` + exampleid + `-tabs-1">Turtle</a></li> | ||
<li><a href="#` + exampleid + `-tabs-2">JSON-LD</a></li> | ||
</ul> | ||
<div id="` + exampleid + `-tabs-1"> | ||
<textarea class="validationquery" id="` + exampleid + `-tab1validationquery" name="query" cols="80" rows="16"></textarea> | ||
<button class="buttonsample copyturtletoclipboard" id="` + exampleid + `-tabs-1-button-1">Copy</button> | ||
</div> | ||
<div id="` + exampleid + `-tabs-2"> | ||
<textarea class="validationquery" id="` + exampleid + `-tab2validationquery" name="query" cols="80" rows="16"></textarea> | ||
<button class="buttonsample copyjsonldtoclipboard" id="` + exampleid + `-tabs-2-button-1">Copy</button> | ||
<button class="buttonsample openinplayground" id="` + exampleid + `-tabs-2-button-2">Open in Playground</button> | ||
</div> | ||
</div>`; | ||
return structure; | ||
} | ||
|
||
|
||
/** | ||
* auxiliary function to get around the issue that indexOf() is not working with jquery. | ||
*/ | ||
|
||
function myIndexOf(list, val) { | ||
var myindex = -1; | ||
var i = 0; | ||
|
||
var elem = list[0]; | ||
|
||
while ( i < list.length ) { | ||
if ( elem == val ) return i; | ||
i = i+1; | ||
elem = list[i]; | ||
|
||
} | ||
|
||
return -1; | ||
|
||
} | ||
|
||
|
||
/** | ||
* Fills in the direct input area with some samples | ||
* @param {string} file - file containing the sample | ||
*/ | ||
function loadFile(editorinstance, file) { | ||
var xmlhttp; | ||
if (window.XMLHttpRequest) { | ||
xmlhttp = new XMLHttpRequest(); | ||
} else { | ||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | ||
} | ||
xmlhttp.onreadystatechange = function () { | ||
if (xmlhttp.readyState === 4 && xmlhttp.status !== 200) { | ||
alert('Error when opening the file: ' + file + ' - ' + xmlhttp.status + ' ' + xmlhttp.statusText); | ||
} else if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { | ||
editorinstance.setValue(xmlhttp.responseText); | ||
} | ||
}; | ||
xmlhttp.open("GET", file, true); | ||
xmlhttp.send(); | ||
return xmlhttp.responseText; | ||
} | ||
|
||
function createTurtleEditorFrom(selector) { | ||
return CodeMirror.fromTextArea(selector, { | ||
mode: "turtle", | ||
lineNumbers: true | ||
}); | ||
} | ||
|
||
function createJSONLDEditorFrom(selector) { | ||
return CodeMirror.fromTextArea(selector, { | ||
mode: "application/ld+json", | ||
lineNumbers: true | ||
}); | ||
} | ||
|
||
|
||
$(document).ready(function () { | ||
|
||
|
||
|
||
var examples = []; | ||
var editors = []; | ||
|
||
var examples_id = ".examples"; | ||
var examples_class = ".h3"; | ||
var folder = "./html/examples/"; | ||
var $examples = $(examples_id); | ||
|
||
// $examples.children(examples_class).each(function(index){ | ||
$examples.each(function(index){ | ||
exampleid = this.id; | ||
examples.push(exampleid); | ||
var text = example_structure(exampleid); | ||
$(this).after(text); | ||
|
||
var obj = {CM0: createTurtleEditorFrom(document.getElementById(exampleid + "-tab1validationquery")), CM1: createJSONLDEditorFrom(document.getElementById(exampleid + "-tab2validationquery"))}; | ||
editors[index] = obj; | ||
//editors[index].push({CM: createTurtleEditorFrom(document.getElementById(exampleid + "-tab1validationquery")}, CM2: createJSONLDEditorFrom(document.getElementById(exampleid + "-tab2validationquery")}); | ||
//editors[index].push({CM: createJSONLDEditorFrom(document.getElementById(exampleid + "-tab2validationquery")}); | ||
//editors[index][0] = createTurtleEditorFrom(document.getElementById(exampleid + "-tab1validationquery")); | ||
//editors[index][1] = createJSONLDEditorFrom(document.getElementById(exampleid + "-tab2validationquery")); | ||
|
||
$("#" + exampleid + "-tabs").tabs(); | ||
|
||
$("#" + exampleid + "-tabs a").on('click', function(e) { | ||
$('.CodeMirror').each(function(i, el){ | ||
el.CodeMirror.refresh(); | ||
}); | ||
}); | ||
|
||
path_to_file = folder + exampleid; | ||
loadFile(editors[index].CM0, path_to_file + ".ttl"); | ||
loadFile(editors[index].CM1, path_to_file + ".jsonld"); | ||
|
||
}); | ||
|
||
$("button.copyturtletoclipboard").on({ | ||
"click": function() { | ||
var exampleid = $(this).parent().parent().attr("exampleid"); | ||
var indexValues = $examples.map(function() { return this.id; }) ; | ||
var index = myIndexOf(indexValues, exampleid); | ||
texttocopy = editors[index].CM0.getValue() | ||
navigator.clipboard.writeText(texttocopy); | ||
$(this).tooltip({ items: "#" + this.id, content: "Copied !"}); | ||
$(this).tooltip("open"); | ||
}, | ||
"mouseout": function() { | ||
$(this).tooltip("disable"); | ||
} | ||
}); | ||
$("button.copyjsonldtoclipboard").on({ | ||
"click": function() { | ||
var exampleid = $(this).parent().parent().attr("exampleid"); | ||
var indexValues = $examples.map(function() { return this.id; }) ; | ||
var index = myIndexOf(indexValues, exampleid); | ||
texttocopy = editors[index].CM1.getValue(); | ||
navigator.clipboard.writeText(texttocopy); | ||
$(this).tooltip({ items: "#" + this.id, content: "Copied !"}); | ||
$(this).tooltip("open"); | ||
}, | ||
"mouseout": function() { | ||
$(this).tooltip("disable"); | ||
} | ||
}); | ||
$("button.openinplayground").on('click', function(e) { | ||
var exampleid = $(this).parent().parent().attr("exampleid"); | ||
var indexValues = $examples.map(function() { return this.id; }) ; | ||
var index = myIndexOf(indexValues, exampleid); | ||
|
||
newUrl = "https://json-ld.org/playground/#startTab=tab-expand&json-ld=" + editors[index].CM1.getValue(); | ||
window.open(encodeURI(newUrl), '_blank'); | ||
return false; | ||
}); | ||
|
||
$("div.CodeMirror pre").on('click', function(e) { | ||
var et = $(e.target); | ||
if(et.hasClass('cm-url')) { | ||
newUrl = $(this).text(); | ||
window.open(encodeURI(newUrl), '_blank'); | ||
return false; | ||
} | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"@context": { | ||
"Expression": "http://data.europa.eu/eli/ontology#Expression", | ||
"Request": "http://data.europa.eu/rrmv#Request", | ||
"Work": "http://data.europa.eu/eli/ontology#Work", | ||
"hasURI": { | ||
"@container": "@set", | ||
"@id": "http://data.europa.eu/eli/ontology#hasURI", | ||
"@type": "http://www.w3.org/2001/XMLSchema#anyURI" | ||
}, | ||
"isPartOf": { | ||
"@container": "@set", | ||
"@id": "http://purl.org/dc/terms/isPartOf", | ||
"@type": "@id" | ||
} | ||
|
||
}, | ||
"@id": "https://system.org/id/request/123", | ||
"@type": "http://data.europa.eu/rrmv#Request", | ||
"isPartOf": "http://data.europa.eu/eli/reg/2016/1011/oj" | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@prefix dct: <http://purl.org/dc/terms/> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
|
||
<https://system.org/id/request/123> a <http://data.europa.eu/rrmv#Request>; | ||
dct:isPartOf <http://data.europa.eu/eli/reg/2016/1011/oj> . |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.