@traqula/rules-sparql-1-2 0.0.1-alpha.148 → 0.0.1-alpha.9

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/lib/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  export * as gram from './grammar';
2
2
  export * as lex from './lexer';
3
3
  export * from './sparql12Types';
4
+ export * from './sparql12HelperTypes';
5
+ export * from './parserUtils';
6
+ export * from './Factory';
package/lib/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  export * as gram from './grammar';
2
2
  export * as lex from './lexer';
3
3
  export * from './sparql12Types';
4
+ export * from './sparql12HelperTypes';
5
+ export * from './parserUtils';
6
+ export * from './Factory';
4
7
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,cAAc,iBAAiB,CAAC","sourcesContent":["export * as gram from './grammar';\nexport * as lex from './lexer';\nexport * from './sparql12Types';"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC","sourcesContent":["export * as gram from './grammar';\nexport * as lex from './lexer';\nexport * from './sparql12Types';\nexport * from './sparql12HelperTypes';\nexport * from './parserUtils';\nexport * from './Factory';\n"]}
package/lib/lexer.d.ts CHANGED
@@ -1,53 +1,20 @@
1
1
  import { LexerBuilder } from '@traqula/core';
2
- export declare const tilde: import("chevrotain").TokenType & {
3
- name: "Tilde";
4
- };
5
- export declare const annotationOpen: import("chevrotain").TokenType & {
6
- name: "AnnotationOpen";
7
- };
8
- export declare const annotationClose: import("chevrotain").TokenType & {
9
- name: "AnnotationClose";
10
- };
11
- export declare const reificationOpen: import("chevrotain").TokenType & {
12
- name: "ReificationOpen";
13
- };
14
- export declare const reificationClose: import("chevrotain").TokenType & {
15
- name: "ReificationClose";
16
- };
17
- export declare const tripleTermOpen: import("chevrotain").TokenType & {
18
- name: "TripleTermOpen";
19
- };
20
- export declare const tripleTermClose: import("chevrotain").TokenType & {
21
- name: "TripleTermClose";
22
- };
23
- export declare const builtinLangDir: import("chevrotain").TokenType & {
24
- name: "BuiltInLangdir";
25
- };
26
- export declare const builtinStrLangDir: import("chevrotain").TokenType & {
27
- name: "BuiltInStrLangdir";
28
- };
29
- export declare const builtinHasLang: import("chevrotain").TokenType & {
30
- name: "BuiltInHasLang";
31
- };
32
- export declare const builtinHasLangDir: import("chevrotain").TokenType & {
33
- name: "BuiltInHasLangdir";
34
- };
35
- export declare const builtinIsTRIPLE: import("chevrotain").TokenType & {
36
- name: "BuiltInIsTriple";
37
- };
38
- export declare const builtinTRIPLE: import("chevrotain").TokenType & {
39
- name: "BuiltInTriple";
40
- };
41
- export declare const builtinSUBJECT: import("chevrotain").TokenType & {
42
- name: "BuiltInSubject";
43
- };
44
- export declare const builtinPREDICATE: import("chevrotain").TokenType & {
45
- name: "BuiltInPredicate";
46
- };
47
- export declare const builtinOBJECT: import("chevrotain").TokenType & {
48
- name: "BuiltInObject";
49
- };
50
- export declare const LANG_DIR: import("chevrotain").TokenType & {
51
- name: "LANG_DIR";
52
- };
53
- export declare const sparql12Tokens: LexerBuilder<"" | "a" | "BuiltInStr" | "BuiltInLang" | "BuiltInLangmatches" | "BuiltInDatatype" | "BuiltInBound" | "BuiltInIri" | "BuiltInUri" | "BuiltInBnode" | "BuiltInRand" | "BuiltInAbs" | "BuiltInCeil" | "BuiltInFloor" | "BuiltInRound" | "BuiltInConcat" | "BuiltInStrlen" | "BuiltInUcase" | "BuiltInLcase" | "BuiltInEncode_for_uri" | "BuiltInContains" | "BuiltInStrstarts" | "BuiltInStrends" | "BuiltInStrbefore" | "BuiltInStrafter" | "BuiltInYear" | "BuiltInMonth" | "BuiltInDay" | "BuiltInHours" | "BuiltInMinutes" | "BuiltInSeconds" | "BuiltInTimezone" | "BuiltInTz" | "BuiltInNow" | "BuiltInUuid" | "BuiltInStruuid" | "BuiltInMd5" | "BuiltInSha1" | "BuiltInSha256" | "BuiltInSha384" | "BuiltInSha512" | "BuiltInCoalesce" | "BuiltInIf" | "BuiltInStrlang" | "BuiltInStrdt" | "BuiltInSameterm" | "BuiltInIsiri" | "BuiltInIsuri" | "BuiltInIsblank" | "BuiltInIsliteral" | "BuiltInIsnumeric" | "BuiltInRegex" | "BuiltInSubstr" | "BuiltInReplace" | "BuiltInExists" | "BuiltInNotexists" | "BuiltInCount" | "BuiltInSum" | "BuiltInMin" | "BuiltInMax" | "BuiltInAvg" | "BuiltInSample" | "BuiltInGroup_concat" | "NamedGraph" | "DefaultGraph" | "Graph" | "GraphAll" | "LCurly" | "RCurly" | "Dot" | "Comma" | "Semi" | "LParen" | "RParen" | "LSquare" | "RSquare" | "Pipe" | "Slash" | "Hat" | "Question" | "Star" | "OpPlus" | "OpMinus" | "Exclamation" | "LogicAnd" | "LogicOr" | "Equal" | "NotEqual" | "LessThan" | "GreaterThan" | "LessThanEqual" | "GreaterThanEqual" | "Hathat" | "IriRef" | "PNameLn" | "PNameNs" | "BlankNodeLabel" | "Var1" | "Var2" | "Integer" | "Decimal" | "Double" | "InterferePositive" | "DecimalPositive" | "DoublePositive" | "IntegerNegative" | "DecimalNegative" | "DoubleNegative" | "StringLiteral1" | "StringLiteral2" | "StringLiteralLong1" | "StringLiteralLong2" | "Ws" | "Comment" | "Nil" | "Anon" | "BaseDecl" | "PrefixDecl" | "Select" | "Distinct" | "Reduced" | "As" | "Construct" | "Describe" | "Ask" | "From" | "Where" | "GroupBy" | "Having" | "Order" | "OrderAsc" | "OrderDesc" | "Limit" | "Offset" | "Values" | "Load" | "Silent" | "LoadInto" | "Clear" | "Drop" | "Create" | "Add" | "To" | "Move" | "Copy" | "ModifyWith" | "DeleteClause" | "InsertClause" | "DataClause" | "UsingClause" | "Optional" | "Service" | "Bind" | "Undef" | "Minus" | "Union" | "Filter" | "True" | "False" | "In" | "NotIn" | "Separator" | "Tilde" | "AnnotationOpen" | "AnnotationClose" | "ReificationOpen" | "ReificationClose" | "TripleTermOpen" | "TripleTermClose" | "BuiltInLangdir" | "BuiltInStrLangdir" | "BuiltInHasLang" | "BuiltInHasLangdir" | "BuiltInIsTriple" | "BuiltInTriple" | "BuiltInSubject" | "BuiltInPredicate" | "BuiltInObject" | "LANG_DIR">;
2
+ export declare const version: import("@traqula/core").NamedToken<"Version">;
3
+ export declare const tilde: import("@traqula/core").NamedToken<"Tilde">;
4
+ export declare const annotationOpen: import("@traqula/core").NamedToken<"AnnotationOpen">;
5
+ export declare const annotationClose: import("@traqula/core").NamedToken<"AnnotationClose">;
6
+ export declare const reificationOpen: import("@traqula/core").NamedToken<"ReificationOpen">;
7
+ export declare const reificationClose: import("@traqula/core").NamedToken<"ReificationClose">;
8
+ export declare const tripleTermOpen: import("@traqula/core").NamedToken<"TripleTermOpen">;
9
+ export declare const tripleTermClose: import("@traqula/core").NamedToken<"TripleTermClose">;
10
+ export declare const builtinLangDir: import("@traqula/core").NamedToken<"BuiltInLangdir">;
11
+ export declare const builtinStrLangDir: import("@traqula/core").NamedToken<"BuiltInStrLangdir">;
12
+ export declare const builtinHasLang: import("@traqula/core").NamedToken<"BuiltInHasLang">;
13
+ export declare const builtinHasLangDir: import("@traqula/core").NamedToken<"BuiltInHasLangdir">;
14
+ export declare const builtinIsTRIPLE: import("@traqula/core").NamedToken<"BuiltInIsTriple">;
15
+ export declare const builtinTRIPLE: import("@traqula/core").NamedToken<"BuiltInTriple">;
16
+ export declare const builtinSUBJECT: import("@traqula/core").NamedToken<"BuiltInSubject">;
17
+ export declare const builtinPREDICATE: import("@traqula/core").NamedToken<"BuiltInPredicate">;
18
+ export declare const builtinOBJECT: import("@traqula/core").NamedToken<"BuiltInObject">;
19
+ export declare const LANG_DIR: import("@traqula/core").NamedToken<"LANG_DIR">;
20
+ export declare const sparql12Tokens: LexerBuilder<"a" | "BuiltInStr" | "BuiltInLang" | "BuiltInLangmatches" | "BuiltInDatatype" | "BuiltInBound" | "BuiltInIri" | "BuiltInUri" | "BuiltInBnode" | "BuiltInRand" | "BuiltInAbs" | "BuiltInCeil" | "BuiltInFloor" | "BuiltInRound" | "BuiltInConcat" | "BuiltInStrlen" | "BuiltInUcase" | "BuiltInLcase" | "BuiltInEncode_for_uri" | "BuiltInContains" | "BuiltInStrstarts" | "BuiltInStrends" | "BuiltInStrbefore" | "BuiltInStrafter" | "BuiltInYear" | "BuiltInMonth" | "BuiltInDay" | "BuiltInHours" | "BuiltInMinutes" | "BuiltInSeconds" | "BuiltInTimezone" | "BuiltInTz" | "BuiltInNow" | "BuiltInUuid" | "BuiltInStruuid" | "BuiltInMd5" | "BuiltInSha1" | "BuiltInSha256" | "BuiltInSha384" | "BuiltInSha512" | "BuiltInCoalesce" | "BuiltInIf" | "BuiltInStrlang" | "BuiltInStrdt" | "BuiltInSameterm" | "BuiltInIsiri" | "BuiltInIsuri" | "BuiltInIsblank" | "BuiltInIsliteral" | "BuiltInIsnumeric" | "BuiltInRegex" | "BuiltInSubstr" | "BuiltInReplace" | "BuiltInExists" | "BuiltInNotexists" | "BuiltInCount" | "BuiltInSum" | "BuiltInMin" | "BuiltInMax" | "BuiltInAvg" | "BuiltInSample" | "BuiltInGroup_concat" | "NamedGraph" | "DefaultGraph" | "Graph" | "GraphAll" | "LCurly" | "RCurly" | "Dot" | "Comma" | "Semi" | "LParen" | "RParen" | "LSquare" | "RSquare" | "Pipe" | "Slash" | "Hat" | "Question" | "Star" | "OpPlus" | "OpMinus" | "Exclamation" | "LogicAnd" | "LogicOr" | "Equal" | "NotEqual" | "LessThan" | "GreaterThan" | "LessThanEqual" | "GreaterThanEqual" | "Hathat" | "IriRef" | "PNameLn" | "PNameNs" | "BlankNodeLabel" | "Var1" | "Var2" | "Integer" | "Decimal" | "Double" | "InterferePositive" | "DecimalPositive" | "DoublePositive" | "IntegerNegative" | "DecimalNegative" | "DoubleNegative" | "StringLiteral1" | "StringLiteral2" | "StringLiteralLong1" | "StringLiteralLong2" | "Ws" | "Comment" | "Nil" | "Anon" | "BaseDecl" | "PrefixDecl" | "Select" | "Distinct" | "Reduced" | "As" | "Construct" | "Describe" | "Ask" | "From" | "Where" | "GroupByGroup" | "By" | "Having" | "Order" | "OrderAsc" | "OrderDesc" | "Limit" | "Offset" | "Values" | "Load" | "Silent" | "LoadInto" | "Clear" | "Drop" | "Create" | "Add" | "To" | "Move" | "Copy" | "ModifyWith" | "DeleteClause" | "InsertClause" | "DataClause" | "UsingClause" | "Optional" | "Service" | "Bind" | "Undef" | "Minus" | "Union" | "Filter" | "True" | "False" | "In" | "NotIn" | "Separator" | "Version" | "Tilde" | "AnnotationOpen" | "AnnotationClose" | "ReificationOpen" | "ReificationClose" | "TripleTermOpen" | "TripleTermClose" | "BuiltInLangdir" | "BuiltInStrLangdir" | "BuiltInHasLang" | "BuiltInHasLangdir" | "BuiltInIsTriple" | "BuiltInTriple" | "BuiltInSubject" | "BuiltInPredicate" | "BuiltInObject" | "LANG_DIR">;
package/lib/lexer.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable require-unicode-regexp */
2
- import { LexerBuilder } from '@traqula/core';
2
+ import { LexerBuilder, createToken } from '@traqula/core';
3
3
  import { lex as l11 } from '@traqula/rules-sparql-1-1';
