Created
April 8, 2021 15:22
-
-
Save BruJu/b2d4969662851d56bdb0a01a1120cfca to your computer and use it in GitHub Desktop.
One day i'll learn how to write an issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
const N3 = require('n3'); | |
const namespace = require('@rdfjs/namespace'); | |
const ex = namespace("http://example.org/", N3.DataFactory); | |
const rdf = namespace("http://rdf.org/", N3.DataFactory); | |
describe('N3 Parser', function() { | |
it('should parse nested nested quad', function() { | |
let q = (new N3.Parser()).parse("<< << <sss> <ssp> <sso> >> <sp> <so> >> <p> <o> .")[0]; | |
assert.ok( | |
q.equals( | |
N3.DataFactory.quad( | |
N3.DataFactory.quad( | |
N3.DataFactory.quad( | |
N3.DataFactory.namedNode("sss"), | |
N3.DataFactory.namedNode("ssp"), | |
N3.DataFactory.namedNode("sso"), | |
), | |
N3.DataFactory.namedNode("sp"), | |
N3.DataFactory.namedNode("so") | |
), | |
N3.DataFactory.namedNode("p"), | |
N3.DataFactory.namedNode("o") | |
) | |
) | |
); | |
}); | |
it('N3.Store should be able to store nested quads', function() { | |
let q = (new N3.Parser()).parse("<< << <sss> <ssp> <sso> >> <sp> <so> >> <p> <o> .")[0]; | |
let store = new N3.Store(); | |
store.addQuad(q); | |
let quads = store.getQuads(); | |
assert.strictEquals(quads.length, 1); | |
}); | |
it('should parse nested quad in list', function() { | |
let q = (new N3.Parser()).parse("<a> <b> ( << <s> <p> <o> >> )."); | |
assert.ok(q.length >= 3); | |
// <a> <b> list | |
// list first <<s p o>> | |
// list rest nil | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment