Skip to content

Commit 8beb370

Browse files
committed
Add CDI previewer with SHACL shapes support
- Add CdiPreview.html with edit/save functionality - Implement cdi.js with SHACL form rendering and Dataverse API integration - Include shacl-form library (ES module) for form rendering - Add official CDIF-Discovery-Core-Shapes.ttl from Cross-Domain Interoperability Framework - Support view and edit modes with API token authentication - Add MIME type: application/ld+json with DDI-CDI profile - Add registration commands to 5.2curlcommands.md and 6.1curlcommands.md - Update README.md with contributor acknowledgment - Add internationalization support (en, es, fr)
1 parent 99c2331 commit 8beb370

10 files changed

Lines changed: 1547 additions & 1 deletion

File tree

5.2curlcommands.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,31 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
852852
}'
853853
```
854854

855+
### CDI Previewer
856+
857+
```bash
858+
curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \
859+
'{
860+
"displayName":"View CDI Metadata",
861+
"description":"View DDI Cross-Domain Integration (CDI) metadata file using SHACL shapes.",
862+
"toolName":"cdiPreviewer",
863+
"scope":"file",
864+
"types":["preview"],
865+
"toolUrl":"https://gdcc.github.io/dataverse-previewers/previewers/betatest/CdiPreview.html",
866+
"toolParameters": {
867+
"queryParameters":[
868+
{"fileid":"{fileId}"},
869+
{"siteUrl":"{siteUrl}"},
870+
{"key":"{apiToken}"},
871+
{"datasetid":"{datasetId}"},
872+
{"datasetversion":"{datasetVersion}"},
873+
{"locale":"{localeCode}"}
874+
]
875+
},
876+
"contentType":"application/ld+json; profile=\"http://www.w3.org/ns/json-ld#flattened http://www.w3.org/ns/json-ld#compacted https://ddialliance.org/Specification/DDI-CDI/1.0\""
877+
}'
878+
```
879+
855880
### 3D model Previewer using X_ITE X3D
856881

857882
__Note:__ There are many mimetypes that can be rendered as 3D models. The following example is for X3D files. You can add more mimetypes by adding more entries to the "contentType" field.

6.1curlcommands.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,50 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
14951495
}'
14961496
```
14971497

1498+
### CDI Previewer
1499+
1500+
```bash
1501+
curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \
1502+
'{
1503+
"displayName":"View CDI Metadata",
1504+
"description":"View DDI Cross-Domain Integration (CDI) metadata file using SHACL shapes.",
1505+
"toolName":"cdiPreviewer",
1506+
"scope":"file",
1507+
"types":["preview"],
1508+
"toolUrl":"https://gdcc.github.io/dataverse-previewers/previewers/betatest/CdiPreview.html",
1509+
"toolParameters": {
1510+
"queryParameters":[
1511+
{"fileid":"{fileId}"},
1512+
{"siteUrl":"{siteUrl}"},
1513+
{"datasetid":"{datasetId}"},
1514+
{"datasetversion":"{datasetVersion}"},
1515+
{"locale":"{localeCode}"}
1516+
]
1517+
},
1518+
"contentType":"application/ld+json; profile=\"http://www.w3.org/ns/json-ld#flattened http://www.w3.org/ns/json-ld#compacted https://ddialliance.org/Specification/DDI-CDI/1.0\"",
1519+
"allowedApiCalls": [
1520+
{
1521+
"name": "retrieveFileContents",
1522+
"httpMethod": "GET",
1523+
"urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=true",
1524+
"timeOut": 3600
1525+
},
1526+
{
1527+
"name": "downloadFile",
1528+
"httpMethod": "GET",
1529+
"urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=false",
1530+
"timeOut": 3600
1531+
},
1532+
{
1533+
"name": "getDatasetVersionMetadata",
1534+
"httpMethod": "GET",
1535+
"urlTemplate": "/api/v1/datasets/{datasetId}/versions/{datasetVersion}",
1536+
"timeOut": 3600
1537+
}
1538+
]
1539+
}'
1540+
```
1541+
14981542
### 3D model Previewer using X_ITE X3D
14991543

