@comunica/actor-function-factory-expression-concat 4.5.0 → 5.0.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/README.md +1 -1
- package/components/ActorFunctionFactoryExpressionConcat.jsonld +15 -15
- package/components/components.jsonld +1 -1
- package/components/context.jsonld +1 -1
- package/lib/ActorFunctionFactoryExpressionConcat.d.ts +0 -0
- package/lib/ActorFunctionFactoryExpressionConcat.js +0 -0
- package/lib/ActorFunctionFactoryExpressionConcat.js.map +0 -0
- package/lib/ExpressionFunctionConcat.d.ts +1 -0
- package/lib/ExpressionFunctionConcat.js +11 -6
- package/lib/ExpressionFunctionConcat.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 +5 -5
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ After installing, this package can be added to your engine's configuration as fo
|
|
|
24
24
|
{
|
|
25
25
|
"@context": [
|
|
26
26
|
...
|
|
27
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-concat/^
|
|
27
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-concat/^5.0.0/components/context.jsonld"
|
|
28
28
|
],
|
|
29
29
|
"actors": [
|
|
30
30
|
...
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-concat/^
|
|
4
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-function-factory/^
|
|
5
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-concat/^5.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-function-factory/^5.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^5.0.0/components/context.jsonld"
|
|
6
6
|
],
|
|
7
7
|
"@id": "npmd:@comunica/actor-function-factory-expression-concat",
|
|
8
8
|
"components": [
|
|
@@ -35,37 +35,37 @@
|
|
|
35
35
|
"genericTypeInstances": [
|
|
36
36
|
{
|
|
37
37
|
"@type": "ParameterRangeGenericTypeReference",
|
|
38
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
38
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"@type": "ParameterRangeGenericTypeReference",
|
|
42
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
42
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"@type": "ParameterRangeGenericTypeReference",
|
|
46
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
46
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"@type": "ParameterRangeGenericTypeReference",
|
|
50
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
50
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"@type": "ParameterRangeGenericTypeReference",
|
|
56
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
56
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"@type": "ParameterRangeGenericTypeReference",
|
|
60
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
60
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"@type": "ParameterRangeGenericTypeReference",
|
|
64
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
64
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"@type": "ParameterRangeGenericTypeReference",
|
|
68
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
68
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
69
69
|
}
|
|
70
70
|
]
|
|
71
71
|
},
|
|
@@ -102,19 +102,19 @@
|
|
|
102
102
|
"genericTypeInstances": [
|
|
103
103
|
{
|
|
104
104
|
"@type": "ParameterRangeGenericTypeReference",
|
|
105
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
105
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
"@type": "ParameterRangeGenericTypeReference",
|
|
109
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
109
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
"@type": "ParameterRangeGenericTypeReference",
|
|
113
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
113
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
"@type": "ParameterRangeGenericTypeReference",
|
|
117
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
117
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
118
118
|
}
|
|
119
119
|
]
|
|
120
120
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-concat/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-concat/^5.0.0/components/context.jsonld"
|
|
4
4
|
],
|
|
5
5
|
"@id": "npmd:@comunica/actor-function-factory-expression-concat",
|
|
6
6
|
"@type": "Module",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
|
|
4
4
|
{
|
|
5
5
|
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
|
-
"caffec": "npmd:@comunica/actor-function-factory-expression-concat/^
|
|
6
|
+
"caffec": "npmd:@comunica/actor-function-factory-expression-concat/^5.0.0/",
|
|
7
7
|
"ActorFunctionFactoryExpressionConcat": {
|
|
8
8
|
"@id": "caffec:components/ActorFunctionFactoryExpressionConcat.jsonld#ActorFunctionFactoryExpressionConcat",
|
|
9
9
|
"@prefix": true,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -4,6 +4,7 @@ exports.ExpressionFunctionConcat = void 0;
|
|
|
4
4
|
const bus_function_factory_1 = require("@comunica/bus-function-factory");
|
|
5
5
|
const context_entries_1 = require("@comunica/context-entries");
|
|
6
6
|
const utils_expression_evaluator_1 = require("@comunica/utils-expression-evaluator");
|
|
7
|
+
const Helpers_1 = require("@comunica/utils-expression-evaluator/lib/functions/Helpers");
|
|
7
8
|
/**
|
|
8
9
|
* https://www.w3.org/TR/sparql11-query/#func-concat
|
|
9
10
|
*/
|
|
@@ -27,18 +28,22 @@ class ExpressionFunctionConcat extends bus_function_factory_1.ExpressionFunction
|
|
|
27
28
|
const strings = lits.map(lit => lit.typedValue);
|
|
28
29
|
const joined = strings.join('');
|
|
29
30
|
const lang = ExpressionFunctionConcat.langAllEqual(lits) ? lits[0].language : undefined;
|
|
30
|
-
|
|
31
|
+
const dir = ExpressionFunctionConcat.dirAllEqual(lits) ? lits[0].direction : undefined;
|
|
32
|
+
return lang ? (dir ? (0, Helpers_1.dirLangString)(joined, lang, dir) : (0, utils_expression_evaluator_1.langString)(joined, lang)) : (0, utils_expression_evaluator_1.string)(joined);
|
|
31
33
|
},
|
|
32
34
|
});
|
|
33
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* This OverloadTree with the constant function will handle both type promotion and subtype-substitution
|
|
38
|
+
*/
|
|
39
|
+
static concatTree = (0, utils_expression_evaluator_1.declare)(utils_expression_evaluator_1.SparqlOperator.CONCAT).onStringly1(() => expr => expr)
|
|
40
|
+
.collect();
|
|
34
41
|
static langAllEqual(lits) {
|
|
35
42
|
return lits.length > 0 && lits.every(lit => lit.language === lits[0].language);
|
|
36
43
|
}
|
|
44
|
+
static dirAllEqual(lits) {
|
|
45
|
+
return lits.length > 0 && lits.every(lit => lit.direction === lits[0].direction);
|
|
46
|
+
}
|
|
37
47
|
}
|
|
38
48
|
exports.ExpressionFunctionConcat = ExpressionFunctionConcat;
|
|
39
|
-
/**
|
|
40
|
-
* This OverloadTree with the constant function will handle both type promotion and subtype-substitution
|
|
41
|
-
*/
|
|
42
|
-
ExpressionFunctionConcat.concatTree = (0, utils_expression_evaluator_1.declare)(utils_expression_evaluator_1.SparqlOperator.CONCAT).onStringly1(() => expr => expr)
|
|
43
|
-
.collect();
|
|
44
49
|
//# sourceMappingURL=ExpressionFunctionConcat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionFunctionConcat.js","sourceRoot":"","sources":["ExpressionFunctionConcat.ts"],"names":[],"mappings":";;;AAAA,yEAAwE;AACxE,+DAAmF;AAMnF,qFAM8C;
|
|
1
|
+
{"version":3,"file":"ExpressionFunctionConcat.js","sourceRoot":"","sources":["ExpressionFunctionConcat.ts"],"names":[],"mappings":";;;AAAA,yEAAwE;AACxE,+DAAmF;AAMnF,qFAM8C;AAC9C,wFAA2F;AAE3F;;GAEG;AACH,MAAa,wBAAyB,SAAQ,6CAAsB;IAClE;QACE,KAAK,CAAC;YACJ,KAAK,EAAE,MAAM,CAAC,iBAAiB;YAC/B,QAAQ,EAAE,2CAAc,CAAC,MAAM;YAC/B,KAAK,EAAE,KAAK,EAAC,OAAqB,EAA2B,EAAE;gBAC7D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;gBAC5C,MAAM,KAAK,GAA+B,IAAI;qBAC3C,GAAG,CAAC,KAAK,EAAC,IAAI,EAAC,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;qBACxE,GAAG,CAAC,KAAK,EAAC,KAAK,EAAE,EAAE;oBAClB,MAAM,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AAM,CAAC,CAAC;YACrG,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,MAAM,CAAU,UAAU,GAAiB,IAAA,oCAAO,EAAC,2CAAc,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;SAC9G,OAAO,EAAE,CAAC;IAEL,MAAM,CAAC,YAAY,CAAC,IAAuB;QACjD,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACjF,CAAC;IAEO,MAAM,CAAC,WAAW,CAAC,IAAuB;QAChD,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnF,CAAC;;AA1CH,4DA2CC","sourcesContent":["import { ExpressionFunctionBase } from '@comunica/bus-function-factory';\nimport { KeysExpressionEvaluator, KeysInitQuery } from '@comunica/context-entries';\nimport type { IEvalContext, TermExpression } from '@comunica/types';\nimport type {\n Literal,\n OverloadTree,\n} from '@comunica/utils-expression-evaluator';\nimport {\n declare,\n InvalidArgumentTypes,\n langString,\n SparqlOperator,\n string,\n} from '@comunica/utils-expression-evaluator';\nimport { dirLangString } from '@comunica/utils-expression-evaluator/lib/functions/Helpers';\n\n/**\n * https://www.w3.org/TR/sparql11-query/#func-concat\n */\nexport class ExpressionFunctionConcat extends ExpressionFunctionBase {\n public constructor() {\n super({\n arity: Number.POSITIVE_INFINITY,\n operator: SparqlOperator.CONCAT,\n apply: async(context: IEvalContext): Promise<TermExpression> => {\n const { args, mapping, exprEval } = context;\n const pLits: Promise<Literal<string>>[] = args\n .map(async expr => exprEval.evaluatorExpressionEvaluation(expr, mapping))\n .map(async(pTerm) => {\n const operation = ExpressionFunctionConcat.concatTree.search(\n [ await pTerm ],\n exprEval.context.getSafe(KeysExpressionEvaluator.superTypeProvider),\n exprEval.context.getSafe(KeysInitQuery.functionArgumentsCache),\n );\n if (!operation) {\n throw new InvalidArgumentTypes(args, SparqlOperator.CONCAT);\n }\n return <Literal<string>> operation(exprEval)([ await pTerm ]);\n });\n const lits = await Promise.all(pLits);\n const strings = lits.map(lit => lit.typedValue);\n const joined = strings.join('');\n const lang = ExpressionFunctionConcat.langAllEqual(lits) ? lits[0].language : undefined;\n const dir = ExpressionFunctionConcat.dirAllEqual(lits) ? lits[0].direction : undefined;\n return lang ? (dir ? dirLangString(joined, lang, dir) : langString(joined, lang)) : string(joined);\n },\n });\n }\n\n /**\n * This OverloadTree with the constant function will handle both type promotion and subtype-substitution\n */\n private static readonly concatTree: OverloadTree = declare(SparqlOperator.CONCAT).onStringly1(() => expr => expr)\n .collect();\n\n private static langAllEqual(lits: Literal<string>[]): boolean {\n return lits.length > 0 && lits.every(lit => lit.language === lits[0].language);\n }\n\n private static dirAllEqual(lits: Literal<string>[]): boolean {\n return lits.length > 0 && lits.every(lit => lit.direction === lits[0].direction);\n }\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-function-factory-expression-concat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "A expression-concat function-factory actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"build:components": "componentsjs-generator"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@comunica/bus-function-factory": "^
|
|
41
|
-
"@comunica/context-entries": "^
|
|
42
|
-
"@comunica/utils-expression-evaluator": "^
|
|
40
|
+
"@comunica/bus-function-factory": "^5.0.2",
|
|
41
|
+
"@comunica/context-entries": "^5.0.2",
|
|
42
|
+
"@comunica/utils-expression-evaluator": "^5.0.2"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "3b29f914010fd2fc56682a0ceff962ef6ff24f32"
|
|
45
45
|
}
|