@comunica/utils-expression-evaluator 3.2.4-alpha.47.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/LICENSE.txt +22 -0
- package/README.md +102 -0
- package/lib/expressions/Aggregate.d.ts +9 -0
- package/lib/expressions/Aggregate.js +13 -0
- package/lib/expressions/Aggregate.js.map +1 -0
- package/lib/expressions/Existence.d.ts +8 -0
- package/lib/expressions/Existence.js +12 -0
- package/lib/expressions/Existence.js.map +1 -0
- package/lib/expressions/Expressions.d.ts +2 -0
- package/lib/expressions/Expressions.js +11 -0
- package/lib/expressions/Expressions.js.map +1 -0
- package/lib/expressions/Operator.d.ts +9 -0
- package/lib/expressions/Operator.js +14 -0
- package/lib/expressions/Operator.js.map +1 -0
- package/lib/expressions/Term.d.ts +180 -0
- package/lib/expressions/Term.js +348 -0
- package/lib/expressions/Term.js.map +1 -0
- package/lib/expressions/Variable.d.ts +7 -0
- package/lib/expressions/Variable.js +12 -0
- package/lib/expressions/Variable.js.map +1 -0
- package/lib/expressions/index.d.ts +6 -0
- package/lib/expressions/index.js +23 -0
- package/lib/expressions/index.js.map +1 -0
- package/lib/functions/Helpers.d.ts +81 -0
- package/lib/functions/Helpers.js +218 -0
- package/lib/functions/Helpers.js.map +1 -0
- package/lib/functions/OverloadTree.d.ts +45 -0
- package/lib/functions/OverloadTree.js +196 -0
- package/lib/functions/OverloadTree.js.map +1 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +99 -0
- package/lib/index.js.map +1 -0
- package/lib/transformers/TermTransformer.d.ts +24 -0
- package/lib/transformers/TermTransformer.js +133 -0
- package/lib/transformers/TermTransformer.js.map +1 -0
- package/lib/util/Consts.d.ts +136 -0
- package/lib/util/Consts.js +171 -0
- package/lib/util/Consts.js.map +1 -0
- package/lib/util/Context.d.ts +2 -0
- package/lib/util/Context.js +32 -0
- package/lib/util/Context.js.map +1 -0
- package/lib/util/DateTimeHelpers.d.ts +19 -0
- package/lib/util/DateTimeHelpers.js +166 -0
- package/lib/util/DateTimeHelpers.js.map +1 -0
- package/lib/util/Errors.d.ts +130 -0
- package/lib/util/Errors.js +194 -0
- package/lib/util/Errors.js.map +1 -0
- package/lib/util/Parsing.d.ts +25 -0
- package/lib/util/Parsing.js +166 -0
- package/lib/util/Parsing.js.map +1 -0
- package/lib/util/Serialization.d.ts +5 -0
- package/lib/util/Serialization.js +54 -0
- package/lib/util/Serialization.js.map +1 -0
- package/lib/util/SpecAlgos.d.ts +4 -0
- package/lib/util/SpecAlgos.js +81 -0
- package/lib/util/SpecAlgos.js.map +1 -0
- package/lib/util/TypeHandling.d.ts +56 -0
- package/lib/util/TypeHandling.js +216 -0
- package/lib/util/TypeHandling.js.map +1 -0
- package/package.json +50 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LangStringLiteral = exports.TimeLiteral = exports.DurationLiteral = exports.DateLiteral = exports.DayTimeDurationLiteral = exports.DateTimeLiteral = exports.yearMonthDurationsToMonths = exports.toUTCDate = exports.toDateTimeRepresentation = exports.negateDuration = exports.extractRawTimeZone = exports.defaultedYearMonthDurationRepresentation = exports.defaultedDurationRepresentation = exports.defaultedDayTimeDurationRepresentation = exports.defaultedDateTimeRepresentation = exports.dayTimeDurationsToSeconds = exports.isSubTypeOf = exports.SparqlOperator = exports.TypeAlias = exports.TypeURL = exports.typedLiteral = exports.InvalidArity = exports.InvalidLexicalForm = exports.ExtensionFunctionError = exports.CastError = exports.UnboundVariableError = exports.NoAggregator = exports.InError = exports.CoalesceError = exports.InvalidArgumentTypes = exports.InvalidTimezoneCall = exports.IncompatibleLanguageOperation = exports.RDFEqualTypeError = exports.EmptyAggregateError = exports.isExpressionError = exports.ExpressionError = exports.Builder = exports.expressionToVar = exports.float = exports.decimal = exports.langString = exports.dateTime = exports.integer = exports.double = exports.string = exports.bool = exports.declare = exports.prepareEvaluatorActionContext = exports.OverloadTree = exports.TermTransformer = void 0;
|
|
4
|
+
exports.trimToDayTimeDuration = exports.trimToYearMonthDuration = exports.parseDate = exports.parseXSDFloat = exports.parseXSDDecimal = exports.parseYearMonthDuration = exports.parseTime = exports.parseDuration = exports.parseDayTimeDuration = exports.parseDateTime = exports.elapsedDuration = exports.addDurationToDateTime = exports.isNonLexicalLiteral = exports.StringLiteral = exports.NonLexicalLiteral = exports.FloatLiteral = exports.IntegerLiteral = exports.Literal = exports.Existence = exports.Aggregate = exports.DoubleLiteral = exports.DefaultGraph = exports.DecimalLiteral = exports.BlankNode = exports.BooleanLiteral = exports.NumericLiteral = exports.Variable = exports.NamedNode = exports.Operator = exports.Quad = exports.YearMonthDurationLiteral = exports.Term = void 0;
|
|
5
|
+
var TermTransformer_1 = require("./transformers/TermTransformer");
|
|
6
|
+
Object.defineProperty(exports, "TermTransformer", { enumerable: true, get: function () { return TermTransformer_1.TermTransformer; } });
|
|
7
|
+
var OverloadTree_1 = require("./functions/OverloadTree");
|
|
8
|
+
Object.defineProperty(exports, "OverloadTree", { enumerable: true, get: function () { return OverloadTree_1.OverloadTree; } });
|
|
9
|
+
var Context_1 = require("./util/Context");
|
|
10
|
+
Object.defineProperty(exports, "prepareEvaluatorActionContext", { enumerable: true, get: function () { return Context_1.prepareEvaluatorActionContext; } });
|
|
11
|
+
var Helpers_1 = require("./functions/Helpers");
|
|
12
|
+
Object.defineProperty(exports, "declare", { enumerable: true, get: function () { return Helpers_1.declare; } });
|
|
13
|
+
Object.defineProperty(exports, "bool", { enumerable: true, get: function () { return Helpers_1.bool; } });
|
|
14
|
+
Object.defineProperty(exports, "string", { enumerable: true, get: function () { return Helpers_1.string; } });
|
|
15
|
+
Object.defineProperty(exports, "double", { enumerable: true, get: function () { return Helpers_1.double; } });
|
|
16
|
+
Object.defineProperty(exports, "integer", { enumerable: true, get: function () { return Helpers_1.integer; } });
|
|
17
|
+
Object.defineProperty(exports, "dateTime", { enumerable: true, get: function () { return Helpers_1.dateTime; } });
|
|
18
|
+
Object.defineProperty(exports, "langString", { enumerable: true, get: function () { return Helpers_1.langString; } });
|
|
19
|
+
Object.defineProperty(exports, "decimal", { enumerable: true, get: function () { return Helpers_1.decimal; } });
|
|
20
|
+
Object.defineProperty(exports, "float", { enumerable: true, get: function () { return Helpers_1.float; } });
|
|
21
|
+
Object.defineProperty(exports, "expressionToVar", { enumerable: true, get: function () { return Helpers_1.expressionToVar; } });
|
|
22
|
+
Object.defineProperty(exports, "Builder", { enumerable: true, get: function () { return Helpers_1.Builder; } });
|
|
23
|
+
var Errors_1 = require("./util/Errors");
|
|
24
|
+
Object.defineProperty(exports, "ExpressionError", { enumerable: true, get: function () { return Errors_1.ExpressionError; } });
|
|
25
|
+
Object.defineProperty(exports, "isExpressionError", { enumerable: true, get: function () { return Errors_1.isExpressionError; } });
|
|
26
|
+
Object.defineProperty(exports, "EmptyAggregateError", { enumerable: true, get: function () { return Errors_1.EmptyAggregateError; } });
|
|
27
|
+
Object.defineProperty(exports, "RDFEqualTypeError", { enumerable: true, get: function () { return Errors_1.RDFEqualTypeError; } });
|
|
28
|
+
Object.defineProperty(exports, "IncompatibleLanguageOperation", { enumerable: true, get: function () { return Errors_1.IncompatibleLanguageOperation; } });
|
|
29
|
+
Object.defineProperty(exports, "InvalidTimezoneCall", { enumerable: true, get: function () { return Errors_1.InvalidTimezoneCall; } });
|
|
30
|
+
Object.defineProperty(exports, "InvalidArgumentTypes", { enumerable: true, get: function () { return Errors_1.InvalidArgumentTypes; } });
|
|
31
|
+
Object.defineProperty(exports, "CoalesceError", { enumerable: true, get: function () { return Errors_1.CoalesceError; } });
|
|
32
|
+
Object.defineProperty(exports, "InError", { enumerable: true, get: function () { return Errors_1.InError; } });
|
|
33
|
+
Object.defineProperty(exports, "NoAggregator", { enumerable: true, get: function () { return Errors_1.NoAggregator; } });
|
|
34
|
+
Object.defineProperty(exports, "UnboundVariableError", { enumerable: true, get: function () { return Errors_1.UnboundVariableError; } });
|
|
35
|
+
Object.defineProperty(exports, "CastError", { enumerable: true, get: function () { return Errors_1.CastError; } });
|
|
36
|
+
Object.defineProperty(exports, "ExtensionFunctionError", { enumerable: true, get: function () { return Errors_1.ExtensionFunctionError; } });
|
|
37
|
+
Object.defineProperty(exports, "InvalidLexicalForm", { enumerable: true, get: function () { return Errors_1.InvalidLexicalForm; } });
|
|
38
|
+
Object.defineProperty(exports, "InvalidArity", { enumerable: true, get: function () { return Errors_1.InvalidArity; } });
|
|
39
|
+
var Consts_1 = require("./util/Consts");
|
|
40
|
+
Object.defineProperty(exports, "typedLiteral", { enumerable: true, get: function () { return Consts_1.typedLiteral; } });
|
|
41
|
+
Object.defineProperty(exports, "TypeURL", { enumerable: true, get: function () { return Consts_1.TypeURL; } });
|
|
42
|
+
Object.defineProperty(exports, "TypeAlias", { enumerable: true, get: function () { return Consts_1.TypeAlias; } });
|
|
43
|
+
Object.defineProperty(exports, "SparqlOperator", { enumerable: true, get: function () { return Consts_1.SparqlOperator; } });
|
|
44
|
+
var TypeHandling_1 = require("./util/TypeHandling");
|
|
45
|
+
Object.defineProperty(exports, "isSubTypeOf", { enumerable: true, get: function () { return TypeHandling_1.isSubTypeOf; } });
|
|
46
|
+
var DateTimeHelpers_1 = require("./util/DateTimeHelpers");
|
|
47
|
+
Object.defineProperty(exports, "dayTimeDurationsToSeconds", { enumerable: true, get: function () { return DateTimeHelpers_1.dayTimeDurationsToSeconds; } });
|
|
48
|
+
Object.defineProperty(exports, "defaultedDateTimeRepresentation", { enumerable: true, get: function () { return DateTimeHelpers_1.defaultedDateTimeRepresentation; } });
|
|
49
|
+
Object.defineProperty(exports, "defaultedDayTimeDurationRepresentation", { enumerable: true, get: function () { return DateTimeHelpers_1.defaultedDayTimeDurationRepresentation; } });
|
|
50
|
+
Object.defineProperty(exports, "defaultedDurationRepresentation", { enumerable: true, get: function () { return DateTimeHelpers_1.defaultedDurationRepresentation; } });
|
|
51
|
+
Object.defineProperty(exports, "defaultedYearMonthDurationRepresentation", { enumerable: true, get: function () { return DateTimeHelpers_1.defaultedYearMonthDurationRepresentation; } });
|
|
52
|
+
Object.defineProperty(exports, "extractRawTimeZone", { enumerable: true, get: function () { return DateTimeHelpers_1.extractRawTimeZone; } });
|
|
53
|
+
Object.defineProperty(exports, "negateDuration", { enumerable: true, get: function () { return DateTimeHelpers_1.negateDuration; } });
|
|
54
|
+
Object.defineProperty(exports, "toDateTimeRepresentation", { enumerable: true, get: function () { return DateTimeHelpers_1.toDateTimeRepresentation; } });
|
|
55
|
+
Object.defineProperty(exports, "toUTCDate", { enumerable: true, get: function () { return DateTimeHelpers_1.toUTCDate; } });
|
|
56
|
+
Object.defineProperty(exports, "yearMonthDurationsToMonths", { enumerable: true, get: function () { return DateTimeHelpers_1.yearMonthDurationsToMonths; } });
|
|
57
|
+
var expressions_1 = require("./expressions");
|
|
58
|
+
Object.defineProperty(exports, "DateTimeLiteral", { enumerable: true, get: function () { return expressions_1.DateTimeLiteral; } });
|
|
59
|
+
Object.defineProperty(exports, "DayTimeDurationLiteral", { enumerable: true, get: function () { return expressions_1.DayTimeDurationLiteral; } });
|
|
60
|
+
Object.defineProperty(exports, "DateLiteral", { enumerable: true, get: function () { return expressions_1.DateLiteral; } });
|
|
61
|
+
Object.defineProperty(exports, "DurationLiteral", { enumerable: true, get: function () { return expressions_1.DurationLiteral; } });
|
|
62
|
+
Object.defineProperty(exports, "TimeLiteral", { enumerable: true, get: function () { return expressions_1.TimeLiteral; } });
|
|
63
|
+
Object.defineProperty(exports, "LangStringLiteral", { enumerable: true, get: function () { return expressions_1.LangStringLiteral; } });
|
|
64
|
+
Object.defineProperty(exports, "Term", { enumerable: true, get: function () { return expressions_1.Term; } });
|
|
65
|
+
Object.defineProperty(exports, "YearMonthDurationLiteral", { enumerable: true, get: function () { return expressions_1.YearMonthDurationLiteral; } });
|
|
66
|
+
Object.defineProperty(exports, "Quad", { enumerable: true, get: function () { return expressions_1.Quad; } });
|
|
67
|
+
Object.defineProperty(exports, "Operator", { enumerable: true, get: function () { return expressions_1.Operator; } });
|
|
68
|
+
Object.defineProperty(exports, "NamedNode", { enumerable: true, get: function () { return expressions_1.NamedNode; } });
|
|
69
|
+
Object.defineProperty(exports, "Variable", { enumerable: true, get: function () { return expressions_1.Variable; } });
|
|
70
|
+
Object.defineProperty(exports, "NumericLiteral", { enumerable: true, get: function () { return expressions_1.NumericLiteral; } });
|
|
71
|
+
Object.defineProperty(exports, "BooleanLiteral", { enumerable: true, get: function () { return expressions_1.BooleanLiteral; } });
|
|
72
|
+
Object.defineProperty(exports, "BlankNode", { enumerable: true, get: function () { return expressions_1.BlankNode; } });
|
|
73
|
+
Object.defineProperty(exports, "DecimalLiteral", { enumerable: true, get: function () { return expressions_1.DecimalLiteral; } });
|
|
74
|
+
Object.defineProperty(exports, "DefaultGraph", { enumerable: true, get: function () { return expressions_1.DefaultGraph; } });
|
|
75
|
+
Object.defineProperty(exports, "DoubleLiteral", { enumerable: true, get: function () { return expressions_1.DoubleLiteral; } });
|
|
76
|
+
Object.defineProperty(exports, "Aggregate", { enumerable: true, get: function () { return expressions_1.Aggregate; } });
|
|
77
|
+
Object.defineProperty(exports, "Existence", { enumerable: true, get: function () { return expressions_1.Existence; } });
|
|
78
|
+
Object.defineProperty(exports, "Literal", { enumerable: true, get: function () { return expressions_1.Literal; } });
|
|
79
|
+
Object.defineProperty(exports, "IntegerLiteral", { enumerable: true, get: function () { return expressions_1.IntegerLiteral; } });
|
|
80
|
+
Object.defineProperty(exports, "FloatLiteral", { enumerable: true, get: function () { return expressions_1.FloatLiteral; } });
|
|
81
|
+
Object.defineProperty(exports, "NonLexicalLiteral", { enumerable: true, get: function () { return expressions_1.NonLexicalLiteral; } });
|
|
82
|
+
Object.defineProperty(exports, "StringLiteral", { enumerable: true, get: function () { return expressions_1.StringLiteral; } });
|
|
83
|
+
Object.defineProperty(exports, "isNonLexicalLiteral", { enumerable: true, get: function () { return expressions_1.isNonLexicalLiteral; } });
|
|
84
|
+
var SpecAlgos_1 = require("./util/SpecAlgos");
|
|
85
|
+
Object.defineProperty(exports, "addDurationToDateTime", { enumerable: true, get: function () { return SpecAlgos_1.addDurationToDateTime; } });
|
|
86
|
+
Object.defineProperty(exports, "elapsedDuration", { enumerable: true, get: function () { return SpecAlgos_1.elapsedDuration; } });
|
|
87
|
+
var Parsing_1 = require("./util/Parsing");
|
|
88
|
+
Object.defineProperty(exports, "parseDateTime", { enumerable: true, get: function () { return Parsing_1.parseDateTime; } });
|
|
89
|
+
Object.defineProperty(exports, "parseDayTimeDuration", { enumerable: true, get: function () { return Parsing_1.parseDayTimeDuration; } });
|
|
90
|
+
Object.defineProperty(exports, "parseDuration", { enumerable: true, get: function () { return Parsing_1.parseDuration; } });
|
|
91
|
+
Object.defineProperty(exports, "parseTime", { enumerable: true, get: function () { return Parsing_1.parseTime; } });
|
|
92
|
+
Object.defineProperty(exports, "parseYearMonthDuration", { enumerable: true, get: function () { return Parsing_1.parseYearMonthDuration; } });
|
|
93
|
+
Object.defineProperty(exports, "parseXSDDecimal", { enumerable: true, get: function () { return Parsing_1.parseXSDDecimal; } });
|
|
94
|
+
Object.defineProperty(exports, "parseXSDFloat", { enumerable: true, get: function () { return Parsing_1.parseXSDFloat; } });
|
|
95
|
+
Object.defineProperty(exports, "parseDate", { enumerable: true, get: function () { return Parsing_1.parseDate; } });
|
|
96
|
+
var DateTimeHelpers_2 = require("./util/DateTimeHelpers");
|
|
97
|
+
Object.defineProperty(exports, "trimToYearMonthDuration", { enumerable: true, get: function () { return DateTimeHelpers_2.trimToYearMonthDuration; } });
|
|
98
|
+
Object.defineProperty(exports, "trimToDayTimeDuration", { enumerable: true, get: function () { return DateTimeHelpers_2.trimToDayTimeDuration; } });
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,kEAAiE;AAAx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A0B,OAAA;AAE5B,6CA2BuB;AA1BrB,8GAAA,eAAe,OAAA;AACf,qHAAA,sBAAsB,OAAA;AACtB,0GAAA,WAAW,OAAA;AACX,8GAAA,eAAe,OAAA;AACf,0GAAA,WAAW,OAAA;AACX,gHAAA,iBAAiB,OAAA;AACjB,mGAAA,IAAI,OAAA;AACJ,uHAAA,wBAAwB,OAAA;AACxB,mGAAA,IAAI,OAAA;AACJ,uGAAA,QAAQ,OAAA;AACR,wGAAA,SAAS,OAAA;AACT,uGAAA,QAAQ,OAAA;AACR,6GAAA,cAAc,OAAA;AACd,6GAAA,cAAc,OAAA;AACd,wGAAA,SAAS,OAAA;AACT,6GAAA,cAAc,OAAA;AACd,2GAAA,YAAY,OAAA;AACZ,4GAAA,aAAa,OAAA;AACb,wGAAA,SAAS,OAAA;AACT,wGAAA,SAAS,OAAA;AACT,sGAAA,OAAO,OAAA;AACP,6GAAA,cAAc,OAAA;AACd,2GAAA,YAAY,OAAA;AACZ,gHAAA,iBAAiB,OAAA;AACjB,4GAAA,aAAa,OAAA;AACb,kHAAA,mBAAmB,OAAA;AAErB,8CAA0E;AAAjE,kHAAA,qBAAqB,OAAA;AAAE,4GAAA,eAAe,OAAA;AAC/C,0CASwB;AARtB,wGAAA,aAAa,OAAA;AACb,+GAAA,oBAAoB,OAAA;AACpB,wGAAA,aAAa,OAAA;AACb,oGAAA,SAAS,OAAA;AACT,iHAAA,sBAAsB,OAAA;AACtB,0GAAA,eAAe,OAAA;AACf,wGAAA,aAAa,OAAA;AACb,oGAAA,SAAS,OAAA;AAEX,0DAGgC;AAF9B,0HAAA,uBAAuB,OAAA;AACvB,wHAAA,qBAAqB,OAAA","sourcesContent":["export { TermTransformer } from './transformers/TermTransformer';\nexport {\n OverloadTree,\n} from './functions/OverloadTree';\nexport { prepareEvaluatorActionContext } from './util/Context';\nexport {\n declare,\n bool,\n string,\n double,\n integer,\n dateTime,\n langString,\n decimal,\n float,\n expressionToVar,\n Builder,\n} from './functions/Helpers';\nexport {\n ExpressionError,\n isExpressionError,\n EmptyAggregateError,\n RDFEqualTypeError,\n IncompatibleLanguageOperation,\n InvalidTimezoneCall,\n InvalidArgumentTypes,\n CoalesceError,\n InError,\n NoAggregator,\n UnboundVariableError,\n CastError,\n ExtensionFunctionError,\n InvalidLexicalForm,\n InvalidArity,\n} from './util/Errors';\nexport {\n typedLiteral,\n TypeURL,\n TypeAlias,\n SparqlOperator,\n NamedOperator,\n GeneralOperator,\n KnownOperator,\n KnownLiteralTypes,\n} from './util/Consts';\nexport { isSubTypeOf } from './util/TypeHandling';\nexport {\n dayTimeDurationsToSeconds,\n defaultedDateTimeRepresentation,\n defaultedDayTimeDurationRepresentation,\n defaultedDurationRepresentation,\n defaultedYearMonthDurationRepresentation,\n extractRawTimeZone,\n negateDuration,\n toDateTimeRepresentation,\n toUTCDate,\n yearMonthDurationsToMonths,\n} from './util/DateTimeHelpers';\nexport {\n DateTimeLiteral,\n DayTimeDurationLiteral,\n DateLiteral,\n DurationLiteral,\n TimeLiteral,\n LangStringLiteral,\n Term,\n YearMonthDurationLiteral,\n Quad,\n Operator,\n NamedNode,\n Variable,\n NumericLiteral,\n BooleanLiteral,\n BlankNode,\n DecimalLiteral,\n DefaultGraph,\n DoubleLiteral,\n Aggregate,\n Existence,\n Literal,\n IntegerLiteral,\n FloatLiteral,\n NonLexicalLiteral,\n StringLiteral,\n isNonLexicalLiteral,\n} from './expressions';\nexport { addDurationToDateTime, elapsedDuration } from './util/SpecAlgos';\nexport {\n parseDateTime,\n parseDayTimeDuration,\n parseDuration,\n parseTime,\n parseYearMonthDuration,\n parseXSDDecimal,\n parseXSDFloat,\n parseDate,\n} from './util/Parsing';\nexport {\n trimToYearMonthDuration,\n trimToDayTimeDuration,\n} from './util/DateTimeHelpers';\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Expression, ISuperTypeProvider } from '@comunica/types';
|
|
2
|
+
import type * as RDF from '@rdfjs/types';
|
|
3
|
+
import type { Algebra as Alg } from 'sparqlalgebrajs';
|
|
4
|
+
import * as E from '../expressions';
|
|
5
|
+
export interface ITermTransformer {
|
|
6
|
+
transformRDFTermUnsafe: (term: RDF.Term) => E.Term;
|
|
7
|
+
transformLiteral: (lit: RDF.Literal) => E.Literal<any>;
|
|
8
|
+
}
|
|
9
|
+
export declare class TermTransformer implements ITermTransformer {
|
|
10
|
+
protected readonly superTypeProvider: ISuperTypeProvider;
|
|
11
|
+
constructor(superTypeProvider: ISuperTypeProvider);
|
|
12
|
+
/**
|
|
13
|
+
* Transforms an RDF term to the internal representation of a term,
|
|
14
|
+
* assuming it is not a variable, which would be an expression (internally).
|
|
15
|
+
*
|
|
16
|
+
* @param term RDF term to transform into internal representation of a term
|
|
17
|
+
*/
|
|
18
|
+
transformRDFTermUnsafe(term: RDF.Term): E.Term;
|
|
19
|
+
protected transformTerm(term: Alg.TermExpression): Expression;
|
|
20
|
+
/**
|
|
21
|
+
* @param lit the rdf literal we want to transform to an internal Literal expression.
|
|
22
|
+
*/
|
|
23
|
+
transformLiteral(lit: RDF.Literal): E.Literal<any>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TermTransformer = void 0;
|
|
4
|
+
const RDFString = require("rdf-string");
|
|
5
|
+
const sparqlalgebrajs_1 = require("sparqlalgebrajs");
|
|
6
|
+
const E = require("../expressions");
|
|
7
|
+
const Consts_1 = require("../util/Consts");
|
|
8
|
+
const Err = require("../util/Errors");
|
|
9
|
+
const Errors_1 = require("../util/Errors");
|
|
10
|
+
const Parsing_1 = require("../util/Parsing");
|
|
11
|
+
const P = require("../util/Parsing");
|
|
12
|
+
const TypeHandling_1 = require("../util/TypeHandling");
|
|
13
|
+
class TermTransformer {
|
|
14
|
+
constructor(superTypeProvider) {
|
|
15
|
+
this.superTypeProvider = superTypeProvider;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Transforms an RDF term to the internal representation of a term,
|
|
19
|
+
* assuming it is not a variable, which would be an expression (internally).
|
|
20
|
+
*
|
|
21
|
+
* @param term RDF term to transform into internal representation of a term
|
|
22
|
+
*/
|
|
23
|
+
transformRDFTermUnsafe(term) {
|
|
24
|
+
return this.transformTerm({
|
|
25
|
+
term,
|
|
26
|
+
type: sparqlalgebrajs_1.Algebra.types.EXPRESSION,
|
|
27
|
+
expressionType: sparqlalgebrajs_1.Algebra.expressionTypes.TERM,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
transformTerm(term) {
|
|
31
|
+
if (!term.term) {
|
|
32
|
+
throw new Err.InvalidExpression(term);
|
|
33
|
+
}
|
|
34
|
+
switch (term.term.termType) {
|
|
35
|
+
case 'Variable':
|
|
36
|
+
return new E.Variable(RDFString.termToString(term.term));
|
|
37
|
+
case 'Literal':
|
|
38
|
+
return this.transformLiteral(term.term);
|
|
39
|
+
case 'NamedNode':
|
|
40
|
+
return new E.NamedNode(term.term.value);
|
|
41
|
+
case 'BlankNode':
|
|
42
|
+
return new E.BlankNode(term.term.value);
|
|
43
|
+
case 'Quad':
|
|
44
|
+
return new E.Quad(this.transformRDFTermUnsafe(term.term.subject), this.transformRDFTermUnsafe(term.term.predicate), this.transformRDFTermUnsafe(term.term.object), this.transformRDFTermUnsafe(term.term.graph));
|
|
45
|
+
case 'DefaultGraph':
|
|
46
|
+
return new E.DefaultGraph();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @param lit the rdf literal we want to transform to an internal Literal expression.
|
|
51
|
+
*/
|
|
52
|
+
transformLiteral(lit) {
|
|
53
|
+
// Both here and within the switch we transform to LangStringLiteral or StringLiteral.
|
|
54
|
+
// We do this when we detect a simple literal being used.
|
|
55
|
+
// Original issue regarding this behaviour: https://github.com/w3c/sparql-12/issues/112
|
|
56
|
+
if (!lit.datatype || [null, undefined, ''].includes(lit.datatype.value)) {
|
|
57
|
+
return lit.language ?
|
|
58
|
+
new E.LangStringLiteral(lit.value, lit.language) :
|
|
59
|
+
new E.StringLiteral(lit.value);
|
|
60
|
+
}
|
|
61
|
+
const dataType = lit.datatype.value;
|
|
62
|
+
const superTypeDict = (0, TypeHandling_1.getSuperTypeDict)(dataType, this.superTypeProvider);
|
|
63
|
+
// The order of checking matters! Check most specific types first!
|
|
64
|
+
try {
|
|
65
|
+
if (Consts_1.TypeURL.XSD_STRING in superTypeDict) {
|
|
66
|
+
return new E.StringLiteral(lit.value, dataType);
|
|
67
|
+
}
|
|
68
|
+
if (Consts_1.TypeURL.RDF_LANG_STRING in superTypeDict) {
|
|
69
|
+
return new E.LangStringLiteral(lit.value, lit.language);
|
|
70
|
+
}
|
|
71
|
+
if (Consts_1.TypeURL.XSD_YEAR_MONTH_DURATION in superTypeDict) {
|
|
72
|
+
return new E.YearMonthDurationLiteral((0, Parsing_1.parseYearMonthDuration)(lit.value), lit.value, dataType);
|
|
73
|
+
}
|
|
74
|
+
if (Consts_1.TypeURL.XSD_DAY_TIME_DURATION in superTypeDict) {
|
|
75
|
+
return new E.DayTimeDurationLiteral((0, Parsing_1.parseDayTimeDuration)(lit.value), lit.value, dataType);
|
|
76
|
+
}
|
|
77
|
+
if (Consts_1.TypeURL.XSD_DURATION in superTypeDict) {
|
|
78
|
+
return new E.DurationLiteral((0, Parsing_1.parseDuration)(lit.value), lit.value, dataType);
|
|
79
|
+
}
|
|
80
|
+
if (Consts_1.TypeURL.XSD_DATE_TIME in superTypeDict) {
|
|
81
|
+
const dateVal = new Date(lit.value);
|
|
82
|
+
if (Number.isNaN(dateVal.getTime())) {
|
|
83
|
+
return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);
|
|
84
|
+
}
|
|
85
|
+
return new E.DateTimeLiteral((0, Parsing_1.parseDateTime)(lit.value), lit.value, dataType);
|
|
86
|
+
}
|
|
87
|
+
if (Consts_1.TypeURL.XSD_DATE in superTypeDict) {
|
|
88
|
+
return new E.DateLiteral((0, Parsing_1.parseDate)(lit.value), lit.value, dataType);
|
|
89
|
+
}
|
|
90
|
+
if (Consts_1.TypeURL.XSD_TIME in superTypeDict) {
|
|
91
|
+
return new E.TimeLiteral((0, Parsing_1.parseTime)(lit.value), lit.value, dataType);
|
|
92
|
+
}
|
|
93
|
+
if (Consts_1.TypeURL.XSD_BOOLEAN in superTypeDict) {
|
|
94
|
+
if (lit.value !== 'true' && lit.value !== 'false' && lit.value !== '1' && lit.value !== '0') {
|
|
95
|
+
return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);
|
|
96
|
+
}
|
|
97
|
+
return new E.BooleanLiteral(lit.value === 'true' || lit.value === '1', lit.value);
|
|
98
|
+
}
|
|
99
|
+
if (Consts_1.TypeURL.XSD_DECIMAL in superTypeDict) {
|
|
100
|
+
const intVal = P.parseXSDDecimal(lit.value);
|
|
101
|
+
if (intVal === undefined) {
|
|
102
|
+
return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);
|
|
103
|
+
}
|
|
104
|
+
if (Consts_1.TypeURL.XSD_INTEGER in superTypeDict) {
|
|
105
|
+
return new E.IntegerLiteral(intVal, dataType, lit.value);
|
|
106
|
+
}
|
|
107
|
+
// If type is not an integer it's just a decimal.
|
|
108
|
+
return new E.DecimalLiteral(intVal, dataType, lit.value);
|
|
109
|
+
}
|
|
110
|
+
const isFloat = Consts_1.TypeURL.XSD_FLOAT in superTypeDict;
|
|
111
|
+
const isDouble = Consts_1.TypeURL.XSD_DOUBLE in superTypeDict;
|
|
112
|
+
if (isFloat || isDouble) {
|
|
113
|
+
const doubleVal = P.parseXSDFloat(lit.value);
|
|
114
|
+
if (doubleVal === undefined) {
|
|
115
|
+
return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);
|
|
116
|
+
}
|
|
117
|
+
if (isFloat) {
|
|
118
|
+
return new E.FloatLiteral(doubleVal, dataType, lit.value);
|
|
119
|
+
}
|
|
120
|
+
return new E.DoubleLiteral(doubleVal, dataType, lit.value);
|
|
121
|
+
}
|
|
122
|
+
return new E.Literal(lit.value, dataType, lit.value);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
if ((0, Errors_1.isExpressionError)(error)) {
|
|
126
|
+
return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);
|
|
127
|
+
}
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.TermTransformer = TermTransformer;
|
|
133
|
+
//# sourceMappingURL=TermTransformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TermTransformer.js","sourceRoot":"","sources":["TermTransformer.ts"],"names":[],"mappings":";;;AAEA,wCAAwC;AAExC,qDAA0C;AAC1C,oCAAoC;AACpC,2CAAyC;AACzC,sCAAsC;AACtC,2CAAmD;AACnD,6CAOyB;AACzB,qCAAqC;AACrC,uDAAwD;AAOxD,MAAa,eAAe;IAC1B,YAAsC,iBAAqC;QAArC,sBAAiB,GAAjB,iBAAiB,CAAoB;IAAG,CAAC;IAE/E;;;;;OAKG;IACI,sBAAsB,CAAC,IAAc;QAC1C,OAAgB,IAAI,CAAC,aAAa,CAAC;YACjC,IAAI;YACJ,IAAI,EAAE,yBAAO,CAAC,KAAK,CAAC,UAAU;YAC9B,cAAc,EAAE,yBAAO,CAAC,eAAe,CAAC,IAAI;SAC7C,CAAC,CAAC;IACL,CAAC;IAES,aAAa,CAAC,IAAwB;QAC9C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,IAAI,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;QAED,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC3B,KAAK,UAAU;gBACb,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YA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;gBACD,OAAO,IAAI,CAAC,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7D,CAAC;YAED,OAAO,IAAI,CAAC,CAAC,OAAO,CAAS,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/D,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,IAAA,0BAAiB,EAAS,KAAK,CAAC,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC,CAAC,iBAAiB,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YACzF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA/HD,0CA+HC","sourcesContent":["import type { Expression, GeneralSuperTypeDict, ISuperTypeProvider } from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport * as RDFString from 'rdf-string';\nimport type { Algebra as Alg } from 'sparqlalgebrajs';\nimport { Algebra } from 'sparqlalgebrajs';\nimport * as E from '../expressions';\nimport { TypeURL } from '../util/Consts';\nimport * as Err from '../util/Errors';\nimport { isExpressionError } from '../util/Errors';\nimport {\n parseDate,\n parseDateTime,\n parseDayTimeDuration,\n parseDuration,\n parseTime,\n parseYearMonthDuration,\n} from '../util/Parsing';\nimport * as P from '../util/Parsing';\nimport { getSuperTypeDict } from '../util/TypeHandling';\n\nexport interface ITermTransformer {\n transformRDFTermUnsafe: (term: RDF.Term) => E.Term;\n transformLiteral: (lit: RDF.Literal) => E.Literal<any>;\n}\n\nexport class TermTransformer implements ITermTransformer {\n public constructor(protected readonly superTypeProvider: ISuperTypeProvider) {}\n\n /**\n * Transforms an RDF term to the internal representation of a term,\n * assuming it is not a variable, which would be an expression (internally).\n *\n * @param term RDF term to transform into internal representation of a term\n */\n public transformRDFTermUnsafe(term: RDF.Term): E.Term {\n return <E.Term> this.transformTerm({\n term,\n type: Algebra.types.EXPRESSION,\n expressionType: Algebra.expressionTypes.TERM,\n });\n }\n\n protected transformTerm(term: Alg.TermExpression): Expression {\n if (!term.term) {\n throw new Err.InvalidExpression(term);\n }\n\n switch (term.term.termType) {\n case 'Variable':\n return new E.Variable(RDFString.termToString(term.term));\n case 'Literal':\n return this.transformLiteral(term.term);\n case 'NamedNode':\n return new E.NamedNode(term.term.value);\n case 'BlankNode':\n return new E.BlankNode(term.term.value);\n case 'Quad':\n return new E.Quad(\n this.transformRDFTermUnsafe(term.term.subject),\n this.transformRDFTermUnsafe(term.term.predicate),\n this.transformRDFTermUnsafe(term.term.object),\n this.transformRDFTermUnsafe(term.term.graph),\n );\n case 'DefaultGraph':\n return new E.DefaultGraph();\n }\n }\n\n /**\n * @param lit the rdf literal we want to transform to an internal Literal expression.\n */\n public transformLiteral(lit: RDF.Literal): E.Literal<any> {\n // Both here and within the switch we transform to LangStringLiteral or StringLiteral.\n // We do this when we detect a simple literal being used.\n // Original issue regarding this behaviour: https://github.com/w3c/sparql-12/issues/112\n if (!lit.datatype || [ null, undefined, '' ].includes(lit.datatype.value)) {\n return lit.language ?\n new E.LangStringLiteral(lit.value, lit.language) :\n new E.StringLiteral(lit.value);\n }\n\n const dataType = lit.datatype.value;\n const superTypeDict: GeneralSuperTypeDict = getSuperTypeDict(dataType, this.superTypeProvider);\n\n // The order of checking matters! Check most specific types first!\n try {\n if (TypeURL.XSD_STRING in superTypeDict) {\n return new E.StringLiteral(lit.value, dataType);\n }\n if (TypeURL.RDF_LANG_STRING in superTypeDict) {\n return new E.LangStringLiteral(lit.value, lit.language);\n }\n if (TypeURL.XSD_YEAR_MONTH_DURATION in superTypeDict) {\n return new E.YearMonthDurationLiteral(parseYearMonthDuration(lit.value), lit.value, dataType);\n }\n if (TypeURL.XSD_DAY_TIME_DURATION in superTypeDict) {\n return new E.DayTimeDurationLiteral(parseDayTimeDuration(lit.value), lit.value, dataType);\n }\n if (TypeURL.XSD_DURATION in superTypeDict) {\n return new E.DurationLiteral(parseDuration(lit.value), lit.value, dataType);\n }\n if (TypeURL.XSD_DATE_TIME in superTypeDict) {\n const dateVal: Date = new Date(lit.value);\n if (Number.isNaN(dateVal.getTime())) {\n return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);\n }\n return new E.DateTimeLiteral(parseDateTime(lit.value), lit.value, dataType);\n }\n if (TypeURL.XSD_DATE in superTypeDict) {\n return new E.DateLiteral(parseDate(lit.value), lit.value, dataType);\n }\n if (TypeURL.XSD_TIME in superTypeDict) {\n return new E.TimeLiteral(parseTime(lit.value), lit.value, dataType);\n }\n if (TypeURL.XSD_BOOLEAN in superTypeDict) {\n if (lit.value !== 'true' && lit.value !== 'false' && lit.value !== '1' && lit.value !== '0') {\n return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);\n }\n return new E.BooleanLiteral(lit.value === 'true' || lit.value === '1', lit.value);\n }\n if (TypeURL.XSD_DECIMAL in superTypeDict) {\n const intVal: number | undefined = P.parseXSDDecimal(lit.value);\n if (intVal === undefined) {\n return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);\n }\n if (TypeURL.XSD_INTEGER in superTypeDict) {\n return new E.IntegerLiteral(intVal, dataType, lit.value);\n }\n // If type is not an integer it's just a decimal.\n return new E.DecimalLiteral(intVal, dataType, lit.value);\n }\n const isFloat = TypeURL.XSD_FLOAT in superTypeDict;\n const isDouble = TypeURL.XSD_DOUBLE in superTypeDict;\n if (isFloat || isDouble) {\n const doubleVal: number | undefined = P.parseXSDFloat(lit.value);\n if (doubleVal === undefined) {\n return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);\n }\n if (isFloat) {\n return new E.FloatLiteral(doubleVal, dataType, lit.value);\n }\n return new E.DoubleLiteral(doubleVal, dataType, lit.value);\n }\n\n return new E.Literal<string>(lit.value, dataType, lit.value);\n } catch (error: unknown) {\n if (isExpressionError(<Error> error)) {\n return new E.NonLexicalLiteral(undefined, dataType, this.superTypeProvider, lit.value);\n }\n throw error;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type * as RDF from '@rdfjs/types';
|
|
2
|
+
export type KnownLiteralTypes = TypeAlias | TypeURL;
|
|
3
|
+
export declare enum TypeAlias {
|
|
4
|
+
SPARQL_NUMERIC = "SPARQL_NUMERIC",
|
|
5
|
+
/**
|
|
6
|
+
* Stringly is everything defined in https://www.w3.org/TR/sparql11-query/#func-strings
|
|
7
|
+
* In other words it is a simple literal, a plain literal with language tag, or a literal with datatype xsd:string
|
|
8
|
+
* In other words, since utils-expression-evaluator transforms a simple literal to xsd_string.
|
|
9
|
+
* It is RDF_LANG_STRING or XSD_STRING.
|
|
10
|
+
* Reasons for this are mentioned here: w3c/sparql-12#112
|
|
11
|
+
*/
|
|
12
|
+
SPARQL_STRINGLY = "SPARQL_STRINGLY"
|
|
13
|
+
}
|
|
14
|
+
export declare function typedLiteral(value: string, type: TypeURL): RDF.Literal;
|
|
15
|
+
export declare enum TypeURL {
|
|
16
|
+
XSD_ANY_URI = "http://www.w3.org/2001/XMLSchema#anyURI",
|
|
17
|
+
XSD_STRING = "http://www.w3.org/2001/XMLSchema#string",
|
|
18
|
+
RDF_LANG_STRING = "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",
|
|
19
|
+
XSD_BOOLEAN = "http://www.w3.org/2001/XMLSchema#boolean",
|
|
20
|
+
XSD_DATE_TIME = "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
21
|
+
XSD_DATE_TIME_STAMP = "http://www.w3.org/2001/XMLSchema#dateTimeStamp",
|
|
22
|
+
XSD_DATE = "http://www.w3.org/2001/XMLSchema#date",
|
|
23
|
+
XSD_G_MONTH = "http://www.w3.org/2001/XMLSchema#gMonth",
|
|
24
|
+
XSD_G_MONTHDAY = "http://www.w3.org/2001/XMLSchema#gMonthDay",
|
|
25
|
+
XSD_G_YEAR = "http://www.w3.org/2001/XMLSchema#gYear",
|
|
26
|
+
XSD_G_YEAR_MONTH = "http://www.w3.org/2001/XMLSchema#gYearMonth",
|
|
27
|
+
XSD_TIME = "http://www.w3.org/2001/XMLSchema#time",
|
|
28
|
+
XSD_G_DAY = "http://www.w3.org/2001/XMLSchema#gDay",
|
|
29
|
+
XSD_DECIMAL = "http://www.w3.org/2001/XMLSchema#decimal",
|
|
30
|
+
XSD_FLOAT = "http://www.w3.org/2001/XMLSchema#float",
|
|
31
|
+
XSD_DOUBLE = "http://www.w3.org/2001/XMLSchema#double",
|
|
32
|
+
XSD_INTEGER = "http://www.w3.org/2001/XMLSchema#integer",
|
|
33
|
+
XSD_NON_POSITIVE_INTEGER = "http://www.w3.org/2001/XMLSchema#nonPositiveInteger",
|
|
34
|
+
XSD_NEGATIVE_INTEGER = "http://www.w3.org/2001/XMLSchema#negativeInteger",
|
|
35
|
+
XSD_LONG = "http://www.w3.org/2001/XMLSchema#long",
|
|
36
|
+
XSD_INT = "http://www.w3.org/2001/XMLSchema#int",
|
|
37
|
+
XSD_SHORT = "http://www.w3.org/2001/XMLSchema#short",
|
|
38
|
+
XSD_BYTE = "http://www.w3.org/2001/XMLSchema#byte",
|
|
39
|
+
XSD_NON_NEGATIVE_INTEGER = "http://www.w3.org/2001/XMLSchema#nonNegativeInteger",
|
|
40
|
+
XSD_POSITIVE_INTEGER = "http://www.w3.org/2001/XMLSchema#positiveInteger",
|
|
41
|
+
XSD_UNSIGNED_LONG = "http://www.w3.org/2001/XMLSchema#unsignedLong",
|
|
42
|
+
XSD_UNSIGNED_INT = "http://www.w3.org/2001/XMLSchema#unsignedInt",
|
|
43
|
+
XSD_UNSIGNED_SHORT = "http://www.w3.org/2001/XMLSchema#unsignedShort",
|
|
44
|
+
XSD_UNSIGNED_BYTE = "http://www.w3.org/2001/XMLSchema#unsignedByte",
|
|
45
|
+
XSD_NORMALIZED_STRING = "http://www.w3.org/2001/XMLSchema#normalizedString",
|
|
46
|
+
XSD_TOKEN = "http://www.w3.org/2001/XMLSchema#token",
|
|
47
|
+
XSD_LANGUAGE = "http://www.w3.org/2001/XMLSchema#language",
|
|
48
|
+
XSD_NM_TOKEN = "http://www.w3.org/2001/XMLSchema#NMTOKEN",
|
|
49
|
+
XSD_NAME = "http://www.w3.org/2001/XMLSchema#name",
|
|
50
|
+
XSD_NC_NAME = "http://www.w3.org/2001/XMLSchema#NCName",
|
|
51
|
+
XSD_ENTITY = "http://www.w3.org/2001/XMLSchema#ENTITY",
|
|
52
|
+
XSD_ID = "http://www.w3.org/2001/XMLSchema#ID",
|
|
53
|
+
XSD_ID_REF = "http://www.w3.org/2001/XMLSchema#IDREF",
|
|
54
|
+
XSD_DURATION = "http://www.w3.org/2001/XMLSchema#duration",
|
|
55
|
+
XSD_YEAR_MONTH_DURATION = "http://www.w3.org/2001/XMLSchema#yearMonthDuration",
|
|
56
|
+
XSD_DAY_TIME_DURATION = "http://www.w3.org/2001/XMLSchema#dayTimeDuration"
|
|
57
|
+
}
|
|
58
|
+
export type GeneralOperator = KnownOperator | string;
|
|
59
|
+
export type KnownOperator = SparqlOperator | NamedOperator;
|
|
60
|
+
export declare enum SparqlOperator {
|
|
61
|
+
NOT = "!",
|
|
62
|
+
UMINUS = "uminus",
|
|
63
|
+
UPLUS = "uplus",
|
|
64
|
+
LOGICAL_OR = "||",
|
|
65
|
+
LOGICAL_AND = "&&",
|
|
66
|
+
EQUAL = "=",
|
|
67
|
+
NOT_EQUAL = "!=",
|
|
68
|
+
LT = "<",
|
|
69
|
+
GT = ">",
|
|
70
|
+
LTE = "<=",
|
|
71
|
+
GTE = ">=",
|
|
72
|
+
SAME_TERM = "sameterm",
|
|
73
|
+
IN = "in",
|
|
74
|
+
NOT_IN = "notin",
|
|
75
|
+
MULTIPLICATION = "*",
|
|
76
|
+
DIVISION = "/",
|
|
77
|
+
ADDITION = "+",
|
|
78
|
+
SUBTRACTION = "-",
|
|
79
|
+
IS_IRI = "isiri",
|
|
80
|
+
IS_URI = "isuri",
|
|
81
|
+
IS_BLANK = "isblank",
|
|
82
|
+
IS_LITERAL = "isliteral",
|
|
83
|
+
IS_NUMERIC = "isnumeric",
|
|
84
|
+
STR = "str",
|
|
85
|
+
LANG = "lang",
|
|
86
|
+
DATATYPE = "datatype",
|
|
87
|
+
IRI = "iri",
|
|
88
|
+
URI = "uri",
|
|
89
|
+
BNODE = "bnode",
|
|
90
|
+
STRDT = "strdt",
|
|
91
|
+
STRLANG = "strlang",
|
|
92
|
+
UUID = "uuid",
|
|
93
|
+
STRUUID = "struuid",
|
|
94
|
+
STRLEN = "strlen",
|
|
95
|
+
SUBSTR = "substr",
|
|
96
|
+
UCASE = "ucase",
|
|
97
|
+
LCASE = "lcase",
|
|
98
|
+
STRSTARTS = "strstarts",
|
|
99
|
+
STRENDS = "strends",
|
|
100
|
+
CONTAINS = "contains",
|
|
101
|
+
STRBEFORE = "strbefore",
|
|
102
|
+
STRAFTER = "strafter",
|
|
103
|
+
ENCODE_FOR_URI = "encode_for_uri",
|
|
104
|
+
CONCAT = "concat",
|
|
105
|
+
LANG_MATCHES = "langmatches",
|
|
106
|
+
REGEX = "regex",
|
|
107
|
+
REPLACE = "replace",
|
|
108
|
+
ABS = "abs",
|
|
109
|
+
ROUND = "round",
|
|
110
|
+
CEIL = "ceil",
|
|
111
|
+
FLOOR = "floor",
|
|
112
|
+
RAND = "rand",
|
|
113
|
+
NOW = "now",
|
|
114
|
+
YEAR = "year",
|
|
115
|
+
MONTH = "month",
|
|
116
|
+
DAY = "day",
|
|
117
|
+
HOURS = "hours",
|
|
118
|
+
MINUTES = "minutes",
|
|
119
|
+
SECONDS = "seconds",
|
|
120
|
+
TIMEZONE = "timezone",
|
|
121
|
+
TZ = "tz",
|
|
122
|
+
MD5 = "md5",
|
|
123
|
+
SHA1 = "sha1",
|
|
124
|
+
SHA256 = "sha256",
|
|
125
|
+
SHA384 = "sha384",
|
|
126
|
+
SHA512 = "sha512",
|
|
127
|
+
TRIPLE = "triple",
|
|
128
|
+
SUBJECT = "subject",
|
|
129
|
+
PREDICATE = "predicate",
|
|
130
|
+
OBJECT = "object",
|
|
131
|
+
IS_TRIPLE = "istriple",
|
|
132
|
+
BOUND = "bound",
|
|
133
|
+
IF = "if",
|
|
134
|
+
COALESCE = "coalesce"
|
|
135
|
+
}
|
|
136
|
+
export type NamedOperator = TypeURL.XSD_STRING | TypeURL.XSD_FLOAT | TypeURL.XSD_DOUBLE | TypeURL.XSD_DECIMAL | TypeURL.XSD_INTEGER | TypeURL.XSD_DATE_TIME | TypeURL.XSD_DATE | TypeURL.XSD_BOOLEAN | TypeURL.XSD_TIME | TypeURL.XSD_DURATION | TypeURL.XSD_DAY_TIME_DURATION | TypeURL.XSD_YEAR_MONTH_DURATION;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SparqlOperator = exports.TypeURL = exports.typedLiteral = exports.TypeAlias = void 0;
|
|
4
|
+
const rdf_data_factory_1 = require("rdf-data-factory");
|
|
5
|
+
var TypeAlias;
|
|
6
|
+
(function (TypeAlias) {
|
|
7
|
+
// Numeric is everything defined in https://www.w3.org/TR/sparql11-query/#operandDataTypes
|
|
8
|
+
TypeAlias["SPARQL_NUMERIC"] = "SPARQL_NUMERIC";
|
|
9
|
+
/**
|
|
10
|
+
* Stringly is everything defined in https://www.w3.org/TR/sparql11-query/#func-strings
|
|
11
|
+
* In other words it is a simple literal, a plain literal with language tag, or a literal with datatype xsd:string
|
|
12
|
+
* In other words, since utils-expression-evaluator transforms a simple literal to xsd_string.
|
|
13
|
+
* It is RDF_LANG_STRING or XSD_STRING.
|
|
14
|
+
* Reasons for this are mentioned here: w3c/sparql-12#112
|
|
15
|
+
*/
|
|
16
|
+
TypeAlias["SPARQL_STRINGLY"] = "SPARQL_STRINGLY";
|
|
17
|
+
})(TypeAlias || (exports.TypeAlias = TypeAlias = {}));
|
|
18
|
+
const DF = new rdf_data_factory_1.DataFactory();
|
|
19
|
+
function typedLiteral(value, type) {
|
|
20
|
+
return DF.literal(value, DF.namedNode(type));
|
|
21
|
+
}
|
|
22
|
+
exports.typedLiteral = typedLiteral;
|
|
23
|
+
var TypeURL;
|
|
24
|
+
(function (TypeURL) {
|
|
25
|
+
TypeURL["XSD_ANY_URI"] = "http://www.w3.org/2001/XMLSchema#anyURI";
|
|
26
|
+
TypeURL["XSD_STRING"] = "http://www.w3.org/2001/XMLSchema#string";
|
|
27
|
+
TypeURL["RDF_LANG_STRING"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString";
|
|
28
|
+
TypeURL["XSD_BOOLEAN"] = "http://www.w3.org/2001/XMLSchema#boolean";
|
|
29
|
+
TypeURL["XSD_DATE_TIME"] = "http://www.w3.org/2001/XMLSchema#dateTime";
|
|
30
|
+
TypeURL["XSD_DATE_TIME_STAMP"] = "http://www.w3.org/2001/XMLSchema#dateTimeStamp";
|
|
31
|
+
TypeURL["XSD_DATE"] = "http://www.w3.org/2001/XMLSchema#date";
|
|
32
|
+
TypeURL["XSD_G_MONTH"] = "http://www.w3.org/2001/XMLSchema#gMonth";
|
|
33
|
+
TypeURL["XSD_G_MONTHDAY"] = "http://www.w3.org/2001/XMLSchema#gMonthDay";
|
|
34
|
+
TypeURL["XSD_G_YEAR"] = "http://www.w3.org/2001/XMLSchema#gYear";
|
|
35
|
+
TypeURL["XSD_G_YEAR_MONTH"] = "http://www.w3.org/2001/XMLSchema#gYearMonth";
|
|
36
|
+
TypeURL["XSD_TIME"] = "http://www.w3.org/2001/XMLSchema#time";
|
|
37
|
+
TypeURL["XSD_G_DAY"] = "http://www.w3.org/2001/XMLSchema#gDay";
|
|
38
|
+
// Numeric types
|
|
39
|
+
TypeURL["XSD_DECIMAL"] = "http://www.w3.org/2001/XMLSchema#decimal";
|
|
40
|
+
TypeURL["XSD_FLOAT"] = "http://www.w3.org/2001/XMLSchema#float";
|
|
41
|
+
TypeURL["XSD_DOUBLE"] = "http://www.w3.org/2001/XMLSchema#double";
|
|
42
|
+
// Derived numeric types
|
|
43
|
+
TypeURL["XSD_INTEGER"] = "http://www.w3.org/2001/XMLSchema#integer";
|
|
44
|
+
TypeURL["XSD_NON_POSITIVE_INTEGER"] = "http://www.w3.org/2001/XMLSchema#nonPositiveInteger";
|
|
45
|
+
TypeURL["XSD_NEGATIVE_INTEGER"] = "http://www.w3.org/2001/XMLSchema#negativeInteger";
|
|
46
|
+
TypeURL["XSD_LONG"] = "http://www.w3.org/2001/XMLSchema#long";
|
|
47
|
+
TypeURL["XSD_INT"] = "http://www.w3.org/2001/XMLSchema#int";
|
|
48
|
+
TypeURL["XSD_SHORT"] = "http://www.w3.org/2001/XMLSchema#short";
|
|
49
|
+
TypeURL["XSD_BYTE"] = "http://www.w3.org/2001/XMLSchema#byte";
|
|
50
|
+
TypeURL["XSD_NON_NEGATIVE_INTEGER"] = "http://www.w3.org/2001/XMLSchema#nonNegativeInteger";
|
|
51
|
+
TypeURL["XSD_POSITIVE_INTEGER"] = "http://www.w3.org/2001/XMLSchema#positiveInteger";
|
|
52
|
+
TypeURL["XSD_UNSIGNED_LONG"] = "http://www.w3.org/2001/XMLSchema#unsignedLong";
|
|
53
|
+
TypeURL["XSD_UNSIGNED_INT"] = "http://www.w3.org/2001/XMLSchema#unsignedInt";
|
|
54
|
+
TypeURL["XSD_UNSIGNED_SHORT"] = "http://www.w3.org/2001/XMLSchema#unsignedShort";
|
|
55
|
+
TypeURL["XSD_UNSIGNED_BYTE"] = "http://www.w3.org/2001/XMLSchema#unsignedByte";
|
|
56
|
+
// Derived String Type
|
|
57
|
+
TypeURL["XSD_NORMALIZED_STRING"] = "http://www.w3.org/2001/XMLSchema#normalizedString";
|
|
58
|
+
TypeURL["XSD_TOKEN"] = "http://www.w3.org/2001/XMLSchema#token";
|
|
59
|
+
TypeURL["XSD_LANGUAGE"] = "http://www.w3.org/2001/XMLSchema#language";
|
|
60
|
+
TypeURL["XSD_NM_TOKEN"] = "http://www.w3.org/2001/XMLSchema#NMTOKEN";
|
|
61
|
+
TypeURL["XSD_NAME"] = "http://www.w3.org/2001/XMLSchema#name";
|
|
62
|
+
TypeURL["XSD_NC_NAME"] = "http://www.w3.org/2001/XMLSchema#NCName";
|
|
63
|
+
TypeURL["XSD_ENTITY"] = "http://www.w3.org/2001/XMLSchema#ENTITY";
|
|
64
|
+
TypeURL["XSD_ID"] = "http://www.w3.org/2001/XMLSchema#ID";
|
|
65
|
+
TypeURL["XSD_ID_REF"] = "http://www.w3.org/2001/XMLSchema#IDREF";
|
|
66
|
+
// Other types
|
|
67
|
+
TypeURL["XSD_DURATION"] = "http://www.w3.org/2001/XMLSchema#duration";
|
|
68
|
+
TypeURL["XSD_YEAR_MONTH_DURATION"] = "http://www.w3.org/2001/XMLSchema#yearMonthDuration";
|
|
69
|
+
TypeURL["XSD_DAY_TIME_DURATION"] = "http://www.w3.org/2001/XMLSchema#dayTimeDuration";
|
|
70
|
+
})(TypeURL || (exports.TypeURL = TypeURL = {}));
|
|
71
|
+
// TODO: Remove unneeded double typing
|
|
72
|
+
var SparqlOperator;
|
|
73
|
+
(function (SparqlOperator) {
|
|
74
|
+
// Operator mapping
|
|
75
|
+
// https://www.w3.org/TR/sparql11-query/#OperatorMapping
|
|
76
|
+
SparqlOperator["NOT"] = "!";
|
|
77
|
+
SparqlOperator["UMINUS"] = "uminus";
|
|
78
|
+
SparqlOperator["UPLUS"] = "uplus";
|
|
79
|
+
SparqlOperator["LOGICAL_OR"] = "||";
|
|
80
|
+
SparqlOperator["LOGICAL_AND"] = "&&";
|
|
81
|
+
SparqlOperator["EQUAL"] = "=";
|
|
82
|
+
SparqlOperator["NOT_EQUAL"] = "!=";
|
|
83
|
+
SparqlOperator["LT"] = "<";
|
|
84
|
+
SparqlOperator["GT"] = ">";
|
|
85
|
+
SparqlOperator["LTE"] = "<=";
|
|
86
|
+
SparqlOperator["GTE"] = ">=";
|
|
87
|
+
SparqlOperator["SAME_TERM"] = "sameterm";
|
|
88
|
+
SparqlOperator["IN"] = "in";
|
|
89
|
+
SparqlOperator["NOT_IN"] = "notin";
|
|
90
|
+
SparqlOperator["MULTIPLICATION"] = "*";
|
|
91
|
+
SparqlOperator["DIVISION"] = "/";
|
|
92
|
+
SparqlOperator["ADDITION"] = "+";
|
|
93
|
+
SparqlOperator["SUBTRACTION"] = "-";
|
|
94
|
+
// Functional Forms
|
|
95
|
+
// https://www.w3.org/TR/sparql11-query/#func-forms
|
|
96
|
+
// See SpecialOperators
|
|
97
|
+
// Functions on RDF Terms
|
|
98
|
+
// https://www.w3.org/TR/sparql11-query/#func-rdfTerms
|
|
99
|
+
SparqlOperator["IS_IRI"] = "isiri";
|
|
100
|
+
SparqlOperator["IS_URI"] = "isuri";
|
|
101
|
+
SparqlOperator["IS_BLANK"] = "isblank";
|
|
102
|
+
SparqlOperator["IS_LITERAL"] = "isliteral";
|
|
103
|
+
SparqlOperator["IS_NUMERIC"] = "isnumeric";
|
|
104
|
+
SparqlOperator["STR"] = "str";
|
|
105
|
+
SparqlOperator["LANG"] = "lang";
|
|
106
|
+
SparqlOperator["DATATYPE"] = "datatype";
|
|
107
|
+
SparqlOperator["IRI"] = "iri";
|
|
108
|
+
SparqlOperator["URI"] = "uri";
|
|
109
|
+
SparqlOperator["BNODE"] = "bnode";
|
|
110
|
+
SparqlOperator["STRDT"] = "strdt";
|
|
111
|
+
SparqlOperator["STRLANG"] = "strlang";
|
|
112
|
+
SparqlOperator["UUID"] = "uuid";
|
|
113
|
+
SparqlOperator["STRUUID"] = "struuid";
|
|
114
|
+
// Functions on strings
|
|
115
|
+
// https://www.w3.org/TR/sparql11-query/#func-strings
|
|
116
|
+
SparqlOperator["STRLEN"] = "strlen";
|
|
117
|
+
SparqlOperator["SUBSTR"] = "substr";
|
|
118
|
+
SparqlOperator["UCASE"] = "ucase";
|
|
119
|
+
SparqlOperator["LCASE"] = "lcase";
|
|
120
|
+
SparqlOperator["STRSTARTS"] = "strstarts";
|
|
121
|
+
SparqlOperator["STRENDS"] = "strends";
|
|
122
|
+
SparqlOperator["CONTAINS"] = "contains";
|
|
123
|
+
SparqlOperator["STRBEFORE"] = "strbefore";
|
|
124
|
+
SparqlOperator["STRAFTER"] = "strafter";
|
|
125
|
+
SparqlOperator["ENCODE_FOR_URI"] = "encode_for_uri";
|
|
126
|
+
SparqlOperator["CONCAT"] = "concat";
|
|
127
|
+
SparqlOperator["LANG_MATCHES"] = "langmatches";
|
|
128
|
+
SparqlOperator["REGEX"] = "regex";
|
|
129
|
+
SparqlOperator["REPLACE"] = "replace";
|
|
130
|
+
// Functions on numerics
|
|
131
|
+
// https://www.w3.org/TR/sparql11-query/#func-numerics
|
|
132
|
+
SparqlOperator["ABS"] = "abs";
|
|
133
|
+
SparqlOperator["ROUND"] = "round";
|
|
134
|
+
SparqlOperator["CEIL"] = "ceil";
|
|
135
|
+
SparqlOperator["FLOOR"] = "floor";
|
|
136
|
+
SparqlOperator["RAND"] = "rand";
|
|
137
|
+
// Functions on Dates and Times
|
|
138
|
+
// https://www.w3.org/TR/sparql11-query/#func-date-time
|
|
139
|
+
SparqlOperator["NOW"] = "now";
|
|
140
|
+
SparqlOperator["YEAR"] = "year";
|
|
141
|
+
SparqlOperator["MONTH"] = "month";
|
|
142
|
+
SparqlOperator["DAY"] = "day";
|
|
143
|
+
SparqlOperator["HOURS"] = "hours";
|
|
144
|
+
SparqlOperator["MINUTES"] = "minutes";
|
|
145
|
+
SparqlOperator["SECONDS"] = "seconds";
|
|
146
|
+
SparqlOperator["TIMEZONE"] = "timezone";
|
|
147
|
+
SparqlOperator["TZ"] = "tz";
|
|
148
|
+
// Hash functions
|
|
149
|
+
// https://www.w3.org/TR/sparql11-query/#func-hash
|
|
150
|
+
SparqlOperator["MD5"] = "md5";
|
|
151
|
+
SparqlOperator["SHA1"] = "sha1";
|
|
152
|
+
SparqlOperator["SHA256"] = "sha256";
|
|
153
|
+
SparqlOperator["SHA384"] = "sha384";
|
|
154
|
+
SparqlOperator["SHA512"] = "sha512";
|
|
155
|
+
// XPath Constructor functions
|
|
156
|
+
// https://www.w3.org/TR/sparql11-query/#FunctionMapping
|
|
157
|
+
// See Named Operators
|
|
158
|
+
// Functions for quoted triples
|
|
159
|
+
// https://w3c.github.io/rdf-star/cg-spec/editors_draft.html#triple-function
|
|
160
|
+
SparqlOperator["TRIPLE"] = "triple";
|
|
161
|
+
SparqlOperator["SUBJECT"] = "subject";
|
|
162
|
+
SparqlOperator["PREDICATE"] = "predicate";
|
|
163
|
+
SparqlOperator["OBJECT"] = "object";
|
|
164
|
+
SparqlOperator["IS_TRIPLE"] = "istriple";
|
|
165
|
+
// Functional Forms
|
|
166
|
+
// https://www.w3.org/TR/sparql11-query/#func-forms
|
|
167
|
+
SparqlOperator["BOUND"] = "bound";
|
|
168
|
+
SparqlOperator["IF"] = "if";
|
|
169
|
+
SparqlOperator["COALESCE"] = "coalesce";
|
|
170
|
+
})(SparqlOperator || (exports.SparqlOperator = SparqlOperator = {}));
|
|
171
|
+
//# sourceMappingURL=Consts.js.map
|