Skip to content

Commit 1122133

Browse files
author
Tim Berners-Lee
committed
Type fixes. Assuming rdflib extended typing now
1 parent 8df827e commit 1122133

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

test/unit/table.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { JSDOM } from 'jsdom'
33
import renderTableViewPane from '../../src/table'
44

55
import store from '../../src/store'
6+
import {NamedNode, sym, parse, variable, Namespace, Query} from "rdflib";
67
const kb = store
78

8-
import * as $rdf from 'rdflib'
9+
//import * as $rdf from 'rdflib'
910

1011
silenceDebugMessages()
1112
const window = new JSDOM('<!DOCTYPE html><p>Hello world</p>').window
@@ -20,11 +21,11 @@ const tableData = `@prefix : <https://example.com/tests#> .
2021
const tableQuery = ` PREFIX : <https://example.com/tests#>
2122
SELECT ?who, ?name WHERE { ?who :name ?name . }
2223
`
23-
const doc = $rdf.sym('https://example.com/tests')
24-
$rdf.parse(tableData, kb, doc.uri, 'text/turtle', null) // should be able to omit tcontent type and callback
24+
const doc = sym('https://example.com/tests')
25+
parse(tableData, kb, doc.uri) // should be able to omit tcontent type and callback
2526
// const query = $rdf.SPARQLToQuery(tableQuery) // TypeError: $rdf.SPARQLToQuery is not a function
2627

27-
const query = new $rdf.Query('List people')
28+
const query = new Query('List people')
2829
const vars = ['person', 'name', 'age', 'hobby']
2930

3031
export interface Person {
@@ -36,9 +37,9 @@ export interface Person {
3637

3738
var v = <Person> {} // The RDF variable objects for each variable name
3839
vars.map(function (x) {
39-
query.vars.push((v[x] = $rdf.variable(x)))
40+
query.vars.push((v[x] = variable(x)))
4041
})
41-
const EX = $rdf.Namespace('https://example.com/tests#')
42+
const EX = Namespace('https://example.com/tests#')
4243
query.pat.add(v.person, EX('name'), v.name, doc)
4344
query.pat.add(v.person, EX('age'), v.age, doc)
4445
query.pat.add(v.person, EX('hobby'), v.hobby, doc)

0 commit comments

Comments
 (0)