-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest2.html
66 lines (53 loc) · 2.73 KB
/
test2.html
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
<html>
<head>
<title>test semantic knockout.js</title>
<script type='text/javascript' src="./build/output/knockout-latest.debug.js"></script>
<script type='text/javascript' src="./deps/rdf_store.js"></script>
<script type='text/javascript' src="./deps/sem_ko.js"></script>
<script type='text/javascript' src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
</head>
<body>
<script type='text/javascript'>
$(document).ready(function(){
var testData = "INSERT DATA { <http://test.com/a> <http://test.com/title> 'test resource a' ; <http://test.com/count> '1'.\
<http://test.com/a> <http://test.com/related> <http://test.com/c>.\
<http://test.com/b> <http://test.com/title> 'test resource b' ; <http://test.com/count> '2' . \
<http://test.com/b> <http://test.com/related> <http://test.com/d>.\
<http://test.com/c> <http://test.com/title> 'test resource c' ; <http://test.com/count> '3' .\
<http://test.com/d> <http://test.com/title> 'test resource d' ; <http://test.com/count> '4' . }";
var test = function() {
var daModel = {'currentResource': ko.observable("<http://test.com/a>")};
window['daModel'] = daModel;
console.log("*** initiating the PAGE");
sko.traceResources(jQuery("#to-trace")[0],daModel, function(){
console.log("*** TRACED RESOURCES!!!");
sko.traceRelations(jQuery("#to-trace")[0],daModel, function(){
console.log("*** TRACED RELATIONS!!!");
ko.applyBindings({});
window['updateRootResource'] = function(newUri) {
sko.about['0'](newUri);
};
window['updateRelated'] = function(a,b) {
var query = "DELETE { "+a+" <http://test.com/related> ?o }";
query = query + " INSERT { "+a+" <http://test.com/related> "+b+" }";
query = query + " WHERE { "+a+" <http://test.com/related> ?o }";
};
});
});
};
sko.init(function(){
sko.store.execute(testData,
function(result, msg){
test();
});
});
});
</script>
<div id="to-trace" about="currentResource">
<p data-bind="text: <http://test.com/title>"></p>
<span id='the-related-thing' rel='<http://test.com/related>'>
<p data-bind="text: <http://test.com/count>"></p>
</span>
</div>
</body>
</html>