sparqlalgebrajs
Advanced tools
Comparing version 4.3.3 to 4.3.4
@@ -178,2 +178,12 @@ "use strict"; | ||
} | ||
function arrayToPattern(input) { | ||
if (!Array.isArray(input)) | ||
return input; | ||
if (input.length === 1) | ||
return input[0]; | ||
return { | ||
type: 'group', | ||
patterns: input, | ||
}; | ||
} | ||
// ------------------------- OPERATIONS ------------------------- | ||
@@ -477,3 +487,3 @@ // these get translated in the project function | ||
type: 'union', | ||
patterns: util_1.default.flatten(op.input.map(translateOperation)) | ||
patterns: op.input.map(translateOperation).map(arrayToPattern), | ||
}; | ||
@@ -610,7 +620,7 @@ } | ||
let where = op.where; | ||
let using = undefined; | ||
let use = undefined; | ||
if (where && where.type === types.FROM) { | ||
let from = where; | ||
where = from.input; | ||
using = { default: from.default, named: from.named }; | ||
use = { default: from.default, named: from.named }; | ||
} | ||
@@ -623,4 +633,4 @@ const updates = [{ | ||
// Typings don't support 'using' yet | ||
if (using) | ||
updates[0].using = using; | ||
if (use) | ||
updates[0].using = use; | ||
// corresponds to empty array in SPARQL.js | ||
@@ -627,0 +637,0 @@ if (!where || (where.type === types.BGP && where.patterns.length === 0)) |
@@ -671,5 +671,5 @@ "use strict"; | ||
// Wrong typings, see test "using" in Sparql.js | ||
const using = thingy.using; | ||
if (using) | ||
where = factory.createFrom(where, using.default, using.named); | ||
const use = thingy.using; | ||
if (use) | ||
where = factory.createFrom(where, use.default, use.named); | ||
else if (thingy.graph) | ||
@@ -676,0 +676,0 @@ // This is equivalent |
{ | ||
"name": "sparqlalgebrajs", | ||
"version": "4.3.3", | ||
"version": "4.3.4", | ||
"description": "Convert SPARQL to SPARQL algebra", | ||
@@ -5,0 +5,0 @@ "author": "Joachim Van Herwegen", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
327958
2883