1.3.0 • Published 3 years ago

shacl-test-as-object v1.3.0

Weekly downloads
409
License
MIT
Repository
github
Last release
3 years ago

shacl-test-as-object

Returns list of SHACL constraints from test suite as resources

GitHub license npm version build Dependabot semantic-release

Usage

import NodeShapesPromise, { NodeShapesMapPromise } from 'shacl-test-as-object';

(async () => {
  const NodeShapes = await NodeShapesPromise;
  const NodeShapesMap = await NodeShapesMapPromise;
  for (const shape of NodeShapes) {
    /* Run test operation on shape here */
  }
  
  const shape = NodeShapesMap['http://datashapes.org/sh/tests/core/complex/personexample.test#PersonShape']
  /* Run test operation on specific shape */
})();

Each of the resolved shapes conforms to the rdf-object.js Resource API.

import { ProxiedNodeShapes, ProxiedNodeShapesMapPromise } from 'shacl-test-as-object';

(async () => {
  const NodeShapes = await ProxiedNodeShapes;
  const NodeShapesMap = await ProxiedNodeShapesMapPromise;
  for (const shape of NodeShapes) {
    /* Run test operation on shape here */
  }
  
  const shape = NodeShapesMap['http://datashapes.org/sh/tests/core/complex/personexample.test#PersonShape']
  /* Run test operation on specific shape */
})();

Each of the resolved shapes conforms to the rdf-object-proxy ProxiedResource API.

For further examples refer the test suite for this library.

getNodeShapes and getProxiedNodeShapes can be used if one wishes to manually supply the path to the manifest file. See the get test suite for usage.

Inferenced Shapes

Inferenced versions of these objects are also exposed. Inferencing is performed using sparql-inferenced over the SHACL ontology, and these specific shacl inferences.

The inferenced shapes can be accessed similarly to the other objects

import { InferencedProxiedNodeShapes, InferencedProxiedNodeShapesMapPromise } from 'shacl-test-as-object';

(async () => {
  const NodeShapes = await InferencedProxiedNodeShapes;
  const NodeShapesMap = await InferencedProxiedNodeShapesMapPromise;
  for (const shape of NodeShapes) {
    /* Run test operation on shape here */
  }
  
  const shape = NodeShapesMap['http://datashapes.org/sh/tests/core/complex/personexample.test#PersonShape']
  /* Run test operation on specific shape */
})();

License

©2021–present Jesse Wright, MIT License.