@coasys/ad4m / Exports / SHACLShape
Class: SHACLShape
SHACL Node Shape Defines constraints for instances of a class
Table of contents
Constructors
Properties
- constructor_actions
- destructor_actions
- interpretationHint
- nodeShapeUri
- parentShapes
- properties
- targetClass
Methods
- addParentShape
- addProperty
- setConstructorActions
- setDestructorActions
- toJSON
- toLinks
- toTurtle
- fromJSON
- fromLinks
Constructors
constructor
• new SHACLShape(targetClassOrShapeUri, targetClass?)
Create a new SHACL Shape
Parameters
| Name | Type | Description |
|---|---|---|
targetClassOrShapeUri | string | If one argument: the target class (shape URI auto-derived as {class}Shape) If two arguments: first is shape URI, second is target class |
targetClass? | string | Optional target class when first arg is shape URI |
Defined in
core/src/shacl/SHACLShape.ts:297 (opens in a new tab)
Properties
constructor_actions
• Optional constructor_actions: AD4MAction[]
AD4M-specific: Constructor actions for creating instances
Defined in
core/src/shacl/SHACLShape.ts:277 (opens in a new tab)
destructor_actions
• Optional destructor_actions: AD4MAction[]
AD4M-specific: Destructor actions for removing instances
Defined in
core/src/shacl/SHACLShape.ts:280 (opens in a new tab)
interpretationHint
• Optional interpretationHint: string
AD4M-specific: Natural-language hint that steers the generic LLM
extractor when producing instances of this class. Emitted as an
ad4m://interpretation_hint link on the shape node itself and surfaced
on ModelShape.interpretation_hint by the Rust model query.
Defined in
core/src/shacl/SHACLShape.ts:289 (opens in a new tab)
nodeShapeUri
• nodeShapeUri: string
URI of this shape (e.g., recipe:RecipeShape)
Defined in
core/src/shacl/SHACLShape.ts:268 (opens in a new tab)
parentShapes
• parentShapes: string[]
Parent shape URIs for model inheritance (sh:node references)
Defined in
core/src/shacl/SHACLShape.ts:283 (opens in a new tab)
properties
• properties: SHACLPropertyShape[]
Property constraints
Defined in
core/src/shacl/SHACLShape.ts:274 (opens in a new tab)
targetClass
• Optional targetClass: string
Target class this shape applies to (e.g., recipe:Recipe)
Defined in
core/src/shacl/SHACLShape.ts:271 (opens in a new tab)
Methods
addParentShape
▸ addParentShape(parentShapeUri): void
Add a parent shape reference (sh:node) for model inheritance. When a
Parameters
| Name | Type |
|---|---|
parentShapeUri | string |
Returns
void
Model
class extends another @Model, the child shape references the parent shape so SHACL validators can walk the class hierarchy.
Defined in
core/src/shacl/SHACLShape.ts:320 (opens in a new tab)
addProperty
▸ addProperty(prop): void
Add a property constraint to this shape
Parameters
| Name | Type |
|---|---|
prop | SHACLPropertyShape |
Returns
void
Defined in
core/src/shacl/SHACLShape.ts:329 (opens in a new tab)
setConstructorActions
▸ setConstructorActions(actions): void
Set constructor actions for this shape
Parameters
| Name | Type |
|---|---|
actions | AD4MAction[] |
Returns
void
Defined in
core/src/shacl/SHACLShape.ts:336 (opens in a new tab)
setDestructorActions
▸ setDestructorActions(actions): void
Set destructor actions for this shape
Parameters
| Name | Type |
|---|---|
actions | AD4MAction[] |
Returns
void
Defined in
core/src/shacl/SHACLShape.ts:343 (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
core/src/shacl/SHACLShape.ts:804 (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
core/src/shacl/SHACLShape.ts:397 (opens in a new tab)
toTurtle
▸ toTurtle(): string
Serialize shape to Turtle (RDF) format
Returns
string
Defined in
core/src/shacl/SHACLShape.ts:350 (opens in a new tab)
fromJSON
▸ Static fromJSON(json): SHACLShape
Create a shape from a JSON object (inverse of toJSON)
Parameters
| Name | Type |
|---|---|
json | any |
Returns
Defined in
core/src/shacl/SHACLShape.ts:854 (opens in a new tab)
fromLinks
▸ Static fromLinks(links, shapeUri): SHACLShape
Reconstruct shape from AD4M Links
Parameters
| Name | Type |
|---|---|
links | Link[] |
shapeUri | string |