From f6090a03712c85d5b7be1577c4c669298fa664de Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Sun, 10 Mar 2019 00:50:53 +0100 Subject: [PATCH 01/46] Added dependency on N3 Passing N3.DataFactory into the Parser constructor jison grammar terms wrapped into DataFactory calls --- lib/sparql.jison | 25 +++++++++++++------------ sparql.js | 4 +++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index 42ea9617..392d7193 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -89,8 +89,7 @@ function toVar(variable) { if (variable) { var first = variable[0]; - if (first === '?') return variable; - if (first === '$') return '?' + variable.substr(1); + if (first === '?' || first === '$') return Parser.factory.variable(variable.substr(1)); } return variable; } @@ -141,7 +140,7 @@ // Creates a literal with the given value and type function createLiteral(value, type) { - return '"' + value + '"^^' + type; + return Parser.factory.literal(value, Parser.factory.namedNode(type)); } // Creates a triple with the given subject, predicate, and object @@ -815,14 +814,14 @@ Literal | DOUBLE -> createLiteral(lowercase($1), XSD_DOUBLE) | NumericLiteralPositive | NumericLiteralNegative - | 'true' -> XSD_TRUE - | 'false' -> XSD_FALSE + | 'true' -> createLiteral('true', XSD_BOOLEAN) + | 'false' -> createLiteral('false', XSD_BOOLEAN) ; String - : STRING_LITERAL1 -> unescapeString($1, 1) - | STRING_LITERAL2 -> unescapeString($1, 1) - | STRING_LITERAL_LONG1 -> unescapeString($1, 3) - | STRING_LITERAL_LONG2 -> unescapeString($1, 3) + : STRING_LITERAL1 -> Parser.factory.literal(unescapeString($1, 1)) + | STRING_LITERAL2 -> Parser.factory.literal(unescapeString($1, 1)) + | STRING_LITERAL_LONG1 -> Parser.factory.literal(unescapeString($1, 3)) + | STRING_LITERAL_LONG2 -> Parser.factory.literal(unescapeString($1, 3)) ; NumericLiteralPositive : INTEGER_POSITIVE -> createLiteral($1.substr(1), XSD_INTEGER) @@ -835,19 +834,21 @@ NumericLiteralNegative | DOUBLE_NEGATIVE -> createLiteral(lowercase($1), XSD_DOUBLE) ; iri - : IRIREF -> resolveIRI($1) + : IRIREF -> Parser.factory.namedNode(resolveIRI($1)) | PNAME_LN { var namePos = $1.indexOf(':'), prefix = $1.substr(0, namePos), expansion = Parser.prefixes[prefix]; if (!expansion) throw new Error('Unknown prefix: ' + prefix); - $$ = resolveIRI(expansion + $1.substr(namePos + 1)); + var uriString = resolveIRI(expansion + $1.substr(namePos + 1)); + $$ = Parser.factory.namedNode(uriString); } | PNAME_NS { $1 = $1.substr(0, $1.length - 1); if (!($1 in Parser.prefixes)) throw new Error('Unknown prefix: ' + $1); - $$ = resolveIRI(Parser.prefixes[$1]); + var uriString = resolveIRI(Parser.prefixes[$1]); + $$ = Parser.factory.namedNode(uriString); } ; diff --git a/sparql.js b/sparql.js index af105aff..d1dd94fb 100644 --- a/sparql.js +++ b/sparql.js @@ -1,5 +1,6 @@ var Parser = require('./lib/SparqlParser').Parser; var Generator = require('./lib/SparqlGenerator'); +var N3 = require('n3'); module.exports = { /** @@ -7,7 +8,7 @@ module.exports = { * @param prefixes { [prefix: string]: string } * @param baseIRI string */ - Parser: function (prefixes, baseIRI) { + Parser: function (prefixes, baseIRI, factory) { // Create a copy of the prefixes var prefixesCopy = {}; for (var prefix in prefixes || {}) @@ -19,6 +20,7 @@ module.exports = { parser.parse = function () { Parser.base = baseIRI || ''; Parser.prefixes = Object.create(prefixesCopy); + Parser.factory = factory || N3.DataFactory ; return Parser.prototype.parse.apply(parser, arguments); }; parser._resetBlanks = Parser._resetBlanks; From 24d0e65010d4ac71df6903aef3b322f4df2018f7 Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Sun, 10 Mar 2019 23:26:49 +0100 Subject: [PATCH 02/46] Added TestDataFactory which imitates the pre-RDF/JS behavior to avoid having to change test files --- lib/sparql.jison | 6 ++-- test/SparqlGenerator-test.js | 6 ++-- test/SparqlParser-test.js | 12 ++++--- test/TestDataFactory.js | 68 ++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 11 deletions(-) create mode 100644 test/TestDataFactory.js diff --git a/lib/sparql.jison b/lib/sparql.jison index 392d7193..ae854b94 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -13,9 +13,7 @@ XSD_INTEGER = XSD + 'integer', XSD_DECIMAL = XSD + 'decimal', XSD_DOUBLE = XSD + 'double', - XSD_BOOLEAN = XSD + 'boolean', - XSD_TRUE = '"true"^^' + XSD_BOOLEAN, - XSD_FALSE = '"false"^^' + XSD_BOOLEAN; + XSD_BOOLEAN = XSD + 'boolean'; var base = '', basePath = '', baseRoot = ''; @@ -154,7 +152,7 @@ // Creates a new blank node identifier function blank() { - return '_:b' + blankId++; + return Parser.factory.blankNode(blankId++); }; var blankId = 0; Parser._resetBlanks = function () { blankId = 0; } diff --git a/test/SparqlGenerator-test.js b/test/SparqlGenerator-test.js index 09f64155..1b289457 100644 --- a/test/SparqlGenerator-test.js +++ b/test/SparqlGenerator-test.js @@ -5,6 +5,8 @@ var fs = require('fs'), expect = require('chai').expect, os = require('os'); +var factory = require('./TestDataFactory'); + var queriesPath = __dirname + '/../queries/'; var parsedQueriesPath = __dirname + '/../test/parsedQueries/'; var unusedPrefixesPath = __dirname + '/../test/unusedPrefixes/'; @@ -24,7 +26,7 @@ describe('A SPARQL generator', function () { it('should correctly generate query "' + query + '"', function () { var parsedQuery = parseJSON(fs.readFileSync(parsedQueryFile, 'utf8')); var genQuery = allPrefixesGenerator.stringify(parsedQuery); - expect(new SparqlParser().parse(genQuery)).to.deep.equal(parsedQuery); + expect(new SparqlParser(null, null, factory).parse(genQuery)).to.deep.equal(parsedQuery); }); }); @@ -47,7 +49,7 @@ describe('A SPARQL generator', function () { }); it('should use inherited prefixes', function () { - var parser = new SparqlParser({rdfs: 'http://www.w3.org/2000/01/rdf-schema#'}); + var parser = new SparqlParser({rdfs: 'http://www.w3.org/2000/01/rdf-schema#'}, null, factory); var parsedQuery = parser.parse('SELECT * WHERE { ?s rdfs:label ?o }'); var generatedQuery = defaultGenerator.stringify(parsedQuery); var expectedQuery = diff --git a/test/SparqlParser-test.js b/test/SparqlParser-test.js index abab3d28..e28c7d3d 100644 --- a/test/SparqlParser-test.js +++ b/test/SparqlParser-test.js @@ -3,11 +3,13 @@ var SparqlParser = require('../sparql').Parser; var fs = require('fs'), expect = require('chai').expect; +var factory = require('./TestDataFactory'); + var queriesPath = __dirname + '/../queries/'; var parsedQueriesPath = __dirname + '/../test/parsedQueries/'; describe('A SPARQL parser', function () { - var parser = new SparqlParser(); + var parser = new SparqlParser(null, null, factory); // Ensure the same blank node identifiers are used in every test beforeEach(function () { parser._resetBlanks(); }); @@ -38,7 +40,7 @@ describe('A SPARQL parser', function () { }); it('should preserve BGP and filter pattern order', function () { - var parser = new SparqlParser(); + var parser = new SparqlParser(null, null, factory); var query = 'SELECT * { ?s ?p "1" . FILTER(true) . ?s ?p "2" }'; var groups = parser.parse(query).where; expect(groups[0].type).to.equal("bgp"); @@ -48,7 +50,7 @@ describe('A SPARQL parser', function () { describe('with pre-defined prefixes', function () { var prefixes = { a: 'ex:abc#', b: 'ex:def#' }; - var parser = new SparqlParser(prefixes); + var parser = new SparqlParser(prefixes, null, factory); it('should use those prefixes', function () { var query = 'SELECT * { a:a b:b "" }'; @@ -76,7 +78,7 @@ describe('A SPARQL parser', function () { }); describe('with pre-defined base IRI', function () { - var parser = new SparqlParser(null, 'http://ex.org/'); + var parser = new SparqlParser(null, 'http://ex.org/', factory); it('should use the base IRI', function () { var query = 'SELECT * { <> <#b> "" }'; @@ -96,7 +98,7 @@ describe('A SPARQL parser', function () { }); describe('with group collapsing disabled', function () { - var parser = new SparqlParser(null, null); + var parser = new SparqlParser(null, null, factory); it('should keep explicit pattern group', function () { var query = 'SELECT * WHERE { { ?s ?p ?o } ?a ?b ?c }'; diff --git a/test/TestDataFactory.js b/test/TestDataFactory.js new file mode 100644 index 00000000..89d1542a --- /dev/null +++ b/test/TestDataFactory.js @@ -0,0 +1,68 @@ +// ## TestDataFactory functions +// Emulate old, pre-RDF/JS output (plain strings instead of Terms) to make tests pass + +var XSD = 'http://www.w3.org/2001/XMLSchema#'; + +const xsd = { + decimal: XSD + 'decimal', + boolean: XSD + 'boolean', + double: XSD + 'double', + integer: XSD + 'integer', + string: XSD + 'string', + }; + +// ### Creates an IRI +function namedNode(iri) { + return iri; +} + +// ### Creates a blank node +function blankNode(name) { + return '_:b' + name; +} + +// ### Creates a literal +function literal(value, languageOrDataType) { + // Create a language-tagged string + if (typeof languageOrDataType === 'string') + return '"' + value + '"@' + languageOrDataType.toLowerCase(); + + // Create a datatyped literal + var datatype = languageOrDataType && languageOrDataType.value || ''; + if (!datatype) { + switch (typeof value) { + // Convert a boolean + case 'boolean': + datatype = xsd.boolean; + break; + // Convert an integer or double + case 'number': + if (Number.isFinite(value)) + datatype = Number.isInteger(value) ? xsd.integer : xsd.double; + else { + datatype = xsd.double; + if (!Number.isNaN(value)) + value = value > 0 ? 'INF' : '-INF'; + } + break; + // No datatype, so convert a plain string + default: + return value; + } + } + return '"' + value + '"^^' + datatype; +} + +// ### Creates a variable +function variable(name) { + return '?' + name; +} + +// ## Module exports +module.exports = TestDataFactory = { + // ### Public factory functions + namedNode: namedNode, + blankNode: blankNode, + variable: variable, + literal: literal +}; \ No newline at end of file From 55d9d5270b9b513258b5ddcf62dc1d657d5c277a Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Mon, 11 Mar 2019 00:01:15 +0100 Subject: [PATCH 03/46] Added createLangLiteral() in JISON for language literals Renamed createLiteral() to createTypedLiteral() in JISON --- lib/sparql.jison | 33 +++++++++++++++++++-------------- test/TestDataFactory.js | 4 ++-- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index ae854b94..87878673 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -137,10 +137,15 @@ } // Creates a literal with the given value and type - function createLiteral(value, type) { + function createTypedLiteral(value, type) { return Parser.factory.literal(value, Parser.factory.namedNode(type)); } + // Creates a literal with the given value and language + function createLangLiteral(value, lang) { + return Parser.factory.literal(value, lang); + } + // Creates a triple with the given subject, predicate, and object function triple(subject, predicate, object) { var triple = {}; @@ -805,15 +810,15 @@ GroupConcatSeparator ; Literal : String - | String LANGTAG -> $1 + lowercase($2) - | String '^^' iri -> $1 + '^^' + $3 - | INTEGER -> createLiteral($1, XSD_INTEGER) - | DECIMAL -> createLiteral($1, XSD_DECIMAL) - | DOUBLE -> createLiteral(lowercase($1), XSD_DOUBLE) + | String LANGTAG -> createLangLiteral($1, lowercase($2.substr(1))) + | String '^^' iri -> createTypedLiteral($1, $3) + | INTEGER -> createTypedLiteral($1, XSD_INTEGER) + | DECIMAL -> createTypedLiteral($1, XSD_DECIMAL) + | DOUBLE -> createTypedLiteral(lowercase($1), XSD_DOUBLE) | NumericLiteralPositive | NumericLiteralNegative - | 'true' -> createLiteral('true', XSD_BOOLEAN) - | 'false' -> createLiteral('false', XSD_BOOLEAN) + | 'true' -> createTypedLiteral('true', XSD_BOOLEAN) + | 'false' -> createTypedLiteral('false', XSD_BOOLEAN) ; String : STRING_LITERAL1 -> Parser.factory.literal(unescapeString($1, 1)) @@ -822,14 +827,14 @@ String | STRING_LITERAL_LONG2 -> Parser.factory.literal(unescapeString($1, 3)) ; NumericLiteralPositive - : INTEGER_POSITIVE -> createLiteral($1.substr(1), XSD_INTEGER) - | DECIMAL_POSITIVE -> createLiteral($1.substr(1), XSD_DECIMAL) - | DOUBLE_POSITIVE -> createLiteral($1.substr(1).toLowerCase(), XSD_DOUBLE) + : INTEGER_POSITIVE -> createTypedLiteral($1.substr(1), XSD_INTEGER) + | DECIMAL_POSITIVE -> createTypedLiteral($1.substr(1), XSD_DECIMAL) + | DOUBLE_POSITIVE -> createTypedLiteral($1.substr(1).toLowerCase(), XSD_DOUBLE) ; NumericLiteralNegative - : INTEGER_NEGATIVE -> createLiteral($1, XSD_INTEGER) - | DECIMAL_NEGATIVE -> createLiteral($1, XSD_DECIMAL) - | DOUBLE_NEGATIVE -> createLiteral(lowercase($1), XSD_DOUBLE) + : INTEGER_NEGATIVE -> createTypedLiteral($1, XSD_INTEGER) + | DECIMAL_NEGATIVE -> createTypedLiteral($1, XSD_DECIMAL) + | DOUBLE_NEGATIVE -> createTypedLiteral(lowercase($1), XSD_DOUBLE) ; iri : IRIREF -> Parser.factory.namedNode(resolveIRI($1)) diff --git a/test/TestDataFactory.js b/test/TestDataFactory.js index 89d1542a..cc06d6e8 100644 --- a/test/TestDataFactory.js +++ b/test/TestDataFactory.js @@ -25,7 +25,7 @@ function blankNode(name) { function literal(value, languageOrDataType) { // Create a language-tagged string if (typeof languageOrDataType === 'string') - return '"' + value + '"@' + languageOrDataType.toLowerCase(); + return value + '@' + languageOrDataType.toLowerCase(); // Create a datatyped literal var datatype = languageOrDataType && languageOrDataType.value || ''; @@ -65,4 +65,4 @@ module.exports = TestDataFactory = { blankNode: blankNode, variable: variable, literal: literal -}; \ No newline at end of file +}; From 867d9d519fb69117b23d0295fc2c3cd62f9bcdae Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Mon, 11 Mar 2019 00:35:41 +0100 Subject: [PATCH 04/46] Refactored TestDataFactory.literal() to differentiate between lang tag and datatype based on tag length --- test/TestDataFactory.js | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/test/TestDataFactory.js b/test/TestDataFactory.js index cc06d6e8..f2d70d93 100644 --- a/test/TestDataFactory.js +++ b/test/TestDataFactory.js @@ -22,35 +22,13 @@ function blankNode(name) { } // ### Creates a literal -function literal(value, languageOrDataType) { - // Create a language-tagged string - if (typeof languageOrDataType === 'string') - return value + '@' + languageOrDataType.toLowerCase(); - - // Create a datatyped literal - var datatype = languageOrDataType && languageOrDataType.value || ''; - if (!datatype) { - switch (typeof value) { - // Convert a boolean - case 'boolean': - datatype = xsd.boolean; - break; - // Convert an integer or double - case 'number': - if (Number.isFinite(value)) - datatype = Number.isInteger(value) ? xsd.integer : xsd.double; - else { - datatype = xsd.double; - if (!Number.isNaN(value)) - value = value > 0 ? 'INF' : '-INF'; - } - break; - // No datatype, so convert a plain string - default: - return value; - } +function literal(value, tag) { + if (tag) { + if (tag.length < 10) // hacky "heuristic" for test purposes only + return value + '@' + tag; // language tag + return '"' + value + '"' + '^^' + tag; // typed literal } - return '"' + value + '"^^' + datatype; + return value; } // ### Creates a variable From b02b90eeeae928a20492b3653904adf0e1ffd4d5 Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Mon, 11 Mar 2019 00:37:06 +0100 Subject: [PATCH 05/46] Removed unused XSD constants --- test/TestDataFactory.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/TestDataFactory.js b/test/TestDataFactory.js index f2d70d93..0f2bb3fe 100644 --- a/test/TestDataFactory.js +++ b/test/TestDataFactory.js @@ -1,16 +1,6 @@ // ## TestDataFactory functions // Emulate old, pre-RDF/JS output (plain strings instead of Terms) to make tests pass -var XSD = 'http://www.w3.org/2001/XMLSchema#'; - -const xsd = { - decimal: XSD + 'decimal', - boolean: XSD + 'boolean', - double: XSD + 'double', - integer: XSD + 'integer', - string: XSD + 'string', - }; - // ### Creates an IRI function namedNode(iri) { return iri; From 31a0c279ce6417090ebe6b5e945c72d34f27394c Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Mon, 11 Mar 2019 00:49:07 +0100 Subject: [PATCH 06/46] Removed quotes from typed literal output --- test/TestDataFactory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TestDataFactory.js b/test/TestDataFactory.js index 0f2bb3fe..6c90ebf1 100644 --- a/test/TestDataFactory.js +++ b/test/TestDataFactory.js @@ -16,7 +16,7 @@ function literal(value, tag) { if (tag) { if (tag.length < 10) // hacky "heuristic" for test purposes only return value + '@' + tag; // language tag - return '"' + value + '"' + '^^' + tag; // typed literal + return value + '^^' + tag; // typed literal } return value; } From 06348fbe0375d91ebf8f986f5dc69f662c80ebfa Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Mon, 11 Mar 2019 00:56:06 +0100 Subject: [PATCH 07/46] TestDataFactory.literal() quotes xsd:integer values because so does SparqlGenerator --- test/TestDataFactory.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/TestDataFactory.js b/test/TestDataFactory.js index 6c90ebf1..f2504bac 100644 --- a/test/TestDataFactory.js +++ b/test/TestDataFactory.js @@ -16,6 +16,8 @@ function literal(value, tag) { if (tag) { if (tag.length < 10) // hacky "heuristic" for test purposes only return value + '@' + tag; // language tag + if (tag === "http://www.w3.org/2001/XMLSchema#integer") + return '"' + value + '"' + '^^' + tag; // treat integers specially as does SparqlGenerator return value + '^^' + tag; // typed literal } return value; From d9b7a9f0ce74ed0d41c0afc59e0258c558cd9967 Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Mon, 11 Mar 2019 01:16:25 +0100 Subject: [PATCH 08/46] Added n3 1.x as dependency --- package.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a9c79f83..b541114a 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,9 @@ "version": "2.2.3", "description": "A parser for the SPARQL query language", "author": "Ruben Verborgh ", + "dependencies": { + "n3": "1.x" + }, "keywords": [ "sparql", "rdf", @@ -45,5 +48,8 @@ "pre-commit": [ "build", "test" - ] + ], + "dependencies": { + "n3": "^1.0.4" + } } From 4cd7986501d96ced5e433501f150cfa36c1db733 Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Mon, 11 Mar 2019 01:18:50 +0100 Subject: [PATCH 09/46] Added package-lock.json file --- package-lock.json | 117 ++++++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 56 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99880595..a23b451a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,7 @@ "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -57,12 +57,12 @@ "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", "dev": true, "requires": { - "assertion-error": "1.0.2", - "check-error": "1.0.2", - "deep-eql": "3.0.1", - "get-func-name": "2.0.0", - "pathval": "1.1.0", - "type-detect": "4.0.3" + "assertion-error": "^1.0.1", + "check-error": "^1.0.1", + "deep-eql": "^3.0.0", + "get-func-name": "^2.0.0", + "pathval": "^1.0.0", + "type-detect": "^4.0.0" } }, "check-error": { @@ -104,9 +104,9 @@ "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" } }, "core-util-is": { @@ -121,9 +121,9 @@ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.2.14" + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" } }, "debug": { @@ -141,7 +141,7 @@ "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true, "requires": { - "type-detect": "4.0.3" + "type-detect": "^4.0.0" } }, "diff": { @@ -168,10 +168,10 @@ "integrity": "sha1-8CQBb1qI4Eb9EgBQVek5gC5sXyM=", "dev": true, "requires": { - "esprima": "1.1.1", - "estraverse": "1.5.1", - "esutils": "1.0.0", - "source-map": "0.1.43" + "esprima": "~1.1.1", + "estraverse": "~1.5.0", + "esutils": "~1.0.0", + "source-map": "~0.1.33" } }, "esprima": { @@ -210,12 +210,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "growl": { @@ -242,8 +242,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -273,10 +273,10 @@ "JSONSelect": "0.4.0", "cjson": "0.3.0", "ebnf-parser": "0.1.10", - "escodegen": "1.3.3", - "esprima": "1.1.1", - "jison-lex": "0.3.4", - "lex-parser": "0.1.4", + "escodegen": "1.3.x", + "esprima": "1.1.x", + "jison-lex": "0.3.x", + "lex-parser": "~0.1.3", "nomnom": "1.5.2" } }, @@ -286,7 +286,7 @@ "integrity": "sha1-gcoo2E+ESZ36jFlNzePYo/Jux6U=", "dev": true, "requires": { - "lex-parser": "0.1.4", + "lex-parser": "0.1.x", "nomnom": "1.5.2" } }, @@ -296,8 +296,8 @@ "integrity": "sha1-iKpGvCiaesk7tGyuLVihh6m7SUo=", "dev": true, "requires": { - "JSV": "4.0.2", - "nomnom": "1.5.2" + "JSV": ">= 4.0.x", + "nomnom": ">= 1.5.x" } }, "lex-parser": { @@ -312,8 +312,8 @@ "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" } }, "minimatch": { @@ -322,7 +322,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.8" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -364,14 +364,19 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "n3": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/n3/-/n3-1.0.4.tgz", + "integrity": "sha512-iMHI7n3OsmMsUf6u9un6f8TCPgN1Zs6uKKcXrpTFUNXaswaOFk3H2/YuzuLE4T5Mhd+1haXAuufBFmsbRaULzw==" + }, "nomnom": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz", "integrity": "sha1-9DRUSKhTz71cDSYyDyR3qwUm/i8=", "dev": true, "requires": { - "colors": "0.5.1", - "underscore": "1.1.7" + "colors": "0.5.x", + "underscore": "1.1.x" } }, "once": { @@ -380,7 +385,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os-shim": { @@ -407,9 +412,9 @@ "integrity": "sha1-287g7p3nI15X95xW186UZBpp7sY=", "dev": true, "requires": { - "cross-spawn": "5.1.0", - "spawn-sync": "1.0.15", - "which": "1.2.14" + "cross-spawn": "^5.0.1", + "spawn-sync": "^1.0.15", + "which": "1.2.x" } }, "process-nextick-args": { @@ -430,13 +435,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -451,7 +456,7 @@ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { - "shebang-regex": "1.0.0" + "shebang-regex": "^1.0.0" } }, "shebang-regex": { @@ -467,7 +472,7 @@ "dev": true, "optional": true, "requires": { - "amdefine": "1.0.1" + "amdefine": ">=0.0.4" } }, "spawn-sync": { @@ -476,8 +481,8 @@ "integrity": "sha1-sAeZVX63+wyDdsKdROih6mfldHY=", "dev": true, "requires": { - "concat-stream": "1.6.0", - "os-shim": "0.1.3" + "concat-stream": "^1.4.7", + "os-shim": "^0.1.2" } }, "string_decoder": { @@ -486,7 +491,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "supports-color": { @@ -495,7 +500,7 @@ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "^2.0.0" } }, "type-detect": { @@ -528,7 +533,7 @@ "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", "dev": true, "requires": { - "isexe": "2.0.0" + "isexe": "^2.0.0" } }, "wrappy": { From 882e73fb2d181fcad4b147a33882bf802bee493f Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Mon, 11 Mar 2019 01:27:39 +0100 Subject: [PATCH 10/46] Removed duplicate declaration of n3 dependency --- package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index b541114a..364937fc 100644 --- a/package.json +++ b/package.json @@ -48,8 +48,5 @@ "pre-commit": [ "build", "test" - ], - "dependencies": { - "n3": "^1.0.4" - } + ] } From 2cd5b06112c5b78f23c526fd904294f475a02904 Mon Sep 17 00:00:00 2001 From: Martynas Jusevicius Date: Mon, 11 Mar 2019 12:34:30 +0100 Subject: [PATCH 11/46] String literals in JISON are handled using createTypedLiteral() as well --- lib/sparql.jison | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index 87878673..280c5656 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -821,10 +821,10 @@ Literal | 'false' -> createTypedLiteral('false', XSD_BOOLEAN) ; String - : STRING_LITERAL1 -> Parser.factory.literal(unescapeString($1, 1)) - | STRING_LITERAL2 -> Parser.factory.literal(unescapeString($1, 1)) - | STRING_LITERAL_LONG1 -> Parser.factory.literal(unescapeString($1, 3)) - | STRING_LITERAL_LONG2 -> Parser.factory.literal(unescapeString($1, 3)) + : STRING_LITERAL1 -> createTypedLiteral(unescapeString($1, 1)) + | STRING_LITERAL2 -> createTypedLiteral(unescapeString($1, 1)) + | STRING_LITERAL_LONG1 -> createTypedLiteral(unescapeString($1, 3)) + | STRING_LITERAL_LONG2 -> createTypedLiteral(unescapeString($1, 3)) ; NumericLiteralPositive : INTEGER_POSITIVE -> createTypedLiteral($1.substr(1), XSD_INTEGER) From 76999c6bbbdcb608e6ecf89076a17867b0e4aaf5 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Thu, 14 Mar 2019 22:58:59 +0100 Subject: [PATCH 12/46] Fix string parsing. --- lib/sparql.jison | 14 +++++++------- test/TestDataFactory.js | 18 ++++-------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index 280c5656..5fc070c7 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -193,7 +193,7 @@ }); } catch (error) { return ''; } - return '"' + string + '"'; + return string; } // Creates a list, collecting its (possibly blank) items and triples associated with those items @@ -806,10 +806,10 @@ Aggregate | 'GROUP_CONCAT' '(' 'DISTINCT'? Expression GroupConcatSeparator? ')' -> expression($4, { type: 'aggregate', aggregation: lowercase($1), distinct: !!$3, separator: $5 || ' ' }) ; GroupConcatSeparator - : ';' 'SEPARATOR' '=' String -> $4.substr(1, $4.length - 2) + : ';' 'SEPARATOR' '=' String -> $4 ; Literal - : String + : String -> createTypedLiteral($1) | String LANGTAG -> createLangLiteral($1, lowercase($2.substr(1))) | String '^^' iri -> createTypedLiteral($1, $3) | INTEGER -> createTypedLiteral($1, XSD_INTEGER) @@ -821,10 +821,10 @@ Literal | 'false' -> createTypedLiteral('false', XSD_BOOLEAN) ; String - : STRING_LITERAL1 -> createTypedLiteral(unescapeString($1, 1)) - | STRING_LITERAL2 -> createTypedLiteral(unescapeString($1, 1)) - | STRING_LITERAL_LONG1 -> createTypedLiteral(unescapeString($1, 3)) - | STRING_LITERAL_LONG2 -> createTypedLiteral(unescapeString($1, 3)) + : STRING_LITERAL1 -> unescapeString($1, 1) + | STRING_LITERAL2 -> unescapeString($1, 1) + | STRING_LITERAL_LONG1 -> unescapeString($1, 3) + | STRING_LITERAL_LONG2 -> unescapeString($1, 3) ; NumericLiteralPositive : INTEGER_POSITIVE -> createTypedLiteral($1.substr(1), XSD_INTEGER) diff --git a/test/TestDataFactory.js b/test/TestDataFactory.js index f2504bac..d80e995d 100644 --- a/test/TestDataFactory.js +++ b/test/TestDataFactory.js @@ -1,36 +1,26 @@ // ## TestDataFactory functions // Emulate old, pre-RDF/JS output (plain strings instead of Terms) to make tests pass -// ### Creates an IRI function namedNode(iri) { return iri; } -// ### Creates a blank node function blankNode(name) { return '_:b' + name; } -// ### Creates a literal function literal(value, tag) { - if (tag) { - if (tag.length < 10) // hacky "heuristic" for test purposes only - return value + '@' + tag; // language tag - if (tag === "http://www.w3.org/2001/XMLSchema#integer") - return '"' + value + '"' + '^^' + tag; // treat integers specially as does SparqlGenerator - return value + '^^' + tag; // typed literal - } - return value; + var suffix = ''; + if (tag) + suffix = (/:/.test(tag) ? '^^' : '@') + tag; + return '"' + value + '"' + suffix; } -// ### Creates a variable function variable(name) { return '?' + name; } -// ## Module exports module.exports = TestDataFactory = { - // ### Public factory functions namedNode: namedNode, blankNode: blankNode, variable: variable, From 2699f0e2c28c151bf0264ecf3618613d4d987879 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Thu, 14 Mar 2019 22:59:31 +0100 Subject: [PATCH 13/46] Set specific N3.js version. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 364937fc..cbdb0978 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A parser for the SPARQL query language", "author": "Ruben Verborgh ", "dependencies": { - "n3": "1.x" + "n3": "^1.0.4" }, "keywords": [ "sparql", @@ -32,7 +32,7 @@ "test": "./node_modules/.bin/mocha" }, "engines": { - "node": ">=0.10.0" + "node": ">=8.0" }, "devDependencies": { "jison": "0.4.18", From c431f2dcd19c415dc6322f95ff2272e55b8fe861 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Thu, 14 Mar 2019 22:59:57 +0100 Subject: [PATCH 14/46] Fix space. --- sparql.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sparql.js b/sparql.js index d1dd94fb..77abdb41 100644 --- a/sparql.js +++ b/sparql.js @@ -20,7 +20,7 @@ module.exports = { parser.parse = function () { Parser.base = baseIRI || ''; Parser.prefixes = Object.create(prefixesCopy); - Parser.factory = factory || N3.DataFactory ; + Parser.factory = factory || N3.DataFactory; return Parser.prototype.parse.apply(parser, arguments); }; parser._resetBlanks = Parser._resetBlanks; From dcf54838146f39e6adc06c0170067927d8cc6372 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Thu, 14 Mar 2019 23:06:43 +0100 Subject: [PATCH 15/46] Simplify true/false case. --- lib/sparql.jison | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index 5fc070c7..b163689f 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -391,8 +391,7 @@ PN_LOCAL_ESC "\\"("_"|"~"|"."|"-"|"!"|"$"|"&"|"'"|"("|")"|"*"|"+"|","|" "GROUP_CONCAT" return 'GROUP_CONCAT' "SEPARATOR" return 'SEPARATOR' "^^" return '^^' -"true" return 'true' -"false" return 'false' +"true"|"false" return 'BOOLEAN' {IRIREF} return 'IRIREF' {PNAME_NS} return 'PNAME_NS' {PNAME_LN} return 'PNAME_LN' @@ -817,8 +816,7 @@ Literal | DOUBLE -> createTypedLiteral(lowercase($1), XSD_DOUBLE) | NumericLiteralPositive | NumericLiteralNegative - | 'true' -> createTypedLiteral('true', XSD_BOOLEAN) - | 'false' -> createTypedLiteral('false', XSD_BOOLEAN) + | BOOLEAN -> createTypedLiteral($1, XSD_BOOLEAN) ; String : STRING_LITERAL1 -> unescapeString($1, 1) From 44cc174507cd3764363d489a0b417e393d15cb8c Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 16 Jul 2019 13:15:16 +0200 Subject: [PATCH 16/46] Fix bug with json representation of VALUES Fixed a bug where Variable instances were used as keys in a values object --- lib/sparql.jison | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index b163689f..753b9582 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -541,7 +541,7 @@ InlineData throw Error('Inconsistent VALUES length'); var valuesObject = {}; for(var i = 0; i Date: Tue, 16 Jul 2019 14:43:27 +0200 Subject: [PATCH 17/46] Change parser tests to work using the N3 DataFactory --- test/SparqlParser-test.js | 97 ++- test/parsedQueries/all.json | 27 +- test/parsedQueries/artists-ghent.json | 166 ++++- test/parsedQueries/artists-york.json | 68 +- test/parsedQueries/blanks.json | 400 ++++++++--- test/parsedQueries/bsbm1.json | 120 +++- test/parsedQueries/bsbm10.json | 171 +++-- test/parsedQueries/bsbm3.json | 83 ++- test/parsedQueries/bsbm4.json | 248 +++++-- test/parsedQueries/bsbm5.json | 226 +++++-- test/parsedQueries/bsbm8.json | 233 +++++-- test/parsedQueries/bsbm9.json | 32 +- test/parsedQueries/clear-drop.json | 33 +- test/parsedQueries/compact-bgp.json | 182 +++-- .../construct-extra-semicolon.json | 68 +- .../construct-multi-extra-semicolons.json | 68 +- .../construct-without-template.json | 38 +- test/parsedQueries/construct.json | 38 +- test/parsedQueries/empty-values.json | 27 +- test/parsedQueries/group-concat.json | 73 +- test/parsedQueries/group-variable.json | 67 +- test/parsedQueries/in.json | 93 ++- test/parsedQueries/lists.json | 627 ++++++++++++++---- test/parsedQueries/load-into.json | 16 +- test/parsedQueries/load.json | 11 +- test/parsedQueries/multiline.json | 51 +- test/parsedQueries/negate-and.json | 42 +- test/parsedQueries/nested-path.json | 27 +- test/parsedQueries/optional-subquery.json | 21 +- test/parsedQueries/or.json | 215 +++++- test/parsedQueries/order-operator.json | 32 +- test/parsedQueries/sparql-10-1a.json | 109 ++- test/parsedQueries/sparql-10-1b.json | 109 ++- test/parsedQueries/sparql-10-2-2a.json | 71 +- test/parsedQueries/sparql-10-2-2b.json | 78 ++- test/parsedQueries/sparql-10-2-2c.json | 78 ++- test/parsedQueries/sparql-11-1.json | 87 ++- test/parsedQueries/sparql-11-2.json | 57 +- test/parsedQueries/sparql-11-3.json | 57 +- test/parsedQueries/sparql-11-4.json | 77 ++- test/parsedQueries/sparql-11-5.json | 72 +- test/parsedQueries/sparql-12.json | 80 ++- test/parsedQueries/sparql-13-2-1.json | 37 +- test/parsedQueries/sparql-13-2-2.json | 42 +- test/parsedQueries/sparql-13-2-3.json | 79 ++- test/parsedQueries/sparql-13-3-1.json | 67 +- test/parsedQueries/sparql-13-3-2.json | 64 +- test/parsedQueries/sparql-13-3-3.json | 151 ++++- test/parsedQueries/sparql-13-3-4.json | 94 ++- test/parsedQueries/sparql-15-1a.json | 37 +- test/parsedQueries/sparql-15-1b.json | 54 +- test/parsedQueries/sparql-15-1c.json | 59 +- test/parsedQueries/sparql-15-2.json | 32 +- test/parsedQueries/sparql-15-3-1.json | 32 +- test/parsedQueries/sparql-15-3-2.json | 32 +- test/parsedQueries/sparql-15-3.json | 32 +- test/parsedQueries/sparql-15-4.json | 37 +- test/parsedQueries/sparql-15-5.json | 32 +- test/parsedQueries/sparql-16-1-1.json | 87 ++- test/parsedQueries/sparql-16-1-2b.json | 99 ++- test/parsedQueries/sparql-16-2-1.json | 104 ++- test/parsedQueries/sparql-16-2-3.json | 64 +- test/parsedQueries/sparql-16-2-4.json | 42 +- test/parsedQueries/sparql-16-2.json | 44 +- test/parsedQueries/sparql-16-3.json | 47 +- test/parsedQueries/sparql-16-4-1.json | 13 +- test/parsedQueries/sparql-16-4-2a.json | 32 +- test/parsedQueries/sparql-16-4-2b.json | 37 +- test/parsedQueries/sparql-16-4-2c.json | 42 +- test/parsedQueries/sparql-16-4-3.json | 37 +- test/parsedQueries/sparql-17-4-1-1a.json | 56 +- test/parsedQueries/sparql-17-4-1-1b.json | 54 +- test/parsedQueries/sparql-17-4-1-7a.json | 102 ++- test/parsedQueries/sparql-17-4-1-7b.json | 71 +- test/parsedQueries/sparql-17-4-1-8a.json | 102 ++- test/parsedQueries/sparql-17-4-1-8b.json | 134 +++- test/parsedQueries/sparql-17-4-2-1.json | 57 +- test/parsedQueries/sparql-17-4-2-2.json | 91 ++- test/parsedQueries/sparql-17-4-2-3.json | 57 +- test/parsedQueries/sparql-17-4-2-5.json | 67 +- test/parsedQueries/sparql-17-4-2-6.json | 67 +- test/parsedQueries/sparql-17-4-2-7.json | 66 +- test/parsedQueries/sparql-17-4-3-13a.json | 67 +- test/parsedQueries/sparql-17-4-3-13b.json | 47 +- test/parsedQueries/sparql-17-4-3-14.json | 57 +- test/parsedQueries/sparql-17-6a.json | 64 +- test/parsedQueries/sparql-17-6b.json | 147 +++- test/parsedQueries/sparql-17.json | 66 +- test/parsedQueries/sparql-4-2a.json | 32 +- test/parsedQueries/sparql-4-2b.json | 34 +- test/parsedQueries/sparql-4-2c.json | 34 +- test/parsedQueries/sparql-5-2-2a.json | 67 +- test/parsedQueries/sparql-5-2-2b.json | 67 +- test/parsedQueries/sparql-5-2-2c.json | 67 +- test/parsedQueries/sparql-5-2-3a.json | 52 +- test/parsedQueries/sparql-5-2-3b.json | 67 +- test/parsedQueries/sparql-5-2-3c.json | 56 +- test/parsedQueries/sparql-5-2a.json | 52 +- test/parsedQueries/sparql-5-2b.json | 52 +- test/parsedQueries/sparql-6-1.json | 52 +- test/parsedQueries/sparql-6-2.json | 69 +- test/parsedQueries/sparql-6-3.json | 72 +- test/parsedQueries/sparql-7a.json | 49 +- test/parsedQueries/sparql-7b.json | 54 +- test/parsedQueries/sparql-7c.json | 84 ++- test/parsedQueries/sparql-8-1-1.json | 49 +- test/parsedQueries/sparql-8-1-2.json | 49 +- test/parsedQueries/sparql-8-2.json | 54 +- test/parsedQueries/sparql-8-3-1a.json | 38 +- test/parsedQueries/sparql-8-3-1b.json | 38 +- test/parsedQueries/sparql-8-3-2a.json | 42 +- test/parsedQueries/sparql-8-3-2b.json | 42 +- test/parsedQueries/sparql-8-3-3a.json | 52 +- test/parsedQueries/sparql-8-3-3b.json | 52 +- test/parsedQueries/sparql-9-2a.json | 36 +- test/parsedQueries/sparql-9-2b.json | 36 +- test/parsedQueries/sparql-9-2c.json | 47 +- test/parsedQueries/sparql-9-2d.json | 52 +- test/parsedQueries/sparql-9-2e.json | 82 ++- test/parsedQueries/sparql-9-2f.json | 82 ++- test/parsedQueries/sparql-9-2g.json | 72 +- test/parsedQueries/sparql-9-2h.json | 27 +- test/parsedQueries/sparql-9-2i.json | 27 +- test/parsedQueries/sparql-9-2j.json | 42 +- test/parsedQueries/sparql-9-2k.json | 52 +- test/parsedQueries/sparql-9-2l.json | 47 +- test/parsedQueries/sparql-9-2m.json | 34 +- test/parsedQueries/sparql-9-2n.json | 34 +- test/parsedQueries/sparql-9-2o.json | 34 +- test/parsedQueries/sparql-9-2p.json | 44 +- test/parsedQueries/sparql-9-2q.json | 32 +- test/parsedQueries/sparql-9-2r.json | 34 +- test/parsedQueries/sparql-9-3a.json | 32 +- test/parsedQueries/sparql-9-3b.json | 42 +- test/parsedQueries/sparql-9-3c.json | 42 +- test/parsedQueries/sparql-9-4a.json | 44 +- test/parsedQueries/sparql-9-4b.json | 34 +- test/parsedQueries/sparql-fed-2-1.json | 57 +- test/parsedQueries/sparql-fed-2-2.json | 82 ++- test/parsedQueries/sparql-fed-2-3.json | 37 +- test/parsedQueries/sparql-fed-2-4a.json | 47 +- test/parsedQueries/sparql-fed-2-4b.json | 29 +- test/parsedQueries/sparql-fed-2-4c.json | 39 +- test/parsedQueries/sparql-fed-2-4d.json | 52 +- test/parsedQueries/sparql-fed-4.json | 91 ++- .../parsedQueries/sparql-modifiers-order.json | 92 ++- test/parsedQueries/sparql-update-1-1-1.json | 30 +- test/parsedQueries/sparql-update-3-1-1a.json | 50 +- test/parsedQueries/sparql-update-3-1-1b.json | 37 +- test/parsedQueries/sparql-update-3-1-2a.json | 50 +- test/parsedQueries/sparql-update-3-1-2b.json | 60 +- .../parsedQueries/sparql-update-3-1-3-1a.json | 72 +- .../parsedQueries/sparql-update-3-1-3-1b.json | 65 +- .../parsedQueries/sparql-update-3-1-3-2a.json | 82 ++- .../parsedQueries/sparql-update-3-1-3-2b.json | 82 ++- .../parsedQueries/sparql-update-3-1-3-2c.json | 164 ++++- .../parsedQueries/sparql-update-3-1-3-3a.json | 45 +- .../parsedQueries/sparql-update-3-1-3-3b.json | 70 +- test/parsedQueries/sparql-update-3-1-3.json | 75 ++- test/parsedQueries/sparql-update-3-2-3.json | 11 +- test/parsedQueries/sparql-update-3-2-4.json | 11 +- test/parsedQueries/sparql-update-3-2-5.json | 11 +- .../sparql-update-multiple-prefixes.json | 52 +- .../sparql-update-only-prefix.json | 2 +- .../sparql-update-trailing-prologue.json | 22 +- .../sparql-update-trailing-semicolon.json | 22 +- test/parsedQueries/sparql-values-clause.json | 97 ++- test/parsedQueries/strlen.json | 34 +- test/parsedQueries/sub-values.json | 34 +- test/parsedQueries/sum-count.json | 57 +- 170 files changed, 8691 insertions(+), 2830 deletions(-) diff --git a/test/SparqlParser-test.js b/test/SparqlParser-test.js index e28c7d3d..55c394ae 100644 --- a/test/SparqlParser-test.js +++ b/test/SparqlParser-test.js @@ -3,13 +3,44 @@ var SparqlParser = require('../sparql').Parser; var fs = require('fs'), expect = require('chai').expect; -var factory = require('./TestDataFactory'); +var N3 = require("n3"); var queriesPath = __dirname + '/../queries/'; var parsedQueriesPath = __dirname + '/../test/parsedQueries/'; +// Test function which checks if object are equal, keeping into account how N3.DataFactory works +function objectsEqual(one, two){ + if (isPrimitive(one) || one === undefined){ + return one === two; + } + + if (one instanceof N3.DataFactory.internal.Term){ + return one.equals(two); + } else if (two instanceof N3.DataFactory.internal.Term){ + return two.equals(one); + } else { + if (Array.isArray(one) && Array.isArray(two)){ + if (one.length !== two.length) return false; + for (let i = 0; i < one.length; i++){ + if (! objectsEqual(one[i], two[i])) return false; + } + } else { + let keys_first = Object.keys(one); + + for (key of keys_first){ + if (! objectsEqual(one[key], two[key])) return false; + } + } + return true; + } +} + +function isPrimitive(value){ + return typeof value === "string" || typeof value === "number" || typeof value === "boolean"; +} + describe('A SPARQL parser', function () { - var parser = new SparqlParser(null, null, factory); + var parser = new SparqlParser(null, null, null); // Ensure the same blank node identifiers are used in every test beforeEach(function () { parser._resetBlanks(); }); @@ -25,7 +56,8 @@ describe('A SPARQL parser', function () { it('should correctly parse query "' + query + '"', function () { var parsedQuery = parseJSON(fs.readFileSync(parsedQueryFile, 'utf8')); query = fs.readFileSync(queriesPath + query + '.sparql', 'utf8'); - expect(parser.parse(query)).to.deep.equal(parsedQuery); + + expect(objectsEqual(parser.parse(query), parsedQuery)).to.equal(true); }); }); @@ -40,7 +72,7 @@ describe('A SPARQL parser', function () { }); it('should preserve BGP and filter pattern order', function () { - var parser = new SparqlParser(null, null, factory); + var parser = new SparqlParser(null, null, null); var query = 'SELECT * { ?s ?p "1" . FILTER(true) . ?s ?p "2" }'; var groups = parser.parse(query).where; expect(groups[0].type).to.equal("bgp"); @@ -50,20 +82,24 @@ describe('A SPARQL parser', function () { describe('with pre-defined prefixes', function () { var prefixes = { a: 'ex:abc#', b: 'ex:def#' }; - var parser = new SparqlParser(prefixes, null, factory); + var parser = new SparqlParser(prefixes, null, null); it('should use those prefixes', function () { var query = 'SELECT * { a:a b:b "" }'; - expect(parser.parse(query).where[0].triples[0]) - .to.deep.equal({subject: 'ex:abc#a', predicate: 'ex:def#b', object: '""'}); + var result_json = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; + + expect(parseJSON(JSON.stringify(parser.parse(query).where[0].triples[0]))) + .to.deep.equal(parseJSON(result_json)); }); it('should allow temporarily overriding prefixes', function () { var query = 'PREFIX a: SELECT * { a:a b:b "" }'; - expect(parser.parse(query).where[0].triples[0]) - .to.deep.equal({subject: 'ex:xyz#a', predicate: 'ex:def#b', object: '""'}); - expect(parser.parse('SELECT * { a:a b:b "" }').where[0].triples[0]) - .to.deep.equal({subject: 'ex:abc#a', predicate: 'ex:def#b', object: '""'}); + var result = '{"subject":{"termType":"NamedNode","value":"ex:xyz#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; + expect(objectsEqual(parser.parse(query).where[0].triples[0], parseJSON(result))).to.equal(true); + + var query2 = 'SELECT * { a:a b:b "" }'; + var result2 = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; + expect(objectsEqual(parser.parse(query2).where[0].triples[0], parseJSON(result2))).to.equal(true); }); it('should not change the original prefixes', function () { @@ -71,19 +107,22 @@ describe('A SPARQL parser', function () { }); it('should not take over changes to the original prefixes', function () { + var query = 'SELECT * { a:a b:b "" }'; + var result = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; prefixes.a = 'ex:xyz#'; - expect(parser.parse('SELECT * { a:a b:b "" }').where[0].triples[0]) - .to.deep.equal({subject: 'ex:abc#a', predicate: 'ex:def#b', object: '""'}); + + expect(objectsEqual(parser.parse(query).where[0].triples[0], parseJSON(result))).to.equal(true); }); }); describe('with pre-defined base IRI', function () { - var parser = new SparqlParser(null, 'http://ex.org/', factory); + var parser = new SparqlParser(null, 'http://ex.org/', null); it('should use the base IRI', function () { var query = 'SELECT * { <> <#b> "" }'; - expect(parser.parse(query).where[0].triples[0]) - .to.deep.equal({subject: 'http://ex.org/', predicate: 'http://ex.org/#b', object: '""'}); + var result = '{"subject":{"termType":"NamedNode","value":"http://ex.org/"},"predicate":{"termType":"NamedNode","value":"http://ex.org/#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; + + expect(objectsEqual(parser.parse(query).where[0].triples[0], parseJSON(result))); }); }); @@ -98,32 +137,20 @@ describe('A SPARQL parser', function () { }); describe('with group collapsing disabled', function () { - var parser = new SparqlParser(null, null, factory); + var parser = new SparqlParser(null, null, null); it('should keep explicit pattern group', function () { var query = 'SELECT * WHERE { { ?s ?p ?o } ?a ?b ?c }'; - expect(parser.parse(query).where).to.deep.equal([ - { - type: 'group', - patterns: [ - { type: 'bgp', triples: [{subject: '?s', predicate: '?p', object: '?o'}] }, - ] - }, - { type: 'bgp', triples: [{subject: '?a', predicate: '?b', object: '?c'}] }, - ]); + var result = '[{"type":"group","patterns":[{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"s"},"predicate":{"termType":"Variable","value":"p"},"object":{"termType":"Variable","value":"o"}}]}]},{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"a"},"predicate":{"termType":"Variable","value":"b"},"object":{"termType":"Variable","value":"c"}}]}]'; + + expect(objectsEqual(parser.parse(query).where, parseJSON(result))).to.equal(true); }); it('should still collapse immediate union groups', function () { var query = 'SELECT * WHERE { { ?s ?p ?o } UNION { ?a ?b ?c } }'; - expect(parser.parse(query).where).to.deep.equal([ - { - type: 'union', - patterns: [ - { type: 'bgp', triples: [{subject: '?s', predicate: '?p', object: '?o'}] }, - { type: 'bgp', triples: [{subject: '?a', predicate: '?b', object: '?c'}] }, - ] - }, - ]); + var result = '[{"type":"union","patterns":[{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"s"},"predicate":{"termType":"Variable","value":"p"},"object":{"termType":"Variable","value":"o"}}]},{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"a"},"predicate":{"termType":"Variable","value":"b"},"object":{"termType":"Variable","value":"c"}}]}]}]'; + + expect(objectsEqual(parser.parse(query).where, parseJSON(result))).to.equal(true); }); }); }); diff --git a/test/parsedQueries/all.json b/test/parsedQueries/all.json index ca91372a..d3958464 100644 --- a/test/parsedQueries/all.json +++ b/test/parsedQueries/all.json @@ -1,18 +1,29 @@ { - "type": "query", - "prefixes": {}, "queryType": "SELECT", - "variables": [ "*" ], + "variables": [ + "*" + ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } - ] -} + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/artists-ghent.json b/test/parsedQueries/artists-ghent.json index 6da78879..3dddd7f2 100644 --- a/test/parsedQueries/artists-ghent.json +++ b/test/parsedQueries/artists-ghent.json @@ -1,26 +1,44 @@ { - "type": "query", - "prefixes": { - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "dbpedia": "http://dbpedia.org/resource/", - "dbpedia-owl": "http://dbpedia.org/ontology/" - }, "queryType": "CONSTRUCT", "template": [ { - "subject": "?person", + "subject": { + "termType": "Variable", + "value": "person" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://dbpedia.org/ontology/Artist" + "object": { + "termType": "NamedNode", + "value": "http://dbpedia.org/ontology/Artist" + } }, { - "subject": "?person", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?person", - "predicate": "http://dbpedia.org/ontology/birthPlace", - "object": "?city" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://dbpedia.org/ontology/birthPlace" + }, + "object": { + "termType": "Variable", + "value": "city" + } } ], "where": [ @@ -28,41 +46,117 @@ "type": "bgp", "triples": [ { - "subject": "?person", + "subject": { + "termType": "Variable", + "value": "person" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://dbpedia.org/ontology/Artist" + "object": { + "termType": "NamedNode", + "value": "http://dbpedia.org/ontology/Artist" + } }, { - "subject": "?person", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?person", - "predicate": "http://dbpedia.org/ontology/birthPlace", - "object": "?city" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://dbpedia.org/ontology/birthPlace" + }, + "object": { + "termType": "Variable", + "value": "city" + } }, { - "subject": "?city", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "?cityName" + "subject": { + "termType": "Variable", + "value": "city" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Variable", + "value": "cityName" + } }, { - "subject": "?city", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "\"Ghent\"@en" + "subject": { + "termType": "Variable", + "value": "city" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Literal", + "value": "Ghent", + "language": "en", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString" + } + } }, { - "subject": "?city", - "predicate": "http://dbpedia.org/ontology/country", - "object": "?country" + "subject": { + "termType": "Variable", + "value": "city" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://dbpedia.org/ontology/country" + }, + "object": { + "termType": "Variable", + "value": "country" + } }, { - "subject": "?country", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "\"Belgium\"@en" + "subject": { + "termType": "Variable", + "value": "country" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Literal", + "value": "Belgium", + "language": "en", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString" + } + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "dbpedia": "http://dbpedia.org/resource/", + "dbpedia-owl": "http://dbpedia.org/ontology/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/artists-york.json b/test/parsedQueries/artists-york.json index ee517bc3..ab38629e 100644 --- a/test/parsedQueries/artists-york.json +++ b/test/parsedQueries/artists-york.json @@ -1,30 +1,68 @@ { - "type": "query", - "prefixes": { - "dbpedia-owl": "http://dbpedia.org/ontology/" - }, "queryType": "SELECT", - "variables": [ "?p", "?c" ], + "variables": [ + { + "termType": "Variable", + "value": "p" + }, + { + "termType": "Variable", + "value": "c" + } + ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?p", + "subject": { + "termType": "Variable", + "value": "p" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://dbpedia.org/ontology/Artist" + "object": { + "termType": "NamedNode", + "value": "http://dbpedia.org/ontology/Artist" + } }, { - "subject": "?p", - "predicate": "http://dbpedia.org/ontology/birthPlace", - "object": "?c" + "subject": { + "termType": "Variable", + "value": "p" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://dbpedia.org/ontology/birthPlace" + }, + "object": { + "termType": "Variable", + "value": "c" + } }, { - "subject": "?c", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "\"York\"@en" + "subject": { + "termType": "Variable", + "value": "c" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Literal", + "value": "York", + "language": "en", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString" + } + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dbpedia-owl": "http://dbpedia.org/ontology/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/blanks.json b/test/parsedQueries/blanks.json index 94e1b542..5f2f34cd 100644 --- a/test/parsedQueries/blanks.json +++ b/test/parsedQueries/blanks.json @@ -1,38 +1,89 @@ { - "type": "query", - "base": "ex:", - "prefixes": {}, "queryType": "CONSTRUCT", "template": [ { - "subject": "?s0", - "predicate": "?p0", - "object": "_:b1" + "subject": { + "termType": "Variable", + "value": "s0" + }, + "predicate": { + "termType": "Variable", + "value": "p0" + }, + "object": { + "termType": "BlankNode", + "value": "1" + } }, { - "subject": "_:b1", - "predicate": "ex:a0", - "object": "_:b0" + "subject": { + "termType": "BlankNode", + "value": "1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:a0" + }, + "object": { + "termType": "BlankNode", + "value": "n3-0" + } }, { - "subject": "_:b0", - "predicate": "ex:b0", - "object": "ex:c0" + "subject": { + "termType": "BlankNode", + "value": "n3-0" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:b0" + }, + "object": { + "termType": "NamedNode", + "value": "ex:c0" + } }, { - "subject": "_:b3", - "predicate": "?p0", - "object": "?o0" + "subject": { + "termType": "BlankNode", + "value": "3" + }, + "predicate": { + "termType": "Variable", + "value": "p0" + }, + "object": { + "termType": "Variable", + "value": "o0" + } }, { - "subject": "_:b3", - "predicate": "ex:a0", - "object": "_:b2" + "subject": { + "termType": "BlankNode", + "value": "3" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:a0" + }, + "object": { + "termType": "BlankNode", + "value": "2" + } }, { - "subject": "_:b2", - "predicate": "ex:b0", - "object": "ex:c0" + "subject": { + "termType": "BlankNode", + "value": "2" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:b0" + }, + "object": { + "termType": "NamedNode", + "value": "ex:c0" + } } ], "where": [ @@ -40,106 +91,289 @@ "type": "bgp", "triples": [ { - "subject": "?s1", - "predicate": "?p1", - "object": "_:b4" + "subject": { + "termType": "Variable", + "value": "s1" + }, + "predicate": { + "termType": "Variable", + "value": "p1" + }, + "object": { + "termType": "BlankNode", + "value": "4" + } }, { - "subject": "?s1", - "predicate": "?p1", - "object": "ex:a1" + "subject": { + "termType": "Variable", + "value": "s1" + }, + "predicate": { + "termType": "Variable", + "value": "p1" + }, + "object": { + "termType": "NamedNode", + "value": "ex:a1" + } }, { - "subject": "?s1", - "predicate": "?q1", - "object": "ex:b1" + "subject": { + "termType": "Variable", + "value": "s1" + }, + "predicate": { + "termType": "Variable", + "value": "q1" + }, + "object": { + "termType": "NamedNode", + "value": "ex:b1" + } }, { - "subject": "?s1", - "predicate": "?q1", - "object": "ex:c1" + "subject": { + "termType": "Variable", + "value": "s1" + }, + "predicate": { + "termType": "Variable", + "value": "q1" + }, + "object": { + "termType": "NamedNode", + "value": "ex:c1" + } }, { - "subject": "_:b5", - "predicate": "?p2", - "object": "?o2" + "subject": { + "termType": "BlankNode", + "value": "5" + }, + "predicate": { + "termType": "Variable", + "value": "p2" + }, + "object": { + "termType": "Variable", + "value": "o2" + } }, { - "subject": "?s3", - "predicate": "?p3", - "object": "_:b6" + "subject": { + "termType": "Variable", + "value": "s3" + }, + "predicate": { + "termType": "Variable", + "value": "p3" + }, + "object": { + "termType": "BlankNode", + "value": "6" + } }, { - "subject": "_:b6", - "predicate": "ex:a3", - "object": "ex:b3" + "subject": { + "termType": "BlankNode", + "value": "6" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:a3" + }, + "object": { + "termType": "NamedNode", + "value": "ex:b3" + } }, { - "subject": "?s4", - "predicate": "?p4", - "object": "_:b7" + "subject": { + "termType": "Variable", + "value": "s4" + }, + "predicate": { + "termType": "Variable", + "value": "p4" + }, + "object": { + "termType": "BlankNode", + "value": "7" + } }, { - "subject": "_:b7", - "predicate": "ex:a4", - "object": "ex:b4" + "subject": { + "termType": "BlankNode", + "value": "7" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:a4" + }, + "object": { + "termType": "NamedNode", + "value": "ex:b4" + } }, { - "subject": "_:b7", - "predicate": "ex:c4", - "object": "ex:d4" + "subject": { + "termType": "BlankNode", + "value": "7" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:c4" + }, + "object": { + "termType": "NamedNode", + "value": "ex:d4" + } }, { - "subject": "_:b7", - "predicate": "ex:c4", - "object": "ex:e4" + "subject": { + "termType": "BlankNode", + "value": "7" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:c4" + }, + "object": { + "termType": "NamedNode", + "value": "ex:e4" + } }, { - "subject": "?s5", - "predicate": "?p5", - "object": "_:b9" + "subject": { + "termType": "Variable", + "value": "s5" + }, + "predicate": { + "termType": "Variable", + "value": "p5" + }, + "object": { + "termType": "BlankNode", + "value": "9" + } }, { - "subject": "_:b9", - "predicate": "ex:a5", - "object": "_:b8" + "subject": { + "termType": "BlankNode", + "value": "9" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:a5" + }, + "object": { + "termType": "BlankNode", + "value": "8" + } }, { - "subject": "_:b8", - "predicate": "ex:b5", - "object": "ex:c5" + "subject": { + "termType": "BlankNode", + "value": "8" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:b5" + }, + "object": { + "termType": "NamedNode", + "value": "ex:c5" + } }, { - "subject": "_:b11", - "predicate": "?p6", - "object": "?o6" + "subject": { + "termType": "BlankNode", + "value": "11" + }, + "predicate": { + "termType": "Variable", + "value": "p6" + }, + "object": { + "termType": "Variable", + "value": "o6" + } }, { - "subject": "_:b11", - "predicate": "ex:a6", - "object": "_:b10" + "subject": { + "termType": "BlankNode", + "value": "11" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:a6" + }, + "object": { + "termType": "BlankNode", + "value": "10" + } }, { - "subject": "_:b10", - "predicate": "ex:b6", - "object": "ex:c6" + "subject": { + "termType": "BlankNode", + "value": "10" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:b6" + }, + "object": { + "termType": "NamedNode", + "value": "ex:c6" + } }, { - "subject": "_:b12", - "predicate": "ex:a7", - "object": "ex:b7" + "subject": { + "termType": "BlankNode", + "value": "12" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:a7" + }, + "object": { + "termType": "NamedNode", + "value": "ex:b7" + } }, { - "subject": "_:b12", - "predicate": "ex:c7", - "object": "ex:d7" + "subject": { + "termType": "BlankNode", + "value": "12" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:c7" + }, + "object": { + "termType": "NamedNode", + "value": "ex:d7" + } }, { - "subject": "_:b12", - "predicate": "ex:c7", - "object": "ex:e7" + "subject": { + "termType": "BlankNode", + "value": "12" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:c7" + }, + "object": { + "termType": "NamedNode", + "value": "ex:e7" + } } ] } - ] -} + ], + "type": "query", + "base": "ex:", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/bsbm1.json b/test/parsedQueries/bsbm1.json index 444320d7..6e3fb1e8 100644 --- a/test/parsedQueries/bsbm1.json +++ b/test/parsedQueries/bsbm1.json @@ -1,15 +1,14 @@ { - "type": "query", - "prefixes": { - "bsbm-inst": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/", - "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - }, "queryType": "SELECT", "variables": [ - "?product", - "?label" + { + "termType": "Variable", + "value": "product" + }, + { + "termType": "Variable", + "value": "label" + } ], "distinct": true, "where": [ @@ -17,29 +16,71 @@ "type": "bgp", "triples": [ { - "subject": "?product", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "?label" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Variable", + "value": "label" + } }, { - "subject": "?product", + "subject": { + "termType": "Variable", + "value": "product" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType105" + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType105" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature815" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature815" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature814" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature814" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric1", - "object": "?value1" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric1" + }, + "object": { + "termType": "Variable", + "value": "value1" + } } ] }, @@ -49,14 +90,37 @@ "type": "operation", "operator": ">", "args": [ - "?value1", - "\"486\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "value1" + }, + { + "termType": "Literal", + "value": "486", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } } ], "order": [ - { "expression": "?label" } + { + "expression": { + "termType": "Variable", + "value": "label" + } + } ], - "limit": 10 -} + "limit": 10, + "type": "query", + "prefixes": { + "bsbm-inst": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/", + "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/bsbm10.json b/test/parsedQueries/bsbm10.json index 2bdf78f6..02137a43 100644 --- a/test/parsedQueries/bsbm10.json +++ b/test/parsedQueries/bsbm10.json @@ -1,14 +1,14 @@ { - "type": "query", - "prefixes": { - "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", - "xsd": "http://www.w3.org/2001/XMLSchema#", - "dc": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?offer", - "?price" + { + "termType": "Variable", + "value": "offer" + }, + { + "termType": "Variable", + "value": "price" + } ], "distinct": true, "where": [ @@ -16,29 +16,74 @@ "type": "bgp", "triples": [ { - "subject": "?offer", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/product", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer5/Product186" + "subject": { + "termType": "Variable", + "value": "offer" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/product" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer5/Product186" + } }, { - "subject": "?offer", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/vendor", - "object": "?vendor" + "subject": { + "termType": "Variable", + "value": "offer" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/vendor" + }, + "object": { + "termType": "Variable", + "value": "vendor" + } }, { - "subject": "?offer", - "predicate": "http://purl.org/dc/elements/1.1/publisher", - "object": "?vendor" + "subject": { + "termType": "Variable", + "value": "offer" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/publisher" + }, + "object": { + "termType": "Variable", + "value": "vendor" + } }, { - "subject": "?vendor", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/country", - "object": "http://downlode.org/rdf/iso-3166/countries#US" + "subject": { + "termType": "Variable", + "value": "vendor" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/country" + }, + "object": { + "termType": "NamedNode", + "value": "http://downlode.org/rdf/iso-3166/countries#US" + } }, { - "subject": "?offer", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/deliveryDays", - "object": "?deliveryDays" + "subject": { + "termType": "Variable", + "value": "offer" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/deliveryDays" + }, + "object": { + "termType": "Variable", + "value": "deliveryDays" + } } ] }, @@ -48,8 +93,19 @@ "type": "operation", "operator": "<=", "args": [ - "?deliveryDays", - "\"3\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "deliveryDays" + }, + { + "termType": "Literal", + "value": "3", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } }, @@ -57,14 +113,32 @@ "type": "bgp", "triples": [ { - "subject": "?offer", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/price", - "object": "?price" + "subject": { + "termType": "Variable", + "value": "offer" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/price" + }, + "object": { + "termType": "Variable", + "value": "price" + } }, { - "subject": "?offer", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/validTo", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "offer" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/validTo" + }, + "object": { + "termType": "Variable", + "value": "date" + } } ] }, @@ -74,8 +148,19 @@ "type": "operation", "operator": ">", "args": [ - "?date", - "\"2008-06-20T00:00:00\"^^http://www.w3.org/2001/XMLSchema#dateTime" + { + "termType": "Variable", + "value": "date" + }, + { + "termType": "Literal", + "value": "2008-06-20T00:00:00", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "[object Object]" + } + } ] } } @@ -84,13 +169,19 @@ { "expression": { "type": "functionCall", - "function": "http://www.w3.org/2001/XMLSchema#double", + "function": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#double" + }, "args": [ { "type": "operation", "operator": "str", "args": [ - "?price" + { + "termType": "Variable", + "value": "price" + } ] } ], @@ -98,5 +189,11 @@ } } ], - "limit": 10 -} + "limit": 10, + "type": "query", + "prefixes": { + "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/bsbm3.json b/test/parsedQueries/bsbm3.json index c9a5571d..1068fc10 100644 --- a/test/parsedQueries/bsbm3.json +++ b/test/parsedQueries/bsbm3.json @@ -1,24 +1,32 @@ { - "type": "query", - "prefixes": { - "bsbm-inst": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/", - "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - }, "queryType": "SELECT", "variables": [ - "?product", - "?label" + { + "termType": "Variable", + "value": "product" + }, + { + "termType": "Variable", + "value": "label" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?product", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "?label" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Variable", + "value": "label" + } } ] }, @@ -29,14 +37,32 @@ "type": "bgp", "triples": [ { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature1043" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature1043" + } }, { - "subject": "?product", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "?testVar" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Variable", + "value": "testVar" + } } ] } @@ -52,7 +78,10 @@ "type": "operation", "operator": "bound", "args": [ - "?testVar" + { + "termType": "Variable", + "value": "testVar" + } ] } ] @@ -61,8 +90,18 @@ ], "order": [ { - "expression": "?label" + "expression": { + "termType": "Variable", + "value": "label" + } } ], - "limit": 10 -} + "limit": 10, + "type": "query", + "prefixes": { + "bsbm-inst": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/", + "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/bsbm4.json b/test/parsedQueries/bsbm4.json index b9c132b1..2fb2052c 100644 --- a/test/parsedQueries/bsbm4.json +++ b/test/parsedQueries/bsbm4.json @@ -1,16 +1,18 @@ { - "type": "query", - "prefixes": { - "bsbm-inst": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/", - "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - }, "queryType": "SELECT", "variables": [ - "?product", - "?label", - "?propertyTextual" + { + "termType": "Variable", + "value": "product" + }, + { + "termType": "Variable", + "value": "label" + }, + { + "termType": "Variable", + "value": "propertyTextual" + } ], "distinct": true, "where": [ @@ -24,34 +26,88 @@ "type": "bgp", "triples": [ { - "subject": "?product", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "?label" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Variable", + "value": "label" + } }, { - "subject": "?product", - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType140" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType140" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature4373" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature4373" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature1475" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature1475" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyTextual1", - "object": "?propertyTextual" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyTextual1" + }, + "object": { + "termType": "Variable", + "value": "propertyTextual" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric1", - "object": "?p1" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric1" + }, + "object": { + "termType": "Variable", + "value": "p1" + } } ] }, @@ -61,8 +117,19 @@ "type": "operation", "operator": ">", "args": [ - "?p1", - "\"160\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "p1" + }, + { + "termType": "Literal", + "value": "160", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } } @@ -75,34 +142,88 @@ "type": "bgp", "triples": [ { - "subject": "?product", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "?label" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Variable", + "value": "label" + } }, { - "subject": "?product", - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType140" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType140" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature4373" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature4373" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature4372" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature4372" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyTextual1", - "object": "?propertyTextual" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyTextual1" + }, + "object": { + "termType": "Variable", + "value": "propertyTextual" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric2", - "object": "?p2" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric2" + }, + "object": { + "termType": "Variable", + "value": "p2" + } } ] }, @@ -112,8 +233,19 @@ "type": "operation", "operator": ">", "args": [ - "?p2", - "\"77\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "p2" + }, + { + "termType": "Literal", + "value": "77", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } } @@ -124,9 +256,19 @@ ], "order": [ { - "expression": "?label" + "expression": { + "termType": "Variable", + "value": "label" + } } ], "limit": 10, - "offset": 5 -} + "offset": 5, + "type": "query", + "prefixes": { + "bsbm-inst": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/", + "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/bsbm5.json b/test/parsedQueries/bsbm5.json index f6a462be..03fcded1 100644 --- a/test/parsedQueries/bsbm5.json +++ b/test/parsedQueries/bsbm5.json @@ -1,14 +1,14 @@ { - "type": "query", - "prefixes": { - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/" - }, "queryType": "SELECT", "variables": [ - "?product", - "?productLabel" + { + "termType": "Variable", + "value": "product" + }, + { + "termType": "Variable", + "value": "productLabel" + } ], "distinct": true, "where": [ @@ -16,9 +16,18 @@ "type": "bgp", "triples": [ { - "subject": "?product", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "?productLabel" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Variable", + "value": "productLabel" + } } ] }, @@ -28,8 +37,14 @@ "type": "operation", "operator": "!=", "args": [ - "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer1/Product28", - "?product" + { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer1/Product28" + }, + { + "termType": "Variable", + "value": "product" + } ] } }, @@ -37,24 +52,60 @@ "type": "bgp", "triples": [ { - "subject": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer1/Product28", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature", - "object": "?prodFeature" + "subject": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer1/Product28" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature" + }, + "object": { + "termType": "Variable", + "value": "prodFeature" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature", - "object": "?prodFeature" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productFeature" + }, + "object": { + "termType": "Variable", + "value": "prodFeature" + } }, { - "subject": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer1/Product28", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric1", - "object": "?origProperty1" + "subject": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer1/Product28" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric1" + }, + "object": { + "termType": "Variable", + "value": "origProperty1" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric1", - "object": "?simProperty1" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric1" + }, + "object": { + "termType": "Variable", + "value": "simProperty1" + } } ] }, @@ -68,13 +119,27 @@ "type": "operation", "operator": "<", "args": [ - "?simProperty1", + { + "termType": "Variable", + "value": "simProperty1" + }, { "type": "operation", "operator": "+", "args": [ - "?origProperty1", - "\"120\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "origProperty1" + }, + { + "termType": "Literal", + "value": "120", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } ] @@ -83,13 +148,27 @@ "type": "operation", "operator": ">", "args": [ - "?simProperty1", + { + "termType": "Variable", + "value": "simProperty1" + }, { "type": "operation", "operator": "-", "args": [ - "?origProperty1", - "\"120\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "origProperty1" + }, + { + "termType": "Literal", + "value": "120", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } ] @@ -101,14 +180,32 @@ "type": "bgp", "triples": [ { - "subject": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer1/Product28", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric2", - "object": "?origProperty2" + "subject": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer1/Product28" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric2" + }, + "object": { + "termType": "Variable", + "value": "origProperty2" + } }, { - "subject": "?product", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric2", - "object": "?simProperty2" + "subject": { + "termType": "Variable", + "value": "product" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/productPropertyNumeric2" + }, + "object": { + "termType": "Variable", + "value": "simProperty2" + } } ] }, @@ -122,13 +219,27 @@ "type": "operation", "operator": "<", "args": [ - "?simProperty2", + { + "termType": "Variable", + "value": "simProperty2" + }, { "type": "operation", "operator": "+", "args": [ - "?origProperty2", - "\"170\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "origProperty2" + }, + { + "termType": "Literal", + "value": "170", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } ] @@ -137,13 +248,27 @@ "type": "operation", "operator": ">", "args": [ - "?simProperty2", + { + "termType": "Variable", + "value": "simProperty2" + }, { "type": "operation", "operator": "-", "args": [ - "?origProperty2", - "\"170\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "origProperty2" + }, + { + "termType": "Literal", + "value": "170", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } ] @@ -154,8 +279,17 @@ ], "order": [ { - "expression": "?productLabel" + "expression": { + "termType": "Variable", + "value": "productLabel" + } } ], - "limit": 5 -} + "limit": 5, + "type": "query", + "prefixes": { + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/bsbm8.json b/test/parsedQueries/bsbm8.json index d773364a..43f2a531 100644 --- a/test/parsedQueries/bsbm8.json +++ b/test/parsedQueries/bsbm8.json @@ -1,41 +1,88 @@ { - "type": "query", - "prefixes": { - "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", - "dc": "http://purl.org/dc/elements/1.1/", - "rev": "http://purl.org/stuff/rev#", - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?title", - "?text", - "?reviewDate", - "?reviewer", - "?reviewerName", - "?rating1", - "?rating2", - "?rating3", - "?rating4" + { + "termType": "Variable", + "value": "title" + }, + { + "termType": "Variable", + "value": "text" + }, + { + "termType": "Variable", + "value": "reviewDate" + }, + { + "termType": "Variable", + "value": "reviewer" + }, + { + "termType": "Variable", + "value": "reviewerName" + }, + { + "termType": "Variable", + "value": "rating1" + }, + { + "termType": "Variable", + "value": "rating2" + }, + { + "termType": "Variable", + "value": "rating3" + }, + { + "termType": "Variable", + "value": "rating4" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?review", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/reviewFor", - "object": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer16/Product783" + "subject": { + "termType": "Variable", + "value": "review" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/reviewFor" + }, + "object": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer16/Product783" + } }, { - "subject": "?review", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "review" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } }, { - "subject": "?review", - "predicate": "http://purl.org/stuff/rev#text", - "object": "?text" + "subject": { + "termType": "Variable", + "value": "review" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/stuff/rev#text" + }, + "object": { + "termType": "Variable", + "value": "text" + } } ] }, @@ -49,10 +96,21 @@ "type": "operation", "operator": "lang", "args": [ - "?text" + { + "termType": "Variable", + "value": "text" + } ] }, - "\"EN\"" + { + "termType": "Literal", + "value": "EN", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } }, @@ -60,19 +118,46 @@ "type": "bgp", "triples": [ { - "subject": "?review", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/reviewDate", - "object": "?reviewDate" + "subject": { + "termType": "Variable", + "value": "review" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/reviewDate" + }, + "object": { + "termType": "Variable", + "value": "reviewDate" + } }, { - "subject": "?review", - "predicate": "http://purl.org/stuff/rev#reviewer", - "object": "?reviewer" + "subject": { + "termType": "Variable", + "value": "review" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/stuff/rev#reviewer" + }, + "object": { + "termType": "Variable", + "value": "reviewer" + } }, { - "subject": "?reviewer", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?reviewerName" + "subject": { + "termType": "Variable", + "value": "reviewer" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "reviewerName" + } } ] }, @@ -83,9 +168,18 @@ "type": "bgp", "triples": [ { - "subject": "?review", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/rating1", - "object": "?rating1" + "subject": { + "termType": "Variable", + "value": "review" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/rating1" + }, + "object": { + "termType": "Variable", + "value": "rating1" + } } ] } @@ -98,9 +192,18 @@ "type": "bgp", "triples": [ { - "subject": "?review", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/rating2", - "object": "?rating2" + "subject": { + "termType": "Variable", + "value": "review" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/rating2" + }, + "object": { + "termType": "Variable", + "value": "rating2" + } } ] } @@ -113,9 +216,18 @@ "type": "bgp", "triples": [ { - "subject": "?review", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/rating3", - "object": "?rating3" + "subject": { + "termType": "Variable", + "value": "review" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/rating3" + }, + "object": { + "termType": "Variable", + "value": "rating3" + } } ] } @@ -128,9 +240,18 @@ "type": "bgp", "triples": [ { - "subject": "?review", - "predicate": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/rating4", - "object": "?rating4" + "subject": { + "termType": "Variable", + "value": "review" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/rating4" + }, + "object": { + "termType": "Variable", + "value": "rating4" + } } ] } @@ -139,9 +260,19 @@ ], "order": [ { - "expression": "?reviewDate", + "expression": { + "termType": "Variable", + "value": "reviewDate" + }, "descending": true } ], - "limit": 20 -} + "limit": 20, + "type": "query", + "prefixes": { + "bsbm": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/", + "dc": "http://purl.org/dc/elements/1.1/", + "rev": "http://purl.org/stuff/rev#", + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/bsbm9.json b/test/parsedQueries/bsbm9.json index 2972e84d..ef86d3d5 100644 --- a/test/parsedQueries/bsbm9.json +++ b/test/parsedQueries/bsbm9.json @@ -1,22 +1,34 @@ { - "type": "query", - "prefixes": { - "rev": "http://purl.org/stuff/rev#" - }, "queryType": "DESCRIBE", "variables": [ - "?x" + { + "termType": "Variable", + "value": "x" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromRatingSite1/Review7958", - "predicate": "http://purl.org/stuff/rev#reviewer", - "object": "?x" + "subject": { + "termType": "NamedNode", + "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromRatingSite1/Review7958" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/stuff/rev#reviewer" + }, + "object": { + "termType": "Variable", + "value": "x" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "rev": "http://purl.org/stuff/rev#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/clear-drop.json b/test/parsedQueries/clear-drop.json index 894a6afc..0c1e5ded 100644 --- a/test/parsedQueries/clear-drop.json +++ b/test/parsedQueries/clear-drop.json @@ -6,7 +6,10 @@ "silent": true, "graph": { "type": "graph", - "name": "ex:graph" + "name": { + "termType": "NamedNode", + "value": "ex:graph" + } } }, { @@ -14,7 +17,10 @@ "silent": false, "graph": { "type": "graph", - "name": "ex:graph" + "name": { + "termType": "NamedNode", + "value": "ex:graph" + } } }, { @@ -22,7 +28,10 @@ "silent": true, "graph": { "type": "graph", - "name": "ex:graph" + "name": { + "termType": "NamedNode", + "value": "ex:graph" + } } }, { @@ -30,7 +39,10 @@ "silent": false, "graph": { "type": "graph", - "name": "ex:graph" + "name": { + "termType": "NamedNode", + "value": "ex:graph" + } } }, { @@ -59,7 +71,10 @@ "silent": true, "graph": { "type": "graph", - "name": "ex:graph" + "name": { + "termType": "NamedNode", + "value": "ex:graph" + } } }, { @@ -67,7 +82,10 @@ "silent": false, "graph": { "type": "graph", - "name": "ex:graph" + "name": { + "termType": "NamedNode", + "value": "ex:graph" + } } }, { @@ -91,7 +109,6 @@ "all": true } } - ], "prefixes": {} -} +} \ No newline at end of file diff --git a/test/parsedQueries/compact-bgp.json b/test/parsedQueries/compact-bgp.json index db6aa4a3..193178ad 100644 --- a/test/parsedQueries/compact-bgp.json +++ b/test/parsedQueries/compact-bgp.json @@ -8,64 +8,172 @@ "type": "bgp", "triples": [ { - "subject": "ex:s1", - "predicate": "ex:p1", - "object": "ex:o1" + "subject": { + "termType": "NamedNode", + "value": "ex:s1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p1" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o1" + } }, { - "subject": "ex:s1", - "predicate": "ex:p2", - "object": "ex:o2" + "subject": { + "termType": "NamedNode", + "value": "ex:s1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p2" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o2" + } }, { - "subject": "ex:s1", - "predicate": "ex:p3", - "object": "_:b1" + "subject": { + "termType": "NamedNode", + "value": "ex:s1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p3" + }, + "object": { + "termType": "BlankNode", + "value": "1" + } }, { - "subject": "_:b1", - "predicate": "ex:p4", - "object": "ex:o4" + "subject": { + "termType": "BlankNode", + "value": "1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p4" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o4" + } }, { - "subject": "_:b1", - "predicate": "ex:p5", - "object": "_:b0" + "subject": { + "termType": "BlankNode", + "value": "1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p5" + }, + "object": { + "termType": "BlankNode", + "value": "n3-1" + } }, { - "subject": "_:b0", - "predicate": "ex:p6", - "object": "ex:o6" + "subject": { + "termType": "BlankNode", + "value": "n3-1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p6" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o6" + } }, { - "subject": "_:b0", - "predicate": "ex:p7", - "object": "ex:o7" + "subject": { + "termType": "BlankNode", + "value": "n3-1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p7" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o7" + } }, { - "subject": "_:b0", - "predicate": "ex:p7", - "object": "ex:o7a" + "subject": { + "termType": "BlankNode", + "value": "n3-1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p7" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o7a" + } }, { - "subject": "_:b1", - "predicate": "ex:p8", - "object": "ex:o8" + "subject": { + "termType": "BlankNode", + "value": "1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p8" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o8" + } }, { - "subject": "ex:s1", - "predicate": "ex:p9", - "object": "ex:o9" + "subject": { + "termType": "NamedNode", + "value": "ex:s1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p9" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o9" + } }, { - "subject": "ex:s1", - "predicate": "ex:p9", - "object": "ex:o9a" + "subject": { + "termType": "NamedNode", + "value": "ex:s1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p9" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o9a" + } }, { - "subject": "ex:s1", - "predicate": "ex:p9", - "object": "ex:o9b" + "subject": { + "termType": "NamedNode", + "value": "ex:s1" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:p9" + }, + "object": { + "termType": "NamedNode", + "value": "ex:o9b" + } } ] } @@ -73,4 +181,4 @@ "type": "query", "base": "ex:", "prefixes": {} -} +} \ No newline at end of file diff --git a/test/parsedQueries/construct-extra-semicolon.json b/test/parsedQueries/construct-extra-semicolon.json index 28d5c606..3c6d0449 100644 --- a/test/parsedQueries/construct-extra-semicolon.json +++ b/test/parsedQueries/construct-extra-semicolon.json @@ -1,22 +1,49 @@ { - "type": "query", - "prefixes": {}, "queryType": "CONSTRUCT", "template": [ { - "subject": "?s", + "subject": { + "termType": "Variable", + "value": "s" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://example.org/ExampleThing" + "object": { + "termType": "NamedNode", + "value": "http://example.org/ExampleThing" + } }, { - "subject": "?s", - "predicate": "http://example.org/hasvalue", - "object": "\"value\"" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/hasvalue" + }, + "object": { + "termType": "Literal", + "value": "value", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ], "where": [ @@ -24,11 +51,22 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } - ] -} + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/construct-multi-extra-semicolons.json b/test/parsedQueries/construct-multi-extra-semicolons.json index 28d5c606..3c6d0449 100644 --- a/test/parsedQueries/construct-multi-extra-semicolons.json +++ b/test/parsedQueries/construct-multi-extra-semicolons.json @@ -1,22 +1,49 @@ { - "type": "query", - "prefixes": {}, "queryType": "CONSTRUCT", "template": [ { - "subject": "?s", + "subject": { + "termType": "Variable", + "value": "s" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://example.org/ExampleThing" + "object": { + "termType": "NamedNode", + "value": "http://example.org/ExampleThing" + } }, { - "subject": "?s", - "predicate": "http://example.org/hasvalue", - "object": "\"value\"" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/hasvalue" + }, + "object": { + "termType": "Literal", + "value": "value", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ], "where": [ @@ -24,11 +51,22 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } - ] -} + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/construct-without-template.json b/test/parsedQueries/construct-without-template.json index 250b6ad6..3fef421b 100644 --- a/test/parsedQueries/construct-without-template.json +++ b/test/parsedQueries/construct-without-template.json @@ -1,12 +1,19 @@ { - "type": "query", - "prefixes": {}, "queryType": "CONSTRUCT", "template": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ], "where": [ @@ -14,11 +21,22 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } - ] -} + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/construct.json b/test/parsedQueries/construct.json index 250b6ad6..3fef421b 100644 --- a/test/parsedQueries/construct.json +++ b/test/parsedQueries/construct.json @@ -1,12 +1,19 @@ { - "type": "query", - "prefixes": {}, "queryType": "CONSTRUCT", "template": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ], "where": [ @@ -14,11 +21,22 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } - ] -} + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/empty-values.json b/test/parsedQueries/empty-values.json index 7a02b165..6380ffa4 100644 --- a/test/parsedQueries/empty-values.json +++ b/test/parsedQueries/empty-values.json @@ -1,23 +1,32 @@ { - "prefixes": {}, "queryType": "SELECT", - "type": "query", "variables": [ "*" ], "where": [ { + "type": "bgp", "triples": [ { - "object": "?o", - "predicate": "?p", - "subject": "?s" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } - ], - "type": "bgp" + ] } ], + "type": "query", "values": [ {} - ] -} + ], + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/group-concat.json b/test/parsedQueries/group-concat.json index bc51085d..7191b8c7 100644 --- a/test/parsedQueries/group-concat.json +++ b/test/parsedQueries/group-concat.json @@ -1,45 +1,72 @@ { - "group": [ - { - "expression": "?s" - } - ], - "prefixes": {}, "queryType": "SELECT", - "type": "query", "variables": [ - "?s", + { + "termType": "Variable", + "value": "s" + }, { "expression": { - "expression": "?p", + "expression": { + "termType": "Variable", + "value": "p" + }, "type": "aggregate", "aggregation": "group_concat", - "separator": " ", - "distinct": false + "distinct": false, + "separator": " " }, - "variable": "?plist" + "variable": { + "termType": "Variable", + "value": "plist" + } }, { "expression": { - "expression": "?p", + "expression": { + "termType": "Variable", + "value": "p" + }, "type": "aggregate", "aggregation": "group_concat", - "separator": ",\"/", - "distinct": true + "distinct": true, + "separator": ",\"/" }, - "variable": "?plist2" + "variable": { + "termType": "Variable", + "value": "plist2" + } } ], "where": [ { + "type": "bgp", "triples": [ { - "object": "?c", - "predicate": "?p", - "subject": "?s" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "c" + } } - ], - "type": "bgp" + ] } - ] -} + ], + "group": [ + { + "expression": { + "termType": "Variable", + "value": "s" + } + } + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/group-variable.json b/test/parsedQueries/group-variable.json index a1340305..5e453926 100644 --- a/test/parsedQueries/group-variable.json +++ b/test/parsedQueries/group-variable.json @@ -1,15 +1,24 @@ { "queryType": "SELECT", "variables": [ - "?O12", + { + "termType": "Variable", + "value": "O12" + }, { "expression": { - "expression": "?O1", + "expression": { + "termType": "Variable", + "value": "O1" + }, "type": "aggregate", "aggregation": "count", "distinct": false }, - "variable": "?C" + "variable": { + "termType": "Variable", + "value": "C" + } } ], "where": [ @@ -17,14 +26,32 @@ "type": "bgp", "triples": [ { - "subject": "?S", - "predicate": "http://www.example.org/p", - "object": "?O1" + "subject": { + "termType": "Variable", + "value": "S" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.example.org/p" + }, + "object": { + "termType": "Variable", + "value": "O1" + } }, { - "subject": "?S", - "predicate": "http://www.example.org/q", - "object": "?O2" + "subject": { + "termType": "Variable", + "value": "S" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.example.org/q" + }, + "object": { + "termType": "Variable", + "value": "O2" + } } ] } @@ -35,20 +62,32 @@ "type": "operation", "operator": "+", "args": [ - "?O1", - "?O2" + { + "termType": "Variable", + "value": "O1" + }, + { + "termType": "Variable", + "value": "O2" + } ] }, - "variable": "?O12" + "variable": { + "termType": "Variable", + "value": "O12" + } } ], "order": [ { - "expression": "?O12" + "expression": { + "termType": "Variable", + "value": "O12" + } } ], "type": "query", "prefixes": { "": "http://www.example.org/" } -} +} \ No newline at end of file diff --git a/test/parsedQueries/in.json b/test/parsedQueries/in.json index 52fa83ac..e319f778 100644 --- a/test/parsedQueries/in.json +++ b/test/parsedQueries/in.json @@ -1,6 +1,4 @@ { - "type": "query", - "prefixes": {}, "queryType": "SELECT", "variables": [ "*" @@ -10,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?a", - "predicate": "?b", - "object": "?c" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "Variable", + "value": "b" + }, + "object": { + "termType": "Variable", + "value": "c" + } } ] }, @@ -22,11 +29,38 @@ "type": "operation", "operator": "in", "args": [ - "?a", + { + "termType": "Variable", + "value": "a" + }, [ - "\"1\"^^http://www.w3.org/2001/XMLSchema#integer", - "\"2\"^^http://www.w3.org/2001/XMLSchema#integer", - "\"3\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Literal", + "value": "1", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + }, + { + "termType": "Literal", + "value": "2", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + }, + { + "termType": "Literal", + "value": "3", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] ] } @@ -37,14 +71,43 @@ "type": "operation", "operator": "notin", "args": [ - "?c", + { + "termType": "Variable", + "value": "c" + }, [ - "\"1\"^^http://www.w3.org/2001/XMLSchema#integer", - "\"2\"^^http://www.w3.org/2001/XMLSchema#integer", - "\"3\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Literal", + "value": "1", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + }, + { + "termType": "Literal", + "value": "2", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + }, + { + "termType": "Literal", + "value": "3", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] ] } } - ] -} + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/lists.json b/test/parsedQueries/lists.json index 110d663f..dd243181 100644 --- a/test/parsedQueries/lists.json +++ b/test/parsedQueries/lists.json @@ -1,96 +1,195 @@ { - "type": "query", - "base": "ex:", - "prefixes": {}, "queryType": "CONSTRUCT", "template": [ { - "subject": "?s0", - "predicate": "?p0", - "object": "_:b2" + "subject": { + "termType": "Variable", + "value": "s0" + }, + "predicate": { + "termType": "Variable", + "value": "p0" + }, + "object": { + "termType": "BlankNode", + "value": "2" + } }, { - "subject": "_:b2", + "subject": { + "termType": "BlankNode", + "value": "2" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:a0" + "object": { + "termType": "NamedNode", + "value": "ex:a0" + } }, { - "subject": "_:b2", + "subject": { + "termType": "BlankNode", + "value": "2" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b3" + "object": { + "termType": "BlankNode", + "value": "3" + } }, { - "subject": "_:b3", + "subject": { + "termType": "BlankNode", + "value": "3" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "_:b0" + "object": { + "termType": "BlankNode", + "value": "n3-2" + } }, { - "subject": "_:b3", + "subject": { + "termType": "BlankNode", + "value": "3" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "_:b0", + "subject": { + "termType": "BlankNode", + "value": "n3-2" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:b0" + "object": { + "termType": "NamedNode", + "value": "ex:b0" + } }, { - "subject": "_:b0", + "subject": { + "termType": "BlankNode", + "value": "n3-2" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b1" + "object": { + "termType": "BlankNode", + "value": "1" + } }, { - "subject": "_:b1", + "subject": { + "termType": "BlankNode", + "value": "1" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:c0" + "object": { + "termType": "NamedNode", + "value": "ex:c0" + } }, { - "subject": "_:b1", + "subject": { + "termType": "BlankNode", + "value": "1" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "_:b6", - "predicate": "?p0", - "object": "?o0" + "subject": { + "termType": "BlankNode", + "value": "6" + }, + "predicate": { + "termType": "Variable", + "value": "p0" + }, + "object": { + "termType": "Variable", + "value": "o0" + } }, { - "subject": "_:b6", + "subject": { + "termType": "BlankNode", + "value": "6" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:a0" + "object": { + "termType": "NamedNode", + "value": "ex:a0" + } }, { - "subject": "_:b6", + "subject": { + "termType": "BlankNode", + "value": "6" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b7" + "object": { + "termType": "BlankNode", + "value": "7" + } }, { - "subject": "_:b7", + "subject": { + "termType": "BlankNode", + "value": "7" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "_:b4" + "object": { + "termType": "BlankNode", + "value": "4" + } }, { - "subject": "_:b7", + "subject": { + "termType": "BlankNode", + "value": "7" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "_:b4", + "subject": { + "termType": "BlankNode", + "value": "4" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:b0" + "object": { + "termType": "NamedNode", + "value": "ex:b0" + } }, { - "subject": "_:b4", + "subject": { + "termType": "BlankNode", + "value": "4" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b5" + "object": { + "termType": "BlankNode", + "value": "5" + } }, { - "subject": "_:b5", + "subject": { + "termType": "BlankNode", + "value": "5" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:c0" + "object": { + "termType": "NamedNode", + "value": "ex:c0" + } }, { - "subject": "_:b5", + "subject": { + "termType": "BlankNode", + "value": "5" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" } @@ -100,211 +199,463 @@ "type": "bgp", "triples": [ { - "subject": "?s1", - "predicate": "?p1", + "subject": { + "termType": "Variable", + "value": "s1" + }, + "predicate": { + "termType": "Variable", + "value": "p1" + }, "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "?s1", - "predicate": "?p1", - "object": "ex:a1" + "subject": { + "termType": "Variable", + "value": "s1" + }, + "predicate": { + "termType": "Variable", + "value": "p1" + }, + "object": { + "termType": "NamedNode", + "value": "ex:a1" + } }, { "subject": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil", - "predicate": "?p2", - "object": "?o2" - }, - { - "subject": "?s3", - "predicate": "?p3", - "object": "_:b8" - }, - { - "subject": "_:b8", + "predicate": { + "termType": "Variable", + "value": "p2" + }, + "object": { + "termType": "Variable", + "value": "o2" + } + }, + { + "subject": { + "termType": "Variable", + "value": "s3" + }, + "predicate": { + "termType": "Variable", + "value": "p3" + }, + "object": { + "termType": "BlankNode", + "value": "8" + } + }, + { + "subject": { + "termType": "BlankNode", + "value": "8" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:a3" + "object": { + "termType": "NamedNode", + "value": "ex:a3" + } }, { - "subject": "_:b8", + "subject": { + "termType": "BlankNode", + "value": "8" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "?s4", - "predicate": "?p4", - "object": "_:b9" - }, - { - "subject": "_:b9", + "subject": { + "termType": "Variable", + "value": "s4" + }, + "predicate": { + "termType": "Variable", + "value": "p4" + }, + "object": { + "termType": "BlankNode", + "value": "9" + } + }, + { + "subject": { + "termType": "BlankNode", + "value": "9" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:a4" + "object": { + "termType": "NamedNode", + "value": "ex:a4" + } }, { - "subject": "_:b9", + "subject": { + "termType": "BlankNode", + "value": "9" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b10" + "object": { + "termType": "BlankNode", + "value": "10" + } }, { - "subject": "_:b10", + "subject": { + "termType": "BlankNode", + "value": "10" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:b4" + "object": { + "termType": "NamedNode", + "value": "ex:b4" + } }, { - "subject": "_:b10", + "subject": { + "termType": "BlankNode", + "value": "10" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b11" + "object": { + "termType": "BlankNode", + "value": "11" + } }, { - "subject": "_:b11", + "subject": { + "termType": "BlankNode", + "value": "11" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:c4" + "object": { + "termType": "NamedNode", + "value": "ex:c4" + } }, { - "subject": "_:b11", + "subject": { + "termType": "BlankNode", + "value": "11" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "?s5", - "predicate": "?p5", - "object": "_:b14" - }, - { - "subject": "_:b14", + "subject": { + "termType": "Variable", + "value": "s5" + }, + "predicate": { + "termType": "Variable", + "value": "p5" + }, + "object": { + "termType": "BlankNode", + "value": "14" + } + }, + { + "subject": { + "termType": "BlankNode", + "value": "14" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:a5" + "object": { + "termType": "NamedNode", + "value": "ex:a5" + } }, { - "subject": "_:b14", + "subject": { + "termType": "BlankNode", + "value": "14" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b15" + "object": { + "termType": "BlankNode", + "value": "15" + } }, { - "subject": "_:b15", + "subject": { + "termType": "BlankNode", + "value": "15" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "_:b12" + "object": { + "termType": "BlankNode", + "value": "12" + } }, { - "subject": "_:b15", + "subject": { + "termType": "BlankNode", + "value": "15" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "_:b12", + "subject": { + "termType": "BlankNode", + "value": "12" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:b5" + "object": { + "termType": "NamedNode", + "value": "ex:b5" + } }, { - "subject": "_:b12", + "subject": { + "termType": "BlankNode", + "value": "12" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b13" + "object": { + "termType": "BlankNode", + "value": "13" + } }, { - "subject": "_:b13", + "subject": { + "termType": "BlankNode", + "value": "13" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:c5" + "object": { + "termType": "NamedNode", + "value": "ex:c5" + } }, { - "subject": "_:b13", + "subject": { + "termType": "BlankNode", + "value": "13" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "_:b18", - "predicate": "?p6", - "object": "?o6" - }, - { - "subject": "_:b18", + "subject": { + "termType": "BlankNode", + "value": "18" + }, + "predicate": { + "termType": "Variable", + "value": "p6" + }, + "object": { + "termType": "Variable", + "value": "o6" + } + }, + { + "subject": { + "termType": "BlankNode", + "value": "18" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:a6" + "object": { + "termType": "NamedNode", + "value": "ex:a6" + } }, { - "subject": "_:b18", + "subject": { + "termType": "BlankNode", + "value": "18" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b19" + "object": { + "termType": "BlankNode", + "value": "19" + } }, { - "subject": "_:b19", + "subject": { + "termType": "BlankNode", + "value": "19" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "_:b16" + "object": { + "termType": "BlankNode", + "value": "16" + } }, { - "subject": "_:b19", + "subject": { + "termType": "BlankNode", + "value": "19" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "_:b16", + "subject": { + "termType": "BlankNode", + "value": "16" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:b6" + "object": { + "termType": "NamedNode", + "value": "ex:b6" + } }, { - "subject": "_:b16", + "subject": { + "termType": "BlankNode", + "value": "16" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b17" + "object": { + "termType": "BlankNode", + "value": "17" + } }, { - "subject": "_:b17", + "subject": { + "termType": "BlankNode", + "value": "17" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:c6" + "object": { + "termType": "NamedNode", + "value": "ex:c6" + } }, { - "subject": "_:b17", + "subject": { + "termType": "BlankNode", + "value": "17" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "_:b20", + "subject": { + "termType": "BlankNode", + "value": "20" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:a7" + "object": { + "termType": "NamedNode", + "value": "ex:a7" + } }, { - "subject": "_:b20", + "subject": { + "termType": "BlankNode", + "value": "20" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "_:b21" + "object": { + "termType": "BlankNode", + "value": "21" + } }, { - "subject": "_:b21", + "subject": { + "termType": "BlankNode", + "value": "21" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "ex:b7" + "object": { + "termType": "NamedNode", + "value": "ex:b7" + } }, { - "subject": "_:b21", + "subject": { + "termType": "BlankNode", + "value": "21" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "?s8", - "predicate": "?p8", - "object": "_:b23" - }, - { - "subject": "_:b23", + "subject": { + "termType": "Variable", + "value": "s8" + }, + "predicate": { + "termType": "Variable", + "value": "p8" + }, + "object": { + "termType": "BlankNode", + "value": "23" + } + }, + { + "subject": { + "termType": "BlankNode", + "value": "23" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", - "object": "_:b22" + "object": { + "termType": "BlankNode", + "value": "22" + } }, { - "subject": "_:b23", + "subject": { + "termType": "BlankNode", + "value": "23" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" }, { - "subject": "_:b22", - "predicate": "ex:a8", - "object": "ex:b8" - }, - { - "subject": "_:b22", - "predicate": "ex:c8", - "object": "ex:d8" - }, - { - "subject": "_:b22", - "predicate": "ex:c8", - "object": "ex:e8" + "subject": { + "termType": "BlankNode", + "value": "22" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:a8" + }, + "object": { + "termType": "NamedNode", + "value": "ex:b8" + } + }, + { + "subject": { + "termType": "BlankNode", + "value": "22" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:c8" + }, + "object": { + "termType": "NamedNode", + "value": "ex:d8" + } + }, + { + "subject": { + "termType": "BlankNode", + "value": "22" + }, + "predicate": { + "termType": "NamedNode", + "value": "ex:c8" + }, + "object": { + "termType": "NamedNode", + "value": "ex:e8" + } } ] } - ] -} + ], + "type": "query", + "base": "ex:", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/load-into.json b/test/parsedQueries/load-into.json index 98e947ac..4a711353 100644 --- a/test/parsedQueries/load-into.json +++ b/test/parsedQueries/load-into.json @@ -1,12 +1,18 @@ { "type": "update", - "prefixes": {}, "updates": [ { "type": "load", "silent": false, - "source": "http://www.w3.org/TR/skos-reference/skos.rdf", - "destination": "urn:namespaces:skos" + "source": { + "termType": "NamedNode", + "value": "http://www.w3.org/TR/skos-reference/skos.rdf" + }, + "destination": { + "termType": "NamedNode", + "value": "urn:namespaces:skos" + } } - ] -} + ], + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/load.json b/test/parsedQueries/load.json index 8d499ecf..d65494ff 100644 --- a/test/parsedQueries/load.json +++ b/test/parsedQueries/load.json @@ -1,11 +1,14 @@ { "type": "update", - "prefixes": {}, "updates": [ { "type": "load", "silent": false, - "source": "http://www.w3.org/TR/skos-reference/skos.rdf" + "source": { + "termType": "NamedNode", + "value": "http://www.w3.org/TR/skos-reference/skos.rdf" + } } - ] -} + ], + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/multiline.json b/test/parsedQueries/multiline.json index e66c0ef6..49e2c374 100644 --- a/test/parsedQueries/multiline.json +++ b/test/parsedQueries/multiline.json @@ -1,20 +1,37 @@ { - "type": "query", - "queryType": "SELECT", - "variables": [ - "?p" - ], - "where": [ + "queryType": "SELECT", + "variables": [ + { + "termType": "Variable", + "value": "p" + } + ], + "where": [ + { + "type": "bgp", + "triples": [ { - "type": "bgp", - "triples": [ - { - "subject": "?p", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "\"York\ntest\"@en" - } - ] + "subject": { + "termType": "Variable", + "value": "p" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Literal", + "value": "York\ntest", + "language": "en", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString" + } + } } - ], - "prefixes": {} -} + ] + } + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/negate-and.json b/test/parsedQueries/negate-and.json index 60574cf3..fac5413c 100644 --- a/test/parsedQueries/negate-and.json +++ b/test/parsedQueries/negate-and.json @@ -11,9 +11,15 @@ "type": "bgp", "triples": [ { - "subject": "?c", + "subject": { + "termType": "Variable", + "value": "c" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://www.w3.org/2002/07/owl#Class" + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/2002/07/owl#Class" + } } ] } @@ -33,7 +39,10 @@ "type": "operation", "operator": "bound", "args": [ - "?c" + { + "termType": "Variable", + "value": "c" + } ] }, { @@ -44,11 +53,30 @@ "type": "operation", "operator": "str", "args": [ - "?c" + { + "termType": "Variable", + "value": "c" + } ] }, - "\"^toto\"", - "\"i\"" + { + "termType": "Literal", + "value": "^toto", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + }, + { + "termType": "Literal", + "value": "i", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } ] @@ -62,4 +90,4 @@ "prefixes": { "owl": "http://www.w3.org/2002/07/owl#" } -} +} \ No newline at end of file diff --git a/test/parsedQueries/nested-path.json b/test/parsedQueries/nested-path.json index 4d6ed9bb..e1922b25 100644 --- a/test/parsedQueries/nested-path.json +++ b/test/parsedQueries/nested-path.json @@ -1,14 +1,20 @@ { "queryType": "SELECT", "variables": [ - "?X" + { + "termType": "Variable", + "value": "X" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "http://example.org/A0", + "subject": { + "termType": "NamedNode", + "value": "http://example.org/A0" + }, "predicate": { "type": "path", "pathType": "*", @@ -17,23 +23,32 @@ "type": "path", "pathType": "*", "items": [ - "http://example.org/P" + { + "termType": "NamedNode", + "value": "http://example.org/P" + } ] } ] }, - "object": "?X" + "object": { + "termType": "Variable", + "value": "X" + } } ] } ], "order": [ { - "expression": "?X" + "expression": { + "termType": "Variable", + "value": "X" + } } ], "type": "query", "prefixes": { "": "http://example.org/" } -} +} \ No newline at end of file diff --git a/test/parsedQueries/optional-subquery.json b/test/parsedQueries/optional-subquery.json index 8ad85a33..d7b1f88b 100644 --- a/test/parsedQueries/optional-subquery.json +++ b/test/parsedQueries/optional-subquery.json @@ -5,8 +5,8 @@ ], "where": [ { - "patterns": [], - "type": "group" + "type": "group", + "patterns": [] }, { "type": "optional", @@ -21,9 +21,18 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } @@ -35,4 +44,4 @@ ], "type": "query", "prefixes": {} -} +} \ No newline at end of file diff --git a/test/parsedQueries/or.json b/test/parsedQueries/or.json index 081b7c0c..b38ae430 100644 --- a/test/parsedQueries/or.json +++ b/test/parsedQueries/or.json @@ -1,6 +1,4 @@ { - "prefixes": {}, - "type": "query", "queryType": "SELECT", "variables": [ "*" @@ -10,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?a", - "predicate": "?b", - "object": "?c" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "Variable", + "value": "b" + }, + "object": { + "termType": "Variable", + "value": "c" + } } ] }, @@ -33,26 +40,82 @@ { "type": "operation", "operator": "=", - "args": [ "?a", "\"1\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "1", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] }, { "type": "operation", "operator": "=", - "args": [ "?a", "\"2\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "2", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] } ] }, { "type": "operation", "operator": "=", - "args": [ "?a", "\"3\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "3", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] } ] }, { "type": "operation", "operator": "=", - "args": [ "?a", "\"4\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "4", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] } ] } @@ -74,26 +137,82 @@ { "type": "operation", "operator": "=", - "args": [ "?a", "\"1\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "1", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] }, { "type": "operation", "operator": "=", - "args": [ "?a", "\"2\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "2", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] } ] }, { "type": "operation", "operator": "=", - "args": [ "?a", "\"3\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "3", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] } ] }, { "type": "operation", "operator": "=", - "args": [ "?a", "\"4\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "4", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] } ] } @@ -111,12 +230,40 @@ { "type": "operation", "operator": "=", - "args": [ "?a", "\"1\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "1", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] }, { "type": "operation", "operator": "=", - "args": [ "?a", "\"2\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "2", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] } ] }, @@ -127,17 +274,47 @@ { "type": "operation", "operator": "=", - "args": [ "?a", "\"3\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "3", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] }, { "type": "operation", "operator": "=", - "args": [ "?a", "\"4\"^^http://www.w3.org/2001/XMLSchema#integer" ] + "args": [ + { + "termType": "Variable", + "value": "a" + }, + { + "termType": "Literal", + "value": "4", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } + ] } ] } ] } } - ] -} + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/order-operator.json b/test/parsedQueries/order-operator.json index e0cd4fc7..b2270cb6 100644 --- a/test/parsedQueries/order-operator.json +++ b/test/parsedQueries/order-operator.json @@ -8,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } @@ -21,8 +30,19 @@ "type": "operation", "operator": "+", "args": [ - "?o", - "\"5\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "o" + }, + { + "termType": "Literal", + "value": "5", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } } @@ -31,4 +51,4 @@ "prefixes": { "": "http://example.org/ns#" } -} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-10-1a.json b/test/parsedQueries/sparql-10-1a.json index a96401c8..a22de990 100644 --- a/test/parsedQueries/sparql-10-1a.json +++ b/test/parsedQueries/sparql-10-1a.json @@ -1,44 +1,80 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "ns": "http://example.org/ns#" - }, "queryType": "SELECT", "variables": [ - "?title", - "?price" + { + "termType": "Variable", + "value": "title" + }, + { + "termType": "Variable", + "value": "price" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://example.org/ns#price", - "object": "?p" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#price" + }, + "object": { + "termType": "Variable", + "value": "p" + } }, { - "subject": "?x", - "predicate": "http://example.org/ns#discount", - "object": "?discount" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#discount" + }, + "object": { + "termType": "Variable", + "value": "discount" + } } ] }, { "type": "bind", - "variable": "?price", + "variable": { + "termType": "Variable", + "value": "price" + }, "expression": { "type": "operation", "operator": "*", "args": [ - "?p", + { + "termType": "Variable", + "value": "p" + }, { "type": "operation", "operator": "-", "args": [ - "\"1\"^^http://www.w3.org/2001/XMLSchema#integer", - "?discount" + { + "termType": "Literal", + "value": "1", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + }, + { + "termType": "Variable", + "value": "discount" + } ] } ] @@ -50,8 +86,19 @@ "type": "operation", "operator": "<", "args": [ - "?price", - "\"20\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "price" + }, + { + "termType": "Literal", + "value": "20", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } }, @@ -59,11 +106,25 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "ns": "http://example.org/ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-10-1b.json b/test/parsedQueries/sparql-10-1b.json index ce9e7fab..aa6be45b 100644 --- a/test/parsedQueries/sparql-10-1b.json +++ b/test/parsedQueries/sparql-10-1b.json @@ -1,13 +1,14 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "ns": "http://example.org/ns#" - }, "queryType": "SELECT", "variables": [ - "?title", - "?price" + { + "termType": "Variable", + "value": "title" + }, + { + "termType": "Variable", + "value": "price" + } ], "where": [ { @@ -17,31 +18,66 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://example.org/ns#price", - "object": "?p" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#price" + }, + "object": { + "termType": "Variable", + "value": "p" + } }, { - "subject": "?x", - "predicate": "http://example.org/ns#discount", - "object": "?discount" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#discount" + }, + "object": { + "termType": "Variable", + "value": "discount" + } } ] }, { "type": "bind", - "variable": "?price", + "variable": { + "termType": "Variable", + "value": "price" + }, "expression": { "type": "operation", "operator": "*", "args": [ - "?p", + { + "termType": "Variable", + "value": "p" + }, { "type": "operation", "operator": "-", "args": [ - "\"1\"^^http://www.w3.org/2001/XMLSchema#integer", - "?discount" + { + "termType": "Literal", + "value": "1", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + }, + { + "termType": "Variable", + "value": "discount" + } ] } ] @@ -56,9 +92,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] } @@ -70,10 +115,26 @@ "type": "operation", "operator": "<", "args": [ - "?price", - "\"20\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "price" + }, + { + "termType": "Literal", + "value": "20", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "ns": "http://example.org/ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-10-2-2a.json b/test/parsedQueries/sparql-10-2-2a.json index c81258af..cd9c2e98 100644 --- a/test/parsedQueries/sparql-10-2-2a.json +++ b/test/parsedQueries/sparql-10-2-2a.json @@ -1,25 +1,34 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "": "http://example.org/book/", - "ns": "http://example.org/ns#" - }, "queryType": "SELECT", "variables": [ - "?book", - "?title", - "?price" + { + "termType": "Variable", + "value": "book" + }, + { + "termType": "Variable", + "value": "title" + }, + { + "termType": "Variable", + "value": "price" + } ], "where": [ { "type": "values", "values": [ { - "?book": "http://example.org/book/book1" + "[object Object]": { + "termType": "NamedNode", + "value": "http://example.org/book/book1" + } }, { - "?book": "http://example.org/book/book3" + "[object Object]": { + "termType": "NamedNode", + "value": "http://example.org/book/book3" + } } ] }, @@ -27,16 +36,40 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } }, { - "subject": "?book", - "predicate": "http://example.org/ns#price", - "object": "?price" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#price" + }, + "object": { + "termType": "Variable", + "value": "price" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "": "http://example.org/book/", + "ns": "http://example.org/ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-10-2-2b.json b/test/parsedQueries/sparql-10-2-2b.json index 7d21e766..7be3ca80 100644 --- a/test/parsedQueries/sparql-10-2-2b.json +++ b/test/parsedQueries/sparql-10-2-2b.json @@ -1,29 +1,50 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "": "http://example.org/book/", - "ns": "http://example.org/ns#" - }, "queryType": "SELECT", "variables": [ - "?book", - "?title", - "?price" + { + "termType": "Variable", + "value": "book" + }, + { + "termType": "Variable", + "value": "title" + }, + { + "termType": "Variable", + "value": "price" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } }, { - "subject": "?book", - "predicate": "http://example.org/ns#price", - "object": "?price" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#price" + }, + "object": { + "termType": "Variable", + "value": "price" + } } ] }, @@ -31,14 +52,29 @@ "type": "values", "values": [ { - "?title": "\"SPARQL Tutorial\"", - "?book": "{undefined}" + "?title": { + "termType": "Literal", + "value": "SPARQL Tutorial", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "?title": "{undefined}", - "?book": "http://example.org/book/book2" + "?book": { + "termType": "NamedNode", + "value": "http://example.org/book/book2" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "": "http://example.org/book/", + "ns": "http://example.org/ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-10-2-2c.json b/test/parsedQueries/sparql-10-2-2c.json index 47ec8f95..e229c626 100644 --- a/test/parsedQueries/sparql-10-2-2c.json +++ b/test/parsedQueries/sparql-10-2-2c.json @@ -1,41 +1,77 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "": "http://example.org/book/", - "ns": "http://example.org/ns#" - }, "queryType": "SELECT", "variables": [ - "?book", - "?title", - "?price" + { + "termType": "Variable", + "value": "book" + }, + { + "termType": "Variable", + "value": "title" + }, + { + "termType": "Variable", + "value": "price" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } }, { - "subject": "?book", - "predicate": "http://example.org/ns#price", - "object": "?price" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#price" + }, + "object": { + "termType": "Variable", + "value": "price" + } } ] } ], + "type": "query", "values": [ { - "?title": "\"SPARQL Tutorial\"", - "?book": "{undefined}" + "?title": { + "termType": "Literal", + "value": "SPARQL Tutorial", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "?title": "{undefined}", - "?book": "http://example.org/book/book2" + "?book": { + "termType": "NamedNode", + "value": "http://example.org/book/book2" + } } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "": "http://example.org/book/", + "ns": "http://example.org/ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-11-1.json b/test/parsedQueries/sparql-11-1.json index be8627b2..a7e86d65 100644 --- a/test/parsedQueries/sparql-11-1.json +++ b/test/parsedQueries/sparql-11-1.json @@ -1,18 +1,20 @@ { - "type": "query", - "prefixes": { - "": "http://books.example/" - }, "queryType": "SELECT", "variables": [ { "expression": { - "expression": "?lprice", + "expression": { + "termType": "Variable", + "value": "lprice" + }, "type": "aggregate", "aggregation": "sum", "distinct": false }, - "variable": "?totalPrice" + "variable": { + "termType": "Variable", + "value": "totalPrice" + } } ], "where": [ @@ -20,26 +22,56 @@ "type": "bgp", "triples": [ { - "subject": "?org", - "predicate": "http://books.example/affiliates", - "object": "?auth" + "subject": { + "termType": "Variable", + "value": "org" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://books.example/affiliates" + }, + "object": { + "termType": "Variable", + "value": "auth" + } }, { - "subject": "?auth", - "predicate": "http://books.example/writesBook", - "object": "?book" + "subject": { + "termType": "Variable", + "value": "auth" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://books.example/writesBook" + }, + "object": { + "termType": "Variable", + "value": "book" + } }, { - "subject": "?book", - "predicate": "http://books.example/price", - "object": "?lprice" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://books.example/price" + }, + "object": { + "termType": "Variable", + "value": "lprice" + } } ] } ], "group": [ { - "expression": "?org" + "expression": { + "termType": "Variable", + "value": "org" + } } ], "having": [ @@ -48,13 +80,28 @@ "operator": ">", "args": [ { - "expression": "?lprice", + "expression": { + "termType": "Variable", + "value": "lprice" + }, "type": "aggregate", "aggregation": "sum", "distinct": false }, - "\"10\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Literal", + "value": "10", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://books.example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-11-2.json b/test/parsedQueries/sparql-11-2.json index eb51a061..60dc917e 100644 --- a/test/parsedQueries/sparql-11-2.json +++ b/test/parsedQueries/sparql-11-2.json @@ -1,18 +1,20 @@ { - "type": "query", - "prefixes": { - "": "http://data.example/" - }, "queryType": "SELECT", "variables": [ { "expression": { - "expression": "?y", + "expression": { + "termType": "Variable", + "value": "y" + }, "type": "aggregate", "aggregation": "avg", "distinct": false }, - "variable": "?avg" + "variable": { + "termType": "Variable", + "value": "avg" + } } ], "where": [ @@ -20,21 +22,46 @@ "type": "bgp", "triples": [ { - "subject": "?a", - "predicate": "http://data.example/x", - "object": "?x" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://data.example/x" + }, + "object": { + "termType": "Variable", + "value": "x" + } }, { - "subject": "?a", - "predicate": "http://data.example/y", - "object": "?y" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://data.example/y" + }, + "object": { + "termType": "Variable", + "value": "y" + } } ] } ], "group": [ { - "expression": "?x" + "expression": { + "termType": "Variable", + "value": "x" + } } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://data.example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-11-3.json b/test/parsedQueries/sparql-11-3.json index d702bb59..4be6a45c 100644 --- a/test/parsedQueries/sparql-11-3.json +++ b/test/parsedQueries/sparql-11-3.json @@ -1,18 +1,20 @@ { - "type": "query", - "prefixes": { - "": "http://data.example/" - }, "queryType": "SELECT", "variables": [ { "expression": { - "expression": "?size", + "expression": { + "termType": "Variable", + "value": "size" + }, "type": "aggregate", "aggregation": "avg", "distinct": false }, - "variable": "?asize" + "variable": { + "termType": "Variable", + "value": "asize" + } } ], "where": [ @@ -20,16 +22,28 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://data.example/size", - "object": "?size" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://data.example/size" + }, + "object": { + "termType": "Variable", + "value": "size" + } } ] } ], "group": [ { - "expression": "?x" + "expression": { + "termType": "Variable", + "value": "x" + } } ], "having": [ @@ -38,13 +52,28 @@ "operator": ">", "args": [ { - "expression": "?size", + "expression": { + "termType": "Variable", + "value": "size" + }, "type": "aggregate", "aggregation": "avg", "distinct": false }, - "\"10\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Literal", + "value": "10", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://data.example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-11-4.json b/test/parsedQueries/sparql-11-4.json index 6139ce95..0611277b 100644 --- a/test/parsedQueries/sparql-11-4.json +++ b/test/parsedQueries/sparql-11-4.json @@ -1,26 +1,39 @@ { - "type": "query", - "prefixes": { - "": "http://example.com/data/#" - }, "queryType": "SELECT", "variables": [ - "?x", + { + "termType": "Variable", + "value": "x" + }, { "expression": { "type": "operation", "operator": "*", "args": [ { - "expression": "?y", + "expression": { + "termType": "Variable", + "value": "y" + }, "type": "aggregate", "aggregation": "min", "distinct": false }, - "\"2\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Literal", + "value": "2", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] }, - "variable": "?min" + "variable": { + "termType": "Variable", + "value": "min" + } } ], "where": [ @@ -28,30 +41,58 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://example.com/data/#p", - "object": "?y" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.com/data/#p" + }, + "object": { + "termType": "Variable", + "value": "y" + } }, { - "subject": "?x", - "predicate": "http://example.com/data/#q", - "object": "?z" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.com/data/#q" + }, + "object": { + "termType": "Variable", + "value": "z" + } } ] } ], "group": [ { - "expression": "?x" + "expression": { + "termType": "Variable", + "value": "x" + } }, { "expression": { "type": "operation", "operator": "str", "args": [ - "?z" + { + "termType": "Variable", + "value": "z" + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example.com/data/#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-11-5.json b/test/parsedQueries/sparql-11-5.json index a1a9a719..d582ff82 100644 --- a/test/parsedQueries/sparql-11-5.json +++ b/test/parsedQueries/sparql-11-5.json @@ -1,19 +1,24 @@ { - "type": "query", - "prefixes": { - "": "http://example.com/data/#" - }, "queryType": "SELECT", "variables": [ - "?g", + { + "termType": "Variable", + "value": "g" + }, { "expression": { - "expression": "?p", + "expression": { + "termType": "Variable", + "value": "p" + }, "type": "aggregate", "aggregation": "avg", "distinct": false }, - "variable": "?avg" + "variable": { + "termType": "Variable", + "value": "avg" + } }, { "expression": { @@ -25,23 +30,40 @@ "operator": "+", "args": [ { - "expression": "?p", + "expression": { + "termType": "Variable", + "value": "p" + }, "type": "aggregate", "aggregation": "min", "distinct": false }, { - "expression": "?p", + "expression": { + "termType": "Variable", + "value": "p" + }, "type": "aggregate", "aggregation": "max", "distinct": false } ] }, - "\"2\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Literal", + "value": "2", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] }, - "variable": "?c" + "variable": { + "termType": "Variable", + "value": "c" + } } ], "where": [ @@ -49,16 +71,32 @@ "type": "bgp", "triples": [ { - "subject": "?g", - "predicate": "http://example.com/data/#p", - "object": "?p" + "subject": { + "termType": "Variable", + "value": "g" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.com/data/#p" + }, + "object": { + "termType": "Variable", + "value": "p" + } } ] } ], "group": [ { - "expression": "?g" + "expression": { + "termType": "Variable", + "value": "g" + } } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example.com/data/#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-12.json b/test/parsedQueries/sparql-12.json index 47cdff3d..85dc1f3b 100644 --- a/test/parsedQueries/sparql-12.json +++ b/test/parsedQueries/sparql-12.json @@ -1,39 +1,59 @@ { - "type": "query", - "prefixes": { - "": "http://people.example/" - }, "queryType": "SELECT", "variables": [ - "?y", - "?minName" + { + "termType": "Variable", + "value": "y" + }, + { + "termType": "Variable", + "value": "minName" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "http://people.example/alice", - "predicate": "http://people.example/knows", - "object": "?y" + "subject": { + "termType": "NamedNode", + "value": "http://people.example/alice" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://people.example/knows" + }, + "object": { + "termType": "Variable", + "value": "y" + } } ] }, { + "type": "group", "patterns": [ { - "type": "query", "queryType": "SELECT", "variables": [ - "?y", + { + "termType": "Variable", + "value": "y" + }, { "expression": { - "expression": "?name", + "expression": { + "termType": "Variable", + "value": "name" + }, "type": "aggregate", "aggregation": "min", "distinct": false }, - "variable": "?minName" + "variable": { + "termType": "Variable", + "value": "minName" + } } ], "where": [ @@ -41,21 +61,37 @@ "type": "bgp", "triples": [ { - "subject": "?y", - "predicate": "http://people.example/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "y" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://people.example/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } ], "group": [ { - "expression": "?y" + "expression": { + "termType": "Variable", + "value": "y" + } } - ] + ], + "type": "query" } - ], - "type": "group" + ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://people.example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-13-2-1.json b/test/parsedQueries/sparql-13-2-1.json index 6091fa24..2182989d 100644 --- a/test/parsedQueries/sparql-13-2-1.json +++ b/test/parsedQueries/sparql-13-2-1.json @@ -1,15 +1,17 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "from": { "default": [ - "http://example.org/foaf/aliceFoaf" + { + "termType": "NamedNode", + "value": "http://example.org/foaf/aliceFoaf" + } ], "named": [] }, @@ -18,11 +20,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-13-2-2.json b/test/parsedQueries/sparql-13-2-2.json index 6a7e8e2a..076d84df 100644 --- a/test/parsedQueries/sparql-13-2-2.json +++ b/test/parsedQueries/sparql-13-2-2.json @@ -1,17 +1,22 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "from": { "default": [], "named": [ - "http://example.org/alice", - "http://example.org/bob" + { + "termType": "NamedNode", + "value": "http://example.org/alice" + }, + { + "termType": "NamedNode", + "value": "http://example.org/bob" + } ] }, "where": [ @@ -19,11 +24,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-13-2-3.json b/test/parsedQueries/sparql-13-2-3.json index 1a12d34d..13436f15 100644 --- a/test/parsedQueries/sparql-13-2-3.json +++ b/test/parsedQueries/sparql-13-2-3.json @@ -1,22 +1,35 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "dc": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?who", - "?g", - "?mbox" + { + "termType": "Variable", + "value": "who" + }, + { + "termType": "Variable", + "value": "g" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "from": { "default": [ - "http://example.org/dft.ttl" + { + "termType": "NamedNode", + "value": "http://example.org/dft.ttl" + } ], "named": [ - "http://example.org/alice", - "http://example.org/bob" + { + "termType": "NamedNode", + "value": "http://example.org/alice" + }, + { + "termType": "NamedNode", + "value": "http://example.org/bob" + } ] }, "where": [ @@ -24,9 +37,18 @@ "type": "bgp", "triples": [ { - "subject": "?g", - "predicate": "http://purl.org/dc/elements/1.1/publisher", - "object": "?who" + "subject": { + "termType": "Variable", + "value": "g" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/publisher" + }, + "object": { + "termType": "Variable", + "value": "who" + } } ] }, @@ -37,14 +59,31 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } ], - "name": "?g" + "name": { + "termType": "Variable", + "value": "g" + } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-13-3-1.json b/test/parsedQueries/sparql-13-3-1.json index 08f75d3a..2169f61d 100644 --- a/test/parsedQueries/sparql-13-3-1.json +++ b/test/parsedQueries/sparql-13-3-1.json @@ -1,18 +1,26 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?src", - "?bobNick" + { + "termType": "Variable", + "value": "src" + }, + { + "termType": "Variable", + "value": "bobNick" + } ], "from": { "default": [], "named": [ - "http://example.org/foaf/aliceFoaf", - "http://example.org/foaf/bobFoaf" + { + "termType": "NamedNode", + "value": "http://example.org/foaf/aliceFoaf" + }, + { + "termType": "NamedNode", + "value": "http://example.org/foaf/bobFoaf" + } ] }, "where": [ @@ -23,19 +31,44 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:bob@work.example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:bob@work.example" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/nick", - "object": "?bobNick" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/nick" + }, + "object": { + "termType": "Variable", + "value": "bobNick" + } } ] } ], - "name": "?src" + "name": { + "termType": "Variable", + "value": "src" + } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-13-3-2.json b/test/parsedQueries/sparql-13-3-2.json index 0a82f183..c6db3c73 100644 --- a/test/parsedQueries/sparql-13-3-2.json +++ b/test/parsedQueries/sparql-13-3-2.json @@ -1,18 +1,22 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "data": "http://example.org/foaf/" - }, "queryType": "SELECT", "variables": [ - "?nick" + { + "termType": "Variable", + "value": "nick" + } ], "from": { "default": [], "named": [ - "http://example.org/foaf/aliceFoaf", - "http://example.org/foaf/bobFoaf" + { + "termType": "NamedNode", + "value": "http://example.org/foaf/aliceFoaf" + }, + { + "termType": "NamedNode", + "value": "http://example.org/foaf/bobFoaf" + } ] }, "where": [ @@ -23,19 +27,45 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:bob@work.example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:bob@work.example" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/nick", - "object": "?nick" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/nick" + }, + "object": { + "termType": "Variable", + "value": "nick" + } } ] } ], - "name": "http://example.org/foaf/bobFoaf" + "name": { + "termType": "NamedNode", + "value": "http://example.org/foaf/bobFoaf" + } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "data": "http://example.org/foaf/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-13-3-3.json b/test/parsedQueries/sparql-13-3-3.json index 3249a8f6..e48624cc 100644 --- a/test/parsedQueries/sparql-13-3-3.json +++ b/test/parsedQueries/sparql-13-3-3.json @@ -1,21 +1,30 @@ { - "type": "query", - "prefixes": { - "data": "http://example.org/foaf/", - "foaf": "http://xmlns.com/foaf/0.1/", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#" - }, "queryType": "SELECT", "variables": [ - "?mbox", - "?nick", - "?ppd" + { + "termType": "Variable", + "value": "mbox" + }, + { + "termType": "Variable", + "value": "nick" + }, + { + "termType": "Variable", + "value": "ppd" + } ], "from": { "default": [], "named": [ - "http://example.org/foaf/aliceFoaf", - "http://example.org/foaf/bobFoaf" + { + "termType": "NamedNode", + "value": "http://example.org/foaf/aliceFoaf" + }, + { + "termType": "NamedNode", + "value": "http://example.org/foaf/bobFoaf" + } ] }, "where": [ @@ -26,34 +35,79 @@ "type": "bgp", "triples": [ { - "subject": "?alice", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@work.example" + "subject": { + "termType": "Variable", + "value": "alice" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@work.example" + } }, { - "subject": "?alice", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?whom" + "subject": { + "termType": "Variable", + "value": "alice" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "whom" + } }, { - "subject": "?whom", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "whom" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } }, { - "subject": "?whom", - "predicate": "http://www.w3.org/2000/01/rdf-schema#seeAlso", - "object": "?ppd" + "subject": { + "termType": "Variable", + "value": "whom" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#seeAlso" + }, + "object": { + "termType": "Variable", + "value": "ppd" + } }, { - "subject": "?ppd", + "subject": { + "termType": "Variable", + "value": "ppd" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://xmlns.com/foaf/0.1/PersonalProfileDocument" + "object": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/PersonalProfileDocument" + } } ] } ], - "name": "http://example.org/foaf/aliceFoaf" + "name": { + "termType": "NamedNode", + "value": "http://example.org/foaf/aliceFoaf" + } }, { "type": "graph", @@ -62,19 +116,46 @@ "type": "bgp", "triples": [ { - "subject": "?w", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "w" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } }, { - "subject": "?w", - "predicate": "http://xmlns.com/foaf/0.1/nick", - "object": "?nick" + "subject": { + "termType": "Variable", + "value": "w" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/nick" + }, + "object": { + "termType": "Variable", + "value": "nick" + } } ] } ], - "name": "?ppd" + "name": { + "termType": "Variable", + "value": "ppd" + } } - ] -} + ], + "type": "query", + "prefixes": { + "data": "http://example.org/foaf/", + "foaf": "http://xmlns.com/foaf/0.1/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-13-3-4.json b/test/parsedQueries/sparql-13-3-4.json index 19e7bcc7..e69b90f7 100644 --- a/test/parsedQueries/sparql-13-3-4.json +++ b/test/parsedQueries/sparql-13-3-4.json @@ -1,28 +1,50 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "dc": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox", - "?date" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + }, + { + "termType": "Variable", + "value": "date" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?g", - "predicate": "http://purl.org/dc/elements/1.1/publisher", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "g" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/publisher" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?g", - "predicate": "http://purl.org/dc/elements/1.1/date", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "g" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/date" + }, + "object": { + "termType": "Variable", + "value": "date" + } } ] }, @@ -33,19 +55,45 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } ], - "name": "?g" + "name": { + "termType": "Variable", + "value": "g" + } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-15-1a.json b/test/parsedQueries/sparql-15-1a.json index 2d7fd5c3..6a5b13d8 100644 --- a/test/parsedQueries/sparql-15-1a.json +++ b/test/parsedQueries/sparql-15-1a.json @@ -1,27 +1,42 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } ], "order": [ { - "expression": "?name" + "expression": { + "termType": "Variable", + "value": "name" + } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-15-1b.json b/test/parsedQueries/sparql-15-1b.json index 6c10fc25..6d14a528 100644 --- a/test/parsedQueries/sparql-15-1b.json +++ b/test/parsedQueries/sparql-15-1b.json @@ -1,34 +1,58 @@ { - "type": "query", - "prefixes": { - "": "http://example.org/ns#", - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://example.org/ns#empId", - "object": "?emp" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#empId" + }, + "object": { + "termType": "Variable", + "value": "emp" + } } ] } ], "order": [ { - "expression": "?emp", + "expression": { + "termType": "Variable", + "value": "emp" + }, "descending": true } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example.org/ns#", + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-15-1c.json b/test/parsedQueries/sparql-15-1c.json index eff19c47..bbf0ad3f 100644 --- a/test/parsedQueries/sparql-15-1c.json +++ b/test/parsedQueries/sparql-15-1c.json @@ -1,37 +1,64 @@ { - "type": "query", - "prefixes": { - "": "http://example.org/ns#", - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://example.org/ns#empId", - "object": "?emp" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#empId" + }, + "object": { + "termType": "Variable", + "value": "emp" + } } ] } ], "order": [ { - "expression": "?name" + "expression": { + "termType": "Variable", + "value": "name" + } }, { - "expression": "?emp", + "expression": { + "termType": "Variable", + "value": "emp" + }, "descending": true } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example.org/ns#", + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-15-2.json b/test/parsedQueries/sparql-15-2.json index b1b766a4..278e6246 100644 --- a/test/parsedQueries/sparql-15-2.json +++ b/test/parsedQueries/sparql-15-2.json @@ -1,22 +1,34 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-15-3-1.json b/test/parsedQueries/sparql-15-3-1.json index 81b22cb5..579055da 100644 --- a/test/parsedQueries/sparql-15-3-1.json +++ b/test/parsedQueries/sparql-15-3-1.json @@ -1,11 +1,10 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "distinct": true, "where": [ @@ -13,11 +12,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-15-3-2.json b/test/parsedQueries/sparql-15-3-2.json index ef5995ce..f89f7e66 100644 --- a/test/parsedQueries/sparql-15-3-2.json +++ b/test/parsedQueries/sparql-15-3-2.json @@ -1,11 +1,10 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "reduced": true, "where": [ @@ -13,11 +12,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-15-3.json b/test/parsedQueries/sparql-15-3.json index b1b766a4..278e6246 100644 --- a/test/parsedQueries/sparql-15-3.json +++ b/test/parsedQueries/sparql-15-3.json @@ -1,22 +1,34 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-15-4.json b/test/parsedQueries/sparql-15-4.json index 89657112..8fb1a768 100644 --- a/test/parsedQueries/sparql-15-4.json +++ b/test/parsedQueries/sparql-15-4.json @@ -1,29 +1,44 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } ], "order": [ { - "expression": "?name" + "expression": { + "termType": "Variable", + "value": "name" + } } ], "limit": 5, - "offset": 10 -} + "offset": 10, + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-15-5.json b/test/parsedQueries/sparql-15-5.json index 66b35af7..aa088af2 100644 --- a/test/parsedQueries/sparql-15-5.json +++ b/test/parsedQueries/sparql-15-5.json @@ -1,23 +1,35 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } ], - "limit": 20 -} + "limit": 20, + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-1-1.json b/test/parsedQueries/sparql-16-1-1.json index 5ee2d93b..c29114d9 100644 --- a/test/parsedQueries/sparql-16-1-1.json +++ b/test/parsedQueries/sparql-16-1-1.json @@ -1,32 +1,64 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?nameX", - "?nameY", - "?nickY" + { + "termType": "Variable", + "value": "nameX" + }, + { + "termType": "Variable", + "value": "nameY" + }, + { + "termType": "Variable", + "value": "nickY" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?y" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "y" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?nameX" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "nameX" + } }, { - "subject": "?y", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?nameY" + "subject": { + "termType": "Variable", + "value": "y" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "nameY" + } } ] }, @@ -37,13 +69,26 @@ "type": "bgp", "triples": [ { - "subject": "?y", - "predicate": "http://xmlns.com/foaf/0.1/nick", - "object": "?nickY" + "subject": { + "termType": "Variable", + "value": "y" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/nick" + }, + "object": { + "termType": "Variable", + "value": "nickY" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-1-2b.json b/test/parsedQueries/sparql-16-1-2b.json index 32930d8b..ca722389 100644 --- a/test/parsedQueries/sparql-16-1-2b.json +++ b/test/parsedQueries/sparql-16-1-2b.json @@ -1,33 +1,54 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "ns": "http://example.org/ns#" - }, "queryType": "SELECT", "variables": [ - "?title", { - "expression": "?p", - "variable": "?fullPrice" + "termType": "Variable", + "value": "title" + }, + { + "expression": { + "termType": "Variable", + "value": "p" + }, + "variable": { + "termType": "Variable", + "value": "fullPrice" + } }, { "expression": { "type": "operation", "operator": "*", "args": [ - "?fullPrice", + { + "termType": "Variable", + "value": "fullPrice" + }, { "type": "operation", "operator": "-", "args": [ - "\"1\"^^http://www.w3.org/2001/XMLSchema#integer", - "?discount" + { + "termType": "Literal", + "value": "1", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + }, + { + "termType": "Variable", + "value": "discount" + } ] } ] }, - "variable": "?customerPrice" + "variable": { + "termType": "Variable", + "value": "customerPrice" + } } ], "where": [ @@ -35,21 +56,53 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://example.org/ns#price", - "object": "?p" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#price" + }, + "object": { + "termType": "Variable", + "value": "p" + } }, { - "subject": "?x", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } }, { - "subject": "?x", - "predicate": "http://example.org/ns#discount", - "object": "?discount" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#discount" + }, + "object": { + "termType": "Variable", + "value": "discount" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "ns": "http://example.org/ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-2-1.json b/test/parsedQueries/sparql-16-2-1.json index 58501566..cb63f416 100644 --- a/test/parsedQueries/sparql-16-2-1.json +++ b/test/parsedQueries/sparql-16-2-1.json @@ -1,25 +1,38 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "vcard": "http://www.w3.org/2001/vcard-rdf/3.0#" - }, "queryType": "CONSTRUCT", "template": [ { - "subject": "?x", - "predicate": "http://www.w3.org/2001/vcard-rdf/3.0#N", + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/vcard-rdf/3.0#N" + }, "object": "_:v" }, { "subject": "_:v", - "predicate": "http://www.w3.org/2001/vcard-rdf/3.0#givenName", - "object": "?gname" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/vcard-rdf/3.0#givenName" + }, + "object": { + "termType": "Variable", + "value": "gname" + } }, { "subject": "_:v", - "predicate": "http://www.w3.org/2001/vcard-rdf/3.0#familyName", - "object": "?fname" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/vcard-rdf/3.0#familyName" + }, + "object": { + "termType": "Variable", + "value": "fname" + } } ], "where": [ @@ -30,9 +43,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/firstname", - "object": "?gname" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/firstname" + }, + "object": { + "termType": "Variable", + "value": "gname" + } } ] }, @@ -40,9 +62,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/givenname", - "object": "?gname" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenname" + }, + "object": { + "termType": "Variable", + "value": "gname" + } } ] } @@ -55,9 +86,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/surname", - "object": "?fname" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/surname" + }, + "object": { + "termType": "Variable", + "value": "fname" + } } ] }, @@ -65,13 +105,27 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/family_name", - "object": "?fname" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/family_name" + }, + "object": { + "termType": "Variable", + "value": "fname" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "vcard": "http://www.w3.org/2001/vcard-rdf/3.0#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-2-3.json b/test/parsedQueries/sparql-16-2-3.json index e47bb58b..0123c4c3 100644 --- a/test/parsedQueries/sparql-16-2-3.json +++ b/test/parsedQueries/sparql-16-2-3.json @@ -1,15 +1,19 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "site": "http://example.org/stats#" - }, "queryType": "CONSTRUCT", "template": [ { - "subject": "_:b0", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "BlankNode", + "value": "n3-3" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ], "where": [ @@ -17,23 +21,49 @@ "type": "bgp", "triples": [ { - "subject": "_:b1", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "BlankNode", + "value": "1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "_:b1", - "predicate": "http://example.org/stats#hits", - "object": "?hits" + "subject": { + "termType": "BlankNode", + "value": "1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/stats#hits" + }, + "object": { + "termType": "Variable", + "value": "hits" + } } ] } ], "order": [ { - "expression": "?hits", + "expression": { + "termType": "Variable", + "value": "hits" + }, "descending": true } ], - "limit": 2 -} + "limit": 2, + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "site": "http://example.org/stats#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-2-4.json b/test/parsedQueries/sparql-16-2-4.json index c5f0249c..6132bbdd 100644 --- a/test/parsedQueries/sparql-16-2-4.json +++ b/test/parsedQueries/sparql-16-2-4.json @@ -1,14 +1,19 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "CONSTRUCT", "template": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ], "where": [ @@ -16,11 +21,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-2.json b/test/parsedQueries/sparql-16-2.json index d788f7de..e4f88d87 100644 --- a/test/parsedQueries/sparql-16-2.json +++ b/test/parsedQueries/sparql-16-2.json @@ -1,15 +1,19 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "vcard": "http://www.w3.org/2001/vcard-rdf/3.0#" - }, "queryType": "CONSTRUCT", "template": [ { - "subject": "http://example.org/person#Alice", - "predicate": "http://www.w3.org/2001/vcard-rdf/3.0#FN", - "object": "?name" + "subject": { + "termType": "NamedNode", + "value": "http://example.org/person#Alice" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/vcard-rdf/3.0#FN" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ], "where": [ @@ -17,11 +21,25 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "vcard": "http://www.w3.org/2001/vcard-rdf/3.0#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-3.json b/test/parsedQueries/sparql-16-3.json index 729d5463..4c4103bb 100644 --- a/test/parsedQueries/sparql-16-3.json +++ b/test/parsedQueries/sparql-16-3.json @@ -1,24 +1,47 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "ASK", "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "\"Alice\"" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Literal", + "value": "Alice", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@work.example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@work.example" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-4-1.json b/test/parsedQueries/sparql-16-4-1.json index 5ab587fd..6489d068 100644 --- a/test/parsedQueries/sparql-16-4-1.json +++ b/test/parsedQueries/sparql-16-4-1.json @@ -1,8 +1,11 @@ { - "type": "query", - "prefixes": {}, "queryType": "DESCRIBE", "variables": [ - "http://example.org/" - ] -} + { + "termType": "NamedNode", + "value": "http://example.org/" + } + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-4-2a.json b/test/parsedQueries/sparql-16-4-2a.json index 7b2121b5..38f13fca 100644 --- a/test/parsedQueries/sparql-16-4-2a.json +++ b/test/parsedQueries/sparql-16-4-2a.json @@ -1,22 +1,34 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "DESCRIBE", "variables": [ - "?x" + { + "termType": "Variable", + "value": "x" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@org" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@org" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-4-2b.json b/test/parsedQueries/sparql-16-4-2b.json index 73ca2b40..2894ba6d 100644 --- a/test/parsedQueries/sparql-16-4-2b.json +++ b/test/parsedQueries/sparql-16-4-2b.json @@ -1,22 +1,39 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "DESCRIBE", "variables": [ - "?x" + { + "termType": "Variable", + "value": "x" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "\"Alice\"" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Literal", + "value": "Alice", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-4-2c.json b/test/parsedQueries/sparql-16-4-2c.json index 5a1f58e2..98e1e44d 100644 --- a/test/parsedQueries/sparql-16-4-2c.json +++ b/test/parsedQueries/sparql-16-4-2c.json @@ -1,24 +1,42 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "DESCRIBE", "variables": [ - "?x", - "?y", - "http://example.org/" + { + "termType": "Variable", + "value": "x" + }, + { + "termType": "Variable", + "value": "y" + }, + { + "termType": "NamedNode", + "value": "http://example.org/" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?y" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "y" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-4-3.json b/test/parsedQueries/sparql-16-4-3.json index 6475e81f..203d5c1b 100644 --- a/test/parsedQueries/sparql-16-4-3.json +++ b/test/parsedQueries/sparql-16-4-3.json @@ -1,22 +1,39 @@ { - "type": "query", - "prefixes": { - "ent": "http://org.example.com/employees#" - }, "queryType": "DESCRIBE", "variables": [ - "?x" + { + "termType": "Variable", + "value": "x" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://org.example.com/employees#employeeId", - "object": "\"1234\"" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://org.example.com/employees#employeeId" + }, + "object": { + "termType": "Literal", + "value": "1234", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "ent": "http://org.example.com/employees#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-1-1a.json b/test/parsedQueries/sparql-17-4-1-1a.json index 8a64bee4..1f6c05a8 100644 --- a/test/parsedQueries/sparql-17-4-1-1a.json +++ b/test/parsedQueries/sparql-17-4-1-1a.json @@ -1,22 +1,28 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "dc": "http://purl.org/dc/elements/1.1/", - "xsd": "http://www.w3.org/2001/XMLSchema#" - }, "queryType": "SELECT", "variables": [ - "?givenName" + { + "termType": "Variable", + "value": "givenName" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/givenName", - "object": "?givenName" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenName" + }, + "object": { + "termType": "Variable", + "value": "givenName" + } } ] }, @@ -27,9 +33,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://purl.org/dc/elements/1.1/date", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/date" + }, + "object": { + "termType": "Variable", + "value": "date" + } } ] } @@ -41,9 +56,18 @@ "type": "operation", "operator": "bound", "args": [ - "?date" + { + "termType": "Variable", + "value": "date" + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "dc": "http://purl.org/dc/elements/1.1/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-1-1b.json b/test/parsedQueries/sparql-17-4-1-1b.json index a670609a..085b51f6 100644 --- a/test/parsedQueries/sparql-17-4-1-1b.json +++ b/test/parsedQueries/sparql-17-4-1-1b.json @@ -1,21 +1,28 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "dc": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/givenName", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenName" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] }, @@ -26,9 +33,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://purl.org/dc/elements/1.1/date", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/date" + }, + "object": { + "termType": "Variable", + "value": "date" + } } ] } @@ -44,11 +60,19 @@ "type": "operation", "operator": "bound", "args": [ - "?date" + { + "termType": "Variable", + "value": "date" + } ] } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-1-7a.json b/test/parsedQueries/sparql-17-4-1-7a.json index e32ebb3a..9eb72c86 100644 --- a/test/parsedQueries/sparql-17-4-1-7a.json +++ b/test/parsedQueries/sparql-17-4-1-7a.json @@ -1,36 +1,74 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name1", - "?name2" + { + "termType": "Variable", + "value": "name1" + }, + { + "termType": "Variable", + "value": "name2" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name1" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name1" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox1" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox1" + } }, { - "subject": "?y", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name2" + "subject": { + "termType": "Variable", + "value": "y" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name2" + } }, { - "subject": "?y", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox2" + "subject": { + "termType": "Variable", + "value": "y" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox2" + } } ] }, @@ -44,20 +82,36 @@ "type": "operation", "operator": "=", "args": [ - "?mbox1", - "?mbox2" + { + "termType": "Variable", + "value": "mbox1" + }, + { + "termType": "Variable", + "value": "mbox2" + } ] }, { "type": "operation", "operator": "!=", "args": [ - "?name1", - "?name2" + { + "termType": "Variable", + "value": "name1" + }, + { + "termType": "Variable", + "value": "name2" + } ] } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-1-7b.json b/test/parsedQueries/sparql-17-4-1-7b.json index 36d48ff8..30434840 100644 --- a/test/parsedQueries/sparql-17-4-1-7b.json +++ b/test/parsedQueries/sparql-17-4-1-7b.json @@ -1,27 +1,42 @@ { - "type": "query", - "prefixes": { - "a": "http://www.w3.org/2000/10/annotation-ns#", - "dc": "http://purl.org/dc/elements/1.1/", - "xsd": "http://www.w3.org/2001/XMLSchema#" - }, "queryType": "SELECT", "variables": [ - "?annotates" + { + "termType": "Variable", + "value": "annotates" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?annot", - "predicate": "http://www.w3.org/2000/10/annotation-ns#annotates", - "object": "?annotates" + "subject": { + "termType": "Variable", + "value": "annot" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/10/annotation-ns#annotates" + }, + "object": { + "termType": "Variable", + "value": "annotates" + } }, { - "subject": "?annot", - "predicate": "http://purl.org/dc/elements/1.1/date", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "annot" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/date" + }, + "object": { + "termType": "Variable", + "value": "date" + } } ] }, @@ -31,17 +46,37 @@ "type": "operation", "operator": "=", "args": [ - "?date", + { + "termType": "Variable", + "value": "date" + }, { "type": "functionCall", - "function": "http://www.w3.org/2001/XMLSchema#dateTime", + "function": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#dateTime" + }, "args": [ - "\"2005-01-01T00:00:00Z\"" + { + "termType": "Literal", + "value": "2005-01-01T00:00:00Z", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ], "distinct": false } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "a": "http://www.w3.org/2000/10/annotation-ns#", + "dc": "http://purl.org/dc/elements/1.1/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-1-8a.json b/test/parsedQueries/sparql-17-4-1-8a.json index fab20d40..daf6f776 100644 --- a/test/parsedQueries/sparql-17-4-1-8a.json +++ b/test/parsedQueries/sparql-17-4-1-8a.json @@ -1,36 +1,74 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name1", - "?name2" + { + "termType": "Variable", + "value": "name1" + }, + { + "termType": "Variable", + "value": "name2" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name1" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name1" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox1" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox1" + } }, { - "subject": "?y", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name2" + "subject": { + "termType": "Variable", + "value": "y" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name2" + } }, { - "subject": "?y", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox2" + "subject": { + "termType": "Variable", + "value": "y" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox2" + } } ] }, @@ -44,8 +82,14 @@ "type": "operation", "operator": "sameterm", "args": [ - "?mbox1", - "?mbox2" + { + "termType": "Variable", + "value": "mbox1" + }, + { + "termType": "Variable", + "value": "mbox2" + } ] }, { @@ -56,8 +100,14 @@ "type": "operation", "operator": "sameterm", "args": [ - "?name1", - "?name2" + { + "termType": "Variable", + "value": "name1" + }, + { + "termType": "Variable", + "value": "name2" + } ] } ] @@ -65,5 +115,9 @@ ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-1-8b.json b/test/parsedQueries/sparql-17-4-1-8b.json index 921d63ef..6e6ba492 100644 --- a/test/parsedQueries/sparql-17-4-1-8b.json +++ b/test/parsedQueries/sparql-17-4-1-8b.json @@ -1,47 +1,102 @@ { - "type": "query", - "prefixes": { - "": "http://example.org/WMterms#", - "t": "http://example.org/types#" - }, "queryType": "SELECT", "variables": [ - "?aLabel1", - "?bLabel" + { + "termType": "Variable", + "value": "aLabel1" + }, + { + "termType": "Variable", + "value": "bLabel" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?a", - "predicate": "http://example.org/WMterms#label", - "object": "?aLabel" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/WMterms#label" + }, + "object": { + "termType": "Variable", + "value": "aLabel" + } }, { - "subject": "?a", - "predicate": "http://example.org/WMterms#weight", - "object": "?aWeight" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/WMterms#weight" + }, + "object": { + "termType": "Variable", + "value": "aWeight" + } }, { - "subject": "?a", - "predicate": "http://example.org/WMterms#displacement", - "object": "?aDisp" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/WMterms#displacement" + }, + "object": { + "termType": "Variable", + "value": "aDisp" + } }, { - "subject": "?b", - "predicate": "http://example.org/WMterms#label", - "object": "?bLabel" + "subject": { + "termType": "Variable", + "value": "b" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/WMterms#label" + }, + "object": { + "termType": "Variable", + "value": "bLabel" + } }, { - "subject": "?b", - "predicate": "http://example.org/WMterms#weight", - "object": "?bWeight" + "subject": { + "termType": "Variable", + "value": "b" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/WMterms#weight" + }, + "object": { + "termType": "Variable", + "value": "bWeight" + } }, { - "subject": "?b", - "predicate": "http://example.org/WMterms#displacement", - "object": "?bDisp" + "subject": { + "termType": "Variable", + "value": "b" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/WMterms#displacement" + }, + "object": { + "termType": "Variable", + "value": "bDisp" + } } ] }, @@ -55,8 +110,14 @@ "type": "operation", "operator": "sameterm", "args": [ - "?aWeight", - "?bWeight" + { + "termType": "Variable", + "value": "aWeight" + }, + { + "termType": "Variable", + "value": "bWeight" + } ] }, { @@ -67,8 +128,14 @@ "type": "operation", "operator": "sameterm", "args": [ - "?aDisp", - "?bDisp" + { + "termType": "Variable", + "value": "aDisp" + }, + { + "termType": "Variable", + "value": "bDisp" + } ] } ] @@ -76,5 +143,10 @@ ] } } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example.org/WMterms#", + "t": "http://example.org/types#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-2-1.json b/test/parsedQueries/sparql-17-4-2-1.json index bf88772b..69bff87a 100644 --- a/test/parsedQueries/sparql-17-4-2-1.json +++ b/test/parsedQueries/sparql-17-4-2-1.json @@ -1,26 +1,46 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] }, @@ -30,9 +50,16 @@ "type": "operation", "operator": "isiri", "args": [ - "?mbox" + { + "termType": "Variable", + "value": "mbox" + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-2-2.json b/test/parsedQueries/sparql-17-4-2-2.json index 0837e97e..df791a1c 100644 --- a/test/parsedQueries/sparql-17-4-2-2.json +++ b/test/parsedQueries/sparql-17-4-2-2.json @@ -1,28 +1,46 @@ { - "type": "query", - "prefixes": { - "a": "http://www.w3.org/2000/10/annotation-ns#", - "dc": "http://purl.org/dc/elements/1.1/", - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?given", - "?family" + { + "termType": "Variable", + "value": "given" + }, + { + "termType": "Variable", + "value": "family" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?annot", - "predicate": "http://www.w3.org/2000/10/annotation-ns#annotates", - "object": "http://www.w3.org/TR/rdf-sparql-query/" + "subject": { + "termType": "Variable", + "value": "annot" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/10/annotation-ns#annotates" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/TR/rdf-sparql-query/" + } }, { - "subject": "?annot", - "predicate": "http://purl.org/dc/elements/1.1/creator", - "object": "?c" + "subject": { + "termType": "Variable", + "value": "annot" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/creator" + }, + "object": { + "termType": "Variable", + "value": "c" + } } ] }, @@ -33,14 +51,32 @@ "type": "bgp", "triples": [ { - "subject": "?c", - "predicate": "http://xmlns.com/foaf/0.1/given", - "object": "?given" + "subject": { + "termType": "Variable", + "value": "c" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/given" + }, + "object": { + "termType": "Variable", + "value": "given" + } }, { - "subject": "?c", - "predicate": "http://xmlns.com/foaf/0.1/family", - "object": "?family" + "subject": { + "termType": "Variable", + "value": "c" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/family" + }, + "object": { + "termType": "Variable", + "value": "family" + } } ] } @@ -52,9 +88,18 @@ "type": "operation", "operator": "isblank", "args": [ - "?c" + { + "termType": "Variable", + "value": "c" + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "a": "http://www.w3.org/2000/10/annotation-ns#", + "dc": "http://purl.org/dc/elements/1.1/", + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-2-3.json b/test/parsedQueries/sparql-17-4-2-3.json index 0dc12474..2cef94f5 100644 --- a/test/parsedQueries/sparql-17-4-2-3.json +++ b/test/parsedQueries/sparql-17-4-2-3.json @@ -1,26 +1,46 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] }, @@ -30,9 +50,16 @@ "type": "operation", "operator": "isliteral", "args": [ - "?mbox" + { + "termType": "Variable", + "value": "mbox" + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-2-5.json b/test/parsedQueries/sparql-17-4-2-5.json index 18edfceb..bd10caaa 100644 --- a/test/parsedQueries/sparql-17-4-2-5.json +++ b/test/parsedQueries/sparql-17-4-2-5.json @@ -1,26 +1,46 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] }, @@ -34,12 +54,27 @@ "type": "operation", "operator": "str", "args": [ - "?mbox" + { + "termType": "Variable", + "value": "mbox" + } ] }, - "\"@work\\.example$\"" + { + "termType": "Literal", + "value": "@work\\.example$", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-2-6.json b/test/parsedQueries/sparql-17-4-2-6.json index ae7f0256..37c4615a 100644 --- a/test/parsedQueries/sparql-17-4-2-6.json +++ b/test/parsedQueries/sparql-17-4-2-6.json @@ -1,26 +1,46 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] }, @@ -34,12 +54,27 @@ "type": "operation", "operator": "lang", "args": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ] }, - "\"es\"" + { + "termType": "Literal", + "value": "es", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-2-7.json b/test/parsedQueries/sparql-17-4-2-7.json index 4e888d69..cae05925 100644 --- a/test/parsedQueries/sparql-17-4-2-7.json +++ b/test/parsedQueries/sparql-17-4-2-7.json @@ -1,28 +1,46 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "xsd": "http://www.w3.org/2001/XMLSchema#", - "eg": "http://biometrics.example/ns#" - }, "queryType": "SELECT", "variables": [ - "?name", - "?shoeSize" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "shoeSize" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://biometrics.example/ns#shoeSize", - "object": "?shoeSize" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://biometrics.example/ns#shoeSize" + }, + "object": { + "termType": "Variable", + "value": "shoeSize" + } } ] }, @@ -36,12 +54,24 @@ "type": "operation", "operator": "datatype", "args": [ - "?shoeSize" + { + "termType": "Variable", + "value": "shoeSize" + } ] }, - "http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "eg": "http://biometrics.example/ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-3-13a.json b/test/parsedQueries/sparql-17-4-3-13a.json index dd047093..42596bad 100644 --- a/test/parsedQueries/sparql-17-4-3-13a.json +++ b/test/parsedQueries/sparql-17-4-3-13a.json @@ -1,25 +1,47 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "\"That Seventies Show\"@en" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Literal", + "value": "That Seventies Show", + "language": "en", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString" + } + } }, { - "subject": "?x", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] }, @@ -33,12 +55,27 @@ "type": "operation", "operator": "lang", "args": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ] }, - "\"FR\"" + { + "termType": "Literal", + "value": "FR", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-3-13b.json b/test/parsedQueries/sparql-17-4-3-13b.json index 429f0571..271512a8 100644 --- a/test/parsedQueries/sparql-17-4-3-13b.json +++ b/test/parsedQueries/sparql-17-4-3-13b.json @@ -1,20 +1,28 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] }, @@ -28,12 +36,27 @@ "type": "operation", "operator": "lang", "args": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ] }, - "\"*\"" + { + "termType": "Literal", + "value": "*", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-4-3-14.json b/test/parsedQueries/sparql-17-4-3-14.json index ad356ac5..626434e1 100644 --- a/test/parsedQueries/sparql-17-4-3-14.json +++ b/test/parsedQueries/sparql-17-4-3-14.json @@ -1,20 +1,28 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] }, @@ -24,11 +32,34 @@ "type": "operation", "operator": "regex", "args": [ - "?name", - "\"^ali\"", - "\"i\"" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Literal", + "value": "^ali", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + }, + { + "termType": "Literal", + "value": "i", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-6a.json b/test/parsedQueries/sparql-17-6a.json index ff47a8cb..db6703c9 100644 --- a/test/parsedQueries/sparql-17-6a.json +++ b/test/parsedQueries/sparql-17-6a.json @@ -1,27 +1,46 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "func": "http://example.org/functions#" - }, "queryType": "SELECT", "variables": [ - "?name", - "?id" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "id" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://example.org/functions#empId", - "object": "?id" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/functions#empId" + }, + "object": { + "termType": "Variable", + "value": "id" + } } ] }, @@ -29,12 +48,23 @@ "type": "filter", "expression": { "type": "functionCall", - "function": "http://example.org/functions#even", + "function": { + "termType": "NamedNode", + "value": "http://example.org/functions#even" + }, "args": [ - "?id" + { + "termType": "Variable", + "value": "id" + } ], "distinct": false } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "func": "http://example.org/functions#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17-6b.json b/test/parsedQueries/sparql-17-6b.json index 7a1e07c3..5464ce5a 100644 --- a/test/parsedQueries/sparql-17-6b.json +++ b/test/parsedQueries/sparql-17-6b.json @@ -1,45 +1,103 @@ { - "type": "query", - "prefixes": { - "aGeo": "http://example.org/geo#" - }, "queryType": "SELECT", "variables": [ - "?neighbor" + { + "termType": "Variable", + "value": "neighbor" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?a", - "predicate": "http://example.org/geo#placeName", - "object": "\"Grenoble\"" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/geo#placeName" + }, + "object": { + "termType": "Literal", + "value": "Grenoble", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "subject": "?a", - "predicate": "http://example.org/geo#locationX", - "object": "?axLoc" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/geo#locationX" + }, + "object": { + "termType": "Variable", + "value": "axLoc" + } }, { - "subject": "?a", - "predicate": "http://example.org/geo#locationY", - "object": "?ayLoc" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/geo#locationY" + }, + "object": { + "termType": "Variable", + "value": "ayLoc" + } }, { - "subject": "?b", - "predicate": "http://example.org/geo#placeName", - "object": "?neighbor" + "subject": { + "termType": "Variable", + "value": "b" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/geo#placeName" + }, + "object": { + "termType": "Variable", + "value": "neighbor" + } }, { - "subject": "?b", - "predicate": "http://example.org/geo#locationX", - "object": "?bxLoc" + "subject": { + "termType": "Variable", + "value": "b" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/geo#locationX" + }, + "object": { + "termType": "Variable", + "value": "bxLoc" + } }, { - "subject": "?b", - "predicate": "http://example.org/geo#locationY", - "object": "?byLoc" + "subject": { + "termType": "Variable", + "value": "b" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/geo#locationY" + }, + "object": { + "termType": "Variable", + "value": "byLoc" + } } ] }, @@ -51,18 +109,45 @@ "args": [ { "type": "functionCall", - "function": "http://example.org/geo#distance", + "function": { + "termType": "NamedNode", + "value": "http://example.org/geo#distance" + }, "args": [ - "?axLoc", - "?ayLoc", - "?bxLoc", - "?byLoc" + { + "termType": "Variable", + "value": "axLoc" + }, + { + "termType": "Variable", + "value": "ayLoc" + }, + { + "termType": "Variable", + "value": "bxLoc" + }, + { + "termType": "Variable", + "value": "byLoc" + } ], "distinct": false }, - "\"10\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Literal", + "value": "10", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "aGeo": "http://example.org/geo#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-17.json b/test/parsedQueries/sparql-17.json index 6f3fff5f..3369e715 100644 --- a/test/parsedQueries/sparql-17.json +++ b/test/parsedQueries/sparql-17.json @@ -1,27 +1,42 @@ { - "type": "query", - "prefixes": { - "a": "http://www.w3.org/2000/10/annotation-ns#", - "dc": "http://purl.org/dc/elements/1.1/", - "xsd": "http://www.w3.org/2001/XMLSchema#" - }, "queryType": "SELECT", "variables": [ - "?annot" + { + "termType": "Variable", + "value": "annot" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?annot", - "predicate": "http://www.w3.org/2000/10/annotation-ns#annotates", - "object": "http://www.w3.org/TR/rdf-sparql-query/" + "subject": { + "termType": "Variable", + "value": "annot" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/10/annotation-ns#annotates" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/TR/rdf-sparql-query/" + } }, { - "subject": "?annot", - "predicate": "http://purl.org/dc/elements/1.1/date", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "annot" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/date" + }, + "object": { + "termType": "Variable", + "value": "date" + } } ] }, @@ -31,10 +46,27 @@ "type": "operation", "operator": ">", "args": [ - "?date", - "\"2005-01-01T00:00:00Z\"^^http://www.w3.org/2001/XMLSchema#dateTime" + { + "termType": "Variable", + "value": "date" + }, + { + "termType": "Literal", + "value": "2005-01-01T00:00:00Z", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "[object Object]" + } + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "a": "http://www.w3.org/2000/10/annotation-ns#", + "dc": "http://purl.org/dc/elements/1.1/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-4-2a.json b/test/parsedQueries/sparql-4-2a.json index eedeb617..d097aaa2 100644 --- a/test/parsedQueries/sparql-4-2a.json +++ b/test/parsedQueries/sparql-4-2a.json @@ -1,22 +1,34 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "http://example.org/book/book1", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "NamedNode", + "value": "http://example.org/book/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-4-2b.json b/test/parsedQueries/sparql-4-2b.json index 6a05cff8..c57cefde 100644 --- a/test/parsedQueries/sparql-4-2b.json +++ b/test/parsedQueries/sparql-4-2b.json @@ -1,23 +1,35 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "": "http://example.org/book/" - }, "queryType": "SELECT", "variables": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "http://example.org/book/book1", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "NamedNode", + "value": "http://example.org/book/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "": "http://example.org/book/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-4-2c.json b/test/parsedQueries/sparql-4-2c.json index c1429721..977bddea 100644 --- a/test/parsedQueries/sparql-4-2c.json +++ b/test/parsedQueries/sparql-4-2c.json @@ -1,23 +1,35 @@ { - "type": "query", - "base" : "http://example.org/book/", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "http://example.org/book/book1", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "NamedNode", + "value": "http://example.org/book/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] } - ] -} + ], + "type": "query", + "base": "http://example.org/book/", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-5-2-2a.json b/test/parsedQueries/sparql-5-2-2a.json index 59b5fc9f..e2c8b9d8 100644 --- a/test/parsedQueries/sparql-5-2-2a.json +++ b/test/parsedQueries/sparql-5-2-2a.json @@ -1,26 +1,46 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] }, @@ -30,10 +50,25 @@ "type": "operation", "operator": "regex", "args": [ - "?name", - "\"Smith\"" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Literal", + "value": "Smith", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-5-2-2b.json b/test/parsedQueries/sparql-5-2-2b.json index fabe28ed..591c88f0 100644 --- a/test/parsedQueries/sparql-5-2-2b.json +++ b/test/parsedQueries/sparql-5-2-2b.json @@ -1,12 +1,14 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { @@ -15,8 +17,19 @@ "type": "operation", "operator": "regex", "args": [ - "?name", - "\"Smith\"" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Literal", + "value": "Smith", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } }, @@ -24,16 +37,38 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-5-2-2c.json b/test/parsedQueries/sparql-5-2-2c.json index 35f2cb59..53a2aa65 100644 --- a/test/parsedQueries/sparql-5-2-2c.json +++ b/test/parsedQueries/sparql-5-2-2c.json @@ -1,21 +1,32 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] }, @@ -25,8 +36,19 @@ "type": "operation", "operator": "regex", "args": [ - "?name", - "\"Smith\"" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Literal", + "value": "Smith", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } }, @@ -34,11 +56,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-5-2-3a.json b/test/parsedQueries/sparql-5-2-3a.json index 60a3f3e6..2e699ec2 100644 --- a/test/parsedQueries/sparql-5-2-3a.json +++ b/test/parsedQueries/sparql-5-2-3a.json @@ -1,28 +1,52 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-5-2-3b.json b/test/parsedQueries/sparql-5-2-3b.json index 35f2cb59..53a2aa65 100644 --- a/test/parsedQueries/sparql-5-2-3b.json +++ b/test/parsedQueries/sparql-5-2-3b.json @@ -1,21 +1,32 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] }, @@ -25,8 +36,19 @@ "type": "operation", "operator": "regex", "args": [ - "?name", - "\"Smith\"" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Literal", + "value": "Smith", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } }, @@ -34,11 +56,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-5-2-3c.json b/test/parsedQueries/sparql-5-2-3c.json index b0fc426a..c5eb20e2 100644 --- a/test/parsedQueries/sparql-5-2-3c.json +++ b/test/parsedQueries/sparql-5-2-3c.json @@ -1,37 +1,61 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] }, { - "patterns": [], - "type": "group" + "type": "group", + "patterns": [] }, { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-5-2a.json b/test/parsedQueries/sparql-5-2a.json index 60a3f3e6..2e699ec2 100644 --- a/test/parsedQueries/sparql-5-2a.json +++ b/test/parsedQueries/sparql-5-2a.json @@ -1,28 +1,52 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-5-2b.json b/test/parsedQueries/sparql-5-2b.json index 64fc74fa..295a246e 100644 --- a/test/parsedQueries/sparql-5-2b.json +++ b/test/parsedQueries/sparql-5-2b.json @@ -1,12 +1,14 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { @@ -16,9 +18,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } @@ -31,13 +42,26 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-6-1.json b/test/parsedQueries/sparql-6-1.json index 8c4f5c03..28a6e623 100644 --- a/test/parsedQueries/sparql-6-1.json +++ b/test/parsedQueries/sparql-6-1.json @@ -1,21 +1,32 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] }, @@ -26,13 +37,26 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-6-2.json b/test/parsedQueries/sparql-6-2.json index 992c0a55..826d4a4a 100644 --- a/test/parsedQueries/sparql-6-2.json +++ b/test/parsedQueries/sparql-6-2.json @@ -1,22 +1,32 @@ { - "type": "query", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "ns": "http://example.org/ns#" - }, "queryType": "SELECT", "variables": [ - "?title", - "?price" + { + "termType": "Variable", + "value": "title" + }, + { + "termType": "Variable", + "value": "price" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] }, @@ -27,9 +37,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://example.org/ns#price", - "object": "?price" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#price" + }, + "object": { + "termType": "Variable", + "value": "price" + } } ] }, @@ -39,12 +58,28 @@ "type": "operation", "operator": "<", "args": [ - "?price", - "\"30\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Variable", + "value": "price" + }, + { + "termType": "Literal", + "value": "30", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "ns": "http://example.org/ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-6-3.json b/test/parsedQueries/sparql-6-3.json index 29b95580..b7918f5c 100644 --- a/test/parsedQueries/sparql-6-3.json +++ b/test/parsedQueries/sparql-6-3.json @@ -1,22 +1,36 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name", - "?mbox", - "?hpage" + { + "termType": "Variable", + "value": "name" + }, + { + "termType": "Variable", + "value": "mbox" + }, + { + "termType": "Variable", + "value": "hpage" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] }, @@ -27,9 +41,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?mbox" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "mbox" + } } ] } @@ -42,13 +65,26 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/homepage", - "object": "?hpage" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/homepage" + }, + "object": { + "termType": "Variable", + "value": "hpage" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-7a.json b/test/parsedQueries/sparql-7a.json index 08f78706..08051eab 100644 --- a/test/parsedQueries/sparql-7a.json +++ b/test/parsedQueries/sparql-7a.json @@ -1,12 +1,10 @@ { - "type": "query", - "prefixes": { - "dc10": "http://purl.org/dc/elements/1.0/", - "dc11": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ], "where": [ { @@ -16,9 +14,18 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.0/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.0/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] }, @@ -26,13 +33,27 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc10": "http://purl.org/dc/elements/1.0/", + "dc11": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-7b.json b/test/parsedQueries/sparql-7b.json index 5391b36d..d98a76a2 100644 --- a/test/parsedQueries/sparql-7b.json +++ b/test/parsedQueries/sparql-7b.json @@ -1,13 +1,14 @@ { - "type": "query", - "prefixes": { - "dc10": "http://purl.org/dc/elements/1.0/", - "dc11": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?x", - "?y" + { + "termType": "Variable", + "value": "x" + }, + { + "termType": "Variable", + "value": "y" + } ], "where": [ { @@ -17,9 +18,18 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.0/title", - "object": "?x" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.0/title" + }, + "object": { + "termType": "Variable", + "value": "x" + } } ] }, @@ -27,13 +37,27 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?y" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "y" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc10": "http://purl.org/dc/elements/1.0/", + "dc11": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-7c.json b/test/parsedQueries/sparql-7c.json index 9852eac2..1e371b37 100644 --- a/test/parsedQueries/sparql-7c.json +++ b/test/parsedQueries/sparql-7c.json @@ -1,13 +1,14 @@ { - "type": "query", - "prefixes": { - "dc10": "http://purl.org/dc/elements/1.0/", - "dc11": "http://purl.org/dc/elements/1.1/" - }, "queryType": "SELECT", "variables": [ - "?title", - "?author" + { + "termType": "Variable", + "value": "title" + }, + { + "termType": "Variable", + "value": "author" + } ], "where": [ { @@ -17,14 +18,32 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.0/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.0/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } }, { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.0/creator", - "object": "?author" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.0/creator" + }, + "object": { + "termType": "Variable", + "value": "author" + } } ] }, @@ -32,18 +51,41 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Variable", + "value": "title" + } }, { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/creator", - "object": "?author" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/creator" + }, + "object": { + "termType": "Variable", + "value": "author" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "dc10": "http://purl.org/dc/elements/1.0/", + "dc11": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-8-1-1.json b/test/parsedQueries/sparql-8-1-1.json index 1380962f..31729593 100644 --- a/test/parsedQueries/sparql-8-1-1.json +++ b/test/parsedQueries/sparql-8-1-1.json @@ -1,21 +1,28 @@ { - "type": "query", - "prefixes": { - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?person" + { + "termType": "Variable", + "value": "person" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://xmlns.com/foaf/0.1/Person" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, + "object": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/Person" + } } ] }, @@ -29,14 +36,28 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-8-1-2.json b/test/parsedQueries/sparql-8-1-2.json index 1f381f68..f52378ff 100644 --- a/test/parsedQueries/sparql-8-1-2.json +++ b/test/parsedQueries/sparql-8-1-2.json @@ -1,21 +1,28 @@ { - "type": "query", - "prefixes": { - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?person" + { + "termType": "Variable", + "value": "person" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://xmlns.com/foaf/0.1/Person" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, + "object": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/Person" + } } ] }, @@ -29,14 +36,28 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-8-2.json b/test/parsedQueries/sparql-8-2.json index 7a81c72a..f26f83fe 100644 --- a/test/parsedQueries/sparql-8-2.json +++ b/test/parsedQueries/sparql-8-2.json @@ -1,12 +1,10 @@ { - "type": "query", - "prefixes": { - "": "http://example/", - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?s" + { + "termType": "Variable", + "value": "s" + } ], "distinct": true, "where": [ @@ -14,9 +12,18 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] }, @@ -27,13 +34,32 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "http://xmlns.com/foaf/0.1/givenName", - "object": "\"Bob\"" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenName" + }, + "object": { + "termType": "Literal", + "value": "Bob", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/", + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-8-3-1a.json b/test/parsedQueries/sparql-8-3-1a.json index 3e74e898..730514f3 100644 --- a/test/parsedQueries/sparql-8-3-1a.json +++ b/test/parsedQueries/sparql-8-3-1a.json @@ -1,6 +1,4 @@ { - "type": "query", - "prefixes": {}, "queryType": "SELECT", "variables": [ "*" @@ -10,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] }, @@ -26,14 +33,25 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "?y", - "object": "?z" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "Variable", + "value": "y" + }, + "object": { + "termType": "Variable", + "value": "z" + } } ] } ] } } - ] -} + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-8-3-1b.json b/test/parsedQueries/sparql-8-3-1b.json index 1a16c16a..87e74ae4 100644 --- a/test/parsedQueries/sparql-8-3-1b.json +++ b/test/parsedQueries/sparql-8-3-1b.json @@ -1,6 +1,4 @@ { - "type": "query", - "prefixes": {}, "queryType": "SELECT", "variables": [ "*" @@ -10,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] }, @@ -23,13 +30,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "?y", - "object": "?z" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "Variable", + "value": "y" + }, + "object": { + "termType": "Variable", + "value": "z" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-8-3-2a.json b/test/parsedQueries/sparql-8-3-2a.json index e998b30c..e30677ca 100644 --- a/test/parsedQueries/sparql-8-3-2a.json +++ b/test/parsedQueries/sparql-8-3-2a.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] }, @@ -28,14 +33,27 @@ "type": "bgp", "triples": [ { - "subject": "http://example/a", - "predicate": "http://example/b", - "object": "http://example/c" + "subject": { + "termType": "NamedNode", + "value": "http://example/a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example/b" + }, + "object": { + "termType": "NamedNode", + "value": "http://example/c" + } } ] } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-8-3-2b.json b/test/parsedQueries/sparql-8-3-2b.json index 2d9f6a3b..beec5d4d 100644 --- a/test/parsedQueries/sparql-8-3-2b.json +++ b/test/parsedQueries/sparql-8-3-2b.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] }, @@ -25,13 +30,26 @@ "type": "bgp", "triples": [ { - "subject": "http://example/a", - "predicate": "http://example/b", - "object": "http://example/c" + "subject": { + "termType": "NamedNode", + "value": "http://example/a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example/b" + }, + "object": { + "termType": "NamedNode", + "value": "http://example/c" + } } ] } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-8-3-3a.json b/test/parsedQueries/sparql-8-3-3a.json index a50cb227..0c08f403 100644 --- a/test/parsedQueries/sparql-8-3-3a.json +++ b/test/parsedQueries/sparql-8-3-3a.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example.com/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://example.com/p", - "object": "?n" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.com/p" + }, + "object": { + "termType": "Variable", + "value": "n" + } } ] }, @@ -31,9 +36,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://example.com/q", - "object": "?m" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.com/q" + }, + "object": { + "termType": "Variable", + "value": "m" + } } ] }, @@ -43,8 +57,14 @@ "type": "operation", "operator": "=", "args": [ - "?n", - "?m" + { + "termType": "Variable", + "value": "n" + }, + { + "termType": "Variable", + "value": "m" + } ] } } @@ -53,5 +73,9 @@ ] } } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example.com/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-8-3-3b.json b/test/parsedQueries/sparql-8-3-3b.json index 23db6fa0..523aac0d 100644 --- a/test/parsedQueries/sparql-8-3-3b.json +++ b/test/parsedQueries/sparql-8-3-3b.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://example/p", - "object": "?n" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example/p" + }, + "object": { + "termType": "Variable", + "value": "n" + } } ] }, @@ -25,9 +30,18 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://example/q", - "object": "?m" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example/q" + }, + "object": { + "termType": "Variable", + "value": "m" + } } ] }, @@ -37,12 +51,22 @@ "type": "operation", "operator": "=", "args": [ - "?n", - "?m" + { + "termType": "Variable", + "value": "n" + }, + { + "termType": "Variable", + "value": "m" + } ] } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2a.json b/test/parsedQueries/sparql-9-2a.json index 65978a5a..ea50b563 100644 --- a/test/parsedQueries/sparql-9-2a.json +++ b/test/parsedQueries/sparql-9-2a.json @@ -1,10 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example/", - "dc": "http://purl.org/dc/elements/1.1/", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#" - }, "queryType": "SELECT", "variables": [ "*" @@ -14,18 +8,36 @@ "type": "bgp", "triples": [ { - "subject": "http://example/book1", + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, "predicate": { "type": "path", "pathType": "|", "items": [ - "http://purl.org/dc/elements/1.1/title", - "http://www.w3.org/2000/01/rdf-schema#label" + { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + } ] }, - "object": "?displayString" + "object": { + "termType": "Variable", + "value": "displayString" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/", + "dc": "http://purl.org/dc/elements/1.1/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2b.json b/test/parsedQueries/sparql-9-2b.json index 65978a5a..ea50b563 100644 --- a/test/parsedQueries/sparql-9-2b.json +++ b/test/parsedQueries/sparql-9-2b.json @@ -1,10 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example/", - "dc": "http://purl.org/dc/elements/1.1/", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#" - }, "queryType": "SELECT", "variables": [ "*" @@ -14,18 +8,36 @@ "type": "bgp", "triples": [ { - "subject": "http://example/book1", + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, "predicate": { "type": "path", "pathType": "|", "items": [ - "http://purl.org/dc/elements/1.1/title", - "http://www.w3.org/2000/01/rdf-schema#label" + { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + } ] }, - "object": "?displayString" + "object": { + "termType": "Variable", + "value": "displayString" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/", + "dc": "http://purl.org/dc/elements/1.1/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2c.json b/test/parsedQueries/sparql-9-2c.json index 3b6bf658..89c9e52b 100644 --- a/test/parsedQueries/sparql-9-2c.json +++ b/test/parsedQueries/sparql-9-2c.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,23 +8,48 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@example" + } }, { - "subject": "?x", + "subject": { + "termType": "Variable", + "value": "x" + }, "predicate": { "type": "path", "pathType": "/", "items": [ - "http://xmlns.com/foaf/0.1/knows", - "http://xmlns.com/foaf/0.1/name" + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + } ] }, - "object": "?name" + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2d.json b/test/parsedQueries/sparql-9-2d.json index a35eccf8..d87f4f69 100644 --- a/test/parsedQueries/sparql-9-2d.json +++ b/test/parsedQueries/sparql-9-2d.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,24 +8,52 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@example" + } }, { - "subject": "?x", + "subject": { + "termType": "Variable", + "value": "x" + }, "predicate": { "type": "path", "pathType": "/", "items": [ - "http://xmlns.com/foaf/0.1/knows", - "http://xmlns.com/foaf/0.1/knows", - "http://xmlns.com/foaf/0.1/name" + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + } ] }, - "object": "?name" + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2e.json b/test/parsedQueries/sparql-9-2e.json index af270ec1..4a485754 100644 --- a/test/parsedQueries/sparql-9-2e.json +++ b/test/parsedQueries/sparql-9-2e.json @@ -1,38 +1,80 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?x", - "?name" + { + "termType": "Variable", + "value": "x" + }, + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@example" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "_:b1" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "BlankNode", + "value": "1" + } }, { - "subject": "_:b1", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "_:b0" + "subject": { + "termType": "BlankNode", + "value": "1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "BlankNode", + "value": "n3-4" + } }, { - "subject": "_:b0", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "BlankNode", + "value": "n3-4" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2f.json b/test/parsedQueries/sparql-9-2f.json index 1f88752b..0cc5749f 100644 --- a/test/parsedQueries/sparql-9-2f.json +++ b/test/parsedQueries/sparql-9-2f.json @@ -1,38 +1,80 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?x", - "?name" + { + "termType": "Variable", + "value": "x" + }, + { + "termType": "Variable", + "value": "name" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@example" + } }, { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?a1" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "a1" + } }, { - "subject": "?a1", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?a2" + "subject": { + "termType": "Variable", + "value": "a1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "a2" + } }, { - "subject": "?a2", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "a2" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2g.json b/test/parsedQueries/sparql-9-2g.json index e16fd7c3..69c1ad84 100644 --- a/test/parsedQueries/sparql-9-2g.json +++ b/test/parsedQueries/sparql-9-2g.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,21 +8,42 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@example" + } }, { - "subject": "?x", + "subject": { + "termType": "Variable", + "value": "x" + }, "predicate": { "type": "path", "pathType": "/", "items": [ - "http://xmlns.com/foaf/0.1/knows", - "http://xmlns.com/foaf/0.1/knows" + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + } ] }, - "object": "?y" + "object": { + "termType": "Variable", + "value": "y" + } } ] }, @@ -36,8 +53,14 @@ "type": "operation", "operator": "!=", "args": [ - "?x", - "?y" + { + "termType": "Variable", + "value": "x" + }, + { + "termType": "Variable", + "value": "y" + } ] } }, @@ -45,11 +68,24 @@ "type": "bgp", "triples": [ { - "subject": "?y", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "y" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2h.json b/test/parsedQueries/sparql-9-2h.json index 1496bf5d..d771a690 100644 --- a/test/parsedQueries/sparql-9-2h.json +++ b/test/parsedQueries/sparql-9-2h.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,11 +8,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@example" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2i.json b/test/parsedQueries/sparql-9-2i.json index ff75ce91..5b83f63a 100644 --- a/test/parsedQueries/sparql-9-2i.json +++ b/test/parsedQueries/sparql-9-2i.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,17 +8,30 @@ "type": "bgp", "triples": [ { - "subject": "mailto:alice@example", + "subject": { + "termType": "NamedNode", + "value": "mailto:alice@example" + }, "predicate": { "type": "path", "pathType": "^", "items": [ - "http://xmlns.com/foaf/0.1/mbox" + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + } ] }, - "object": "?x" + "object": { + "termType": "Variable", + "value": "x" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2j.json b/test/parsedQueries/sparql-9-2j.json index 4bc94e73..4c2ea45f 100644 --- a/test/parsedQueries/sparql-9-2j.json +++ b/test/parsedQueries/sparql-9-2j.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,22 +8,34 @@ "type": "bgp", "triples": [ { - "subject": "?x", + "subject": { + "termType": "Variable", + "value": "x" + }, "predicate": { "type": "path", "pathType": "/", "items": [ - "http://xmlns.com/foaf/0.1/knows", + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, { "type": "path", "pathType": "^", "items": [ - "http://xmlns.com/foaf/0.1/knows" + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + } ] } ] }, - "object": "?y" + "object": { + "termType": "Variable", + "value": "y" + } } ] }, @@ -37,10 +45,20 @@ "type": "operation", "operator": "!=", "args": [ - "?x", - "?y" + { + "termType": "Variable", + "value": "x" + }, + { + "termType": "Variable", + "value": "y" + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2k.json b/test/parsedQueries/sparql-9-2k.json index 90cb7bb8..b0b63350 100644 --- a/test/parsedQueries/sparql-9-2k.json +++ b/test/parsedQueries/sparql-9-2k.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,14 +8,32 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?gen1" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "gen1" + } }, { - "subject": "?y", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?gen1" + "subject": { + "termType": "Variable", + "value": "y" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "gen1" + } } ] }, @@ -29,10 +43,20 @@ "type": "operation", "operator": "!=", "args": [ - "?x", - "?y" + { + "termType": "Variable", + "value": "x" + }, + { + "termType": "Variable", + "value": "y" + } ] } } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2l.json b/test/parsedQueries/sparql-9-2l.json index b85092bd..e36a7a96 100644 --- a/test/parsedQueries/sparql-9-2l.json +++ b/test/parsedQueries/sparql-9-2l.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,12 +8,24 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "mailto:alice@example" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "NamedNode", + "value": "mailto:alice@example" + } }, { - "subject": "?x", + "subject": { + "termType": "Variable", + "value": "x" + }, "predicate": { "type": "path", "pathType": "/", @@ -26,15 +34,28 @@ "type": "path", "pathType": "+", "items": [ - "http://xmlns.com/foaf/0.1/knows" + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + } ] }, - "http://xmlns.com/foaf/0.1/name" + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + } ] }, - "object": "?name" + "object": { + "termType": "Variable", + "value": "name" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2m.json b/test/parsedQueries/sparql-9-2m.json index 08b9ebee..978c9e5b 100644 --- a/test/parsedQueries/sparql-9-2m.json +++ b/test/parsedQueries/sparql-9-2m.json @@ -1,9 +1,4 @@ { - "type": "query", - "base": "http://example.org/", - "prefixes": { - "ex": "http://example.org/#" - }, "queryType": "SELECT", "variables": [ "*" @@ -13,7 +8,10 @@ "type": "bgp", "triples": [ { - "subject": "?ancestor", + "subject": { + "termType": "Variable", + "value": "ancestor" + }, "predicate": { "type": "path", "pathType": "+", @@ -22,15 +20,29 @@ "type": "path", "pathType": "|", "items": [ - "http://example.org/#motherOf", - "http://example.org/#fatherOf" + { + "termType": "NamedNode", + "value": "http://example.org/#motherOf" + }, + { + "termType": "NamedNode", + "value": "http://example.org/#fatherOf" + } ] } ] }, - "object": "http://example.org/#me" + "object": { + "termType": "NamedNode", + "value": "http://example.org/#me" + } } ] } - ] -} + ], + "type": "query", + "base": "http://example.org/", + "prefixes": { + "ex": "http://example.org/#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2n.json b/test/parsedQueries/sparql-9-2n.json index e355be31..23a1d0eb 100644 --- a/test/parsedQueries/sparql-9-2n.json +++ b/test/parsedQueries/sparql-9-2n.json @@ -1,9 +1,4 @@ { - "type": "query", - "prefixes": { - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#" - }, "queryType": "SELECT", "variables": [ "*" @@ -13,24 +8,41 @@ "type": "bgp", "triples": [ { - "subject": "http://example/thing", + "subject": { + "termType": "NamedNode", + "value": "http://example/thing" + }, "predicate": { "type": "path", "pathType": "/", "items": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, { "type": "path", "pathType": "*", "items": [ - "http://www.w3.org/2000/01/rdf-schema#subClassOf" + { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } ] } ] }, - "object": "?type" + "object": { + "termType": "Variable", + "value": "type" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2o.json b/test/parsedQueries/sparql-9-2o.json index 2df07e16..b9750d1f 100644 --- a/test/parsedQueries/sparql-9-2o.json +++ b/test/parsedQueries/sparql-9-2o.json @@ -1,9 +1,4 @@ { - "type": "query", - "prefixes": { - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#" - }, "queryType": "SELECT", "variables": [ "*" @@ -13,24 +8,41 @@ "type": "bgp", "triples": [ { - "subject": "?x", + "subject": { + "termType": "Variable", + "value": "x" + }, "predicate": { "type": "path", "pathType": "/", "items": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, { "type": "path", "pathType": "*", "items": [ - "http://www.w3.org/2000/01/rdf-schema#subClassOf" + { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } ] } ] }, - "object": "?type" + "object": { + "termType": "Variable", + "value": "type" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2p.json b/test/parsedQueries/sparql-9-2p.json index 81b2cefc..389ffd28 100644 --- a/test/parsedQueries/sparql-9-2p.json +++ b/test/parsedQueries/sparql-9-2p.json @@ -1,9 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example/", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#" - }, "queryType": "SELECT", "variables": [ "*" @@ -13,22 +8,45 @@ "type": "bgp", "triples": [ { - "subject": "?x", - "predicate": "?p", - "object": "?v" + "subject": { + "termType": "Variable", + "value": "x" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "v" + } }, { - "subject": "?p", + "subject": { + "termType": "Variable", + "value": "p" + }, "predicate": { "type": "path", "pathType": "*", "items": [ - "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } ] }, - "object": "http://example/property" + "object": { + "termType": "NamedNode", + "value": "http://example/property" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2q.json b/test/parsedQueries/sparql-9-2q.json index e3420761..4a80c138 100644 --- a/test/parsedQueries/sparql-9-2q.json +++ b/test/parsedQueries/sparql-9-2q.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,7 +8,10 @@ "type": "bgp", "triples": [ { - "subject": "?x", + "subject": { + "termType": "Variable", + "value": "x" + }, "predicate": { "type": "path", "pathType": "!", @@ -21,21 +20,34 @@ "type": "path", "pathType": "|", "items": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, { "type": "path", "pathType": "^", "items": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + } ] } ] } ] }, - "object": "?y" + "object": { + "termType": "Variable", + "value": "y" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-2r.json b/test/parsedQueries/sparql-9-2r.json index f68b9cef..34a5fb24 100644 --- a/test/parsedQueries/sparql-9-2r.json +++ b/test/parsedQueries/sparql-9-2r.json @@ -1,9 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example/", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - }, "queryType": "SELECT", "variables": [ "*" @@ -13,7 +8,10 @@ "type": "bgp", "triples": [ { - "subject": "http://example/list", + "subject": { + "termType": "NamedNode", + "value": "http://example/list" + }, "predicate": { "type": "path", "pathType": "/", @@ -22,15 +20,29 @@ "type": "path", "pathType": "*", "items": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + } ] }, - "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + } ] }, - "object": "?element" + "object": { + "termType": "Variable", + "value": "element" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-3a.json b/test/parsedQueries/sparql-9-3a.json index 9379e37d..ecb63543 100644 --- a/test/parsedQueries/sparql-9-3a.json +++ b/test/parsedQueries/sparql-9-3a.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,18 +8,34 @@ "type": "bgp", "triples": [ { - "subject": "?s", + "subject": { + "termType": "Variable", + "value": "s" + }, "predicate": { "type": "path", "pathType": "/", "items": [ - "http://example/item", - "http://example/price" + { + "termType": "NamedNode", + "value": "http://example/item" + }, + { + "termType": "NamedNode", + "value": "http://example/price" + } ] }, - "object": "?x" + "object": { + "termType": "Variable", + "value": "x" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-3b.json b/test/parsedQueries/sparql-9-3b.json index 6501e64d..590c0c30 100644 --- a/test/parsedQueries/sparql-9-3b.json +++ b/test/parsedQueries/sparql-9-3b.json @@ -1,8 +1,4 @@ { - "type": "query", - "prefixes": { - "": "http://example/" - }, "queryType": "SELECT", "variables": [ "*" @@ -12,16 +8,38 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "http://example/item", - "object": "?_a" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example/item" + }, + "object": { + "termType": "Variable", + "value": "_a" + } }, { - "subject": "?_a", - "predicate": "http://example/price", - "object": "?x" + "subject": { + "termType": "Variable", + "value": "_a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example/price" + }, + "object": { + "termType": "Variable", + "value": "x" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-3c.json b/test/parsedQueries/sparql-9-3c.json index f4e43d6b..f736ab2b 100644 --- a/test/parsedQueries/sparql-9-3c.json +++ b/test/parsedQueries/sparql-9-3c.json @@ -1,18 +1,20 @@ { - "type": "query", - "prefixes": { - "": "http://example/" - }, "queryType": "SELECT", "variables": [ { "expression": { - "expression": "?x", + "expression": { + "termType": "Variable", + "value": "x" + }, "type": "aggregate", "aggregation": "sum", "distinct": false }, - "variable": "?total" + "variable": { + "termType": "Variable", + "value": "total" + } } ], "where": [ @@ -20,18 +22,34 @@ "type": "bgp", "triples": [ { - "subject": "http://example/order", + "subject": { + "termType": "NamedNode", + "value": "http://example/order" + }, "predicate": { "type": "path", "pathType": "/", "items": [ - "http://example/item", - "http://example/price" + { + "termType": "NamedNode", + "value": "http://example/item" + }, + { + "termType": "NamedNode", + "value": "http://example/price" + } ] }, - "object": "?x" + "object": { + "termType": "Variable", + "value": "x" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-4a.json b/test/parsedQueries/sparql-9-4a.json index 6daa5b17..c2915099 100644 --- a/test/parsedQueries/sparql-9-4a.json +++ b/test/parsedQueries/sparql-9-4a.json @@ -1,37 +1,55 @@ { - "type": "query", - "prefixes": { - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - }, "queryType": "SELECT", "variables": [ - "?x", - "?type" + { + "termType": "Variable", + "value": "x" + }, + { + "termType": "Variable", + "value": "type" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?x", + "subject": { + "termType": "Variable", + "value": "x" + }, "predicate": { "type": "path", "pathType": "/", "items": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, { "type": "path", "pathType": "*", "items": [ - "http://www.w3.org/2000/01/rdf-schema#subClassOf" + { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } ] } ] }, - "object": "?type" + "object": { + "termType": "Variable", + "value": "type" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-9-4b.json b/test/parsedQueries/sparql-9-4b.json index e1136a22..be195e40 100644 --- a/test/parsedQueries/sparql-9-4b.json +++ b/test/parsedQueries/sparql-9-4b.json @@ -1,29 +1,41 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "": "http://example/" - }, "queryType": "SELECT", "variables": [ - "?person" + { + "termType": "Variable", + "value": "person" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "http://example/x", + "subject": { + "termType": "NamedNode", + "value": "http://example/x" + }, "predicate": { "type": "path", "pathType": "+", "items": [ - "http://xmlns.com/foaf/0.1/knows" + { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + } ] }, - "object": "?person" + "object": { + "termType": "Variable", + "value": "person" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "": "http://example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-fed-2-1.json b/test/parsedQueries/sparql-fed-2-1.json index 73f11b29..6e40ba8b 100644 --- a/test/parsedQueries/sparql-fed-2-1.json +++ b/test/parsedQueries/sparql-fed-2-1.json @@ -1,15 +1,17 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "from": { "default": [ - "http://example.org/myfoaf.rdf" + { + "termType": "NamedNode", + "value": "http://example.org/myfoaf.rdf" + } ], "named": [] }, @@ -18,9 +20,18 @@ "type": "bgp", "triples": [ { - "subject": "http://example.org/myfoaf/I", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?person" + "subject": { + "termType": "NamedNode", + "value": "http://example.org/myfoaf/I" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "person" + } } ] }, @@ -31,15 +42,31 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } ], - "name": "http://people.example.org/sparql", + "name": { + "termType": "NamedNode", + "value": "http://people.example.org/sparql" + }, "silent": false } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-fed-2-2.json b/test/parsedQueries/sparql-fed-2-2.json index 916b827b..0e1343a3 100644 --- a/test/parsedQueries/sparql-fed-2-2.json +++ b/test/parsedQueries/sparql-fed-2-2.json @@ -1,13 +1,18 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?person", - "?interest", - "?known" + { + "termType": "Variable", + "value": "person" + }, + { + "termType": "Variable", + "value": "interest" + }, + { + "termType": "Variable", + "value": "known" + } ], "where": [ { @@ -17,9 +22,18 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] }, @@ -30,9 +44,18 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/interest", - "object": "?interest" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/interest" + }, + "object": { + "termType": "Variable", + "value": "interest" + } } ] }, @@ -43,21 +66,40 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?known" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "known" + } } ] } ], - "name": "http://people2.example.org/sparql", + "name": { + "termType": "NamedNode", + "value": "http://people2.example.org/sparql" + }, "silent": false } ] } ], - "name": "http://people.example.org/sparql", + "name": { + "termType": "NamedNode", + "value": "http://people.example.org/sparql" + }, "silent": false } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-fed-2-3.json b/test/parsedQueries/sparql-fed-2-3.json index d410abf7..4052dfcb 100644 --- a/test/parsedQueries/sparql-fed-2-3.json +++ b/test/parsedQueries/sparql-fed-2-3.json @@ -1,11 +1,10 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?name" + { + "termType": "Variable", + "value": "name" + } ], "where": [ { @@ -15,15 +14,31 @@ "type": "bgp", "triples": [ { - "subject": "http://example.org/people15", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "NamedNode", + "value": "http://example.org/people15" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] } ], - "name": "http://people.example.org/sparql", + "name": { + "termType": "NamedNode", + "value": "http://people.example.org/sparql" + }, "silent": true } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-fed-2-4a.json b/test/parsedQueries/sparql-fed-2-4a.json index ab9dbcf7..01ca3740 100644 --- a/test/parsedQueries/sparql-fed-2-4a.json +++ b/test/parsedQueries/sparql-fed-2-4a.json @@ -1,20 +1,25 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?s" + { + "termType": "Variable", + "value": "s" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?s", + "subject": { + "termType": "Variable", + "value": "s" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://xmlns.com/foaf/0.1/Person" + "object": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/Person" + } } ] }, @@ -25,15 +30,31 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } ], - "name": "http://example.org/sparql", + "name": { + "termType": "NamedNode", + "value": "http://example.org/sparql" + }, "silent": false } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-fed-2-4b.json b/test/parsedQueries/sparql-fed-2-4b.json index d02e616c..86f470e2 100644 --- a/test/parsedQueries/sparql-fed-2-4b.json +++ b/test/parsedQueries/sparql-fed-2-4b.json @@ -1,23 +1,32 @@ { - "type": "query", - "prefixes": { - "": "http://example.org/", - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?s" + { + "termType": "Variable", + "value": "s" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?s", + "subject": { + "termType": "Variable", + "value": "s" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://xmlns.com/foaf/0.1/Person" + "object": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/Person" + } } ] } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://example.org/", + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-fed-2-4c.json b/test/parsedQueries/sparql-fed-2-4c.json index 4fe67169..51ac8942 100644 --- a/test/parsedQueries/sparql-fed-2-4c.json +++ b/test/parsedQueries/sparql-fed-2-4c.json @@ -1,9 +1,4 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "": "http://example.org/" - }, "queryType": "SELECT", "variables": [ "*" @@ -13,19 +8,39 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } ], + "type": "query", "values": [ { - "?s": "http://example.org/a" + "?s": { + "termType": "NamedNode", + "value": "http://example.org/a" + } }, { - "?s": "http://example.org/b" + "?s": { + "termType": "NamedNode", + "value": "http://example.org/b" + } } - ] -} + ], + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "": "http://example.org/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-fed-2-4d.json b/test/parsedQueries/sparql-fed-2-4d.json index ab572897..a3e3a76d 100644 --- a/test/parsedQueries/sparql-fed-2-4d.json +++ b/test/parsedQueries/sparql-fed-2-4d.json @@ -1,21 +1,29 @@ { - "type": "query", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "queryType": "SELECT", "variables": [ - "?s", - "?o" + { + "termType": "Variable", + "value": "s" + }, + { + "termType": "Variable", + "value": "o" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?s", + "subject": { + "termType": "Variable", + "value": "s" + }, "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "object": "http://xmlns.com/foaf/0.1/Person" + "object": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/Person" + } } ] }, @@ -26,15 +34,31 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "http://xmlns.com/foaf/0.1/knows", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/knows" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } ], - "name": "http://example.org/sparql", + "name": { + "termType": "NamedNode", + "value": "http://example.org/sparql" + }, "silent": false } - ] -} + ], + "type": "query", + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-fed-4.json b/test/parsedQueries/sparql-fed-4.json index 7ffd4f1a..c996b5fb 100644 --- a/test/parsedQueries/sparql-fed-4.json +++ b/test/parsedQueries/sparql-fed-4.json @@ -1,28 +1,46 @@ { - "type": "query", - "prefixes": { - "void": "http://rdfs.org/ns/void#", - "dc": "http://purl.org/dc/elements/1.1/", - "doap": "http://usefulinc.com/ns/doap#" - }, "queryType": "SELECT", "variables": [ - "?service", - "?projectName" + { + "termType": "Variable", + "value": "service" + }, + { + "termType": "Variable", + "value": "projectName" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "?p", - "predicate": "http://purl.org/dc/elements/1.1/subject", - "object": "?projectSubject" + "subject": { + "termType": "Variable", + "value": "p" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/subject" + }, + "object": { + "termType": "Variable", + "value": "projectSubject" + } }, { - "subject": "?p", - "predicate": "http://rdfs.org/ns/void#sparqlEndpoint", - "object": "?service" + "subject": { + "termType": "Variable", + "value": "p" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://rdfs.org/ns/void#sparqlEndpoint" + }, + "object": { + "termType": "Variable", + "value": "service" + } } ] }, @@ -32,8 +50,19 @@ "type": "operation", "operator": "regex", "args": [ - "?projectSubject", - "\"remote\"" + { + "termType": "Variable", + "value": "projectSubject" + }, + { + "termType": "Literal", + "value": "remote", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } ] } }, @@ -44,15 +73,33 @@ "type": "bgp", "triples": [ { - "subject": "?project", - "predicate": "http://usefulinc.com/ns/doap#name", - "object": "?projectName" + "subject": { + "termType": "Variable", + "value": "project" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://usefulinc.com/ns/doap#name" + }, + "object": { + "termType": "Variable", + "value": "projectName" + } } ] } ], - "name": "?service", + "name": { + "termType": "Variable", + "value": "service" + }, "silent": false } - ] -} + ], + "type": "query", + "prefixes": { + "void": "http://rdfs.org/ns/void#", + "dc": "http://purl.org/dc/elements/1.1/", + "doap": "http://usefulinc.com/ns/doap#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-modifiers-order.json b/test/parsedQueries/sparql-modifiers-order.json index 18751db2..05d290d3 100644 --- a/test/parsedQueries/sparql-modifiers-order.json +++ b/test/parsedQueries/sparql-modifiers-order.json @@ -1,18 +1,20 @@ { - "type": "query", - "prefixes": { - "": "http://books.example/" - }, "queryType": "SELECT", "variables": [ { "expression": { - "expression": "?lprice", + "expression": { + "termType": "Variable", + "value": "lprice" + }, "type": "aggregate", "aggregation": "sum", "distinct": false }, - "variable": "?totalPrice" + "variable": { + "termType": "Variable", + "value": "totalPrice" + } } ], "where": [ @@ -20,26 +22,56 @@ "type": "bgp", "triples": [ { - "subject": "?org", - "predicate": "http://books.example/affiliates", - "object": "?auth" + "subject": { + "termType": "Variable", + "value": "org" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://books.example/affiliates" + }, + "object": { + "termType": "Variable", + "value": "auth" + } }, { - "subject": "?auth", - "predicate": "http://books.example/writesBook", - "object": "?book" + "subject": { + "termType": "Variable", + "value": "auth" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://books.example/writesBook" + }, + "object": { + "termType": "Variable", + "value": "book" + } }, { - "subject": "?book", - "predicate": "http://books.example/price", - "object": "?lprice" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://books.example/price" + }, + "object": { + "termType": "Variable", + "value": "lprice" + } } ] } ], "group": [ { - "expression": "?org" + "expression": { + "termType": "Variable", + "value": "org" + } } ], "having": [ @@ -48,18 +80,36 @@ "operator": ">", "args": [ { - "expression": "?lprice", + "expression": { + "termType": "Variable", + "value": "lprice" + }, "type": "aggregate", "aggregation": "sum", "distinct": false }, - "\"10\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Literal", + "value": "10", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } ], "order": [ { - "expression": "?totalPrice" + "expression": { + "termType": "Variable", + "value": "totalPrice" + } } - ] -} + ], + "type": "query", + "prefixes": { + "": "http://books.example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-1-1-1.json b/test/parsedQueries/sparql-update-1-1-1.json index 0e9293cb..d3fc9e19 100644 --- a/test/parsedQueries/sparql-update-1-1-1.json +++ b/test/parsedQueries/sparql-update-1-1-1.json @@ -1,8 +1,5 @@ { "type": "update", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/" - }, "updates": [ { "updateType": "insertdelete", @@ -11,9 +8,23 @@ "type": "bgp", "triples": [ { - "subject": "http://example/egbook", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "\"This is an example title\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/egbook" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Literal", + "value": "This is an example title", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } @@ -21,5 +32,8 @@ "delete": [], "where": [] } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-1a.json b/test/parsedQueries/sparql-update-3-1-1a.json index 51fa3ff3..3b9c4221 100644 --- a/test/parsedQueries/sparql-update-3-1-1a.json +++ b/test/parsedQueries/sparql-update-3-1-1a.json @@ -1,8 +1,5 @@ { "type": "update", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/" - }, "updates": [ { "updateType": "insert", @@ -11,18 +8,49 @@ "type": "bgp", "triples": [ { - "subject": "http://example/book1", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "\"A new book\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Literal", + "value": "A new book", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "subject": "http://example/book1", - "predicate": "http://purl.org/dc/elements/1.1/creator", - "object": "\"A.N.Other\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/creator" + }, + "object": { + "termType": "Literal", + "value": "A.N.Other", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } ] } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-1b.json b/test/parsedQueries/sparql-update-3-1-1b.json index ec9bd828..4b4d9443 100644 --- a/test/parsedQueries/sparql-update-3-1-1b.json +++ b/test/parsedQueries/sparql-update-3-1-1b.json @@ -1,9 +1,5 @@ { "type": "update", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "ns": "http://example.org/ns#" - }, "updates": [ { "updateType": "insert", @@ -12,14 +8,35 @@ "type": "graph", "triples": [ { - "subject": "http://example/book1", - "predicate": "http://example.org/ns#price", - "object": "\"42\"^^http://www.w3.org/2001/XMLSchema#integer" + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://example.org/ns#price" + }, + "object": { + "termType": "Literal", + "value": "42", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } } ], - "name": "http://example/bookStore" + "name": { + "termType": "NamedNode", + "value": "http://example/bookStore" + } } ] } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "ns": "http://example.org/ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-2a.json b/test/parsedQueries/sparql-update-3-1-2a.json index 44fc01c8..0ca3cd9e 100644 --- a/test/parsedQueries/sparql-update-3-1-2a.json +++ b/test/parsedQueries/sparql-update-3-1-2a.json @@ -1,8 +1,5 @@ { "type": "update", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/" - }, "updates": [ { "updateType": "delete", @@ -11,18 +8,49 @@ "type": "bgp", "triples": [ { - "subject": "http://example/book2", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "\"David Copperfield\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book2" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Literal", + "value": "David Copperfield", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "subject": "http://example/book2", - "predicate": "http://purl.org/dc/elements/1.1/creator", - "object": "\"Edmund Wells\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book2" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/creator" + }, + "object": { + "termType": "Literal", + "value": "Edmund Wells", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } ] } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-2b.json b/test/parsedQueries/sparql-update-3-1-2b.json index f5c7db8d..e357f778 100644 --- a/test/parsedQueries/sparql-update-3-1-2b.json +++ b/test/parsedQueries/sparql-update-3-1-2b.json @@ -1,8 +1,5 @@ { "type": "update", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/" - }, "updates": [ { "updateType": "delete", @@ -11,12 +8,29 @@ "type": "graph", "triples": [ { - "subject": "http://example/book1", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "\"Fundamentals of Compiler Desing\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Literal", + "value": "Fundamentals of Compiler Desing", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ], - "name": "http://example/bookStore" + "name": { + "termType": "NamedNode", + "value": "http://example/bookStore" + } } ] }, @@ -27,14 +41,34 @@ "type": "graph", "triples": [ { - "subject": "http://example/book1", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "\"Fundamentals of Compiler Design\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Literal", + "value": "Fundamentals of Compiler Design", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ], - "name": "http://example/bookStore" + "name": { + "termType": "NamedNode", + "value": "http://example/bookStore" + } } ] } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-3-1a.json b/test/parsedQueries/sparql-update-3-1-3-1a.json index ad98aac1..7007fa56 100644 --- a/test/parsedQueries/sparql-update-3-1-3-1a.json +++ b/test/parsedQueries/sparql-update-3-1-3-1a.json @@ -1,9 +1,5 @@ { "type": "update", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "xsd": "http://www.w3.org/2001/XMLSchema#" - }, "updates": [ { "updateType": "insertdelete", @@ -12,9 +8,18 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "?p", - "object": "?v" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "v" + } } ] } @@ -25,9 +30,18 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/date", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/date" + }, + "object": { + "termType": "Variable", + "value": "date" + } } ] }, @@ -37,8 +51,19 @@ "type": "operation", "operator": ">", "args": [ - "?date", - "\"1970-01-01T00:00:00-02:00\"^^http://www.w3.org/2001/XMLSchema#dateTime" + { + "termType": "Variable", + "value": "date" + }, + { + "termType": "Literal", + "value": "1970-01-01T00:00:00-02:00", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "[object Object]" + } + } ] } }, @@ -46,13 +71,26 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "?p", - "object": "?v" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "v" + } } ] } ] } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-3-1b.json b/test/parsedQueries/sparql-update-3-1-3-1b.json index 90dcfd81..6eb15092 100644 --- a/test/parsedQueries/sparql-update-3-1-3-1b.json +++ b/test/parsedQueries/sparql-update-3-1-3-1b.json @@ -1,20 +1,29 @@ { "type": "update", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "updates": [ { "updateType": "insertdelete", - "graph": "http://example/addresses", + "graph": { + "termType": "NamedNode", + "value": "http://example/addresses" + }, "delete": [ { "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "?property", - "object": "?value" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "Variable", + "value": "property" + }, + "object": { + "termType": "Variable", + "value": "value" + } } ] } @@ -25,18 +34,44 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "?property", - "object": "?value" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "Variable", + "value": "property" + }, + "object": { + "termType": "Variable", + "value": "value" + } }, { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/givenName", - "object": "\"Fred\"" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenName" + }, + "object": { + "termType": "Literal", + "value": "Fred", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } ] } - ] -} + ], + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-3-2a.json b/test/parsedQueries/sparql-update-3-1-3-2a.json index af24c2c5..7f90b712 100644 --- a/test/parsedQueries/sparql-update-3-1-3-2a.json +++ b/test/parsedQueries/sparql-update-3-1-3-2a.json @@ -1,9 +1,5 @@ { "type": "update", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "xsd": "http://www.w3.org/2001/XMLSchema#" - }, "updates": [ { "updateType": "insertdelete", @@ -12,12 +8,24 @@ "type": "graph", "triples": [ { - "subject": "?book", - "predicate": "?p", - "object": "?v" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "v" + } } ], - "name": "http://example/bookStore2" + "name": { + "termType": "NamedNode", + "value": "http://example/bookStore2" + } } ], "delete": [], @@ -29,9 +37,18 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/date", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/date" + }, + "object": { + "termType": "Variable", + "value": "date" + } } ] }, @@ -41,8 +58,19 @@ "type": "operation", "operator": ">", "args": [ - "?date", - "\"1970-01-01T00:00:00-02:00\"^^http://www.w3.org/2001/XMLSchema#dateTime" + { + "termType": "Variable", + "value": "date" + }, + { + "termType": "Literal", + "value": "1970-01-01T00:00:00-02:00", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "[object Object]" + } + } ] } }, @@ -50,16 +78,32 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "?p", - "object": "?v" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "v" + } } ] } ], - "name": "http://example/bookStore" + "name": { + "termType": "NamedNode", + "value": "http://example/bookStore" + } } ] } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-3-2b.json b/test/parsedQueries/sparql-update-3-1-3-2b.json index 0482cbbf..33dafcf9 100644 --- a/test/parsedQueries/sparql-update-3-1-3-2b.json +++ b/test/parsedQueries/sparql-update-3-1-3-2b.json @@ -1,9 +1,5 @@ { "type": "update", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - }, "updates": [ { "updateType": "insertdelete", @@ -12,17 +8,38 @@ "type": "graph", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } }, { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?email" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "email" + } } ], - "name": "http://example/addresses" + "name": { + "termType": "NamedNode", + "value": "http://example/addresses" + } } ], "delete": [], @@ -34,9 +51,18 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/name", - "object": "?name" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/name" + }, + "object": { + "termType": "Variable", + "value": "name" + } } ] }, @@ -47,18 +73,34 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/mbox", - "object": "?email" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/mbox" + }, + "object": { + "termType": "Variable", + "value": "email" + } } ] } ] } ], - "name": "http://example/people" + "name": { + "termType": "NamedNode", + "value": "http://example/people" + } } ] } - ] -} + ], + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-3-2c.json b/test/parsedQueries/sparql-update-3-1-3-2c.json index 51baccad..6b0b3f01 100644 --- a/test/parsedQueries/sparql-update-3-1-3-2c.json +++ b/test/parsedQueries/sparql-update-3-1-3-2c.json @@ -1,10 +1,5 @@ { "type": "update", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "dcmitype": "http://purl.org/dc/dcmitype/", - "xsd": "http://www.w3.org/2001/XMLSchema#" - }, "updates": [ { "updateType": "insertdelete", @@ -13,12 +8,24 @@ "type": "graph", "triples": [ { - "subject": "?book", - "predicate": "?p", - "object": "?v" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "v" + } } ], - "name": "http://example/bookStore2" + "name": { + "termType": "NamedNode", + "value": "http://example/bookStore2" + } } ], "delete": [], @@ -30,9 +37,18 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/date", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/date" + }, + "object": { + "termType": "Variable", + "value": "date" + } } ] }, @@ -42,8 +58,19 @@ "type": "operation", "operator": "<", "args": [ - "?date", - "\"2000-01-01T00:00:00-02:00\"^^http://www.w3.org/2001/XMLSchema#dateTime" + { + "termType": "Variable", + "value": "date" + }, + { + "termType": "Literal", + "value": "2000-01-01T00:00:00-02:00", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "[object Object]" + } + } ] } }, @@ -51,28 +78,52 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "?p", - "object": "?v" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "v" + } } ] } ], - "name": "http://example/bookStore" + "name": { + "termType": "NamedNode", + "value": "http://example/bookStore" + } } ] }, { "updateType": "insertdelete", - "graph": "http://example/bookStore", + "graph": { + "termType": "NamedNode", + "value": "http://example/bookStore" + }, "delete": [ { "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "?p", - "object": "?v" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "v" + } } ] } @@ -83,14 +134,32 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/date", - "object": "?date" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/date" + }, + "object": { + "termType": "Variable", + "value": "date" + } }, { - "subject": "?book", - "predicate": "http://purl.org/dc/elements/1.1/type", - "object": "http://purl.org/dc/dcmitype/PhysicalObject" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/type" + }, + "object": { + "termType": "NamedNode", + "value": "http://purl.org/dc/dcmitype/PhysicalObject" + } } ] }, @@ -100,8 +169,19 @@ "type": "operation", "operator": "<", "args": [ - "?date", - "\"2000-01-01T00:00:00-02:00\"^^http://www.w3.org/2001/XMLSchema#dateTime" + { + "termType": "Variable", + "value": "date" + }, + { + "termType": "Literal", + "value": "2000-01-01T00:00:00-02:00", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "[object Object]" + } + } ] } }, @@ -109,13 +189,27 @@ "type": "bgp", "triples": [ { - "subject": "?book", - "predicate": "?p", - "object": "?v" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "v" + } } ] } ] } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "dcmitype": "http://purl.org/dc/dcmitype/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-3-3a.json b/test/parsedQueries/sparql-update-3-1-3-3a.json index df271fd4..e972eeb4 100644 --- a/test/parsedQueries/sparql-update-3-1-3-3a.json +++ b/test/parsedQueries/sparql-update-3-1-3-3a.json @@ -1,8 +1,5 @@ { "type": "update", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "updates": [ { "updateType": "deletewhere", @@ -11,18 +8,44 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/givenName", - "object": "\"Fred\"" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenName" + }, + "object": { + "termType": "Literal", + "value": "Fred", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "subject": "?person", - "predicate": "?property", - "object": "?value" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "Variable", + "value": "property" + }, + "object": { + "termType": "Variable", + "value": "value" + } } ] } ] } - ] -} + ], + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-3-3b.json b/test/parsedQueries/sparql-update-3-1-3-3b.json index 4e3eb9b9..b53d51a8 100644 --- a/test/parsedQueries/sparql-update-3-1-3-3b.json +++ b/test/parsedQueries/sparql-update-3-1-3-3b.json @@ -1,8 +1,5 @@ { "type": "update", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "updates": [ { "updateType": "deletewhere", @@ -11,30 +8,71 @@ "type": "graph", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/givenName", - "object": "\"Fred\"" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenName" + }, + "object": { + "termType": "Literal", + "value": "Fred", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } }, { - "subject": "?person", - "predicate": "?property1", - "object": "?value1" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "Variable", + "value": "property1" + }, + "object": { + "termType": "Variable", + "value": "value1" + } } ], - "name": "http://example.com/names" + "name": { + "termType": "NamedNode", + "value": "http://example.com/names" + } }, { "type": "graph", "triples": [ { - "subject": "?person", - "predicate": "?property2", - "object": "?value2" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "Variable", + "value": "property2" + }, + "object": { + "termType": "Variable", + "value": "value2" + } } ], - "name": "http://example.com/addresses" + "name": { + "termType": "NamedNode", + "value": "http://example.com/addresses" + } } ] } - ] -} + ], + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-1-3.json b/test/parsedQueries/sparql-update-3-1-3.json index 1cd1a107..479ad5d8 100644 --- a/test/parsedQueries/sparql-update-3-1-3.json +++ b/test/parsedQueries/sparql-update-3-1-3.json @@ -1,20 +1,34 @@ { "type": "update", - "prefixes": { - "foaf": "http://xmlns.com/foaf/0.1/" - }, "updates": [ { "updateType": "insertdelete", - "graph": "http://example/addresses", + "graph": { + "termType": "NamedNode", + "value": "http://example/addresses" + }, "delete": [ { "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/givenName", - "object": "\"Bill\"" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenName" + }, + "object": { + "termType": "Literal", + "value": "Bill", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } @@ -24,9 +38,23 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/givenName", - "object": "\"William\"" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenName" + }, + "object": { + "termType": "Literal", + "value": "William", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } @@ -36,13 +64,30 @@ "type": "bgp", "triples": [ { - "subject": "?person", - "predicate": "http://xmlns.com/foaf/0.1/givenName", - "object": "\"Bill\"" + "subject": { + "termType": "Variable", + "value": "person" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://xmlns.com/foaf/0.1/givenName" + }, + "object": { + "termType": "Literal", + "value": "Bill", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } ] } - ] -} + ], + "prefixes": { + "foaf": "http://xmlns.com/foaf/0.1/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-2-3.json b/test/parsedQueries/sparql-update-3-2-3.json index cd3dbc8d..8866acaf 100644 --- a/test/parsedQueries/sparql-update-3-2-3.json +++ b/test/parsedQueries/sparql-update-3-2-3.json @@ -1,6 +1,5 @@ { "type": "update", - "prefixes": {}, "updates": [ { "type": "copy", @@ -11,8 +10,12 @@ }, "destination": { "type": "graph", - "name": "http://example.org/named" + "name": { + "termType": "NamedNode", + "value": "http://example.org/named" + } } } - ] -} + ], + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-2-4.json b/test/parsedQueries/sparql-update-3-2-4.json index 618659d3..b24fee01 100644 --- a/test/parsedQueries/sparql-update-3-2-4.json +++ b/test/parsedQueries/sparql-update-3-2-4.json @@ -1,6 +1,5 @@ { "type": "update", - "prefixes": {}, "updates": [ { "type": "move", @@ -11,8 +10,12 @@ }, "destination": { "type": "graph", - "name": "http://example.org/named" + "name": { + "termType": "NamedNode", + "value": "http://example.org/named" + } } } - ] -} + ], + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-3-2-5.json b/test/parsedQueries/sparql-update-3-2-5.json index 430cf5cd..ab368d37 100644 --- a/test/parsedQueries/sparql-update-3-2-5.json +++ b/test/parsedQueries/sparql-update-3-2-5.json @@ -1,6 +1,5 @@ { "type": "update", - "prefixes": {}, "updates": [ { "type": "add", @@ -11,8 +10,12 @@ }, "destination": { "type": "graph", - "name": "http://example.org/named" + "name": { + "termType": "NamedNode", + "value": "http://example.org/named" + } } } - ] -} + ], + "prefixes": {} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-multiple-prefixes.json b/test/parsedQueries/sparql-update-multiple-prefixes.json index 70228e6a..9f1b5001 100644 --- a/test/parsedQueries/sparql-update-multiple-prefixes.json +++ b/test/parsedQueries/sparql-update-multiple-prefixes.json @@ -1,9 +1,5 @@ { "type": "update", - "prefixes": { - "dc": "http://purl.org/dc/elements/1.1/", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#" - }, "updates": [ { "updateType": "insert", @@ -12,9 +8,23 @@ "type": "bgp", "triples": [ { - "subject": "http://example/book1", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "\"A new book\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, + "object": { + "termType": "Literal", + "value": "A new book", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } @@ -27,13 +37,31 @@ "type": "bgp", "triples": [ { - "subject": "http://example/book2", - "predicate": "http://www.w3.org/2000/01/rdf-schema#label", - "object": "\"A second book\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book2" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/2000/01/rdf-schema#label" + }, + "object": { + "termType": "Literal", + "value": "A second book", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } ] } - ] -} + ], + "prefixes": { + "dc": "http://purl.org/dc/elements/1.1/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + } +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-only-prefix.json b/test/parsedQueries/sparql-update-only-prefix.json index 716c78b1..9b0cc2b7 100644 --- a/test/parsedQueries/sparql-update-only-prefix.json +++ b/test/parsedQueries/sparql-update-only-prefix.json @@ -2,4 +2,4 @@ "prefixes": { "a": "urn:a" } -} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-trailing-prologue.json b/test/parsedQueries/sparql-update-trailing-prologue.json index 2011e0cd..d7114340 100644 --- a/test/parsedQueries/sparql-update-trailing-prologue.json +++ b/test/parsedQueries/sparql-update-trailing-prologue.json @@ -8,9 +8,23 @@ "type": "bgp", "triples": [ { - "subject": "http://example/book1", - "predicate": "urn:label", - "object": "\"A new book\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "urn:label" + }, + "object": { + "termType": "Literal", + "value": "A new book", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } @@ -20,4 +34,4 @@ "prefixes": { "a": "urn:a" } -} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-update-trailing-semicolon.json b/test/parsedQueries/sparql-update-trailing-semicolon.json index f41b5200..cdd98a93 100644 --- a/test/parsedQueries/sparql-update-trailing-semicolon.json +++ b/test/parsedQueries/sparql-update-trailing-semicolon.json @@ -8,9 +8,23 @@ "type": "bgp", "triples": [ { - "subject": "http://example/book1", - "predicate": "urn:label", - "object": "\"A new book\"" + "subject": { + "termType": "NamedNode", + "value": "http://example/book1" + }, + "predicate": { + "termType": "NamedNode", + "value": "urn:label" + }, + "object": { + "termType": "Literal", + "value": "A new book", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#string" + } + } } ] } @@ -18,4 +32,4 @@ } ], "prefixes": {} -} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-values-clause.json b/test/parsedQueries/sparql-values-clause.json index 7d458cf4..ec1d527e 100644 --- a/test/parsedQueries/sparql-values-clause.json +++ b/test/parsedQueries/sparql-values-clause.json @@ -1,18 +1,20 @@ { - "type": "query", - "prefixes": { - "": "http://books.example/" - }, "queryType": "SELECT", "variables": [ { "expression": { - "expression": "?lprice", + "expression": { + "termType": "Variable", + "value": "lprice" + }, "type": "aggregate", "aggregation": "sum", "distinct": false }, - "variable": "?totalPrice" + "variable": { + "termType": "Variable", + "value": "totalPrice" + } } ], "where": [ @@ -20,26 +22,56 @@ "type": "bgp", "triples": [ { - "subject": "?org", - "predicate": "http://books.example/affiliates", - "object": "?auth" + "subject": { + "termType": "Variable", + "value": "org" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://books.example/affiliates" + }, + "object": { + "termType": "Variable", + "value": "auth" + } }, { - "subject": "?auth", - "predicate": "http://books.example/writesBook", - "object": "?book" + "subject": { + "termType": "Variable", + "value": "auth" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://books.example/writesBook" + }, + "object": { + "termType": "Variable", + "value": "book" + } }, { - "subject": "?book", - "predicate": "http://books.example/price", - "object": "?lprice" + "subject": { + "termType": "Variable", + "value": "book" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://books.example/price" + }, + "object": { + "termType": "Variable", + "value": "lprice" + } } ] } ], "group": [ { - "expression": "?org" + "expression": { + "termType": "Variable", + "value": "org" + } } ], "having": [ @@ -48,23 +80,44 @@ "operator": ">", "args": [ { - "expression": "?lprice", + "expression": { + "termType": "Variable", + "value": "lprice" + }, "type": "aggregate", "aggregation": "sum", "distinct": false }, - "\"10\"^^http://www.w3.org/2001/XMLSchema#integer" + { + "termType": "Literal", + "value": "10", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } ] } ], "order": [ { - "expression": "?totalPrice" + "expression": { + "termType": "Variable", + "value": "totalPrice" + } } ], + "type": "query", "values": [ { - "?book": "http://books.example/book2" + "?book": { + "termType": "NamedNode", + "value": "http://books.example/book2" + } } - ] -} + ], + "prefixes": { + "": "http://books.example/" + } +} \ No newline at end of file diff --git a/test/parsedQueries/strlen.json b/test/parsedQueries/strlen.json index e8c7870c..d9dd4210 100644 --- a/test/parsedQueries/strlen.json +++ b/test/parsedQueries/strlen.json @@ -1,17 +1,25 @@ { - "type": "query", "queryType": "SELECT", "variables": [ - "?str", + { + "termType": "Variable", + "value": "str" + }, { "expression": { "type": "operation", "operator": "strlen", "args": [ - "?str" + { + "termType": "Variable", + "value": "str" + } ] }, - "variable": "?strlen" + "variable": { + "termType": "Variable", + "value": "strlen" + } } ], "where": [ @@ -19,12 +27,22 @@ "type": "bgp", "triples": [ { - "subject": "_:b0", - "predicate": "?p", - "object": "?str" + "subject": { + "termType": "BlankNode", + "value": "n3-5" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "str" + } } ] } ], + "type": "query", "prefixes": {} -} +} \ No newline at end of file diff --git a/test/parsedQueries/sub-values.json b/test/parsedQueries/sub-values.json index 73d881cd..d09e2080 100644 --- a/test/parsedQueries/sub-values.json +++ b/test/parsedQueries/sub-values.json @@ -1,15 +1,20 @@ { "queryType": "SELECT", "variables": [ - "?s", - "?o" + { + "termType": "Variable", + "value": "s" + }, + { + "termType": "Variable", + "value": "o" + } ], "where": [ { "type": "group", "patterns": [ { - "type": "query", "queryType": "SELECT", "variables": [ "*" @@ -19,16 +24,29 @@ "type": "bgp", "triples": [ { - "subject": "?s", - "predicate": "?p", - "object": "?o" + "subject": { + "termType": "Variable", + "value": "s" + }, + "predicate": { + "termType": "Variable", + "value": "p" + }, + "object": { + "termType": "Variable", + "value": "o" + } } ] } ], + "type": "query", "values": [ { - "?o": "http://example.org/b" + "?o": { + "termType": "NamedNode", + "value": "http://example.org/b" + } } ] } @@ -39,4 +57,4 @@ "prefixes": { "": "http://example.org/" } -} +} \ No newline at end of file diff --git a/test/parsedQueries/sum-count.json b/test/parsedQueries/sum-count.json index 8bd16162..42d513e3 100644 --- a/test/parsedQueries/sum-count.json +++ b/test/parsedQueries/sum-count.json @@ -1,27 +1,35 @@ { - "type": "query", - "prefixes": { - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - }, "queryType": "SELECT", "variables": [ { "expression": { - "expression": "?val", + "expression": { + "termType": "Variable", + "value": "val" + }, "type": "aggregate", "aggregation": "sum", "distinct": false }, - "variable": "?sum" + "variable": { + "termType": "Variable", + "value": "sum" + } }, { "expression": { - "expression": "?a", + "expression": { + "termType": "Variable", + "value": "a" + }, "type": "aggregate", "aggregation": "count", "distinct": false }, - "variable": "?count" + "variable": { + "termType": "Variable", + "value": "count" + } }, { "expression": { @@ -30,7 +38,10 @@ "aggregation": "count", "distinct": false }, - "variable": "?countAll" + "variable": { + "termType": "Variable", + "value": "countAll" + } } ], "where": [ @@ -38,16 +49,32 @@ "type": "bgp", "triples": [ { - "subject": "?a", - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#value", - "object": "?val" + "subject": { + "termType": "Variable", + "value": "a" + }, + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#value" + }, + "object": { + "termType": "Variable", + "value": "val" + } } ] } ], "group": [ { - "expression": "?a" + "expression": { + "termType": "Variable", + "value": "a" + } } - ] -} + ], + "type": "query", + "prefixes": { + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + } +} \ No newline at end of file From e2c6cff7a382e634bdf62eda231d65f93585004a Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 16 Jul 2019 14:58:45 +0200 Subject: [PATCH 18/46] Fix assert that wasn't updated --- test/SparqlParser-test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/SparqlParser-test.js b/test/SparqlParser-test.js index 55c394ae..afc13256 100644 --- a/test/SparqlParser-test.js +++ b/test/SparqlParser-test.js @@ -88,8 +88,7 @@ describe('A SPARQL parser', function () { var query = 'SELECT * { a:a b:b "" }'; var result_json = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; - expect(parseJSON(JSON.stringify(parser.parse(query).where[0].triples[0]))) - .to.deep.equal(parseJSON(result_json)); + expect(objectsEqual(parser.parse(query).where[0].triples[0], parseJSON(result_json))); }); it('should allow temporarily overriding prefixes', function () { From 43b6218d94807d2e827eb6f349d20fdfc8af725c Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 16 Jul 2019 15:13:08 +0200 Subject: [PATCH 19/46] Fix bug with RDF type url not getting output as a NamedNode --- lib/sparql.jison | 6 +++--- test/parsedQueries/artists-ghent.json | 10 ++++++++-- test/parsedQueries/artists-york.json | 5 ++++- test/parsedQueries/bsbm1.json | 5 ++++- test/parsedQueries/construct-extra-semicolon.json | 5 ++++- .../construct-multi-extra-semicolons.json | 5 ++++- test/parsedQueries/negate-and.json | 5 ++++- test/parsedQueries/sparql-13-3-3.json | 5 ++++- test/parsedQueries/sparql-fed-2-4a.json | 5 ++++- test/parsedQueries/sparql-fed-2-4b.json | 5 ++++- test/parsedQueries/sparql-fed-2-4d.json | 5 ++++- 11 files changed, 47 insertions(+), 14 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index 753b9582..fcfde9f3 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -671,7 +671,7 @@ VerbObjectList Verb : VAR -> toVar($1) | iri - | 'a' -> RDF_TYPE + | 'a' -> Parser.factory.namedNode(RDF_TYPE) ; ObjectList : (GraphNode ',')* GraphNode -> appendTo($1, $2) @@ -701,7 +701,7 @@ PathEltOrInverse ; PathPrimary : iri - | 'a' -> RDF_TYPE + | 'a' -> Parser.factory.namedNode(RDF_TYPE) | '!' PathNegatedPropertySet -> path($1, [$2]) | '(' Path ')' -> $2 ; @@ -712,7 +712,7 @@ PathNegatedPropertySet ; PathOneInPropertySet : iri - | 'a' -> RDF_TYPE + | 'a' -> Parser.factory.namedNode(RDF_TYPE) | '^' iri -> path($1, [$2]) | '^' 'a' -> path($1, [RDF_TYPE]) ; diff --git a/test/parsedQueries/artists-ghent.json b/test/parsedQueries/artists-ghent.json index 3dddd7f2..309201ba 100644 --- a/test/parsedQueries/artists-ghent.json +++ b/test/parsedQueries/artists-ghent.json @@ -6,7 +6,10 @@ "termType": "Variable", "value": "person" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://dbpedia.org/ontology/Artist" @@ -50,7 +53,10 @@ "termType": "Variable", "value": "person" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://dbpedia.org/ontology/Artist" diff --git a/test/parsedQueries/artists-york.json b/test/parsedQueries/artists-york.json index ab38629e..a3b2f242 100644 --- a/test/parsedQueries/artists-york.json +++ b/test/parsedQueries/artists-york.json @@ -19,7 +19,10 @@ "termType": "Variable", "value": "p" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://dbpedia.org/ontology/Artist" diff --git a/test/parsedQueries/bsbm1.json b/test/parsedQueries/bsbm1.json index 6e3fb1e8..3fd5f1b8 100644 --- a/test/parsedQueries/bsbm1.json +++ b/test/parsedQueries/bsbm1.json @@ -34,7 +34,10 @@ "termType": "Variable", "value": "product" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType105" diff --git a/test/parsedQueries/construct-extra-semicolon.json b/test/parsedQueries/construct-extra-semicolon.json index 3c6d0449..d0f18aa1 100644 --- a/test/parsedQueries/construct-extra-semicolon.json +++ b/test/parsedQueries/construct-extra-semicolon.json @@ -6,7 +6,10 @@ "termType": "Variable", "value": "s" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://example.org/ExampleThing" diff --git a/test/parsedQueries/construct-multi-extra-semicolons.json b/test/parsedQueries/construct-multi-extra-semicolons.json index 3c6d0449..d0f18aa1 100644 --- a/test/parsedQueries/construct-multi-extra-semicolons.json +++ b/test/parsedQueries/construct-multi-extra-semicolons.json @@ -6,7 +6,10 @@ "termType": "Variable", "value": "s" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://example.org/ExampleThing" diff --git a/test/parsedQueries/negate-and.json b/test/parsedQueries/negate-and.json index fac5413c..d1adc5d7 100644 --- a/test/parsedQueries/negate-and.json +++ b/test/parsedQueries/negate-and.json @@ -15,7 +15,10 @@ "termType": "Variable", "value": "c" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://www.w3.org/2002/07/owl#Class" diff --git a/test/parsedQueries/sparql-13-3-3.json b/test/parsedQueries/sparql-13-3-3.json index e48624cc..1695651c 100644 --- a/test/parsedQueries/sparql-13-3-3.json +++ b/test/parsedQueries/sparql-13-3-3.json @@ -95,7 +95,10 @@ "termType": "Variable", "value": "ppd" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://xmlns.com/foaf/0.1/PersonalProfileDocument" diff --git a/test/parsedQueries/sparql-fed-2-4a.json b/test/parsedQueries/sparql-fed-2-4a.json index 01ca3740..fff85311 100644 --- a/test/parsedQueries/sparql-fed-2-4a.json +++ b/test/parsedQueries/sparql-fed-2-4a.json @@ -15,7 +15,10 @@ "termType": "Variable", "value": "s" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://xmlns.com/foaf/0.1/Person" diff --git a/test/parsedQueries/sparql-fed-2-4b.json b/test/parsedQueries/sparql-fed-2-4b.json index 86f470e2..5087de6c 100644 --- a/test/parsedQueries/sparql-fed-2-4b.json +++ b/test/parsedQueries/sparql-fed-2-4b.json @@ -15,7 +15,10 @@ "termType": "Variable", "value": "s" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://xmlns.com/foaf/0.1/Person" diff --git a/test/parsedQueries/sparql-fed-2-4d.json b/test/parsedQueries/sparql-fed-2-4d.json index a3e3a76d..c8eb8dd5 100644 --- a/test/parsedQueries/sparql-fed-2-4d.json +++ b/test/parsedQueries/sparql-fed-2-4d.json @@ -19,7 +19,10 @@ "termType": "Variable", "value": "s" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + }, "object": { "termType": "NamedNode", "value": "http://xmlns.com/foaf/0.1/Person" From 80555a180df7ee9960b994dd018d42606dcf250a Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 16 Jul 2019 16:06:51 +0200 Subject: [PATCH 20/46] Move comparing function to test-setup.js --- test/SparqlParser-test.js | 33 --------------------------------- test/test-setup.js | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/test/SparqlParser-test.js b/test/SparqlParser-test.js index afc13256..285769c5 100644 --- a/test/SparqlParser-test.js +++ b/test/SparqlParser-test.js @@ -3,42 +3,9 @@ var SparqlParser = require('../sparql').Parser; var fs = require('fs'), expect = require('chai').expect; -var N3 = require("n3"); - var queriesPath = __dirname + '/../queries/'; var parsedQueriesPath = __dirname + '/../test/parsedQueries/'; -// Test function which checks if object are equal, keeping into account how N3.DataFactory works -function objectsEqual(one, two){ - if (isPrimitive(one) || one === undefined){ - return one === two; - } - - if (one instanceof N3.DataFactory.internal.Term){ - return one.equals(two); - } else if (two instanceof N3.DataFactory.internal.Term){ - return two.equals(one); - } else { - if (Array.isArray(one) && Array.isArray(two)){ - if (one.length !== two.length) return false; - for (let i = 0; i < one.length; i++){ - if (! objectsEqual(one[i], two[i])) return false; - } - } else { - let keys_first = Object.keys(one); - - for (key of keys_first){ - if (! objectsEqual(one[key], two[key])) return false; - } - } - return true; - } -} - -function isPrimitive(value){ - return typeof value === "string" || typeof value === "number" || typeof value === "boolean"; -} - describe('A SPARQL parser', function () { var parser = new SparqlParser(null, null, null); diff --git a/test/test-setup.js b/test/test-setup.js index f87dc34a..dfd03815 100644 --- a/test/test-setup.js +++ b/test/test-setup.js @@ -1,3 +1,5 @@ +var N3 = require("n3"); + // Parses a JSON object, restoring `undefined` values global.parseJSON = function parseJSON(string) { var object = JSON.parse(string); @@ -15,3 +17,36 @@ function restoreUndefined(object) { } return object; } + + + +// Test function which checks if object are equal, keeping into account how N3.DataFactory works +global.objectsEqual = function (one, two){ + if (isPrimitive(one) || one === undefined){ + return one === two; + } + + if (one instanceof N3.DataFactory.internal.Term){ + return one.equals(two); + } else if (two instanceof N3.DataFactory.internal.Term){ + return two.equals(one); + } else { + if (Array.isArray(one) && Array.isArray(two)){ + if (one.length !== two.length) return false; + for (let i = 0; i < one.length; i++){ + if (! objectsEqual(one[i], two[i])) return false; + } + } else { + let keys_first = Object.keys(one); + + for (key of keys_first){ + if (! objectsEqual(one[key], two[key])) return false; + } + } + return true; + } +}; + +global.isPrimitive = function (value){ + return typeof value === "string" || typeof value === "number" || typeof value === "boolean"; +}; From 5c2e6be996284982a056419dd628151a2c7f3548 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Thu, 18 Jul 2019 09:11:18 +0200 Subject: [PATCH 21/46] Fix a parser bug related to typedLiterals Fix a bug that caused typed literals to sometimes get [object Object] as the datatype value. --- lib/sparql.jison | 2 +- test/parsedQueries/bsbm10.json | 2 +- test/parsedQueries/sparql-17.json | 2 +- test/parsedQueries/sparql-update-3-1-3-1a.json | 2 +- test/parsedQueries/sparql-update-3-1-3-2a.json | 2 +- test/parsedQueries/sparql-update-3-1-3-2c.json | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index fcfde9f3..1a35c6c2 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -810,7 +810,7 @@ GroupConcatSeparator Literal : String -> createTypedLiteral($1) | String LANGTAG -> createLangLiteral($1, lowercase($2.substr(1))) - | String '^^' iri -> createTypedLiteral($1, $3) + | String '^^' iri -> createTypedLiteral($1, $3.value) | INTEGER -> createTypedLiteral($1, XSD_INTEGER) | DECIMAL -> createTypedLiteral($1, XSD_DECIMAL) | DOUBLE -> createTypedLiteral(lowercase($1), XSD_DOUBLE) diff --git a/test/parsedQueries/bsbm10.json b/test/parsedQueries/bsbm10.json index 02137a43..855e121f 100644 --- a/test/parsedQueries/bsbm10.json +++ b/test/parsedQueries/bsbm10.json @@ -158,7 +158,7 @@ "language": "", "datatype": { "termType": "NamedNode", - "value": "[object Object]" + "value": "http://www.w3.org/2001/XMLSchema#dateTime" } } ] diff --git a/test/parsedQueries/sparql-17.json b/test/parsedQueries/sparql-17.json index 3369e715..43f956bc 100644 --- a/test/parsedQueries/sparql-17.json +++ b/test/parsedQueries/sparql-17.json @@ -56,7 +56,7 @@ "language": "", "datatype": { "termType": "NamedNode", - "value": "[object Object]" + "value": "http://www.w3.org/2001/XMLSchema#dateTime" } } ] diff --git a/test/parsedQueries/sparql-update-3-1-3-1a.json b/test/parsedQueries/sparql-update-3-1-3-1a.json index 7007fa56..64ae0066 100644 --- a/test/parsedQueries/sparql-update-3-1-3-1a.json +++ b/test/parsedQueries/sparql-update-3-1-3-1a.json @@ -61,7 +61,7 @@ "language": "", "datatype": { "termType": "NamedNode", - "value": "[object Object]" + "value": "http://www.w3.org/2001/XMLSchema#dateTime" } } ] diff --git a/test/parsedQueries/sparql-update-3-1-3-2a.json b/test/parsedQueries/sparql-update-3-1-3-2a.json index 7f90b712..e0def9e0 100644 --- a/test/parsedQueries/sparql-update-3-1-3-2a.json +++ b/test/parsedQueries/sparql-update-3-1-3-2a.json @@ -68,7 +68,7 @@ "language": "", "datatype": { "termType": "NamedNode", - "value": "[object Object]" + "value": "http://www.w3.org/2001/XMLSchema#dateTime" } } ] diff --git a/test/parsedQueries/sparql-update-3-1-3-2c.json b/test/parsedQueries/sparql-update-3-1-3-2c.json index 6b0b3f01..5ae11332 100644 --- a/test/parsedQueries/sparql-update-3-1-3-2c.json +++ b/test/parsedQueries/sparql-update-3-1-3-2c.json @@ -68,7 +68,7 @@ "language": "", "datatype": { "termType": "NamedNode", - "value": "[object Object]" + "value": "http://www.w3.org/2001/XMLSchema#dateTime" } } ] @@ -179,7 +179,7 @@ "language": "", "datatype": { "termType": "NamedNode", - "value": "[object Object]" + "value": "http://www.w3.org/2001/XMLSchema#dateTime" } } ] From 8535802ff63775ac22cffcb80fa53d2666589fdd Mon Sep 17 00:00:00 2001 From: sivbraec Date: Thu, 18 Jul 2019 09:38:42 +0200 Subject: [PATCH 22/46] Fix bug related to VALUES in query Fix a bug that caused value entries in parsed queries to have get variable as key rather than a string --- lib/sparql.jison | 1 - test/SparqlParser-test.js | 3 ++- test/parsedQueries/sparql-10-2-2a.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index 1a35c6c2..2c222b26 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -524,7 +524,6 @@ ValuesClause InlineData : VAR '{' DataBlockValue* '}' { - $1 = toVar($1); $$ = $3.map(function(v) { var o = {}; o[$1] = v; return o; }) } | diff --git a/test/SparqlParser-test.js b/test/SparqlParser-test.js index 285769c5..b3f2c914 100644 --- a/test/SparqlParser-test.js +++ b/test/SparqlParser-test.js @@ -24,7 +24,8 @@ describe('A SPARQL parser', function () { var parsedQuery = parseJSON(fs.readFileSync(parsedQueryFile, 'utf8')); query = fs.readFileSync(queriesPath + query + '.sparql', 'utf8'); - expect(objectsEqual(parser.parse(query), parsedQuery)).to.equal(true); + const parsed = parser.parse(query); + expect(objectsEqual(parsed, parsedQuery)).to.equal(true); }); }); diff --git a/test/parsedQueries/sparql-10-2-2a.json b/test/parsedQueries/sparql-10-2-2a.json index cd9c2e98..0177d2d5 100644 --- a/test/parsedQueries/sparql-10-2-2a.json +++ b/test/parsedQueries/sparql-10-2-2a.json @@ -19,13 +19,13 @@ "type": "values", "values": [ { - "[object Object]": { + "?book": { "termType": "NamedNode", "value": "http://example.org/book/book1" } }, { - "[object Object]": { + "?book": { "termType": "NamedNode", "value": "http://example.org/book/book3" } From 11a30a84fa3b60cd3188e1f80347d5ea33de5536 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Thu, 18 Jul 2019 12:55:31 +0200 Subject: [PATCH 23/46] Fix a bug causing namedNodes to get parsed as strings --- lib/sparql.jison | 9 ++++++--- test/parsedQueries/sparql-16-2-1.json | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index 2c222b26..a7f6ed69 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -155,8 +155,11 @@ return triple; } - // Creates a new blank node identifier - function blank() { + // Creates a new blank node + function blank(name) { + if (typeof name === 'string') { + return Parser.factory.blankNode(name); + } return Parser.factory.blankNode(blankId++); }; var blankId = 0; @@ -735,7 +738,7 @@ VarOrTerm : VAR -> toVar($1) | iri | Literal - | BLANK_NODE_LABEL + | BLANK_NODE_LABEL -> blank($1.replace(/^(_:)/,"")); | ANON -> blank() | NIL -> RDF_NIL ; diff --git a/test/parsedQueries/sparql-16-2-1.json b/test/parsedQueries/sparql-16-2-1.json index cb63f416..faa596e2 100644 --- a/test/parsedQueries/sparql-16-2-1.json +++ b/test/parsedQueries/sparql-16-2-1.json @@ -10,10 +10,16 @@ "termType": "NamedNode", "value": "http://www.w3.org/2001/vcard-rdf/3.0#N" }, - "object": "_:v" + "object": { + "termType": "BlankNode", + "value": "v" + } }, { - "subject": "_:v", + "subject": { + "termType": "BlankNode", + "value": "v" + }, "predicate": { "termType": "NamedNode", "value": "http://www.w3.org/2001/vcard-rdf/3.0#givenName" @@ -24,7 +30,10 @@ } }, { - "subject": "_:v", + "subject": { + "termType": "BlankNode", + "value": "v" + }, "predicate": { "termType": "NamedNode", "value": "http://www.w3.org/2001/vcard-rdf/3.0#familyName" @@ -128,4 +137,4 @@ "foaf": "http://xmlns.com/foaf/0.1/", "vcard": "http://www.w3.org/2001/vcard-rdf/3.0#" } -} \ No newline at end of file +} From f253fc08d610a550afa02c0e7405a6e4a83f19ce Mon Sep 17 00:00:00 2001 From: sivbraec Date: Thu, 18 Jul 2019 14:44:27 +0200 Subject: [PATCH 24/46] Fix RDF_ constants --- lib/sparql.jison | 8 +- test/parsedQueries/lists.json | 300 +++++++++++++++++++++++++++------- 2 files changed, 244 insertions(+), 64 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index a7f6ed69..bfd829f4 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -206,8 +206,8 @@ // Build an RDF list out of the items for (var i = 0, j = 0, l = listItems.length, listTriples = Array(l * 2); i < l;) - listTriples[j++] = triple(head, RDF_FIRST, listItems[i]), - listTriples[j++] = triple(head, RDF_REST, head = ++i < l ? blank() : RDF_NIL); + listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_FIRST), listItems[i]), + listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_REST), head = ++i < l ? blank() : Parser.factory.namedNode(RDF_NIL)); // Return the list's identifier, its triples, and the triples associated with its items return { entity: list, triples: appendAllTo(listTriples, triples) }; @@ -716,7 +716,7 @@ PathOneInPropertySet : iri | 'a' -> Parser.factory.namedNode(RDF_TYPE) | '^' iri -> path($1, [$2]) - | '^' 'a' -> path($1, [RDF_TYPE]) + | '^' 'a' -> path($1, [Parser.factory.namedNode(RDF_TYPE)]) ; TriplesNode : '(' GraphNode+ ')' -> createList($2) @@ -740,7 +740,7 @@ VarOrTerm | Literal | BLANK_NODE_LABEL -> blank($1.replace(/^(_:)/,"")); | ANON -> blank() - | NIL -> RDF_NIL + | NIL -> Parser.factory.namedNode(RDF_NIL) ; Expression : ConditionalAndExpression ExpressionTail* -> createOperationTree($1, $2) diff --git a/test/parsedQueries/lists.json b/test/parsedQueries/lists.json index dd243181..3fcb444f 100644 --- a/test/parsedQueries/lists.json +++ b/test/parsedQueries/lists.json @@ -20,7 +20,10 @@ "termType": "BlankNode", "value": "2" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:a0" @@ -31,7 +34,10 @@ "termType": "BlankNode", "value": "2" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "3" @@ -42,7 +48,10 @@ "termType": "BlankNode", "value": "3" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "BlankNode", "value": "n3-2" @@ -53,15 +62,24 @@ "termType": "BlankNode", "value": "3" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { "termType": "BlankNode", "value": "n3-2" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:b0" @@ -72,7 +90,10 @@ "termType": "BlankNode", "value": "n3-2" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "1" @@ -83,7 +104,10 @@ "termType": "BlankNode", "value": "1" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:c0" @@ -94,8 +118,14 @@ "termType": "BlankNode", "value": "1" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { @@ -116,7 +146,10 @@ "termType": "BlankNode", "value": "6" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:a0" @@ -127,7 +160,10 @@ "termType": "BlankNode", "value": "6" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "7" @@ -138,7 +174,10 @@ "termType": "BlankNode", "value": "7" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "BlankNode", "value": "4" @@ -149,15 +188,24 @@ "termType": "BlankNode", "value": "7" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { "termType": "BlankNode", "value": "4" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:b0" @@ -168,7 +216,10 @@ "termType": "BlankNode", "value": "4" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "5" @@ -179,7 +230,10 @@ "termType": "BlankNode", "value": "5" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:c0" @@ -190,8 +244,14 @@ "termType": "BlankNode", "value": "5" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } } ], "where": [ @@ -207,7 +267,10 @@ "termType": "Variable", "value": "p1" }, - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { @@ -224,7 +287,10 @@ } }, { - "subject": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil", + "subject": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + }, "predicate": { "termType": "Variable", "value": "p2" @@ -253,7 +319,10 @@ "termType": "BlankNode", "value": "8" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:a3" @@ -264,8 +333,14 @@ "termType": "BlankNode", "value": "8" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { @@ -286,7 +361,10 @@ "termType": "BlankNode", "value": "9" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:a4" @@ -297,7 +375,10 @@ "termType": "BlankNode", "value": "9" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "10" @@ -308,7 +389,10 @@ "termType": "BlankNode", "value": "10" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:b4" @@ -319,7 +403,10 @@ "termType": "BlankNode", "value": "10" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "11" @@ -330,7 +417,10 @@ "termType": "BlankNode", "value": "11" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:c4" @@ -341,8 +431,14 @@ "termType": "BlankNode", "value": "11" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { @@ -363,7 +459,10 @@ "termType": "BlankNode", "value": "14" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:a5" @@ -374,7 +473,10 @@ "termType": "BlankNode", "value": "14" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "15" @@ -385,7 +487,10 @@ "termType": "BlankNode", "value": "15" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "BlankNode", "value": "12" @@ -396,15 +501,24 @@ "termType": "BlankNode", "value": "15" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { "termType": "BlankNode", "value": "12" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:b5" @@ -415,7 +529,10 @@ "termType": "BlankNode", "value": "12" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "13" @@ -426,7 +543,10 @@ "termType": "BlankNode", "value": "13" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:c5" @@ -437,8 +557,14 @@ "termType": "BlankNode", "value": "13" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { @@ -459,7 +585,10 @@ "termType": "BlankNode", "value": "18" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:a6" @@ -470,7 +599,10 @@ "termType": "BlankNode", "value": "18" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "19" @@ -481,7 +613,10 @@ "termType": "BlankNode", "value": "19" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "BlankNode", "value": "16" @@ -492,15 +627,24 @@ "termType": "BlankNode", "value": "19" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { "termType": "BlankNode", "value": "16" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:b6" @@ -511,7 +655,10 @@ "termType": "BlankNode", "value": "16" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "17" @@ -522,7 +669,10 @@ "termType": "BlankNode", "value": "17" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:c6" @@ -533,15 +683,24 @@ "termType": "BlankNode", "value": "17" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { "termType": "BlankNode", "value": "20" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:a7" @@ -552,7 +711,10 @@ "termType": "BlankNode", "value": "20" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, "object": { "termType": "BlankNode", "value": "21" @@ -563,7 +725,10 @@ "termType": "BlankNode", "value": "21" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "NamedNode", "value": "ex:b7" @@ -574,8 +739,14 @@ "termType": "BlankNode", "value": "21" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { @@ -596,7 +767,10 @@ "termType": "BlankNode", "value": "23" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first", + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" + }, "object": { "termType": "BlankNode", "value": "22" @@ -607,8 +781,14 @@ "termType": "BlankNode", "value": "23" }, - "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest", - "object": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + "predicate": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" + }, + "object": { + "termType": "NamedNode", + "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" + } }, { "subject": { From 9b3f8c891242a2cdac9565ae4aacb7fb8b298026 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Thu, 18 Jul 2019 15:09:14 +0200 Subject: [PATCH 25/46] Change generator so tests succeed again --- lib/SparqlGenerator.js | 27 ++++++++++++++++++--------- package-lock.json | 29 +++++++++++++++++++++++++++++ package.json | 3 ++- test/SparqlGenerator-test.js | 8 ++++---- test/TestDataFactory.js | 28 ---------------------------- 5 files changed, 53 insertions(+), 42 deletions(-) delete mode 100644 test/TestDataFactory.js diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index b80acbdc..a981ed00 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -1,5 +1,7 @@ var XSD_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer'; +var termToString = require("rdf-string").termToString; + function Generator(options, prefixes) { this._options = options = options || {}; @@ -31,11 +33,12 @@ Generator.prototype.toQuery = function (q) { if (q.distinct) query += 'DISTINCT '; - if (q.variables) + if (q.variables){ query += mapJoin(q.variables, undefined, function (variable) { - return isString(variable) ? this.toEntity(variable) : - '(' + this.toExpression(variable.expression) + ' AS ' + variable.variable + ')'; + return isString(variable) || isTerm(variable) ? this.toEntity(variable) : + '(' + this.toExpression(variable.expression) + ' AS ' + termToString(variable.variable) + ')'; }, this) + ' '; + } else if (q.template) query += this.group(q.template, true) + this._newline; @@ -51,7 +54,7 @@ Generator.prototype.toQuery = function (q) { if (q.group) query += 'GROUP BY ' + mapJoin(q.group, undefined, function (it) { var result = isString(it.expression) ? it.expression : '(' + this.toExpression(it.expression) + ')'; - return it.variable ? '(' + result + ' AS ' + it.variable + ')' : result; + return it.variable ? '(' + result + ' AS ' + termToString(it.variable) + ')' : result; }, this) + this._newline; if (q.having) query += 'HAVING (' + mapJoin(q.having, undefined, this.toExpression, this) + ')' + this._newline; @@ -156,7 +159,7 @@ Generator.prototype.filter = function (filter) { }; Generator.prototype.bind = function (bind) { - return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + bind.variable + ')'; + return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + termToString(bind.variable) + ')'; }; Generator.prototype.optional = function (optional) { @@ -201,9 +204,9 @@ Generator.prototype.service = function (service) { // Converts the parsed expression object into a SPARQL expression Generator.prototype.toExpression = function (expr) { - if (isString(expr)) + if (isString(expr) || isTerm(expr)) { return this.toEntity(expr); - + } switch (expr.type.toLowerCase()) { case 'aggregate': return expr.aggregation.toUpperCase() + @@ -227,9 +230,9 @@ Generator.prototype.toExpression = function (expr) { case '-': case '*': case '/': - return (isString(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + + return (isString(args[0]) || isTerm(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + ' ' + operator + ' ' + - (isString(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); + (isString(args[1]) || isTerm(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); // Unary operators case '!': return '!(' + this.toExpression(args[0]) + ')'; @@ -255,6 +258,9 @@ Generator.prototype.toExpression = function (expr) { // Converts the parsed entity (or property path) into a SPARQL entity Generator.prototype.toEntity = function (value) { + if (isTerm(value)){ + value = termToString(value); + } // regular entity if (isString(value)) { switch (value[0]) { @@ -358,6 +364,9 @@ Generator.prototype.indent = function(text) { return text.replace(/^/gm, this._i // Checks whether the object is a string function isString(object) { return typeof object === 'string'; } +// Checks whether the object is a Term +function isTerm(object) { return object.termType !== undefined; } + // Maps the array with the given function, and joins the results using the separator function mapJoin(array, sep, func, self) { return array.map(func, self).join(isString(sep) ? sep : ' '); diff --git a/package-lock.json b/package-lock.json index a23b451a..4c335d29 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,27 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@rdfjs/data-model": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@rdfjs/data-model/-/data-model-1.1.1.tgz", + "integrity": "sha512-4jb1zc77f27u/MLVhpE/zHR1uvdH4XElXG63rJP/kVnvKoHtVfyJSEqN9oRLANgqHJ9SNwKj9FXeNFZ4+GGfiw==", + "requires": { + "@types/rdf-js": "^2.0.1" + } + }, + "@types/node": { + "version": "12.6.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.6.8.tgz", + "integrity": "sha512-aX+gFgA5GHcDi89KG5keey2zf0WfZk/HAQotEamsK2kbey+8yGKcson0hbK8E+v0NArlCJQCqMP161YhV6ZXLg==" + }, + "@types/rdf-js": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/rdf-js/-/rdf-js-2.0.2.tgz", + "integrity": "sha512-rHtC0mtRmMc9JzITesWhzmAXqfyJZhY8MygmmWZc3oWS5DPsGsKs+t3RXxGYlM4UKOqlD9Ki4owS1Cx/GPMeqw==", + "requires": { + "@types/node": "*" + } + }, "JSONSelect": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz", @@ -429,6 +450,14 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, + "rdf-string": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/rdf-string/-/rdf-string-1.3.1.tgz", + "integrity": "sha512-Pcw6aZRfto2cZodK5kSqFZW8mz6nfKLxSfjOSrTi5ajb2CSIwzqGx7UniysgKoV2i7tQL5dpPgCgY80upCiRUw==", + "requires": { + "@rdfjs/data-model": "^1.1.1" + } + }, "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", diff --git a/package.json b/package.json index cbdb0978..45a1c071 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "A parser for the SPARQL query language", "author": "Ruben Verborgh ", "dependencies": { - "n3": "^1.0.4" + "n3": "^1.0.4", + "rdf-string": "^1.3.1" }, "keywords": [ "sparql", diff --git a/test/SparqlGenerator-test.js b/test/SparqlGenerator-test.js index 1b289457..106c2d36 100644 --- a/test/SparqlGenerator-test.js +++ b/test/SparqlGenerator-test.js @@ -5,8 +5,6 @@ var fs = require('fs'), expect = require('chai').expect, os = require('os'); -var factory = require('./TestDataFactory'); - var queriesPath = __dirname + '/../queries/'; var parsedQueriesPath = __dirname + '/../test/parsedQueries/'; var unusedPrefixesPath = __dirname + '/../test/unusedPrefixes/'; @@ -26,7 +24,9 @@ describe('A SPARQL generator', function () { it('should correctly generate query "' + query + '"', function () { var parsedQuery = parseJSON(fs.readFileSync(parsedQueryFile, 'utf8')); var genQuery = allPrefixesGenerator.stringify(parsedQuery); - expect(new SparqlParser(null, null, factory).parse(genQuery)).to.deep.equal(parsedQuery); + + const parsed = new SparqlParser(null, null, null).parse(genQuery); + expect(objectsEqual(parsed, parsedQuery)).to.equal(true); }); }); @@ -49,7 +49,7 @@ describe('A SPARQL generator', function () { }); it('should use inherited prefixes', function () { - var parser = new SparqlParser({rdfs: 'http://www.w3.org/2000/01/rdf-schema#'}, null, factory); + var parser = new SparqlParser({rdfs: 'http://www.w3.org/2000/01/rdf-schema#'}, null, null); var parsedQuery = parser.parse('SELECT * WHERE { ?s rdfs:label ?o }'); var generatedQuery = defaultGenerator.stringify(parsedQuery); var expectedQuery = diff --git a/test/TestDataFactory.js b/test/TestDataFactory.js deleted file mode 100644 index d80e995d..00000000 --- a/test/TestDataFactory.js +++ /dev/null @@ -1,28 +0,0 @@ -// ## TestDataFactory functions -// Emulate old, pre-RDF/JS output (plain strings instead of Terms) to make tests pass - -function namedNode(iri) { - return iri; -} - -function blankNode(name) { - return '_:b' + name; -} - -function literal(value, tag) { - var suffix = ''; - if (tag) - suffix = (/:/.test(tag) ? '^^' : '@') + tag; - return '"' + value + '"' + suffix; -} - -function variable(name) { - return '?' + name; -} - -module.exports = TestDataFactory = { - namedNode: namedNode, - blankNode: blankNode, - variable: variable, - literal: literal -}; From 07a16379fa7003b4a8a3a6ee7793bb2efe86c4f3 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Thu, 18 Jul 2019 16:03:13 +0200 Subject: [PATCH 26/46] Migrate from to expect from jest and add custom matcher --- package-lock.json | 1196 ++++++++++++++++++++++++++- package.json | 1 + test/SparqlGenerator-test.js | 11 +- test/SparqlParser-test.js | 45 +- test/matchers/toEqualParsedQuery.js | 72 ++ test/test-setup.js | 35 - 6 files changed, 1295 insertions(+), 65 deletions(-) create mode 100644 test/matchers/toEqualParsedQuery.js diff --git a/package-lock.json b/package-lock.json index 4c335d29..143d0b0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,78 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + } + } + }, + "@jest/console": { + "version": "24.7.1", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.7.1.tgz", + "integrity": "sha512-iNhtIy2M8bXlAOULWVTUxmnelTLFneTNEkHCgPmgd+zNwy9zVddJ6oS5rZ9iwoscNdT5mMwUd0C51v/fSlzItg==", + "requires": { + "@jest/source-map": "^24.3.0", + "chalk": "^2.0.1", + "slash": "^2.0.0" + } + }, + "@jest/source-map": { + "version": "24.3.0", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-24.3.0.tgz", + "integrity": "sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag==", + "requires": { + "callsites": "^3.0.0", + "graceful-fs": "^4.1.15", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "@jest/test-result": { + "version": "24.8.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.8.0.tgz", + "integrity": "sha512-+YdLlxwizlfqkFDh7Mc7ONPQAhA4YylU1s529vVM1rsf67vGZH/2GGm5uO8QzPeVyaVMobCQ7FTxl38QrKRlng==", + "requires": { + "@jest/console": "^24.7.1", + "@jest/types": "^24.8.0", + "@types/istanbul-lib-coverage": "^2.0.0" + } + }, + "@jest/types": { + "version": "24.8.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.8.0.tgz", + "integrity": "sha512-g17UxVr2YfBtaMUxn9u/4+siG1ptg9IGYAYwvpwn61nBg779RXnjE/m7CxYcIzEt0AbHZZAHSEZNhkE2WxURVg==", + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^12.0.9" + } + }, "@rdfjs/data-model": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@rdfjs/data-model/-/data-model-1.1.1.tgz", @@ -12,6 +84,28 @@ "@types/rdf-js": "^2.0.1" } }, + "@types/istanbul-lib-coverage": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", + "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==" + }, + "@types/istanbul-lib-report": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz", + "integrity": "sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg==", + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz", + "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==", + "requires": { + "@types/istanbul-lib-coverage": "*", + "@types/istanbul-lib-report": "*" + } + }, "@types/node": { "version": "12.6.8", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.6.8.tgz", @@ -25,6 +119,16 @@ "@types/node": "*" } }, + "@types/stack-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", + "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==" + }, + "@types/yargs": { + "version": "12.0.12", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-12.0.12.tgz", + "integrity": "sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw==" + }, "JSONSelect": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz", @@ -44,18 +148,111 @@ "dev": true, "optional": true }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" + }, "assertion-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", "dev": true }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", @@ -66,12 +263,60 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "browser-stdout": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", "dev": true }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, "chai": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", @@ -86,6 +331,31 @@ "type-detect": "^4.0.0" } }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -101,6 +371,49 @@ "jsonlint": "1.6.0" } }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, "colors": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/colors/-/colors-0.5.1.tgz", @@ -113,6 +426,11 @@ "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", "dev": true }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -130,6 +448,11 @@ "typedarray": "^0.0.6" } }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -156,6 +479,11 @@ "ms": "2.0.0" } }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -165,12 +493,54 @@ "type-detect": "^4.0.0" } }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, "diff": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", "dev": true }, + "diff-sequences": { + "version": "24.3.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.3.0.tgz", + "integrity": "sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw==" + }, "ebnf-parser": { "version": "0.1.10", "resolved": "https://registry.npmjs.org/ebnf-parser/-/ebnf-parser-0.1.10.tgz", @@ -180,8 +550,7 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "escodegen": { "version": "1.3.3", @@ -213,6 +582,171 @@ "integrity": "sha1-gVHTWOIMisx/t0XnRywAJf5JZXA=", "dev": true }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expect": { + "version": "24.8.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-24.8.0.tgz", + "integrity": "sha512-/zYvP8iMDrzaaxHVa724eJBCKqSHmO0FA7EDkBiRHxg6OipmMn1fN+C8T9L9K8yr7UONkOifu6+LLH+z76CnaA==", + "requires": { + "@jest/types": "^24.8.0", + "ansi-styles": "^3.2.0", + "jest-get-type": "^24.8.0", + "jest-matcher-utils": "^24.8.0", + "jest-message-util": "^24.8.0", + "jest-regex-util": "^24.3.0" + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "requires": { + "map-cache": "^0.2.2" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -225,6 +759,11 @@ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" + }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -239,6 +778,11 @@ "path-is-absolute": "^1.0.0" } }, + "graceful-fs": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", + "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==" + }, "growl": { "version": "1.10.3", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", @@ -251,6 +795,35 @@ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -273,11 +846,104 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "requires": { + "isobject": "^3.0.1" + } + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -285,6 +951,58 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "jest-diff": { + "version": "24.8.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.8.0.tgz", + "integrity": "sha512-wxetCEl49zUpJ/bvUmIFjd/o52J+yWcoc5ZyPq4/W1LUKGEhRYDIbP1KcF6t+PvqNrGAFk4/JhtxDq/Nnzs66g==", + "requires": { + "chalk": "^2.0.1", + "diff-sequences": "^24.3.0", + "jest-get-type": "^24.8.0", + "pretty-format": "^24.8.0" + } + }, + "jest-get-type": { + "version": "24.8.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.8.0.tgz", + "integrity": "sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ==" + }, + "jest-matcher-utils": { + "version": "24.8.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.8.0.tgz", + "integrity": "sha512-lex1yASY51FvUuHgm0GOVj7DCYEouWSlIYmCW7APSqB9v8mXmKSn5+sWVF0MhuASG0bnYY106/49JU1FZNl5hw==", + "requires": { + "chalk": "^2.0.1", + "jest-diff": "^24.8.0", + "jest-get-type": "^24.8.0", + "pretty-format": "^24.8.0" + } + }, + "jest-message-util": { + "version": "24.8.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.8.0.tgz", + "integrity": "sha512-p2k71rf/b6ns8btdB0uVdljWo9h0ovpnEe05ZKWceQGfXYr4KkzgKo3PBi8wdnd9OtNh46VpNIJynUn/3MKm1g==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@jest/test-result": "^24.8.0", + "@jest/types": "^24.8.0", + "@types/stack-utils": "^1.0.1", + "chalk": "^2.0.1", + "micromatch": "^3.1.10", + "slash": "^2.0.0", + "stack-utils": "^1.0.1" + } + }, + "jest-regex-util": { + "version": "24.3.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.3.0.tgz", + "integrity": "sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg==" + }, "jison": { "version": "0.4.18", "resolved": "https://registry.npmjs.org/jison/-/jison-0.4.18.tgz", @@ -311,6 +1029,11 @@ "nomnom": "1.5.2" } }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, "jsonlint": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.0.tgz", @@ -321,6 +1044,11 @@ "nomnom": ">= 1.5.x" } }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + }, "lex-parser": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/lex-parser/-/lex-parser-0.1.4.tgz", @@ -337,6 +1065,39 @@ "yallist": "^2.1.2" } }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "requires": { + "object-visit": "^1.0.0" + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -352,6 +1113,25 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -382,14 +1162,31 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "n3": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/n3/-/n3-1.0.4.tgz", "integrity": "sha512-iMHI7n3OsmMsUf6u9un6f8TCPgN1Zs6uKKcXrpTFUNXaswaOFk3H2/YuzuLE4T5Mhd+1haXAuufBFmsbRaULzw==" }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, "nomnom": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz", @@ -400,6 +1197,50 @@ "underscore": "1.1.x" } }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "requires": { + "isobject": "^3.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "requires": { + "isobject": "^3.0.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -415,6 +1256,11 @@ "integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=", "dev": true }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -427,6 +1273,11 @@ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" + }, "pre-commit": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/pre-commit/-/pre-commit-1.2.2.tgz", @@ -438,6 +1289,17 @@ "which": "1.2.x" } }, + "pretty-format": { + "version": "24.8.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.8.0.tgz", + "integrity": "sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw==", + "requires": { + "@jest/types": "^24.8.0", + "ansi-regex": "^4.0.0", + "ansi-styles": "^3.2.0", + "react-is": "^16.8.4" + } + }, "process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", @@ -458,6 +1320,11 @@ "@rdfjs/data-model": "^1.1.1" } }, + "react-is": { + "version": "16.8.6", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz", + "integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==" + }, "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", @@ -473,12 +1340,70 @@ "util-deprecate": "~1.0.1" } }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==" + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", "dev": true }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "requires": { + "ret": "~0.1.10" + } + }, + "set-value": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -494,6 +1419,121 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==" + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "source-map": { "version": "0.1.43", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", @@ -504,6 +1544,23 @@ "amdefine": ">=0.0.4" } }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" + }, "spawn-sync": { "version": "1.0.15", "resolved": "https://registry.npmjs.org/spawn-sync/-/spawn-sync-1.0.15.tgz", @@ -514,6 +1571,38 @@ "os-shim": "^0.1.2" } }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "stack-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", + "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==" + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", @@ -532,6 +1621,44 @@ "has-flag": "^2.0.0" } }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, "type-detect": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", @@ -550,6 +1677,63 @@ "integrity": "sha1-QLq4S60Z0jAJbo1u9ii/8FXYPbA=", "dev": true }, + "union-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" + } + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 45a1c071..2f89c345 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "A parser for the SPARQL query language", "author": "Ruben Verborgh ", "dependencies": { + "expect": "^24.8.0", "n3": "^1.0.4", "rdf-string": "^1.3.1" }, diff --git a/test/SparqlGenerator-test.js b/test/SparqlGenerator-test.js index 106c2d36..0d51f6d3 100644 --- a/test/SparqlGenerator-test.js +++ b/test/SparqlGenerator-test.js @@ -2,9 +2,12 @@ var SparqlGenerator = require('../sparql').Generator; var SparqlParser = require('../sparql').Parser; var fs = require('fs'), - expect = require('chai').expect, + expect = require('expect'), os = require('os'); +var toEqualParsedQuery = require("../test/matchers/toEqualParsedQuery"); +expect.extend({toEqualParsedQuery,}); + var queriesPath = __dirname + '/../queries/'; var parsedQueriesPath = __dirname + '/../test/parsedQueries/'; var unusedPrefixesPath = __dirname + '/../test/unusedPrefixes/'; @@ -26,7 +29,7 @@ describe('A SPARQL generator', function () { var genQuery = allPrefixesGenerator.stringify(parsedQuery); const parsed = new SparqlParser(null, null, null).parse(genQuery); - expect(objectsEqual(parsed, parsedQuery)).to.equal(true); + expect(parsed).toEqualParsedQuery(parsedQuery); }); }); @@ -44,7 +47,7 @@ describe('A SPARQL generator', function () { var expectedQuery = fs.readFileSync(generatedQueryFile, 'utf8') .split(os.EOL).join('\n'); var generatedQuery = defaultGenerator.stringify(parsedQuery); - expect(generatedQuery + '\n').to.be.equal(expectedQuery); + expect(generatedQuery + '\n').toEqual(expectedQuery); }); }); @@ -55,6 +58,6 @@ describe('A SPARQL generator', function () { var expectedQuery = 'PREFIX rdfs: \n' + 'SELECT * WHERE { ?s rdfs:label ?o. }'; - expect(generatedQuery).to.be.equal(expectedQuery); + expect(generatedQuery).toEqual(expectedQuery); }); }); diff --git a/test/SparqlParser-test.js b/test/SparqlParser-test.js index b3f2c914..ef5d9553 100644 --- a/test/SparqlParser-test.js +++ b/test/SparqlParser-test.js @@ -1,7 +1,12 @@ var SparqlParser = require('../sparql').Parser; -var fs = require('fs'), - expect = require('chai').expect; +var fs = require('fs'); + // expect = require('chai').expect; +var expect = require("expect"); +var toEqualParsedQuery = require("../test/matchers/toEqualParsedQuery"); +expect.extend({ + toEqualParsedQuery, +}); var queriesPath = __dirname + '/../queries/'; var parsedQueriesPath = __dirname + '/../test/parsedQueries/'; @@ -25,7 +30,7 @@ describe('A SPARQL parser', function () { query = fs.readFileSync(queriesPath + query + '.sparql', 'utf8'); const parsed = parser.parse(query); - expect(objectsEqual(parsed, parsedQuery)).to.equal(true); + expect(parsed).toEqualParsedQuery(parsedQuery); }); }); @@ -34,18 +39,18 @@ describe('A SPARQL parser', function () { try { parser.parse(query); } catch (e) { error = e; } - expect(error).to.exist; - expect(error).to.be.an.instanceof(Error); - expect(error.message).to.include('Parse error on line 1'); + expect(error).not.toBeUndefined(); + expect(error).toBeInstanceOf(Error); + expect(error.message).toContain('Parse error on line 1'); }); it('should preserve BGP and filter pattern order', function () { var parser = new SparqlParser(null, null, null); var query = 'SELECT * { ?s ?p "1" . FILTER(true) . ?s ?p "2" }'; var groups = parser.parse(query).where; - expect(groups[0].type).to.equal("bgp"); - expect(groups[1].type).to.equal("filter"); - expect(groups[2].type).to.equal("bgp"); + expect(groups[0].type).toBe("bgp"); + expect(groups[1].type).toBe("filter"); + expect(groups[2].type).toBe("bgp"); }); describe('with pre-defined prefixes', function () { @@ -56,21 +61,21 @@ describe('A SPARQL parser', function () { var query = 'SELECT * { a:a b:b "" }'; var result_json = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; - expect(objectsEqual(parser.parse(query).where[0].triples[0], parseJSON(result_json))); + expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result_json)); }); it('should allow temporarily overriding prefixes', function () { var query = 'PREFIX a: SELECT * { a:a b:b "" }'; var result = '{"subject":{"termType":"NamedNode","value":"ex:xyz#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; - expect(objectsEqual(parser.parse(query).where[0].triples[0], parseJSON(result))).to.equal(true); + expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result)); var query2 = 'SELECT * { a:a b:b "" }'; var result2 = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; - expect(objectsEqual(parser.parse(query2).where[0].triples[0], parseJSON(result2))).to.equal(true); + expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result)); }); it('should not change the original prefixes', function () { - expect(prefixes).to.deep.equal({ a: 'ex:abc#', b: 'ex:def#' }); + expect(prefixes).toEqual({ a: 'ex:abc#', b: 'ex:def#' }); }); it('should not take over changes to the original prefixes', function () { @@ -78,7 +83,7 @@ describe('A SPARQL parser', function () { var result = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; prefixes.a = 'ex:xyz#'; - expect(objectsEqual(parser.parse(query).where[0].triples[0], parseJSON(result))).to.equal(true); + expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result)); }); }); @@ -89,7 +94,7 @@ describe('A SPARQL parser', function () { var query = 'SELECT * { <> <#b> "" }'; var result = '{"subject":{"termType":"NamedNode","value":"http://ex.org/"},"predicate":{"termType":"NamedNode","value":"http://ex.org/#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; - expect(objectsEqual(parser.parse(query).where[0].triples[0], parseJSON(result))); + expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result)); }); }); @@ -98,9 +103,9 @@ describe('A SPARQL parser', function () { try { parser.parse(query); } catch (e) { error = e; } - expect(error).to.exist; - expect(error).to.be.an.instanceof(Error); - expect(error.message).to.include('Cannot resolve relative IRI a because no base IRI was set.'); + expect(error).not.toBeUndefined(); + expect(error).toBeInstanceOf(Error); + expect(error.message).toContain('Cannot resolve relative IRI a because no base IRI was set.'); }); describe('with group collapsing disabled', function () { @@ -110,14 +115,14 @@ describe('A SPARQL parser', function () { var query = 'SELECT * WHERE { { ?s ?p ?o } ?a ?b ?c }'; var result = '[{"type":"group","patterns":[{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"s"},"predicate":{"termType":"Variable","value":"p"},"object":{"termType":"Variable","value":"o"}}]}]},{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"a"},"predicate":{"termType":"Variable","value":"b"},"object":{"termType":"Variable","value":"c"}}]}]'; - expect(objectsEqual(parser.parse(query).where, parseJSON(result))).to.equal(true); + expect(parser.parse(query).where).toEqualParsedQuery(parseJSON(result)); }); it('should still collapse immediate union groups', function () { var query = 'SELECT * WHERE { { ?s ?p ?o } UNION { ?a ?b ?c } }'; var result = '[{"type":"union","patterns":[{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"s"},"predicate":{"termType":"Variable","value":"p"},"object":{"termType":"Variable","value":"o"}}]},{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"a"},"predicate":{"termType":"Variable","value":"b"},"object":{"termType":"Variable","value":"c"}}]}]}]'; - expect(objectsEqual(parser.parse(query).where, parseJSON(result))).to.equal(true); + expect(parser.parse(query).where).toEqualParsedQuery(parseJSON(result)); }); }); }); diff --git a/test/matchers/toEqualParsedQuery.js b/test/matchers/toEqualParsedQuery.js new file mode 100644 index 00000000..0d485656 --- /dev/null +++ b/test/matchers/toEqualParsedQuery.js @@ -0,0 +1,72 @@ +const diff = require('jest-diff'); +const N3 = require("n3"); + +function toEqualParsedQuery(received, expected) { + const options = { + comment: 'Object.is equality', + isNot: this.isNot, + promise: this.promise, + }; + + let message; + let pass; + + pass = objectsEqual(received, expected); + message = pass + ? () => + this.utils.matcherHint('toEqualParsedQuery', undefined, undefined, options) + + '\n\n' + + `Expected: ${this.utils.printExpected(expected)}\n` + + `Received: ${this.utils.printReceived(received)}` + : () => { + const diffString = diff(expected, received, { + expand: this.expand, + }); + return ( + this.utils.matcherHint('toEqualParsedQuery', undefined, undefined, options) + + '\n\n' + + (diffString && diffString.includes('- Expect') + ? `Difference:\n\n${diffString}` + : `Expected: ${this.utils.printExpected(expected)}\n` + + `Received: ${this.utils.printReceived(received)}`) + ); + }; + + + + return {actual: received, message, pass}; +} + + +// Test function which checks if object are equal, keeping into account how N3.DataFactory works +let objectsEqual = function (received, expected){ + if (isPrimitive(received) || received === undefined){ + return received === expected; + } + + if (received instanceof N3.DataFactory.internal.Term){ + return received.equals(expected); + } else if (expected instanceof N3.DataFactory.internal.Term){ + return expected.equals(received); + } else { + if (Array.isArray(received) && Array.isArray(expected)){ + if (received.length !== expected.length) return false; + for (let i = 0; i < received.length; i++){ + if (! objectsEqual(received[i], expected[i])) return false; + } + } else { + let keys_first = Object.keys(received); + + for (key of keys_first){ + if (! objectsEqual(received[key], expected[key])) return false; + } + } + return true; + } +}; + +function isPrimitive(value){ + return typeof value === "string" || typeof value === "number" || typeof value === "boolean"; +} + +module.exports = toEqualParsedQuery; diff --git a/test/test-setup.js b/test/test-setup.js index dfd03815..f87dc34a 100644 --- a/test/test-setup.js +++ b/test/test-setup.js @@ -1,5 +1,3 @@ -var N3 = require("n3"); - // Parses a JSON object, restoring `undefined` values global.parseJSON = function parseJSON(string) { var object = JSON.parse(string); @@ -17,36 +15,3 @@ function restoreUndefined(object) { } return object; } - - - -// Test function which checks if object are equal, keeping into account how N3.DataFactory works -global.objectsEqual = function (one, two){ - if (isPrimitive(one) || one === undefined){ - return one === two; - } - - if (one instanceof N3.DataFactory.internal.Term){ - return one.equals(two); - } else if (two instanceof N3.DataFactory.internal.Term){ - return two.equals(one); - } else { - if (Array.isArray(one) && Array.isArray(two)){ - if (one.length !== two.length) return false; - for (let i = 0; i < one.length; i++){ - if (! objectsEqual(one[i], two[i])) return false; - } - } else { - let keys_first = Object.keys(one); - - for (key of keys_first){ - if (! objectsEqual(one[key], two[key])) return false; - } - } - return true; - } -}; - -global.isPrimitive = function (value){ - return typeof value === "string" || typeof value === "number" || typeof value === "boolean"; -}; From 62f763fec165bc3f40289ab217c3e09097a47447 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Fri, 19 Jul 2019 10:32:10 +0200 Subject: [PATCH 27/46] Add BlankNode name prefixes support To avoid generating a blanknode name that already exists causing blanknodes to be mistaken for being the same --- lib/SparqlGenerator.js | 2 + lib/sparql.jison | 4 +- test/SparqlGenerator-test.js | 4 +- test/SparqlParser-test.js | 1 + test/matchers/toEqualParsedQuery.js | 1 - test/parsedQueries/blanks.json | 54 +++++----- test/parsedQueries/compact-bgp.json | 16 +-- test/parsedQueries/lists.json | 144 +++++++++++++------------- test/parsedQueries/sparql-16-2-1.json | 8 +- test/parsedQueries/sparql-16-2-3.json | 6 +- test/parsedQueries/sparql-9-2e.json | 8 +- test/parsedQueries/strlen.json | 2 +- 12 files changed, 127 insertions(+), 123 deletions(-) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index a981ed00..fd7e42a9 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -259,6 +259,8 @@ Generator.prototype.toExpression = function (expr) { // Converts the parsed entity (or property path) into a SPARQL entity Generator.prototype.toEntity = function (value) { if (isTerm(value)){ + // Take a copy to avoid altering the input + if (value.termType === "BlankNode") value = {termType: value.termType, value: value.value.substr(2)}; value = termToString(value); } // regular entity diff --git a/lib/sparql.jison b/lib/sparql.jison index bfd829f4..b214d9ba 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -158,9 +158,9 @@ // Creates a new blank node function blank(name) { if (typeof name === 'string') { - return Parser.factory.blankNode(name); + return Parser.factory.blankNode("e_" + name); } - return Parser.factory.blankNode(blankId++); + return Parser.factory.blankNode("g_" + blankId++); }; var blankId = 0; Parser._resetBlanks = function () { blankId = 0; } diff --git a/test/SparqlGenerator-test.js b/test/SparqlGenerator-test.js index 0d51f6d3..4c563f6f 100644 --- a/test/SparqlGenerator-test.js +++ b/test/SparqlGenerator-test.js @@ -25,7 +25,9 @@ describe('A SPARQL generator', function () { if (!fs.existsSync(parsedQueryFile)) return; it('should correctly generate query "' + query + '"', function () { - var parsedQuery = parseJSON(fs.readFileSync(parsedQueryFile, 'utf8')); + // In parsed query, replace "generated" prefixes with "existing" prefix because all blanknodes are named in the + // generated query. + var parsedQuery = parseJSON(fs.readFileSync(parsedQueryFile, 'utf8').replace(/g_/g, 'e_')); var genQuery = allPrefixesGenerator.stringify(parsedQuery); const parsed = new SparqlParser(null, null, null).parse(genQuery); diff --git a/test/SparqlParser-test.js b/test/SparqlParser-test.js index ef5d9553..f4c3371e 100644 --- a/test/SparqlParser-test.js +++ b/test/SparqlParser-test.js @@ -30,6 +30,7 @@ describe('A SPARQL parser', function () { query = fs.readFileSync(queriesPath + query + '.sparql', 'utf8'); const parsed = parser.parse(query); + // fs.writeFileSync(parsedQueryFile, JSON.stringify(parsed, null, " ")); expect(parsed).toEqualParsedQuery(parsedQuery); }); }); diff --git a/test/matchers/toEqualParsedQuery.js b/test/matchers/toEqualParsedQuery.js index 0d485656..d135bf1c 100644 --- a/test/matchers/toEqualParsedQuery.js +++ b/test/matchers/toEqualParsedQuery.js @@ -3,7 +3,6 @@ const N3 = require("n3"); function toEqualParsedQuery(received, expected) { const options = { - comment: 'Object.is equality', isNot: this.isNot, promise: this.promise, }; diff --git a/test/parsedQueries/blanks.json b/test/parsedQueries/blanks.json index 5f2f34cd..d9ad8f49 100644 --- a/test/parsedQueries/blanks.json +++ b/test/parsedQueries/blanks.json @@ -12,13 +12,13 @@ }, "object": { "termType": "BlankNode", - "value": "1" + "value": "g_1" } }, { "subject": { "termType": "BlankNode", - "value": "1" + "value": "g_1" }, "predicate": { "termType": "NamedNode", @@ -26,13 +26,13 @@ }, "object": { "termType": "BlankNode", - "value": "n3-0" + "value": "g_0" } }, { "subject": { "termType": "BlankNode", - "value": "n3-0" + "value": "g_0" }, "predicate": { "termType": "NamedNode", @@ -46,7 +46,7 @@ { "subject": { "termType": "BlankNode", - "value": "3" + "value": "g_3" }, "predicate": { "termType": "Variable", @@ -60,7 +60,7 @@ { "subject": { "termType": "BlankNode", - "value": "3" + "value": "g_3" }, "predicate": { "termType": "NamedNode", @@ -68,13 +68,13 @@ }, "object": { "termType": "BlankNode", - "value": "2" + "value": "g_2" } }, { "subject": { "termType": "BlankNode", - "value": "2" + "value": "g_2" }, "predicate": { "termType": "NamedNode", @@ -101,7 +101,7 @@ }, "object": { "termType": "BlankNode", - "value": "4" + "value": "g_4" } }, { @@ -149,7 +149,7 @@ { "subject": { "termType": "BlankNode", - "value": "5" + "value": "g_5" }, "predicate": { "termType": "Variable", @@ -171,13 +171,13 @@ }, "object": { "termType": "BlankNode", - "value": "6" + "value": "g_6" } }, { "subject": { "termType": "BlankNode", - "value": "6" + "value": "g_6" }, "predicate": { "termType": "NamedNode", @@ -199,13 +199,13 @@ }, "object": { "termType": "BlankNode", - "value": "7" + "value": "g_7" } }, { "subject": { "termType": "BlankNode", - "value": "7" + "value": "g_7" }, "predicate": { "termType": "NamedNode", @@ -219,7 +219,7 @@ { "subject": { "termType": "BlankNode", - "value": "7" + "value": "g_7" }, "predicate": { "termType": "NamedNode", @@ -233,7 +233,7 @@ { "subject": { "termType": "BlankNode", - "value": "7" + "value": "g_7" }, "predicate": { "termType": "NamedNode", @@ -255,13 +255,13 @@ }, "object": { "termType": "BlankNode", - "value": "9" + "value": "g_9" } }, { "subject": { "termType": "BlankNode", - "value": "9" + "value": "g_9" }, "predicate": { "termType": "NamedNode", @@ -269,13 +269,13 @@ }, "object": { "termType": "BlankNode", - "value": "8" + "value": "g_8" } }, { "subject": { "termType": "BlankNode", - "value": "8" + "value": "g_8" }, "predicate": { "termType": "NamedNode", @@ -289,7 +289,7 @@ { "subject": { "termType": "BlankNode", - "value": "11" + "value": "g_11" }, "predicate": { "termType": "Variable", @@ -303,7 +303,7 @@ { "subject": { "termType": "BlankNode", - "value": "11" + "value": "g_11" }, "predicate": { "termType": "NamedNode", @@ -311,13 +311,13 @@ }, "object": { "termType": "BlankNode", - "value": "10" + "value": "g_10" } }, { "subject": { "termType": "BlankNode", - "value": "10" + "value": "g_10" }, "predicate": { "termType": "NamedNode", @@ -331,7 +331,7 @@ { "subject": { "termType": "BlankNode", - "value": "12" + "value": "g_12" }, "predicate": { "termType": "NamedNode", @@ -345,7 +345,7 @@ { "subject": { "termType": "BlankNode", - "value": "12" + "value": "g_12" }, "predicate": { "termType": "NamedNode", @@ -359,7 +359,7 @@ { "subject": { "termType": "BlankNode", - "value": "12" + "value": "g_12" }, "predicate": { "termType": "NamedNode", diff --git a/test/parsedQueries/compact-bgp.json b/test/parsedQueries/compact-bgp.json index 193178ad..517132a9 100644 --- a/test/parsedQueries/compact-bgp.json +++ b/test/parsedQueries/compact-bgp.json @@ -46,13 +46,13 @@ }, "object": { "termType": "BlankNode", - "value": "1" + "value": "g_1" } }, { "subject": { "termType": "BlankNode", - "value": "1" + "value": "g_1" }, "predicate": { "termType": "NamedNode", @@ -66,7 +66,7 @@ { "subject": { "termType": "BlankNode", - "value": "1" + "value": "g_1" }, "predicate": { "termType": "NamedNode", @@ -74,13 +74,13 @@ }, "object": { "termType": "BlankNode", - "value": "n3-1" + "value": "g_0" } }, { "subject": { "termType": "BlankNode", - "value": "n3-1" + "value": "g_0" }, "predicate": { "termType": "NamedNode", @@ -94,7 +94,7 @@ { "subject": { "termType": "BlankNode", - "value": "n3-1" + "value": "g_0" }, "predicate": { "termType": "NamedNode", @@ -108,7 +108,7 @@ { "subject": { "termType": "BlankNode", - "value": "n3-1" + "value": "g_0" }, "predicate": { "termType": "NamedNode", @@ -122,7 +122,7 @@ { "subject": { "termType": "BlankNode", - "value": "1" + "value": "g_1" }, "predicate": { "termType": "NamedNode", diff --git a/test/parsedQueries/lists.json b/test/parsedQueries/lists.json index 3fcb444f..df832068 100644 --- a/test/parsedQueries/lists.json +++ b/test/parsedQueries/lists.json @@ -12,13 +12,13 @@ }, "object": { "termType": "BlankNode", - "value": "2" + "value": "g_2" } }, { "subject": { "termType": "BlankNode", - "value": "2" + "value": "g_2" }, "predicate": { "termType": "NamedNode", @@ -32,7 +32,7 @@ { "subject": { "termType": "BlankNode", - "value": "2" + "value": "g_2" }, "predicate": { "termType": "NamedNode", @@ -40,13 +40,13 @@ }, "object": { "termType": "BlankNode", - "value": "3" + "value": "g_3" } }, { "subject": { "termType": "BlankNode", - "value": "3" + "value": "g_3" }, "predicate": { "termType": "NamedNode", @@ -54,13 +54,13 @@ }, "object": { "termType": "BlankNode", - "value": "n3-2" + "value": "g_0" } }, { "subject": { "termType": "BlankNode", - "value": "3" + "value": "g_3" }, "predicate": { "termType": "NamedNode", @@ -74,7 +74,7 @@ { "subject": { "termType": "BlankNode", - "value": "n3-2" + "value": "g_0" }, "predicate": { "termType": "NamedNode", @@ -88,7 +88,7 @@ { "subject": { "termType": "BlankNode", - "value": "n3-2" + "value": "g_0" }, "predicate": { "termType": "NamedNode", @@ -96,13 +96,13 @@ }, "object": { "termType": "BlankNode", - "value": "1" + "value": "g_1" } }, { "subject": { "termType": "BlankNode", - "value": "1" + "value": "g_1" }, "predicate": { "termType": "NamedNode", @@ -116,7 +116,7 @@ { "subject": { "termType": "BlankNode", - "value": "1" + "value": "g_1" }, "predicate": { "termType": "NamedNode", @@ -130,7 +130,7 @@ { "subject": { "termType": "BlankNode", - "value": "6" + "value": "g_6" }, "predicate": { "termType": "Variable", @@ -144,7 +144,7 @@ { "subject": { "termType": "BlankNode", - "value": "6" + "value": "g_6" }, "predicate": { "termType": "NamedNode", @@ -158,7 +158,7 @@ { "subject": { "termType": "BlankNode", - "value": "6" + "value": "g_6" }, "predicate": { "termType": "NamedNode", @@ -166,13 +166,13 @@ }, "object": { "termType": "BlankNode", - "value": "7" + "value": "g_7" } }, { "subject": { "termType": "BlankNode", - "value": "7" + "value": "g_7" }, "predicate": { "termType": "NamedNode", @@ -180,13 +180,13 @@ }, "object": { "termType": "BlankNode", - "value": "4" + "value": "g_4" } }, { "subject": { "termType": "BlankNode", - "value": "7" + "value": "g_7" }, "predicate": { "termType": "NamedNode", @@ -200,7 +200,7 @@ { "subject": { "termType": "BlankNode", - "value": "4" + "value": "g_4" }, "predicate": { "termType": "NamedNode", @@ -214,7 +214,7 @@ { "subject": { "termType": "BlankNode", - "value": "4" + "value": "g_4" }, "predicate": { "termType": "NamedNode", @@ -222,13 +222,13 @@ }, "object": { "termType": "BlankNode", - "value": "5" + "value": "g_5" } }, { "subject": { "termType": "BlankNode", - "value": "5" + "value": "g_5" }, "predicate": { "termType": "NamedNode", @@ -242,7 +242,7 @@ { "subject": { "termType": "BlankNode", - "value": "5" + "value": "g_5" }, "predicate": { "termType": "NamedNode", @@ -311,13 +311,13 @@ }, "object": { "termType": "BlankNode", - "value": "8" + "value": "g_8" } }, { "subject": { "termType": "BlankNode", - "value": "8" + "value": "g_8" }, "predicate": { "termType": "NamedNode", @@ -331,7 +331,7 @@ { "subject": { "termType": "BlankNode", - "value": "8" + "value": "g_8" }, "predicate": { "termType": "NamedNode", @@ -353,13 +353,13 @@ }, "object": { "termType": "BlankNode", - "value": "9" + "value": "g_9" } }, { "subject": { "termType": "BlankNode", - "value": "9" + "value": "g_9" }, "predicate": { "termType": "NamedNode", @@ -373,7 +373,7 @@ { "subject": { "termType": "BlankNode", - "value": "9" + "value": "g_9" }, "predicate": { "termType": "NamedNode", @@ -381,13 +381,13 @@ }, "object": { "termType": "BlankNode", - "value": "10" + "value": "g_10" } }, { "subject": { "termType": "BlankNode", - "value": "10" + "value": "g_10" }, "predicate": { "termType": "NamedNode", @@ -401,7 +401,7 @@ { "subject": { "termType": "BlankNode", - "value": "10" + "value": "g_10" }, "predicate": { "termType": "NamedNode", @@ -409,13 +409,13 @@ }, "object": { "termType": "BlankNode", - "value": "11" + "value": "g_11" } }, { "subject": { "termType": "BlankNode", - "value": "11" + "value": "g_11" }, "predicate": { "termType": "NamedNode", @@ -429,7 +429,7 @@ { "subject": { "termType": "BlankNode", - "value": "11" + "value": "g_11" }, "predicate": { "termType": "NamedNode", @@ -451,13 +451,13 @@ }, "object": { "termType": "BlankNode", - "value": "14" + "value": "g_14" } }, { "subject": { "termType": "BlankNode", - "value": "14" + "value": "g_14" }, "predicate": { "termType": "NamedNode", @@ -471,7 +471,7 @@ { "subject": { "termType": "BlankNode", - "value": "14" + "value": "g_14" }, "predicate": { "termType": "NamedNode", @@ -479,13 +479,13 @@ }, "object": { "termType": "BlankNode", - "value": "15" + "value": "g_15" } }, { "subject": { "termType": "BlankNode", - "value": "15" + "value": "g_15" }, "predicate": { "termType": "NamedNode", @@ -493,13 +493,13 @@ }, "object": { "termType": "BlankNode", - "value": "12" + "value": "g_12" } }, { "subject": { "termType": "BlankNode", - "value": "15" + "value": "g_15" }, "predicate": { "termType": "NamedNode", @@ -513,7 +513,7 @@ { "subject": { "termType": "BlankNode", - "value": "12" + "value": "g_12" }, "predicate": { "termType": "NamedNode", @@ -527,7 +527,7 @@ { "subject": { "termType": "BlankNode", - "value": "12" + "value": "g_12" }, "predicate": { "termType": "NamedNode", @@ -535,13 +535,13 @@ }, "object": { "termType": "BlankNode", - "value": "13" + "value": "g_13" } }, { "subject": { "termType": "BlankNode", - "value": "13" + "value": "g_13" }, "predicate": { "termType": "NamedNode", @@ -555,7 +555,7 @@ { "subject": { "termType": "BlankNode", - "value": "13" + "value": "g_13" }, "predicate": { "termType": "NamedNode", @@ -569,7 +569,7 @@ { "subject": { "termType": "BlankNode", - "value": "18" + "value": "g_18" }, "predicate": { "termType": "Variable", @@ -583,7 +583,7 @@ { "subject": { "termType": "BlankNode", - "value": "18" + "value": "g_18" }, "predicate": { "termType": "NamedNode", @@ -597,7 +597,7 @@ { "subject": { "termType": "BlankNode", - "value": "18" + "value": "g_18" }, "predicate": { "termType": "NamedNode", @@ -605,13 +605,13 @@ }, "object": { "termType": "BlankNode", - "value": "19" + "value": "g_19" } }, { "subject": { "termType": "BlankNode", - "value": "19" + "value": "g_19" }, "predicate": { "termType": "NamedNode", @@ -619,13 +619,13 @@ }, "object": { "termType": "BlankNode", - "value": "16" + "value": "g_16" } }, { "subject": { "termType": "BlankNode", - "value": "19" + "value": "g_19" }, "predicate": { "termType": "NamedNode", @@ -639,7 +639,7 @@ { "subject": { "termType": "BlankNode", - "value": "16" + "value": "g_16" }, "predicate": { "termType": "NamedNode", @@ -653,7 +653,7 @@ { "subject": { "termType": "BlankNode", - "value": "16" + "value": "g_16" }, "predicate": { "termType": "NamedNode", @@ -661,13 +661,13 @@ }, "object": { "termType": "BlankNode", - "value": "17" + "value": "g_17" } }, { "subject": { "termType": "BlankNode", - "value": "17" + "value": "g_17" }, "predicate": { "termType": "NamedNode", @@ -681,7 +681,7 @@ { "subject": { "termType": "BlankNode", - "value": "17" + "value": "g_17" }, "predicate": { "termType": "NamedNode", @@ -695,7 +695,7 @@ { "subject": { "termType": "BlankNode", - "value": "20" + "value": "g_20" }, "predicate": { "termType": "NamedNode", @@ -709,7 +709,7 @@ { "subject": { "termType": "BlankNode", - "value": "20" + "value": "g_20" }, "predicate": { "termType": "NamedNode", @@ -717,13 +717,13 @@ }, "object": { "termType": "BlankNode", - "value": "21" + "value": "g_21" } }, { "subject": { "termType": "BlankNode", - "value": "21" + "value": "g_21" }, "predicate": { "termType": "NamedNode", @@ -737,7 +737,7 @@ { "subject": { "termType": "BlankNode", - "value": "21" + "value": "g_21" }, "predicate": { "termType": "NamedNode", @@ -759,13 +759,13 @@ }, "object": { "termType": "BlankNode", - "value": "23" + "value": "g_23" } }, { "subject": { "termType": "BlankNode", - "value": "23" + "value": "g_23" }, "predicate": { "termType": "NamedNode", @@ -773,13 +773,13 @@ }, "object": { "termType": "BlankNode", - "value": "22" + "value": "g_22" } }, { "subject": { "termType": "BlankNode", - "value": "23" + "value": "g_23" }, "predicate": { "termType": "NamedNode", @@ -793,7 +793,7 @@ { "subject": { "termType": "BlankNode", - "value": "22" + "value": "g_22" }, "predicate": { "termType": "NamedNode", @@ -807,7 +807,7 @@ { "subject": { "termType": "BlankNode", - "value": "22" + "value": "g_22" }, "predicate": { "termType": "NamedNode", @@ -821,7 +821,7 @@ { "subject": { "termType": "BlankNode", - "value": "22" + "value": "g_22" }, "predicate": { "termType": "NamedNode", diff --git a/test/parsedQueries/sparql-16-2-1.json b/test/parsedQueries/sparql-16-2-1.json index faa596e2..39bef203 100644 --- a/test/parsedQueries/sparql-16-2-1.json +++ b/test/parsedQueries/sparql-16-2-1.json @@ -12,13 +12,13 @@ }, "object": { "termType": "BlankNode", - "value": "v" + "value": "e_v" } }, { "subject": { "termType": "BlankNode", - "value": "v" + "value": "e_v" }, "predicate": { "termType": "NamedNode", @@ -32,7 +32,7 @@ { "subject": { "termType": "BlankNode", - "value": "v" + "value": "e_v" }, "predicate": { "termType": "NamedNode", @@ -137,4 +137,4 @@ "foaf": "http://xmlns.com/foaf/0.1/", "vcard": "http://www.w3.org/2001/vcard-rdf/3.0#" } -} +} \ No newline at end of file diff --git a/test/parsedQueries/sparql-16-2-3.json b/test/parsedQueries/sparql-16-2-3.json index 0123c4c3..f5b5fe17 100644 --- a/test/parsedQueries/sparql-16-2-3.json +++ b/test/parsedQueries/sparql-16-2-3.json @@ -4,7 +4,7 @@ { "subject": { "termType": "BlankNode", - "value": "n3-3" + "value": "g_0" }, "predicate": { "termType": "NamedNode", @@ -23,7 +23,7 @@ { "subject": { "termType": "BlankNode", - "value": "1" + "value": "g_1" }, "predicate": { "termType": "NamedNode", @@ -37,7 +37,7 @@ { "subject": { "termType": "BlankNode", - "value": "1" + "value": "g_1" }, "predicate": { "termType": "NamedNode", diff --git a/test/parsedQueries/sparql-9-2e.json b/test/parsedQueries/sparql-9-2e.json index 4a485754..00349140 100644 --- a/test/parsedQueries/sparql-9-2e.json +++ b/test/parsedQueries/sparql-9-2e.json @@ -39,13 +39,13 @@ }, "object": { "termType": "BlankNode", - "value": "1" + "value": "g_1" } }, { "subject": { "termType": "BlankNode", - "value": "1" + "value": "g_1" }, "predicate": { "termType": "NamedNode", @@ -53,13 +53,13 @@ }, "object": { "termType": "BlankNode", - "value": "n3-4" + "value": "g_0" } }, { "subject": { "termType": "BlankNode", - "value": "n3-4" + "value": "g_0" }, "predicate": { "termType": "NamedNode", diff --git a/test/parsedQueries/strlen.json b/test/parsedQueries/strlen.json index d9dd4210..60d72bd0 100644 --- a/test/parsedQueries/strlen.json +++ b/test/parsedQueries/strlen.json @@ -29,7 +29,7 @@ { "subject": { "termType": "BlankNode", - "value": "n3-5" + "value": "g_0" }, "predicate": { "termType": "Variable", From a99aa9758d14526e2d5906cbbc20625e0a82d639 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Fri, 19 Jul 2019 11:14:27 +0200 Subject: [PATCH 28/46] Drop Node 4 support. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f921cfac..b6b2a879 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,10 @@ language: node_js node_js: - - "4" - "6" - "8" - "10" + - "12" + - "lts/*" - "node" before_script: From 96105b735db588e2cd743b88861bb23fc4d8efc4 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Mon, 22 Jul 2019 09:37:37 +0200 Subject: [PATCH 29/46] Refrase comment for clarification --- test/SparqlGenerator-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/SparqlGenerator-test.js b/test/SparqlGenerator-test.js index 4c563f6f..4f96febc 100644 --- a/test/SparqlGenerator-test.js +++ b/test/SparqlGenerator-test.js @@ -25,8 +25,8 @@ describe('A SPARQL generator', function () { if (!fs.existsSync(parsedQueryFile)) return; it('should correctly generate query "' + query + '"', function () { - // In parsed query, replace "generated" prefixes with "existing" prefix because all blanknodes are named in the - // generated query. + // In parsed query, replace "generated" prefixes with "existing" prefix because all blanknodes in the + // generated query have explicit names. var parsedQuery = parseJSON(fs.readFileSync(parsedQueryFile, 'utf8').replace(/g_/g, 'e_')); var genQuery = allPrefixesGenerator.stringify(parsedQuery); From 14bbeb6f9fa73a508040c3a6646dc7e1037d9918 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Mon, 22 Jul 2019 13:21:01 +0200 Subject: [PATCH 30/46] Add e_ prefix only if not present --- lib/sparql.jison | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index b214d9ba..24d359d5 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -157,7 +157,8 @@ // Creates a new blank node function blank(name) { - if (typeof name === 'string') { + if (typeof name === 'string') { // Only use name if a name is given + if (name.startsWith("e_")) return Parser.factory.blankNode(name); return Parser.factory.blankNode("e_" + name); } return Parser.factory.blankNode("g_" + blankId++); From 9d207e4edaf34bdc2af7f3ed5c987a58792b852d Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 23 Jul 2019 11:17:19 +0200 Subject: [PATCH 31/46] Add comment --- lib/SparqlGenerator.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index fd7e42a9..6665df03 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -260,6 +260,7 @@ Generator.prototype.toExpression = function (expr) { Generator.prototype.toEntity = function (value) { if (isTerm(value)){ // Take a copy to avoid altering the input + // Remove prefix if (value.termType === "BlankNode") value = {termType: value.termType, value: value.value.substr(2)}; value = termToString(value); } From 28ed2a8f08315a428ca5caf42a3afbb146bc4ea2 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 23 Jul 2019 13:13:43 +0200 Subject: [PATCH 32/46] Code cleanup & refactoring --- lib/sparql.jison | 7 ++- test/SparqlGenerator-test.js | 4 +- test/SparqlParser-test.js | 82 +++++++++++++++++++++++++++--------- 3 files changed, 69 insertions(+), 24 deletions(-) diff --git a/lib/sparql.jison b/lib/sparql.jison index 24d359d5..16519090 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -138,7 +138,10 @@ // Creates a literal with the given value and type function createTypedLiteral(value, type) { - return Parser.factory.literal(value, Parser.factory.namedNode(type)); + if (type && type.termType !== "NamedNode"){ + type = Parser.factory.namedNode(type); + } + return Parser.factory.literal(value, type); } // Creates a literal with the given value and language @@ -813,7 +816,7 @@ GroupConcatSeparator Literal : String -> createTypedLiteral($1) | String LANGTAG -> createLangLiteral($1, lowercase($2.substr(1))) - | String '^^' iri -> createTypedLiteral($1, $3.value) + | String '^^' iri -> createTypedLiteral($1, $3) | INTEGER -> createTypedLiteral($1, XSD_INTEGER) | DECIMAL -> createTypedLiteral($1, XSD_DECIMAL) | DOUBLE -> createTypedLiteral(lowercase($1), XSD_DOUBLE) diff --git a/test/SparqlGenerator-test.js b/test/SparqlGenerator-test.js index 4f96febc..8ff9ce3e 100644 --- a/test/SparqlGenerator-test.js +++ b/test/SparqlGenerator-test.js @@ -30,7 +30,7 @@ describe('A SPARQL generator', function () { var parsedQuery = parseJSON(fs.readFileSync(parsedQueryFile, 'utf8').replace(/g_/g, 'e_')); var genQuery = allPrefixesGenerator.stringify(parsedQuery); - const parsed = new SparqlParser(null, null, null).parse(genQuery); + const parsed = new SparqlParser().parse(genQuery); expect(parsed).toEqualParsedQuery(parsedQuery); }); }); @@ -54,7 +54,7 @@ describe('A SPARQL generator', function () { }); it('should use inherited prefixes', function () { - var parser = new SparqlParser({rdfs: 'http://www.w3.org/2000/01/rdf-schema#'}, null, null); + var parser = new SparqlParser({rdfs: 'http://www.w3.org/2000/01/rdf-schema#'}); var parsedQuery = parser.parse('SELECT * WHERE { ?s rdfs:label ?o }'); var generatedQuery = defaultGenerator.stringify(parsedQuery); var expectedQuery = diff --git a/test/SparqlParser-test.js b/test/SparqlParser-test.js index f4c3371e..9d5c4cfa 100644 --- a/test/SparqlParser-test.js +++ b/test/SparqlParser-test.js @@ -1,7 +1,8 @@ var SparqlParser = require('../sparql').Parser; var fs = require('fs'); - // expect = require('chai').expect; +var DataFactory = require('n3').DataFactory; + var expect = require("expect"); var toEqualParsedQuery = require("../test/matchers/toEqualParsedQuery"); expect.extend({ @@ -12,7 +13,7 @@ var queriesPath = __dirname + '/../queries/'; var parsedQueriesPath = __dirname + '/../test/parsedQueries/'; describe('A SPARQL parser', function () { - var parser = new SparqlParser(null, null, null); + var parser = new SparqlParser(); // Ensure the same blank node identifiers are used in every test beforeEach(function () { parser._resetBlanks(); }); @@ -30,7 +31,6 @@ describe('A SPARQL parser', function () { query = fs.readFileSync(queriesPath + query + '.sparql', 'utf8'); const parsed = parser.parse(query); - // fs.writeFileSync(parsedQueryFile, JSON.stringify(parsed, null, " ")); expect(parsed).toEqualParsedQuery(parsedQuery); }); }); @@ -46,7 +46,7 @@ describe('A SPARQL parser', function () { }); it('should preserve BGP and filter pattern order', function () { - var parser = new SparqlParser(null, null, null); + var parser = new SparqlParser(); var query = 'SELECT * { ?s ?p "1" . FILTER(true) . ?s ?p "2" }'; var groups = parser.parse(query).where; expect(groups[0].type).toBe("bgp"); @@ -56,23 +56,31 @@ describe('A SPARQL parser', function () { describe('with pre-defined prefixes', function () { var prefixes = { a: 'ex:abc#', b: 'ex:def#' }; - var parser = new SparqlParser(prefixes, null, null); + var parser = new SparqlParser(prefixes); it('should use those prefixes', function () { var query = 'SELECT * { a:a b:b "" }'; - var result_json = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; + var result_json = {subject: DataFactory.namedNode('ex:abc#a'), + predicate: DataFactory.namedNode('ex:def#b'), + object: DataFactory.literal("")}; - expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result_json)); + expect(parser.parse(query).where[0].triples[0]).toEqual(result_json); }); it('should allow temporarily overriding prefixes', function () { var query = 'PREFIX a: SELECT * { a:a b:b "" }'; - var result = '{"subject":{"termType":"NamedNode","value":"ex:xyz#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; - expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result)); + var result = {subject: DataFactory.namedNode("ex:xyz#a"), + predicate:DataFactory.namedNode("ex:def#b"), + object: DataFactory.literal(""), + }; + expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(result); var query2 = 'SELECT * { a:a b:b "" }'; - var result2 = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; - expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result)); + var result2 = {subject: DataFactory.namedNode("ex:abc#a"), + predicate:DataFactory.namedNode("ex:def#b"), + object: DataFactory.literal(""), + }; + expect(parser.parse(query2).where[0].triples[0]).toEqualParsedQuery(result2); }); it('should not change the original prefixes', function () { @@ -81,21 +89,28 @@ describe('A SPARQL parser', function () { it('should not take over changes to the original prefixes', function () { var query = 'SELECT * { a:a b:b "" }'; - var result = '{"subject":{"termType":"NamedNode","value":"ex:abc#a"},"predicate":{"termType":"NamedNode","value":"ex:def#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; + var result = {subject: DataFactory.namedNode("ex:abc#a"), + predicate: DataFactory.namedNode("ex:def#b"), + object: DataFactory.literal("") + }; prefixes.a = 'ex:xyz#'; - expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result)); + expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(result); }); }); describe('with pre-defined base IRI', function () { - var parser = new SparqlParser(null, 'http://ex.org/', null); + var parser = new SparqlParser(null, 'http://ex.org/'); it('should use the base IRI', function () { var query = 'SELECT * { <> <#b> "" }'; - var result = '{"subject":{"termType":"NamedNode","value":"http://ex.org/"},"predicate":{"termType":"NamedNode","value":"http://ex.org/#b"},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; + var result = '{"subject":{"termType":"NamedNode","value":"http://ex.org/"},"predicate":{"termType":"NamedNode","value":""},"object":{"termType":"Literal","value":"","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#string"}}}'; + var result = {subject: DataFactory.namedNode("http://ex.org/"), + predicate: DataFactory.namedNode("http://ex.org/#b"), + object: DataFactory.literal("") + }; - expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(parseJSON(result)); + expect(parser.parse(query).where[0].triples[0]).toEqualParsedQuery(result); }); }); @@ -110,13 +125,40 @@ describe('A SPARQL parser', function () { }); describe('with group collapsing disabled', function () { - var parser = new SparqlParser(null, null, null); + var parser = new SparqlParser(); it('should keep explicit pattern group', function () { var query = 'SELECT * WHERE { { ?s ?p ?o } ?a ?b ?c }'; - var result = '[{"type":"group","patterns":[{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"s"},"predicate":{"termType":"Variable","value":"p"},"object":{"termType":"Variable","value":"o"}}]}]},{"type":"bgp","triples":[{"subject":{"termType":"Variable","value":"a"},"predicate":{"termType":"Variable","value":"b"},"object":{"termType":"Variable","value":"c"}}]}]'; - - expect(parser.parse(query).where).toEqualParsedQuery(parseJSON(result)); + var result = ',"object":{"termType":"Variable","value":"c"}}]}]'; + var result = [ + { + type: "group", + patterns: [ + { + type: "bgp", + triples: [ + { + subject: DataFactory.variable("s"), + predicate: DataFactory.variable("p"), + object: DataFactory.variable("o") + } + ] + } + ] + }, + { + type: "bgp", + triples: [ + { + subject: DataFactory.variable("a"), + predicate: DataFactory.variable("b"), + object: DataFactory.variable("c") + } + ] + } + ]; + + expect(parser.parse(query).where).toEqualParsedQuery(result); }); it('should still collapse immediate union groups', function () { From c976acee65b41b163b1c8640365e1c6bf7110c8b Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 23 Jul 2019 14:46:45 +0200 Subject: [PATCH 33/46] Replace termToString calls that had Variable as only input --- lib/SparqlGenerator.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index 6665df03..780b05eb 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -2,6 +2,7 @@ var XSD_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer'; var termToString = require("rdf-string").termToString; + function Generator(options, prefixes) { this._options = options = options || {}; @@ -36,7 +37,7 @@ Generator.prototype.toQuery = function (q) { if (q.variables){ query += mapJoin(q.variables, undefined, function (variable) { return isString(variable) || isTerm(variable) ? this.toEntity(variable) : - '(' + this.toExpression(variable.expression) + ' AS ' + termToString(variable.variable) + ')'; + '(' + this.toExpression(variable.expression) + ' AS ' + "?" + variable.variable.value + ')'; }, this) + ' '; } else if (q.template) @@ -54,7 +55,7 @@ Generator.prototype.toQuery = function (q) { if (q.group) query += 'GROUP BY ' + mapJoin(q.group, undefined, function (it) { var result = isString(it.expression) ? it.expression : '(' + this.toExpression(it.expression) + ')'; - return it.variable ? '(' + result + ' AS ' + termToString(it.variable) + ')' : result; + return it.variable ? '(' + result + ' AS ' + "?" + it.variable.value + ')' : result; }, this) + this._newline; if (q.having) query += 'HAVING (' + mapJoin(q.having, undefined, this.toExpression, this) + ')' + this._newline; @@ -159,7 +160,7 @@ Generator.prototype.filter = function (filter) { }; Generator.prototype.bind = function (bind) { - return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + termToString(bind.variable) + ')'; + return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + "?" + bind.variable.value + ')'; }; Generator.prototype.optional = function (optional) { From 89082d5afd2c6a94f5b60d89acd11bd46581e317 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 23 Jul 2019 15:11:52 +0200 Subject: [PATCH 34/46] Update tests --- test/unusedPrefixes/unused-prefixes-1.json | 18 +++++++++++++---- test/unusedPrefixes/unused-prefixes-2.json | 23 ++++++++++++++++++---- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/test/unusedPrefixes/unused-prefixes-1.json b/test/unusedPrefixes/unused-prefixes-1.json index 9ee81381..db9905eb 100644 --- a/test/unusedPrefixes/unused-prefixes-1.json +++ b/test/unusedPrefixes/unused-prefixes-1.json @@ -11,16 +11,26 @@ }, "queryType": "SELECT", "variables": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "http://example.org/book/book1", - "predicate": "http://purl.org/dc/elements/1.1/title", - "object": "?title" + "subject": { + "termType": "NamedNode", + "value": "http://example.org/book/book1" + },"predicate": { + "termType": "NamedNode", + "value": "http://purl.org/dc/elements/1.1/title" + }, "object": { + "termType": "Variable", + "value": "title" + } } ] } diff --git a/test/unusedPrefixes/unused-prefixes-2.json b/test/unusedPrefixes/unused-prefixes-2.json index 2ae128bb..3af75a2c 100644 --- a/test/unusedPrefixes/unused-prefixes-2.json +++ b/test/unusedPrefixes/unused-prefixes-2.json @@ -8,16 +8,31 @@ }, "queryType": "SELECT", "variables": [ - "?title" + { + "termType": "Variable", + "value": "title" + } ], "where": [ { "type": "bgp", "triples": [ { - "subject": "http://example.org/person/foo1/netWorth", - "predicate": "schema:value", - "object": "\"32\"^^http://www.w3.org/2001/XMLSchema#integer" + "subject": { + "termType": "NamedNode", + "value": "http://example.org/person/foo1/netWorth" + },"predicate": { + "termType": "NamedNode", + "value": "schema:value" + }, "object": { + "termType": "Literal", + "value": "32", + "language": "", + "datatype": { + "termType": "NamedNode", + "value": "http://www.w3.org/2001/XMLSchema#integer" + } + } } ] } From f510a385fab8c34726c4836c9ab1d99bf74d213c Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 23 Jul 2019 15:17:07 +0200 Subject: [PATCH 35/46] Refactor so only string input to toEntity is '*' --- lib/SparqlGenerator.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index 780b05eb..14ba84b6 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -2,7 +2,6 @@ var XSD_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer'; var termToString = require("rdf-string").termToString; - function Generator(options, prefixes) { this._options = options = options || {}; @@ -212,7 +211,7 @@ Generator.prototype.toExpression = function (expr) { case 'aggregate': return expr.aggregation.toUpperCase() + '(' + (expr.distinct ? 'DISTINCT ' : '') + this.toExpression(expr.expression) + - (expr.separator ? '; SEPARATOR = ' + this.toEntity('"' + expr.separator + '"') : '') + ')'; + (expr.separator ? '; SEPARATOR = ' + '"' + expr.separator.replace(escape, escapeReplacer) + '"' : '') + ')'; case 'functioncall': return this.toEntity(expr.function) + '(' + mapJoin(expr.args, ', ', this.toExpression, this) + ')'; case 'operation': @@ -259,14 +258,13 @@ Generator.prototype.toExpression = function (expr) { // Converts the parsed entity (or property path) into a SPARQL entity Generator.prototype.toEntity = function (value) { - if (isTerm(value)){ - // Take a copy to avoid altering the input - // Remove prefix + if (value === "*") return value; + + if (isTerm(value)) { + // Remove the prefix but with taking a copy to avoid altering the input if (value.termType === "BlankNode") value = {termType: value.termType, value: value.value.substr(2)}; value = termToString(value); - } - // regular entity - if (isString(value)) { + switch (value[0]) { // variable, * selector, or blank node case '?': From e02b294795b04582f66fe4cce15833e28d469484 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 23 Jul 2019 16:03:44 +0200 Subject: [PATCH 36/46] Refactor toEntity to manually to termToString work --- lib/SparqlGenerator.js | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index 14ba84b6..aa945dde 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -1,7 +1,5 @@ var XSD_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer'; -var termToString = require("rdf-string").termToString; - function Generator(options, prefixes) { this._options = options = options || {}; @@ -263,30 +261,29 @@ Generator.prototype.toEntity = function (value) { if (isTerm(value)) { // Remove the prefix but with taking a copy to avoid altering the input if (value.termType === "BlankNode") value = {termType: value.termType, value: value.value.substr(2)}; - value = termToString(value); - switch (value[0]) { + switch (value.termType) { // variable, * selector, or blank node - case '?': - case '$': - case '*': - case '_': - return value; + case 'Variable': + return "?" + value.value; + case "BlankNode": + return '_:' + value.value; // literal - case '"': - var match = value.match(/^"([^]*)"(?:(@.+)|\^\^(.+))?$/) || {}, - lexical = match[1] || '', language = match[2] || '', datatype = match[3]; - value = '"' + lexical.replace(escape, escapeReplacer) + '"' + language; - if (datatype) { - if (datatype === XSD_INTEGER && /^\d+$/.test(lexical)) + case "Literal": + var lexical = value.value || '', language = value.language || '', datatype = value.datatype; + value = '"' + lexical.replace(escape, escapeReplacer) + '"'; + if (language){ + value += '@' + language; + } else if (datatype) { + if (datatype.value === XSD_INTEGER && /^\d+$/.test(lexical)) // Add space to avoid confusion with decimals in broken parsers return lexical + ' '; - value += '^^' + this.encodeIRI(datatype); + value += '^^' + this.encodeIRI(datatype.value); } return value; // IRI default: - return this.encodeIRI(value); + return this.encodeIRI(value.value); } } // property path From ea36aa79185614b538e0aa63b2355064d165555b Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 23 Jul 2019 16:06:20 +0200 Subject: [PATCH 37/46] Remove rdf-string from dependencies --- package-lock.json | 29 ----------------------------- package.json | 3 +-- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 143d0b0b..d2e0487b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,14 +76,6 @@ "@types/yargs": "^12.0.9" } }, - "@rdfjs/data-model": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@rdfjs/data-model/-/data-model-1.1.1.tgz", - "integrity": "sha512-4jb1zc77f27u/MLVhpE/zHR1uvdH4XElXG63rJP/kVnvKoHtVfyJSEqN9oRLANgqHJ9SNwKj9FXeNFZ4+GGfiw==", - "requires": { - "@types/rdf-js": "^2.0.1" - } - }, "@types/istanbul-lib-coverage": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", @@ -106,19 +98,6 @@ "@types/istanbul-lib-report": "*" } }, - "@types/node": { - "version": "12.6.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.6.8.tgz", - "integrity": "sha512-aX+gFgA5GHcDi89KG5keey2zf0WfZk/HAQotEamsK2kbey+8yGKcson0hbK8E+v0NArlCJQCqMP161YhV6ZXLg==" - }, - "@types/rdf-js": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@types/rdf-js/-/rdf-js-2.0.2.tgz", - "integrity": "sha512-rHtC0mtRmMc9JzITesWhzmAXqfyJZhY8MygmmWZc3oWS5DPsGsKs+t3RXxGYlM4UKOqlD9Ki4owS1Cx/GPMeqw==", - "requires": { - "@types/node": "*" - } - }, "@types/stack-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", @@ -1312,14 +1291,6 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, - "rdf-string": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/rdf-string/-/rdf-string-1.3.1.tgz", - "integrity": "sha512-Pcw6aZRfto2cZodK5kSqFZW8mz6nfKLxSfjOSrTi5ajb2CSIwzqGx7UniysgKoV2i7tQL5dpPgCgY80upCiRUw==", - "requires": { - "@rdfjs/data-model": "^1.1.1" - } - }, "react-is": { "version": "16.8.6", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz", diff --git a/package.json b/package.json index 2f89c345..eda23136 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,7 @@ "author": "Ruben Verborgh ", "dependencies": { "expect": "^24.8.0", - "n3": "^1.0.4", - "rdf-string": "^1.3.1" + "n3": "^1.0.4" }, "keywords": [ "sparql", From 78f0ea3f836e813549f415ce39e10cb5baa65eef Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 23 Jul 2019 16:26:44 +0200 Subject: [PATCH 38/46] Replace isString with a more strict test where possible --- lib/SparqlGenerator.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index aa945dde..d3a3221b 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -33,7 +33,7 @@ Generator.prototype.toQuery = function (q) { if (q.variables){ query += mapJoin(q.variables, undefined, function (variable) { - return isString(variable) || isTerm(variable) ? this.toEntity(variable) : + return variable === "*" || isTerm(variable) ? this.toEntity(variable) : '(' + this.toExpression(variable.expression) + ' AS ' + "?" + variable.variable.value + ')'; }, this) + ' '; } @@ -202,7 +202,7 @@ Generator.prototype.service = function (service) { // Converts the parsed expression object into a SPARQL expression Generator.prototype.toExpression = function (expr) { - if (isString(expr) || isTerm(expr)) { + if (expr === "*" || isTerm(expr)) { return this.toEntity(expr); } switch (expr.type.toLowerCase()) { @@ -228,9 +228,9 @@ Generator.prototype.toExpression = function (expr) { case '-': case '*': case '/': - return (isString(args[0]) || isTerm(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + + return (args[0] === "*" || isTerm(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + ' ' + operator + ' ' + - (isString(args[1]) || isTerm(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); + (args[1] === "*" || isTerm(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); // Unary operators case '!': return '!(' + this.toExpression(args[0]) + ')'; From 42e274bd61d547d7c34f3ae06794c7fbbc0e8d85 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Wed, 24 Jul 2019 15:13:16 +0200 Subject: [PATCH 39/46] Move expect to devDependencies --- package-lock.json | 293 ++++++++++++++++++++++++++++++---------------- package.json | 3 +- 2 files changed, 193 insertions(+), 103 deletions(-) diff --git a/package-lock.json b/package-lock.json index d2e0487b..e7dc3cdd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "version": "7.5.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, "requires": { "@babel/highlight": "^7.0.0" } @@ -16,6 +17,7 @@ "version": "7.5.0", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "dev": true, "requires": { "chalk": "^2.0.0", "esutils": "^2.0.2", @@ -25,7 +27,8 @@ "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true } } }, @@ -33,6 +36,7 @@ "version": "24.7.1", "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.7.1.tgz", "integrity": "sha512-iNhtIy2M8bXlAOULWVTUxmnelTLFneTNEkHCgPmgd+zNwy9zVddJ6oS5rZ9iwoscNdT5mMwUd0C51v/fSlzItg==", + "dev": true, "requires": { "@jest/source-map": "^24.3.0", "chalk": "^2.0.1", @@ -43,6 +47,7 @@ "version": "24.3.0", "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-24.3.0.tgz", "integrity": "sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag==", + "dev": true, "requires": { "callsites": "^3.0.0", "graceful-fs": "^4.1.15", @@ -52,7 +57,8 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, @@ -60,6 +66,7 @@ "version": "24.8.0", "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.8.0.tgz", "integrity": "sha512-+YdLlxwizlfqkFDh7Mc7ONPQAhA4YylU1s529vVM1rsf67vGZH/2GGm5uO8QzPeVyaVMobCQ7FTxl38QrKRlng==", + "dev": true, "requires": { "@jest/console": "^24.7.1", "@jest/types": "^24.8.0", @@ -70,6 +77,7 @@ "version": "24.8.0", "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.8.0.tgz", "integrity": "sha512-g17UxVr2YfBtaMUxn9u/4+siG1ptg9IGYAYwvpwn61nBg779RXnjE/m7CxYcIzEt0AbHZZAHSEZNhkE2WxURVg==", + "dev": true, "requires": { "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^1.1.1", @@ -79,12 +87,14 @@ "@types/istanbul-lib-coverage": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", - "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==" + "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==", + "dev": true }, "@types/istanbul-lib-report": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz", "integrity": "sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg==", + "dev": true, "requires": { "@types/istanbul-lib-coverage": "*" } @@ -93,6 +103,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz", "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==", + "dev": true, "requires": { "@types/istanbul-lib-coverage": "*", "@types/istanbul-lib-report": "*" @@ -101,12 +112,14 @@ "@types/stack-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", - "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==" + "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==", + "dev": true }, "@types/yargs": { "version": "12.0.12", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-12.0.12.tgz", - "integrity": "sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw==" + "integrity": "sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw==", + "dev": true }, "JSONSelect": { "version": "0.4.0", @@ -130,12 +143,14 @@ "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, "requires": { "color-convert": "^1.9.0" } @@ -143,38 +158,38 @@ "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true }, "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true }, "arr-union": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true }, "array-unique": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" - }, - "assertion-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", - "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true }, "balanced-match": { "version": "1.0.0", @@ -186,6 +201,7 @@ "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, "requires": { "cache-base": "^1.0.1", "class-utils": "^0.3.5", @@ -200,6 +216,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, "requires": { "is-descriptor": "^1.0.0" } @@ -208,6 +225,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, "requires": { "kind-of": "^6.0.0" } @@ -216,6 +234,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, "requires": { "kind-of": "^6.0.0" } @@ -224,6 +243,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", @@ -246,6 +266,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, "requires": { "arr-flatten": "^1.1.0", "array-unique": "^0.3.2", @@ -263,6 +284,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "requires": { "is-extendable": "^0.1.0" } @@ -279,6 +301,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, "requires": { "collection-visit": "^1.0.0", "component-emitter": "^1.2.1", @@ -294,26 +317,14 @@ "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" - }, - "chai": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", - "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", - "dev": true, - "requires": { - "assertion-error": "^1.0.1", - "check-error": "^1.0.1", - "deep-eql": "^3.0.0", - "get-func-name": "^2.0.0", - "pathval": "^1.0.0", - "type-detect": "^4.0.0" - } + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, "requires": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -323,24 +334,20 @@ "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, "requires": { "has-flag": "^3.0.0" } } } }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, "cjson": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/cjson/-/cjson-0.3.0.tgz", @@ -354,6 +361,7 @@ "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, "requires": { "arr-union": "^3.1.0", "define-property": "^0.2.5", @@ -365,6 +373,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "requires": { "is-descriptor": "^0.1.0" } @@ -375,6 +384,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, "requires": { "map-visit": "^1.0.0", "object-visit": "^1.0.0" @@ -384,6 +394,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, "requires": { "color-name": "1.1.3" } @@ -391,7 +402,8 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true }, "colors": { "version": "0.5.1", @@ -408,7 +420,8 @@ "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true }, "concat-map": { "version": "0.0.1", @@ -430,7 +443,8 @@ "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -461,21 +475,14 @@ "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" - }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true }, "define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, "requires": { "is-descriptor": "^1.0.2", "isobject": "^3.0.1" @@ -485,6 +492,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, "requires": { "kind-of": "^6.0.0" } @@ -493,6 +501,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, "requires": { "kind-of": "^6.0.0" } @@ -501,6 +510,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", @@ -518,7 +528,8 @@ "diff-sequences": { "version": "24.3.0", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.3.0.tgz", - "integrity": "sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw==" + "integrity": "sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw==", + "dev": true }, "ebnf-parser": { "version": "0.1.10", @@ -529,7 +540,8 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true }, "escodegen": { "version": "1.3.3", @@ -565,6 +577,7 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, "requires": { "debug": "^2.3.3", "define-property": "^0.2.5", @@ -579,6 +592,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -587,6 +601,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "requires": { "is-descriptor": "^0.1.0" } @@ -595,6 +610,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "requires": { "is-extendable": "^0.1.0" } @@ -605,6 +621,7 @@ "version": "24.8.0", "resolved": "https://registry.npmjs.org/expect/-/expect-24.8.0.tgz", "integrity": "sha512-/zYvP8iMDrzaaxHVa724eJBCKqSHmO0FA7EDkBiRHxg6OipmMn1fN+C8T9L9K8yr7UONkOifu6+LLH+z76CnaA==", + "dev": true, "requires": { "@jest/types": "^24.8.0", "ansi-styles": "^3.2.0", @@ -618,6 +635,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, "requires": { "assign-symbols": "^1.0.0", "is-extendable": "^1.0.1" @@ -627,6 +645,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, "requires": { "is-plain-object": "^2.0.4" } @@ -637,6 +656,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, "requires": { "array-unique": "^0.3.2", "define-property": "^1.0.0", @@ -652,6 +672,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, "requires": { "is-descriptor": "^1.0.0" } @@ -660,6 +681,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "requires": { "is-extendable": "^0.1.0" } @@ -668,6 +690,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, "requires": { "kind-of": "^6.0.0" } @@ -676,6 +699,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, "requires": { "kind-of": "^6.0.0" } @@ -684,6 +708,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", @@ -696,6 +721,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, "requires": { "extend-shallow": "^2.0.1", "is-number": "^3.0.0", @@ -707,6 +733,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "requires": { "is-extendable": "^0.1.0" } @@ -716,12 +743,14 @@ "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, "requires": { "map-cache": "^0.2.2" } @@ -732,16 +761,11 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true }, "glob": { "version": "7.1.2", @@ -760,7 +784,8 @@ "graceful-fs": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", - "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==" + "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", + "dev": true }, "growl": { "version": "1.10.3", @@ -778,6 +803,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, "requires": { "get-value": "^2.0.6", "has-values": "^1.0.0", @@ -788,6 +814,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, "requires": { "is-number": "^3.0.0", "kind-of": "^4.0.0" @@ -797,6 +824,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, "requires": { "is-buffer": "^1.1.5" } @@ -829,6 +857,7 @@ "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, "requires": { "kind-of": "^3.0.2" }, @@ -837,6 +866,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "requires": { "is-buffer": "^1.1.5" } @@ -846,12 +876,14 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, "requires": { "kind-of": "^3.0.2" }, @@ -860,6 +892,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "requires": { "is-buffer": "^1.1.5" } @@ -870,6 +903,7 @@ "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, "requires": { "is-accessor-descriptor": "^0.1.6", "is-data-descriptor": "^0.1.4", @@ -879,19 +913,22 @@ "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true } } }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, "requires": { "kind-of": "^3.0.2" }, @@ -900,6 +937,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "requires": { "is-buffer": "^1.1.5" } @@ -910,6 +948,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, "requires": { "isobject": "^3.0.1" } @@ -917,12 +956,14 @@ "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true }, "isexe": { "version": "2.0.0", @@ -933,12 +974,14 @@ "isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true }, "jest-diff": { "version": "24.8.0", "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.8.0.tgz", "integrity": "sha512-wxetCEl49zUpJ/bvUmIFjd/o52J+yWcoc5ZyPq4/W1LUKGEhRYDIbP1KcF6t+PvqNrGAFk4/JhtxDq/Nnzs66g==", + "dev": true, "requires": { "chalk": "^2.0.1", "diff-sequences": "^24.3.0", @@ -949,12 +992,14 @@ "jest-get-type": { "version": "24.8.0", "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.8.0.tgz", - "integrity": "sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ==" + "integrity": "sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ==", + "dev": true }, "jest-matcher-utils": { "version": "24.8.0", "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.8.0.tgz", "integrity": "sha512-lex1yASY51FvUuHgm0GOVj7DCYEouWSlIYmCW7APSqB9v8mXmKSn5+sWVF0MhuASG0bnYY106/49JU1FZNl5hw==", + "dev": true, "requires": { "chalk": "^2.0.1", "jest-diff": "^24.8.0", @@ -966,6 +1011,7 @@ "version": "24.8.0", "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.8.0.tgz", "integrity": "sha512-p2k71rf/b6ns8btdB0uVdljWo9h0ovpnEe05ZKWceQGfXYr4KkzgKo3PBi8wdnd9OtNh46VpNIJynUn/3MKm1g==", + "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "@jest/test-result": "^24.8.0", @@ -980,7 +1026,8 @@ "jest-regex-util": { "version": "24.3.0", "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.3.0.tgz", - "integrity": "sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg==" + "integrity": "sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg==", + "dev": true }, "jison": { "version": "0.4.18", @@ -1011,7 +1058,8 @@ "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, "jsonlint": { "version": "1.6.0", @@ -1026,7 +1074,8 @@ "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true }, "lex-parser": { "version": "0.1.4", @@ -1047,12 +1096,14 @@ "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, "requires": { "object-visit": "^1.0.0" } @@ -1061,6 +1112,7 @@ "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", @@ -1096,6 +1148,7 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "dev": true, "requires": { "for-in": "^1.0.2", "is-extendable": "^1.0.1" @@ -1105,6 +1158,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, "requires": { "is-plain-object": "^2.0.4" } @@ -1141,7 +1195,8 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true }, "n3": { "version": "1.0.4", @@ -1152,6 +1207,7 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", @@ -1180,6 +1236,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, "requires": { "copy-descriptor": "^0.1.0", "define-property": "^0.2.5", @@ -1190,6 +1247,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "requires": { "is-descriptor": "^0.1.0" } @@ -1198,6 +1256,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "requires": { "is-buffer": "^1.1.5" } @@ -1208,6 +1267,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, "requires": { "isobject": "^3.0.0" } @@ -1216,6 +1276,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, "requires": { "isobject": "^3.0.1" } @@ -1238,7 +1299,8 @@ "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true }, "path-is-absolute": { "version": "1.0.1", @@ -1246,16 +1308,11 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", - "dev": true - }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true }, "pre-commit": { "version": "1.2.2", @@ -1272,6 +1329,7 @@ "version": "24.8.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.8.0.tgz", "integrity": "sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw==", + "dev": true, "requires": { "@jest/types": "^24.8.0", "ansi-regex": "^4.0.0", @@ -1294,7 +1352,8 @@ "react-is": { "version": "16.8.6", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz", - "integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==" + "integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==", + "dev": true }, "readable-stream": { "version": "2.3.3", @@ -1315,6 +1374,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, "requires": { "extend-shallow": "^3.0.2", "safe-regex": "^1.1.0" @@ -1323,22 +1383,26 @@ "repeat-element": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", - "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==" + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true }, "repeat-string": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true }, "safe-buffer": { "version": "5.1.1", @@ -1350,6 +1414,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, "requires": { "ret": "~0.1.10" } @@ -1358,6 +1423,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "dev": true, "requires": { "extend-shallow": "^2.0.1", "is-extendable": "^0.1.1", @@ -1369,6 +1435,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "requires": { "is-extendable": "^0.1.0" } @@ -1393,12 +1460,14 @@ "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==" + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, "requires": { "base": "^0.11.1", "debug": "^2.2.0", @@ -1414,6 +1483,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -1422,6 +1492,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "requires": { "is-descriptor": "^0.1.0" } @@ -1430,6 +1501,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "requires": { "is-extendable": "^0.1.0" } @@ -1437,7 +1509,8 @@ "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true } } }, @@ -1445,6 +1518,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, "requires": { "define-property": "^1.0.0", "isobject": "^3.0.0", @@ -1455,6 +1529,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, "requires": { "is-descriptor": "^1.0.0" } @@ -1463,6 +1538,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, "requires": { "kind-of": "^6.0.0" } @@ -1471,6 +1547,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, "requires": { "kind-of": "^6.0.0" } @@ -1479,6 +1556,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", @@ -1491,6 +1569,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, "requires": { "kind-of": "^3.2.0" }, @@ -1499,6 +1578,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "requires": { "is-buffer": "^1.1.5" } @@ -1519,6 +1599,7 @@ "version": "0.5.2", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, "requires": { "atob": "^2.1.1", "decode-uri-component": "^0.2.0", @@ -1530,7 +1611,8 @@ "source-map-url": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true }, "spawn-sync": { "version": "1.0.15", @@ -1546,6 +1628,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, "requires": { "extend-shallow": "^3.0.0" } @@ -1553,12 +1636,14 @@ "stack-utils": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", - "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==" + "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", + "dev": true }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, "requires": { "define-property": "^0.2.5", "object-copy": "^0.1.0" @@ -1568,6 +1653,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "requires": { "is-descriptor": "^0.1.0" } @@ -1596,6 +1682,7 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, "requires": { "kind-of": "^3.0.2" }, @@ -1604,6 +1691,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "requires": { "is-buffer": "^1.1.5" } @@ -1614,6 +1702,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, "requires": { "define-property": "^2.0.2", "extend-shallow": "^3.0.2", @@ -1625,17 +1714,12 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, "requires": { "is-number": "^3.0.0", "repeat-string": "^1.6.1" } }, - "type-detect": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", - "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", - "dev": true - }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -1652,6 +1736,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "dev": true, "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", @@ -1663,6 +1748,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, "requires": { "has-value": "^0.3.1", "isobject": "^3.0.0" @@ -1672,6 +1758,7 @@ "version": "0.3.1", "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, "requires": { "get-value": "^2.0.3", "has-values": "^0.1.4", @@ -1682,6 +1769,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, "requires": { "isarray": "1.0.0" } @@ -1691,19 +1779,22 @@ "has-values": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true } } }, "urix": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", - "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true }, "util-deprecate": { "version": "1.0.2", diff --git a/package.json b/package.json index eda23136..f1e7c800 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "A parser for the SPARQL query language", "author": "Ruben Verborgh ", "dependencies": { - "expect": "^24.8.0", "n3": "^1.0.4" }, "keywords": [ @@ -36,9 +35,9 @@ "node": ">=8.0" }, "devDependencies": { + "expect": "^24.8.0", "jison": "0.4.18", "mocha": "4.1.x", - "chai": "4.1.x", "pre-commit": "~1.2.2" }, "browser": { From 791ee6d9917441d763128bfb4b1775987c303fce Mon Sep 17 00:00:00 2001 From: sivbraec Date: Sat, 27 Jul 2019 13:31:54 +0200 Subject: [PATCH 40/46] Use regex instead of substr to remove prefix --- lib/SparqlGenerator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index d3a3221b..d08fdfd9 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -260,7 +260,7 @@ Generator.prototype.toEntity = function (value) { if (isTerm(value)) { // Remove the prefix but with taking a copy to avoid altering the input - if (value.termType === "BlankNode") value = {termType: value.termType, value: value.value.substr(2)}; + if (value.termType === "BlankNode") value = {termType: value.termType, value: value.value.replace(/^e_|^g_/, '')}; switch (value.termType) { // variable, * selector, or blank node From 219eec79eb5032702556431dde9feedd18067745 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 30 Jul 2019 11:11:34 +0200 Subject: [PATCH 41/46] Make matcher more strict --- lib/Wildcard.js | 0 test/matchers/toEqualParsedQuery.js | 8 +++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 lib/Wildcard.js diff --git a/lib/Wildcard.js b/lib/Wildcard.js new file mode 100644 index 00000000..e69de29b diff --git a/test/matchers/toEqualParsedQuery.js b/test/matchers/toEqualParsedQuery.js index d135bf1c..b56029f1 100644 --- a/test/matchers/toEqualParsedQuery.js +++ b/test/matchers/toEqualParsedQuery.js @@ -48,15 +48,17 @@ let objectsEqual = function (received, expected){ } else if (expected instanceof N3.DataFactory.internal.Term){ return expected.equals(received); } else { - if (Array.isArray(received) && Array.isArray(expected)){ + if (Array.isArray(received)){ + if (! Array.isArray(expected)) return false; if (received.length !== expected.length) return false; for (let i = 0; i < received.length; i++){ if (! objectsEqual(received[i], expected[i])) return false; } - } else { + } else { // received == object + if (isPrimitive(expected) || Array.isArray(expected)) return false; let keys_first = Object.keys(received); - for (key of keys_first){ + for (let key of keys_first){ if (! objectsEqual(received[key], expected[key])) return false; } } From 0028d282382408605ecdb4d11a578812887f3a1b Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 30 Jul 2019 11:17:41 +0200 Subject: [PATCH 42/46] Add Wildcard to parser --- lib/Wildcard.js | 22 ++++++++++++++++++++++ lib/sparql.jison | 8 +++++--- test/parsedQueries/all.json | 4 +++- test/parsedQueries/compact-bgp.json | 4 +++- test/parsedQueries/empty-values.json | 4 +++- test/parsedQueries/in.json | 4 +++- test/parsedQueries/negate-and.json | 4 +++- test/parsedQueries/optional-subquery.json | 8 ++++++-- test/parsedQueries/or.json | 4 +++- test/parsedQueries/order-operator.json | 4 +++- test/parsedQueries/sparql-8-3-1a.json | 4 +++- test/parsedQueries/sparql-8-3-1b.json | 4 +++- test/parsedQueries/sparql-8-3-2a.json | 4 +++- test/parsedQueries/sparql-8-3-2b.json | 4 +++- test/parsedQueries/sparql-8-3-3a.json | 4 +++- test/parsedQueries/sparql-8-3-3b.json | 4 +++- test/parsedQueries/sparql-9-2a.json | 4 +++- test/parsedQueries/sparql-9-2b.json | 4 +++- test/parsedQueries/sparql-9-2c.json | 4 +++- test/parsedQueries/sparql-9-2d.json | 4 +++- test/parsedQueries/sparql-9-2g.json | 4 +++- test/parsedQueries/sparql-9-2h.json | 4 +++- test/parsedQueries/sparql-9-2i.json | 4 +++- test/parsedQueries/sparql-9-2j.json | 4 +++- test/parsedQueries/sparql-9-2k.json | 4 +++- test/parsedQueries/sparql-9-2l.json | 4 +++- test/parsedQueries/sparql-9-2m.json | 4 +++- test/parsedQueries/sparql-9-2n.json | 4 +++- test/parsedQueries/sparql-9-2o.json | 4 +++- test/parsedQueries/sparql-9-2p.json | 4 +++- test/parsedQueries/sparql-9-2q.json | 4 +++- test/parsedQueries/sparql-9-2r.json | 4 +++- test/parsedQueries/sparql-9-3a.json | 4 +++- test/parsedQueries/sparql-9-3b.json | 4 +++- test/parsedQueries/sparql-fed-2-4c.json | 4 +++- test/parsedQueries/sub-values.json | 4 +++- test/parsedQueries/sum-count.json | 4 +++- 37 files changed, 135 insertions(+), 39 deletions(-) diff --git a/lib/Wildcard.js b/lib/Wildcard.js index e69de29b..72dbc0e8 100644 --- a/lib/Wildcard.js +++ b/lib/Wildcard.js @@ -0,0 +1,22 @@ +var Term = require('n3').DataFactory.internal.Term; + +// Wildcard constructor +class Wildcard extends Term{ + constructor() { + super(''); + return WILDCARD || this; + } + + get termType() { + return 'Wildcard'; + } + + equals(other) { + return (other && (this.termType === other.termType)); + } +} + +// Wildcard singleton +var WILDCARD = new Wildcard(); + +module.exports.Wildcard = Wildcard; diff --git a/lib/sparql.jison b/lib/sparql.jison index 16519090..acba80f4 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -3,6 +3,8 @@ SPARQL parser in the Jison parser generator format. */ + var Wildcard = require('./Wildcard.js').Wildcard; + // Common namespaces and entities var RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', RDF_TYPE = RDF + 'type', @@ -99,7 +101,7 @@ // Creates an expression with the given type and attributes function expression(expr, attr) { - var expression = { expression: expr }; + var expression = { expression: expr === '*'? new Wildcard() : expr }; if (attr) for (var a in attr) expression[a] = attr[a]; @@ -472,7 +474,7 @@ SubSelect : SelectClause WhereClause SolutionModifier ValuesClause? -> extend($1, $2, $3, $4, { type: 'query' }) ; SelectClause - : 'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( SelectClauseItem+ | '*' ) -> extend({ queryType: 'SELECT', variables: $3 === '*' ? ['*'] : $3 }, $2 && ($1 = lowercase($2), $2 = {}, $2[$1] = true, $2)) + : 'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( SelectClauseItem+ | '*' ) -> extend({ queryType: 'SELECT', variables: $3 === '*' ? [new Wildcard()] : $3 }, $2 && ($1 = lowercase($2), $2 = {}, $2[$1] = true, $2)) ; SelectClauseItem : VAR -> toVar($1) @@ -483,7 +485,7 @@ ConstructQuery | 'CONSTRUCT' DatasetClause* 'WHERE' '{' TriplesTemplate? '}' SolutionModifier -> extend({ queryType: 'CONSTRUCT', template: $5 = ($5 ? $5.triples : []) }, groupDatasets($2), { where: [ { type: 'bgp', triples: appendAllTo([], $5) } ] }, $7) ; DescribeQuery - : 'DESCRIBE' ( (VAR | iri)+ | '*' ) DatasetClause* WhereClause? SolutionModifier -> extend({ queryType: 'DESCRIBE', variables: $2 === '*' ? ['*'] : $2.map(toVar) }, groupDatasets($3), $4, $5) + : 'DESCRIBE' ( (VAR | iri)+ | '*' ) DatasetClause* WhereClause? SolutionModifier -> extend({ queryType: 'DESCRIBE', variables: $2 === '*' ? [new Wildcard()] : $2.map(toVar) }, groupDatasets($3), $4, $5) ; AskQuery : 'ASK' DatasetClause* WhereClause SolutionModifier -> extend({ queryType: 'ASK' }, groupDatasets($2), $3, $4) diff --git a/test/parsedQueries/all.json b/test/parsedQueries/all.json index d3958464..f8eda069 100644 --- a/test/parsedQueries/all.json +++ b/test/parsedQueries/all.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/compact-bgp.json b/test/parsedQueries/compact-bgp.json index 517132a9..258710e2 100644 --- a/test/parsedQueries/compact-bgp.json +++ b/test/parsedQueries/compact-bgp.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/empty-values.json b/test/parsedQueries/empty-values.json index 6380ffa4..72888714 100644 --- a/test/parsedQueries/empty-values.json +++ b/test/parsedQueries/empty-values.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/in.json b/test/parsedQueries/in.json index e319f778..8810d5d7 100644 --- a/test/parsedQueries/in.json +++ b/test/parsedQueries/in.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/negate-and.json b/test/parsedQueries/negate-and.json index d1adc5d7..77bdb4a3 100644 --- a/test/parsedQueries/negate-and.json +++ b/test/parsedQueries/negate-and.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/optional-subquery.json b/test/parsedQueries/optional-subquery.json index d7b1f88b..b1dc2c7a 100644 --- a/test/parsedQueries/optional-subquery.json +++ b/test/parsedQueries/optional-subquery.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { @@ -14,7 +16,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/or.json b/test/parsedQueries/or.json index b38ae430..0e590159 100644 --- a/test/parsedQueries/or.json +++ b/test/parsedQueries/or.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/order-operator.json b/test/parsedQueries/order-operator.json index b2270cb6..bbaaa212 100644 --- a/test/parsedQueries/order-operator.json +++ b/test/parsedQueries/order-operator.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-8-3-1a.json b/test/parsedQueries/sparql-8-3-1a.json index 730514f3..4eb236f2 100644 --- a/test/parsedQueries/sparql-8-3-1a.json +++ b/test/parsedQueries/sparql-8-3-1a.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-8-3-1b.json b/test/parsedQueries/sparql-8-3-1b.json index 87e74ae4..927a8ed7 100644 --- a/test/parsedQueries/sparql-8-3-1b.json +++ b/test/parsedQueries/sparql-8-3-1b.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-8-3-2a.json b/test/parsedQueries/sparql-8-3-2a.json index e30677ca..a06a36fb 100644 --- a/test/parsedQueries/sparql-8-3-2a.json +++ b/test/parsedQueries/sparql-8-3-2a.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-8-3-2b.json b/test/parsedQueries/sparql-8-3-2b.json index beec5d4d..e57e9c57 100644 --- a/test/parsedQueries/sparql-8-3-2b.json +++ b/test/parsedQueries/sparql-8-3-2b.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-8-3-3a.json b/test/parsedQueries/sparql-8-3-3a.json index 0c08f403..74a0c0c0 100644 --- a/test/parsedQueries/sparql-8-3-3a.json +++ b/test/parsedQueries/sparql-8-3-3a.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-8-3-3b.json b/test/parsedQueries/sparql-8-3-3b.json index 523aac0d..c7aab301 100644 --- a/test/parsedQueries/sparql-8-3-3b.json +++ b/test/parsedQueries/sparql-8-3-3b.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2a.json b/test/parsedQueries/sparql-9-2a.json index ea50b563..84e5a61d 100644 --- a/test/parsedQueries/sparql-9-2a.json +++ b/test/parsedQueries/sparql-9-2a.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2b.json b/test/parsedQueries/sparql-9-2b.json index ea50b563..84e5a61d 100644 --- a/test/parsedQueries/sparql-9-2b.json +++ b/test/parsedQueries/sparql-9-2b.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2c.json b/test/parsedQueries/sparql-9-2c.json index 89c9e52b..6b12309f 100644 --- a/test/parsedQueries/sparql-9-2c.json +++ b/test/parsedQueries/sparql-9-2c.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2d.json b/test/parsedQueries/sparql-9-2d.json index d87f4f69..9a39a6f7 100644 --- a/test/parsedQueries/sparql-9-2d.json +++ b/test/parsedQueries/sparql-9-2d.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2g.json b/test/parsedQueries/sparql-9-2g.json index 69c1ad84..7b461b9a 100644 --- a/test/parsedQueries/sparql-9-2g.json +++ b/test/parsedQueries/sparql-9-2g.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2h.json b/test/parsedQueries/sparql-9-2h.json index d771a690..c90a6c99 100644 --- a/test/parsedQueries/sparql-9-2h.json +++ b/test/parsedQueries/sparql-9-2h.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2i.json b/test/parsedQueries/sparql-9-2i.json index 5b83f63a..b96efbdf 100644 --- a/test/parsedQueries/sparql-9-2i.json +++ b/test/parsedQueries/sparql-9-2i.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2j.json b/test/parsedQueries/sparql-9-2j.json index 4c2ea45f..9642892e 100644 --- a/test/parsedQueries/sparql-9-2j.json +++ b/test/parsedQueries/sparql-9-2j.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2k.json b/test/parsedQueries/sparql-9-2k.json index b0b63350..c49cd8b2 100644 --- a/test/parsedQueries/sparql-9-2k.json +++ b/test/parsedQueries/sparql-9-2k.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2l.json b/test/parsedQueries/sparql-9-2l.json index e36a7a96..df915a51 100644 --- a/test/parsedQueries/sparql-9-2l.json +++ b/test/parsedQueries/sparql-9-2l.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2m.json b/test/parsedQueries/sparql-9-2m.json index 978c9e5b..dd77a1f5 100644 --- a/test/parsedQueries/sparql-9-2m.json +++ b/test/parsedQueries/sparql-9-2m.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2n.json b/test/parsedQueries/sparql-9-2n.json index 23a1d0eb..7da3f343 100644 --- a/test/parsedQueries/sparql-9-2n.json +++ b/test/parsedQueries/sparql-9-2n.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2o.json b/test/parsedQueries/sparql-9-2o.json index b9750d1f..c6b7d8a6 100644 --- a/test/parsedQueries/sparql-9-2o.json +++ b/test/parsedQueries/sparql-9-2o.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2p.json b/test/parsedQueries/sparql-9-2p.json index 389ffd28..25b16475 100644 --- a/test/parsedQueries/sparql-9-2p.json +++ b/test/parsedQueries/sparql-9-2p.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2q.json b/test/parsedQueries/sparql-9-2q.json index 4a80c138..5e50701b 100644 --- a/test/parsedQueries/sparql-9-2q.json +++ b/test/parsedQueries/sparql-9-2q.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-2r.json b/test/parsedQueries/sparql-9-2r.json index 34a5fb24..3fbbcd0a 100644 --- a/test/parsedQueries/sparql-9-2r.json +++ b/test/parsedQueries/sparql-9-2r.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-3a.json b/test/parsedQueries/sparql-9-3a.json index ecb63543..bb75595c 100644 --- a/test/parsedQueries/sparql-9-3a.json +++ b/test/parsedQueries/sparql-9-3a.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-9-3b.json b/test/parsedQueries/sparql-9-3b.json index 590c0c30..bf4983c7 100644 --- a/test/parsedQueries/sparql-9-3b.json +++ b/test/parsedQueries/sparql-9-3b.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sparql-fed-2-4c.json b/test/parsedQueries/sparql-fed-2-4c.json index 51ac8942..665d711c 100644 --- a/test/parsedQueries/sparql-fed-2-4c.json +++ b/test/parsedQueries/sparql-fed-2-4c.json @@ -1,7 +1,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sub-values.json b/test/parsedQueries/sub-values.json index d09e2080..3e345775 100644 --- a/test/parsedQueries/sub-values.json +++ b/test/parsedQueries/sub-values.json @@ -17,7 +17,9 @@ { "queryType": "SELECT", "variables": [ - "*" + { + "termType": "Wildcard" + } ], "where": [ { diff --git a/test/parsedQueries/sum-count.json b/test/parsedQueries/sum-count.json index 42d513e3..adf10311 100644 --- a/test/parsedQueries/sum-count.json +++ b/test/parsedQueries/sum-count.json @@ -33,7 +33,9 @@ }, { "expression": { - "expression": "*", + "expression": { + "termType": "Wildcard" + }, "type": "aggregate", "aggregation": "count", "distinct": false From 0c00589989b47ce3a8f2b92a6e7159d38209089d Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 30 Jul 2019 11:36:16 +0200 Subject: [PATCH 43/46] Adjust generator to expect Wildcard --- lib/SparqlGenerator.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index d08fdfd9..23cd4a21 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -33,7 +33,7 @@ Generator.prototype.toQuery = function (q) { if (q.variables){ query += mapJoin(q.variables, undefined, function (variable) { - return variable === "*" || isTerm(variable) ? this.toEntity(variable) : + return isTerm(variable) ? this.toEntity(variable) : '(' + this.toExpression(variable.expression) + ' AS ' + "?" + variable.variable.value + ')'; }, this) + ' '; } @@ -202,7 +202,7 @@ Generator.prototype.service = function (service) { // Converts the parsed expression object into a SPARQL expression Generator.prototype.toExpression = function (expr) { - if (expr === "*" || isTerm(expr)) { + if (isTerm(expr)) { return this.toEntity(expr); } switch (expr.type.toLowerCase()) { @@ -228,9 +228,9 @@ Generator.prototype.toExpression = function (expr) { case '-': case '*': case '/': - return (args[0] === "*" || isTerm(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + + return (isTerm(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + ' ' + operator + ' ' + - (args[1] === "*" || isTerm(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); + (isTerm(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); // Unary operators case '!': return '!(' + this.toExpression(args[0]) + ')'; @@ -256,14 +256,14 @@ Generator.prototype.toExpression = function (expr) { // Converts the parsed entity (or property path) into a SPARQL entity Generator.prototype.toEntity = function (value) { - if (value === "*") return value; - if (isTerm(value)) { // Remove the prefix but with taking a copy to avoid altering the input if (value.termType === "BlankNode") value = {termType: value.termType, value: value.value.replace(/^e_|^g_/, '')}; switch (value.termType) { // variable, * selector, or blank node + case "Wildcard": + return "*"; case 'Variable': return "?" + value.value; case "BlankNode": From bca26f43627cf493092c4f545e3e671eec97f2e3 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 30 Jul 2019 13:15:05 +0200 Subject: [PATCH 44/46] PR review changes --- lib/SparqlGenerator.js | 3 --- lib/Wildcard.js | 4 ++-- lib/sparql.jison | 2 +- sparql.js | 2 ++ 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index 23cd4a21..30b336f4 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -257,9 +257,6 @@ Generator.prototype.toExpression = function (expr) { // Converts the parsed entity (or property path) into a SPARQL entity Generator.prototype.toEntity = function (value) { if (isTerm(value)) { - // Remove the prefix but with taking a copy to avoid altering the input - if (value.termType === "BlankNode") value = {termType: value.termType, value: value.value.replace(/^e_|^g_/, '')}; - switch (value.termType) { // variable, * selector, or blank node case "Wildcard": diff --git a/lib/Wildcard.js b/lib/Wildcard.js index 72dbc0e8..a78972d7 100644 --- a/lib/Wildcard.js +++ b/lib/Wildcard.js @@ -1,7 +1,7 @@ var Term = require('n3').DataFactory.internal.Term; // Wildcard constructor -class Wildcard extends Term{ +class Wildcard extends Term { constructor() { super(''); return WILDCARD || this; @@ -12,7 +12,7 @@ class Wildcard extends Term{ } equals(other) { - return (other && (this.termType === other.termType)); + return other && (this.termType === other.termType); } } diff --git a/lib/sparql.jison b/lib/sparql.jison index acba80f4..d780c00b 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -3,7 +3,7 @@ SPARQL parser in the Jison parser generator format. */ - var Wildcard = require('./Wildcard.js').Wildcard; + var Wildcard = require('./Wildcard').Wildcard; // Common namespaces and entities var RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', diff --git a/sparql.js b/sparql.js index 77abdb41..33b91daf 100644 --- a/sparql.js +++ b/sparql.js @@ -1,5 +1,6 @@ var Parser = require('./lib/SparqlParser').Parser; var Generator = require('./lib/SparqlGenerator'); +var Wildcard = require("./lib/Wildcard").Wildcard; var N3 = require('n3'); module.exports = { @@ -27,4 +28,5 @@ module.exports = { return parser; }, Generator: Generator, + Wildcard: Wildcard, }; From 54f83f6f9a77dd2ed5e4ec6625910be5fc043ca1 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Tue, 30 Jul 2019 14:16:52 +0200 Subject: [PATCH 45/46] Add value property so users dont have to deal with undefined there --- lib/Wildcard.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Wildcard.js b/lib/Wildcard.js index a78972d7..27f70b76 100644 --- a/lib/Wildcard.js +++ b/lib/Wildcard.js @@ -16,6 +16,12 @@ class Wildcard extends Term { } } +Object.defineProperty(Wildcard.prototype, 'value', { + enumerable: true, + value: '*', +}); + + // Wildcard singleton var WILDCARD = new Wildcard(); From fa2f7a72e45b304a9dcf8def84da3f0daebe9712 Mon Sep 17 00:00:00 2001 From: sivbraec Date: Wed, 31 Jul 2019 11:41:00 +0200 Subject: [PATCH 46/46] Code cleanup for PR --- lib/SparqlGenerator.js | 24 ++++++++++++++---------- lib/Wildcard.js | 9 +++++---- lib/sparql.jison | 12 ++++++------ test/SparqlGenerator-test.js | 2 +- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/lib/SparqlGenerator.js b/lib/SparqlGenerator.js index 30b336f4..a34429e7 100644 --- a/lib/SparqlGenerator.js +++ b/lib/SparqlGenerator.js @@ -34,7 +34,7 @@ Generator.prototype.toQuery = function (q) { if (q.variables){ query += mapJoin(q.variables, undefined, function (variable) { return isTerm(variable) ? this.toEntity(variable) : - '(' + this.toExpression(variable.expression) + ' AS ' + "?" + variable.variable.value + ')'; + '(' + this.toExpression(variable.expression) + ' AS ' + variableToString(variable.variable) + ')'; }, this) + ' '; } else if (q.template) @@ -52,7 +52,7 @@ Generator.prototype.toQuery = function (q) { if (q.group) query += 'GROUP BY ' + mapJoin(q.group, undefined, function (it) { var result = isString(it.expression) ? it.expression : '(' + this.toExpression(it.expression) + ')'; - return it.variable ? '(' + result + ' AS ' + "?" + it.variable.value + ')' : result; + return it.variable ? '(' + result + ' AS ' + variableToString(it.variable) + ')' : result; }, this) + this._newline; if (q.having) query += 'HAVING (' + mapJoin(q.having, undefined, this.toExpression, this) + ')' + this._newline; @@ -157,7 +157,7 @@ Generator.prototype.filter = function (filter) { }; Generator.prototype.bind = function (bind) { - return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + "?" + bind.variable.value + ')'; + return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + variableToString(bind.variable) + ')'; }; Generator.prototype.optional = function (optional) { @@ -190,7 +190,7 @@ Generator.prototype.values = function (valuesList) { return 'VALUES ' + lparen + keys.join(' ') + rparen + ' {' + this._newline + mapJoin(valuesList.values, this._newline, function (values) { return ' ' + lparen + mapJoin(keys, undefined, function (key) { - return values[key] !== undefined ? this.toEntity(values[key]) : 'UNDEF'; + return values[key] ? this.toEntity(values[key]) : 'UNDEF'; }, this) + rparen; }, this) + this._newline + '}'; }; @@ -259,14 +259,14 @@ Generator.prototype.toEntity = function (value) { if (isTerm(value)) { switch (value.termType) { // variable, * selector, or blank node - case "Wildcard": - return "*"; + case 'Wildcard': + return '*'; case 'Variable': - return "?" + value.value; - case "BlankNode": + return variableToString(value); + case 'BlankNode': return '_:' + value.value; // literal - case "Literal": + case 'Literal': var lexical = value.value || '', language = value.language || '', datatype = value.datatype; value = '"' + lexical.replace(escape, escapeReplacer) + '"'; if (language){ @@ -357,11 +357,15 @@ Generator.prototype.toUpdate = function (update) { // Indents each line of the string Generator.prototype.indent = function(text) { return text.replace(/^/gm, this._indent); } +function variableToString(variable){ + return '?' + variable.value; +} + // Checks whether the object is a string function isString(object) { return typeof object === 'string'; } // Checks whether the object is a Term -function isTerm(object) { return object.termType !== undefined; } +function isTerm(object) { return !!object.termType; } // Maps the array with the given function, and joins the results using the separator function mapJoin(array, sep, func, self) { diff --git a/lib/Wildcard.js b/lib/Wildcard.js index 27f70b76..35a2f6cd 100644 --- a/lib/Wildcard.js +++ b/lib/Wildcard.js @@ -7,10 +7,6 @@ class Wildcard extends Term { return WILDCARD || this; } - get termType() { - return 'Wildcard'; - } - equals(other) { return other && (this.termType === other.termType); } @@ -21,6 +17,11 @@ Object.defineProperty(Wildcard.prototype, 'value', { value: '*', }); +Object.defineProperty(Wildcard.prototype, 'termType', { + enumerable: true, + value: 'Wildcard', +}); + // Wildcard singleton var WILDCARD = new Wildcard(); diff --git a/lib/sparql.jison b/lib/sparql.jison index d780c00b..6c64a334 100644 --- a/lib/sparql.jison +++ b/lib/sparql.jison @@ -140,7 +140,7 @@ // Creates a literal with the given value and type function createTypedLiteral(value, type) { - if (type && type.termType !== "NamedNode"){ + if (type && type.termType !== 'NamedNode'){ type = Parser.factory.namedNode(type); } return Parser.factory.literal(value, type); @@ -163,10 +163,10 @@ // Creates a new blank node function blank(name) { if (typeof name === 'string') { // Only use name if a name is given - if (name.startsWith("e_")) return Parser.factory.blankNode(name); - return Parser.factory.blankNode("e_" + name); + if (name.startsWith('e_')) return Parser.factory.blankNode(name); + return Parser.factory.blankNode('e_' + name); } - return Parser.factory.blankNode("g_" + blankId++); + return Parser.factory.blankNode('g_' + blankId++); }; var blankId = 0; Parser._resetBlanks = function () { blankId = 0; } @@ -549,7 +549,7 @@ InlineData throw Error('Inconsistent VALUES length'); var valuesObject = {}; for(var i = 0; i toVar($1) | iri | Literal - | BLANK_NODE_LABEL -> blank($1.replace(/^(_:)/,"")); + | BLANK_NODE_LABEL -> blank($1.replace(/^(_:)/,'')); | ANON -> blank() | NIL -> Parser.factory.namedNode(RDF_NIL) ; diff --git a/test/SparqlGenerator-test.js b/test/SparqlGenerator-test.js index 8ff9ce3e..6d14ee93 100644 --- a/test/SparqlGenerator-test.js +++ b/test/SparqlGenerator-test.js @@ -6,7 +6,7 @@ var fs = require('fs'), os = require('os'); var toEqualParsedQuery = require("../test/matchers/toEqualParsedQuery"); -expect.extend({toEqualParsedQuery,}); +expect.extend({toEqualParsedQuery}); var queriesPath = __dirname + '/../queries/'; var parsedQueriesPath = __dirname + '/../test/parsedQueries/';