-
Notifications
You must be signed in to change notification settings - Fork 0
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
Niels Hoffmann
committed
Dec 16, 2024
1 parent
00f9191
commit 5111758
Showing
3 changed files
with
62 additions
and
62 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
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 |
---|---|---|
@@ -1,58 +1,75 @@ | ||
<html> | ||
<head> | ||
<script type="importmap"> | ||
|
||
<head> | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"@ulb-darmstadt/shacl-form/": "https://cdn.jsdelivr.net/npm/@ulb-darmstadt/[email protected]/dist/" | ||
} | ||
} | ||
</script> | ||
<script type="module"> | ||
import '@ulb-darmstadt/shacl-form/form-default.js' | ||
import { registerPlugin } from '@ulb-darmstadt/shacl-form/form-default.js' | ||
import { LeafletPlugin } from '@ulb-darmstadt/shacl-form/plugins/leaflet.js' | ||
registerPlugin(new LeafletPlugin({ datatype: 'http://www.opengis.net/ont/geosparql#wktLiteral' })) | ||
</script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/vs.min.css"> | ||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script> | ||
<link rel="stylesheet" href="./style.css"> | ||
</head> | ||
<body> | ||
<div class="header"> | ||
<h1>demo - DCAT-AP-NL RDF genereren op basis van een formulier</h1> | ||
</div> | ||
<div class="main"> | ||
</div> | ||
<script type="module"> | ||
import '@ulb-darmstadt/shacl-form/form-default.js' | ||
import { registerPlugin } from '@ulb-darmstadt/shacl-form/form-default.js' | ||
import { LeafletPlugin } from '@ulb-darmstadt/shacl-form/plugins/leaflet.js' | ||
registerPlugin(new LeafletPlugin({ datatype: 'http://www.opengis.net/ont/geosparql#wktLiteral' })) | ||
</script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/vs.min.css"> | ||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script> | ||
<link rel="stylesheet" href="./style.css"> | ||
</head> | ||
|
||
<body> | ||
<div class="header"> | ||
<h1>demo - DCAT-AP-NL RDF genereren op basis van een formulier</h1> | ||
</div> | ||
<div class="main"> | ||
</div> | ||
|
||
|
||
<div class="wrapper"> | ||
<fieldset><legend>Input Formulier</legend><shacl-form id="shacl-form" data-submit-button data-collapse="open" data-values-subject="http://example.org/dataset/42" data-shape-subject="http://example.org/Dataset"></shacl-form></fieldset> | ||
|
||
<!-- <fieldset id="output"> --> | ||
<fieldset id="shacl-output"><legend>Output in Turtle formaat </legend><pre></pre></fieldset> | ||
<!-- </fieldset> --> | ||
<div class="wrapper"> | ||
<fieldset> | ||
<legend>Input Formulier</legend><shacl-form id="shacl-form" data-submit-button data-collapse="open" | ||
data-values-subject="http://example.org/dataset/42" | ||
data-shape-subject="http://example.org/Dataset"></shacl-form> | ||
</fieldset> | ||
|
||
<fieldset id="shacl-output"> | ||
<legend>Output in Turtle formaat </legend> | ||
<pre></pre> | ||
</fieldset> | ||
|
||
<div> | ||
<figure id="fig-overzicht-klassen"><img | ||
src="https://docs.geostandaarden.nl/dcat/dcat-ap-nl30/media/overzicht%20klassen.png" | ||
alt="Afbeelding met tekst" style="width: 100%;"> | ||
</figure> | ||
Met het formulier wordt metadata voor een Dataset, een Catalog Record en optioneel een Dataservice aangemaakt. De | ||
overige klassen worden in deze demo buiten beschouwing gelaten. | ||
</div> | ||
</div> | ||
<script> | ||
setTimeout(async () => { | ||
const form = document.getElementById("shacl-form") | ||
const output = document.getElementById("shacl-output") | ||
const shapesTTL = await fetch("dcat-ap-nl.ttl").then(resp => resp.text()) | ||
form.setClassInstanceProvider((clazz) => { | ||
if (clazz === 'http://purl.org/dc/terms/RightsStatement') { | ||
return ` | ||
setTimeout(async () => { | ||
const form = document.getElementById("shacl-form") | ||
const output = document.getElementById("shacl-output") | ||
const shapesTTL = await fetch("dcat-ap-nl.ttl").then(resp => resp.text()) | ||
form.setClassInstanceProvider((clazz) => { | ||
if (clazz === 'http://purl.org/dc/terms/RightsStatement') { | ||
return ` | ||
<http://publications.europa.eu/resource/authority/access-right/PUBLIC> a <http://purl.org/dc/terms/RightsStatement>; <http://www.w3.org/2000/01/rdf-schema#label> "Public". | ||
<http://publications.europa.eu/resource/authority/access-right/RESTRICTED> a <http://purl.org/dc/terms/RightsStatement>; <http://www.w3.org/2000/01/rdf-schema#label> "Restricted". | ||
<http://publications.europa.eu/resource/authority/access-right/NON-PUBLIC> a <http://purl.org/dc/terms/RightsStatement>; <http://www.w3.org/2000/01/rdf-schema#label> "Non-Public". | ||
` | ||
} | ||
}) | ||
form.addEventListener('change', (ev) => { | ||
output.classList.toggle('valid', ev.detail?.valid) | ||
output.classList.toggle('invalid', !ev.detail?.valid) | ||
output.querySelector("pre").innerText = form.serialize() | ||
}) | ||
form.dataset['shapes'] = shapesTTL | ||
} | ||
}) | ||
</script> | ||
</body> | ||
form.addEventListener('change', (ev) => { | ||
output.classList.toggle('valid', ev.detail?.valid) | ||
output.classList.toggle('invalid', !ev.detail?.valid) | ||
output.querySelector("pre").innerText = form.serialize() | ||
}) | ||
form.dataset['shapes'] = shapesTTL | ||
}) | ||
</script> | ||
</body> | ||
|
||
</html> |
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