Skip to content

Commit 0c60e4c

Browse files
committed
Merge pull request #241 from wooldridge/github-issue-237-defaultGraphs
correctly handle default graphs in multi-param sparql()
2 parents 8434234 + a67e0c6 commit 0c60e4c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/graphs.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ Graphs.prototype.sparql = function queryGraphSPARQL() {
607607

608608
// TODO: collection, directory?
609609

610+
// Single configuration object
610611
if (argLen === 1) {
611612
var params = args[0];
612613
acceptType = params.contentType;
@@ -626,9 +627,11 @@ Graphs.prototype.sparql = function queryGraphSPARQL() {
626627
if ((acceptType == null) || (query == null)) {
627628
throw new Error('named parameters must specify content type and query for SPARQL query on graphs');
628629
}
629-
} else {
630+
}
631+
// Multiple params
632+
else {
630633
acceptType = args[0];
631-
if (argLen > 3) {
634+
if (argLen >= 3) {
632635
defaultGraphs = Array.prototype.slice.call(arguments, 1, argLen - 1);
633636
}
634637
query = args[argLen - 1];

0 commit comments

Comments
 (0)