Skip to content

Commit

Permalink
support for sh:and / theming and documentation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
s-tittel committed Nov 1, 2023
1 parent 245d128 commit 13dc39f
Show file tree
Hide file tree
Showing 16 changed files with 271 additions and 157 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ data-shapes-url | When `data-shapes` is not set, the SHACL shapes are loaded fro
data-shape-subject | Optional subject (id) of the SHACL node shape to use as root for the form. If not set, the first found node shape will be used
data-values | RDF triples (e.g. a turtle string) to use as existing data graph to fill the form
data-values-url | When `data-values` is not set, the data graph 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 the root node in the data graph to fill the form
data-value-subject | The subject (id) of the generated data. If this is not set, a blank node with a new UUID is created. If `data-values` or `data-values-url` is set, this id is also used to find the root node 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`. Default is [`navigator.language`](https://www.w3schools.com/jsref/prop_nav_language.asp)
data-loading | Text to display while the web component is initializing. Default: `"Loading..."`
data‑ignore‑owl‑imports | By default, `owl:imports` URLs are fetched and the resulting RDF triples are added to the shapes graph. Setting this attribute to any value disables this feature
data-mode | When set to `"view"`, turns the web component into a viewer that displays the given data graph without editing functionality
data-collapse | When this attribute is present or set to any value, `sh:group`s and properties with `sh:node` and `sh:maxCount` > 1 are displayed in a collapsible accordion-like widget. This enhances readability in edit and view mode
data-collapse | When this attribute is present, `sh:group`s and properties with `sh:node` and `sh:maxCount` > 1 are displayed in a collapsible accordion-like widget to reduce visual complexity of the form. The collapsible element is initially shown closed, except when the attribute value is `"open"`
data-submit-button | [Only used in edit mode] 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
### Element functions
Expand Down Expand Up @@ -105,4 +105,4 @@ Default (custom CSS) | `import '@ulb-darmstadt/shacl-form/index.js'`
[Bootstrap](./src/themes/bootstrap.ts) [alpha status] | `import '@ulb-darmstadt/shacl-form/bootstrap.js'`
[Material Design](./src/themes/material.ts) [alpha status] | `import '@ulb-darmstadt/shacl-form/material.js'`
Custom themes can be employed by implementing class [Theme](./src/theme.ts), then activating it with function `setTheme()` on the `<shacl-form>` element.
Custom themes can be employed by extending class [Theme](./src/theme.ts), then calling function `setTheme()` on the `<shacl-form>` element.
184 changes: 92 additions & 92 deletions demo/datatypes.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,95 +5,95 @@
@prefix ex: <http://example.org/> .

ex:Demo a sh:NodeShape ;
sh:property [
sh:datatype xsd:string ;
sh:maxCount 1 ;
sh:name "simple string" ;
sh:path ex:mySimpleString
] ;
sh:property [
sh:datatype xsd:string ;
sh:maxCount 1 ;
sh:name "string with default" ;
sh:defaultValue "default value of string" ;
sh:path ex:mySimpleStringWithDefault
] ;
sh:property [
sh:datatype xsd:string ;
dash:singleLine false ;
sh:maxCount 1 ;
sh:name "multiline string" ;
sh:path ex:myMultilineString
] ;
sh:property [
sh:datatype xsd:date ;
sh:maxCount 1 ;
sh:name "date" ;
sh:path ex:myDate
] ;
sh:property [
sh:datatype xsd:dateTime ;
sh:maxCount 1 ;
sh:name "dateTime" ;
sh:path ex:myDateTime
] ;
sh:property [
sh:datatype xsd:boolean ;
#sh:minCount 1;
sh:maxCount 1 ;
sh:name "boolean" ;
sh:path ex:myBoolean ;
sh:order 1
] ;
sh:property [
sh:maxCount 1 ;
sh:name "list" ;
sh:path ex:myList ;
sh:in ( "option 1" "option 2" "option 3" ) ;
] ;
sh:property [
sh:datatype xsd:decimal ;
sh:maxCount 1 ;
sh:name "decimal" ;
sh:path ex:myDecimal ;
] ;
sh:property [
sh:datatype xsd:integer ;
sh:minInclusive 1 ;
sh:maxInclusive 5 ;
sh:maxCount 1 ;
sh:name "integer" ;
sh:path ex:myInteger ;
] ;
sh:property [
sh:datatype rdf:langString ;
sh:languageIn ( "en" "de" ) ;
sh:maxCount 1 ;
sh:name "langString 1" ;
sh:description "simple langString with fixed languages" ;
sh:path ex:myLangString1
] ;
sh:property [
sh:datatype rdf:langString ;
sh:languageIn ( "en" "de" ) ;
sh:maxCount 1 ;
sh:name "langString 2" ;
sh:description "multiline langString with fixed languages" ;
dash:singleLine false ;
sh:path ex:myLangString2
] ;
sh:property [
sh:datatype rdf:langString ;
sh:maxCount 1 ;
sh:name "langString 3" ;
sh:description "simple langString with no fixed languages" ;
sh:path ex:myLangString3
] ;
sh:property [
sh:datatype rdf:langString ;
sh:maxCount 1 ;
sh:name "langString 4" ;
sh:description "multiline langString with no fixed languages" ;
dash:singleLine false ;
sh:path ex:myLangString4
] .
sh:property [
sh:datatype xsd:string ;
sh:maxCount 1 ;
sh:name "simple string" ;
sh:path ex:mySimpleString
] ;
sh:property [
sh:datatype xsd:string ;
sh:maxCount 1 ;
sh:name "string with default" ;
sh:defaultValue "default value of string" ;
sh:path ex:mySimpleStringWithDefault
] ;
sh:property [
sh:datatype xsd:string ;
dash:singleLine false ;
sh:maxCount 1 ;
sh:name "multiline string" ;
sh:path ex:myMultilineString
] ;
sh:property [
sh:datatype xsd:date ;
sh:maxCount 1 ;
sh:name "date" ;
sh:path ex:myDate
] ;
sh:property [
sh:datatype xsd:dateTime ;
sh:maxCount 1 ;
sh:name "dateTime" ;
sh:path ex:myDateTime
] ;
sh:property [
sh:datatype xsd:boolean ;
#sh:minCount 1;
sh:maxCount 1 ;
sh:name "boolean" ;
sh:path ex:myBoolean ;
sh:order 1
] ;
sh:property [
sh:maxCount 1 ;
sh:name "list" ;
sh:path ex:myList ;
sh:in ( "option 1" "option 2" "option 3" ) ;
] ;
sh:property [
sh:datatype xsd:decimal ;
sh:maxCount 1 ;
sh:name "decimal" ;
sh:path ex:myDecimal ;
] ;
sh:property [
sh:datatype xsd:integer ;
sh:minInclusive 1 ;
sh:maxInclusive 5 ;
sh:maxCount 1 ;
sh:name "integer" ;
sh:path ex:myInteger ;
] ;
sh:property [
sh:datatype rdf:langString ;
sh:languageIn ( "en" "de" ) ;
sh:maxCount 1 ;
sh:name "langString 1" ;
sh:description "simple langString with fixed languages" ;
sh:path ex:myLangString1
] ;
sh:property [
sh:datatype rdf:langString ;
sh:languageIn ( "en" "de" ) ;
sh:maxCount 1 ;
sh:name "langString 2" ;
sh:description "multiline langString with fixed languages" ;
dash:singleLine false ;
sh:path ex:myLangString2
] ;
sh:property [
sh:datatype rdf:langString ;
sh:maxCount 1 ;
sh:name "langString 3" ;
sh:description "simple langString with no fixed languages" ;
sh:path ex:myLangString3
] ;
sh:property [
sh:datatype rdf:langString ;
sh:maxCount 1 ;
sh:name "langString 4" ;
sh:description "multiline langString with no fixed languages" ;
dash:singleLine false ;
sh:path ex:myLangString4
] .
Loading

0 comments on commit 13dc39f

Please sign in to comment.