-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_test.ts
118 lines (114 loc) · 2.54 KB
/
mod_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import { convertQuadsToRdfJson } from './mod.ts'
import { assertEquals } from 'https://deno.land/std@0.158.0/testing/asserts.ts'
const quads = [{
"termType": "Quad",
"value": "",
"subject": {
"termType": "NamedNode",
"value": "https://danielbeeke.nl#me"
},
"predicate": {
"termType": "NamedNode",
"value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
},
"object": {
"termType": "NamedNode",
"value": "http://xmlns.com/foaf/0.1/Person"
},
"graph": {
"termType": "DefaultGraph",
"value": ""
}
}, {
"termType": "Quad",
"value": "",
"subject": {
"termType": "NamedNode",
"value": "https://danielbeeke.nl#me"
},
"predicate": {
"termType": "NamedNode",
"value": "http://xmlns.com/foaf/0.1/name"
},
"object": {
"termType": "Literal",
"value": "Daniel Beeke",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#string"
}
},
"graph": {
"termType": "DefaultGraph",
"value": ""
}
}, {
"termType": "Quad",
"value": "",
"subject": {
"termType": "BlankNode",
"value": "bc_0_n3-31"
},
"predicate": {
"termType": "NamedNode",
"value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
},
"object": {
"termType": "NamedNode",
"value": "http://xmlns.com/foaf/0.1/Person"
},
"graph": {
"termType": "DefaultGraph",
"value": ""
}
}, {
"termType": "Quad",
"value": "",
"subject": {
"termType": "BlankNode",
"value": "bc_0_n3-31"
},
"predicate": {
"termType": "NamedNode",
"value": "http://xmlns.com/foaf/0.1/name"
},
"object": {
"termType": "Literal",
"value": "John Doo",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#string"
}
},
"graph": {
"termType": "DefaultGraph",
"value": ""
}
}]
Deno.test("url test", () => {
const json = convertQuadsToRdfJson(quads)
assertEquals(json, {
"https://danielbeeke.nl#me": {
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [ { type: "uri", value: "http://xmlns.com/foaf/0.1/Person" } ],
"http://xmlns.com/foaf/0.1/name": [
{
type: "literal",
value: "Daniel Beeke",
datatype: "http://www.w3.org/2001/XMLSchema#string"
}
]
},
"bc_0_n3-31": {
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [ { type: "uri", value: "http://xmlns.com/foaf/0.1/Person" } ],
"http://xmlns.com/foaf/0.1/name": [
{
type: "literal",
value: "John Doo",
datatype: "http://www.w3.org/2001/XMLSchema#string"
}
]
}
})
})