@ulb-darmstadt/shacl-form 1.7.4 → 1.8.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 +13 -3
- package/dist/config.d.ts +4 -5
- package/dist/constants.d.ts +15 -13
- package/dist/constraints.d.ts +2 -2
- package/dist/exports.d.ts +2 -1
- package/dist/form-bootstrap.d.ts +1 -1
- package/dist/form-bootstrap.js +361 -2
- package/dist/form-default.d.ts +1 -1
- package/dist/form-default.js +350 -2
- package/dist/form-material.d.ts +1 -1
- package/dist/form-material.js +670 -2
- package/dist/form.d.ts +3 -2
- package/dist/node-template.d.ts +17 -0
- package/dist/node.d.ts +2 -1
- package/dist/plugins/leaflet.d.ts +2 -4
- package/dist/plugins/leaflet.js +720 -2
- package/dist/plugins/mapbox.d.ts +2 -2
- package/dist/plugins/mapbox.js +2764 -2
- package/dist/property-template.d.ts +1 -1
- package/dist/property.d.ts +6 -2
- package/dist/theme.d.ts +2 -2
- package/dist/themes/default.d.ts +3 -3
- package/dist/themes/material.d.ts +2 -3
- package/package.json +23 -11
- package/src/config.ts +11 -10
- package/src/constants.ts +3 -1
- package/src/constraints.ts +15 -18
- package/src/exports.ts +2 -1
- package/src/form.ts +32 -17
- package/src/group.ts +1 -1
- package/src/loader.ts +12 -13
- package/src/node-template.ts +82 -0
- package/src/node.ts +40 -38
- package/src/plugins/leaflet.ts +2 -2
- package/src/plugins/mapbox.ts +4 -4
- package/src/property-template.ts +4 -5
- package/src/property.ts +154 -56
- package/src/serialize.ts +14 -1
- package/src/styles.css +8 -10
- package/src/theme.ts +5 -5
- package/src/themes/bootstrap.ts +1 -1
- package/src/themes/default.css +2 -2
- package/src/themes/default.ts +12 -3
- package/src/themes/material.ts +12 -3
- package/src/util.ts +12 -14
- package/dist/form-bootstrap.js.LICENSE.txt +0 -69
- package/dist/form-default.js.LICENSE.txt +0 -69
- package/dist/form-material.js.LICENSE.txt +0 -69
- package/dist/plugins/file-upload.js +0 -1
- package/dist/plugins/fixed-list.js +0 -1
- package/dist/plugins/leaflet.js.LICENSE.txt +0 -4
- package/dist/plugins/mapbox.js.LICENSE.txt +0 -10
package/README.md
CHANGED
|
@@ -165,9 +165,9 @@ an `sh:class` predicate. The expected return value is a (promise of a) string (e
|
|
|
165
165
|
|
|
166
166
|
A more realistic use case of this feature is calling some API endpoint to fetch class instance definitions from existing ontologies.
|
|
167
167
|
|
|
168
|
-
### SHACL "or" constraint
|
|
168
|
+
### SHACL "or" and "xone" constraint
|
|
169
169
|
|
|
170
|
-
`<shacl-form>` supports using [sh:or](https://www.w3.org/TR/shacl/#OrConstraintComponent) to let users select between different options on nodes or properties.
|
|
170
|
+
`<shacl-form>` supports using [sh:or](https://www.w3.org/TR/shacl/#OrConstraintComponent) and [sh:xone](https://www.w3.org/TR/shacl/#XoneConstraintComponent) to let users select between different options on nodes or properties.
|
|
171
171
|
The [example shapes graph](https://ulb-darmstadt.github.io/shacl-form/#example) has the following triples:
|
|
172
172
|
```
|
|
173
173
|
example:Attribution
|
|
@@ -184,10 +184,20 @@ example:Attribution
|
|
|
184
184
|
```
|
|
185
185
|
When adding a new attribution, `<shacl-form>` renders a dropdown to let the user select between the two options Person/Organisation. After selecting one of the options, the dropdown is replaced by the input fields of the selected node shape.
|
|
186
186
|
|
|
187
|
-
When binding an existing data graph to the form, the
|
|
187
|
+
When binding an existing data graph to the form, the constraint is tried to be resolved depending on the respective data value:
|
|
188
188
|
- For RDF literals, an `sh:or` option with a matching `sh:datatype` is chosen
|
|
189
189
|
- For blank nodes or named nodes, the `rdf:type` of the value is tried to be matched with a node shape having a corresponding `sh:targetClass` or with a property shape having a corresponding `sh:class`. If there is no `rdf:type` but a `sh:nodeKind` of `sh:IRI`, the id of the the node is used as the value.
|
|
190
190
|
|
|
191
|
+
### Linking existing data
|
|
192
|
+
|
|
193
|
+
In case a node shape has a `sh:targetClass` and any graph, i.e.
|
|
194
|
+
- the shapes graph
|
|
195
|
+
- the data graph
|
|
196
|
+
- any graph loaded by `owl:imports`
|
|
197
|
+
- triples provided by [classInstanceProvider](#classInstanceProvider)
|
|
198
|
+
|
|
199
|
+
contains instances of that class, those can be linked in the respective SHACL property. In effect, the generated data graph will just contain a reference to the instance, but not the triples that the instance consists of.
|
|
200
|
+
|
|
191
201
|
### SHACL shape inheritance
|
|
192
202
|
|
|
193
203
|
SHACL defines two ways of inheriting shapes: [sh:and](https://www.w3.org/TR/shacl/#AndConstraintComponent)
|
package/dist/config.d.ts
CHANGED
|
@@ -32,18 +32,17 @@ export declare class Config {
|
|
|
32
32
|
prefixes: Prefixes;
|
|
33
33
|
editMode: boolean;
|
|
34
34
|
languages: string[];
|
|
35
|
-
dataGraph: Store<import("@rdfjs/types").Quad, import("n3").Quad, import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>;
|
|
36
35
|
lists: Record<string, Term[]>;
|
|
37
36
|
groups: Array<string>;
|
|
38
37
|
theme: Theme;
|
|
39
38
|
form: HTMLElement;
|
|
40
39
|
renderedNodes: Set<string>;
|
|
41
|
-
|
|
42
|
-
private
|
|
40
|
+
valuesGraphId: NamedNode | undefined;
|
|
41
|
+
private _store;
|
|
43
42
|
constructor(theme: Theme, form: HTMLElement);
|
|
44
43
|
updateAttributes(elem: HTMLElement): void;
|
|
45
44
|
static dataAttributes(): Array<string>;
|
|
46
|
-
get
|
|
47
|
-
set
|
|
45
|
+
get store(): Store;
|
|
46
|
+
set store(store: Store);
|
|
48
47
|
registerPrefixes(prefixes: Prefixes): void;
|
|
49
48
|
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -7,16 +7,18 @@ export declare const PREFIX_SKOS = "http://www.w3.org/2004/02/skos/core#";
|
|
|
7
7
|
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
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const
|
|
10
|
+
export declare const PREFIX_FOAF = "http://xmlns.com/foaf/0.1/";
|
|
11
|
+
export declare const SHAPES_GRAPH: import('n3').NamedNode<"loaded-shapes">;
|
|
12
|
+
export declare const DATA_GRAPH: import('n3').NamedNode<"loaded-data">;
|
|
13
|
+
export declare const RDF_PREDICATE_TYPE: import('n3').NamedNode<string>;
|
|
14
|
+
export declare const DCTERMS_PREDICATE_CONFORMS_TO: import('n3').NamedNode<string>;
|
|
15
|
+
export declare const RDFS_PREDICATE_SUBCLASS_OF: import('n3').NamedNode<string>;
|
|
16
|
+
export declare const SKOS_PREDICATE_BROADER: import('n3').NamedNode<string>;
|
|
17
|
+
export declare const OWL_PREDICATE_IMPORTS: import('n3').NamedNode<string>;
|
|
18
|
+
export declare const OWL_OBJECT_NAMED_INDIVIDUAL: import('n3').NamedNode<string>;
|
|
19
|
+
export declare const SHACL_OBJECT_NODE_SHAPE: import('n3').NamedNode<string>;
|
|
20
|
+
export declare const SHACL_OBJECT_IRI: import('n3').NamedNode<string>;
|
|
21
|
+
export declare const SHACL_PREDICATE_PROPERTY: import('n3').NamedNode<string>;
|
|
22
|
+
export declare const SHACL_PREDICATE_CLASS: import('n3').NamedNode<string>;
|
|
23
|
+
export declare const SHACL_PREDICATE_TARGET_CLASS: import('n3').NamedNode<string>;
|
|
24
|
+
export declare const SHACL_PREDICATE_NODE_KIND: import('n3').NamedNode<string>;
|
package/dist/constraints.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Quad } from 'n3';
|
|
2
2
|
import { Term } from '@rdfjs/types';
|
|
3
|
-
import { ShaclNode } from
|
|
4
|
-
import { ShaclProperty } from
|
|
3
|
+
import { ShaclNode } from './node';
|
|
4
|
+
import { ShaclProperty } from './property';
|
|
5
5
|
import { Config } from './config';
|
|
6
6
|
export declare function createShaclOrConstraint(options: Term[], context: ShaclNode | ShaclProperty, config: Config): HTMLElement;
|
|
7
7
|
export declare function resolveShaclOrConstraintOnProperty(subjects: Term[], value: Term, config: Config): Quad[];
|
package/dist/exports.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export type { InputListEntry, Editor } from './theme';
|
|
2
|
+
export { Theme } from './theme';
|
|
2
3
|
export { Loader, setSharedShapesGraph } from './loader';
|
|
3
4
|
export { Config } from './config';
|
|
4
5
|
export { Plugin, registerPlugin } from './plugin';
|
package/dist/form-bootstrap.d.ts
CHANGED