Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rdf-object

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdf-object - npm Package Compare versions

Comparing version 1.7.1 to 1.8.0

6

CHANGELOG.md
# Changelog
All notable changes to this project will be documented in this file.
<a name="v1.8.0"></a>
## [v1.8.0](https://github.com/rubensworks/rdf-object.js/compare/v1.7.1...v1.8.0) - 2020-12-03
### Added
* [Also handle RDF lists in Resource#toQuads](https://github.com/rubensworks/rdf-object.js/commit/70dd1bdce52e6a7a653f0b4c4d3b55c5b1008a7f)
<a name="v1.7.1"></a>

@@ -5,0 +11,0 @@ ## [v1.7.1](https://github.com/rubensworks/rdf-object.js/compare/v1.7.0...v1.7.1) - 2020-11-25

21

lib/Resource.js

@@ -7,2 +7,3 @@ "use strict";

const rdf_string_1 = require("rdf-string");
const RdfListMaterializer_1 = require("./RdfListMaterializer");
const ShortcutPropertyHandler_1 = require("./ShortcutPropertyHandler");

@@ -103,2 +104,3 @@ const SingularPropertyHandler_1 = require("./SingularPropertyHandler");

toQuads(quads = [], dataFactory = new rdf_data_factory_1.DataFactory()) {
// Handle predicates
for (const [property, resources] of Object.entries(this.propertiesUri)) {

@@ -108,3 +110,3 @@ const subject = this.term;

for (const resource of resources) {
const object = resource.term;
const object = resource.list && resource.list.length === 0 ? RdfListMaterializer_1.RdfListMaterializer.RDF_NIL : resource.term;
quads.push(dataFactory.quad(subject, predicate, object));

@@ -114,2 +116,19 @@ resource.toQuads(quads, dataFactory);

}
// Handle RDF lists
if (this.list) {
let chain = this.term;
let chainPrev;
for (const element of this.list) {
if (chainPrev) {
quads.push(dataFactory.quad(chainPrev, RdfListMaterializer_1.RdfListMaterializer.RDF_REST, chain));
}
quads.push(dataFactory.quad(chain, RdfListMaterializer_1.RdfListMaterializer.RDF_FIRST, element.term));
element.toQuads(quads, dataFactory);
chainPrev = chain;
chain = dataFactory.blankNode();
}
if (chainPrev) {
quads.push(dataFactory.quad(chainPrev, RdfListMaterializer_1.RdfListMaterializer.RDF_REST, RdfListMaterializer_1.RdfListMaterializer.RDF_NIL));
}
}
return quads;

@@ -116,0 +135,0 @@ }

2

package.json
{
"name": "rdf-object",
"version": "1.7.1",
"version": "1.8.0",
"description": "Loads RDF as JSON objects",

@@ -5,0 +5,0 @@ "keywords": [

@@ -46,3 +46,3 @@ # RDF Object

```javascript
import {namedNode, literal, triple} as DataFactory from "@rdfjs/data-model"; // External library
import {namedNode, literal, triple} from "@rdfjs/data-model"; // External library
import {RdfObjectLoader} from "rdf-object";

@@ -49,0 +49,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc