@traqula/test-utils 0.0.1-alpha.141 → 0.0.1-alpha.145

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 CHANGED
@@ -5,11 +5,11 @@ TRAQULA test utils contains some developer dependencies for testing packages and
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install -D @traqula/test-utils
8
+ npm install -D @traqula/test-utils.ts
9
9
  ```
10
10
 
11
11
  or
12
12
 
13
13
  ```bash
14
- yarn add -D @traqula/test-utils
14
+ yarn add -D @traqula/test-utils.ts
15
15
  ```
@@ -105,6 +105,21 @@ export function importSparql11NoteTests(constructor, dataFactory) {
105
105
  base: 'http://ex.org/'
106
106
  });
107
107
  });
108
+ it('using prefixed as relative iri', ({ expect }) => {
109
+ const parser = constructor({ baseIRI: 'http://ex.org/apl' });
110
+ const query = `
111
+ CONSTRUCT
112
+ FROM <data.ttl>
113
+ WHERE { ?s ?p ?o }
114
+ `;
115
+ expect(parser.parse(query)).toMatchObject({
116
+ from: {
117
+ default: [
118
+ dataFactory.namedNode('http://ex.org/data.ttl'),
119
+ ]
120
+ }
121
+ });
122
+ });
108
123
  it('should use the base IRI', ({ expect }) => {
109
124
  const query = 'SELECT * { <> <#b> "" }';
110
125
  const result = {
@@ -1 +1 @@
1
- {"version":3,"file":"Sparql11NotesTest.js","sourceRoot":"","sources":["Sparql11NotesTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAC;AAWpC,MAAM,UAAU,uBAAuB,CAAC,WAA8B,EAAE,WAAkC;IACxG,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAE7B,SAAS,kBAAkB,CAAC,KAAa,EAAE,QAAgB;QACzD,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;YACpB,IAAI,KAAK,GAAQ,IAAI,CAAC;YACtB,IAAI,CAAC;gBACH,MAAM,CAAC,KAAK,CAAC,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DAAqD,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;YACvE,MAAM,KAAK,GAAG;;yDAEqC,CAAC;YACpD,wBAAwB;YACxB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2EAA2E,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;YAC7F,MAAM,KAAK,GAAG;yDACqC,CAAC;YACpD,wBAAwB;YACxB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sDAAsD,EAAE,kBAAkB,CAC3E,yEAAyE,EACzE,aAAa,CACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4FAA4F,EAAE,kBAAkB,CACjH,yCAAyC,EACzC,6EAA6E,CAC9E,CAAC,CAAC;IAEH,EAAE,CACA,iGAAiG,EACjG,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;QACb,MAAM,KAAK,GAAG,+CAA+C,CAAC;QAC9D,wBAAwB;QACxB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import {describe, it} from \"vitest\";\nimport type {TestFunction} from \"vitest\";\nimport {DataFactory} from \"rdf-data-factory\";\nimport {BaseQuad} from \"@rdfjs/types\";\n\ninterface Parser {\n parse: (query: string) => unknown;\n}\n\ntype ParserConstructor = (args?: {prefixes?: Record<string, string>, baseIRI?: string}) => Parser;\n\nexport function importSparql11NoteTests(constructor: ParserConstructor, dataFactory: DataFactory<BaseQuad>) {\n const parser = constructor();\n\n function testErroneousQuery(query: string, errorMsg: string): TestFunction<object> {\n return ({ expect }) => {\n let error: any = null;\n try {\n parser.parse(query);\n } catch (e) {\n error = e;\n }\n expect(error).not.toBeUndefined();\n expect(error).toBeInstanceOf(Error);\n // Expect(error.message).toContain(errorMsg);\n };\n }\n\n\n it('should throw an error on an invalid query', testErroneousQuery('invalid', 'Parse error on line 1'));\n\n it('should throw an error on a projection of ungrouped variable', testErroneousQuery(\n 'PREFIX : <http://www.example.org/> SELECT ?o WHERE { ?s ?p ?o } GROUP BY ?s',\n 'Projection of ungrouped variable (?o)',\n ));\n\n it('should throw an error on a values class with LESS variables than value', testErroneousQuery(\n 'SELECT * WHERE { } VALUES ( ?S ) { ( true false ) }',\n 'Number of dataBlockValues does not match number of variables. Too much values.',\n ));\n\n it('should throw an error on a values class with MORE variables than value', testErroneousQuery(\n 'SELECT * WHERE { } VALUES ( ?S ?O ) { ( true ) }',\n 'Number of dataBlockValues does not match number of variables. Too few values.',\n ));\n\n it('should NOT throw on a values class with correct amount of values', ({ expect }) => {\n const query = 'SELECT * WHERE { } VALUES ( ?S ) { ( true ) }';\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should throw an error on an invalid selectscope', testErroneousQuery(\n 'SELECT (1 AS ?X ) { SELECT (2 AS ?X ) {} }',\n 'Target id of \\'AS\\' (?X) already used in subquery',\n ));\n\n it('should throw an error on bind to variable in scope', testErroneousQuery(\n 'SELECT * { ?s ?p ?o BIND(?o AS ?o) }',\n 'Target id of \\'AS\\' (?X) already used in subquery',\n ));\n\n it('should preserve BGP and filter pattern order', ({ expect }) => {\n const query = 'SELECT * { ?s ?p \"1\" . FILTER(true) . ?s ?p \"2\" }';\n expect(parser.parse(query)).toMatchObject({\n where: [\n { type: 'bgp' },\n { type: 'filter' },\n { type: 'bgp' },\n ],\n });\n });\n\n it('should throw an error on an aggregate function within an aggregate function', testErroneousQuery(\n 'SELECT (SUM(COUNT(?lprice)) AS ?totalPrice) { }',\n 'An aggregate function is not allowed within an aggregate function',\n ));\n\n describe('with pre-defined prefixes', () => {\n const prefixes = { a: 'ex:abc#', b: 'ex:def#' };\n const parser = constructor({ prefixes });\n\n it('should use those prefixes', ({ expect }) => {\n const query = 'SELECT * { a:a b:b \"\" }';\n expect(parser.parse(query)).toMatchObject({\n where: [\n {\n triples: [\n {\n subject: dataFactory.namedNode('ex:abc#a'),\n predicate: dataFactory.namedNode('ex:def#b'),\n object: dataFactory.literal(''),\n },\n ],\n },\n ],\n });\n });\n\n it('should allow temporarily overriding prefixes', ({ expect }) => {\n const query = 'PREFIX a: <ex:xyz#> SELECT * { a:a b:b \"\" }';\n expect(parser.parse(query)).toMatchObject({\n where: [{\n triples: [{\n subject: dataFactory.namedNode('ex:xyz#a'),\n predicate: dataFactory.namedNode('ex:def#b'),\n object: dataFactory.literal(''),\n }],\n },\n ],\n });\n\n const query2 = 'SELECT * { a:a b:b \"\" }';\n expect(parser.parse(query2)).toMatchObject({\n where: [{\n triples: [{\n subject: dataFactory.namedNode('ex:abc#a'),\n predicate: dataFactory.namedNode('ex:def#b'),\n object: dataFactory.literal(''),\n }],\n },\n ],\n });\n });\n\n it('should not change the original prefixes', ({ expect }) => {\n expect(prefixes).toEqual({ a: 'ex:abc#', b: 'ex:def#' });\n });\n\n it('should not take over changes to the original prefixes', ({ expect }) => {\n const query = 'SELECT * { a:a b:b \"\" }';\n prefixes.a = 'ex:xyz#';\n expect(parser.parse(query)).toMatchObject({\n where: [{\n triples: [{\n subject: dataFactory.namedNode('ex:abc#a'),\n predicate: dataFactory.namedNode('ex:def#b'),\n object: dataFactory.literal(''),\n }],\n },\n ],\n });\n });\n });\n\n describe('with pre-defined base IRI', () => {\n const parser = constructor({ baseIRI: 'http://ex.org/' });\n\n it('contains the base', ({expect}) => {\n const query = 'SELECT * { ?s ?p ?o }';\n expect(parser.parse(query)).toMatchObject({\n base: 'http://ex.org/'\n });\n })\n\n it('should use the base IRI', ({ expect }) => {\n const query = 'SELECT * { <> <#b> \"\" }';\n const result = {\n subject: dataFactory.namedNode('http://ex.org/'),\n predicate: dataFactory.namedNode('http://ex.org/#b'),\n object: dataFactory.literal(''),\n };\n\n expect(parser.parse(query)).toMatchObject({\n where: [{ triples: [ result ]}],\n });\n });\n\n it('should work after a previous query failed', ({ expect }) => {\n const badQuery = 'SELECT * { <> <#b> \"\" } invalid!';\n expect(() => parser.parse(badQuery)).toThrow(Error);\n\n const goodQuery = 'SELECT * { <> <#b> \"\" }';\n\n const parser = constructor({ baseIRI: 'http://ex2.org/' });\n const result = {\n subject: dataFactory.namedNode('http://ex2.org/'),\n predicate: dataFactory.namedNode('http://ex2.org/#b'),\n object: dataFactory.literal(''),\n };\n const data = parser.parse(goodQuery);\n expect(data).toMatchObject({\n where: [{ triples: [ result ]}],\n });\n });\n });\n\n it('should throw an error on relative IRIs if no base IRI is specified', testErroneousQuery(\n 'SELECT * { <a> <b> <c> }',\n 'Cannot resolve relative IRI a because no base IRI was set.',\n ));\n\n describe('with group collapsing disabled', () => {\n it('should keep explicit pattern group', ({ expect }) => {\n const query = 'SELECT * WHERE { { ?s ?p ?o } ?a ?b ?c }';\n const result = [\n {\n type: 'group',\n patterns: [\n {\n type: 'bgp',\n triples: [\n {\n subject: dataFactory.variable('s'),\n predicate: dataFactory.variable('p'),\n object: dataFactory.variable('o'),\n },\n ],\n },\n ],\n },\n {\n type: 'bgp',\n triples: [\n {\n subject: dataFactory.variable('a'),\n predicate: dataFactory.variable('b'),\n object: dataFactory.variable('c'),\n },\n ],\n },\n ];\n\n expect(parser.parse(query)).toMatchObject({ where: result });\n });\n\n it('should still collapse immediate union groups', ({ expect }) => {\n const query = 'SELECT * WHERE { { ?s ?p ?o } UNION { ?a ?b ?c } }';\n\n const result = [\n {\n type: 'union',\n patterns: [{\n type: 'bgp',\n triples: [{\n subject: {\n termType: 'Variable',\n value: 's',\n },\n predicate: {\n termType: 'Variable',\n value: 'p',\n },\n object: {\n termType: 'Variable',\n value: 'o',\n },\n }],\n }, {\n type: 'bgp',\n triples: [{\n subject: {\n termType: 'Variable',\n value: 'a',\n },\n predicate: {\n termType: 'Variable',\n value: 'b',\n },\n object: {\n termType: 'Variable',\n value: 'c',\n },\n }],\n }],\n },\n ];\n\n expect(parser.parse(query)).toMatchObject({ where: result });\n });\n });\n\n describe('for update queries', () => {\n it('should throw an error on blank nodes in DELETE clause', testErroneousQuery(\n 'DELETE { ?a <ex:knows> [] . } WHERE { ?a <ex:knows> \"Alan\" . }',\n 'Detected illegal blank node in BGP',\n ));\n\n it('should not throw on blank nodes in INSERT clause', ({ expect }) => {\n const query = 'INSERT { ?a <ex:knows> [] . } WHERE { ?a <ex:knows> \"Alan\" . }';\n // TODO: add proper test\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should throw an error on blank nodes in compact DELETE clause', testErroneousQuery(\n 'DELETE WHERE { _:a <ex:p> <ex:o> }',\n 'Detected illegal blank node in BGP',\n ));\n\n it('should throw an error on variables in DELETE DATA clause', testErroneousQuery(\n 'DELETE DATA { ?a <ex:p> <ex:o> }',\n 'Detected illegal variable in BGP',\n ));\n\n it('should throw an error on blank nodes in DELETE DATA clause', testErroneousQuery(\n 'DELETE DATA { _:a <ex:p> <ex:o> }',\n 'Detected illegal blank node in BGP',\n ));\n\n it('should throw an error on variables in DELETE DATA clause with GRAPH', testErroneousQuery(\n 'DELETE DATA { GRAPH ?a { <ex:s> <ex:p> <ex:o> } }',\n 'Detected illegal variable in GRAPH',\n ));\n\n it('should throw an error on variables in INSERT DATA clause', testErroneousQuery(\n 'INSERT DATA { ?a <ex:p> <ex:o> }',\n 'Detected illegal variable in BGP',\n ));\n\n it('should not throw on reused blank nodes in one INSERT DATA clause', ({ expect }) => {\n const query = 'INSERT DATA { _:a <ex:p> <ex:o> . _:a <ex:p> <ex:o> . }';\n // Todo: add proper test\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should throw an error on reused blank nodes across INSERT DATA clauses', testErroneousQuery(\n 'INSERT DATA { _:a <ex:p> <ex:o> }; INSERT DATA { _:a <ex:p> <ex:o> }',\n 'Detected reuse blank node across different INSERT DATA clauses',\n ));\n\n it('should throw an error on reused blank nodes across INSERT DATA clauses with GRAPH', testErroneousQuery(\n 'INSERT DATA { _:a <ex:p> <ex:o> }; INSERT DATA { GRAPH <ex:g> { _:a <ex:p> <ex:o> } }',\n 'Detected reuse blank node across different INSERT DATA clauses',\n ));\n\n it('should not throw on comment between INSERT and DATA', ({ expect }) => {\n const query = `INSERT\n# Comment\nDATA { GRAPH <ex:G> { <ex:s> <ex:p> 'o1', 'o2', 'o3' } }`;\n // TODO: add proper test\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should not throw on comment after INSERT that could be confused with DATA', ({ expect }) => {\n const query = `INSERT # DATA\nDATA { GRAPH <ex:G> { <ex:s> <ex:p> 'o1', 'o2', 'o3' } }`;\n // TODO: add proper test\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should throw an error on commented DATA after INSERT', testErroneousQuery(\n 'INSERT # DATA { GRAPH <ex:G> { <ex:s> <ex:p> \\'o1\\', \\'o2\\', \\'o3\\' } }',\n 'Parse error',\n ));\n });\n\n it('should throw an error on unicode codepoint escaping in literal with partial surrogate pair', testErroneousQuery(\n 'SELECT * WHERE { ?s <ex:p> \\'\\uD800\\' }',\n 'Invalid unicode codepoint of surrogate pair without corresponding codepoint',\n ));\n\n it(\n 'should not throw an error on unicode codepoint escaping in literal with complete surrogate pair',\n ({ expect }) => {\n const query = 'SELECT * WHERE { ?s <ex:p> \\'\\uD800\\uDFFF\\' }';\n // TODO: add proper test\n expect(parser.parse(query)).toMatchObject({});\n },\n );\n}"]}
1
+ {"version":3,"file":"Sparql11NotesTest.js","sourceRoot":"","sources":["Sparql11NotesTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAC;AAWpC,MAAM,UAAU,uBAAuB,CAAC,WAA8B,EAAE,WAAkC;IACxG,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAE7B,SAAS,kBAAkB,CAAC,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,CACA,iGAAiG,EACjG,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;QACb,MAAM,KAAK,GAAG,+CAA+C,CAAC;QAC9D,wBAAwB;QACxB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import {describe, it} from \"vitest\";\nimport type {TestFunction} from \"vitest\";\nimport {DataFactory} from \"rdf-data-factory\";\nimport {BaseQuad} from \"@rdfjs/types\";\n\ninterface Parser {\n parse: (query: string) => unknown;\n}\n\ntype ParserConstructor = (args?: {prefixes?: Record<string, string>, baseIRI?: string}) => Parser;\n\nexport function importSparql11NoteTests(constructor: ParserConstructor, dataFactory: DataFactory<BaseQuad>) {\n const parser = constructor();\n\n function testErroneousQuery(query: string, errorMsg: string): TestFunction<object> {\n return ({ expect }) => {\n let error: any = null;\n try {\n parser.parse(query);\n } catch (e) {\n error = e;\n }\n expect(error).not.toBeUndefined();\n expect(error).toBeInstanceOf(Error);\n // Expect(error.message).toContain(errorMsg);\n };\n }\n\n\n it('should throw an error on an invalid query', testErroneousQuery('invalid', 'Parse error on line 1'));\n\n it('should throw an error on a projection of ungrouped variable', testErroneousQuery(\n 'PREFIX : <http://www.example.org/> SELECT ?o WHERE { ?s ?p ?o } GROUP BY ?s',\n 'Projection of ungrouped variable (?o)',\n ));\n\n it('should throw an error on a values class with LESS variables than value', testErroneousQuery(\n 'SELECT * WHERE { } VALUES ( ?S ) { ( true false ) }',\n 'Number of dataBlockValues does not match number of variables. Too much values.',\n ));\n\n it('should throw an error on a values class with MORE variables than value', testErroneousQuery(\n 'SELECT * WHERE { } VALUES ( ?S ?O ) { ( true ) }',\n 'Number of dataBlockValues does not match number of variables. Too few values.',\n ));\n\n it('should NOT throw on a values class with correct amount of values', ({ expect }) => {\n const query = 'SELECT * WHERE { } VALUES ( ?S ) { ( true ) }';\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should throw an error on an invalid selectscope', testErroneousQuery(\n 'SELECT (1 AS ?X ) { SELECT (2 AS ?X ) {} }',\n 'Target id of \\'AS\\' (?X) already used in subquery',\n ));\n\n it('should throw an error on bind to variable in scope', testErroneousQuery(\n 'SELECT * { ?s ?p ?o BIND(?o AS ?o) }',\n 'Target id of \\'AS\\' (?X) already used in subquery',\n ));\n\n it('should preserve BGP and filter pattern order', ({ expect }) => {\n const query = 'SELECT * { ?s ?p \"1\" . FILTER(true) . ?s ?p \"2\" }';\n expect(parser.parse(query)).toMatchObject({\n where: [\n { type: 'bgp' },\n { type: 'filter' },\n { type: 'bgp' },\n ],\n });\n });\n\n it('should throw an error on an aggregate function within an aggregate function', testErroneousQuery(\n 'SELECT (SUM(COUNT(?lprice)) AS ?totalPrice) { }',\n 'An aggregate function is not allowed within an aggregate function',\n ));\n\n describe('with pre-defined prefixes', () => {\n const prefixes = { a: 'ex:abc#', b: 'ex:def#' };\n const parser = constructor({ prefixes });\n\n it('should use those prefixes', ({ expect }) => {\n const query = 'SELECT * { a:a b:b \"\" }';\n expect(parser.parse(query)).toMatchObject({\n where: [\n {\n triples: [\n {\n subject: dataFactory.namedNode('ex:abc#a'),\n predicate: dataFactory.namedNode('ex:def#b'),\n object: dataFactory.literal(''),\n },\n ],\n },\n ],\n });\n });\n\n it('should allow temporarily overriding prefixes', ({ expect }) => {\n const query = 'PREFIX a: <ex:xyz#> SELECT * { a:a b:b \"\" }';\n expect(parser.parse(query)).toMatchObject({\n where: [{\n triples: [{\n subject: dataFactory.namedNode('ex:xyz#a'),\n predicate: dataFactory.namedNode('ex:def#b'),\n object: dataFactory.literal(''),\n }],\n },\n ],\n });\n\n const query2 = 'SELECT * { a:a b:b \"\" }';\n expect(parser.parse(query2)).toMatchObject({\n where: [{\n triples: [{\n subject: dataFactory.namedNode('ex:abc#a'),\n predicate: dataFactory.namedNode('ex:def#b'),\n object: dataFactory.literal(''),\n }],\n },\n ],\n });\n });\n\n it('should not change the original prefixes', ({ expect }) => {\n expect(prefixes).toEqual({ a: 'ex:abc#', b: 'ex:def#' });\n });\n\n it('should not take over changes to the original prefixes', ({ expect }) => {\n const query = 'SELECT * { a:a b:b \"\" }';\n prefixes.a = 'ex:xyz#';\n expect(parser.parse(query)).toMatchObject({\n where: [{\n triples: [{\n subject: dataFactory.namedNode('ex:abc#a'),\n predicate: dataFactory.namedNode('ex:def#b'),\n object: dataFactory.literal(''),\n }],\n },\n ],\n });\n });\n });\n\n describe('with pre-defined base IRI', () => {\n const parser = constructor({ baseIRI: 'http://ex.org/' });\n\n it('contains the base', ({expect}) => {\n const query = 'SELECT * { ?s ?p ?o }';\n expect(parser.parse(query)).toMatchObject({\n base: 'http://ex.org/'\n });\n })\n\n it('using prefixed as relative iri', ({expect}) => {\n const parser = constructor({ baseIRI: 'http://ex.org/apl' });\n const query = `\nCONSTRUCT\nFROM <data.ttl>\nWHERE { ?s ?p ?o }\n`;\n expect(parser.parse(query)).toMatchObject({\n from: {\n default: [\n dataFactory.namedNode('http://ex.org/data.ttl'),\n ]\n }\n })\n\n })\n\n it('should use the base IRI', ({ expect }) => {\n const query = 'SELECT * { <> <#b> \"\" }';\n const result = {\n subject: dataFactory.namedNode('http://ex.org/'),\n predicate: dataFactory.namedNode('http://ex.org/#b'),\n object: dataFactory.literal(''),\n };\n\n expect(parser.parse(query)).toMatchObject({\n where: [{ triples: [ result ]}],\n });\n });\n\n it('should work after a previous query failed', ({ expect }) => {\n const badQuery = 'SELECT * { <> <#b> \"\" } invalid!';\n expect(() => parser.parse(badQuery)).toThrow(Error);\n\n const goodQuery = 'SELECT * { <> <#b> \"\" }';\n\n const parser = constructor({ baseIRI: 'http://ex2.org/' });\n const result = {\n subject: dataFactory.namedNode('http://ex2.org/'),\n predicate: dataFactory.namedNode('http://ex2.org/#b'),\n object: dataFactory.literal(''),\n };\n const data = parser.parse(goodQuery);\n expect(data).toMatchObject({\n where: [{ triples: [ result ]}],\n });\n });\n });\n\n it('should throw an error on relative IRIs if no base IRI is specified', testErroneousQuery(\n 'SELECT * { <a> <b> <c> }',\n 'Cannot resolve relative IRI a because no base IRI was set.',\n ));\n\n describe('with group collapsing disabled', () => {\n it('should keep explicit pattern group', ({ expect }) => {\n const query = 'SELECT * WHERE { { ?s ?p ?o } ?a ?b ?c }';\n const result = [\n {\n type: 'group',\n patterns: [\n {\n type: 'bgp',\n triples: [\n {\n subject: dataFactory.variable('s'),\n predicate: dataFactory.variable('p'),\n object: dataFactory.variable('o'),\n },\n ],\n },\n ],\n },\n {\n type: 'bgp',\n triples: [\n {\n subject: dataFactory.variable('a'),\n predicate: dataFactory.variable('b'),\n object: dataFactory.variable('c'),\n },\n ],\n },\n ];\n\n expect(parser.parse(query)).toMatchObject({ where: result });\n });\n\n it('should still collapse immediate union groups', ({ expect }) => {\n const query = 'SELECT * WHERE { { ?s ?p ?o } UNION { ?a ?b ?c } }';\n\n const result = [\n {\n type: 'union',\n patterns: [{\n type: 'bgp',\n triples: [{\n subject: {\n termType: 'Variable',\n value: 's',\n },\n predicate: {\n termType: 'Variable',\n value: 'p',\n },\n object: {\n termType: 'Variable',\n value: 'o',\n },\n }],\n }, {\n type: 'bgp',\n triples: [{\n subject: {\n termType: 'Variable',\n value: 'a',\n },\n predicate: {\n termType: 'Variable',\n value: 'b',\n },\n object: {\n termType: 'Variable',\n value: 'c',\n },\n }],\n }],\n },\n ];\n\n expect(parser.parse(query)).toMatchObject({ where: result });\n });\n });\n\n describe('for update queries', () => {\n it('should throw an error on blank nodes in DELETE clause', testErroneousQuery(\n 'DELETE { ?a <ex:knows> [] . } WHERE { ?a <ex:knows> \"Alan\" . }',\n 'Detected illegal blank node in BGP',\n ));\n\n it('should not throw on blank nodes in INSERT clause', ({ expect }) => {\n const query = 'INSERT { ?a <ex:knows> [] . } WHERE { ?a <ex:knows> \"Alan\" . }';\n // TODO: add proper test\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should throw an error on blank nodes in compact DELETE clause', testErroneousQuery(\n 'DELETE WHERE { _:a <ex:p> <ex:o> }',\n 'Detected illegal blank node in BGP',\n ));\n\n it('should throw an error on variables in DELETE DATA clause', testErroneousQuery(\n 'DELETE DATA { ?a <ex:p> <ex:o> }',\n 'Detected illegal variable in BGP',\n ));\n\n it('should throw an error on blank nodes in DELETE DATA clause', testErroneousQuery(\n 'DELETE DATA { _:a <ex:p> <ex:o> }',\n 'Detected illegal blank node in BGP',\n ));\n\n it('should throw an error on variables in DELETE DATA clause with GRAPH', testErroneousQuery(\n 'DELETE DATA { GRAPH ?a { <ex:s> <ex:p> <ex:o> } }',\n 'Detected illegal variable in GRAPH',\n ));\n\n it('should throw an error on variables in INSERT DATA clause', testErroneousQuery(\n 'INSERT DATA { ?a <ex:p> <ex:o> }',\n 'Detected illegal variable in BGP',\n ));\n\n it('should not throw on reused blank nodes in one INSERT DATA clause', ({ expect }) => {\n const query = 'INSERT DATA { _:a <ex:p> <ex:o> . _:a <ex:p> <ex:o> . }';\n // Todo: add proper test\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should throw an error on reused blank nodes across INSERT DATA clauses', testErroneousQuery(\n 'INSERT DATA { _:a <ex:p> <ex:o> }; INSERT DATA { _:a <ex:p> <ex:o> }',\n 'Detected reuse blank node across different INSERT DATA clauses',\n ));\n\n it('should throw an error on reused blank nodes across INSERT DATA clauses with GRAPH', testErroneousQuery(\n 'INSERT DATA { _:a <ex:p> <ex:o> }; INSERT DATA { GRAPH <ex:g> { _:a <ex:p> <ex:o> } }',\n 'Detected reuse blank node across different INSERT DATA clauses',\n ));\n\n it('should not throw on comment between INSERT and DATA', ({ expect }) => {\n const query = `INSERT\n# Comment\nDATA { GRAPH <ex:G> { <ex:s> <ex:p> 'o1', 'o2', 'o3' } }`;\n // TODO: add proper test\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should not throw on comment after INSERT that could be confused with DATA', ({ expect }) => {\n const query = `INSERT # DATA\nDATA { GRAPH <ex:G> { <ex:s> <ex:p> 'o1', 'o2', 'o3' } }`;\n // TODO: add proper test\n expect(parser.parse(query)).toMatchObject({});\n });\n\n it('should throw an error on commented DATA after INSERT', testErroneousQuery(\n 'INSERT # DATA { GRAPH <ex:G> { <ex:s> <ex:p> \\'o1\\', \\'o2\\', \\'o3\\' } }',\n 'Parse error',\n ));\n });\n\n it('should throw an error on unicode codepoint escaping in literal with partial surrogate pair', testErroneousQuery(\n 'SELECT * WHERE { ?s <ex:p> \\'\\uD800\\' }',\n 'Invalid unicode codepoint of surrogate pair without corresponding codepoint',\n ));\n\n it(\n 'should not throw an error on unicode codepoint escaping in literal with complete surrogate pair',\n ({ expect }) => {\n const query = 'SELECT * WHERE { ?s <ex:p> \\'\\uD800\\uDFFF\\' }';\n // TODO: add proper test\n expect(parser.parse(query)).toMatchObject({});\n },\n );\n}"]}
package/lib/index.cjs CHANGED
@@ -7195,6 +7195,21 @@ function importSparql11NoteTests(constructor, dataFactory) {
7195
7195
  base: "http://ex.org/"
7196
7196
  });
