@comunica/actor-optimize-query-operation-set-seed-sources-quadpattern-iris 0.6.0 → 0.7.0
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/components/ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris.jsonld +0 -0
- package/components/components.jsonld +0 -0
- package/components/context.jsonld +0 -0
- package/lib/ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris.d.ts +0 -0
- package/lib/ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris.js +4 -0
- package/lib/ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris.js.map +1 -1
- package/lib/index.d.ts +0 -0
- package/lib/index.js +0 -0
- package/lib/index.js.map +0 -0
- package/package.json +9 -8
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -25,6 +25,10 @@ class ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris extends bus_optim
|
|
|
25
25
|
if (hashPosition >= 0) {
|
|
26
26
|
source = source.slice(0, hashPosition);
|
|
27
27
|
}
|
|
28
|
+
const traversalTracker = action.context.get(context_entries_1.KeysStatistics.discoveredLinks);
|
|
29
|
+
if (traversalTracker) {
|
|
30
|
+
traversalTracker.updateStatistic({ url: source, metadata: { seed: true } }, { url: 'root' });
|
|
31
|
+
}
|
|
28
32
|
return (await this.mediatorQuerySourceIdentify.mediate({
|
|
29
33
|
querySourceUnidentified: {
|
|
30
34
|
value: source,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris.js","sourceRoot":"","sources":["ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris.ts"],"names":[],"mappings":";;;AAIA,yFAAqF;AAErF,+
|
|
1
|
+
{"version":3,"file":"ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris.js","sourceRoot":"","sources":["ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris.ts"],"names":[],"m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AO,KAAK,CAAC;YACf,CAAC;YACD,CAAC,yBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE;gBACnC,IAAI,IAAI,CAAC,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;oBACrE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACnC,CAAC;gBACD,IAAI,IAAI,CAAC,iBAAiB,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;oBACzE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;gBACD,IAAI,IAAI,CAAC,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,KAAK,WAAW;oBAChE,CAAC,IAAI,CAAC,gBAAgB,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,KAAK,iDAAiD,CAAC,EAAE,CAAC;oBAC3G,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAClC,CAAC;gBACD,IAAI,IAAI,CAAC,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;oBACjE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACjC,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SACF,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAnFD,4HAmFC","sourcesContent":["import type {\n IActionOptimizeQueryOperation,\n IActorOptimizeQueryOperationOutput,\n} from '@comunica/bus-optimize-query-operation';\nimport { ActorOptimizeQueryOperation } from '@comunica/bus-optimize-query-operation';\nimport type { MediatorQuerySourceIdentify } from '@comunica/bus-query-source-identify';\nimport { KeysQueryOperation, KeysQuerySourceIdentify, KeysStatistics } from '@comunica/context-entries';\nimport type { IActorArgs, IActorTest, TestResult } from '@comunica/core';\nimport { ActionContext, passTestVoid } from '@comunica/core';\nimport type { StatisticLinkDiscovery } from '@comunica/statistic-link-discovery';\nimport type { IDiscoverEventData, IQuerySourceWrapper, IStatisticBase } from '@comunica/types';\nimport { Algebra, Util } from 'sparqlalgebrajs';\n\n/**\n * A comunica Set Seed Sources Quadpattern IRIs Optimize Query Operation Actor.\n */\nexport class ActorOptimizeQueryOperationSetSeedSourcesQuadpatternIris extends ActorOptimizeQueryOperation {\n public readonly mediatorQuerySourceIdentify: MediatorQuerySourceIdentify;\n private readonly extractSubjects: boolean;\n private readonly extractPredicates: boolean;\n private readonly extractObjects: boolean;\n private readonly extractGraphs: boolean;\n private readonly extractVocabIris: boolean;\n\n public constructor(args: IActorOptimizeQueryOperationSetSeedSourcesQuadpatternIrisArgs) {\n super(args);\n }\n\n public async test(_action: IActionOptimizeQueryOperation): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async run(action: IActionOptimizeQueryOperation): Promise<IActorOptimizeQueryOperationOutput> {\n let sources: IQuerySourceWrapper[] | undefined = action.context.get(KeysQueryOperation.querySources);\n if (!sources || sources.length === 0) {\n sources = await Promise.all(\n [ ...new Set(this.extractIrisFromOperation(action.operation)) ]\n .map(async(source) => {\n // Remove fragment from URL\n const hashPosition = source.indexOf('#');\n if (hashPosition >= 0) {\n source = source.slice(0, hashPosition);\n }\n\n const traversalTracker: IStatisticBase<IDiscoverEventData> | StatisticLinkDiscovery | undefined =\n action.context.get(KeysStatistics.discoveredLinks);\n if (traversalTracker) {\n traversalTracker.updateStatistic({ url: source, metadata: { seed: true }}, { url: 'root' });\n }\n\n return (await this.mediatorQuerySourceIdentify.mediate({\n querySourceUnidentified: {\n value: source,\n context: new ActionContext().set(KeysQuerySourceIdentify.traverse, true),\n },\n context: action.context,\n })).querySource;\n }),\n );\n action.context = action.context.set(KeysQueryOperation.querySources, sources);\n }\n return { ...action, context: action.context };\n }\n\n public extractIrisFromOperation(operation: Algebra.Operation): string[] {\n const iris: string[] = [];\n Util.recurseOperation(operation, {\n [Algebra.types.PATH]: (path) => {\n if (this.extractSubjects && path.subject.termType === 'NamedNode') {\n iris.push(path.subject.value);\n }\n // Predicates are ignored\n if (this.extractObjects && path.object.termType === 'NamedNode') {\n iris.push(path.object.value);\n }\n if (this.extractGraphs && path.graph.termType === 'NamedNode') {\n iris.push(path.graph.value);\n }\n return false;\n },\n [Algebra.types.PATTERN]: (pattern) => {\n if (this.extractSubjects && pattern.subject.termType === 'NamedNode') {\n iris.push(pattern.subject.value);\n }\n if (this.extractPredicates && pattern.predicate.termType === 'NamedNode') {\n iris.push(pattern.predicate.value);\n }\n if (this.extractObjects && pattern.object.termType === 'NamedNode' &&\n (this.extractVocabIris || pattern.predicate.value !== 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type')) {\n iris.push(pattern.object.value);\n }\n if (this.extractGraphs && pattern.graph.termType === 'NamedNode') {\n iris.push(pattern.graph.value);\n }\n return false;\n },\n });\n return iris;\n }\n}\n\nexport interface IActorOptimizeQueryOperationSetSeedSourcesQuadpatternIrisArgs\n extends IActorArgs<IActionOptimizeQueryOperation, IActorTest, IActorOptimizeQueryOperationOutput> {\n /**\n * Mediator for identifying query sources.\n */\n mediatorQuerySourceIdentify: MediatorQuerySourceIdentify;\n /**\n * If IRIs should be extracted from subject positions.\n * @default {true}\n */\n extractSubjects: boolean;\n /**\n * If IRIs should be extracted from predicate positions.\n * @default {false}\n */\n extractPredicates: boolean;\n /**\n * If IRIs should be extracted from object positions.\n * @default {true}\n */\n extractObjects: boolean;\n /**\n * If IRIs should be extracted from graph positions.\n * @default {true}\n */\n extractGraphs: boolean;\n /**\n * If object IRIs should be extracted if the predicate is rdf:type.\n * @default {false}\n */\n extractVocabIris: boolean;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
File without changes
|
package/lib/index.js
CHANGED
|
File without changes
|
package/lib/index.js.map
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-optimize-query-operation-set-seed-sources-quadpattern-iris",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A set-seed-sources-quadpattern-iris optimize-query-operation actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,12 +41,13 @@
|
|
|
41
41
|
"build:components": "componentsjs-generator"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@comunica/bus-optimize-query-operation": "^4.0
|
|
45
|
-
"@comunica/bus-query-source-identify": "^4.0
|
|
46
|
-
"@comunica/context-entries": "^4.0
|
|
47
|
-
"@comunica/core": "^4.0
|
|
48
|
-
"@comunica/
|
|
49
|
-
"
|
|
44
|
+
"@comunica/bus-optimize-query-operation": "^4.2.0",
|
|
45
|
+
"@comunica/bus-query-source-identify": "^4.2.0",
|
|
46
|
+
"@comunica/context-entries": "^4.2.0",
|
|
47
|
+
"@comunica/core": "^4.2.0",
|
|
48
|
+
"@comunica/statistic-link-discovery": "^4.2.0",
|
|
49
|
+
"@comunica/types": "^4.2.0",
|
|
50
|
+
"sparqlalgebrajs": "^4.3.8"
|
|
50
51
|
},
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "595db2db5c2dbdb718fb96a9ae1116de68be5558"
|
|
52
53
|
}
|