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

@rdfjs/tree

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rdfjs/tree - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

1

lib/Node.js

@@ -8,3 +8,2 @@ import TermMap from '@rdfjs/term-map'

this.isListItem = false
this.isListRoot = false
this.predicates = new TermMap()

@@ -11,0 +10,0 @@ this.quads = []

22

lib/Parser.js

@@ -88,4 +88,6 @@ import TermMap from '@rdfjs/term-map'

let predicate
if (!node.predicates.has(quad.predicate)) {
const predicate = new Predicate({
predicate = new Predicate({
objects: [[quad.object, object]],

@@ -102,3 +104,3 @@ quads: [quad],

} else {
const predicate = node.predicates.get(quad.predicate)
predicate = node.predicates.get(quad.predicate)

@@ -113,8 +115,5 @@ predicate.objects.set(quad.object, object)

this.listItems.set(node.term, node)
} else if (quad.object.equals(ns.rdf.nil)) {
predicate.lists.add(quad.object)
}
if (quad.object.equals(ns.rdf.nil)) {
object.isListRoot = true
object.items = []
}
}

@@ -153,3 +152,10 @@

if (root) {
root.isListRoot = true
for (const ref of root.refs) {
for (const predicate of ref.predicates.values()) {
if (predicate.objects.has(root.term)) {
predicate.lists.add(root.term)
}
}
}
root.items = this._findListItems(root)

@@ -156,0 +162,0 @@ }

import TermMap from '@rdfjs/term-map'
import TermSet from '@rdfjs/term-set'
import * as ns from './namespaces.js'

@@ -7,2 +8,3 @@

this.isType = ns.rdf.type.equals(term)
this.lists = new TermSet()
this.objects = new TermMap(objects)

@@ -9,0 +11,0 @@ this.quads = quads

{
"name": "@rdfjs/tree",
"version": "0.1.0",
"version": "0.2.0",
"description": "Tree structure for a set of RDF/JS Quads",

@@ -5,0 +5,0 @@ "type": "module",

@@ -56,10 +56,2 @@ import { strictEqual } from 'assert'

describe('.isListRoot', () => {
it('should be a property with the value false', () => {
const node = new Node()
strictEqual(node.isListRoot, false)
})
})
describe('.isSubject', () => {

@@ -66,0 +58,0 @@ it('should be a property with the value false', () => {

@@ -39,2 +39,6 @@ import { deepStrictEqual } from 'assert'

predicates: termSetToString(subject.predicates.keys()),
lists: [...subject.predicates.values()]
.filter(p => p.lists.size)
.map(p => `${termString(p.term)} ${termSetToString(p.lists)}`)
.join(','),
items: (subject.items || []).map(node => termString(node.item.term)).join(' ')

@@ -41,0 +45,0 @@ }

@@ -42,2 +42,6 @@ import { strictEqual } from 'assert'

}, {
term: ''
}, {
term: '""'
}, {
term: '"a"'

@@ -51,2 +55,3 @@ }, {

items: '',
lists: '',
predicates: '<http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>',

@@ -56,2 +61,3 @@ term: ''

items: '"a" "b"',
lists: '',
predicates: '<http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>',

@@ -61,3 +67,4 @@ term: ''

items: '',
predicates: '<http://example.org/propertyC> <http://example.org/propertyD>',
lists: '<http://example.org/propertyC> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>,<http://example.org/propertyD> _:',
predicates: '<http://example.org/propertyA> <http://example.org/propertyB> <http://example.org/propertyC> <http://example.org/propertyD>',
term: '<http://example.org/resource>'

@@ -79,2 +86,3 @@ }]

items: '',
lists: '',
predicates: '<http://example.org/propertyA>',

@@ -95,2 +103,3 @@ term: '<http://example.org/resource>'

items: '',
lists: '',
predicates: '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>',

@@ -97,0 +106,0 @@ term: '<http://example.org/resource>'

Sorry, the diff of this file is not supported yet

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