Fork of https://github.com/oxigraph/oxigraph.git for the purpose of NextGraph project
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.7 KiB
39 lines
1.7 KiB
3 years ago
|
/* global describe, it */
|
||
|
|
||
3 years ago
|
import oxigraph from '../pkg/oxigraph.js'
|
||
|
import assert from 'assert'
|
||
|
import runTests from '../node_modules/@rdfjs/data-model/test/index.js'
|
||
|
|
||
|
runTests({ factory: oxigraph })
|
||
3 years ago
|
|
||
|
describe('DataModel', function () {
|
||
|
describe('#toString()', function () {
|
||
|
it('namedNode().toString() should return SPARQL compatible syntax', function () {
|
||
|
assert.strictEqual('<http://example.com>', oxigraph.namedNode('http://example.com').toString())
|
||
|
})
|
||
|
|
||
|
it('blankNode().toString() should return SPARQL compatible syntax', function () {
|
||
|
assert.strictEqual('_:a', oxigraph.blankNode('a').toString())
|
||
|
})
|
||
|
|
||
|
it('literal().toString() should return SPARQL compatible syntax', function () {
|
||
|
assert.strictEqual('"a\\"b"@en', oxigraph.literal('a"b', 'en').toString())
|
||
|
})
|
||
|
|
||
|
it('defaultGraph().toString() should return SPARQL compatible syntax', function () {
|
||
|
assert.strictEqual('DEFAULT', oxigraph.defaultGraph().toString())
|
||
|
})
|
||
|
|
||
|
it('variable().toString() should return SPARQL compatible syntax', function () {
|
||
|
assert.strictEqual('?a', oxigraph.variable('a').toString())
|
||
|
})
|
||
|
|
||
|
it('quad().toString() should return SPARQL compatible syntax', function () {
|
||
|
assert.strictEqual(
|
||
|
'<http://example.com/s> <http://example.com/p> <<<http://example.com/s1> <http://example.com/p1> <http://example.com/o1>>> <http://example.com/g>',
|
||
|
oxigraph.quad(oxigraph.namedNode('http://example.com/s'), oxigraph.namedNode('http://example.com/p'), oxigraph.quad(oxigraph.namedNode('http://example.com/s1'), oxigraph.namedNode('http://example.com/p1'), oxigraph.namedNode('http://example.com/o1')), oxigraph.namedNode('http://example.com/g')).toString()
|
||
|
)
|
||
|
})
|
||
|
})
|
||
|
})
|