Skip to content

Commit c0a7d4c

Browse files
Merge pull request #215 from metaphacts/quad-termtype
Add 'termType' property to Quad.toJSON() result
2 parents 4a52763 + 8a9723b commit c0a7d4c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/N3DataFactory.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ export class Quad extends Term {
272272
// ### Returns a plain object representation of this quad
273273
toJSON() {
274274
return {
275+
termType: this.termType,
275276
subject: this.subject.toJSON(),
276277
predicate: this.predicate.toJSON(),
277278
object: this.object.toJSON(),

test/Quad-test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ describe('Quad', function () {
100100

101101
it('should provide a JSON representation', function () {
102102
quad.toJSON().should.deep.equal({
103+
termType: 'Quad',
103104
subject: { termType: 'NamedNode', value: 's' },
104105
predicate: { termType: 'NamedNode', value: 'p' },
105106
object: { termType: 'NamedNode', value: 'o' },
@@ -194,6 +195,7 @@ describe('Quad', function () {
194195

195196
it('should provide a JSON representation', function () {
196197
quad.toJSON().should.deep.equal({
198+
termType: 'Quad',
197199
subject: { termType: 'NamedNode', value: 's' },
198200
predicate: { termType: 'NamedNode', value: 'p' },
199201
object: { termType: 'NamedNode', value: 'o' },
@@ -295,6 +297,7 @@ describe('Quad', function () {
295297

296298
it('should provide a JSON representation', function () {
297299
quad.toJSON().should.deep.equal({
300+
termType: 'Quad',
298301
subject: termFromId('<<_:n3-123 ?var-a ?var-b _:n3-000>>').toJSON(),
299302
predicate: { termType: 'NamedNode', value: 'p' },
300303
object: termFromId('<<http://ex.org/a http://ex.org/b http://ex.org/c>>').toJSON(),

0 commit comments

Comments
 (0)