diff --git a/README.md b/README.md index 0b03caa..8f2f469 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ data-shape-subject | Optional subject (id) of the SHACL node shape to use as roo data-values | RDF triples (e.g. a turtle string) to use as existing data values to fill the form data-values-url | When `data-values` is not set, the data triples are loaded from this URL data-value-subject | The subject (id) of the generated data. If this is not set, a blank node with a new UUID will be used. If `data-values` or `data-values-url` is set, this id is also used to find existing data in the data graph to fill the form -data-language | Language to use if shapes contain langStrings, e.g. in `sh:name` or `rdfs:label` +data-language | Language to use if shapes contain langStrings, e.g. in `sh:name` or `rdfs:label`. Default is [`navigator.language`](https://www.w3schools.com/jsref/prop_nav_language.asp) data‑ignore‑owl‑imports | By default, `owl:imports` IRIs are fetched and the resulting triples added to the shapes graph. Set this attribute to any value in order to disable this feature data-submit-button | Whether to add a submit button to the form. The value of this attribute is used as the button label. `submit` events will only fire after successful validation diff --git a/demo/complex-example-data.ttl b/demo/complex-example-data.ttl index 8ddea3d..9e02adc 100644 --- a/demo/complex-example-data.ttl +++ b/demo/complex-example-data.ttl @@ -9,24 +9,24 @@ @prefix prov: . example:4f2a8de3-9fc8-40a9-9237-d5964520ec54 - a dcat:Dataset, example:ArchitectureModelDataset ; - dcterms:title "Einsteinturm"@de, "Einstein Tower"@en ; - dcterms:description "Modell des Einsteinturms"@de, "Model of the Einstein Tower"@en ; - dcterms:issued "2023-07-27"^^xsd:date ; - dcterms:license ; - schema:artworkSurface example:wood ; - schema:width 200 ; - dcterms:spatial [ - a dcterms:Location ; - geo:asWKT "POLYGON((13.06382134836241 52.37900504575066,13.063796707503286 52.37896794299019,13.063798350228126 52.37875635638159,13.063926482692182 52.37875435081642,13.0639281254158 52.378964934657034,13.063905127281544 52.37900404297392,13.06382134836241 52.37900504575066))"^^geo:wktLiteral ; - dcterms:description "Building has been realized here" ; - ] ; - prov:qualifiedAttribution [ - a prov:Attribution ; - prov:agent [ - a foaf:Person ; - foaf:name "Jane Doe"; - dcterms:identifier "https://orcid.org/0000-0002-1584-4316" ; - ] ; - dcat:hadRole ; - ] . + a dcat:Dataset, example:ArchitectureModelDataset ; + dcterms:title "Einsteinturm"@de, "Einstein Tower"@en ; + dcterms:description "Modell des Einsteinturms"@de, "Model of the Einstein Tower"@en ; + dcterms:issued "2023-07-27"^^xsd:date ; + dcterms:license ; + schema:artworkSurface example:plaster ; + schema:width 200 ; + dcterms:spatial [ + a dcterms:Location ; + geo:asWKT "POLYGON((13.06382134836241 52.37900504575066,13.063796707503286 52.37896794299019,13.063798350228126 52.37875635638159,13.063926482692182 52.37875435081642,13.0639281254158 52.378964934657034,13.063905127281544 52.37900404297392,13.06382134836241 52.37900504575066))"^^geo:wktLiteral ; + dcterms:description "Building has been realized here" ; + ] ; + prov:qualifiedAttribution [ + a prov:Attribution ; + prov:agent [ + a foaf:Person ; + foaf:name "Jane Doe"; + dcterms:identifier "https://orcid.org/0000-0002-1584-4316" ; + ] ; + dcat:hadRole ; + ] . diff --git a/demo/complex-example.ttl b/demo/complex-example.ttl index 0d0580d..8eb8f73 100644 --- a/demo/complex-example.ttl +++ b/demo/complex-example.ttl @@ -14,166 +14,171 @@ @prefix example: . example:ArchitectureModelDataset - a sh:NodeShape ; - sh:node example:Dataset ; + a sh:NodeShape ; + sh:node example:Dataset ; - sh:property [ sh:description "Location of the building" ; - sh:name "Location" ; - sh:node example:Location ; - sh:path dcterms:spatial - ] ; - sh:property [ sh:datatype xsd:integer ; - sh:description "Width [mm] of the model" ; - sh:group example:PhysicalPropertiesGroup ; - sh:maxCount 1 ; - sh:minInclusive 1 ; - sh:name "Width" ; - sh:path schema:width - ] ; - sh:property [ sh:datatype xsd:integer ; - sh:description "Height [mm] of the model" ; - sh:group example:PhysicalPropertiesGroup ; - sh:maxCount 1 ; - sh:minInclusive 1 ; - sh:name "Height" ; - sh:path schema:height - ] ; - sh:property [ sh:datatype xsd:integer ; - sh:description "Depth [mm] of the model" ; - sh:group example:PhysicalPropertiesGroup ; - sh:maxCount 1 ; - sh:minInclusive 1 ; - sh:name "Depth" ; - sh:path schema:depth - ] ; - sh:property [ sh:datatype xsd:string ; - sh:description "Scale of the model, e.g. 1:20" ; - sh:group example:PhysicalPropertiesGroup ; - sh:maxCount 1 ; - sh:name "Scale" ; - sh:path dbpedia:scale ; - sh:pattern "^\\d+:\\d+$" - ] ; - sh:property [ sh:description "Material used with this model"@en , "Beim Bau des Modells verwendetes Material"@de ; - sh:group example:PhysicalPropertiesGroup ; - sh:name "Artwork material" ; - sh:path schema:artworkSurface ; - sh:class example:Material ; - ] . + sh:property [ sh:description "Location of the building" ; + sh:name "Location" ; + sh:node example:Location ; + sh:path dcterms:spatial + ] ; + sh:property [ sh:datatype xsd:integer ; + sh:description "Width [mm] of the model" ; + sh:group example:PhysicalPropertiesGroup ; + sh:maxCount 1 ; + sh:minInclusive 1 ; + sh:name "Width" ; + sh:path schema:width + ] ; + sh:property [ sh:datatype xsd:integer ; + sh:description "Height [mm] of the model" ; + sh:group example:PhysicalPropertiesGroup ; + sh:maxCount 1 ; + sh:minInclusive 1 ; + sh:name "Height" ; + sh:path schema:height + ] ; + sh:property [ sh:datatype xsd:integer ; + sh:description "Depth [mm] of the model" ; + sh:group example:PhysicalPropertiesGroup ; + sh:maxCount 1 ; + sh:minInclusive 1 ; + sh:name "Depth" ; + sh:path schema:depth + ] ; + sh:property [ sh:datatype xsd:string ; + sh:description "Scale of the model, e.g. 1:20" ; + sh:group example:PhysicalPropertiesGroup ; + sh:maxCount 1 ; + sh:name "Scale" ; + sh:path dbpedia:scale ; + sh:pattern "^\\d+:\\d+$" + ] ; + sh:property [ sh:description "Material used with this model"@en , "Beim Bau des Modells verwendetes Material"@de ; + sh:group example:PhysicalPropertiesGroup ; + sh:name "Artwork material" ; + sh:path schema:artworkSurface ; + sh:class example:Material ; + ] . example:Dataset - a sh:NodeShape ; - sh:property [ sh:datatype rdf:langString ; - sh:languageIn ( "en" "de" ) ; - sh:uniqueLang true ; - sh:description "The name of the dataset" , "Der Name des Datensatzes"@de ; - sh:minCount 1 ; - sh:maxCount 2 ; - sh:name "Name" ; - sh:path dcterms:title - ] ; - sh:property [ dash:singleLine false ; - sh:datatype rdf:langString ; - sh:languageIn ( "en" "de" ) ; - sh:uniqueLang true ; - sh:description "Description of the dataset" ; - sh:minCount 1 ; - sh:maxCount 2 ; - sh:name "Description" ; - sh:path dcterms:description - ] ; - sh:property [ sh:description "License of the dataset" ; - sh:maxCount 1 ; - sh:minCount 1 ; - sh:name "License" ; - sh:nodeKind sh:IRI ; - sh:path dcterms:license ; - sh:in ( - # see below how labels are added to the list entries - - - ) - ] ; - sh:property [ sh:datatype xsd:date ; - sh:description "Date when this dataset has been issued" ; - sh:maxCount 1 ; - sh:minCount 1 ; - sh:name "Issued" ; - sh:path dcterms:issued - ] ; - sh:property [ sh:name "Attribution" ; - sh:node example:Attribution ; - sh:path prov:qualifiedAttribution - ] ; - sh:targetClass dcat:Dataset . + a sh:NodeShape ; + sh:property [ sh:datatype rdf:langString ; + sh:languageIn ( "en" "de" ) ; + sh:uniqueLang true ; + sh:description "The name of the dataset" , "Der Name des Datensatzes"@de ; + sh:minCount 1 ; + sh:maxCount 2 ; + sh:name "Name" ; + sh:path dcterms:title + ] ; + sh:property [ dash:singleLine false ; + sh:datatype rdf:langString ; + sh:languageIn ( "en" "de" ) ; + sh:uniqueLang true ; + sh:description "Description of the dataset" ; + sh:minCount 1 ; + sh:maxCount 2 ; + sh:name "Description" ; + sh:path dcterms:description + ] ; + sh:property [ sh:description "License of the dataset" ; + sh:maxCount 1 ; + sh:minCount 1 ; + sh:name "License" ; + sh:nodeKind sh:IRI ; + sh:path dcterms:license ; + sh:in ( + # see below how labels are added to the list entries + + + ) + ] ; + sh:property [ sh:datatype xsd:date ; + sh:description "Date when this dataset has been issued" ; + sh:maxCount 1 ; + sh:minCount 1 ; + sh:name "Issued" ; + sh:path dcterms:issued + ] ; + sh:property [ sh:name "Attribution" ; + sh:node example:Attribution ; + sh:path prov:qualifiedAttribution + ] ; + sh:targetClass dcat:Dataset . example:PhysicalPropertiesGroup - a sh:PropertyGroup ; - rdfs:label "Physical properties" . + a sh:PropertyGroup ; + rdfs:label "Physical properties" . example:Location - a sh:NodeShape ; - rdfs:label "Location" ; - sh:property [ sh:datatype geo:wktLiteral ; - sh:description "Format WKT, e.g. POINT(8.65 49.87)" ; - sh:maxCount 1 ; - sh:minCount 1 ; - sh:name "Coordinates" ; - sh:path geo:asWKT ; - sh:pattern "^POINT\\([+\\-]?(?:[0-9]*[.])?[0-9]+ [+\\-]?(?:[0-9]*[.])?[0-9]+\\)|POLYGON\\(\\((?:[+\\-]?(?:[0-9]*[.])?[0-9]+[ ,]?){3,}\\)\\)$" - ] ; - sh:property [ sh:description "Description of the location" ; - sh:maxCount 1 ; - sh:name "Description" ; - sh:path dcterms:description - ] ; - sh:targetClass dcterms:Location . + a sh:NodeShape ; + rdfs:label "Location" ; + sh:property [ sh:datatype geo:wktLiteral ; + sh:description "Format WKT, e.g. POINT(8.65 49.87)" ; + sh:maxCount 1 ; + sh:minCount 1 ; + sh:name "Coordinates" ; + sh:path geo:asWKT ; + sh:pattern "^POINT\\([+\\-]?(?:[0-9]*[.])?[0-9]+ [+\\-]?(?:[0-9]*[.])?[0-9]+\\)|POLYGON\\(\\((?:[+\\-]?(?:[0-9]*[.])?[0-9]+[ ,]?){3,}\\)\\)$" + ] ; + sh:property [ sh:description "Description of the location" ; + sh:maxCount 1 ; + sh:name "Description" ; + sh:path dcterms:description + ] ; + sh:targetClass dcterms:Location . example:Person - a sh:NodeShape ; - rdfs:label "Person" ; - sh:property [ sh:maxCount 1 ; - sh:minCount 1 ; - sh:name "Name" ; - sh:path foaf:name - ] ; - sh:property [ sh:datatype xsd:string ; - sh:maxCount 1 ; - sh:name "ORCID ID" ; - sh:path dcterms:identifier ; - sh:pattern "^https://orcid.org/\\d{4}-\\d{4}-\\d{4}-\\d{4}$" - ] ; - sh:targetClass foaf:Person . + a sh:NodeShape ; + rdfs:label "Person" ; + sh:property [ sh:maxCount 1 ; + sh:minCount 1 ; + sh:name "Name" ; + sh:path foaf:name + ] ; + sh:property [ sh:datatype xsd:string ; + sh:maxCount 1 ; + sh:name "ORCID ID" ; + sh:path dcterms:identifier ; + sh:pattern "^https://orcid.org/\\d{4}-\\d{4}-\\d{4}-\\d{4}$" + ] ; + sh:targetClass foaf:Person . example:Organisation - a sh:NodeShape ; - rdfs:label "Organisation" ; - sh:property [ sh:maxCount 1 ; - sh:minCount 1 ; - sh:name "Name" ; - sh:path foaf:name - ] ; - sh:targetClass foaf:Organisation . + a sh:NodeShape ; + rdfs:label "Organisation" ; + sh:property [ sh:maxCount 1 ; + sh:minCount 1 ; + sh:name "Name" ; + sh:path foaf:name + ] ; + sh:property [ sh:name "Address" ; + sh:path example:Address + ] ; + sh:targetClass foaf:Organisation . example:Attribution - a sh:NodeShape ; - # load an external taxonomy, which will be added to the shapes graph. In this case, the taxonomy provides class instances of prov:Role. - owl:imports ; + a sh:NodeShape ; + # Import an external taxonomy to the shapes graph. + # In this case, the taxonomy provides class instances of prov:Role, + # which will be displayed in a dropdown to select from. + owl:imports ; - sh:property [ sh:maxCount 1 ; - sh:minCount 1 ; - sh:path prov:agent ; - sh:or ( - [ sh:node example:Person ; rdfs:label "Person" ] - [ sh:node example:Organisation ; rdfs:label "Organisation" ] - ) - ] ; - sh:property [ sh:name "Role" ; - sh:minCount 1 ; - sh:path dcat:hadRole ; - sh:class prov:Role - ] ; - sh:targetClass prov:Attribution . + sh:property [ sh:maxCount 1 ; + sh:minCount 1 ; + sh:path prov:agent ; + sh:or ( + [ sh:node example:Person ; rdfs:label "Person" ] + [ sh:node example:Organisation ; rdfs:label "Organisation" ] + ) + ] ; + sh:property [ sh:name "Role" ; + sh:minCount 1 ; + sh:path dcat:hadRole ; + sh:class prov:Role + ] ; + sh:targetClass prov:Attribution . # add a label to the license IRIs rdfs:label "CC-BY" . diff --git a/demo/index.html b/demo/index.html index e72d97c..e22a598 100644 --- a/demo/index.html +++ b/demo/index.html @@ -6,16 +6,17 @@ <shacl-form> demo - + + @@ -70,9 +71,9 @@

<shacl-form> demo