@coasys/ad4m 0.12.0-rc1-dev → 0.12.0-rc1-dev.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/jest.config.js +4 -4
- package/lib/index.cjs +5999 -6044
- package/lib/index.js +5977 -6038
- package/lib/src/Ad4mClient.d.ts +16 -9
- package/lib/src/Ad4mClient.js +25 -46
- package/lib/src/Ad4mClient.test.d.ts +1 -0
- package/lib/src/Ad4mClient.test.js +1204 -0
- package/lib/src/Literal.d.ts +2 -1
- package/lib/src/Literal.js +35 -38
- package/lib/src/Literal.test.d.ts +1 -0
- package/lib/src/Literal.test.js +41 -0
- package/lib/src/SmartLiteral.d.ts +2 -1
- package/lib/src/SmartLiteral.js +15 -30
- package/lib/src/agent/AgentClient.d.ts +4 -1
- package/lib/src/agent/AgentClient.js +99 -79
- package/lib/src/ai/AIClient.d.ts +2 -1
- package/lib/src/ai/AIClient.js +220 -224
- package/lib/src/expression/ExpressionClient.d.ts +1 -1
- package/lib/src/expression/ExpressionClient.js +86 -73
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/language/LanguageClient.d.ts +1 -1
- package/lib/src/language/LanguageClient.js +52 -52
- package/lib/src/model/Ad4mModel.d.ts +157 -937
- package/lib/src/model/Ad4mModel.js +212 -2797
- package/lib/src/model/Ad4mModel.test.js +1002 -561
- package/lib/src/model/decorators.d.ts +94 -426
- package/lib/src/model/decorators.js +333 -741
- package/lib/src/model/mutation.d.ts +81 -0
- package/lib/src/model/mutation.js +317 -0
- package/lib/src/model/parentUtils.d.ts +32 -0
- package/lib/src/model/parentUtils.js +64 -0
- package/lib/src/model/prolog/generatePrologFacts.d.ts +36 -0
- package/lib/src/model/prolog/generatePrologFacts.js +139 -0
- package/lib/src/model/prolog/index.d.ts +1 -0
- package/lib/src/model/prolog/index.js +1 -0
- package/lib/src/model/query/ModelQueryBuilder.d.ts +82 -0
- package/lib/src/model/query/ModelQueryBuilder.js +115 -0
- package/lib/src/model/query/QueryBuilder.d.ts +101 -0
- package/lib/src/model/query/QueryBuilder.js +193 -0
- package/lib/src/model/query/SurrealQueryBuilder.d.ts +48 -0
- package/lib/src/model/query/SurrealQueryBuilder.js +371 -0
- package/lib/src/model/query/fetchInstance.d.ts +24 -0
- package/lib/src/model/query/fetchInstance.js +144 -0
- package/lib/src/model/query/hydration.d.ts +54 -0
- package/lib/src/model/query/hydration.js +214 -0
- package/lib/src/model/query/operations.d.ts +59 -0
- package/lib/src/model/query/operations.js +384 -0
- package/lib/src/model/query/snapshot.d.ts +59 -0
- package/lib/src/model/query/snapshot.js +106 -0
- package/lib/src/model/query/surrealCompiler.d.ts +42 -0
- package/lib/src/model/query/surrealCompiler.js +304 -0
- package/lib/src/model/schema/fromJSONSchema.d.ts +67 -0
- package/lib/src/model/schema/fromJSONSchema.js +264 -0
- package/lib/src/model/schema/metadata.d.ts +15 -0
- package/lib/src/model/schema/metadata.js +112 -0
- package/lib/src/model/subscription.d.ts +47 -0
- package/lib/src/model/subscription.js +231 -0
- package/lib/src/model/transaction.d.ts +27 -0
- package/lib/src/model/transaction.js +32 -0
- package/lib/src/model/types.d.ts +195 -0
- package/lib/src/model/types.js +8 -0
- package/lib/src/model/util.js +7 -7
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +5 -1
- package/lib/src/neighbourhood/NeighbourhoodClient.js +263 -181
- package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -1
- package/lib/src/neighbourhood/NeighbourhoodProxy.js +13 -28
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +1 -5
- package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
- package/lib/src/perspectives/PerspectiveClient.js +316 -240
- package/lib/src/perspectives/PerspectiveProxy.d.ts +54 -92
- package/lib/src/perspectives/PerspectiveProxy.js +803 -444
- package/lib/src/runtime/RuntimeClient.d.ts +5 -1
- package/lib/src/runtime/RuntimeClient.js +412 -238
- package/lib/src/shacl/SHACLFlow.test.js +164 -105
- package/lib/src/shacl/SHACLShape.d.ts +17 -3
- package/lib/src/shacl/SHACLShape.js +127 -90
- package/lib/src/shacl/SHACLShape.test.js +244 -176
- package/lib/src/utils.d.ts +8 -0
- package/lib/src/utils.js +21 -7
- package/package.json +8 -13
- package/src/Ad4mClient.test.ts +1564 -1315
- package/src/Ad4mClient.ts +55 -54
- package/src/Literal.test.ts +45 -26
- package/src/Literal.ts +82 -66
- package/src/SmartLiteral.ts +74 -58
- package/src/agent/AgentClient.ts +144 -99
- package/src/ai/AIClient.ts +409 -359
- package/src/expression/ExpressionClient.ts +142 -96
- package/src/index.ts +1 -1
- package/src/language/LanguageClient.ts +137 -113
- package/src/model/Ad4mModel.test.ts +1128 -647
- package/src/model/Ad4mModel.ts +485 -3247
- package/src/model/IMPROVEMENTS.md +482 -0
- package/src/model/PREDICATE_COLLISION_FIX.md +651 -0
- package/src/model/README.md +317 -0
- package/src/model/SHACL_MUTATION_DECOUPLING.md +356 -0
- package/src/model/SUBSCRIPTION_STRATEGY.md +317 -0
- package/src/model/TC39_STAGE_3_DECORATORS.md +609 -0
- package/src/model/decorators.ts +689 -1046
- package/src/model/mutation.ts +461 -0
- package/src/model/parentUtils.ts +91 -0
- package/src/model/prolog/generatePrologFacts.ts +176 -0
- package/src/model/prolog/index.ts +1 -0
- package/src/model/query/ModelQueryBuilder.ts +173 -0
- package/src/model/query/fetchInstance.ts +181 -0
- package/src/model/query/hydration.ts +273 -0
- package/src/model/query/operations.ts +510 -0
- package/src/model/query/snapshot.ts +126 -0
- package/src/model/query/surrealCompiler.ts +376 -0
- package/src/model/schema/fromJSONSchema.ts +411 -0
- package/src/model/schema/metadata.ts +148 -0
- package/src/model/subscription.ts +307 -0
- package/src/model/transaction.ts +60 -0
- package/src/model/types.ts +207 -0
- package/src/model/util.ts +47 -48
- package/src/neighbourhood/NeighbourhoodClient.ts +393 -251
- package/src/neighbourhood/NeighbourhoodProxy.test.ts +3 -7
- package/src/neighbourhood/NeighbourhoodProxy.ts +58 -40
- package/src/perspectives/PerspectiveClient.ts +779 -540
- package/src/perspectives/PerspectiveProxy.ts +2860 -2053
- package/src/runtime/RuntimeClient.ts +775 -476
- package/src/shacl/SHACLFlow.test.ts +196 -129
- package/src/shacl/SHACLShape.test.ts +284 -190
- package/src/shacl/SHACLShape.ts +225 -172
- package/src/utils.ts +31 -17
- package/tsconfig.json +9 -10
- package/src/model/Subject.ts +0 -159
|
@@ -1,194 +1,253 @@
|
|
|
1
|
-
import { SHACLFlow } from
|
|
2
|
-
describe(
|
|
3
|
-
describe(
|
|
4
|
-
it(
|
|
5
|
-
const flow = new SHACLFlow(
|
|
6
|
-
expect(flow.name).toBe(
|
|
7
|
-
expect(flow.namespace).toBe(
|
|
8
|
-
expect(flow.flowUri).toBe(
|
|
1
|
+
import { SHACLFlow } from "./SHACLFlow";
|
|
2
|
+
describe("SHACLFlow", () => {
|
|
3
|
+
describe("basic construction", () => {
|
|
4
|
+
it("creates a flow with name and namespace", () => {
|
|
5
|
+
const flow = new SHACLFlow("TODO", "todo://");
|
|
6
|
+
expect(flow.name).toBe("TODO");
|
|
7
|
+
expect(flow.namespace).toBe("todo://");
|
|
8
|
+
expect(flow.flowUri).toBe("todo://TODOFlow");
|
|
9
9
|
});
|
|
10
|
-
it(
|
|
11
|
-
const flow = new SHACLFlow(
|
|
12
|
-
expect(flow.stateUri(
|
|
13
|
-
expect(flow.stateUri(
|
|
10
|
+
it("generates correct state URIs", () => {
|
|
11
|
+
const flow = new SHACLFlow("TODO", "todo://");
|
|
12
|
+
expect(flow.stateUri("ready")).toBe("todo://TODO.ready");
|
|
13
|
+
expect(flow.stateUri("done")).toBe("todo://TODO.done");
|
|
14
14
|
});
|
|
15
|
-
it(
|
|
16
|
-
const flow = new SHACLFlow(
|
|
17
|
-
expect(flow.transitionUri(
|
|
15
|
+
it("generates correct transition URIs", () => {
|
|
16
|
+
const flow = new SHACLFlow("TODO", "todo://");
|
|
17
|
+
expect(flow.transitionUri("ready", "doing")).toBe("todo://TODO.readyTodoing");
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
|
-
describe(
|
|
21
|
-
it(
|
|
22
|
-
const flow = new SHACLFlow(
|
|
20
|
+
describe("state management", () => {
|
|
21
|
+
it("adds and retrieves states", () => {
|
|
22
|
+
const flow = new SHACLFlow("TODO", "todo://");
|
|
23
23
|
flow.addState({
|
|
24
|
-
name:
|
|
24
|
+
name: "ready",
|
|
25
25
|
value: 0,
|
|
26
|
-
stateCheck: { predicate:
|
|
26
|
+
stateCheck: { predicate: "todo://state", target: "todo://ready" },
|
|
27
27
|
});
|
|
28
28
|
flow.addState({
|
|
29
|
-
name:
|
|
29
|
+
name: "done",
|
|
30
30
|
value: 1,
|
|
31
|
-
stateCheck: { predicate:
|
|
31
|
+
stateCheck: { predicate: "todo://state", target: "todo://done" },
|
|
32
32
|
});
|
|
33
33
|
expect(flow.states.length).toBe(2);
|
|
34
|
-
expect(flow.states[0].name).toBe(
|
|
35
|
-
expect(flow.states[1].name).toBe(
|
|
34
|
+
expect(flow.states[0].name).toBe("ready");
|
|
35
|
+
expect(flow.states[1].name).toBe("done");
|
|
36
36
|
});
|
|
37
37
|
});
|
|
38
|
-
describe(
|
|
39
|
-
it(
|
|
40
|
-
const flow = new SHACLFlow(
|
|
38
|
+
describe("transition management", () => {
|
|
39
|
+
it("adds and retrieves transitions", () => {
|
|
40
|
+
const flow = new SHACLFlow("TODO", "todo://");
|
|
41
41
|
flow.addTransition({
|
|
42
|
-
actionName:
|
|
43
|
-
fromState:
|
|
44
|
-
toState:
|
|
42
|
+
actionName: "Complete",
|
|
43
|
+
fromState: "ready",
|
|
44
|
+
toState: "done",
|
|
45
45
|
actions: [
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
{
|
|
47
|
+
action: "addLink",
|
|
48
|
+
source: "this",
|
|
49
|
+
predicate: "todo://state",
|
|
50
|
+
target: "todo://done",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
action: "removeLink",
|
|
54
|
+
source: "this",
|
|
55
|
+
predicate: "todo://state",
|
|
56
|
+
target: "todo://ready",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
49
59
|
});
|
|
50
60
|
expect(flow.transitions.length).toBe(1);
|
|
51
|
-
expect(flow.transitions[0].actionName).toBe(
|
|
61
|
+
expect(flow.transitions[0].actionName).toBe("Complete");
|
|
52
62
|
expect(flow.transitions[0].actions.length).toBe(2);
|
|
53
63
|
});
|
|
54
64
|
});
|
|
55
|
-
describe(
|
|
56
|
-
it(
|
|
57
|
-
const flow = new SHACLFlow(
|
|
58
|
-
flow.flowable =
|
|
65
|
+
describe("toLinks()", () => {
|
|
66
|
+
it("serializes flow to links", () => {
|
|
67
|
+
const flow = new SHACLFlow("TODO", "todo://");
|
|
68
|
+
flow.flowable = "any";
|
|
59
69
|
flow.startAction = [
|
|
60
|
-
{
|
|
70
|
+
{
|
|
71
|
+
action: "addLink",
|
|
72
|
+
source: "this",
|
|
73
|
+
predicate: "todo://state",
|
|
74
|
+
target: "todo://ready",
|
|
75
|
+
},
|
|
61
76
|
];
|
|
62
77
|
flow.addState({
|
|
63
|
-
name:
|
|
78
|
+
name: "ready",
|
|
64
79
|
value: 0,
|
|
65
|
-
stateCheck: { predicate:
|
|
80
|
+
stateCheck: { predicate: "todo://state", target: "todo://ready" },
|
|
66
81
|
});
|
|
67
82
|
flow.addTransition({
|
|
68
|
-
actionName:
|
|
69
|
-
fromState:
|
|
70
|
-
toState:
|
|
71
|
-
actions: [
|
|
83
|
+
actionName: "Start",
|
|
84
|
+
fromState: "ready",
|
|
85
|
+
toState: "doing",
|
|
86
|
+
actions: [
|
|
87
|
+
{
|
|
88
|
+
action: "addLink",
|
|
89
|
+
source: "this",
|
|
90
|
+
predicate: "todo://state",
|
|
91
|
+
target: "todo://doing",
|
|
92
|
+
},
|
|
93
|
+
],
|
|
72
94
|
});
|
|
73
95
|
const links = flow.toLinks();
|
|
74
96
|
// Check flow type link
|
|
75
|
-
const typeLink = links.find(l => l.predicate ===
|
|
97
|
+
const typeLink = links.find((l) => l.predicate === "rdf://type" && l.target === "ad4m://Flow");
|
|
76
98
|
expect(typeLink).toBeDefined();
|
|
77
|
-
expect(typeLink.source).toBe(
|
|
99
|
+
expect(typeLink.source).toBe("todo://TODOFlow");
|
|
78
100
|
// Check flowable link
|
|
79
|
-
const flowableLink = links.find(l => l.predicate ===
|
|
101
|
+
const flowableLink = links.find((l) => l.predicate === "ad4m://flowable");
|
|
80
102
|
expect(flowableLink).toBeDefined();
|
|
81
|
-
expect(flowableLink.target).toBe(
|
|
103
|
+
expect(flowableLink.target).toBe("ad4m://any");
|
|
82
104
|
// Check start action link
|
|
83
|
-
const startActionLink = links.find(l => l.predicate ===
|
|
105
|
+
const startActionLink = links.find((l) => l.predicate === "ad4m://startAction");
|
|
84
106
|
expect(startActionLink).toBeDefined();
|
|
85
|
-
expect(startActionLink.target).toContain(
|
|
107
|
+
expect(startActionLink.target).toContain("addLink");
|
|
86
108
|
// Check state link
|
|
87
|
-
const stateLink = links.find(l => l.predicate ===
|
|
109
|
+
const stateLink = links.find((l) => l.predicate === "ad4m://hasState");
|
|
88
110
|
expect(stateLink).toBeDefined();
|
|
89
|
-
expect(stateLink.target).toBe(
|
|
111
|
+
expect(stateLink.target).toBe("todo://TODO.ready");
|
|
90
112
|
// Check transition link
|
|
91
|
-
const transitionLink = links.find(l => l.predicate ===
|
|
113
|
+
const transitionLink = links.find((l) => l.predicate === "ad4m://hasTransition");
|
|
92
114
|
expect(transitionLink).toBeDefined();
|
|
93
115
|
});
|
|
94
116
|
});
|
|
95
|
-
describe(
|
|
96
|
-
it(
|
|
97
|
-
const original = new SHACLFlow(
|
|
98
|
-
original.flowable =
|
|
117
|
+
describe("fromLinks()", () => {
|
|
118
|
+
it("reconstructs flow from links", () => {
|
|
119
|
+
const original = new SHACLFlow("TODO", "todo://");
|
|
120
|
+
original.flowable = "any";
|
|
99
121
|
original.startAction = [
|
|
100
|
-
{
|
|
122
|
+
{
|
|
123
|
+
action: "addLink",
|
|
124
|
+
source: "this",
|
|
125
|
+
predicate: "todo://state",
|
|
126
|
+
target: "todo://ready",
|
|
127
|
+
},
|
|
101
128
|
];
|
|
102
129
|
original.addState({
|
|
103
|
-
name:
|
|
130
|
+
name: "ready",
|
|
104
131
|
value: 0,
|
|
105
|
-
stateCheck: { predicate:
|
|
132
|
+
stateCheck: { predicate: "todo://state", target: "todo://ready" },
|
|
106
133
|
});
|
|
107
134
|
original.addState({
|
|
108
|
-
name:
|
|
135
|
+
name: "done",
|
|
109
136
|
value: 1,
|
|
110
|
-
stateCheck: { predicate:
|
|
137
|
+
stateCheck: { predicate: "todo://state", target: "todo://done" },
|
|
111
138
|
});
|
|
112
139
|
original.addTransition({
|
|
113
|
-
actionName:
|
|
114
|
-
fromState:
|
|
115
|
-
toState:
|
|
116
|
-
actions: [
|
|
140
|
+
actionName: "Complete",
|
|
141
|
+
fromState: "ready",
|
|
142
|
+
toState: "done",
|
|
143
|
+
actions: [
|
|
144
|
+
{
|
|
145
|
+
action: "addLink",
|
|
146
|
+
source: "this",
|
|
147
|
+
predicate: "todo://state",
|
|
148
|
+
target: "todo://done",
|
|
149
|
+
},
|
|
150
|
+
],
|
|
117
151
|
});
|
|
118
152
|
const links = original.toLinks();
|
|
119
|
-
const reconstructed = SHACLFlow.fromLinks(links,
|
|
120
|
-
expect(reconstructed.name).toBe(
|
|
121
|
-
expect(reconstructed.namespace).toBe(
|
|
122
|
-
expect(reconstructed.flowable).toBe(
|
|
153
|
+
const reconstructed = SHACLFlow.fromLinks(links, "todo://TODOFlow");
|
|
154
|
+
expect(reconstructed.name).toBe("TODO");
|
|
155
|
+
expect(reconstructed.namespace).toBe("todo://");
|
|
156
|
+
expect(reconstructed.flowable).toBe("any");
|
|
123
157
|
expect(reconstructed.startAction.length).toBe(1);
|
|
124
158
|
expect(reconstructed.states.length).toBe(2);
|
|
125
159
|
expect(reconstructed.transitions.length).toBe(1);
|
|
126
|
-
expect(reconstructed.transitions[0].actionName).toBe(
|
|
160
|
+
expect(reconstructed.transitions[0].actionName).toBe("Complete");
|
|
127
161
|
});
|
|
128
162
|
});
|
|
129
|
-
describe(
|
|
130
|
-
it(
|
|
131
|
-
const original = new SHACLFlow(
|
|
163
|
+
describe("JSON serialization", () => {
|
|
164
|
+
it("converts to and from JSON", () => {
|
|
165
|
+
const original = new SHACLFlow("TODO", "todo://");
|
|
132
166
|
original.addState({
|
|
133
|
-
name:
|
|
167
|
+
name: "ready",
|
|
134
168
|
value: 0,
|
|
135
|
-
stateCheck: { predicate:
|
|
169
|
+
stateCheck: { predicate: "todo://state", target: "todo://ready" },
|
|
136
170
|
});
|
|
137
171
|
original.addTransition({
|
|
138
|
-
actionName:
|
|
139
|
-
fromState:
|
|
140
|
-
toState:
|
|
141
|
-
actions: []
|
|
172
|
+
actionName: "Start",
|
|
173
|
+
fromState: "ready",
|
|
174
|
+
toState: "doing",
|
|
175
|
+
actions: [],
|
|
142
176
|
});
|
|
143
177
|
const json = original.toJSON();
|
|
144
178
|
const reconstructed = SHACLFlow.fromJSON(json);
|
|
145
|
-
expect(reconstructed.name).toBe(
|
|
179
|
+
expect(reconstructed.name).toBe("TODO");
|
|
146
180
|
expect(reconstructed.states.length).toBe(1);
|
|
147
181
|
expect(reconstructed.transitions.length).toBe(1);
|
|
148
182
|
});
|
|
149
183
|
});
|
|
150
|
-
describe(
|
|
151
|
-
it(
|
|
152
|
-
const flow = new SHACLFlow(
|
|
153
|
-
flow.flowable =
|
|
184
|
+
describe("full TODO example", () => {
|
|
185
|
+
it("creates complete TODO flow matching Prolog example", () => {
|
|
186
|
+
const flow = new SHACLFlow("TODO", "todo://");
|
|
187
|
+
flow.flowable = "any";
|
|
154
188
|
// Start action - renders expression as TODO in 'ready' state
|
|
155
189
|
flow.startAction = [
|
|
156
|
-
{
|
|
190
|
+
{
|
|
191
|
+
action: "addLink",
|
|
192
|
+
source: "this",
|
|
193
|
+
predicate: "todo://state",
|
|
194
|
+
target: "todo://ready",
|
|
195
|
+
},
|
|
157
196
|
];
|
|
158
197
|
// Three states
|
|
159
198
|
flow.addState({
|
|
160
|
-
name:
|
|
199
|
+
name: "ready",
|
|
161
200
|
value: 0,
|
|
162
|
-
stateCheck: { predicate:
|
|
201
|
+
stateCheck: { predicate: "todo://state", target: "todo://ready" },
|
|
163
202
|
});
|
|
164
203
|
flow.addState({
|
|
165
|
-
name:
|
|
204
|
+
name: "doing",
|
|
166
205
|
value: 0.5,
|
|
167
|
-
stateCheck: { predicate:
|
|
206
|
+
stateCheck: { predicate: "todo://state", target: "todo://doing" },
|
|
168
207
|
});
|
|
169
208
|
flow.addState({
|
|
170
|
-
name:
|
|
209
|
+
name: "done",
|
|
171
210
|
value: 1,
|
|
172
|
-
stateCheck: { predicate:
|
|
211
|
+
stateCheck: { predicate: "todo://state", target: "todo://done" },
|
|
173
212
|
});
|
|
174
213
|
// Transitions
|
|
175
214
|
flow.addTransition({
|
|
176
|
-
actionName:
|
|
177
|
-
fromState:
|
|
178
|
-
toState:
|
|
215
|
+
actionName: "Start",
|
|
216
|
+
fromState: "ready",
|
|
217
|
+
toState: "doing",
|
|
179
218
|
actions: [
|
|
180
|
-
{
|
|
181
|
-
|
|
182
|
-
|
|
219
|
+
{
|
|
220
|
+
action: "addLink",
|
|
221
|
+
source: "this",
|
|
222
|
+
predicate: "todo://state",
|
|
223
|
+
target: "todo://doing",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
action: "removeLink",
|
|
227
|
+
source: "this",
|
|
228
|
+
predicate: "todo://state",
|
|
229
|
+
target: "todo://ready",
|
|
230
|
+
},
|
|
231
|
+
],
|
|
183
232
|
});
|
|
184
233
|
flow.addTransition({
|
|
185
|
-
actionName:
|
|
186
|
-
fromState:
|
|
187
|
-
toState:
|
|
234
|
+
actionName: "Finish",
|
|
235
|
+
fromState: "doing",
|
|
236
|
+
toState: "done",
|
|
188
237
|
actions: [
|
|
189
|
-
{
|
|
190
|
-
|
|
191
|
-
|
|
238
|
+
{
|
|
239
|
+
action: "addLink",
|
|
240
|
+
source: "this",
|
|
241
|
+
predicate: "todo://state",
|
|
242
|
+
target: "todo://done",
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
action: "removeLink",
|
|
246
|
+
source: "this",
|
|
247
|
+
predicate: "todo://state",
|
|
248
|
+
target: "todo://doing",
|
|
249
|
+
},
|
|
250
|
+
],
|
|
192
251
|
});
|
|
193
252
|
// Verify structure
|
|
194
253
|
expect(flow.states.length).toBe(3);
|
|
@@ -21,7 +21,7 @@ export interface SHACLPropertyShape {
|
|
|
21
21
|
/** Expected datatype (e.g., xsd:string, xsd:integer) */
|
|
22
22
|
datatype?: string;
|
|
23
23
|
/** Node kind constraint (IRI, Literal, BlankNode) */
|
|
24
|
-
nodeKind?:
|
|
24
|
+
nodeKind?: "IRI" | "Literal" | "BlankNode";
|
|
25
25
|
/** Minimum cardinality (required if >= 1) */
|
|
26
26
|
minCount?: number;
|
|
27
27
|
/** Maximum cardinality (single-valued if 1, omit for collections) */
|
|
@@ -36,8 +36,8 @@ export interface SHACLPropertyShape {
|
|
|
36
36
|
hasValue?: string;
|
|
37
37
|
/** AD4M-specific: Local-only property */
|
|
38
38
|
local?: boolean;
|
|
39
|
-
/** AD4M-specific:
|
|
40
|
-
|
|
39
|
+
/** AD4M-specific: Read-only property (no setter actions) */
|
|
40
|
+
readOnly?: boolean;
|
|
41
41
|
/** AD4M-specific: Language to resolve property values through */
|
|
42
42
|
resolveLanguage?: string;
|
|
43
43
|
/** AD4M-specific: Setter action for this property */
|
|
@@ -46,6 +46,8 @@ export interface SHACLPropertyShape {
|
|
|
46
46
|
adder?: AD4MAction[];
|
|
47
47
|
/** AD4M-specific: Remover action for collection properties */
|
|
48
48
|
remover?: AD4MAction[];
|
|
49
|
+
/** AD4M-specific: Reverse path traversal — sh:inversePath instead of sh:path */
|
|
50
|
+
inversePath?: boolean;
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
53
|
* SHACL Node Shape
|
|
@@ -58,6 +60,12 @@ export declare class SHACLShape {
|
|
|
58
60
|
targetClass?: string;
|
|
59
61
|
/** Property constraints */
|
|
60
62
|
properties: SHACLPropertyShape[];
|
|
63
|
+
/**
|
|
64
|
+
* Parent shape URIs for SHACL inheritance (sh:node references).
|
|
65
|
+
* When a model class extends another @Model-decorated class, the child shape
|
|
66
|
+
* references the parent shape via sh:node rather than duplicating its properties.
|
|
67
|
+
*/
|
|
68
|
+
parentShapes?: string[];
|
|
61
69
|
/** AD4M-specific: Constructor actions for creating instances */
|
|
62
70
|
constructor_actions?: AD4MAction[];
|
|
63
71
|
/** AD4M-specific: Destructor actions for removing instances */
|
|
@@ -73,6 +81,12 @@ export declare class SHACLShape {
|
|
|
73
81
|
* Add a property constraint to this shape
|
|
74
82
|
*/
|
|
75
83
|
addProperty(prop: SHACLPropertyShape): void;
|
|
84
|
+
/**
|
|
85
|
+
* Add a parent shape reference (sh:node) for SHACL inheritance.
|
|
86
|
+
* The child shape will reference the parent shape instead of duplicating its properties.
|
|
87
|
+
* @param parentShapeUri - URI of the parent SHACL shape
|
|
88
|
+
*/
|
|
89
|
+
addParentShape(parentShapeUri: string): void;
|
|
76
90
|
/**
|
|
77
91
|
* Set constructor actions for this shape
|
|
78
92
|
*/
|