@ulb-darmstadt/shacl-form 1.6.0 → 1.6.1

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
@@ -22,9 +22,9 @@ HTML5 web component for editing/viewing [RDF](https://www.w3.org/RDF/) data that
22
22
  or can be loaded by setting attribute 'data-shapes-url'
23
23
  -->
24
24
  <shacl-form data-shapes="
25
- @prefix sh: <http://www.w3.org/ns/shacl#> .
26
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
27
- @prefix ex: <http://example.org#> .
25
+ @prefix sh: <http://www.w3.org/ns/shacl#> .
26
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
27
+ @prefix ex: <http://example.org#> .
28
28
 
29
29
  ex:ExampleShape
30
30
  a sh:NodeShape, rdfs:Class ;
@@ -74,6 +74,7 @@ data-show-node-ids | When this attribute is set, shacl node shapes will have the
74
74
 
75
75
  ### Element functions
76
76
 
77
+ <a id="toRDF"></a>
77
78
  ```typescript
78
79
  toRDF(graph?: Store): Store
79
80
  ```
@@ -103,11 +104,7 @@ Set a design theme to use for rendering. See section [Theming](#Theming).
103
104
  ```typescript
104
105
  setClassInstanceProvider((className: string) => Promise<string>)
105
106
  ```
106
- Sets a callback function that is called when a SHACL property has an `sh:class` definition. The expected return value is a string (e.g. in format `text/turtle`) that contains RDF class instance definitions of the given class. Instances can be defined e.g. like:
107
- - `example:Instance a example:Class`
108
- - `example:Instance a owl:NamedIndividual; skos:broader example:Class`
109
-
110
- Class hierarchies can be built using `rdfs:subClassOf` or `skos:broader`.
107
+ Sets a callback function that is invoked when a SHACL property has an `sh:class` definition to retrieve class instances. See [below](#classInstanceProvider) for more information.
111
108
 
112
109
  ## Features
113
110
 
@@ -138,7 +135,7 @@ Apart from setting the element attributes `data-shapes` or `data-shapes-url`, th
138
135
  ```
139
136
  In this case, the URL references an ontology which among other things defines instances of class `prov:Role` that are then used to populate the "Role" dropdown in the form.
140
137
 
141
- 2. The `<shacl-form>` element has a function `setClassInstanceProvider((className: string) => Promise<string>)` that registers a callback function which is invoked when a SHACL property has
138
+ 2. <a id="classInstanceProvider"></a>The `<shacl-form>` element has a function `setClassInstanceProvider((className: string) => Promise<string>)` that registers a callback function which is invoked when a SHACL property has
142
139
  an `sh:class` predicate. The expected return value is a (promise of a) string (e.g. in format `text/turtle`) that contains RDF class instance definitions of the given class. Instances can be defined e.g. like:
143
140
  - `example:Instance a example:Class`
144
141
  - `example:Instance a owl:NamedIndividual; skos:broader example:Class`
@@ -218,7 +215,7 @@ Apart from grouped properties, all properties having an `sh:node` predicate and
218
215
 
219
216
  ### Use with Solid Pods
220
217
 
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`:
218
+ `<shacl-form>` can easily be integrated with [Solid Pods](https://solidproject.org/about). The output of `toRDF()` being a RDF/JS N3 Store, as explained [above](#toRDF), 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
219
 
223
220
  ```js
224
221
  // Authentication is assumed, resulting in a fetch able to read and write into the Pod
@@ -226,7 +223,7 @@ Apart from grouped properties, all properties having an `sh:node` predicate and
226
223
  // Get data out of the shacl-form
227
224
  const form = document.querySelector('shacl-form')
228
225
 
229
- // Extract the RDF Graph from the form
226
+ // Extract the RDF graph from the form
230
227
  const shaclFormGraphStore = await form.toRDF()
231
228
 
232
229
  // Convert RDF store into a Solid dataset
@@ -235,7 +232,7 @@ Apart from grouped properties, all properties having an `sh:node` predicate and
235
232
  // First get the current dataset
236
233
  myReadingList = await getSolidDataset(readingListDataResourceURI, { fetch: fetch })
237
234
 
238
- // get all Things from the shaclFormDataset
235
+ // get all things from the shaclFormDataset
239
236
  const shaclFormThings = getThingAll(shaclFormDataset)
240
237
 
241
238
  // add the things from ShaclForm to the existing set