diff --git a/db-server/init-data/forms/example-1.ttl b/db-server/init-data/forms/example-1.ttl index a065fb82..523424ba 100644 --- a/db-server/init-data/forms/example-1.ttl +++ b/db-server/init-data/forms/example-1.ttl @@ -1,4 +1,4 @@ -@prefix dc: . +@prefix dcterms: . @prefix doc: . @prefix ex1: . @prefix form: . @@ -53,7 +53,7 @@ ex1:answerable-section-with-advanced-switch a doc:question ; form:has-identifying-question "test-5279" ; form:has-preceding-question ex1:non-answerable-section-with-advanced-switch ; form:has-question-origin ex1:answerable-section-with-advanced-switch-qo ; - dc:source . + dcterms:source . ex1:first-name-9402 a doc:question ; rdfs:label "Jméno" ; @@ -174,7 +174,7 @@ ex1:ps-cin-452 a doc:question ; form-lt:has-layout-class "text" ; form:has-question-origin ex1:ps-cin-452-qo ; form:is-relevant-if ex1:provozovatel-pravnicka-osoba-condition ; - dc:description "Company identification number" . + dcterms:description "Company identification number" . ex1:ps-iq-452 a doc:question ; rdfs:label "IQ" ; @@ -229,13 +229,13 @@ ex1:test-field-3888 a doc:question ; rdfs:label "Field test" ; form-lt:has-layout-class "text" ; form:has-question-origin ex1:test-field-3888-qo ; - dc:source . + dcterms:source . ex1:test-field-3888-na a doc:question ; rdfs:label "Field test" ; form-lt:has-layout-class "text" ; form:has-question-origin ex1:test-field-3888-na-qo ; - dc:source . + dcterms:source . ex1:age-1063 a doc:question ; rdfs:label "Age" ; @@ -252,7 +252,7 @@ ex1:cena-6557 a doc:question ; form:has-preceding-question ex1:age-1063 ; form:has-question-origin ex1:cena-6557-qo ; form:has-unit-of-measure-question "mena-8088" ; - dc:description "Tohle je cena s měnou" . + dcterms:description "Tohle je cena s měnou" . ex1:non-answerable-section-with-advanced-switch a doc:question ; rdfs:label "Simple section with advanced switch" ; @@ -265,7 +265,7 @@ ex1:non-answerable-section-with-advanced-switch a doc:question ; form:has-identifying-question "test-5279-na" ; form:has-preceding-question ex1:test-section-666 ; form:has-question-origin ex1:non-answerable-section-with-advanced-switch-qo ; - dc:source . + dcterms:source . ex1:parent-section-1590 a doc:question ; rdfs:label "Vlastník" ; @@ -312,7 +312,7 @@ ex1:show-advanced-question-test-advanced-switch a doc:question ; form:has-timestamp "1636061441831" ] ; form:has-question-origin ex1:form-show-advanced-question ; form:show-advanced-question true ; - dc:description "Advanced switch test" . + dcterms:description "Advanced switch test" . ex1:show-advanced-question-test-advanced-switch-na a doc:question ; rdfs:label "Advanced switch test" ; @@ -327,7 +327,7 @@ ex1:show-advanced-question-test-advanced-switch-na a doc:question ; form:has-timestamp "1636065441831" ] ; form:has-question-origin ex1:form-show-advanced-question ; form:show-advanced-question true ; - dc:description "Advanced switch test" . + dcterms:description "Advanced switch test" . ex1:test-field-3887 a doc:question ; rdfs:label "Popis vlastníka" ; @@ -343,7 +343,7 @@ ex1:test-section-666 a doc:question ; form:has-identifying-question "test-5278" ; form:has-preceding-question ex1:parent-section-1590 ; form:has-question-origin ex1:test-section-666-qo ; - dc:description "test" . + dcterms:description "test" . ex1:title-7183 a doc:question ; rdfs:label "Titul" ; diff --git a/db-server/init-data/forms/example-2.ttl b/db-server/init-data/forms/example-2.ttl index f83b801c..e7d34d6f 100644 --- a/db-server/init-data/forms/example-2.ttl +++ b/db-server/init-data/forms/example-2.ttl @@ -1,4 +1,4 @@ -@prefix dc: . +@prefix dcterms: . @prefix doc: . @prefix ex2: . @prefix form: . @@ -53,7 +53,7 @@ ex2:answerable-section-with-advanced-switch a doc:question ; form:has-identifying-question "test-5279" ; form:has-preceding-question ex2:non-answerable-section-with-advanced-switch ; form:has-question-origin ex2:answerable-section-with-advanced-switch-qo ; - dc:source . + dcterms:source . ex2:first-name-9402 a doc:question ; rdfs:label "Jméno" ; @@ -174,7 +174,7 @@ ex2:ps-cin-452 a doc:question ; form-lt:has-layout-class "text" ; form:has-question-origin ex2:ps-cin-452-qo ; form:is-relevant-if ex2:provozovatel-pravnicka-osoba-condition ; - dc:description "Company identification number" . + dcterms:description "Company identification number" . ex2:ps-iq-452 a doc:question ; rdfs:label "IQ" ; @@ -229,13 +229,13 @@ ex2:test-field-3888 a doc:question ; rdfs:label "Field test" ; form-lt:has-layout-class "text" ; form:has-question-origin ex2:test-field-3888-qo ; - dc:source . + dcterms:source . ex2:test-field-3888-na a doc:question ; rdfs:label "Field test" ; form-lt:has-layout-class "text" ; form:has-question-origin ex2:test-field-3888-na-qo ; - dc:source . + dcterms:source . ex2:age-1063 a doc:question ; rdfs:label "Age" ; @@ -252,7 +252,7 @@ ex2:cena-6557 a doc:question ; form:has-preceding-question ex2:age-1063 ; form:has-question-origin ex2:cena-6557-qo ; form:has-unit-of-measure-question "mena-8088" ; - dc:description "Tohle je cena s měnou" . + dcterms:description "Tohle je cena s měnou" . ex2:non-answerable-section-with-advanced-switch a doc:question ; rdfs:label "Simple section with advanced switch" ; @@ -265,7 +265,7 @@ ex2:non-answerable-section-with-advanced-switch a doc:question ; form:has-identifying-question "test-5279-na" ; form:has-preceding-question ex2:test-section-666 ; form:has-question-origin ex2:non-answerable-section-with-advanced-switch-qo ; - dc:source . + dcterms:source . ex2:parent-section-1590 a doc:question ; rdfs:label "Vlastník" ; @@ -312,7 +312,7 @@ ex2:show-advanced-question-test-advanced-switch a doc:question ; form:has-timestamp "1636065441831" ] ; form:has-question-origin ex2:form-show-advanced-question ; form:show-advanced-question true ; - dc:description "Advanced switch test" . + dcterms:description "Advanced switch test" . ex2:show-advanced-question-test-advanced-switch-na a doc:question ; rdfs:label "Advanced switch test" ; @@ -327,7 +327,7 @@ ex2:show-advanced-question-test-advanced-switch-na a doc:question ; form:has-timestamp "1636061441831" ] ; form:has-question-origin ex2:form-show-advanced-question ; form:show-advanced-question true ; - dc:description "Advanced switch test" . + dcterms:description "Advanced switch test" . ex2:test-field-3887 a doc:question ; rdfs:label "Popis vlastníka" ; @@ -343,7 +343,7 @@ ex2:test-section-666 a doc:question ; form:has-identifying-question "test-5278" ; form:has-preceding-question ex2:parent-section-1590 ; form:has-question-origin ex2:test-section-666-qo ; - dc:description "test" . + dcterms:description "test" . ex2:title-7183 a doc:question ; rdfs:label "Titul" ; diff --git a/doc/form-template-shape.ttl b/doc/form-template-shape.ttl index aca22ca7..911ac73c 100644 --- a/doc/form-template-shape.ttl +++ b/doc/form-template-shape.ttl @@ -7,7 +7,7 @@ # 2. it is typed form:form-template # (http://onto.fel.cvut.cz/ontologies/form/form-template); # 3. it has an rdfs:label; -# 4. it has an rdfs:comment. +# 4. it has a dcterms:description. # # This shape enforces requirements (2)-(4) — the triple-level pattern. # Requirement (1), the named-graph constraint, cannot be expressed in core SHACL @@ -16,6 +16,7 @@ @prefix sh: . @prefix rdfs: . +@prefix dcterms: . @prefix form: . form:FormTemplateShape @@ -31,7 +32,7 @@ form:FormTemplateShape sh:message "A form template must have at least one rdfs:label; otherwise it is silently dropped from the form template listing." ; ] ; sh:property [ - sh:path rdfs:comment ; + sh:path dcterms:description ; sh:minCount 1 ; - sh:message "A form template must have at least one rdfs:comment; otherwise it is silently dropped from the form template listing." ; + sh:message "A form template must have at least one dcterms:description; otherwise it is silently dropped from the form template listing." ; ] . diff --git a/doc/form-templates.md b/doc/form-templates.md index df397274..b241d4e0 100644 --- a/doc/form-templates.md +++ b/doc/form-templates.md @@ -11,16 +11,17 @@ TTL files against it. ## Form template RDF pattern A valid form template is a named graph whose IRI is the template IRI, containing a -resource (the same IRI) typed `form:form-template` with a label and a comment: +resource (the same IRI) typed `form:form-template` with a label and a description: ```trig -@prefix rdfs: . -@prefix form: . +@prefix rdfs: . +@prefix dcterms: . +@prefix form: . { a form:form-template ; - rdfs:label "My template" ; - rdfs:comment "Description of the template" . + rdfs:label "My template" ; + dcterms:description "Description of the template" . } ``` @@ -33,10 +34,10 @@ A resource is recognized as a form template only when **all** of the following h same. Triples in the default graph or in a differently named graph are not seen. 2. **It is typed `form:form-template`** (`http://onto.fel.cvut.cz/ontologies/form/form-template`). 3. **It has an `rdfs:label`** (`http://www.w3.org/2000/01/rdf-schema#label`). -4. **It has an `rdfs:comment`** (`http://www.w3.org/2000/01/rdf-schema#comment`). +4. **It has a `dcterms:description`** (`http://purl.org/dc/terms/description`). -The query's `WHERE` clause requires the type, label, and comment **conjunctively**, so a -candidate **missing either the label or the comment is silently dropped** from the result +The query's `WHERE` clause requires the type, label, and description **conjunctively**, so a +candidate **missing either the label or the description is silently dropped** from the result — it does not appear even when correctly typed. The form-gen repository must also be a quad store (it must preserve named graphs) and expose a SPARQL endpoint that accepts a `query` parameter. @@ -51,7 +52,7 @@ pyshacl -s doc/form-template-shape.ttl -f human your-templates.ttl ``` The shape targets `form:form-template` resources and reports a violation when the -`rdfs:label` or `rdfs:comment` is missing. Resources not typed as templates are ignored, +`rdfs:label` or `dcterms:description` is missing. Resources not typed as templates are ignored, so the shape can be run against arbitrary TTL files. **Named-graph caveat:** SHACL validates the merged data graph, not graph names, so the diff --git a/src/main/resources/query/find-raw-records.sparql b/src/main/resources/query/find-raw-records.sparql index 55993433..71eefcdf 100644 --- a/src/main/resources/query/find-raw-records.sparql +++ b/src/main/resources/query/find-raw-records.sparql @@ -1,5 +1,4 @@ PREFIX av: -PREFIX dc: PREFIX doc: PREFIX form: PREFIX form-lt: diff --git a/src/main/resources/query/findFormTemplates.rq b/src/main/resources/query/findFormTemplates.rq index 4e37a57f..4598a0cd 100644 --- a/src/main/resources/query/findFormTemplates.rq +++ b/src/main/resources/query/findFormTemplates.rq @@ -1,14 +1,15 @@ -prefix rdfs: -prefix form: +prefix rdfs: +prefix dcterms: +prefix form: CONSTRUCT { ?formTemplate a form:form-template . ?formTemplate rdfs:label ?formTemplateLabel . - ?formTemplate rdfs:comment ?formTemplateComment . + ?formTemplate dcterms:description ?formTemplateDescription . } WHERE { GRAPH ?formTemplate { ?formTemplate a form:form-template . ?formTemplate rdfs:label ?formTemplateLabel . - ?formTemplate rdfs:comment ?formTemplateComment . + ?formTemplate dcterms:description ?formTemplateDescription . } } \ No newline at end of file