From 433c56d88ccaae8ddd2c0ae7fbc6d1f38d251551 Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Wed, 22 Dec 2021 11:44:12 +0100
Subject: [PATCH] fix

---
 .../repository/common/findChildTitles.sparql  |  6 ++
 .../common/findEntityByLiteral.sparql         | 11 ++++
 .../repository/repository/getFdpIri.sparql    |  9 ---
 .../service/reset/shape-catalog.ttl           | 30 +++++++++
 .../service/reset/shape-dataset.ttl           | 44 +++++++++++++
 .../service/reset/shape-distribution.ttl      | 50 +++++++++++++++
 .../service/reset/shape-repository.ttl        | 40 ++++++++++++
 .../service/reset/shape-resource.ttl          | 64 +++++++++++++++++++
 8 files changed, 245 insertions(+), 9 deletions(-)
 create mode 100644 src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/common/findChildTitles.sparql
 create mode 100644 src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/common/findEntityByLiteral.sparql
 delete mode 100755 src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/repository/getFdpIri.sparql
 create mode 100644 src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-catalog.ttl
 create mode 100644 src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-dataset.ttl
 create mode 100644 src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-distribution.ttl
 create mode 100644 src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-repository.ttl
 create mode 100644 src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-resource.ttl

diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/common/findChildTitles.sparql b/src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/common/findChildTitles.sparql
new file mode 100644
index 0000000..1f2ef7e
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/common/findChildTitles.sparql
@@ -0,0 +1,6 @@
+prefix dct: <http://purl.org/dc/terms/>
+
+SELECT ?child ?title WHERE {
+	?parent ?relation ?child .
+	?child dct:title ?title .
+}
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/common/findEntityByLiteral.sparql b/src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/common/findEntityByLiteral.sparql
new file mode 100644
index 0000000..77e9907
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/common/findEntityByLiteral.sparql
@@ -0,0 +1,11 @@
+prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+prefix dct: <http://purl.org/dc/terms/>
+
+SELECT ?entity ?rdfType ?title ?description ?relationPredicate ?relationObject WHERE {
+  ?entity ?relationPredicate ?relationObject .
+  ?entity rdf:type ?rdfType .
+  ?entity dct:title ?title .
+  Optional { ?entity dct:description ?description }
+  filter isLiteral(?relationObject)
+  filter CONTAINS(LCASE(str(?relationObject)), LCASE(str(?query)))
+}
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/repository/getFdpIri.sparql b/src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/repository/getFdpIri.sparql
deleted file mode 100755
index 92c314a..0000000
--- a/src/main/resources/nl/dtls/fairdatapoint/database/rdf/repository/repository/getFdpIri.sparql
+++ /dev/null
@@ -1,9 +0,0 @@
-prefix r3d: <http://www.re3data.org/schema/3-0#>
-prefix dcterms: <http://purl.org/dc/terms/>
-
-SELECT DISTINCT ?fdp {         
-         
-  ?iri dcterms:isPartOf* ?fdp.  
-  ?fdp a r3d:Repository.
-
-}
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-catalog.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-catalog.ttl
new file mode 100644
index 0000000..6d823dd
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-catalog.ttl
@@ -0,0 +1,30 @@
+@prefix :         <http://fairdatapoint.org/> .
+@prefix dash:     <http://datashapes.org/dash#> .
+@prefix dcat:     <http://www.w3.org/ns/dcat#> .
+@prefix dct:      <http://purl.org/dc/terms/> .
+@prefix foaf:     <http://xmlns.com/foaf/0.1/> .
+@prefix sh:       <http://www.w3.org/ns/shacl#> .
+
+:CatalogShape a sh:NodeShape ;
+  sh:targetClass dcat:Catalog ;
+  sh:property [
+    sh:path dct:issued ;
+    sh:datatype xsd:dateTime ;
+    sh:maxCount 1 ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path dct:modified ;
+    sh:datatype xsd:dateTime ;
+    sh:maxCount 1 ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path foaf:homePage ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ], [
+    sh:path dcat:themeTaxonomy ;
+    sh:nodeKind sh:IRI ;
+    dash:viewer dash:LabelViewer ;
+  ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-dataset.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-dataset.ttl
new file mode 100644
index 0000000..a47a56a
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-dataset.ttl
@@ -0,0 +1,44 @@
+@prefix :         <http://fairdatapoint.org/> .
+@prefix dash:     <http://datashapes.org/dash#> .
+@prefix dcat:     <http://www.w3.org/ns/dcat#> .
+@prefix dct:      <http://purl.org/dc/terms/> .
+@prefix sh:       <http://www.w3.org/ns/shacl#> .
+
+:DatasetShape a sh:NodeShape ;
+  sh:targetClass dcat:Dataset ;
+  sh:property [
+    sh:path dct:issued ;
+    sh:datatype xsd:dateTime ;
+    sh:maxCount 1 ;
+    dash:editor dash:DatePickerEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path dct:modified ;
+    sh:datatype xsd:dateTime ;
+    sh:maxCount 1 ;
+    dash:editor dash:DatePickerEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ],  [
+    sh:path dcat:theme ;
+    sh:nodeKind sh:IRI ;
+    sh:minCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ], [
+    sh:path dcat:contactPoint ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ], [
+    sh:path dcat:keyword ;
+    sh:nodeKind sh:Literal ;
+    dash:editor dash:TextFieldEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path dcat:landingPage ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-distribution.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-distribution.ttl
new file mode 100644
index 0000000..a26eae1
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-distribution.ttl
@@ -0,0 +1,50 @@
+@prefix :         <http://fairdatapoint.org/> .
+@prefix dash:     <http://datashapes.org/dash#> .
+@prefix dcat:     <http://www.w3.org/ns/dcat#> .
+@prefix dct:      <http://purl.org/dc/terms/> .
+@prefix sh:       <http://www.w3.org/ns/shacl#> .
+
+:DistributionShape a sh:NodeShape ;
+  sh:targetClass dcat:Distribution ;
+  sh:property [
+    sh:path dct:issued ;
+    sh:datatype xsd:dateTime ;
+    sh:maxCount 1 ;
+    dash:editor dash:DatePickerEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path dct:modified ;
+    sh:datatype xsd:dateTime ;
+    sh:maxCount 1 ;
+    dash:editor dash:DatePickerEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path dcat:accessURL ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+  ], [
+    sh:path dcat:downloadURL ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+  ], [
+    sh:path dcat:mediaType ;
+    sh:nodeKind sh:Literal ;
+    sh:minCount 1 ;
+    sh:maxCount 1 ;
+    dash:editor dash:TextFieldEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path dcat:format ;
+    sh:nodeKind sh:Literal ;
+    sh:maxCount 1 ;
+    dash:editor dash:TextFieldEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path dcat:byteSize ;
+    sh:nodeKind sh:Literal ;
+    sh:maxCount 1 ;
+    dash:editor dash:TextFieldEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-repository.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-repository.ttl
new file mode 100644
index 0000000..29ade85
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-repository.ttl
@@ -0,0 +1,40 @@
+@prefix :         <http://fairdatapoint.org/> .
+@prefix dash:     <http://datashapes.org/dash#> .
+@prefix dct:      <http://purl.org/dc/terms/> .
+@prefix r3d:      <http://www.re3data.org/schema/3-0#> .
+@prefix sh:       <http://www.w3.org/ns/shacl#> .
+@prefix xsd:      <http://www.w3.org/2001/XMLSchema#> .
+
+:RepositoryShape a sh:NodeShape ;
+  sh:targetClass r3d:Repository ;
+  sh:property [
+    sh:path dct:references ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ], [
+    sh:path r3d:institution ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ], [
+    sh:path r3d:startDate ;
+    sh:datatype xsd:dateTime ;
+    sh:maxCount 1 ;
+    dash:editor dash:DatePickerEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path r3d:lastUpdate ;
+    sh:datatype xsd:dateTime ;
+    sh:maxCount 1 ;
+    dash:editor dash:DatePickerEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path r3d:institutionCountry ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-resource.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-resource.ttl
new file mode 100644
index 0000000..7e8c3cc
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-resource.ttl
@@ -0,0 +1,64 @@
+@prefix :         <http://fairdatapoint.org/> .
+@prefix dash:     <http://datashapes.org/dash#> .
+@prefix dcat:     <http://www.w3.org/ns/dcat#> .
+@prefix dct:      <http://purl.org/dc/terms/> .
+@prefix foaf:     <http://xmlns.com/foaf/0.1/> .
+@prefix sh:       <http://www.w3.org/ns/shacl#> .
+@prefix xsd:      <http://www.w3.org/2001/XMLSchema#> .
+
+:ResourceShape a sh:NodeShape ;
+  sh:targetClass dcat:Resource ;
+  sh:property [
+    sh:path dct:title ;
+    sh:nodeKind sh:Literal ;
+    sh:minCount 1 ;
+    sh:maxCount  1 ;
+    dash:editor dash:TextFieldEditor ;
+  ], [
+    sh:path dct:description ;
+    sh:nodeKind sh:Literal ;
+    sh:maxCount 1 ;
+    dash:editor dash:TextAreaEditor ;
+  ], [
+    sh:path dct:publisher ;
+    sh:node :AgentShape ;
+    sh:minCount 1 ;
+    sh:maxCount 1 ;
+    dash:editor dash:BlankNodeEditor ;
+  ], [
+    sh:path dct:hasVersion ;
+    sh:name "version" ;
+    sh:nodeKind sh:Literal ;
+    sh:minCount 1 ;
+    sh:maxCount 1 ;
+    dash:editor dash:TextFieldEditor ;
+    dash:viewer dash:LiteralViewer ;
+  ], [
+    sh:path dct:language ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ], [
+    sh:path dct:license ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ], [
+    sh:path dct:rights ;
+    sh:nodeKind sh:IRI ;
+    sh:maxCount 1 ;
+    dash:editor dash:URIEditor ;
+    dash:viewer dash:LabelViewer ;
+  ] .
+
+:AgentShape a sh:NodeShape ;
+  sh:targetClass foaf:Agent ;
+  sh:property [
+    sh:path foaf:name ;
+    sh:nodeKind sh:Literal ;
+    sh:minCount 1 ;
+    sh:maxCount 1 ;
+    dash:editor dash:TextFieldEditor ;
+  ] .
-- 
GitLab