rdf-object
Advanced tools
Comparing version 1.6.0 to 1.7.0
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
<a name="v1.7.0"></a> | ||
## [v1.7.0](https://github.com/rubensworks/rdf-object.js/compare/v1.6.0...v1.7.0) - 2020-11-25 | ||
### Added | ||
* [Handle compacted terms in createCompactedResource](https://github.com/rubensworks/rdf-object.js/commit/21e73deefa9e531d9c278df3dd78994bca53b09d) | ||
<a name="v1.6.0"></a> | ||
@@ -5,0 +11,0 @@ ## [v1.6.0](https://github.com/rubensworks/rdf-object.js/compare/v1.5.0...v1.6.0) - 2020-11-24 |
@@ -57,2 +57,6 @@ "use strict"; | ||
if (typeof hash !== 'object') { | ||
hash = this.contextResolved.expandTerm(hash); | ||
if (!hash) { | ||
return this.getOrMakeResource(this.dataFactory.blankNode()); | ||
} | ||
return this.getOrMakeResource(rdf_string_1.stringToTerm(hash, this.dataFactory)); | ||
@@ -65,5 +69,16 @@ } | ||
// Create resource for named node term by @id value, or blank node | ||
const resource = this.getOrMakeResource(hash['@id'] ? | ||
this.dataFactory.namedNode(hash['@id']) : | ||
this.dataFactory.blankNode()); | ||
let term; | ||
if (hash['@id']) { | ||
const expandedId = this.contextResolved.expandTerm(hash['@id']); | ||
if (expandedId) { | ||
term = this.dataFactory.namedNode(expandedId); | ||
} | ||
else { | ||
term = this.dataFactory.blankNode(); | ||
} | ||
} | ||
else { | ||
term = this.dataFactory.blankNode(); | ||
} | ||
const resource = this.getOrMakeResource(term); | ||
// Iterate over all entries in the hash | ||
@@ -70,0 +85,0 @@ for (const [key, value] of Object.entries(hash)) { |
{ | ||
"name": "rdf-object", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "Loads RDF as JSON objects", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
42315
627