-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
189 lines (171 loc) · 7.07 KB
/
index.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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<html>
<head>
<title>Constrain Rewriter Sandbox</title>
<script type="text/javascript" src="/assets/highlight-lisp/highlight-lisp.js"></script>
<link type="text/css" rel="stylesheet" href="/assets/style.css" />
<link type="text/css" rel="stylesheet" href="/assets/highlight-lisp/themes/github.css" />
</head>
<body>
<div class="menu">
<div class="title">Constraint Rewriter Sandbox
<div class="user">
<select id="authorization-user">
</select>
</div>
</div>
</div>
<div class="toolbar">
<p>
<select id="plugins"><option value="">--- Saved Constraints ---</option><option value="">====================</option></select> <button id="clear-plugin">Clear</button> <button id="save-plugin">Save</button> <button id="save-plugin-as" disabled=true>Save As</button>
<button name="model" id="apply">Apply Constraint</button>
<span id="message"></span>
<span class="right">
<a target="_new" href="http://localhost:9001/">Sample Application »</a>
</span>
</p>
</div>
<div class="row main">
<div class="column side" id="help">
<div class="panel">
<h2><a href="#" class="close">Help ✕</a></h2>
<h3>Constraints</h3>
<p>Use <code><SESSION></code> for the mu-session-id header.</p>
<p>In the write constraint, graphs containing the matched triple should be variables. Use VALUES when necessary:</p>
<pre>
GRAPH ?graph {
?a ?b ?c
}
VALUES ?graph { <http://example.com/people> }</pre>
<p>Cache annotations can take two forms:</p>
<pre><code>@access Label</code></pre>
<pre><code>@access Label(?var)</code></pre>
<p>and are parsed as Quad blocks (GraphPatternNotTriples).</p>
</div>
<div class="panel">
<h3>Unique Variables</h3>
<p>Unique variables will not be rewritten. Comma- or space-separated list.">?</p>
</div>
<div class="panel">
<h3>Functional Properties</h3>
<p>Comma- or space-separated list.</p>
</div>
<div class="panel">
<h3><a id="toggle-domain">Model (domain.lisp)</a></h3>
<pre id="domain"><code class="lisp">
(define-resource person ()
:class (s-prefix "foaf:Person")
:properties `((:name :string ,(s-prefix "foaf:name"))
(:email :string ,(s-prefix "foaf:mbox"))
(:role :string ,(s-prefix "school:role")))
:has-many `((class :via ,(s-prefix "school:hasTeacher")
:as "classesTaught"
:inverse t)
(class :via ,(s-prefix "school:hasStudent")
:as "classesTaken"
:inverse t)
(grade :via ,(s-prefix "gradeRecipient")
:as "earnedGrades"
:inverse t))
:resource-base (s-url "http://mu.semte.ch/school/people/")
:on-path "people")
(define-resource subject ()
:class (s-prefix "school:Subject")
:properties `((:name :string ,(s-prefix "dct:title")))
:resource-base (s-url "http://mu.semte.ch/school/subjects/")
:has-many `((class :via ,(s-prefix "dct:subject")
:as "classes"
:inverse t))
:on-path "subjects")
(define-resource class ()
:class (s-prefix "school:Class")
:properties `((:name :string ,(s-prefix "dct:title"))
(:subject :string ,(s-prefix "dct:subject")))
:has-many `((person :via ,(s-prefix "school:hasTeacher")
:as "teachers")
(person :via ,(s-prefix "school:hasStudent")
:as "students")
(grade :via ,(s-prefix "school:classGrade")
:as "grades"))
:resource-base (s-url "http://mu.semte.ch/school/classes/")
:on-path "classes")
(define-resource grade ()
:class (s-prefix "school:Grade")
:properties `((:points :number ,(s-prefix "school:gradePoints")))
:resource-base (s-url "http://mu.semte.ch/school/grades/")
:has-one `((person :via ,(s-prefix "school:gradeRecipient")
:as "student")
(class :via ,(s-prefix "school:classGrade")
:as "class"
:inverse t))
:on-path "grades")
</code></pre>
</div>
<br style="clear"/>
</div>
</div>
<div class="column left">
<div class="panel constraint" >
<h2>Constraint
<a target="#" class="help">?</a>
</h2>
<textarea class="constraint text" id="read-constraint"></textarea>
</div>
<div class="panel constraint">
<h3>Write Constraint <small><input checked=true type="checkbox" id="read-write"/>Same as Read Constraint</small></h3>
<textarea class="constraint text" id="write-constraint" disabled=true>
</textarea>
</div>
<div class="panel">
<h3>Optimizations</h3>
<h4>Unique Variables</h4>
<p> <input type="text" id="uvs" value="?session, ?user"/></p>
<h4>Functional Properties</h4>
<p> <input type="text" id="fprops" value="rdf:type"/></p>
<h4>Transient Functional Properties (no caching)</h4>
<p> <input type="text" id="trfprops" /></p>
<p><input type="checkbox" id="query-fprops" checked=true/> Query functional properties for known subjects</p>
<h4>Queried Properties</h4>
<p> <input type="text" id="qprops" value="rdf:type"/></p>
<h4>Transient Queried Properties (no caching)</h4>
<p> <input type="text" id="trqprops" value="rdf:type"/></p>
</div>
</div>
<div class="column middle">
<div class="panel query">
<h2>Query <small><button name="rewrite" id="rewrite">Rewrite</button></small></h2>
<textarea id="query">
SELECT *
WHERE {
?s ?p ?o
}
</textarea>
</div> <!-- .panel -->
</div> <!-- .column.middle -->
<div class="column right">
<div class="panel" id="result-panel">
<h2>Rewritten Query <small><button name="run" id="run" disabled=true>Run</button></small></h2>
<div class="panel-box">
<pre id="result"></pre>
</div><!-- .panel-box -->
</div><!-- .panel.result -->
<div class="panel">
<div id="annotations-box">
<h3>Query Annotations</h3>
<ul id="annotations"></ul>
<h3>Queried Annotations</h3>
<ul id="queried-annotations"></ul>
</div>
</div> <!-- .panel -->
</div>
<div class="column side" id="results-column">
<div class="panel results" id="results-panel">
<h2><a href="#" class="close">Query Results ✕</a></h2>
<pre id="results"></pre>
</div> <!-- .panel.results -->
</div> <!-- .column -->
<script type="text/javascript" src="/assets/sandbox.js"></script>
<script type="text/javascript">
HighlightLisp.highlight_auto({className: 'lisp'});
</script>
</body>
</html>