@traqula/rules-sparql-1-2 0.0.23 → 0.0.24

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.
@@ -1,96 +1,74 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var AstFactory_exports = {};
20
- __export(AstFactory_exports, {
21
- AstFactory: () => AstFactory
22
- });
23
- module.exports = __toCommonJS(AstFactory_exports);
24
- var import_rules_sparql_1_1 = require("@traqula/rules-sparql-1-1");
25
- class AstFactory extends import_rules_sparql_1_1.AstFactory {
26
- termTriple(subject, predicate, object, loc) {
27
- return {
28
- type: "term",
29
- subType: "triple",
30
- subject,
31
- predicate,
32
- object,
33
- loc
34
- };
35
- }
36
- isTermTriple(obj) {
37
- return this.isOfSubType(obj, "term", "triple");
38
- }
39
- tripleCollectionReifiedTriple(loc, subject, predicate, object, reifier) {
40
- return {
41
- type: "tripleCollection",
42
- subType: "reifiedTriple",
43
- triples: [this.triple(subject, predicate, object)],
44
- identifier: reifier ?? this.termBlank(void 0, this.sourceLocationNoMaterialize()),
45
- loc
46
- };
47
- }
48
- isTripleCollectionReifiedTriple(obj) {
49
- return this.isOfSubType(obj, "tripleCollection", "reifiedTriple");
50
- }
51
- tripleCollectionBlankNodeProperties(identifier, triples, loc) {
52
- return {
53
- type: "tripleCollection",
54
- subType: "blankNodeProperties",
55
- triples,
56
- identifier,
57
- loc
58
- };
59
- }
60
- /**
61
- * Overwritten triple constructor to always contain an empty annotations list
62
- */
63
- triple = (subject, predicate, object, loc) => ({
64
- type: "triple",
65
- subject,
66
- predicate,
67
- object,
68
- annotations: [],
69
- loc: loc ?? this.sourceLocation(subject, predicate, object)
70
- });
71
- annotatedTriple(subject, predicate, object, annotations, loc) {
72
- return {
73
- type: "triple",
74
- subject,
75
- predicate,
76
- object,
77
- annotations: annotations ?? [],
78
- loc: loc ?? this.sourceLocation(subject, predicate, object, ...annotations ?? [])
79
- };
80
- }
81
- contextDefinitionVersion(version, loc) {
82
- return {
83
- type: "contextDef",
84
- subType: "version",
85
- version,
86
- loc
87
- };
88
- }
89
- isContextDefinitionVersion(obj) {
90
- return this.isOfSubType(obj, "contextDef", "version");
91
- }
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AstFactory = void 0;
4
+ const rules_sparql_1_1_1 = require("@traqula/rules-sparql-1-1");
5
+ class AstFactory extends rules_sparql_1_1_1.AstFactory {
6
+ termTriple(subject, predicate, object, loc) {
7
+ return {
8
+ type: 'term',
9
+ subType: 'triple',
10
+ subject,
11
+ predicate,
12
+ object,
13
+ loc,
14
+ };
15
+ }
16
+ isTermTriple(obj) {
17
+ return this.isOfSubType(obj, 'term', 'triple');
18
+ }
19
+ tripleCollectionReifiedTriple(loc, subject, predicate, object, reifier) {
20
+ return {
21
+ type: 'tripleCollection',
22
+ subType: 'reifiedTriple',
23
+ triples: [this.triple(subject, predicate, object)],
24
+ identifier: reifier ?? this.termBlank(undefined, this.sourceLocationNoMaterialize()),
25
+ loc,
26
+ };
27
+ }
28
+ isTripleCollectionReifiedTriple(obj) {
29
+ return this.isOfSubType(obj, 'tripleCollection', 'reifiedTriple');
30
+ }
31
+ tripleCollectionBlankNodeProperties(identifier, triples, loc) {
32
+ return {
33
+ type: 'tripleCollection',
34
+ subType: 'blankNodeProperties',
35
+ triples,
36
+ identifier,
37
+ loc,
38
+ };
39
+ }
40
+ /**
41
+ * Overwritten triple constructor to always contain an empty annotations list
42
+ */
43
+ triple = (subject, predicate, object, loc) => ({
44
+ type: 'triple',
45
+ subject,
46
+ predicate,
47
+ object,
48
+ annotations: [],
49
+ loc: loc ?? this.sourceLocation(subject, predicate, object),
50
+ });
51
+ annotatedTriple(subject, predicate, object, annotations, loc) {
52
+ return {
53
+ type: 'triple',
54
+ subject,
55
+ predicate,
56
+ object,
57
+ annotations: annotations ?? [],
58
+ loc: loc ?? this.sourceLocation(subject, predicate, object, ...annotations ?? []),
59
+ };
60
+ }
61
+ contextDefinitionVersion(version, loc) {
62
+ return {
63
+ type: 'contextDef',
64
+ subType: 'version',
65
+ version,
66
+ loc,
67
+ };
68
+ }
69
+ isContextDefinitionVersion(obj) {
70
+ return this.isOfSubType(obj, 'contextDef', 'version');
71
+ }
92
72
  }
93
- // Annotate the CommonJS export names for ESM import in node:
94
- 0 && (module.exports = {
95
- AstFactory
96
- });
73
+ exports.AstFactory = AstFactory;
74
+ //# sourceMappingURL=AstFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AstFactory.js","sourceRoot":"","sources":["../../../lib/AstFactory.ts"],"names":[],"mappings":";;;AACA,gEAA0E;AAc1E,MAAa,UAAW,SAAQ,6BAAe;IACtC,UAAU,CACf,OAA8B,EAC9B,SAAkC,EAClC,MAA4B,EAC5B,GAAmB;QAEnB,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,QAAQ;YACjB,OAAO;YACP,SAAS;YACT,MAAM;YACN,GAAG;SACJ,CAAC;IACJ,CAAC;IAEM,YAAY,CAAC,GAAW;QAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACjD,CAAC;IAEM,6BAA6B,CAClC,GAAmB,EACnB,OAAiC,EACjC,SAAqC,EACrC,MAA+B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EM,wBAAwB,CAAC,OAAe,EAAE,GAAmB;QAClE,OAAO;YACL,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,SAAS;YAClB,OAAO;YACP,GAAG;SACJ,CAAC;IACJ,CAAC;IAEM,0BAA0B,CAAC,GAAW;QAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;CACF;AAjGD,gCAiGC","sourcesContent":["import type { SourceLocation, SubTyped } from '@traqula/core';\nimport { AstFactory as Sparql11Factory } from '@traqula/rules-sparql-1-1';\nimport type * as T11 from '@traqula/rules-sparql-1-1';\nimport type {\n Annotation,\n ContextDefinitionVersion,\n TermBlank,\n TermIri,\n TermTriple,\n TermVariable,\n TripleCollectionBlankNodeProperties,\n TripleCollectionReifiedTriple,\n TripleNesting,\n} from './sparql12Types.js';\n\nexport class AstFactory extends Sparql11Factory {\n public termTriple(\n subject: TermTriple['subject'],\n predicate: TermTriple['predicate'],\n object: TermTriple['object'],\n loc: SourceLocation,\n ): TermTriple {\n return {\n type: 'term',\n subType: 'triple',\n subject,\n predicate,\n object,\n loc,\n };\n }\n\n public isTermTriple(obj: object): obj is SubTyped<'term', 'triple'> {\n return this.isOfSubType(obj, 'term', 'triple');\n }\n\n public tripleCollectionReifiedTriple(\n loc: SourceLocation,\n subject: TripleNesting['subject'],\n predicate: TripleNesting['predicate'],\n object: TripleNesting['object'],\n reifier?: TripleCollectionReifiedTriple['identifier'],\n ): TripleCollectionReifiedTriple {\n return {\n type: 'tripleCollection',\n subType: 'reifiedTriple',\n triples: [ this.triple(<T11.TripleNesting['subject']>subject, predicate, <T11.TripleNesting['object']>object) ],\n identifier: reifier ?? this.termBlank(undefined, this.sourceLocationNoMaterialize()),\n loc,\n };\n }\n\n public isTripleCollectionReifiedTriple(obj: object): obj is SubTyped<'tripleCollection', 'reifiedTriple'> {\n return this.isOfSubType(obj, 'tripleCollection', 'reifiedTriple');\n }\n\n public override tripleCollectionBlankNodeProperties(\n identifier: TermBlank | TermVariable | TermIri,\n triples: TripleNesting[],\n loc: SourceLocation,\n ): T11.TripleCollectionBlankNodeProperties {\n return <T11.TripleCollectionBlankNodeProperties> {\n type: 'tripleCollection',\n subType: 'blankNodeProperties',\n triples,\n identifier,\n loc,\n } satisfies TripleCollectionBlankNodeProperties;\n }\n\n /**\n * Overwritten triple constructor to always contain an empty annotations list\n */\n public override triple: Sparql11Factory['triple'] =\n (subject, predicate, object, loc) => <T11.TripleNesting> {\n type: 'triple',\n subject,\n predicate,\n object,\n annotations: [],\n loc: loc ?? this.sourceLocation(subject, predicate, object),\n } satisfies TripleNesting;\n\n public annotatedTriple(\n subject: TripleNesting['subject'],\n predicate: TripleNesting['predicate'],\n object: TripleNesting['object'],\n annotations?: Annotation[],\n loc?: SourceLocation,\n ): TripleNesting {\n return {\n type: 'triple',\n subject,\n predicate,\n object,\n annotations: annotations ?? [],\n loc: loc ?? this.sourceLocation(subject, predicate, object, ...annotations ?? []),\n };\n }\n\n public contextDefinitionVersion(version: string, loc: SourceLocation): ContextDefinitionVersion {\n return {\n type: 'contextDef',\n subType: 'version',\n version,\n loc,\n };\n }\n\n public isContextDefinitionVersion(obj: object): obj is SubTyped<'contextDef', 'version'> {\n return this.isOfSubType(obj, 'contextDef', 'version');\n }\n}\n"]}