@ulb-darmstadt/shacl-form 1.5.2 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,7 +70,7 @@ data-view | When set, turns the web component into a viewer that displays the gi
70
70
  data-collapse | When set, `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 this attribute's value is `"open"`
71
71
  data-submit-button | [Ignored when `data-view` attribute is set] Whether to add a submit button to the form. The value of this attribute is used as the button label. `submit` events get emitted only when the form data validates
72
72
  data-generate-node-shape-reference | When generating the RDF data graph, <shacl-form> can create a triple that references the root `sh:NodeShape` of the data. Suggested values for this attribute are `http://www.w3.org/1999/02/22-rdf-syntax-ns#type` or `http://purl.org/dc/terms/conformsTo`. Default is empty, so that no such triple is created
73
- show-node-ids | When this attribute is set, shacl node shapes will have their subject id shown in the form
73
+ data-show-node-ids | When this attribute is set, shacl node shapes will have their subject id shown in the form
74
74
 
75
75
  ### Element functions
76
76
 
@@ -113,7 +113,7 @@ Class hierarchies can be built using `rdfs:subClassOf` or `skos:broader`.
113
113
 
114
114
  ### Validation
115
115
 
116
- In edit mode, `<shacl-form>` validates the constructed data graph using the library [rdf-validate-shacl](https://github.com/zazuko/rdf-validate-shacl) and displays validation results as icons next to the respective form fields.
116
+ In edit mode, `<shacl-form>` validates the constructed data graph using the library [shacl-engine](https://github.com/rdf-ext/shacl-engine) and displays validation results as icons next to the respective form fields.
117
117
 
118
118
  ### Data graph binding
119
119
 
@@ -216,6 +216,43 @@ When the element attribute `data-collapse` is set, `<shacl-form>` creates an acc
216
216
 
217
217
  Apart from grouped properties, all properties having an `sh:node` predicate and `sh:maxCount` != 1 are collapsed.
218
218
 
219
+ ### Use with Solid Pods
220
+
221
+ `<shacl-form>` can easily be integrated with [Solid Pods](https://solidproject.org/about). The output of `toRDF()` being a RDFJS N3 Store, as explained above, it can be presented to `solid-client`s `fromRdfJsDataset()` function, which converts the RDF Graph into a Solid Dataset. The following example, based on Inrupt's basic [Solid Pod Example](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/getting-started/) shows how to merge data from a `<shacl-form>` with a Solid Data Resource at `readingListDataResourceURI`:
222
+
223
+ ```js
224
+ // Authentication is assumed, resulting in a fetch able to read and write into the Pod
225
+ try {
226
+ // Get data out of the shacl-form
227
+ const form = document.querySelector('shacl-form')
228
+
229
+ // Extract the RDF Graph from the form
230
+ const shaclFormGraphStore = await form.toRDF()
231
+
232
+ // Convert RDF store into a Solid dataset
233
+ const shaclFormDataset = await fromRdfJsDataset(shaclFormGraphStore)
234
+
235
+ // First get the current dataset
236
+ myReadingList = await getSolidDataset(readingListDataResourceURI, { fetch: fetch })
237
+
238
+ // get all Things from the shaclFormDataset
239
+ const shaclFormThings = getThingAll(shaclFormDataset)
240
+
241
+ // add the things from ShaclForm to the existing set
242
+ shaclFormThings.forEach((thing) => (myReadingList = setThing(myReadingList, thing)))
243
+
244
+ // save the new dataset
245
+ let savedReadingList = await saveSolidDatasetAt(readingListDataResourceURI, myReadingList, {
246
+ fetch: fetch
247
+ })
248
+
249
+ // Other handling here
250
+
251
+ } catch (err) {
252
+ console.error(`Storing SHACL data from Form failed with error ${err}!`)
253
+ }
254
+ ```
255
+
219
256
  ### Theming
220
257
 
221
258
  `<shacl-form>` comes in 3 different bundles, each providing a specific theme. See the [demo page](https://ulb-darmstadt.github.io/shacl-form/#theming) for an example.
@@ -8,11 +8,11 @@ export declare const PREFIX_OWL = "http://www.w3.org/2002/07/owl#";
8
8
  export declare const PREFIX_OA = "http://www.w3.org/ns/oa#";
9
9
  export declare const PREFIX_DCTERMS = "http://purl.org/dc/terms/";
10
10
  export declare const SHAPES_GRAPH: import("n3").NamedNode<"shapes">;
11
- export declare const OWL_IMPORTS: import("n3").NamedNode<string>;
12
11
  export declare const RDF_PREDICATE_TYPE: import("n3").NamedNode<string>;
13
12
  export declare const DCTERMS_PREDICATE_CONFORMS_TO: import("n3").NamedNode<string>;
14
13
  export declare const RDFS_PREDICATE_SUBCLASS_OF: import("n3").NamedNode<string>;
15
14
  export declare const SKOS_PREDICATE_BROADER: import("n3").NamedNode<string>;
15
+ export declare const OWL_PREDICATE_IMPORTS: import("n3").NamedNode<string>;
16
16
  export declare const OWL_OBJECT_NAMED_INDIVIDUAL: import("n3").NamedNode<string>;
17
17
  export declare const SHACL_OBJECT_NODE_SHAPE: import("n3").NamedNode<string>;
18
18
  export declare const SHACL_OBJECT_IRI: import("n3").NamedNode<string>;