API Reference
classes
Shaclshape

@coasys/ad4m / Exports / SHACLShape

Class: SHACLShape

SHACL Node Shape Defines constraints for instances of a class

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new SHACLShape(targetClassOrShapeUri, targetClass?)

Create a new SHACL Shape

Parameters

NameTypeDescription
targetClassOrShapeUristringIf one argument: the target class (shape URI auto-derived as {class}Shape) If two arguments: first is shape URI, second is target class
targetClass?stringOptional target class when first arg is shape URI

Defined in

shacl/SHACLShape.ts:208 (opens in a new tab)

Properties

constructor_actions

Optional constructor_actions: AD4MAction[]

AD4M-specific: Constructor actions for creating instances

Defined in

shacl/SHACLShape.ts:194 (opens in a new tab)


destructor_actions

Optional destructor_actions: AD4MAction[]

AD4M-specific: Destructor actions for removing instances

Defined in

shacl/SHACLShape.ts:197 (opens in a new tab)


nodeShapeUri

nodeShapeUri: string

URI of this shape (e.g., recipe:RecipeShape)

Defined in

shacl/SHACLShape.ts:185 (opens in a new tab)


parentShapes

parentShapes: string[]

Parent shape URIs for model inheritance (sh:node references)

Defined in

shacl/SHACLShape.ts:200 (opens in a new tab)


properties

properties: SHACLPropertyShape[]

Property constraints

Defined in

shacl/SHACLShape.ts:191 (opens in a new tab)


targetClass

Optional targetClass: string

Target class this shape applies to (e.g., recipe:Recipe)

Defined in

shacl/SHACLShape.ts:188 (opens in a new tab)

Methods

addParentShape

addParentShape(parentShapeUri): void

Add a parent shape reference (sh:node) for model inheritance. When a

Parameters

NameType
parentShapeUristring

Returns

void

Model

class extends another @Model, the child shape references the parent shape so SHACL validators can walk the class hierarchy.

Defined in

shacl/SHACLShape.ts:231 (opens in a new tab)


addProperty

addProperty(prop): void

Add a property constraint to this shape

Parameters

NameType
propSHACLPropertyShape

Returns

void

Defined in

shacl/SHACLShape.ts:240 (opens in a new tab)


setConstructorActions

setConstructorActions(actions): void

Set constructor actions for this shape

Parameters

NameType
actionsAD4MAction[]

Returns

void

Defined in

shacl/SHACLShape.ts:247 (opens in a new tab)


setDestructorActions

setDestructorActions(actions): void

Set destructor actions for this shape

Parameters

NameType
actionsAD4MAction[]

Returns

void

Defined in

shacl/SHACLShape.ts:254 (opens in a new tab)


toJSON

toJSON(): object

Convert the shape to a JSON-serializable object. Useful for passing to addSdna() as shaclJson parameter.

Returns

object

JSON-serializable object representing the shape

Defined in

shacl/SHACLShape.ts:790 (opens in a new tab)


toLinks

toLinks(): Link[]

Serialize shape to AD4M Links (RDF triples) Stores the shape as a graph of links in a Perspective

Returns

Link[]

Defined in

shacl/SHACLShape.ts:340 (opens in a new tab)


toTurtle

toTurtle(): string

Serialize shape to Turtle (RDF) format

Returns

string

Defined in

shacl/SHACLShape.ts:261 (opens in a new tab)


fromJSON

Static fromJSON(json): SHACLShape

Create a shape from a JSON object (inverse of toJSON)

Parameters

NameType
jsonany

Returns

SHACLShape

Defined in

shacl/SHACLShape.ts:824 (opens in a new tab)


fromLinks

Static fromLinks(links, shapeUri): SHACLShape

Reconstruct shape from AD4M Links

Parameters

NameType
linksLink[]
shapeUristring

Returns

SHACLShape

Defined in

shacl/SHACLShape.ts:556 (opens in a new tab)