15001544
__Note:__ There are many mimetypes that can be rendered as 3D models. The following example is for X3D files. You can add more mimetypes by adding more entries to the "contentType" field.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The Spreadsheet Previewer was contributed by [anncie-pcss](https://github.com/an
8484

8585
[Max Planck Digital Library](https://github.com/MPDL) contributed the ZIP Previewer.
8686

87-
[erykkul](https://github.com/erykkul) contributed the Markdown (MD) Previewer and the RO-Crate previewer.
87+
[erykkul](https://github.com/erykkul) contributed the Markdown (MD) Previewer, the RO-Crate previewer, and the CDI (DDI Cross-Domain Integration) previewer. The CDI previewer uses [SHACL shapes](https://www.w3.org/TR/shacl/) from the [Cross-Domain Interoperability Framework](https://github.com/Cross-Domain-Interoperability-Framework/validation) and the [shacl-form](https://github.com/ULB-Darmstadt/shacl-form) library to render DDI-CDI metadata according to official standards.
8888

8989
[Jan Range](https://github.com/JR-1991) contributed the H5Web Previewer, Rich Html Previewer.
9090

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<html>
2+
3+
<head>
4+
<meta charset="utf-8">
5+
<title class="cdiPreviewText">CDI Preview</title>
6+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
7+
<script type="text/javascript" src="js/xss.js"></script>
8+
<script type="module" src="js/shacl-form.js"></script>
9+
<script src="lib/jquery.i18n.js"></script>
10+
<script src="lib/jquery.i18n.messagestore.js"></script>
11+
<script src="lib/jquery.i18n.language.js"></script>
12+
<script type="text/javascript" src="js/retriever.js"></script>
13+
<script type="text/javascript" src="js/cdi.js"></script>
14+
<!-- Latest compiled and minified CSS -->
15+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
16+
integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
17+
<!-- Optional theme -->
18+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css"
19+
integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">
20+
<link type="text/css" rel="stylesheet" href="css/preview.css" />
21+
<style>
22+
.cdi-form-container {
23+
margin-top: 20px;
24+
padding: 15px;
25+
background-color: #f9f9f9;
26+
border: 1px solid #ddd;
27+
border-radius: 4px;
28+
}
29+
30+
.preview-info {
31+
padding: 15px;
32+
background-color: #d9edf7;
33+
border: 1px solid #bce8f1;
34+
border-radius: 4px;
35+
margin-bottom: 20px;
36+
color: #31708f;
37+
}
38+
39+
.preview-info p {
40+
margin: 5px 0;
41+
}
42+
43+
.preview-info strong {
44+
font-size: 1.2em;
45+
}
46+
47+
shacl-form {
48+
display: block;
49+
width: 100%;
50+
}
51+
</style>
52+
</head>
53+
54+
<body class="container">
55+
<main><img id='logo' alt='Site Logo'>
56+
<h1 class="page-title cdiPreviewText">CDI Preview</h1>
57+
58+
<!-- Edit/Save toolbar -->
59+
<div class="edit-toolbar" style="margin-bottom: 20px; padding: 15px; background-color: #f5f5f5; border: 1px solid #ddd; border-radius: 4px; display: none;">
60+
<div class="row">
61+
<div class="col-md-6">
62+
<div class="form-group">
63+
<label for="api-token-input">API Token (required for saving):</label>
64+
<input type="password" id="api-token-input" class="form-control" placeholder="Enter your Dataverse API token">
65+
<small class="help-block">Your API token is required to save changes back to Dataverse.</small>
66+
</div>
67+
</div>
68+
<div class="col-md-6" style="padding-top: 25px;">
69+
<button id="toggle-edit-btn" class="btn btn-primary">
70+
<span class="glyphicon glyphicon-edit"></span> Enable Editing
71+
</button>
72+
<button id="save-btn" class="btn btn-success" style="display: none;">
73+
<span class="glyphicon glyphicon-floppy-disk"></span> Save Changes
74+
</button>
75+
<span id="save-status" style="margin-left: 10px;"></span>
76+
</div>
77+
</div>
78+
</div>
79+
80+
<div class='preview-container'>
81+
<div class='preview-header'></div>
82+
<div class='preview'></div>
83+
</div>
84+
</main>
85+
</body>
86+
87+
</html>

previewers/betatest/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"mdPreviewText": "Markdown Preview",
2323
"ncmlPreviewText": "NcML Preview",
2424
"rocratePreviewText": "RO-Crate Preview",
25+
"cdiPreviewText": "CDI Preview",
2526
"prev": "Previous",
2627
"next": "Next",
2728
"pageText": "Page:",

previewers/betatest/i18n/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"mdPreviewText": "Previsualización de Markdown",
2222
"ncmlPreviewText": "Previsualización de NcML",
2323
"rocratePreviewText": "Previsualización de RO-Crate",
24+
"cdiPreviewText": "Previsualización de CDI",
2425
"prev": "Anterior",
2526
"next": "Siguiente",
2627
"pageText": "Página:",

previewers/betatest/i18n/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"mdPreviewText": "Aperçu Markdown",
2323
"ncmlPreviewText": "Aperçu NcML",
2424
"rocratePreviewText": "Aperçu RO-Crate",
25+
"cdiPreviewText": "Aperçu CDI",
2526
"prev": "Précédent",
2627
"next": "Suivant",
2728
"pageText": "Page:",

0 commit comments

Comments
 (0)