7197
7197
  });
7198
+ it("using prefixed as relative iri", ({ expect: expect2 }) => {
7199
+ const parser3 = constructor({ baseIRI: "http://ex.org/apl" });
7200
+ const query = `
7201
+ CONSTRUCT
7202
+ FROM <data.ttl>
7203
+ WHERE { ?s ?p ?o }
7204
+ `;
7205
+ expect2(parser3.parse(query)).toMatchObject({
7206
+ from: {
7207
+ default: [
7208
+ dataFactory.namedNode("http://ex.org/data.ttl")
7209
+ ]
7210
+ }
7211
+ });
7212
+ });
7198
7213
  it("should use the base IRI", ({ expect: expect2 }) => {
7199
7214
  const query = 'SELECT * { <> <#b> "" }';
7200
7215
  const result = {
@@ -0,0 +1,11 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "termType": "NamedNode",
5
+ "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
6
+ }
7
+ ],
8
+ "pathType": "*",
9
+ "prefixes": {},
10
+ "type": "path"
11
+ }
@@ -0,0 +1 @@
1
+ a*
@@ -12,13 +12,13 @@
12
12
  },
13
13
  "object": {
14
14
  "termType": "BlankNode",
15
- "value": "g_1"
15
+ "value": "g_0"
16
16
  }
