@comunica/actor-function-factory-term-lesser-than-equal 4.4.1 → 4.4.2-alpha.49.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/ActorFunctionFactoryTermLesserThanEqual.jsonld +0 -0
- package/components/components.jsonld +0 -0
- package/components/context.jsonld +0 -0
- package/lib/ActorFunctionFactoryTermLesserThanEqual.d.ts +0 -0
- package/lib/ActorFunctionFactoryTermLesserThanEqual.js +0 -0
- package/lib/ActorFunctionFactoryTermLesserThanEqual.js.map +0 -0
- package/lib/TermFunctionLesserThanEqual.d.ts +0 -0
- package/lib/TermFunctionLesserThanEqual.js +26 -9
- package/lib/TermFunctionLesserThanEqual.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 +4 -4
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -9,15 +9,32 @@ class TermFunctionLesserThanEqual extends bus_function_factory_1.TermFunctionBas
|
|
|
9
9
|
arity: 2,
|
|
10
10
|
operator: utils_expression_evaluator_1.SparqlOperator.LTE,
|
|
11
11
|
overloads: (0, utils_expression_evaluator_1.declare)(utils_expression_evaluator_1.SparqlOperator.LTE)
|
|
12
|
-
.set(['term', 'term'], exprEval => ([first, second]) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
.set(['term', 'term'], exprEval => ([first, second]) => {
|
|
13
|
+
// X <= Y -> X = Y || X < Y
|
|
14
|
+
// We must ensure correct handling of errors following logical-or semantics.
|
|
15
|
+
// First check if the first is lesser than the second.
|
|
16
|
+
let lessThanError;
|
|
17
|
+
try {
|
|
18
|
+
if (this.lessThanFunction.applyOnTerms([first, second], exprEval).typedValue) {
|
|
19
|
+
return (0, utils_expression_evaluator_1.bool)(true);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
// If an error occurs, store it for later.
|
|
24
|
+
lessThanError = error;
|
|
25
|
+
}
|
|
26
|
+
// Then check if they are equal, and return if so.
|
|
27
|
+
if (this.equalityFunction.applyOnTerms([first, second], exprEval)
|
|
28
|
+
.typedValue) {
|
|
29
|
+
return (0, utils_expression_evaluator_1.bool)(true);
|
|
30
|
+
}
|
|
31
|
+
// If less than produced an error and equals was false, throw the error.
|
|
32
|
+
if (lessThanError) {
|
|
33
|
+
throw lessThanError;
|
|
34
|
+
}
|
|
35
|
+
// In all other cases, return false
|
|
36
|
+
return (0, utils_expression_evaluator_1.bool)(false);
|
|
37
|
+
})
|
|
21
38
|
.collect(),
|
|
22
39
|
});
|
|
23
40
|
this.equalityFunction = equalityFunction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TermFunctionLesserThanEqual.js","sourceRoot":"","sources":["TermFunctionLesserThanEqual.ts"],"names":[],"mappings":";;;AACA,yEAAkE;AAIlE,qFAI8C;AAE9C,MAAa,2BAA4B,SAAQ,uCAAgB;IAC/D,YACmB,gBAA+B,EAC/B,gBAA+B;QAEhD,KAAK,CAAC;YACJ,KAAK,EAAE,CAAC;YACR,QAAQ,EAAE,2CAAc,CAAC,GAAG;YAC5B,SAAS,EAAE,IAAA,oCAAO,EAAC,2CAAc,CAAC,GAAG,CAAC;iBACnC,GAAG,CAAC,CAAE,MAAM,EAAE,MAAM,CAAE,EAAE,QAAQ,CAAC,EAAE,CAClC,CAAC,CAAE,KAAK,EAAE,MAAM,CAAE,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"TermFunctionLesserThanEqual.js","sourceRoot":"","sources":["TermFunctionLesserThanEqual.ts"],"names":[],"mappings":";;;AACA,yEAAkE;AAIlE,qFAI8C;AAE9C,MAAa,2BAA4B,SAAQ,uCAAgB;IAC/D,YACmB,gBAA+B,EAC/B,gBAA+B;QAEhD,KAAK,CAAC;YACJ,KAAK,EAAE,CAAC;YACR,QAAQ,EAAE,2CAAc,CAAC,GAAG;YAC5B,SAAS,EAAE,IAAA,oCAAO,EAAC,2CAAc,CAAC,GAAG,CAAC;iBACnC,GAAG,CAAC,CAAE,MAAM,EAAE,MAAM,CAAE,EAAE,QAAQ,CAAC,EAAE,CAClC,CAAC,CAAE,KAAK,EAAE,MAAM,CAAE,EAAE,EAAE;gBACpB,2BAA2B;gBAC3B,4EAA4E;gBAE5E,sDAAsD;gBACtD,IAAI,aAAgC,CAAC;gBACrC,IAAI,CAAC;oBACH,IAAsB,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAE,KAAK,EAAE,MAAM,CAAE,EAAE,QAAQ,CAAE,CAAC,UAAU,EAAE,CAAC;wBAClG,OAAO,IAAA,iCAAI,EAAC,IAAI,CAAC,CAAC;oBACpB,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,0CAA0C;oBAC1C,aAAa,GAAW,KAAK,CAAC;gBAChC,CAAC;gBAED,kDAAkD;gBAClD,IAAsB,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAE,KAAK,EAAE,MAAM,CAAE,EAAE,QAAQ,CAAE;qBACnF,UAAU,EAAE,CAAC;oBACd,OAAO,IAAA,iCAAI,EAAC,IAAI,CAAC,CAAC;gBACpB,CAAC;gBAED,wEAAwE;gBACxE,IAAI,aAAa,EAAE,CAAC;oBAClB,MAAM,aAAa,CAAC;gBACtB,CAAC;gBAED,mCAAmC;gBACnC,OAAO,IAAA,iCAAI,EAAC,KAAK,CAAC,CAAC;YACrB,CAAC,CAAC;iBACH,OAAO,EAAE;SACb,CAAC,CAAC;QAtCc,qBAAgB,GAAhB,gBAAgB,CAAe;QAC/B,qBAAgB,GAAhB,gBAAgB,CAAe;IAsClD,CAAC;CACF;AA1CD,kEA0CC","sourcesContent":["import type { ITermFunction } from '@comunica/bus-function-factory';\nimport { TermFunctionBase } from '@comunica/bus-function-factory';\nimport type {\n BooleanLiteral,\n} from '@comunica/utils-expression-evaluator';\nimport {\n bool,\n declare,\n SparqlOperator,\n} from '@comunica/utils-expression-evaluator';\n\nexport class TermFunctionLesserThanEqual extends TermFunctionBase {\n public constructor(\n private readonly equalityFunction: ITermFunction,\n private readonly lessThanFunction: ITermFunction,\n ) {\n super({\n arity: 2,\n operator: SparqlOperator.LTE,\n overloads: declare(SparqlOperator.LTE)\n .set([ 'term', 'term' ], exprEval =>\n ([ first, second ]) => {\n // X <= Y -> X = Y || X < Y\n // We must ensure correct handling of errors following logical-or semantics.\n\n // First check if the first is lesser than the second.\n let lessThanError: Error | undefined;\n try {\n if ((<BooleanLiteral> this.lessThanFunction.applyOnTerms([ first, second ], exprEval)).typedValue) {\n return bool(true);\n }\n } catch (error) {\n // If an error occurs, store it for later.\n lessThanError = <Error> error;\n }\n\n // Then check if they are equal, and return if so.\n if ((<BooleanLiteral> this.equalityFunction.applyOnTerms([ first, second ], exprEval))\n .typedValue) {\n return bool(true);\n }\n\n // If less than produced an error and equals was false, throw the error.\n if (lessThanError) {\n throw lessThanError;\n }\n\n // In all other cases, return false\n return bool(false);\n })\n .collect(),\n });\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-term-lesser-than-equal",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2-alpha.49.0",
|
|
4
4
|
"description": "A term-lesser-than-equal function-factory actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"build:components": "componentsjs-generator"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@comunica/bus-function-factory": "
|
|
41
|
-
"@comunica/utils-expression-evaluator": "
|
|
40
|
+
"@comunica/bus-function-factory": "4.4.2-alpha.49.0",
|
|
41
|
+
"@comunica/utils-expression-evaluator": "4.4.2-alpha.49.0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "ef6f96cfd8faf7c37955bb7e0fe9f6fc6a994bdf"
|
|
44
44
|
}
|