4
- import { createToken } from '@traqula/core';
4
+ export const version = createToken({ name: 'Version', pattern: /version/i, label: 'version identifier' });
5
5
  export const tilde = createToken({ name: 'Tilde', pattern: '~', label: '~' });
6
6
  export const annotationOpen = createToken({ name: 'AnnotationOpen', pattern: '{|', label: `Annotation Open: {|` });
7
7
  export const annotationClose = createToken({ name: 'AnnotationClose', pattern: '|}', label: 'Annotation Close |}' });
@@ -28,12 +28,12 @@ export const builtinPREDICATE = createToken({ name: 'BuiltInPredicate', pattern:
28
28
  export const builtinOBJECT = createToken({ name: 'BuiltInObject', pattern: /object/i, label: 'OBJECT' });
29
29
  export const LANG_DIR = createToken({
30
30
  name: 'LANG_DIR',
31
- pattern: /@[A-Za-z]+(?:-[\dA-Za-z]+)*(?:--[A-Za-z]+)?/,
31
+ pattern: /@[a-z]+(?:-[\da-z]+)*(?:--[a-z]+)?/i,
32
32
  label: 'LANG_DIR',
33
33
  });
34
34
  export const sparql12Tokens = LexerBuilder
35
35
  .create(l11.sparql11Tokens)
36
- .addBefore(l11.symbols.logicAnd, tilde, annotationOpen, annotationClose, tripleTermOpen, tripleTermClose, reificationOpen, reificationClose)
36
+ .addBefore(l11.symbols.logicAnd, tilde, annotationOpen, annotationClose, tripleTermOpen, tripleTermClose, reificationOpen, reificationClose, version)
37
37
  .addBefore(l11.builtIn.langmatches, builtinLangDir, builtinStrLangDir, builtinHasLangDir, builtinHasLang, builtinIsTRIPLE, builtinTRIPLE, builtinSUBJECT, builtinPREDICATE, builtinOBJECT)
38
38
  .addBefore(l11.terminals.langTag, LANG_DIR)
39
39
  .delete(l11.terminals.langTag);
package/lib/lexer.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"lexer.js","sourceRoot":"","sources":["lexer.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,GAAG,IAAI,GAAG,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,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AS,CACR,GAAG,CAAC,OAAO,CAAC,WAAW,EACvB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,aAAa,CACd;KACA,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC1C,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC","sourcesContent":["/* eslint-disable require-unicode-regexp */\nimport { LexerBuilder } from '@traqula/core';\nimport { lex as l11 } from '@traqula/rules-sparql-1-1';\nimport { createToken } from '@traqula/core';\n\nexport const tilde = createToken({ name: 'Tilde', pattern: '~', label: '~' });\nexport const annotationOpen = createToken({ name: 'AnnotationOpen', pattern: '{|', label: `Annotation Open: {|` });\nexport const annotationClose = createToken({ name: 'AnnotationClose', pattern: '|}', label: 'Annotation Close |}' });\nexport const reificationOpen = createToken({ name: 'ReificationOpen', pattern: '<<', label: 'Reification open <<' });\nexport const reificationClose = createToken({ name: 'ReificationClose', pattern: '>>', label: 'Reification close >>' });\nexport const tripleTermOpen = createToken({ name: 'TripleTermOpen', pattern: '<<(', label: 'Triple Term Open <<(' });\nexport const tripleTermClose = createToken({ name: 'TripleTermClose', pattern: ')>>', label: 'Triple Term Close )>>' });\n\nexport const builtinLangDir = createToken({ name: 'BuiltInLangdir', pattern: /langdir/i, label: 'LANGDIR' });\nexport const builtinStrLangDir = createToken({\n name: 'BuiltInStrLangdir',\n pattern: /strlangdir/i,\n label: 'STRLANGDIR',\n});\nexport const builtinHasLang = createToken({ name: 'BuiltInHasLang', pattern: /haslang/i, label: 'hasLANG' });\nexport const builtinHasLangDir = createToken({\n name: 'BuiltInHasLangdir',\n pattern: /haslangdir/i,\n label: 'hasLANGDIR',\n});\nexport const builtinIsTRIPLE = createToken({ name: 'BuiltInIsTriple', pattern: /istriple/i, label: 'isTRIPLE' });\nexport const builtinTRIPLE = createToken({ name: 'BuiltInTriple', pattern: /triple/i, label: 'TRIPLE' });\nexport const builtinSUBJECT = createToken({ name: 'BuiltInSubject', pattern: /subject/i, label: 'SUBJECT' });\nexport const builtinPREDICATE = createToken({ name: 'BuiltInPredicate', pattern: /predicate/i, label: 'PREDICATE' });\nexport const builtinOBJECT = createToken({ name: 'BuiltInObject', pattern: /object/i, label: 'OBJECT' });\n\nexport const LANG_DIR = createToken({\n name: 'LANG_DIR',\n pattern: /@[A-Za-z]+(?:-[\\dA-Za-z]+)*(?:--[A-Za-z]+)?/,\n label: 'LANG_DIR',\n});\n\nexport const sparql12Tokens = LexerBuilder\n .create(l11.sparql11Tokens)\n .addBefore(\n l11.symbols.logicAnd,\n tilde,\n annotationOpen,\n annotationClose,\n tripleTermOpen,\n tripleTermClose,\n reificationOpen,\n reificationClose,\n )\n .addBefore(\n l11.builtIn.langmatches,\n builtinLangDir,\n builtinStrLangDir,\n builtinHasLangDir,\n builtinHasLang,\n builtinIsTRIPLE,\n builtinTRIPLE,\n builtinSUBJECT,\n builtinPREDICATE,\n builtinOBJECT,\n )\n .addBefore(l11.terminals.langTag, LANG_DIR)\n .delete(l11.terminals.langTag);\n"]}
1
+ {"version":3,"file":"lexer.js","sourceRoot":"","sources":["lexer.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,GAAG,IAAI,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEvD,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,cAAc,GAA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B,OAAO,CACR;KACA,SAAS,CACR,GAAG,CAAC,OAAO,CAAC,WAAW,EACvB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,aAAa,CACd;KACA,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC1C,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC","sourcesContent":["/* eslint-disable require-unicode-regexp */\nimport { LexerBuilder, createToken } from '@traqula/core';\nimport { lex as l11 } from '@traqula/rules-sparql-1-1';\n\nexport const version = createToken({ name: 'Version', pattern: /version/i, label: 'version identifier' });\nexport const tilde = createToken({ name: 'Tilde', pattern: '~', label: '~' });\nexport const annotationOpen = createToken({ name: 'AnnotationOpen', pattern: '{|', label: `Annotation Open: {|` });\nexport const annotationClose = createToken({ name: 'AnnotationClose', pattern: '|}', label: 'Annotation Close |}' });\nexport const reificationOpen = createToken({ name: 'ReificationOpen', pattern: '<<', label: 'Reification open <<' });\nexport const reificationClose = createToken({ name: 'ReificationClose', pattern: '>>', label: 'Reification close >>' });\nexport const tripleTermOpen = createToken({ name: 'TripleTermOpen', pattern: '<<(', label: 'Triple Term Open <<(' });\nexport const tripleTermClose = createToken({ name: 'TripleTermClose', pattern: ')>>', label: 'Triple Term Close )>>' });\n\nexport const builtinLangDir = createToken({ name: 'BuiltInLangdir', pattern: /langdir/i, label: 'LANGDIR' });\nexport const builtinStrLangDir = createToken({\n name: 'BuiltInStrLangdir',\n pattern: /strlangdir/i,\n label: 'STRLANGDIR',\n});\nexport const builtinHasLang = createToken({ name: 'BuiltInHasLang', pattern: /haslang/i, label: 'hasLANG' });\nexport const builtinHasLangDir = createToken({\n name: 'BuiltInHasLangdir',\n pattern: /haslangdir/i,\n label: 'hasLANGDIR',\n});\nexport const builtinIsTRIPLE = createToken({ name: 'BuiltInIsTriple', pattern: /istriple/i, label: 'isTRIPLE' });\nexport const builtinTRIPLE = createToken({ name: 'BuiltInTriple', pattern: /triple/i, label: 'TRIPLE' });\nexport const builtinSUBJECT = createToken({ name: 'BuiltInSubject', pattern: /subject/i, label: 'SUBJECT' });\nexport const builtinPREDICATE = createToken({ name: 'BuiltInPredicate', pattern: /predicate/i, label: 'PREDICATE' });\nexport const builtinOBJECT = createToken({ name: 'BuiltInObject', pattern: /object/i, label: 'OBJECT' });\n\nexport const LANG_DIR = createToken({\n name: 'LANG_DIR',\n pattern: /@[a-z]+(?:-[\\da-z]+)*(?:--[a-z]+)?/i,\n label: 'LANG_DIR',\n});\n\nexport const sparql12Tokens = LexerBuilder\n .create(l11.sparql11Tokens)\n .addBefore(\n l11.symbols.logicAnd,\n tilde,\n annotationOpen,\n annotationClose,\n tripleTermOpen,\n tripleTermClose,\n reificationOpen,\n reificationClose,\n version,\n )\n .addBefore(\n l11.builtIn.langmatches,\n builtinLangDir,\n builtinStrLangDir,\n builtinHasLangDir,\n builtinHasLang,\n builtinIsTRIPLE,\n builtinTRIPLE,\n builtinSUBJECT,\n builtinPREDICATE,\n builtinOBJECT,\n )\n .addBefore(l11.terminals.langTag, LANG_DIR)\n .delete(l11.terminals.langTag);\n"]}
@@ -0,0 +1,8 @@
1
+ import type { SparqlContext } from './sparql12HelperTypes';
2
+ export declare function completeParseContext(context: Partial<SparqlContext & {
3
+ origSource: string;
4
+ offset?: number;
5
+ }>): SparqlContext & {
6
+ origSource: string;
7
+ offset?: number;
8
+ };
@@ -0,0 +1,13 @@
1
+ import { Factory } from './Factory';
2
+ export function completeParseContext(context) {
3
+ return {
4
+ factory: context.factory ?? new Factory(),
5
+ baseIRI: context.baseIRI,
6
+ prefixes: { ...context.prefixes },
7
+ origSource: context.origSource ?? '',
8
+ offset: context.offset,
9
+ parseMode: context.parseMode ? new Set(context.parseMode) : new Set(['canParseVars', 'canCreateBlankNodes']),
10
+ skipValidation: context.skipValidation ?? false,
11
+ };
12
+ }
13
+ //# sourceMappingURL=parserUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parserUtils.js","sourceRoot":"","sources":["parserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,UAAU,oBAAoB,CAClC,OAAyE;IAEzE,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI,OAAO,EAAE;QACzC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE;QACjC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAE,cAAc,EAAE,qBAAqB,CAAE,CAAC;QAC9G,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,KAAK;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import { Factory } from './Factory';\nimport type { SparqlContext } from './sparql12HelperTypes';\n\nexport function completeParseContext(\n context: Partial<SparqlContext & { origSource: string; offset?: number }>,\n): SparqlContext & { origSource: string; offset?: number } {\n return {\n factory: context.factory ?? new Factory(),\n baseIRI: context.baseIRI,\n prefixes: { ...context.prefixes },\n origSource: context.origSource ?? '',\n offset: context.offset,\n parseMode: context.parseMode ? new Set(context.parseMode) : new Set([ 'canParseVars', 'canCreateBlankNodes' ]),\n skipValidation: context.skipValidation ?? false,\n };\n}\n"]}
@@ -0,0 +1,50 @@
1
+ import type { GeneratorRule, ParserRule } from '@traqula/core';
2
+ import type * as T11 from '@traqula/rules-sparql-1-1';
3
+ import type { Factory } from './Factory';
4
+ export type SparqlRule<
5
+ /**
6
+ * Name of grammar rule, should be a strict subtype of string like 'myGrammarRule'.
7
+ */
8
+ NameType extends string = string,
9
+ /**
10
+ * Type that will be returned after a correct parse of this rule.
11
+ * This type will be the return type of calling SUBRULE with this grammar rule.
12
+ */
13
+ ReturnType = unknown, GenInputType = ReturnType,
14
+ /**
15
+ * Function arguments that can be given to convey the state of the current parse operation.
16
+ */
17
+ ParamType = undefined> = SparqlGrammarRule<NameType, ReturnType, ParamType> & SparqlGeneratorRule<NameType, GenInputType, ParamType>;
18
+ export type SparqlGeneratorRule<
19
+ /**
20
+ * Name of grammar rule, should be a strict subtype of string like 'myGrammarRule'.
21
+ */
22
+ NameType extends string = string,
23
+ /**
24
+ * Type that will be returned after a correct parse of this rule.
25
+ * This type will be the return type of calling SUBRULE with this grammar rule.
26
+ */
27
+ ReturnType = unknown,
28
+ /**
29
+ * Function arguments that can be given to convey the state of the current parse operation.
30
+ */
31
+ ParamType = undefined> = GeneratorRule<{
32
+ factory: Factory;
33
+ }, NameType, ReturnType, ParamType>;
34
+ export type SparqlGrammarRule<
35
+ /**
36
+ * Name of grammar rule, should be a strict subtype of string like 'myGrammarRule'.
37
+ */
38
+ NameType extends string = string,
39
+ /**
40
+ * Type that will be returned after a correct parse of this rule.
41
+ * This type will be the return type of calling SUBRULE with this grammar rule.
42
+ */
43
+ ReturnType = unknown,
44
+ /**
45
+ * Function arguments that can be given to convey the state of the current parse operation.
46
+ */
47
+ ParamType = undefined> = ParserRule<SparqlContext, NameType, ReturnType, ParamType>;
48
+ export type SparqlContext = T11.SparqlContext & {
49
+ factory: Factory;
50
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sparql12HelperTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sparql12HelperTypes.js","sourceRoot":"","sources":["sparql12HelperTypes.ts"],"names":[],"mappings":"","sourcesContent":["import type { GeneratorRule, ParserRule } from '@traqula/core';\nimport type * as T11 from '@traqula/rules-sparql-1-1';\nimport type { Factory } from './Factory';\n\nexport type SparqlRule<\n /**\n * Name of grammar rule, should be a strict subtype of string like 'myGrammarRule'.\n */\n NameType extends string = string,\n /**\n * Type that will be returned after a correct parse of this rule.\n * This type will be the return type of calling SUBRULE with this grammar rule.\n */\n ReturnType = unknown,\n GenInputType = ReturnType,\n /**\n * Function arguments that can be given to convey the state of the current parse operation.\n */\n ParamType = undefined,\n> = SparqlGrammarRule<NameType, ReturnType, ParamType>\n & SparqlGeneratorRule<NameType, GenInputType, ParamType>;\n\nexport type SparqlGeneratorRule<\n /**\n * Name of grammar rule, should be a strict subtype of string like 'myGrammarRule'.\n */\n NameType extends string = string,\n /**\n * Type that will be returned after a correct parse of this rule.\n * This type will be the return type of calling SUBRULE with this grammar rule.\n */\n ReturnType = unknown,\n /**\n * Function arguments that can be given to convey the state of the current parse operation.\n */\n ParamType = undefined,\n> = GeneratorRule<{ factory: Factory }, NameType, ReturnType, ParamType>;\n\nexport type SparqlGrammarRule<\n /**\n * Name of grammar rule, should be a strict subtype of string like 'myGrammarRule'.\n */\n NameType extends string = string,\n /**\n * Type that will be returned after a correct parse of this rule.\n * This type will be the return type of calling SUBRULE with this grammar rule.\n */\n ReturnType = unknown,\n /**\n * Function arguments that can be given to convey the state of the current parse operation.\n */\n ParamType = undefined,\n> = ParserRule<SparqlContext, NameType, ReturnType, ParamType>;\n\nexport type SparqlContext = T11.SparqlContext & { factory: Factory };\n"]}
@@ -1,25 +1,317 @@
1
- import type * as RdfJs from '@rdfjs/types';
1
+ import type { Localized, Node, Patch } from '@traqula/core';
2
2
  import type * as T11 from '@traqula/rules-sparql-1-1';
3
- export type BaseQuadTerm = RdfJs.BaseQuad;
4
- export type GraphTerm = T11.GraphTerm | BaseQuadTerm;
5
- export type Term = T11.Term | BaseQuadTerm;
6
- export type Expression = T11.Expression | BaseQuadTerm;
7
- export type Triple = {
8
- subject: Term;
9
- predicate: T11.IriTerm | T11.VariableTerm | T11.PropertyPath;
10
- object: Term;
3
+ export type Sparql12Nodes = GraphRef | UpdateOperation | Update | Query | DatasetClauses | TripleCollection | TripleNesting | Pattern | SolutionModifier | Expression | Path | ContextDefinition | Wildcard | Term;
4
+ export type GraphRefBase = T11.GraphRefBase;
5
+ export type GraphRefDefault = T11.GraphRefDefault;
6
+ export type GraphRefNamed = T11.GraphRefNamed;
7
+ export type GraphRefAll = T11.GraphRefAll;
8
+ export type GraphRefSpecific = T11.GraphRefSpecific;
9
+ export type GraphRef = T11.GraphRef;
10
+ export type Quads = PatternBgp | GraphQuads;
11
+ export type GraphQuads = Node & {
12
+ type: 'graph';
13
+ graph: TermIri | TermVariable;
14
+ triples: PatternBgp;
15
+ };
16
+ export type UpdateOperationBase = Node & {
17
+ type: 'updateOperation';
18
+ subType: string;
19
+ };
20
+ export type UpdateOperationLoad = UpdateOperationBase & {
21
+ subType: 'load';
22
+ silent: boolean;
23
+ source: TermIri;
24
+ destination?: GraphRefSpecific;
25
+ };
26
+ type UpdateOperationClearDropCreateBase = UpdateOperationBase & {
27
+ subType: 'clear' | 'drop' | 'create';
28
+ silent: boolean;
29
+ destination: GraphRef;
30
+ };
31
+ export type UpdateOperationClear = UpdateOperationClearDropCreateBase & {
32
+ subType: 'clear';
33
+ };
34
+ export type UpdateOperationDrop = UpdateOperationClearDropCreateBase & {
35
+ subType: 'drop';
36
+ };
37
+ export type UpdateOperationCreate = UpdateOperationClearDropCreateBase & {
38
+ subType: 'create';
39
+ destination: GraphRefSpecific;
40
+ };
41
+ type UpdateOperationAddMoveCopy = UpdateOperationBase & {
42
+ subType: 'add' | 'move' | 'copy';
43
+ silent: boolean;
44
+ source: GraphRefDefault | GraphRefSpecific;
45
+ destination: GraphRefDefault | GraphRefSpecific;
46
+ };
47
+ export type UpdateOperationAdd = UpdateOperationAddMoveCopy & {
48
+ subType: 'add';
49
+ };
50
+ export type UpdateOperationMove = UpdateOperationAddMoveCopy & {
51
+ subType: 'move';
52
+ };
53
+ export type UpdateOperationCopy = UpdateOperationAddMoveCopy & {
54
+ subType: 'copy';
55
+ };
56
+ type UpdateOperationInsertDeleteDelWhere = UpdateOperationBase & {
57
+ subType: 'insertdata' | 'deletedata' | 'deletewhere';
58
+ data: Quads[];
59
+ };
60
+ export type UpdateOperationInsertData = UpdateOperationInsertDeleteDelWhere & {
61
+ subType: 'insertdata';
62
+ };
63
+ export type UpdateOperationDeleteData = UpdateOperationInsertDeleteDelWhere & {
64
+ subType: 'deletedata';
65
+ };
66
+ export type UpdateOperationDeleteWhere = UpdateOperationInsertDeleteDelWhere & {
67
+ subType: 'deletewhere';
68
+ };
69
+ export type UpdateOperationModify = UpdateOperationBase & {
70
+ subType: 'modify';
71
+ graph: TermIri | undefined;
72
+ insert: Quads[];
73
+ delete: Quads[];
74
+ from: DatasetClauses;
75
+ where: PatternGroup;
76
+ };
77
+ export type UpdateOperation = UpdateOperationLoad | UpdateOperationClear | UpdateOperationDrop | UpdateOperationCreate | UpdateOperationAdd | UpdateOperationMove | UpdateOperationCopy | UpdateOperationInsertData | UpdateOperationDeleteData | UpdateOperationDeleteWhere | UpdateOperationModify;
78
+ export type Update = Node & {
79
+ type: 'update';
80
+ updates: {
81
+ operation?: UpdateOperation;
82
+ context: ContextDefinition[];
83
+ }[];
84
+ };
85
+ export type QueryBase = Node & {
86
+ type: 'query';
87
+ subType: string;
88
+ context: ContextDefinition[];
89
+ values?: PatternValues;
90
+ solutionModifiers: SolutionModifiers;
91
+ datasets: DatasetClauses;
92
+ where?: PatternGroup;
93
+ };
94
+ export type QuerySelect = QueryBase & {
95
+ subType: 'select';
96
+ variables: (TermVariable | PatternBind)[] | [Wildcard];
97
+ distinct?: true;
98
+ reduced?: true;
99
+ where: PatternGroup;
100
+ };
101
+ export type QueryConstruct = QueryBase & {
102
+ subType: 'construct';
103
+ template: PatternBgp;
104
+ where: PatternGroup;
105
+ };
106
+ export type QueryDescribe = QueryBase & {
107
+ subType: 'describe';
108
+ variables: (TermVariable | TermIri)[] | [Wildcard];
109
+ };
110
+ export type QueryAsk = QueryBase & {
111
+ subType: 'ask';
112
+ where: PatternGroup;
113
+ };
114
+ export type Query = QuerySelect | QueryConstruct | QueryDescribe | QueryAsk;
115
+ export type SparqlQuery = Query | Update;
116
+ export type DatasetClauses = Node & {
117
+ type: 'datasetClauses';
118
+ clauses: {
119
+ clauseType: 'default' | 'named';
120
+ value: TermIri;
121
+ }[];
122
+ };
123
+ export type TripleCollectionBase = Node & {
124
+ type: 'tripleCollection';
125
+ subType: string;
126
+ triples: TripleNesting[];
127
+ identifier: Term;
11
128
  };
12
129
  /**
13
- * OVERRIDES: {@link T11.ITriplesNode}
130
+ * Both subject and predicate of the triples do not have a string manifestation.
14
131
  */
15
- export interface ITriplesNode {
16
- node: T11.IriTerm | T11.BlankTerm;
17
- triples: Triple[];
18
- }
132
+ export type TripleCollectionList = TripleCollectionBase & {
133
+ subType: 'list';
134
+ identifier: TermBlank;
135
+ };
19
136
  /**
20
- * OVERRIDES: {@link T11.IGraphNode}
137
+ * The subject of the triples does not have a string manifestation.
21
138
  */
22
- export interface IGraphNode {
23
- node: ITriplesNode['node'] | Term;
24
- triples: Triple[];
25
- }
139
+ export type TripleCollectionBlankNodeProperties = Patch<T11.TripleCollectionBlankNodeProperties, {
140
+ triples: TripleNesting[];
141
+ identifier: TermBlank | TermVariable | TermIri;
142
+ }>;
143
+ export type TripleCollectionReifiedTriple = TripleCollectionBase & {
144
+ subType: 'reifiedTriple';
145
+ identifier: TermVariable | TermIri | TermBlank;
146
+ };
147
+ export type TripleCollection = TripleCollectionList | TripleCollectionBlankNodeProperties | TripleCollectionReifiedTriple;
148
+ export type GraphNode = Term | TripleCollection;
149
+ export type Annotation = TripleCollectionBlankNodeProperties | TermVariable | TermIri | TermBlank;
150
+ export type TripleNesting = Node & {
151
+ type: 'triple';
152
+ subject: GraphNode;
153
+ predicate: TermIri | TermVariable | Path;
154
+ object: GraphNode;
155
+ annotations?: Annotation[];
156
+ };
157
+ export type PatternBase = Node & {
158
+ type: 'pattern';
159
+ subType: string;
160
+ };
161
+ export type PatternFilter = PatternBase & {
162
+ subType: 'filter';
163
+ expression: Expression;
164
+ };
165
+ export type PatternMinus = PatternBase & {
166
+ subType: 'minus';
167
+ patterns: Pattern[];
168
+ };
169
+ export type PatternGroup = PatternBase & {
170
+ subType: 'group';
171
+ patterns: Pattern[];
172
+ };
173
+ export type PatternOptional = PatternBase & {
174
+ subType: 'optional';
175
+ patterns: Pattern[];
176
+ };
177
+ export type PatternGraph = PatternBase & {
178
+ subType: 'graph';
179
+ name: TermIri | TermVariable;
180
+ patterns: Pattern[];
181
+ };
182
+ export type PatternUnion = PatternBase & {
183
+ subType: 'union';
184
+ patterns: PatternGroup[];
185
+ };
186
+ export type BasicGraphPattern = (TripleNesting | TripleCollection)[];
187
+ export type PatternBgp = PatternBase & {
188
+ subType: 'bgp';
189
+ /**
190
+ * Only the first appearance of a subject and predicate have a string manifestation
191
+ */
192
+ triples: BasicGraphPattern;
193
+ };
194
+ export type PatternBind = PatternBase & {
195
+ subType: 'bind';
196
+ expression: Expression;
197
+ variable: TermVariable;
198
+ };
199
+ export type PatternService = PatternBase & {
200
+ subType: 'service';
201
+ name: TermIri | TermVariable;
202
+ silent: boolean;
203
+ patterns: Pattern[];
204
+ };
205
+ /**
206
+ * A single list of assignments maps the variable identifier to the value
207
+ */
208
+ export type ValuePatternRow = Record<string, TermIri | TermLiteral | undefined>;
209
+ export type PatternValues = PatternBase & {
210
+ subType: 'values';
211
+ values: ValuePatternRow[];
212
+ };
213
+ export type SubSelect = QuerySelect;
214
+ export type Pattern = PatternBgp | PatternGroup | PatternUnion | PatternOptional | PatternMinus | PatternGraph | PatternService | PatternFilter | PatternBind | PatternValues | SubSelect;
215
+ export type SolutionModifiers = {
216
+ group?: SolutionModifierGroup;
217
+ having?: SolutionModifierHaving;
218
+ order?: SolutionModifierOrder;
219
+ limitOffset?: SolutionModifierLimitOffset;
220
+ };
221
+ export type SolutionModifierBase = Node & {
222
+ type: 'solutionModifier';
223
+ subType: string;
224
+ };
225
+ export type SolutionModifierGroupBind = Localized & {
226
+ variable: TermVariable;
227
+ value: Expression;
228
+ };
229
+ export type SolutionModifierGroup = SolutionModifierBase & {
230
+ subType: 'group';
231
+ groupings: (Expression | SolutionModifierGroupBind)[];
232
+ };
233
+ export type SolutionModifierHaving = SolutionModifierBase & {
234
+ subType: 'having';
235
+ having: Expression[];
236
+ };
237
+ export type Ordering = Expression | (Localized & {
238
+ descending: boolean;
239
+ expression: Expression;
240
+ });
241
+ export type SolutionModifierOrder = SolutionModifierBase & {
242
+ subType: 'order';
243
+ orderDefs: Ordering[];
244
+ };
245
+ export type SolutionModifierLimitOffset = T11.SolutionModifierLimitOffset;
246
+ export type SolutionModifier = SolutionModifierGroup | SolutionModifierHaving | SolutionModifierOrder | SolutionModifierLimitOffset;
247
+ export type ExpressionBase = Node & {
248
+ type: 'expression';
249
+ subType: string;
250
+ };
251
+ type ExpressionAggregateBase = ExpressionBase & {
252
+ subType: 'aggregate';
253
+ distinct: boolean;
254
+ };
255
+ export type ExpressionAggregateDefault = ExpressionAggregateBase & {
256
+ expression: [Expression];
257
+ aggregation: string;
258
+ };
259
+ export type ExpressionAggregateOnWildcard = ExpressionAggregateBase & {
260
+ expression: [Wildcard];
261
+ aggregation: string;
262
+ };
263
+ export type ExpressionAggregateSeparator = ExpressionAggregateBase & {
264
+ expression: [Expression];
265
+ aggregation: string;
266
+ separator: string;
267
+ };
268
+ export type ExpressionAggregate = ExpressionAggregateDefault | ExpressionAggregateOnWildcard | ExpressionAggregateSeparator;
269
+ export type ExpressionOperation = ExpressionBase & {
270
+ subType: 'operation';
271
+ operator: string;
272
+ args: Expression[];
273
+ };
274
+ export type ExpressionPatternOperation = ExpressionBase & {
275
+ subType: 'patternOperation';
276
+ operator: string;
277
+ args: PatternGroup;
278
+ };
279
+ export type ExpressionFunctionCall = ExpressionBase & {
280
+ subType: 'functionCall';
281
+ function: TermIri;
282
+ distinct: boolean;
283
+ args: Expression[];
284
+ };
285
+ export type Expression = ExpressionOperation | ExpressionPatternOperation | ExpressionFunctionCall | ExpressionAggregate | TermIri | TermVariable | TermLiteral | TermTriple;
286
+ export type PropertyPathChain = T11.PropertyPathChain;
287
+ export type PathModified = T11.PathModified;
288
+ export type PathNegatedElt = T11.PathNegatedElt;
289
+ export type PathAlternativeLimited = T11.PathAlternativeLimited;
290
+ export type PathNegated = T11.PathNegated;
291
+ export type Path = T11.Path;
292
+ export type ContextDefinitionPrefix = T11.ContextDefinitionPrefix;
293
+ export type ContextDefinitionBase = T11.ContextDefinitionBase;
294
+ export type ContextDefinitionVersion = T11.ContextDefinitionBase_ & {
295
+ subType: 'version';
296
+ version: string;
297
+ };
298
+ export type ContextDefinition = T11.ContextDefinition | ContextDefinitionVersion;
299
+ export type Wildcard = T11.Wildcard;
300
+ export type TermLiteralStr = T11.TermLiteralStr;
301
+ export type TermLiteralLangStr = T11.TermLiteralLangStr;
302
+ export type TermLiteralTyped = T11.TermLiteralTyped;
303
+ export type TermLiteral = T11.TermLiteral;
304
+ export type TermVariable = T11.TermVariable;
305
+ export type TermIriFull = T11.TermIriFull;
306
+ export type TermIriPrefixed = T11.TermIriPrefixed;
307
+ export type TermIri = T11.TermIri;
308
+ export type TermBlank = T11.TermBlank;
309
+ export type TermTriple = T11.TermBase & {
310
+ subType: 'triple';
311
+ subject: Term;
312
+ predicate: TermIri | TermVariable;
313
+ object: Term;
314
+ };
315
+ export type Term = GraphTerm | TermVariable;
316
+ export type GraphTerm = TermIri | TermBlank | TermLiteral | TermTriple;
317
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"sparql12Types.js","sourceRoot":"","sources":["sparql12Types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as RdfJs from '@rdfjs/types';\nimport type * as T11 from '@traqula/rules-sparql-1-1';\n\nexport type BaseQuadTerm = RdfJs.BaseQuad;\nexport type GraphTerm = T11.GraphTerm | BaseQuadTerm;\nexport type Term = T11.Term | BaseQuadTerm;\nexport type Expression = T11.Expression | BaseQuadTerm;\n\nexport type Triple = {\n subject: Term;\n predicate: T11.IriTerm | T11.VariableTerm | T11.PropertyPath;\n object: Term;\n};\n\n/**\n * OVERRIDES: {@link T11.ITriplesNode}\n */\nexport interface ITriplesNode {\n node: T11.IriTerm | T11.BlankTerm;\n triples: Triple[];\n}\n\n/**\n * OVERRIDES: {@link T11.IGraphNode}\n */\nexport interface IGraphNode {\n node: ITriplesNode['node'] | Term;\n triples: Triple[];\n}\n"]}
1
+ {"version":3,"file":"sparql12Types.js","sourceRoot":"","sources":["sparql12Types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Localized, Node, Patch } from '@traqula/core';\nimport type * as T11 from '@traqula/rules-sparql-1-1';\n\nexport type Sparql12Nodes =\n | GraphRef\n | UpdateOperation\n | Update\n | Query\n | DatasetClauses\n | TripleCollection\n | TripleNesting\n | Pattern\n | SolutionModifier\n | Expression\n | Path\n | ContextDefinition\n | Wildcard\n | Term;\n\nexport type GraphRefBase = T11.GraphRefBase;\nexport type GraphRefDefault = T11.GraphRefDefault;\nexport type GraphRefNamed = T11.GraphRefNamed;\nexport type GraphRefAll = T11.GraphRefAll;\nexport type GraphRefSpecific = T11.GraphRefSpecific;\nexport type GraphRef = T11.GraphRef;\n\nexport type Quads = PatternBgp | GraphQuads;\n\nexport type GraphQuads = Node & {\n type: 'graph';\n graph: TermIri | TermVariable;\n triples: PatternBgp;\n};\n\n// https://www.w3.org/TR/sparql11-query/#rUpdate1\nexport type UpdateOperationBase = Node & { type: 'updateOperation'; subType: string };\nexport type UpdateOperationLoad = UpdateOperationBase & {\n subType: 'load';\n silent: boolean;\n source: TermIri;\n destination?: GraphRefSpecific;\n};\ntype UpdateOperationClearDropCreateBase = UpdateOperationBase & {\n subType: 'clear' | 'drop' | 'create';\n silent: boolean;\n destination: GraphRef;\n};\nexport type UpdateOperationClear = UpdateOperationClearDropCreateBase & { subType: 'clear' };\nexport type UpdateOperationDrop = UpdateOperationClearDropCreateBase & { subType: 'drop' };\nexport type UpdateOperationCreate = UpdateOperationClearDropCreateBase & {\n subType: 'create';\n destination: GraphRefSpecific;\n};\ntype UpdateOperationAddMoveCopy = UpdateOperationBase & {\n subType: 'add' | 'move' | 'copy';\n silent: boolean;\n source: GraphRefDefault | GraphRefSpecific;\n destination: GraphRefDefault | GraphRefSpecific;\n};\nexport type UpdateOperationAdd = UpdateOperationAddMoveCopy & { subType: 'add' };\nexport type UpdateOperationMove = UpdateOperationAddMoveCopy & { subType: 'move' };\nexport type UpdateOperationCopy = UpdateOperationAddMoveCopy & { subType: 'copy' };\ntype UpdateOperationInsertDeleteDelWhere = UpdateOperationBase & {\n subType: 'insertdata' | 'deletedata' | 'deletewhere';\n data: Quads[];\n};\nexport type UpdateOperationInsertData = UpdateOperationInsertDeleteDelWhere & { subType: 'insertdata' };\nexport type UpdateOperationDeleteData = UpdateOperationInsertDeleteDelWhere & { subType: 'deletedata' };\nexport type UpdateOperationDeleteWhere = UpdateOperationInsertDeleteDelWhere & { subType: 'deletewhere' };\nexport type UpdateOperationModify = UpdateOperationBase & {\n subType: 'modify';\n graph: TermIri | undefined;\n insert: Quads[];\n delete: Quads[];\n from: DatasetClauses;\n where: PatternGroup;\n};\nexport type UpdateOperation =\n | UpdateOperationLoad\n | UpdateOperationClear\n | UpdateOperationDrop\n | UpdateOperationCreate\n | UpdateOperationAdd\n | UpdateOperationMove\n | UpdateOperationCopy\n | UpdateOperationInsertData\n | UpdateOperationDeleteData\n | UpdateOperationDeleteWhere\n | UpdateOperationModify;\n\n// https://www.w3.org/TR/sparql11-query/#rUpdate\nexport type Update = Node & {\n type: 'update';\n updates: {\n operation?: UpdateOperation;\n context: ContextDefinition[];\n }[];\n};\n\n// https://www.w3.org/TR/sparql11-query/#rQueryUnit\nexport type QueryBase = Node & {\n type: 'query';\n subType: string;\n\n context: ContextDefinition[];\n values?: PatternValues;\n solutionModifiers: SolutionModifiers;\n datasets: DatasetClauses;\n where?: PatternGroup;\n};\nexport type QuerySelect = QueryBase & {\n subType: 'select';\n variables: (TermVariable | PatternBind)[] | [Wildcard];\n distinct?: true;\n reduced?: true;\n where: PatternGroup;\n};\nexport type QueryConstruct = QueryBase & {\n subType: 'construct';\n template: PatternBgp;\n where: PatternGroup;\n};\nexport type QueryDescribe = QueryBase & {\n subType: 'describe';\n variables: (TermVariable | TermIri)[] | [Wildcard];\n};\nexport type QueryAsk = QueryBase & {\n subType: 'ask';\n where: PatternGroup;\n};\nexport type Query =\n | QuerySelect\n | QueryConstruct\n | QueryDescribe\n | QueryAsk;\n\nexport type SparqlQuery = Query | Update;\n\n// https://www.w3.org/TR/sparql11-query/#rDatasetClause\nexport type DatasetClauses = Node & {\n type: 'datasetClauses';\n clauses: { clauseType: 'default' | 'named'; value: TermIri }[];\n};\n\n// https://www.w3.org/TR/sparql11-query/#rGraphNode\nexport type TripleCollectionBase = Node & {\n type: 'tripleCollection';\n subType: string;\n triples: TripleNesting[];\n identifier: Term;\n};\n/**\n * Both subject and predicate of the triples do not have a string manifestation.\n */\nexport type TripleCollectionList = TripleCollectionBase & {\n subType: 'list';\n identifier: TermBlank;\n};\n/**\n * The subject of the triples does not have a string manifestation.\n */\nexport type TripleCollectionBlankNodeProperties = Patch<T11.TripleCollectionBlankNodeProperties, {\n triples: TripleNesting[];\n identifier: TermBlank | TermVariable | TermIri;\n}>;\nexport type TripleCollectionReifiedTriple = TripleCollectionBase & {\n subType: 'reifiedTriple';\n identifier: TermVariable | TermIri | TermBlank;\n};\n\nexport type TripleCollection =\n | TripleCollectionList\n | TripleCollectionBlankNodeProperties\n | TripleCollectionReifiedTriple;\n\n// https://www.w3.org/TR/sparql11-query/#rGraphNode\nexport type GraphNode = Term | TripleCollection;\nexport type Annotation = TripleCollectionBlankNodeProperties | TermVariable | TermIri | TermBlank;\n// https://www.w3.org/TR/sparql11-query/#rTriplesBlock\nexport type TripleNesting = Node & {\n type: 'triple';\n subject: GraphNode;\n predicate: TermIri | TermVariable | Path;\n object: GraphNode;\n annotations?: Annotation[];\n};\n\nexport type PatternBase = Node & { type: 'pattern'; subType: string };\nexport type PatternFilter = PatternBase & {\n subType: 'filter';\n expression: Expression;\n};\nexport type PatternMinus = PatternBase & {\n subType: 'minus';\n patterns: Pattern[];\n};\n\nexport type PatternGroup = PatternBase & {\n subType: 'group';\n patterns: Pattern[];\n};\nexport type PatternOptional = PatternBase & {\n subType: 'optional';\n patterns: Pattern[];\n};\nexport type PatternGraph = PatternBase & {\n subType: 'graph';\n name: TermIri | TermVariable;\n patterns: Pattern[];\n};\nexport type PatternUnion = PatternBase & {\n subType: 'union';\n patterns: PatternGroup[];\n};\nexport type BasicGraphPattern = (TripleNesting | TripleCollection)[];\nexport type PatternBgp = PatternBase & {\n subType: 'bgp';\n /**\n * Only the first appearance of a subject and predicate have a string manifestation\n */\n triples: BasicGraphPattern;\n};\nexport type PatternBind = PatternBase & {\n subType: 'bind';\n expression: Expression;\n variable: TermVariable;\n};\nexport type PatternService = PatternBase & {\n subType: 'service';\n name: TermIri | TermVariable;\n silent: boolean;\n patterns: Pattern[];\n};\n/**\n * A single list of assignments maps the variable identifier to the value\n */\nexport type ValuePatternRow = Record<string, TermIri | TermLiteral | undefined>;\nexport type PatternValues = PatternBase & {\n subType: 'values';\n values: ValuePatternRow[];\n};\nexport type SubSelect = QuerySelect;\n\nexport type Pattern =\n | PatternBgp\n | PatternGroup\n | PatternUnion\n | PatternOptional\n | PatternMinus\n | PatternGraph\n | PatternService\n | PatternFilter\n | PatternBind\n | PatternValues\n | SubSelect;\n\nexport type SolutionModifiers = {\n group?: SolutionModifierGroup;\n having?: SolutionModifierHaving;\n order?: SolutionModifierOrder;\n limitOffset?: SolutionModifierLimitOffset;\n};\nexport type SolutionModifierBase = Node & { type: 'solutionModifier'; subType: string };\nexport type SolutionModifierGroupBind = Localized & {\n variable: TermVariable;\n value: Expression;\n};\nexport type SolutionModifierGroup = SolutionModifierBase & {\n subType: 'group';\n groupings: (Expression | SolutionModifierGroupBind)[];\n};\nexport type SolutionModifierHaving = SolutionModifierBase & {\n subType: 'having';\n having: Expression[];\n};\nexport type Ordering =\n | Expression\n | (Localized & { descending: boolean; expression: Expression });\nexport type SolutionModifierOrder = SolutionModifierBase & {\n subType: 'order';\n orderDefs: Ordering[];\n};\nexport type SolutionModifierLimitOffset = T11.SolutionModifierLimitOffset;\n\nexport type SolutionModifier =\n | SolutionModifierGroup\n | SolutionModifierHaving\n | SolutionModifierOrder\n | SolutionModifierLimitOffset;\n\nexport type ExpressionBase = Node & { type: 'expression'; subType: string };\n\ntype ExpressionAggregateBase = ExpressionBase & {\n subType: 'aggregate';\n distinct: boolean;\n};\nexport type ExpressionAggregateDefault = ExpressionAggregateBase & {\n expression: [Expression];\n aggregation: string;\n};\nexport type ExpressionAggregateOnWildcard = ExpressionAggregateBase & {\n expression: [Wildcard];\n aggregation: string;\n};\nexport type ExpressionAggregateSeparator = ExpressionAggregateBase & {\n expression: [Expression];\n aggregation: string;\n separator: string;\n};\nexport type ExpressionAggregate =\n | ExpressionAggregateDefault\n | ExpressionAggregateOnWildcard\n | ExpressionAggregateSeparator;\n\nexport type ExpressionOperation = ExpressionBase & {\n subType: 'operation';\n operator: string;\n args: Expression[];\n};\n\nexport type ExpressionPatternOperation = ExpressionBase & {\n subType: 'patternOperation';\n operator: string;\n // Can be a pattern in case of exists and not exists\n args: PatternGroup;\n};\n\nexport type ExpressionFunctionCall = ExpressionBase & {\n subType: 'functionCall';\n function: TermIri;\n distinct: boolean;\n args: Expression[];\n};\n\nexport type Expression =\n | ExpressionOperation\n | ExpressionPatternOperation\n | ExpressionFunctionCall\n | ExpressionAggregate\n | TermIri\n | TermVariable\n | TermLiteral\n | TermTriple;\n\nexport type PropertyPathChain = T11.PropertyPathChain;\nexport type PathModified = T11.PathModified;\nexport type PathNegatedElt = T11.PathNegatedElt;\nexport type PathAlternativeLimited = T11.PathAlternativeLimited;\nexport type PathNegated = T11.PathNegated;\n// [[88]](https://www.w3.org/TR/sparql11-query/#rPath)\nexport type Path = T11.Path;\n\nexport type ContextDefinitionPrefix = T11.ContextDefinitionPrefix;\nexport type ContextDefinitionBase = T11.ContextDefinitionBase;\nexport type ContextDefinitionVersion = T11.ContextDefinitionBase_ & {\n subType: 'version';\n version: string;\n};\nexport type ContextDefinition = T11.ContextDefinition | ContextDefinitionVersion;\n\nexport type Wildcard = T11.Wildcard;\nexport type TermLiteralStr = T11.TermLiteralStr;\nexport type TermLiteralLangStr = T11.TermLiteralLangStr;\nexport type TermLiteralTyped = T11.TermLiteralTyped;\nexport type TermLiteral = T11.TermLiteral;\nexport type TermVariable = T11.TermVariable;\nexport type TermIriFull = T11.TermIriFull;\nexport type TermIriPrefixed = T11.TermIriPrefixed;\nexport type TermIri = T11.TermIri;\nexport type TermBlank = T11.TermBlank;\n\nexport type TermTriple = T11.TermBase & {\n subType: 'triple';\n subject: Term;\n predicate: TermIri | TermVariable;\n object: Term;\n};\n\nexport type Term = GraphTerm | TermVariable;\nexport type GraphTerm = TermIri | TermBlank | TermLiteral | TermTriple;\n"]}
@@ -0,0 +1,2 @@
1
+ import type { TermLiteral } from './sparql12Types';
2
+ export declare function langTagHasCorrectDomain(literal: TermLiteral): void;