@rdfjs/tree
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -8,2 +8,3 @@ import TermMap from '@rdfjs/term-map' | ||
this.isListItem = false | ||
this.isListValue = false | ||
this.predicates = new TermMap() | ||
@@ -10,0 +11,0 @@ this.quads = [] |
@@ -12,2 +12,3 @@ import TermMap from '@rdfjs/term-map' | ||
this.listItemsSeen = new TermSet() | ||
this.listValues = new TermSet() | ||
} | ||
@@ -113,2 +114,6 @@ | ||
if (quad.predicate.equals(ns.rdf.first)) { | ||
this.listValues.add(quad.object) | ||
} | ||
this.listItems.set(node.term, node) | ||
@@ -162,2 +167,6 @@ } else if (quad.object.equals(ns.rdf.nil)) { | ||
} | ||
for (const term of this.listValues.values()) { | ||
this.tree.nodes.get(term).isListValue = true | ||
} | ||
} | ||
@@ -164,0 +173,0 @@ |
{ | ||
"name": "@rdfjs/tree", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Tree structure for a set of RDF/JS Quads", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -56,2 +56,10 @@ import { strictEqual } from 'assert' | ||
describe('.isListValue', () => { | ||
it('should be a property with the value false', () => { | ||
const node = new Node() | ||
strictEqual(node.isListValue, false) | ||
}) | ||
}) | ||
describe('.isSubject', () => { | ||
@@ -58,0 +66,0 @@ it('should be a property with the value false', () => { |
@@ -43,3 +43,4 @@ import { deepStrictEqual } from 'assert' | ||
.join(','), | ||
items: (subject.items || []).map(node => termString(node.item.term)).join(' ') | ||
items: (subject.items || []).map(node => termString(node.item.term)).join(' '), | ||
isListValue: subject.isListValue | ||
} | ||
@@ -46,0 +47,0 @@ }) |
@@ -44,2 +44,6 @@ import { strictEqual } from 'assert' | ||
}, { | ||
term: '' | ||
}, { | ||
term: '' | ||
}, { | ||
term: '""' | ||
@@ -51,10 +55,28 @@ }, { | ||
}, { | ||
term: '"c"' | ||
}, { | ||
term: '"d"' | ||
}, { | ||
term: '<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>' | ||
}], | ||
subjects: [{ | ||
isListValue: true, | ||
items: '', | ||
lists: '', | ||
predicates: '<http://example.org/propertyF>', | ||
term: '' | ||
}, { | ||
isListValue: false, | ||
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>', | ||
term: '' | ||
}, { | ||
isListValue: false, | ||
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>', | ||
term: '' | ||
}, { | ||
isListValue: false, | ||
items: '"a" "b"', | ||
@@ -65,5 +87,12 @@ lists: '', | ||
}, { | ||
isListValue: false, | ||
items: '"c" ', | ||
lists: '', | ||
predicates: '<http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>', | ||
term: '' | ||
}, { | ||
isListValue: false, | ||
items: '', | ||
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>', | ||
lists: '<http://example.org/propertyC> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>,<http://example.org/propertyD> _:,<http://example.org/propertyE> _:', | ||
predicates: '<http://example.org/propertyA> <http://example.org/propertyB> <http://example.org/propertyC> <http://example.org/propertyD> <http://example.org/propertyE>', | ||
term: '<http://example.org/resource>' | ||
@@ -84,2 +113,3 @@ }] | ||
subjects: [{ | ||
isListValue: false, | ||
items: '', | ||
@@ -101,2 +131,3 @@ lists: '', | ||
subjects: [{ | ||
isListValue: false, | ||
items: '', | ||
@@ -103,0 +134,0 @@ lists: '', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
19557
561