17
17
  },
18
18
  {
19
19
  "subject": {
20
20
  "termType": "BlankNode",
21
- "value": "g_1"
21
+ "value": "g_0"
22
22
  },
23
23
  "predicate": {
24
24
  "termType": "NamedNode",
@@ -26,13 +26,13 @@
26
26
  },
27
27
  "object": {
28
28
  "termType": "BlankNode",
29
- "value": "g_0"
29
+ "value": "g_1"
30
30
  }
31
31
  },
32
32
  {
33
33
  "subject": {
34
34
  "termType": "BlankNode",
35
- "value": "g_0"
35
+ "value": "g_1"
36
36
  },
37
37
  "predicate": {
38
38
  "termType": "NamedNode",
@@ -46,7 +46,7 @@
46
46
  {
47
47
  "subject": {
48
48
  "termType": "BlankNode",
49
- "value": "g_3"
49
+ "value": "g_2"
50
50
  },
51
51
  "predicate": {
52
52
  "termType": "Variable",
@@ -60,7 +60,7 @@
60
60
  {
61
61
  "subject": {
62
62
  "termType": "BlankNode",
63
- "value": "g_3"
63
+ "value": "g_2"
64
64
  },
65
65
  "predicate": {
66
66
  "termType": "NamedNode",
@@ -68,13 +68,13 @@
68
68
  },
69
69
  "object": {
70
70
  "termType": "BlankNode",
71
- "value": "g_2"
71
+ "value": "g_3"
72
72
  }
73
73
  },
74
74
  {
75
75
  "subject": {
76
76
  "termType": "BlankNode",
77
- "value": "g_2"
77
+ "value": "g_3"
78
78
  },
79
79
  "predicate": {
80
80
  "termType": "NamedNode",
@@ -255,13 +255,13 @@
255
255
  },
256
256
  "object": {
257
257
  "termType": "BlankNode",
258
- "value": "g_9"
258
+ "value": "g_8"
259
259
  }
260
260
  },
261
261
  {
262
262
  "subject": {
263
263
  "termType": "BlankNode",
264
- "value": "g_9"
264
+ "value": "g_8"
265
265
  },
266
266
  "predicate": {
267
267
  "termType": "NamedNode",
@@ -269,13 +269,13 @@
269
269
  },
270
270
  "object": {
271
271
  "termType": "BlankNode",
272
- "value": "g_8"
272
+ "value": "g_9"
273
273
  }
274
274
  },
275
275
  {
276
276
  "subject": {
277
277
  "termType": "BlankNode",
278
- "value": "g_8"
278
+ "value": "g_9"
279
279
  },
280
280
  "predicate": {
281
281
  "termType": "NamedNode",
@@ -289,7 +289,7 @@
289
289
  {
290
290
  "subject": {
291
291
  "termType": "BlankNode",
292
- "value": "g_11"
292
+ "value": "g_10"
293
293
  },
294
294
  "predicate": {
295
295
  "termType": "Variable",
@@ -303,7 +303,7 @@
303
303
  {
304
304
  "subject": {
305
305
  "termType": "BlankNode",
306
- "value": "g_11"
306
+ "value": "g_10"
307
307
  },
308
308
  "predicate": {
309
309
  "termType": "NamedNode",
@@ -311,13 +311,13 @@
311
311
  },
312
312
  "object": {
313
313
  "termType": "BlankNode",
314
- "value": "g_10"
314
+ "value": "g_11"
315
315
  }
316
316
  },
317
317
  {
318
318
  "subject": {
319
319
  "termType": "BlankNode",
320
- "value": "g_10"
320
+ "value": "g_11"
321
321
  },
322
322
  "predicate": {
323
323
  "termType": "NamedNode",
@@ -48,13 +48,13 @@
48
48
  },
49
49
  "object": {
50
50
  "termType": "BlankNode",
51
- "value": "g_1"
51
+ "value": "g_0"
52
52
  }
53
53
  },
54
54
  {
55
55
  "subject": {
56
56
  "termType": "BlankNode",
57
- "value": "g_1"
57
+ "value": "g_0"
58
58
  },
59
59
  "predicate": {
60
60
  "termType": "NamedNode",
@@ -68,7 +68,7 @@
68
68
  {
69
69
  "subject": {
70
70
  "termType": "BlankNode",
71
- "value": "g_1"
71
+ "value": "g_0"
72
72
  },
73
73
  "predicate": {
74
74
  "termType": "NamedNode",
@@ -76,13 +76,13 @@
76
76
  },
77
77
  "object": {
78
78
  "termType": "BlankNode",
79
- "value": "g_0"
79
+ "value": "g_1"
80
80
  }
81
81
  },
82
82
  {
83
83
  "subject": {
84
84
  "termType": "BlankNode",
85
- "value": "g_0"
85
+ "value": "g_1"
86
86
  },
87
87
  "predicate": {
88
88
  "termType": "NamedNode",
@@ -96,7 +96,7 @@
96
96
  {
97
97
  "subject": {
98
98
  "termType": "BlankNode",
99
- "value": "g_0"
99
+ "value": "g_1"
100
100
  },
101
101
  "predicate": {
102
102
  "termType": "NamedNode",
@@ -110,7 +110,7 @@
110
110
  {
111
111
  "subject": {
112
112
  "termType": "BlankNode",
113
- "value": "g_0"
113
+ "value": "g_1"
114
114
  },
115
115
  "predicate": {
116
116
  "termType": "NamedNode",
@@ -124,7 +124,7 @@
124
124
  {
125
125
  "subject": {
126
126
  "termType": "BlankNode",
127
- "value": "g_1"
127
+ "value": "g_0"
128
128
  },
129
129
  "predicate": {
130
130
  "termType": "NamedNode",
@@ -28,7 +28,7 @@
28
28
  {
29
29
  "subject": {
30
30
  "termType": "BlankNode",
31
- "value": "g_1"
31
+ "value": "g_0"
32
32
  },
33
33
  "predicate": {
34
34
  "termType": "Variable",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "object": {
38
38
  "termType": "BlankNode",
39
- "value": "g_0"
39
+ "value": "g_1"
40
40
  }
41
41
  }
42
42
  ]
@@ -66,20 +66,6 @@
66
66
  "value": "g_1"
67
67
  }
68
68
  },
69
- {
70
- "subject": {
71
- "termType": "Variable",
72
- "value": "s"
73
- },
74
- "predicate": {
75
- "termType": "NamedNode",
76
- "value": "http://example/id/p2"
77
- },
78
- "object": {
79
- "termType": "Variable",
80
- "value": "_"
81
- }
82
- },
83
69
  {
84
70
  "subject": {
85
71
  "termType": "BlankNode",
@@ -100,6 +86,20 @@
100
86
  "value": "o"
101
87
  }
102
88
  },
89
+ {
90
+ "subject": {
91
+ "termType": "Variable",
92
+ "value": "s"
93
+ },
94
+ "predicate": {
95
+ "termType": "NamedNode",
96
+ "value": "http://example/id/p2"
97
+ },
98
+ "object": {
99
+ "termType": "Variable",
100
+ "value": "_"
101
+ }
102
+ },
103
103
  {
104
104
  "subject": {
105
105
  "termType": "Variable",
@@ -27,7 +27,7 @@
27
27
  {
28
28
  "subject": {
29
29
  "termType": "BlankNode",
30
- "value": "g_1"
30
+ "value": "g_0"
31
31
  },
32
32
  "predicate": {
33
33
  "termType": "Variable",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "object": {
37
37
  "termType": "BlankNode",
38
- "value": "g_0"
38
+ "value": "g_1"
39
39
  }
40
40
  }
41
41
  ]
@@ -39,13 +39,13 @@
39
39
  },
40
40
  "object": {
41
41
  "termType": "BlankNode",
42
- "value": "g_1"
42
+ "value": "g_0"
43
43
  }
44
44
  },
45
45
  {
46
46
  "subject": {
47
47
  "termType": "BlankNode",
48
- "value": "g_1"
48
+ "value": "g_0"
49
49
  },
50
50
  "predicate": {
51
51
  "termType": "NamedNode",
@@ -53,13 +53,13 @@
53
53
  },
54
54
  "object": {
55
55
  "termType": "BlankNode",
56
- "value": "g_0"
56
+ "value": "g_1"
57
57
  }
58
58
  },
59
59
  {
60
60
  "subject": {
61
61
  "termType": "BlankNode",
62
- "value": "g_0"
62
+ "value": "g_1"
63
63
  },
64
64
  "predicate": {
65
65
  "termType": "NamedNode",
@@ -29,7 +29,7 @@
29
29
  "value": "",
30
30
  "subject": {
31
31
  "termType": "BlankNode",
32
- "value": "g_2"
32
+ "value": "g_0"
33
33
  },
34
34
  "predicate": {
35
35
  "termType": "NamedNode",
@@ -63,26 +63,12 @@
63
63
  {
64
64
  "subject": {
65
65
  "termType": "BlankNode",
66
- "value": "g_2"
66
+ "value": "g_0"
67
67
  },
68
68
  "predicate": {
69
69
  "termType": "NamedNode",
70
70
  "value": "http://example.com/ns#source"
71
71
  },
72
- "object": {
73
- "termType": "BlankNode",
74
- "value": "g_0"
75
- }
76
- },
77
- {
78
- "subject": {
79
- "termType": "BlankNode",
80
- "value": "g_2"
81
- },
82
- "predicate": {
83
- "termType": "Variable",
84
- "value": "source"
85
- },
86
72
  "object": {
87
73
  "termType": "BlankNode",
88
74
  "value": "g_1"
@@ -99,7 +85,7 @@
99
85
  },
100
86
  "object": {
101
87
  "termType": "NamedNode",
102
- "value": "http://host2/"
88
+ "value": "http://host1/"
103
89
  }
104
90
  },
105
91
  {
@@ -113,7 +99,7 @@
113
99
  },
114
100
  "object": {
115
101
  "termType": "Literal",
116
- "value": "2020-12-31",
102
+ "value": "2020-01-20",
117
103
  "language": "",
118
104
  "datatype": {
119
105
  "termType": "NamedNode",
@@ -127,19 +113,33 @@
127
113
  "termType": "BlankNode",
128
114
  "value": "g_0"
129
115
  },
116
+ "predicate": {
117
+ "termType": "Variable",
118
+ "value": "source"
119
+ },
120
+ "object": {
121
+ "termType": "BlankNode",
122
+ "value": "g_2"
123
+ }
124
+ },
125
+ {
126
+ "subject": {
127
+ "termType": "BlankNode",
128
+ "value": "g_2"
129
+ },
130
130
  "predicate": {
131
131
  "termType": "NamedNode",
132
132
  "value": "http://example.com/ns#graph"
133
133
  },
134
134
  "object": {
135
135
  "termType": "NamedNode",
136
- "value": "http://host1/"
136
+ "value": "http://host2/"
137
137
  }
138
138
  },
139
139
  {
140
140
  "subject": {
141
141
  "termType": "BlankNode",
142
- "value": "g_0"
142
+ "value": "g_2"
143
143
  },
144
144
  "predicate": {
145
145
  "termType": "NamedNode",
@@ -147,7 +147,7 @@
147
147
  },
148
148
  "object": {
149
149
  "termType": "Literal",
150
- "value": "2020-01-20",
150
+ "value": "2020-12-31",
151
151
  "language": "",
152
152
  "datatype": {
153
153
  "termType": "NamedNode",
@@ -65,7 +65,7 @@
65
65
  "value": "",
66
66
  "subject": {
67
67
  "termType": "BlankNode",
68
- "value": "g_2"
68
+ "value": "g_1"
69
69
  },
70
70
  "predicate": {
71
71
  "termType": "NamedNode",
@@ -99,7 +99,7 @@
99
99
  {
100
100
  "subject": {
101
101
  "termType": "BlankNode",
102
- "value": "g_2"
102
+ "value": "g_1"
103
103
  },
104
104
  "predicate": {
105
105
  "termType": "Variable",
@@ -107,7 +107,7 @@
107
107
  },
108
108
  "object": {
109
109
  "termType": "BlankNode",
110
- "value": "g_1"
110
+ "value": "g_2"
111
111
  }
112
112
  },
113
113
  {
@@ -115,7 +115,7 @@
115
115
  "value": "",
116
116
  "subject": {
117
117
  "termType": "BlankNode",
118
- "value": "g_1"
118
+ "value": "g_2"
119
119
  },
120
120
  "predicate": {
121
121
  "termType": "NamedNode",
@@ -29,7 +29,7 @@
29
29
  "value": "",
30
30
  "subject": {
31
31
  "termType": "BlankNode",
32
- "value": "g_1"
32
+ "value": "g_0"
33
33
  },
34
34
  "predicate": {
35
35
  "termType": "NamedNode",
@@ -63,7 +63,7 @@
63
63
  {
64
64
  "subject": {
65
65
  "termType": "BlankNode",
66
- "value": "g_1"
66
+ "value": "g_0"
67
67
  },
68
68
  "predicate": {
69
69
  "termType": "NamedNode",
@@ -71,13 +71,13 @@
71
71
  },
72
72
  "object": {
73
73
  "termType": "BlankNode",
74
- "value": "g_0"
74
+ "value": "g_1"
75
75
  }
76
76
  },
77
77
  {
78
78
  "subject": {
79
79
  "termType": "BlankNode",
80
- "value": "g_0"
80
+ "value": "g_1"
81
81
  },
82
82
  "predicate": {
83
83
  "type": "path",
@@ -74,24 +74,10 @@
74
74
  "value": "g_0"
75
75
  }
76
76
  },
77
- {
78
- "subject": {
79
- "termType": "NamedNode",
80
- "value": "http://example.com/ns#iri"
81
- },
82
- "predicate": {
83
- "termType": "Variable",
84
- "value": "source"
85
- },
86
- "object": {
87
- "termType": "BlankNode",
88
- "value": "g_1"
89
- }
90
- },
91
77
  {
92
78
  "subject": {
93
79
  "termType": "BlankNode",
94
- "value": "g_1"
80
+ "value": "g_0"
95
81
  },
96
82
  "predicate": {
97
83
  "termType": "NamedNode",
@@ -99,13 +85,13 @@
99
85
  },
100
86
  "object": {
101
87
  "termType": "NamedNode",
102
- "value": "http://host2/"
88
+ "value": "http://host1/"
103
89
  }
104
90
  },
105
91
  {
106
92
  "subject": {
107
93
  "termType": "BlankNode",
108
- "value": "g_1"
94
+ "value": "g_0"
109
95
  },
110
96
  "predicate": {
111
97
  "termType": "NamedNode",
@@ -113,7 +99,7 @@
113
99
  },
114
100
  "object": {
115
101
  "termType": "Literal",
116
- "value": "2020-12-31",
102
+ "value": "2020-01-20",
117
103
  "language": "",
118
104
  "datatype": {
119
105
  "termType": "NamedNode",
@@ -124,8 +110,22 @@
124
110
  },
125
111
  {
126
112
  "subject": {
113
+ "termType": "NamedNode",
114
+ "value": "http://example.com/ns#iri"
115
+ },
116
+ "predicate": {
117
+ "termType": "Variable",
118
+ "value": "source"
119
+ },
120
+ "object": {
127
121
  "termType": "BlankNode",
128
- "value": "g_0"
122
+ "value": "g_1"
123
+ }
124
+ },
125
+ {
126
+ "subject": {
127
+ "termType": "BlankNode",
128
+ "value": "g_1"
129
129
  },
130
130
  "predicate": {
131
131
  "termType": "NamedNode",
@@ -133,13 +133,13 @@
133
133
  },
134
134
  "object": {
135
135
  "termType": "NamedNode",
136
- "value": "http://host1/"
136
+ "value": "http://host2/"
137
137
  }
138
138
  },
139
139
  {
140
140
  "subject": {
141
141
  "termType": "BlankNode",
142
- "value": "g_0"
142
+ "value": "g_1"
143
143
  },
144
144
  "predicate": {
145
145
  "termType": "NamedNode",
@@ -147,7 +147,7 @@
147
147
  },
148
148
  "object": {
149
149
  "termType": "Literal",
150
- "value": "2020-01-20",
150
+ "value": "2020-12-31",
151
151
  "language": "",
152
152
  "datatype": {
153
153
  "termType": "NamedNode",
@@ -13,7 +13,7 @@
13
13
  {
14
14
  "subject": {
15
15
  "termType": "BlankNode",
16
- "value": "g_1"
16
+ "value": "g_0"
17
17
  },
18
18
  "predicate": {
19
19
  "termType": "NamedNode",
@@ -27,7 +27,7 @@
27
27
  {
28
28
  "subject": {
29
29
  "termType": "BlankNode",
30
- "value": "g_1"
30
+ "value": "g_0"
31
31
  },
32
32
  "predicate": {
33
33
  "termType": "Variable",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "object": {
37
37
  "termType": "BlankNode",
38
- "value": "g_0"
38
+ "value": "g_1"
39
39
  }
40
40
  },
41
41
  {
@@ -43,7 +43,7 @@
43
43
  "value": "",
44
44
  "subject": {
45
45
  "termType": "BlankNode",
46
- "value": "g_0"
46
+ "value": "g_1"
47
47
  },
48
48
  "predicate": {
49
49
  "termType": "NamedNode",
@@ -63,7 +63,7 @@
63
63
  "value": "",
64
64
  "subject": {
65
65
  "termType": "BlankNode",
66
- "value": "g_2"
66
+ "value": "g_1"
67
67
  },
68
68
  "predicate": {
69
69
  "termType": "NamedNode",
@@ -97,7 +97,7 @@
97
97
  {
98
98
  "subject": {
99
99
  "termType": "BlankNode",
100
- "value": "g_2"
100
+ "value": "g_1"
101
101
  },
102
102
  "predicate": {
103
103
  "termType": "Variable",
@@ -105,7 +105,7 @@
105
105
  },
106
106
  "object": {
107
107
  "termType": "BlankNode",
108
- "value": "g_1"
108
+ "value": "g_2"
109
109
  }
110
110
  },
111
111
  {
@@ -113,7 +113,7 @@
113
113
  "value": "",
114
114
  "subject": {
115
115
  "termType": "BlankNode",
116
- "value": "g_1"
116
+ "value": "g_2"
117
117
  },
118
118
  "predicate": {
119
119
  "termType": "NamedNode",
@@ -206,7 +206,7 @@
206
206
  "value": "",
207
207
  "subject": {
208
208
  "termType": "BlankNode",
209
- "value": "g_5"
209
+ "value": "g_4"
210
210
  },
211
211
  "predicate": {
212
212
  "termType": "NamedNode",
@@ -240,7 +240,7 @@
240
240
  {
241
241
  "subject": {
242
242
  "termType": "BlankNode",
243
- "value": "g_5"
243
+ "value": "g_4"
244
244
  },
245
245
  "predicate": {
246
246
  "termType": "Variable",
@@ -248,7 +248,7 @@
248
248
  },
249
249
  "object": {
250
250
  "termType": "BlankNode",
251
- "value": "g_4"
251
+ "value": "g_5"
252
252
  }
253
253
  },
254
254
  {
@@ -256,7 +256,7 @@
256
256
  "value": "",
257
257
  "subject": {
258
258
  "termType": "BlankNode",
259
- "value": "g_4"
259
+ "value": "g_5"
260
260
  },
261
261
  "predicate": {
262
262
  "termType": "NamedNode",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@traqula/test-utils",
3
- "version": "0.0.1-alpha.141+caaf4c7",
3
+ "version": "0.0.1-alpha.145+b7fd73e",
4
4
  "description": "Test utils used by the TRAQULA monorepo",
5
5
  "lsd:module": true,
6
6
  "license": "MIT",
@@ -39,12 +39,12 @@
39
39
  "build:transpile": " node \"../../node_modules/esbuild/bin/esbuild\" --platform=node --format=cjs --bundle --log-level=error --outfile=lib/index.cjs lib/index.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@traqula/core": "^0.0.1-alpha.141+caaf4c7",
42
+ "@traqula/core": "^0.0.1-alpha.145+b7fd73e",
43
43
  "rdf-data-factory": "^2.0.1",
44
44
  "vitest": "^2.1.8"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@rdfjs/types": "^2.0.0"
48
48
  },
49
- "gitHead": "caaf4c71153d27f8fa113b51efb1dae91e182960"
49
+ "gitHead": "b7fd73efdfc32dec46beaa040431ba031a723b53"
50
50
  }
File without changes
File without changes