@ulb-darmstadt/shacl-form 1.7.1 → 1.7.2

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/dist/form.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ShaclNode } from './node';
2
2
  import { Config } from './config';
3
3
  import { ClassInstanceProvider, Plugin } from './plugin';
4
- import { Store } from 'n3';
4
+ import { Store, Quad } from 'n3';
5
5
  import { Theme } from './theme';
6
6
  export declare class ShaclForm extends HTMLElement {
7
7
  static get observedAttributes(): string[];
@@ -13,8 +13,8 @@ export declare class ShaclForm extends HTMLElement {
13
13
  connectedCallback(): void;
14
14
  attributeChangedCallback(): void;
15
15
  private initialize;
16
- serialize(format?: string, graph?: Store<import("@rdfjs/types").Quad, import("n3").Quad, import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>): string;
17
- toRDF(graph?: Store<import("@rdfjs/types").Quad, import("n3").Quad, import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>): Store;
16
+ serialize(format?: string, graph?: Store<import("@rdfjs/types").Quad, Quad, import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>): string;
17
+ toRDF(graph?: Store<import("@rdfjs/types").Quad, Quad, import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>): Store;
18
18
  registerPlugin(plugin: Plugin): void;
19
19
  setTheme(theme: Theme): void;
20
20
  setSharedShapesGraph(graph: Store): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulb-darmstadt/shacl-form",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "SHACL form generator",
5
5
  "main": "dist/form-default.js",
6
6
  "module": "dist/form-default.js",
package/src/form.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ShaclNode } from './node'
2
2
  import { Config } from './config'
3
3
  import { ClassInstanceProvider, Plugin, listPlugins, registerPlugin } from './plugin'
4
- import { Store, NamedNode, DataFactory } from 'n3'
5
- import { DCTERMS_PREDICATE_CONFORMS_TO, RDF_PREDICATE_TYPE, SHACL_OBJECT_NODE_SHAPE, SHACL_PREDICATE_TARGET_CLASS } from './constants'
4
+ import { Store, NamedNode, DataFactory, Quad } from 'n3'
5
+ import { DCTERMS_PREDICATE_CONFORMS_TO, PREFIX_SHACL, RDF_PREDICATE_TYPE, SHACL_OBJECT_NODE_SHAPE, SHACL_PREDICATE_TARGET_CLASS } from './constants'
6
6
  import { Editor, Theme } from './theme'
7
7
  import { serialize } from './serialize'
8
8
  import { Validator } from 'shacl-engine'
@@ -156,6 +156,10 @@ export class ShaclForm extends HTMLElement {
156
156
 
157
157
  this.config.shapesGraph.deleteGraph('')
158
158
  this.shape?.toRDF(this.config.shapesGraph)
159
+ if (this.shape) {
160
+ // add node target for validation. this is required in case of missing sh:targetClass in root shape
161
+ this.config.shapesGraph.add(new Quad(this.shape.shaclSubject, DataFactory.namedNode(PREFIX_SHACL + 'targetNode'), this.shape.nodeId, undefined))
162
+ }
159
163
  try {
160
164
  const dataset = this.config.shapesGraph
161
165
  const report = await new Validator(dataset, { details: true, factory: DataFactory }).validate({ dataset })