shacl-test-as-object
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i shacl-test-as-object

Weekly Downloads

1

Version

1.3.0

License

MIT

Unpacked Size

293 kB

Total Files

155

Last publish

Collaborators

  • jeswr