sparqlxml-parse
Advanced tools
Comparing version 1.2.0 to 1.2.1
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
<a name="v1.2.1"></a> | ||
## [v1.2.1](https://github.com/rubensworks/sparqlxml-parse.js/compare/v1.2.0...v1.2.1) - 2019-02-13 | ||
### Fixed | ||
* [Handle emtpy literals correctly](https://github.com/rubensworks/sparqlxml-parse.js/commit/47b67208443899287564882bac6c8f9e193fd359) | ||
<a name="v1.2.0"></a> | ||
@@ -5,0 +11,0 @@ ## [v1.2.0](https://github.com/rubensworks/sparqlxml-parse.js/compare/v1.1.3...v1.2.0) - 2018-11-08 |
@@ -29,3 +29,3 @@ /// <reference types="node" /> | ||
* Convert a SPARQL XML boolean response stream to a promise resolving to a boolean. | ||
* This will reject if the given reponse was not a valid boolean response. | ||
* This will reject if the given response was not a valid boolean response. | ||
* @param {NodeJS.ReadableStream} sparqlResponseStream A SPARQL XML response stream. | ||
@@ -32,0 +32,0 @@ * @return {NodeJS.ReadableStream} A stream of bindings. |
@@ -56,21 +56,23 @@ "use strict"; | ||
const key = binding.attribs.name; | ||
let value = null; | ||
let term = null; | ||
if (binding.children.bnode) { | ||
value = this.dataFactory.blankNode(binding.children.bnode.value); | ||
term = this.dataFactory.blankNode(binding.children.bnode.value); | ||
} | ||
else if (binding.children.literal) { | ||
if (binding.children.literal.attribs && binding.children.literal.attribs['xml:lang']) { | ||
value = this.dataFactory.literal(binding.children.literal.value, binding.children.literal.attribs['xml:lang']); | ||
const value = binding.children.literal.value || ""; | ||
const attribs = binding.children.literal.attribs; | ||
if (attribs && attribs['xml:lang']) { | ||
term = this.dataFactory.literal(value, attribs['xml:lang']); | ||
} | ||
else if (binding.children.literal.attribs && binding.children.literal.attribs.datatype) { | ||
value = this.dataFactory.literal(binding.children.literal.value, this.dataFactory.namedNode(binding.children.literal.attribs.datatype)); | ||
else if (attribs && attribs.datatype) { | ||
term = this.dataFactory.literal(value, this.dataFactory.namedNode(attribs.datatype)); | ||
} | ||
else { | ||
value = this.dataFactory.literal(binding.children.literal.value); | ||
term = this.dataFactory.literal(value); | ||
} | ||
} | ||
else { | ||
value = this.dataFactory.namedNode(binding.children.uri.value); | ||
term = this.dataFactory.namedNode(binding.children.uri.value); | ||
} | ||
bindings[this.prefixVariableQuestionMark ? ('?' + key) : key] = value; | ||
bindings[this.prefixVariableQuestionMark ? ('?' + key) : key] = term; | ||
} | ||
@@ -83,3 +85,3 @@ } | ||
* Convert a SPARQL XML boolean response stream to a promise resolving to a boolean. | ||
* This will reject if the given reponse was not a valid boolean response. | ||
* This will reject if the given response was not a valid boolean response. | ||
* @param {NodeJS.ReadableStream} sparqlResponseStream A SPARQL XML response stream. | ||
@@ -86,0 +88,0 @@ * @return {NodeJS.ReadableStream} A stream of bindings. |
{ | ||
"name": "sparqlxml-parse", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Parses SPARQL XML query results", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/jest": "^23.3.0", | ||
"@types/jest": "^24.0.1", | ||
"@types/minimist": "^1.2.0", | ||
@@ -46,3 +46,3 @@ "arrayify-stream": "^1.0.0", | ||
"tslint-eslint-rules": "^5.3.1", | ||
"typescript": "^3.0.1" | ||
"typescript": "^3.0.3" | ||
}, | ||
@@ -49,0 +49,0 @@ "jest": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17652
195