@traqula/rules-sparql-1-2 0.0.23 → 0.0.25
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 +2 -0
- package/dist/cjs/lib/AstFactory.js +75 -94
- package/dist/cjs/lib/AstFactory.js.map +1 -0
- package/dist/cjs/lib/grammar.js +662 -602
- package/dist/cjs/lib/grammar.js.map +1 -0
- package/dist/cjs/lib/index.js +45 -50
- package/dist/cjs/lib/index.js.map +1 -0
- package/dist/cjs/lib/lexer.js +39 -92
- package/dist/cjs/lib/lexer.js.map +1 -0
- package/dist/cjs/lib/parserUtils.js +33 -42
- package/dist/cjs/lib/parserUtils.js.map +1 -0
- package/dist/cjs/lib/sparql12HelperTypes.js +2 -15
- package/dist/cjs/lib/sparql12HelperTypes.js.map +1 -0
- package/dist/cjs/lib/sparql12Types.js +2 -15
- package/dist/cjs/lib/sparql12Types.js.map +1 -0
- package/dist/cjs/lib/validators.js +82 -97
- package/dist/cjs/lib/validators.js.map +1 -0
- package/dist/esm/lib/AstFactory.d.ts +3 -0
- package/dist/esm/lib/AstFactory.js +4 -1
- package/dist/esm/lib/AstFactory.js.map +1 -1
- package/dist/esm/lib/grammar.d.ts +4 -4
- package/dist/esm/lib/grammar.js +12 -6
- package/dist/esm/lib/grammar.js.map +1 -1
- package/dist/esm/lib/lexer.d.ts +1 -1
- package/dist/esm/lib/parserUtils.d.ts +7 -4
- package/dist/esm/lib/parserUtils.js +15 -3
- package/dist/esm/lib/parserUtils.js.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Traqula Rules SPARQL 1.2 package
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@traqula/rules-sparql-1-2)
|
|
4
|
+
|
|
3
5
|
Traqula rules SPARQL 1.2 contains additional rules required for creating a parser for SPARQL 1.2 from the SPARQL 1.1 rules.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
@@ -1,96 +1,77 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
+
/**
|
|
6
|
+
* A factory that helps you create, and check types for AST nodes for SPARQL 1.2
|
|
7
|
+
*/
|
|
8
|
+
class AstFactory extends rules_sparql_1_1_1.AstFactory {
|
|
9
|
+
termTriple(subject, predicate, object, loc) {
|
|
10
|
+
return {
|
|
11
|
+
type: 'term',
|
|
12
|
+
subType: 'triple',
|
|
13
|
+
subject,
|
|
14
|
+
predicate,
|
|
15
|
+
object,
|
|
16
|
+
loc,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
isTermTriple(obj) {
|
|
20
|
+
return this.isOfSubType(obj, 'term', 'triple');
|
|
21
|
+
}
|
|
22
|
+
tripleCollectionReifiedTriple(loc, subject, predicate, object, reifier) {
|
|
23
|
+
return {
|
|
24
|
+
type: 'tripleCollection',
|
|
25
|
+
subType: 'reifiedTriple',
|
|
26
|
+
triples: [this.triple(subject, predicate, object)],
|
|
27
|
+
identifier: reifier ?? this.termBlank(undefined, this.sourceLocation()),
|
|
28
|
+
loc,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
isTripleCollectionReifiedTriple(obj) {
|
|
32
|
+
return this.isOfSubType(obj, 'tripleCollection', 'reifiedTriple');
|
|
33
|
+
}
|
|
34
|
+
tripleCollectionBlankNodeProperties(identifier, triples, loc) {
|
|
35
|
+
return {
|
|
36
|
+
type: 'tripleCollection',
|
|
37
|
+
subType: 'blankNodeProperties',
|
|
38
|
+
triples,
|
|
39
|
+
identifier,
|
|
40
|
+
loc,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Overwritten triple constructor to always contain an empty annotations list
|
|
45
|
+
*/
|
|
46
|
+
triple = (subject, predicate, object, loc) => ({
|
|
47
|
+
type: 'triple',
|
|
48
|
+
subject,
|
|
49
|
+
predicate,
|
|
50
|
+
object,
|
|
51
|
+
annotations: [],
|
|
52
|
+
loc: loc ?? this.sourceLocation(subject, predicate, object),
|
|
53
|
+
});
|
|
54
|
+
annotatedTriple(subject, predicate, object, annotations, loc) {
|
|
55
|
+
return {
|
|
56
|
+
type: 'triple',
|
|
57
|
+
subject,
|
|
58
|
+
predicate,
|
|
59
|
+
object,
|
|
60
|
+
annotations: annotations ?? [],
|
|
61
|
+
loc: loc ?? this.sourceLocation(subject, predicate, object, ...annotations ?? []),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
contextDefinitionVersion(version, loc) {
|
|
65
|
+
return {
|
|
66
|
+
type: 'contextDef',
|
|
67
|
+
subType: 'version',
|
|
68
|
+
version,
|
|
69
|
+
loc,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
isContextDefinitionVersion(obj) {
|
|
73
|
+
return this.isOfSubType(obj, 'contextDef', 'version');
|
|
74
|
+
}
|
|
92
75
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
AstFactory
|
|
96
|
-
});
|
|
76
|
+
exports.AstFactory = AstFactory;
|
|
77
|
+
//# sourceMappingURL=AstFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstFactory.js","sourceRoot":"","sources":["../../../lib/AstFactory.ts"],"names":[],"mappings":";;;AACA,gEAA0E;AAc1E;;GAEG;AACH,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,CAA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AAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,WAAW,IAAI,EAAE,CAAC;SAClF,CAAC;IACJ,CAAC;IAEM,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\n/**\n * A factory that helps you create, and check types for AST nodes for SPARQL 1.2\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.sourceLocation()),\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"]}
|