@coasys/ad4m 0.13.0-test-7 → 0.13.0-test-8
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/lib/index.cjs +1109 -828
- package/lib/index.js +1096 -828
- package/lib/src/Ad4mClient.d.ts +4 -1
- package/lib/src/Ad4mClient.js +2 -2
- package/lib/src/agent/AgentClient.js +17 -0
- package/lib/src/ai/AIClient.js +1 -1
- package/lib/src/apiClient.d.ts +5 -1
- package/lib/src/apiClient.js +14 -6
- package/lib/src/generated/rest/AIModelLoadingStatus.d.ts +7 -0
- package/lib/src/generated/rest/AIModelLoadingStatus.js +2 -0
- package/lib/src/generated/rest/AddAgentInfosRequest.d.ts +3 -0
- package/lib/src/generated/rest/AddAgentInfosRequest.js +2 -0
- package/lib/src/generated/rest/AddLinkExpressionRequest.d.ts +6 -0
- package/lib/src/generated/rest/AddLinkExpressionRequest.js +1 -0
- package/lib/src/generated/rest/AddLinkRequest.d.ts +6 -0
- package/lib/src/generated/rest/AddLinkRequest.js +1 -0
- package/lib/src/generated/rest/AddLinksBulkRequest.d.ts +6 -0
- package/lib/src/generated/rest/AddLinksBulkRequest.js +1 -0
- package/lib/src/generated/rest/AddSdnaRequest.d.ts +6 -0
- package/lib/src/generated/rest/AddSdnaRequest.js +2 -0
- package/lib/src/generated/rest/ApplyTemplateRequest.d.ts +4 -0
- package/lib/src/generated/rest/ApplyTemplateRequest.js +2 -0
- package/lib/src/generated/rest/AuthInfoInput.d.ts +10 -0
- package/lib/src/generated/rest/AuthInfoInput.js +1 -0
- package/lib/src/generated/rest/BroadcastRequest.d.ts +6 -0
- package/lib/src/generated/rest/BroadcastRequest.js +1 -0
- package/lib/src/generated/rest/CapabilityInput.d.ts +5 -0
- package/lib/src/generated/rest/CapabilityInput.js +1 -0
- package/lib/src/generated/rest/CommitBatchRequest.d.ts +3 -0
- package/lib/src/generated/rest/CommitBatchRequest.js +2 -0
- package/lib/src/generated/rest/ComputeLogEntry.d.ts +9 -0
- package/lib/src/generated/rest/ComputeLogEntry.js +2 -0
- package/lib/src/generated/rest/CreateExpressionRequest.d.ts +4 -0
- package/lib/src/generated/rest/CreateExpressionRequest.js +2 -0
- package/lib/src/generated/rest/CreatePerspectiveRequest.d.ts +3 -0
- package/lib/src/generated/rest/CreatePerspectiveRequest.js +2 -0
- package/lib/src/generated/rest/CreateSubjectRequest.d.ts +6 -0
- package/lib/src/generated/rest/CreateSubjectRequest.js +2 -0
- package/lib/src/generated/rest/CreateUserRequest.d.ts +4 -0
- package/lib/src/generated/rest/CreateUserRequest.js +2 -0
- package/lib/src/generated/rest/CreateUserResponse.d.ts +5 -0
- package/lib/src/generated/rest/CreateUserResponse.js +2 -0
- package/lib/src/generated/rest/DecoratedExpressionProof.d.ts +6 -0
- package/lib/src/generated/rest/DecoratedExpressionProof.js +2 -0
- package/lib/src/generated/rest/DecoratedLinkExpression.d.ts +10 -0
- package/lib/src/generated/rest/DecoratedLinkExpression.js +1 -0
- package/lib/src/generated/rest/DisposeQueryRequest.d.ts +3 -0
- package/lib/src/generated/rest/DisposeQueryRequest.js +2 -0
- package/lib/src/generated/rest/EmailTestRequest.d.ts +6 -0
- package/lib/src/generated/rest/EmailTestRequest.js +2 -0
- package/lib/src/generated/rest/EmbedRequest.d.ts +4 -0
- package/lib/src/generated/rest/EmbedRequest.js +2 -0
- package/lib/src/generated/rest/EntanglementProofInput.d.ts +6 -0
- package/lib/src/generated/rest/EntanglementProofInput.js +2 -0
- package/lib/src/generated/rest/EntanglementProofPreflightRequest.d.ts +4 -0
- package/lib/src/generated/rest/EntanglementProofPreflightRequest.js +2 -0
- package/lib/src/generated/rest/ExecuteCommandsRequest.d.ts +4 -0
- package/lib/src/generated/rest/ExecuteCommandsRequest.js +2 -0
- package/lib/src/generated/rest/ExportRequest.d.ts +5 -0
- package/lib/src/generated/rest/ExportRequest.js +2 -0
- package/lib/src/generated/rest/ExpressionManyRequest.d.ts +3 -0
- package/lib/src/generated/rest/ExpressionManyRequest.js +2 -0
- package/lib/src/generated/rest/ExpressionProof.d.ts +4 -0
- package/lib/src/generated/rest/ExpressionProof.js +2 -0
- package/lib/src/generated/rest/ExpressionProofInput.d.ts +6 -0
- package/lib/src/generated/rest/ExpressionProofInput.js +2 -0
- package/lib/src/generated/rest/FriendSendMessageRequest.d.ts +3 -0
- package/lib/src/generated/rest/FriendSendMessageRequest.js +2 -0
- package/lib/src/generated/rest/FriendsListRequest.d.ts +3 -0
- package/lib/src/generated/rest/FriendsListRequest.js +2 -0
- package/lib/src/generated/rest/GenerateAgentRequest.d.ts +3 -0
- package/lib/src/generated/rest/GenerateAgentRequest.js +2 -0
- package/lib/src/generated/rest/GenerateJwtRequest.d.ts +4 -0
- package/lib/src/generated/rest/GenerateJwtRequest.js +2 -0
- package/lib/src/generated/rest/GetSubjectDataRequest.d.ts +4 -0
- package/lib/src/generated/rest/GetSubjectDataRequest.js +2 -0
- package/lib/src/generated/rest/HostingInfoResponse.d.ts +5 -0
- package/lib/src/generated/rest/HostingInfoResponse.js +2 -0
- package/lib/src/generated/rest/HostingWalletResponse.d.ts +4 -0
- package/lib/src/generated/rest/HostingWalletResponse.js +2 -0
- package/lib/src/generated/rest/ImportAgentRequest.d.ts +6 -0
- package/lib/src/generated/rest/ImportAgentRequest.js +2 -0
- package/lib/src/generated/rest/ImportRequest.d.ts +4 -0
- package/lib/src/generated/rest/ImportRequest.js +2 -0
- package/lib/src/generated/rest/JoinNeighbourhoodRequest.d.ts +3 -0
- package/lib/src/generated/rest/JoinNeighbourhoodRequest.js +2 -0
- package/lib/src/generated/rest/KeepAliveQueryRequest.d.ts +3 -0
- package/lib/src/generated/rest/KeepAliveQueryRequest.js +2 -0
- package/lib/src/generated/rest/LanguageMetaInput.d.ts +6 -0
- package/lib/src/generated/rest/LanguageMetaInput.js +2 -0
- package/lib/src/generated/rest/Link.d.ts +5 -0
- package/lib/src/generated/rest/Link.js +2 -0
- package/lib/src/generated/rest/LinkExpression.d.ts +10 -0
- package/lib/src/generated/rest/LinkExpression.js +1 -0
- package/lib/src/generated/rest/LinkExpressionInput.d.ts +10 -0
- package/lib/src/generated/rest/LinkExpressionInput.js +1 -0
- package/lib/src/generated/rest/LinkInput.d.ts +5 -0
- package/lib/src/generated/rest/LinkInput.js +2 -0
- package/lib/src/generated/rest/LinkLanguageTemplatesRequest.d.ts +3 -0
- package/lib/src/generated/rest/LinkLanguageTemplatesRequest.js +2 -0
- package/lib/src/generated/rest/LinkMutationRequest.d.ts +12 -0
- package/lib/src/generated/rest/LinkMutationRequest.js +1 -0
- package/lib/src/generated/rest/LinkMutationResponse.d.ts +9 -0
- package/lib/src/generated/rest/LinkMutationResponse.js +1 -0
- package/lib/src/generated/rest/LinkMutations.d.ts +6 -0
- package/lib/src/generated/rest/LinkMutations.js +1 -0
- package/lib/src/generated/rest/LinkMutationsRequest.d.ts +5 -0
- package/lib/src/generated/rest/LinkMutationsRequest.js +1 -0
- package/lib/src/generated/rest/LinkStatus.d.ts +1 -0
- package/lib/src/generated/rest/LinkStatus.js +2 -0
- package/lib/src/generated/rest/LinkUpdateInput.d.ts +5 -0
- package/lib/src/generated/rest/LinkUpdateInput.js +1 -0
- package/lib/src/generated/rest/LockAgentRequest.d.ts +3 -0
- package/lib/src/generated/rest/LockAgentRequest.js +2 -0
- package/lib/src/generated/rest/LoginUserRequest.d.ts +5 -0
- package/lib/src/generated/rest/LoginUserRequest.js +2 -0
- package/lib/src/generated/rest/ModelType.d.ts +1 -0
- package/lib/src/generated/rest/ModelType.js +2 -0
- package/lib/src/generated/rest/NotificationGrantRequest.d.ts +3 -0
- package/lib/src/generated/rest/NotificationGrantRequest.js +2 -0
- package/lib/src/generated/rest/NotificationInput.d.ts +10 -0
- package/lib/src/generated/rest/NotificationInput.js +2 -0
- package/lib/src/generated/rest/OpenLinkRequest.d.ts +3 -0
- package/lib/src/generated/rest/OpenLinkRequest.js +2 -0
- package/lib/src/generated/rest/PermitCapabilityRequest.d.ts +3 -0
- package/lib/src/generated/rest/PermitCapabilityRequest.js +2 -0
- package/lib/src/generated/rest/PerspectiveInput.d.ts +4 -0
- package/lib/src/generated/rest/PerspectiveInput.js +1 -0
- package/lib/src/generated/rest/PromptRequest.d.ts +4 -0
- package/lib/src/generated/rest/PromptRequest.js +2 -0
- package/lib/src/generated/rest/PublicPerspectiveInput.d.ts +4 -0
- package/lib/src/generated/rest/PublicPerspectiveInput.js +1 -0
- package/lib/src/generated/rest/PublishLanguageRequest.d.ts +5 -0
- package/lib/src/generated/rest/PublishLanguageRequest.js +1 -0
- package/lib/src/generated/rest/PublishNeighbourhoodRequest.d.ts +6 -0
- package/lib/src/generated/rest/PublishNeighbourhoodRequest.js +1 -0
- package/lib/src/generated/rest/QueryRequest.d.ts +7 -0
- package/lib/src/generated/rest/QueryRequest.js +2 -0
- package/lib/src/generated/rest/RemoveLinkRequest.d.ts +5 -0
- package/lib/src/generated/rest/RemoveLinkRequest.js +1 -0
- package/lib/src/generated/rest/RemoveLinksBulkRequest.d.ts +5 -0
- package/lib/src/generated/rest/RemoveLinksBulkRequest.js +1 -0
- package/lib/src/generated/rest/RequestCapabilityRequest.d.ts +4 -0
- package/lib/src/generated/rest/RequestCapabilityRequest.js +1 -0
- package/lib/src/generated/rest/RequestPaymentRequest.d.ts +3 -0
- package/lib/src/generated/rest/RequestPaymentRequest.js +2 -0
- package/lib/src/generated/rest/RequestVerificationRequest.d.ts +4 -0
- package/lib/src/generated/rest/RequestVerificationRequest.js +2 -0
- package/lib/src/generated/rest/ResourceInput.d.ts +4 -0
- package/lib/src/generated/rest/ResourceInput.js +2 -0
- package/lib/src/generated/rest/SetDefaultModelRequest.d.ts +4 -0
- package/lib/src/generated/rest/SetDefaultModelRequest.js +1 -0
- package/lib/src/generated/rest/SetFreeHostingEnabledRequest.d.ts +3 -0
- package/lib/src/generated/rest/SetFreeHostingEnabledRequest.js +2 -0
- package/lib/src/generated/rest/SetHotWalletAddressRequest.d.ts +3 -0
- package/lib/src/generated/rest/SetHotWalletAddressRequest.js +2 -0
- package/lib/src/generated/rest/SetMultiUserRequest.d.ts +3 -0
- package/lib/src/generated/rest/SetMultiUserRequest.js +2 -0
- package/lib/src/generated/rest/SetOnlineStatusRequest.d.ts +5 -0
- package/lib/src/generated/rest/SetOnlineStatusRequest.js +1 -0
- package/lib/src/generated/rest/SetStatusRequest.d.ts +3 -0
- package/lib/src/generated/rest/SetStatusRequest.js +2 -0
- package/lib/src/generated/rest/SetUserFreeAccessRequest.d.ts +4 -0
- package/lib/src/generated/rest/SetUserFreeAccessRequest.js +2 -0
- package/lib/src/generated/rest/SignMessageRequest.d.ts +3 -0
- package/lib/src/generated/rest/SignMessageRequest.js +2 -0
- package/lib/src/generated/rest/SignalRequest.d.ts +6 -0
- package/lib/src/generated/rest/SignalRequest.js +1 -0
- package/lib/src/generated/rest/SubscribeQueryRequest.d.ts +3 -0
- package/lib/src/generated/rest/SubscribeQueryRequest.js +2 -0
- package/lib/src/generated/rest/SubscribeQueryResponse.d.ts +4 -0
- package/lib/src/generated/rest/SubscribeQueryResponse.js +2 -0
- package/lib/src/generated/rest/TrustedAgentsRequest.d.ts +3 -0
- package/lib/src/generated/rest/TrustedAgentsRequest.js +2 -0
- package/lib/src/generated/rest/UnlockAgentRequest.d.ts +4 -0
- package/lib/src/generated/rest/UnlockAgentRequest.js +2 -0
- package/lib/src/generated/rest/UpdateLinkRequest.d.ts +7 -0
- package/lib/src/generated/rest/UpdateLinkRequest.js +1 -0
- package/lib/src/generated/rest/UpdatePerspectiveRequest.d.ts +3 -0
- package/lib/src/generated/rest/UpdatePerspectiveRequest.js +2 -0
- package/lib/src/generated/rest/UpdateProfileRequest.d.ts +5 -0
- package/lib/src/generated/rest/UpdateProfileRequest.js +1 -0
- package/lib/src/generated/rest/UserStatistics.d.ts +9 -0
- package/lib/src/generated/rest/UserStatistics.js +2 -0
- package/lib/src/generated/rest/VerificationRequestResult.d.ts +6 -0
- package/lib/src/generated/rest/VerificationRequestResult.js +2 -0
- package/lib/src/generated/rest/VerifyEmailRequest.d.ts +6 -0
- package/lib/src/generated/rest/VerifyEmailRequest.js +2 -0
- package/lib/src/generated/rest/VerifySignatureRequest.d.ts +5 -0
- package/lib/src/generated/rest/VerifySignatureRequest.js +2 -0
- package/lib/src/generated/rest/WriteSettingsRequest.d.ts +3 -0
- package/lib/src/generated/rest/WriteSettingsRequest.js +2 -0
- package/lib/src/generated/rest/index.d.ts +73 -0
- package/lib/src/generated/rest/index.js +8 -0
- package/lib/src/generated/rest/routes.d.ts +587 -0
- package/lib/src/generated/rest/routes.js +3 -0
- package/lib/src/index.d.ts +4 -0
- package/lib/src/index.js +4 -0
- package/lib/src/model/Ad4mModel.d.ts +30 -36
- package/lib/src/model/Ad4mModel.js +93 -382
- package/lib/src/model/Ad4mModel.test.js +735 -480
- package/lib/src/model/ModelQueryBuilder.d.ts +5 -10
- package/lib/src/model/ModelQueryBuilder.js +142 -62
- package/lib/src/model/decorators.d.ts +7 -4
- package/lib/src/model/decorators.js +0 -7
- package/lib/src/model/query-sparql.d.ts +0 -10
- package/lib/src/model/query-sparql.js +10 -15
- package/lib/src/model/query-sparql.test.js +10 -92
- package/lib/src/model/query-surreal.d.ts +44 -0
- package/lib/src/model/query-surreal.js +249 -0
- package/lib/src/model/shacl-gen.js +120 -47
- package/lib/src/model/surreal-utils.d.ts +42 -0
- package/lib/src/model/surreal-utils.js +128 -0
- package/lib/src/model/types.d.ts +140 -4
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +33 -33
- package/lib/src/perspectives/PerspectiveClient.d.ts +13 -4
- package/lib/src/perspectives/PerspectiveClient.js +22 -6
- package/lib/src/perspectives/PerspectiveProxy.d.ts +27 -7
- package/lib/src/perspectives/PerspectiveProxy.js +60 -12
- package/lib/src/perspectives/PerspectiveProxy.test.d.ts +1 -0
- package/lib/src/perspectives/PerspectiveProxy.test.js +34 -0
- package/lib/src/perspectives/SparqlBindings.d.ts +47 -0
- package/lib/src/perspectives/SparqlBindings.js +65 -0
- package/lib/src/perspectives/WakerSubscriptionManager.js +5 -4
- package/lib/src/restClient.d.ts +52 -0
- package/lib/src/restClient.js +227 -0
- package/lib/src/shacl/NodeExpression.d.ts +44 -0
- package/lib/src/shacl/NodeExpression.js +39 -0
- package/lib/src/shacl/SHACLShape.d.ts +23 -0
- package/lib/src/shacl/SHACLShape.js +115 -1
- package/lib/src/shacl/SHACLShape.test.js +0 -82
- package/lib/src/shacl/builders.d.ts +58 -0
- package/lib/src/shacl/builders.js +76 -0
- package/lib/src/shacl/index.d.ts +36 -0
- package/lib/src/shacl/index.js +33 -0
- package/package.json +11 -8
- package/src/Ad4mClient.ts +7 -2
- package/src/agent/AgentClient.ts +23 -0
- package/src/ai/AIClient.ts +1 -1
- package/src/apiClient.ts +17 -6
- package/src/index.ts +4 -0
- package/src/model/Ad4mModel.test.ts +274 -72
- package/src/model/Ad4mModel.ts +140 -420
- package/src/model/ModelQueryBuilder.ts +136 -71
- package/src/model/decorators.ts +7 -13
- package/src/model/query-sparql.test.ts +35 -19
- package/src/model/query-sparql.ts +10 -16
- package/src/model/relation-filtering.test.ts +46 -39
- package/src/model/shacl-gen.ts +128 -54
- package/src/model/shacl-roundtrip.test.ts +197 -0
- package/src/model/types-typed-query.test.ts +360 -0
- package/src/model/types.ts +196 -4
- package/src/perspectives/PerspectiveClient.ts +24 -8
- package/src/perspectives/PerspectiveProxy.test.ts +85 -1
- package/src/perspectives/PerspectiveProxy.ts +65 -20
- package/src/perspectives/SparqlBindings.ts +79 -0
- package/src/perspectives/WakerSubscriptionManager.ts +5 -4
- package/src/shacl/NodeExpression.ts +54 -0
- package/src/shacl/SHACLShape.test.ts +172 -0
- package/src/shacl/SHACLShape.ts +173 -1
- package/src/shacl/builders.ts +86 -0
- package/src/shacl/index.ts +72 -0
- package/lib/src/model/model-manifest.d.ts +0 -41
- package/lib/src/model/model-manifest.js +0 -11
|
@@ -10,6 +10,7 @@ import type { PerspectiveProxy } from "../perspectives/PerspectiveProxy";
|
|
|
10
10
|
import type {
|
|
11
11
|
Where, Order, IncludeMap, Query,
|
|
12
12
|
ResultsWithTotalCount, PaginationResult,
|
|
13
|
+
TypedWhere, TypedOrder, TypedIncludeMap, PropertyKeysOf,
|
|
13
14
|
} from "./types";
|
|
14
15
|
|
|
15
16
|
/** Query builder for Ad4mModel queries.
|
|
@@ -80,8 +81,8 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
80
81
|
* })
|
|
81
82
|
* ```
|
|
82
83
|
*/
|
|
83
|
-
where(conditions:
|
|
84
|
-
this.queryParams.where = conditions;
|
|
84
|
+
where(conditions: TypedWhere<T>): ModelQueryBuilder<T> {
|
|
85
|
+
this.queryParams.where = conditions as Where;
|
|
85
86
|
return this;
|
|
86
87
|
}
|
|
87
88
|
|
|
@@ -96,8 +97,8 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
96
97
|
* .order({ createdAt: "DESC" })
|
|
97
98
|
* ```
|
|
98
99
|
*/
|
|
99
|
-
order(orderBy:
|
|
100
|
-
this.queryParams.order = orderBy;
|
|
100
|
+
order(orderBy: TypedOrder<T>): ModelQueryBuilder<T> {
|
|
101
|
+
this.queryParams.order = orderBy as Order;
|
|
101
102
|
return this;
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -218,8 +219,8 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
218
219
|
* .properties(["name", "description", "rating"])
|
|
219
220
|
* ```
|
|
220
221
|
*/
|
|
221
|
-
properties(properties: string[]): ModelQueryBuilder<T> {
|
|
222
|
-
this.queryParams.properties = properties;
|
|
222
|
+
properties(properties: PropertyKeysOf<T>[] | string[]): ModelQueryBuilder<T> {
|
|
223
|
+
this.queryParams.properties = properties as string[];
|
|
223
224
|
return this;
|
|
224
225
|
}
|
|
225
226
|
|
|
@@ -272,8 +273,8 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
272
273
|
* .run();
|
|
273
274
|
* ```
|
|
274
275
|
*/
|
|
275
|
-
include(map:
|
|
276
|
-
this.queryParams.include = map;
|
|
276
|
+
include(map: TypedIncludeMap<T>): ModelQueryBuilder<T> {
|
|
277
|
+
this.queryParams.include = map as IncludeMap;
|
|
277
278
|
return this;
|
|
278
279
|
}
|
|
279
280
|
|
|
@@ -282,14 +283,6 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
282
283
|
return this;
|
|
283
284
|
}
|
|
284
285
|
|
|
285
|
-
/**
|
|
286
|
-
* Sets the query engine to use.
|
|
287
|
-
* @deprecated Prolog engine has been removed. All queries use SPARQL/Rust.
|
|
288
|
-
*/
|
|
289
|
-
engine(_eng: 'sparql' | 'prolog'): ModelQueryBuilder<T> {
|
|
290
|
-
return this;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
286
|
/**
|
|
294
287
|
* Executes the query once and returns the results.
|
|
295
288
|
*
|
|
@@ -336,8 +329,10 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
336
329
|
* ```
|
|
337
330
|
*/
|
|
338
331
|
async first(): Promise<T | null> {
|
|
332
|
+
const savedLimit = this.queryParams.limit;
|
|
339
333
|
this.queryParams.limit = 1;
|
|
340
334
|
const results = await this.get();
|
|
335
|
+
this.queryParams.limit = savedLimit;
|
|
341
336
|
return results[0] ?? null;
|
|
342
337
|
}
|
|
343
338
|
|
|
@@ -375,15 +370,16 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
375
370
|
|
|
376
371
|
const ctor = this.ctor;
|
|
377
372
|
|
|
378
|
-
// Build the model query params (className, queryJson
|
|
379
|
-
|
|
373
|
+
// Build the model query params (className, queryJson). The executor
|
|
374
|
+
// resolves the shape from the perspective's SHACL triples.
|
|
375
|
+
const { className, queryJson } = (ctor as any).prepareModelQueryParams(
|
|
380
376
|
this.queryParams, this.modelClassName
|
|
381
377
|
);
|
|
382
378
|
|
|
383
379
|
// Register model subscription via Rust — this builds trigger SPARQL internally,
|
|
384
380
|
// registers the subscription, and runs the initial query in one call.
|
|
385
381
|
const { subscriptionId, result: initialModelResult } = await this.perspective.modelSubscribe(
|
|
386
|
-
className, queryJson
|
|
382
|
+
className, queryJson
|
|
387
383
|
);
|
|
388
384
|
|
|
389
385
|
// Convert JSON instances to model class instances
|
|
@@ -391,15 +387,8 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
391
387
|
return (ctor as any).parseModelResult(this.perspective, raw, this.queryParams.include, this.queryParams.properties);
|
|
392
388
|
};
|
|
393
389
|
|
|
394
|
-
//
|
|
395
|
-
|
|
396
|
-
const resolveAndReturn = async (instances: T[]): Promise<T[]> => {
|
|
397
|
-
await (ctor as any).resolveNonLiteralProps(this.perspective, instances);
|
|
398
|
-
return instances;
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
// Parse initial results (with non-literal resolution)
|
|
402
|
-
const initialResults = await resolveAndReturn(parseResults(initialModelResult));
|
|
390
|
+
// Transforms are now applied by the Rust executor during hydration
|
|
391
|
+
const initialResults = parseResults(initialModelResult);
|
|
403
392
|
|
|
404
393
|
// Track last emitted result fingerprint to suppress duplicate callbacks
|
|
405
394
|
let lastResultFingerprint: string | null = null;
|
|
@@ -417,35 +406,62 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
417
406
|
subscriptionId,
|
|
418
407
|
(rawResult: any) => {
|
|
419
408
|
try {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
callback
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
});
|
|
409
|
+
const results = parseResults(rawResult);
|
|
410
|
+
console.debug(`[ModelQueryBuilder.subscribe] Update received for ${subscriptionId}: ${results.length} instances`);
|
|
411
|
+
const fp = buildFingerprint(results);
|
|
412
|
+
if (fp === lastResultFingerprint) {
|
|
413
|
+
console.debug(`[ModelQueryBuilder.subscribe] Fingerprint unchanged, skipping callback`);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
console.debug(`[ModelQueryBuilder.subscribe] Fingerprint changed, calling callback with ${results.length} results`);
|
|
417
|
+
lastResultFingerprint = fp;
|
|
418
|
+
callback(results);
|
|
428
419
|
} catch (e) {
|
|
429
420
|
console.error('Model subscription update parse error:', e);
|
|
430
421
|
}
|
|
431
422
|
},
|
|
432
423
|
);
|
|
433
424
|
|
|
434
|
-
// Set up keepalive with
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
425
|
+
// Set up keepalive with recovery — uses setTimeout loop so we can
|
|
426
|
+
// break out and resubscribe when the server evicts the subscription.
|
|
427
|
+
let disposed = false;
|
|
428
|
+
let keepaliveTimer: ReturnType<typeof setTimeout> | undefined;
|
|
429
|
+
let resubscribeAttempts = 0;
|
|
430
|
+
const MAX_RESUBSCRIBE_ATTEMPTS = 5;
|
|
431
|
+
const keepaliveLoop = async () => {
|
|
432
|
+
if (disposed) return;
|
|
433
|
+
try {
|
|
434
|
+
await this.perspective.client.keepAliveQuery(this.perspective.uuid, subscriptionId);
|
|
435
|
+
resubscribeAttempts = 0; // Reset on success
|
|
436
|
+
} catch (e: any) {
|
|
437
|
+
console.warn(`Model subscription keepalive failed for ${subscriptionId}:`, e);
|
|
438
|
+
if (!disposed && resubscribeAttempts < MAX_RESUBSCRIBE_ATTEMPTS) {
|
|
439
|
+
resubscribeAttempts++;
|
|
440
|
+
const backoffMs = Math.min(1000 * Math.pow(2, resubscribeAttempts), 60000);
|
|
441
|
+
console.warn(`Resubscribing (attempt ${resubscribeAttempts}/${MAX_RESUBSCRIBE_ATTEMPTS}, backoff ${backoffMs}ms)...`);
|
|
442
|
+
await new Promise(r => setTimeout(r, backoffMs));
|
|
443
|
+
try {
|
|
444
|
+
unsubscribe();
|
|
445
|
+
await this.subscribe(callback);
|
|
446
|
+
} catch (resubErr) {
|
|
447
|
+
console.error('Model subscription resubscribe failed:', resubErr);
|
|
448
|
+
}
|
|
449
|
+
} else if (resubscribeAttempts >= MAX_RESUBSCRIBE_ATTEMPTS) {
|
|
450
|
+
console.error(`Model subscription ${subscriptionId}: max resubscribe attempts reached, giving up.`);
|
|
451
|
+
}
|
|
452
|
+
return; // new subscription owns its own keepalive loop
|
|
453
|
+
}
|
|
454
|
+
if (!disposed) {
|
|
455
|
+
keepaliveTimer = setTimeout(keepaliveLoop, 30000);
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
keepaliveTimer = setTimeout(keepaliveLoop, 30000);
|
|
444
459
|
|
|
445
460
|
// Store dispose function
|
|
446
461
|
this.currentSubscription = {
|
|
447
462
|
dispose: () => {
|
|
448
|
-
|
|
463
|
+
disposed = true;
|
|
464
|
+
if (keepaliveTimer) clearTimeout(keepaliveTimer);
|
|
449
465
|
unsubscribe();
|
|
450
466
|
this.perspective.client.disposeQuerySubscription(this.perspective.uuid, subscriptionId).catch(() => {});
|
|
451
467
|
},
|
|
@@ -525,12 +541,12 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
525
541
|
this.dispose();
|
|
526
542
|
|
|
527
543
|
const countParams = { ...this.queryParams, limit: 0 };
|
|
528
|
-
const { className, queryJson
|
|
544
|
+
const { className, queryJson } = (this.ctor as any).prepareModelQueryParams(
|
|
529
545
|
countParams, this.modelClassName
|
|
530
546
|
);
|
|
531
547
|
|
|
532
548
|
const { subscriptionId, result: initialModelResult } = await this.perspective.modelSubscribe(
|
|
533
|
-
className, queryJson
|
|
549
|
+
className, queryJson
|
|
534
550
|
);
|
|
535
551
|
|
|
536
552
|
const parseCount = (raw: any): number => {
|
|
@@ -551,19 +567,43 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
551
567
|
},
|
|
552
568
|
);
|
|
553
569
|
|
|
554
|
-
let
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
570
|
+
let disposed = false;
|
|
571
|
+
let keepaliveTimer: ReturnType<typeof setTimeout> | undefined;
|
|
572
|
+
let resubscribeAttempts = 0;
|
|
573
|
+
const MAX_RESUBSCRIBE_ATTEMPTS = 5;
|
|
574
|
+
const keepaliveLoop = async () => {
|
|
575
|
+
if (disposed) return;
|
|
576
|
+
try {
|
|
577
|
+
await this.perspective.client.keepAliveQuery(this.perspective.uuid, subscriptionId);
|
|
578
|
+
resubscribeAttempts = 0;
|
|
579
|
+
} catch (e: any) {
|
|
580
|
+
console.warn(`Count subscription keepalive failed for ${subscriptionId}:`, e);
|
|
581
|
+
if (!disposed && resubscribeAttempts < MAX_RESUBSCRIBE_ATTEMPTS) {
|
|
582
|
+
resubscribeAttempts++;
|
|
583
|
+
const backoffMs = Math.min(1000 * Math.pow(2, resubscribeAttempts), 60000);
|
|
584
|
+
console.warn(`Count resubscribing (attempt ${resubscribeAttempts}/${MAX_RESUBSCRIBE_ATTEMPTS}, backoff ${backoffMs}ms)...`);
|
|
585
|
+
await new Promise(r => setTimeout(r, backoffMs));
|
|
586
|
+
try {
|
|
587
|
+
unsubscribe();
|
|
588
|
+
await this.countSubscribe(callback);
|
|
589
|
+
} catch (resubErr) {
|
|
590
|
+
console.error('Count subscription resubscribe failed:', resubErr);
|
|
591
|
+
}
|
|
592
|
+
} else if (resubscribeAttempts >= MAX_RESUBSCRIBE_ATTEMPTS) {
|
|
593
|
+
console.error(`Count subscription ${subscriptionId}: max resubscribe attempts reached, giving up.`);
|
|
594
|
+
}
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
if (!disposed) {
|
|
598
|
+
keepaliveTimer = setTimeout(keepaliveLoop, 30000);
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
keepaliveTimer = setTimeout(keepaliveLoop, 30000);
|
|
563
602
|
|
|
564
603
|
this.currentSubscription = {
|
|
565
604
|
dispose: () => {
|
|
566
|
-
|
|
605
|
+
disposed = true;
|
|
606
|
+
if (keepaliveTimer) clearTimeout(keepaliveTimer);
|
|
567
607
|
unsubscribe();
|
|
568
608
|
this.perspective.client.disposeQuerySubscription(this.perspective.uuid, subscriptionId).catch(() => {});
|
|
569
609
|
},
|
|
@@ -655,12 +695,12 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
655
695
|
const subscriptionParams = { ...(this.queryParams || {}) };
|
|
656
696
|
delete subscriptionParams.limit;
|
|
657
697
|
delete subscriptionParams.offset;
|
|
658
|
-
const { className, queryJson
|
|
698
|
+
const { className, queryJson } = (ctor as any).prepareModelQueryParams(
|
|
659
699
|
subscriptionParams, this.modelClassName
|
|
660
700
|
);
|
|
661
701
|
|
|
662
702
|
const { subscriptionId } = await this.perspective.modelSubscribe(
|
|
663
|
-
className, queryJson
|
|
703
|
+
className, queryJson
|
|
664
704
|
);
|
|
665
705
|
|
|
666
706
|
// Build the paginated query for Rust endpoint (count: true fetches both results and totalCount in one call)
|
|
@@ -679,23 +719,48 @@ export class ModelQueryBuilder<T extends Ad4mModel> {
|
|
|
679
719
|
const unsubscribe = this.perspective.client.subscribeToQueryUpdates(
|
|
680
720
|
subscriptionId,
|
|
681
721
|
(rawResult: any) => {
|
|
722
|
+
console.debug(`[ModelQueryBuilder.paginateSubscribe] Update received for ${subscriptionId}, re-fetching paginated data...`);
|
|
682
723
|
processResults().catch(e => console.error('Paginate subscription error:', e));
|
|
683
724
|
},
|
|
684
725
|
);
|
|
685
726
|
|
|
686
|
-
let
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
727
|
+
let disposed = false;
|
|
728
|
+
let keepaliveTimer: ReturnType<typeof setTimeout> | undefined;
|
|
729
|
+
let resubscribeAttempts = 0;
|
|
730
|
+
const MAX_RESUBSCRIBE_ATTEMPTS = 5;
|
|
731
|
+
const keepaliveLoop = async () => {
|
|
732
|
+
if (disposed) return;
|
|
733
|
+
try {
|
|
734
|
+
await this.perspective.client.keepAliveQuery(this.perspective.uuid, subscriptionId);
|
|
735
|
+
resubscribeAttempts = 0;
|
|
736
|
+
} catch (e: any) {
|
|
737
|
+
console.warn(`Paginate subscription keepalive failed for ${subscriptionId}:`, e);
|
|
738
|
+
if (!disposed && resubscribeAttempts < MAX_RESUBSCRIBE_ATTEMPTS) {
|
|
739
|
+
resubscribeAttempts++;
|
|
740
|
+
const backoffMs = Math.min(1000 * Math.pow(2, resubscribeAttempts), 60000);
|
|
741
|
+
console.warn(`Paginate resubscribing (attempt ${resubscribeAttempts}/${MAX_RESUBSCRIBE_ATTEMPTS}, backoff ${backoffMs}ms)...`);
|
|
742
|
+
await new Promise(r => setTimeout(r, backoffMs));
|
|
743
|
+
try {
|
|
744
|
+
unsubscribe();
|
|
745
|
+
await this.paginateSubscribe(pageSize, pageNumber, callback);
|
|
746
|
+
} catch (resubErr) {
|
|
747
|
+
console.error('Paginate subscription resubscribe failed:', resubErr);
|
|
748
|
+
}
|
|
749
|
+
} else if (resubscribeAttempts >= MAX_RESUBSCRIBE_ATTEMPTS) {
|
|
750
|
+
console.error(`Paginate subscription ${subscriptionId}: max resubscribe attempts reached, giving up.`);
|
|
751
|
+
}
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
if (!disposed) {
|
|
755
|
+
keepaliveTimer = setTimeout(keepaliveLoop, 30000);
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
keepaliveTimer = setTimeout(keepaliveLoop, 30000);
|
|
695
759
|
|
|
696
760
|
this.currentSubscription = {
|
|
697
761
|
dispose: () => {
|
|
698
|
-
|
|
762
|
+
disposed = true;
|
|
763
|
+
if (keepaliveTimer) clearTimeout(keepaliveTimer);
|
|
699
764
|
unsubscribe();
|
|
700
765
|
this.perspective.client.disposeQuerySubscription(this.perspective.uuid, subscriptionId).catch(() => {});
|
|
701
766
|
},
|
package/src/model/decorators.ts
CHANGED
|
@@ -274,11 +274,14 @@ export interface PropertyOptions {
|
|
|
274
274
|
local?: boolean;
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
|
-
* Optional transform
|
|
278
|
-
* This is
|
|
279
|
-
*
|
|
277
|
+
* Optional transform expression to modify the property value.
|
|
278
|
+
* This is a SHACL-AF Node Expression that runs in the Rust model query engine.
|
|
279
|
+
* Examples: `fileToDataUri`, `concat(literal('prefix_'), focus())`, etc.
|
|
280
|
+
* Builders (`focus`, `literal`, `path`, `exists`, `ifExpr`, `concat`,
|
|
281
|
+
* `coalesce`, `fn`) and the `fileToDataUri` built-in are exported from
|
|
282
|
+
* the package root: `import { concat, literal, focus } from '@coasys/ad4m'`.
|
|
280
283
|
*/
|
|
281
|
-
transform?: (
|
|
284
|
+
transform?: import('../shacl/NodeExpression').NodeExpression;
|
|
282
285
|
|
|
283
286
|
/**
|
|
284
287
|
* Allowed values for this property (enum constraint).
|
|
@@ -858,17 +861,8 @@ export function HasMany(
|
|
|
858
861
|
first: (() => Ad4mModelLike) | RelationOptions,
|
|
859
862
|
second?: Omit<RelationOptions, 'target'>,
|
|
860
863
|
): PropertyDecorator {
|
|
861
|
-
const explicitThrough = typeof first === 'function' ? second?.through : (first as RelationOptions).through;
|
|
862
864
|
const opts = resolveRelationArgs(first, second);
|
|
863
865
|
return function <T>(target: T, key: keyof T) {
|
|
864
|
-
if (!explicitThrough && !opts.getter) {
|
|
865
|
-
const className = ((target as any).constructor?.name) ?? 'unknown';
|
|
866
|
-
console.warn(
|
|
867
|
-
`@HasMany on ${className}.${String(key)} has no 'through' predicate — defaulting to 'ad4m://has_child'. ` +
|
|
868
|
-
`Add { through: 'ad4m://has_child' } to silence this warning, or use a semantic predicate ` +
|
|
869
|
-
`like { through: 'myns://has_${String(key)}' } for efficient targeted queries.`
|
|
870
|
-
);
|
|
871
|
-
}
|
|
872
866
|
// --- relation registry ---
|
|
873
867
|
const ctor = (target as any).constructor;
|
|
874
868
|
if (!relationRegistry.has(ctor)) relationRegistry.set(ctor, {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { buildSPARQLQuery, buildPaginationSubquery, hasJsOnlyWhereFilters } from './query-sparql';
|
|
2
2
|
|
|
3
|
-
// Minimal stubs for ModelMetadata
|
|
3
|
+
// Minimal stubs for ModelMetadata
|
|
4
4
|
const emptyMetadata: any = { properties: {}, relations: {} };
|
|
5
5
|
|
|
6
6
|
// Metadata with a required (non-literal) property and a literal-stored property
|
|
@@ -87,19 +87,6 @@ describe('buildSPARQLQuery — SPARQL-level pagination via subquery', () => {
|
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
describe('buildSPARQLOrderLimitOffset', () => {
|
|
91
|
-
it('always returns empty string (pagination uses subquery pattern instead)', () => {
|
|
92
|
-
expect(buildSPARQLOrderLimitOffset(emptyMetadata, {})).toBe('');
|
|
93
|
-
expect(buildSPARQLOrderLimitOffset(emptyMetadata, { limit: 50 })).toBe('');
|
|
94
|
-
expect(buildSPARQLOrderLimitOffset(emptyMetadata, { limit: 50, offset: 100 })).toBe('');
|
|
95
|
-
expect(buildSPARQLOrderLimitOffset(emptyMetadata, { order: { timestamp: 'DESC' } })).toBe('');
|
|
96
|
-
expect(buildSPARQLOrderLimitOffset(emptyMetadata, {
|
|
97
|
-
order: { timestamp: 'DESC' },
|
|
98
|
-
limit: 50,
|
|
99
|
-
offset: 100,
|
|
100
|
-
})).toBe('');
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
90
|
|
|
104
91
|
describe('buildSPARQLQuery — parse_literal push-down filters', () => {
|
|
105
92
|
const modelClass: any = {};
|
|
@@ -161,13 +148,42 @@ describe('buildSPARQLQuery — structural correctness', () => {
|
|
|
161
148
|
expect(sparql).toContain('SELECT DISTINCT ?source');
|
|
162
149
|
});
|
|
163
150
|
|
|
164
|
-
it('
|
|
151
|
+
it('rejects injection attempts through where clause IRI values', () => {
|
|
165
152
|
const query = {
|
|
166
153
|
where: { category: 'some://uri"> . } UNION { SELECT * WHERE { ?s ?p ?o' },
|
|
167
154
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
155
|
+
expect(() => buildSPARQLQuery(richMetadata, emptyRelations, query, modelClass))
|
|
156
|
+
.toThrow('Invalid IRI component');
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('rejects angle brackets in IRI values', () => {
|
|
160
|
+
const query = { where: { category: 'foo<bar>' } };
|
|
161
|
+
expect(() => buildSPARQLQuery(richMetadata, emptyRelations, query, modelClass))
|
|
162
|
+
.toThrow('Invalid IRI component');
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('rejects curly braces in IRI values', () => {
|
|
166
|
+
const query = { where: { category: 'foo{bar}' } };
|
|
167
|
+
expect(() => buildSPARQLQuery(richMetadata, emptyRelations, query, modelClass))
|
|
168
|
+
.toThrow('Invalid IRI component');
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('rejects spaces in IRI values', () => {
|
|
172
|
+
const query = { where: { category: 'foo bar' } };
|
|
173
|
+
expect(() => buildSPARQLQuery(richMetadata, emptyRelations, query, modelClass))
|
|
174
|
+
.toThrow('Invalid IRI component');
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('rejects double quotes in IRI values', () => {
|
|
178
|
+
const query = { where: { category: 'foo"bar' } };
|
|
179
|
+
expect(() => buildSPARQLQuery(richMetadata, emptyRelations, query, modelClass))
|
|
180
|
+
.toThrow('Invalid IRI component');
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('allows valid URIs through iri()', () => {
|
|
184
|
+
const query = { where: { category: 'https://example.com/category/food' } };
|
|
185
|
+
expect(() => buildSPARQLQuery(richMetadata, emptyRelations, query, modelClass))
|
|
186
|
+
.not.toThrow();
|
|
171
187
|
});
|
|
172
188
|
});
|
|
173
189
|
|
|
@@ -119,7 +119,9 @@ function escapeSPARQL(value: string): string {
|
|
|
119
119
|
.replace(/"/g, '\\"')
|
|
120
120
|
.replace(/\n/g, "\\n")
|
|
121
121
|
.replace(/\r/g, "\\r")
|
|
122
|
-
.replace(/\t/g, "\\t")
|
|
122
|
+
.replace(/\t/g, "\\t")
|
|
123
|
+
.replace(/\0/g, "")
|
|
124
|
+
.replace(/\f/g, "\\u000C");
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
/**
|
|
@@ -136,8 +138,14 @@ export function formatSPARQLValue(value: any): string {
|
|
|
136
138
|
* Format an AD4M URI as an RDF IRI for use in SPARQL triple patterns.
|
|
137
139
|
* All AD4M link source/predicate/target values become IRIs in angle brackets.
|
|
138
140
|
* The Rust SPARQL service transparently transforms these to valid IRI format.
|
|
141
|
+
*
|
|
142
|
+
* Rejects characters that would break or inject into a SPARQL IRI token,
|
|
143
|
+
* matching the Rust-side `validate_iri()` function.
|
|
139
144
|
*/
|
|
140
145
|
function iri(value: string): string {
|
|
146
|
+
if (/[<>{}" ]/.test(value)) {
|
|
147
|
+
throw new Error(`Invalid IRI component: '${value}'`);
|
|
148
|
+
}
|
|
141
149
|
return `<${value}>`;
|
|
142
150
|
}
|
|
143
151
|
|
|
@@ -297,23 +305,9 @@ export function buildSPARQLQuery(
|
|
|
297
305
|
?_reifier <ad4m://ontology/timestamp> ?timestamp .
|
|
298
306
|
${filterClause}
|
|
299
307
|
}
|
|
300
|
-
${buildSPARQLOrderLimitOffset(metadata, query)}
|
|
301
308
|
`.trim();
|
|
302
309
|
}
|
|
303
310
|
|
|
304
|
-
/**
|
|
305
|
-
* Build ORDER BY / LIMIT / OFFSET clauses for the SPARQL query.
|
|
306
|
-
*
|
|
307
|
-
* NOTE: The outer SELECT returns multiple rows per instance (one per link),
|
|
308
|
-
* so LIMIT/OFFSET at the outer level would cut off links mid-instance.
|
|
309
|
-
* This function is kept for backward compatibility and always returns "".
|
|
310
|
-
* SPARQL-level pagination is handled via a subquery in buildSPARQLQuery
|
|
311
|
-
* using buildPaginationSubquery().
|
|
312
|
-
*/
|
|
313
|
-
export function buildSPARQLOrderLimitOffset(_metadata: ModelMetadata, query: Query): string {
|
|
314
|
-
return "";
|
|
315
|
-
}
|
|
316
|
-
|
|
317
311
|
/**
|
|
318
312
|
* Build an inner subquery that selects DISTINCT ?source URIs with
|
|
319
313
|
* ORDER BY, LIMIT, and OFFSET applied at the instance level.
|
|
@@ -369,7 +363,7 @@ export function buildPaginationSubquery(
|
|
|
369
363
|
{ SELECT DISTINCT ?source${tsSelect} WHERE {${innerJoin}${orderJoinPatterns.join('')}${tsPattern}
|
|
370
364
|
FILTER(isIRI(?source))
|
|
371
365
|
${innerFilter}
|
|
372
|
-
}
|
|
366
|
+
} ${orderByClause} ${limitClause} ${offsetClause} }\n`;
|
|
373
367
|
}
|
|
374
368
|
|
|
375
369
|
/**
|