sparqlalgebrajs
Advanced tools
Comparing version 0.7.2 to 0.7.3
@@ -16,3 +16,6 @@ "use strict"; | ||
op = removeQuads(op); | ||
return translateOperation(op); | ||
let result = translateOperation(op); | ||
if (result.type === 'group') | ||
return result.patterns[0]; | ||
return result; | ||
} | ||
@@ -126,2 +129,7 @@ exports.toSparqlJs = toSparqlJs; | ||
function translateOperatorExpression(expr) { | ||
if (expr.operator === 'desc') { | ||
let result = { expression: translateExpression(expr.args[0]) }; | ||
result.descending = true; | ||
return result; | ||
} | ||
let result = { | ||
@@ -166,3 +174,4 @@ type: 'operation', | ||
let result = translateOperation(op.input); | ||
result.distinct = true; | ||
// project is nested in group object | ||
result.patterns[0].distinct = true; | ||
return result; | ||
@@ -335,4 +344,5 @@ } | ||
}); | ||
// descending expressions will already be in the correct format due to the structure of those | ||
if (context.order.length > 0) | ||
result.order = context.order.map(translateOperation).map(o => ({ expression: o })); | ||
result.order = context.order.map(translateOperation).map(o => o.descending ? o : ({ expression: o })); | ||
// this needs to happen after the group because it might depend on variables generated there | ||
@@ -365,2 +375,4 @@ if (result.variables) { | ||
context.order = order; | ||
// subqueries need to be in a group | ||
result = { type: 'group', patterns: [result] }; | ||
return result; | ||
@@ -377,3 +389,4 @@ } | ||
let result = translateOperation(op.input); | ||
result.reduced = true; | ||
// project is nested in group object | ||
result.patterns[0].reduced = true; | ||
return result; | ||
@@ -383,6 +396,8 @@ } | ||
let result = translateOperation(op.input); | ||
// project is nested in group object | ||
let obj = result.patterns[0]; | ||
if (op.start !== 0) | ||
result.offset = op.start; | ||
obj.offset = op.start; | ||
if (op.length !== undefined) | ||
result.limit = op.length; | ||
obj.limit = op.length; | ||
return result; | ||
@@ -389,0 +404,0 @@ } |
{ | ||
"name": "sparqlalgebrajs", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "Convert SPARQL to SPARL algebra", | ||
@@ -16,3 +16,4 @@ "author": "Joachim Van Herwegen", | ||
"rdf-data-model": "^1.0.0", | ||
"sparqljs": "^2.0.2" | ||
"rdf-string": "^1.1.1", | ||
"sparqljs": "^2.0.3" | ||
}, | ||
@@ -19,0 +20,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57275
1419
8
5
+ Addedrdf-string@^1.1.1
+ Added@rdfjs/types@1.1.2(transitive)
+ Added@types/node@22.9.0(transitive)
+ Addedrdf-data-factory@1.1.2(transitive)
+ Addedrdf-string@1.6.3(transitive)
+ Addedundici-types@6.19.8(transitive)
Updatedsparqljs@^2.0.3