annotate slide/slide.html @ 4:84bbcfe22656 default tip

change slide
author tatsuki
date Sat, 12 Sep 2015 17:30:58 +0900
parents 082148d6bf7f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
tatsuki
parents:
diff changeset
1 <!DOCTYPE html>
tatsuki
parents:
diff changeset
2 <html>
tatsuki
parents:
diff changeset
3 <head>
tatsuki
parents:
diff changeset
4 <meta http-equiv="content-type" content="text/html;charset=utf-8">
tatsuki
parents:
diff changeset
5 <title>非破壊的木構造データベースJungleとその評価</title>
tatsuki
parents:
diff changeset
6 <!--
tatsuki
parents:
diff changeset
7 Notes on CSS media types used:
tatsuki
parents:
diff changeset
8
tatsuki
parents:
diff changeset
9 1) projection -> slideshow mode (display one slide at-a-time; hide all others)
tatsuki
parents:
diff changeset
10 2) screen -> outline mode (display all slides-at-once on screen)
tatsuki
parents:
diff changeset
11 3) print -> print (and print preview)
tatsuki
parents:
diff changeset
12
tatsuki
parents:
diff changeset
13 Note: toggle between projection/screen (that is, slideshow/outline) mode using t-key
tatsuki
parents:
diff changeset
14
tatsuki
parents:
diff changeset
15 Questions, comments?
tatsuki
parents:
diff changeset
16 - send them along to the mailinglist/forum online @ http://groups.google.com/group/webslideshow
tatsuki
parents:
diff changeset
17 -->
tatsuki
parents:
diff changeset
18
tatsuki
parents:
diff changeset
19 <!-- styles -->
tatsuki
parents:
diff changeset
20 <style media="screen,projection">
tatsuki
parents:
diff changeset
21
tatsuki
parents:
diff changeset
22 html,
tatsuki
parents:
diff changeset
23 body,
tatsuki
parents:
diff changeset
24 .presentation { margin: 0; padding: 0; }
tatsuki
parents:
diff changeset
25
tatsuki
parents:
diff changeset
26 .slide { display: none;
tatsuki
parents:
diff changeset
27 position: absolute;
tatsuki
parents:
diff changeset
28 top: 0; left: 0;
tatsuki
parents:
diff changeset
29 margin: 0;
tatsuki
parents:
diff changeset
30 border: none;
tatsuki
parents:
diff changeset
31 padding: 2% 4% 0% 4%; /* css note: order is => top right bottom left */
tatsuki
parents:
diff changeset
32 -moz-box-sizing: border-box;
tatsuki
parents:
diff changeset
33 -webkit-box-sizing: border-box;
tatsuki
parents:
diff changeset
34 box-sizing: border-box;
tatsuki
parents:
diff changeset
35 width: 100%; height: 100%; /* css note: lets use border-box; no need to add padding+border to get to 100% */
tatsuki
parents:
diff changeset
36 overflow-x: hidden; overflow-y: auto;
tatsuki
parents:
diff changeset
37 z-index: 2;
tatsuki
parents:
diff changeset
38 }
tatsuki
parents:
diff changeset
39
tatsuki
parents:
diff changeset
40 .slide.current { display: block; } /* only display current slide in projection mode */
tatsuki
parents:
diff changeset
41
tatsuki
parents:
diff changeset
42 .slide .stepcurrent { color: black; }
tatsuki
parents:
diff changeset
43 .slide .step { color: silver; } /* or hide next steps e.g. .step { visibility: hidden; } */
tatsuki
parents:
diff changeset
44
tatsuki
parents:
diff changeset
45 .slide {
tatsuki
parents:
diff changeset
46 /*
tatsuki
parents:
diff changeset
47 background-image: -webkit-linear-gradient(top, blue, aqua, blue, aqua);
tatsuki
parents:
diff changeset
48 background-image: -moz-linear-gradient(top, blue, aqua, blue, aqua);
tatsuki
parents:
diff changeset
49 */
tatsuki
parents:
diff changeset
50 }
tatsuki
parents:
diff changeset
51 </style>
tatsuki
parents:
diff changeset
52
tatsuki
parents:
diff changeset
53 <style media="screen">
tatsuki
parents:
diff changeset
54 .slide { border-top: 1px solid #888; }
tatsuki
parents:
diff changeset
55 .slide:first-child { border: none; }
tatsuki
parents:
diff changeset
56 </style>
tatsuki
parents:
diff changeset
57
tatsuki
parents:
diff changeset
58 <style media="print">
tatsuki
parents:
diff changeset
59 .slide { page-break-inside: avoid; }
tatsuki
parents:
diff changeset
60 .slide h1 { page-break-after: avoid; }
tatsuki
parents:
diff changeset
61 .slide ul { page-break-inside: avoid; }
tatsuki
parents:
diff changeset
62 </style>
tatsuki
parents:
diff changeset
63
tatsuki
parents:
diff changeset
64
tatsuki
parents:
diff changeset
65 <!-- add js lib (jquery) -->
tatsuki
parents:
diff changeset
66 <script src="js/jquery-1.7.min.js"></script>
tatsuki
parents:
diff changeset
67
tatsuki
parents:
diff changeset
68 <!-- S6 JS -->
tatsuki
parents:
diff changeset
69 <script src="js/jquery.slideshow.js"></script>
tatsuki
parents:
diff changeset
70 <script src="js/jquery.slideshow.counter.js"></script>
tatsuki
parents:
diff changeset
71 <script src="js/jquery.slideshow.controls.js"></script>
tatsuki
parents:
diff changeset
72 <script>
tatsuki
parents:
diff changeset
73 $(document).ready( function() {
tatsuki
parents:
diff changeset
74 Slideshow.init();
tatsuki
parents:
diff changeset
75
tatsuki
parents:
diff changeset
76 // Example 2: Start Off in Outline Mode
tatsuki
parents:
diff changeset
77 // Slideshow.init( { mode: 'outline' } );
tatsuki
parents:
diff changeset
78
tatsuki
parents:
diff changeset
79 // Example 3: Use Custom Transition
tatsuki
parents:
diff changeset
80 // Slideshow.transition = transitionScrollUp;
tatsuki
parents:
diff changeset
81 // Slideshow.init();
tatsuki
parents:
diff changeset
82
tatsuki
parents:
diff changeset
83 // Example 4: Start Off in Autoplay Mode with Custom Transition
tatsuki
parents:
diff changeset
84 // Slideshow.transition = transitionScrollUp;
tatsuki
parents:
diff changeset
85 // Slideshow.init( { mode: 'autoplay' } );
tatsuki
parents:
diff changeset
86 } );
tatsuki
parents:
diff changeset
87 </script>
tatsuki
parents:
diff changeset
88
tatsuki
parents:
diff changeset
89 </head>
tatsuki
parents:
diff changeset
90 <body>
tatsuki
parents:
diff changeset
91
tatsuki
parents:
diff changeset
92 <div class="presentation">
tatsuki
parents:
diff changeset
93
tatsuki
parents:
diff changeset
94 <!-- add slides here; example -->
tatsuki
parents:
diff changeset
95 <div id="header">
tatsuki
parents:
diff changeset
96 <font size=5>
tatsuki
parents:
diff changeset
97 <h1>非破壊的木構造データベースJungleとその評価</h1>
tatsuki
parents:
diff changeset
98 <br><br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
99 </font>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
100 <font size=6>
1
tatsuki
parents:
diff changeset
101 <p>琉球大学情報工学科並列信頼研</p>
tatsuki
parents:
diff changeset
102 <p>金川竜己</p></font>
tatsuki
parents:
diff changeset
103
tatsuki
parents:
diff changeset
104 </div>
tatsuki
parents:
diff changeset
105
tatsuki
parents:
diff changeset
106 <div>
2
tatsuki
parents: 1
diff changeset
107 <h1>知的構造を格納するためのデータベース</h1>
1
tatsuki
parents:
diff changeset
108 <font size=5>
2
tatsuki
parents: 1
diff changeset
109 <p>我々が扱っている知識は木構造であることが多い。</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
110 <p>RDBに木構造を格納する際は表に変換を行う必要があり、スキーマが煩雑になる</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
111 <p>木構造をそのまま格納できるデータベースが欲しい</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
112 <p>データ構造をリトライ可能な形で変更したい</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
113 <p>いろいろ試しながらアプリケーションに合ったデータ設計を行える</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
114 <p>当研究室では、非破壊的木構造データベースJungleの開発をおこなっている</p>
1
tatsuki
parents:
diff changeset
115 <p>Jungleの表現力、機能の十分性検証、及び性能実証実験を行いたい</p>
tatsuki
parents:
diff changeset
116 <p>そのために、Jungle上に組織の許認可管理アプリケーションmaTrixを実装した</p>
tatsuki
parents:
diff changeset
117 </font>
tatsuki
parents:
diff changeset
118 </div>
tatsuki
parents:
diff changeset
119
tatsuki
parents:
diff changeset
120
tatsuki
parents:
diff changeset
121 <div>
2
tatsuki
parents: 1
diff changeset
122 <h1>組織の中の許認可管理アプリケーションmaTrix</h1>
1
tatsuki
parents:
diff changeset
123 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
124 <p>人、組織、役割等の複数の木構造データを組織構造として保持している</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
125 <p>組織構造は版管理されている</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
126 <p>木構造のデータはお互いに参照を行っている</p>
2
tatsuki
parents: 1
diff changeset
127 <p>許認可の判断はアクセスルールが記述されたポリシーファイルにそって行われる</p>
1
tatsuki
parents:
diff changeset
128 <p>ポリシーファイルは主に、誰が (Target)、何を (Redource)、どうできるか(Action) の3つの要素で記述されている</p>
tatsuki
parents:
diff changeset
129 </font>
tatsuki
parents:
diff changeset
130 </div>
tatsuki
parents:
diff changeset
131
tatsuki
parents:
diff changeset
132
tatsuki
parents:
diff changeset
133 <div>
2
tatsuki
parents: 1
diff changeset
134 <h1>非破壊的木構造データベースJungle</h1>
1
tatsuki
parents:
diff changeset
135 <font size=5>
tatsuki
parents:
diff changeset
136 <p>Jungleは、複数の木の集合からなり、木はノードの集合で出来ている</p>
tatsuki
parents:
diff changeset
137 <p>ノードは、自身の子供のリストと、属性名(Key)と属性値(Value)のデータの組を持つ</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
138 <p>Jungleは、木の編集を行う際に一度作成した木を上書きしない</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
139 <p>新しい木構造を構築することでデータの編集を行う</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
140 <p>変更がないノードは共有する</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
141 <p>木が変更されていることが保証されているため、読み込み時にロックをかける必要がない</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
142 <p>Jungleは過去のversionへの木の参照を持つ</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
143 <p>過去の木に対してアクセスが可能</p>
2
tatsuki
parents: 1
diff changeset
144 </font>
tatsuki
parents: 1
diff changeset
145 </div>
tatsuki
parents: 1
diff changeset
146
tatsuki
parents: 1
diff changeset
147
tatsuki
parents: 1
diff changeset
148
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
149 <!--
2
tatsuki
parents: 1
diff changeset
150 <div>
tatsuki
parents: 1
diff changeset
151 <h1>Jungleのデータの編集</h1>
tatsuki
parents: 1
diff changeset
152 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
153 <p>Jungleは、木の編集を行う際に一度作成した木を上書きしない</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
154 <p>新しい木構造を構築することでデータの編集を行う</p>
2
tatsuki
parents: 1
diff changeset
155 <p>変更がないノードは共有する</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
156 <iframe src="images/non_destructive_tree_edit2.html" width="1000" height="400"></iframe>
1
tatsuki
parents:
diff changeset
157 <p>木の更新は、ルートノードをCASを用いて入れ替えることで行う</p>
2
tatsuki
parents: 1
diff changeset
158 <p>データの上書きが無いため、読み込み中にロックをかける必要がない</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
159 <p>木は過去のversionの木への参照を持つ</p>
1
tatsuki
parents:
diff changeset
160 </font>
tatsuki
parents:
diff changeset
161 </div>
tatsuki
parents:
diff changeset
162
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
163 -->
1
tatsuki
parents:
diff changeset
164
tatsuki
parents:
diff changeset
165 <div>
2
tatsuki
parents: 1
diff changeset
166 <h1>Jungle上でのmaTrixのデータ構造の表現</h1>
1
tatsuki
parents:
diff changeset
167 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
168 <p>Jugnleは木構造のデータをそのまま格納できる</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
169 <p>maTrixが書きだしたxml形式データをそのまま格納できる</p>
1
tatsuki
parents:
diff changeset
170 <p>maTrixの人物TreeをJungleに格納した図の一部を以下に示す</p>
tatsuki
parents:
diff changeset
171 <iframe src="images/TreePersonJungle.html" width="1000" height="1000"></iframe>
tatsuki
parents:
diff changeset
172 <p></p>
tatsuki
parents:
diff changeset
173 </font>
tatsuki
parents:
diff changeset
174 </div>
tatsuki
parents:
diff changeset
175
tatsuki
parents:
diff changeset
176
tatsuki
parents:
diff changeset
177 <div>
tatsuki
parents:
diff changeset
178 <font size=5>
2
tatsuki
parents: 1
diff changeset
179 <h1>Jungle上でのIdを使った木の相互参照</h1>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
180 <p>組織構造は複数の木構造を持ち、お互いのノード参照している</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
181 <p>ノードの参照はidとindexを用いて表現する</p>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
182 <iframe src="images/ref.html" width="2000" height="1000"></iframe>
1
tatsuki
parents:
diff changeset
183 </font>
tatsuki
parents:
diff changeset
184 </div>
tatsuki
parents:
diff changeset
185
tatsuki
parents:
diff changeset
186
tatsuki
parents:
diff changeset
187 <div>
2
tatsuki
parents: 1
diff changeset
188 <h1>JungleのIndex</h1>
1
tatsuki
parents:
diff changeset
189 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
190 <p>Jungleは過去の木を全て保持している</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
191 <p>version毎にIndexを持っている必要がある</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
192 <p>全てに新しくIndexを作るとメモリを多量使用してしまう</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
193 <p>前の版のIndexから変更が行われていないデータを共有するIndexを実装した</p>
2
tatsuki
parents: 1
diff changeset
194 <p>複数のversionのIndexがあっても、データの差分しかメモリは使用されない</p>
tatsuki
parents: 1
diff changeset
195 </font>
tatsuki
parents: 1
diff changeset
196 </div>
tatsuki
parents: 1
diff changeset
197
tatsuki
parents: 1
diff changeset
198 <div>
tatsuki
parents: 1
diff changeset
199 <h1>非破壊TreeMapの実装</h1>
tatsuki
parents: 1
diff changeset
200 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
201 <p>FunctionalJavaというjava上で関数型プログラミングが行えるライブラリがある</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
202 <p>当初はFunctionalJavaのTreeMapを使用してIndexの実装を行った</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
203 <p>FunctionalJavaにはTreeMapにはgetが致命的に遅いバグがあった</p>
2
tatsuki
parents: 1
diff changeset
204 <p>新しく非破壊TreeMapを実装した</p>
tatsuki
parents: 1
diff changeset
205 <p>その結果Jungleの性能は劇的に向上した</p>
1
tatsuki
parents:
diff changeset
206 </font>
tatsuki
parents:
diff changeset
207 </div>
tatsuki
parents:
diff changeset
208
tatsuki
parents:
diff changeset
209
2
tatsuki
parents: 1
diff changeset
210
1
tatsuki
parents:
diff changeset
211 <div>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
212 <h1>ノードの親を取得するIndex</h1>
1
tatsuki
parents:
diff changeset
213 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
214 <p>Jungleは子から親への参照は存在しない</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
215 <p>子ノードを渡すと親をノードを返すParentIndexの実装を行った</p>
2
tatsuki
parents: 1
diff changeset
216 </font>
tatsuki
parents: 1
diff changeset
217 </div>
tatsuki
parents: 1
diff changeset
218
tatsuki
parents: 1
diff changeset
219 <div>
tatsuki
parents: 1
diff changeset
220 <h1>許認可Queryの実装</h1>
tatsuki
parents: 1
diff changeset
221 <font size=5>
tatsuki
parents: 1
diff changeset
222 <p>maTrixを用いた許認可は、ポリシーファイルを参照し行われる</p>
1
tatsuki
parents:
diff changeset
223 <p>ポリシーファイルには、subject(誰が)、Resource(何に対して)、Action(何が出来るか)を記述する</p>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
224 <p>maTrixにおける許認可判断において、データに対するアクセスは、subject部分で検索関数を用いて行う</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
225 <p>Jungle上にmaTrixを実装するにあって、検索関数の実装を行った</p>
1
tatsuki
parents:
diff changeset
226 </font>
tatsuki
parents:
diff changeset
227 </div>
tatsuki
parents:
diff changeset
228
tatsuki
parents:
diff changeset
229
tatsuki
parents:
diff changeset
230 <div>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
231 <h1>Treeの検索</h1>
1
tatsuki
parents:
diff changeset
232 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
233 <p>検索関数はTraverserに実装する</p>
1
tatsuki
parents:
diff changeset
234 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
tatsuki
parents:
diff changeset
235 InterfaceTraverser traverser = tree.getTraverser(boolean useIndex);
tatsuki
parents:
diff changeset
236 </div>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
237 <p>Traverserは木のノードを走破する機能を持ったクラスです</p>
1
tatsuki
parents:
diff changeset
238 <p>TreeからgetTraverserで取得可能</p>
2
tatsuki
parents: 1
diff changeset
239 <p>引数で検索を行う際にIndexを使用するかどうかを選択できる</p>
tatsuki
parents: 1
diff changeset
240 </font>
tatsuki
parents: 1
diff changeset
241 </div>
tatsuki
parents: 1
diff changeset
242
tatsuki
parents: 1
diff changeset
243 <div>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
244 <h1>Treeの検索</h1>
2
tatsuki
parents: 1
diff changeset
245 <font size=5>
1
tatsuki
parents:
diff changeset
246 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
2
tatsuki
parents: 1
diff changeset
247 public Iterator&lt;TreeNode&gt; find(Query query,String key, String searchValue);
tatsuki
parents: 1
diff changeset
248 </div>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
249 <p>findは上のように定義されており、引数に</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
250 <p>検索の条件を記述する関数boolean condition(TreeNode)を定義したQuery</p>
2
tatsuki
parents: 1
diff changeset
251 <p>Indexを使う検索に使用するString 属性名、String 属性値のペア</p>
tatsuki
parents: 1
diff changeset
252 <p>の3つを取る</p>
tatsuki
parents: 1
diff changeset
253 <p>条件に一致したNodeのIteratorを返す</p>
tatsuki
parents: 1
diff changeset
254 <p>Iteratorは、複数の値から1つずつ順番に取得するためのinterfaceである</p>
tatsuki
parents: 1
diff changeset
255 </font>
tatsuki
parents: 1
diff changeset
256 </div>
tatsuki
parents: 1
diff changeset
257
tatsuki
parents: 1
diff changeset
258 <div>
tatsuki
parents: 1
diff changeset
259 <h1>findの使用例</h1>
tatsuki
parents: 1
diff changeset
260 <font size=5>
tatsuki
parents: 1
diff changeset
261 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
tatsuki
parents: 1
diff changeset
262 InterfaceTraverser personTraverser = personTree.getTraverser(true);<br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
263 Iterator&lt;TreeNode&gt; iterator = personTraverser.find((TreeNode node) -&gt; { <br>
2
tatsuki
parents: 1
diff changeset
264 &nbsp;&nbsp;String personId = node.getAttributes().getString("Person-id");<br>
tatsuki
parents: 1
diff changeset
265 &nbsp;&nbsp;if (personId.equals("p:4"))<br>
tatsuki
parents: 1
diff changeset
266 &nbsp;&nbsp;&nbsp;&nbsp;return true;<br>
tatsuki
parents: 1
diff changeset
267 &nbsp;&nbsp;return false;<br>
tatsuki
parents: 1
diff changeset
268 }, "Person-id", "p:4");<br>
tatsuki
parents: 1
diff changeset
269 <br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
270 if (iterator.hasNext())<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
271 &nbsp;&nbsp;TreeNode node = iterator.next();
1
tatsuki
parents:
diff changeset
272 </div>
2
tatsuki
parents: 1
diff changeset
273 <ol>
tatsuki
parents: 1
diff changeset
274 <li>Treeから木の探索を行うInterfaceTraverserを取得する</li>
tatsuki
parents: 1
diff changeset
275 <li>findを実行する。引数には、検索条件が記述されたQuery、Person-Id、p:4を与える。(以下Queryの中の解説)</li>
tatsuki
parents: 1
diff changeset
276 <li>nodeから属性名Person-idとペアになっている属性値を取得する</li>
tatsuki
parents: 1
diff changeset
277 <li>返り値がp:4と一致するかどうかを調べる</li>
tatsuki
parents: 1
diff changeset
278 <li>一致した場合trueを一致しなかった場合falseを返す</li>
tatsuki
parents: 1
diff changeset
279 <li>帰ってきたIteratorからNodeを取得する</li>
tatsuki
parents: 1
diff changeset
280 </ol>
tatsuki
parents: 1
diff changeset
281 </font>
tatsuki
parents: 1
diff changeset
282 </div>
tatsuki
parents: 1
diff changeset
283
tatsuki
parents: 1
diff changeset
284 <div>
tatsuki
parents: 1
diff changeset
285 <h1>maTrix上での許認可判断例(1)</h1>
tatsuki
parents: 1
diff changeset
286 <font size=5>
tatsuki
parents: 1
diff changeset
287 <p>情報工学科の学生にのみ貸し出されるPCをAさんが借りようとした場合の許認可判断</p>
tatsuki
parents: 1
diff changeset
288 <ol>
tatsuki
parents: 1
diff changeset
289 <li>Aさん(Subject)が、学科のノートPC(Resource)の借りる(Action)ために、maTrixに貸出許可を求める</li>
tatsuki
parents: 1
diff changeset
290 <li>maTrixは、PCの貸出許可を与えるかを判断するためのポリシーファイルを参照する</li>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
291 <li>maTrixはAさんの役割を取得する</li>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
292 <li>Aさんが情報工学科学生の役割を持っていた場合貸出許可を与える</li>
2
tatsuki
parents: 1
diff changeset
293 </ol>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
294 <p>maTrixは、3番目の処理で役割を取得する検索関数roleIdsを使用している</p>
2
tatsuki
parents: 1
diff changeset
295 </font>
tatsuki
parents: 1
diff changeset
296 </div>
tatsuki
parents: 1
diff changeset
297
tatsuki
parents: 1
diff changeset
298 <div>
tatsuki
parents: 1
diff changeset
299 <h1>役割を取得する関数</h1>
tatsuki
parents: 1
diff changeset
300 <font size=5>
tatsuki
parents: 1
diff changeset
301 <p>roleIdsは、人、組織の役割を取得する関数</p>
1
tatsuki
parents:
diff changeset
302 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
2
tatsuki
parents: 1
diff changeset
303 public&nbsp;Iterator&lt;String&gt;&nbsp;searchPersonRoleIds(String&nbsp;version,&nbsp;String&nbsp;id,&nbsp;LinkedList&lt;String&gt;&nbsp;filterIds)&nbsp;
tatsuki
parents: 1
diff changeset
304 </div>
tatsuki
parents: 1
diff changeset
305 <p>roleIdsは引数に</p>
tatsuki
parents: 1
diff changeset
306 <li>検索を行う組織構造のversion</li>
tatsuki
parents: 1
diff changeset
307 <li>役割を取得したい人 or 組織のId</li>
tatsuki
parents: 1
diff changeset
308 <li>検索対象を絞り込むために使用するフィルター</li>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
309 <p>の3つをとり、返り値に役割のIteratorを返します</p>
2
tatsuki
parents: 1
diff changeset
310 </font>
tatsuki
parents: 1
diff changeset
311 </div>
1
tatsuki
parents:
diff changeset
312
2
tatsuki
parents: 1
diff changeset
313 <div>
tatsuki
parents: 1
diff changeset
314 <h1>roleIdsのフィルター</h1>
tatsuki
parents: 1
diff changeset
315 <font size=5>
tatsuki
parents: 1
diff changeset
316 <p>人や組織は、複数の組織に所属することが可能</p>
tatsuki
parents: 1
diff changeset
317 <p>組織に所属する際に役割が与えられる</p>
tatsuki
parents: 1
diff changeset
318 <p>例. 人が大学に所属していると、「学生」や「教授」という役割が与えられる</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
319 <p>フィルターを使うと役割を与える組織、で結果を絞り込める</p>
1
tatsuki
parents:
diff changeset
320 </font>
tatsuki
parents:
diff changeset
321 </div>
tatsuki
parents:
diff changeset
322
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
323 <!--
1
tatsuki
parents:
diff changeset
324 <div>
2
tatsuki
parents: 1
diff changeset
325 <h1>roleIdsのコード</h1>
1
tatsuki
parents:
diff changeset
326 <font size=5>
2
tatsuki
parents: 1
diff changeset
327 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
tatsuki
parents: 1
diff changeset
328 &nbsp;&nbsp;JungleTree&nbsp;personTree&nbsp;=&nbsp;getTree(version,&nbsp;"Person");<br>
tatsuki
parents: 1
diff changeset
329 </div>
tatsuki
parents: 1
diff changeset
330 <p>maTrixは組織構造を版管理している</p>
tatsuki
parents: 1
diff changeset
331 <p>getTree(String Version, String TreeName)は、VersionとTreeNameで指定された木を返す</p>
tatsuki
parents: 1
diff changeset
332 <p>今回はroleIdsの引数で指定されたversionの人物Treeを取得している</p>
tatsuki
parents: 1
diff changeset
333 </font>
tatsuki
parents: 1
diff changeset
334 </div>
tatsuki
parents: 1
diff changeset
335
tatsuki
parents: 1
diff changeset
336 <div>
tatsuki
parents: 1
diff changeset
337 <h1>roleIdsのコード</h1>
tatsuki
parents: 1
diff changeset
338 <font size=5>
tatsuki
parents: 1
diff changeset
339 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
tatsuki
parents: 1
diff changeset
340 &nbsp;&nbsp;InterfaceTraverser&nbsp;traverser&nbsp;=&nbsp;personTree.getTraverser(useIndex);<br>
tatsuki
parents: 1
diff changeset
341 &nbsp;&nbsp;Iterator&lt;TreeNode&gt;&nbsp;personNodeIterator&nbsp;=&nbsp;traverser.find((TreeNode&nbsp;node)&nbsp;-&gt;&nbsp;{<br>
tatsuki
parents: 1
diff changeset
342 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;nodeId&nbsp;=&nbsp;node.getAttributes().getString("Person-id");<br>
tatsuki
parents: 1
diff changeset
343 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(nodeId.equals(id))<br>
tatsuki
parents: 1
diff changeset
344 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;<br>
tatsuki
parents: 1
diff changeset
345 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;<br>
tatsuki
parents: 1
diff changeset
346 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;"Person-id",&nbsp;id);<br>
tatsuki
parents: 1
diff changeset
347 </div>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
348 <p>getTreeで取得した木から、getTraverserで木を探索する機能を持ったTraverserを取得する</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
349 <p>取得したTraverser.findで、属性名 Person-id、属性値 引数で指定されたidのペアを持つノードを検索する</p>
2
tatsuki
parents: 1
diff changeset
350 </font>
tatsuki
parents: 1
diff changeset
351 </div>
tatsuki
parents: 1
diff changeset
352
tatsuki
parents: 1
diff changeset
353
tatsuki
parents: 1
diff changeset
354 <div>
tatsuki
parents: 1
diff changeset
355 <h1>roleIdsのコード</h1>
tatsuki
parents: 1
diff changeset
356 <font size=5>
tatsuki
parents: 1
diff changeset
357 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
tatsuki
parents: 1
diff changeset
358 TreeNode PersonNode = personNodeIterator.next();<br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
359 TreeNode rolesNode = PersonNode.getChildren().at(5);<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
360 Iterator&lt;TreeNode&gt; roleIterator = rolesNode.getChildren().iterator();<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
361 return new Iterator&lt;String&gt;() {<br>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
362 ………<BR>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
363 };
2
tatsuki
parents: 1
diff changeset
364 </div>
tatsuki
parents: 1
diff changeset
365 <p>findで取得したノードから、その人が持っている役割を持つノードのIteratorを取得する</p>
tatsuki
parents: 1
diff changeset
366 <p>idを持っているノードの5番目の子供の下に役割のデータが格納されている</p>
tatsuki
parents: 1
diff changeset
367 <p>なので、PersonNode.getChildren().at(5).b();で5番目の子供を取得</p>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
368 <p>その下に役割のデータが入ったノードがあるので、子供のiteratorを取得する</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
369 <p>検索条件にあった役割を返すiteratorを定義する</p>
2
tatsuki
parents: 1
diff changeset
370 </font>
tatsuki
parents: 1
diff changeset
371 </div>
tatsuki
parents: 1
diff changeset
372
tatsuki
parents: 1
diff changeset
373 <div>
tatsuki
parents: 1
diff changeset
374 <h1>roleIdsのコード</h1>
tatsuki
parents: 1
diff changeset
375 <font size=5>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
376 <p>定義したiteratorのhasNext</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
377 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
378 public boolean hasNext() {<br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
379 &nbsp;&nbsp;if (roleIterator.hasNext())<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
380 &nbsp;&nbsp;&nbsp;&nbsp;roleId = search();<br>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
381 &nbsp;&nbsp;else<br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
382 &nbsp;&nbsp;&nbsp;&nbsp;roleId = null;<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
383 &nbsp;&nbsp;if (roleId != null)<br>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
384 &nbsp;&nbsp;&nbsp;&nbsp;return true;<br>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
385 &nbsp;&nbsp;return false;<br>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
386 }<br>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
387 </div>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
388 <p>取得した役割のIteratorの中身がある場合はsearch()を実行する</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
389 <p>search()は条件にあった役割を返す</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
390 <p>中身がない場合はroleId = nullを行う</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
391 <p>roleIdがnullの場合、条件にあった役割は無いのでfalseを返し</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
392 <p>roleIdに値がある場合はtrueを返す</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
393 <p>next()では、roleIdの値を返せば良い</p>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
394 </font>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
395 </div>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
396
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
397
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
398
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
399 <div>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
400 <h1>roleIdsのコード</h1>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
401 <font size=5>
2
tatsuki
parents: 1
diff changeset
402 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
403 for&nbsp;(;&nbsp;roleIterator.hasNext();&nbsp;)&nbsp;{<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
404 &nbsp;&nbsp;TreeNode&nbsp;roleNode&nbsp;=&nbsp;roleIterator.next();<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
405 &nbsp;&nbsp;TreeNode&nbsp;organizationNode&nbsp;=&nbsp;roleNode.getChildren().at(0).b();<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
406 &nbsp;&nbsp;String&nbsp;organizationId&nbsp;=&nbsp;organizationNode.getAttributes().getString("text-organizationRefId");<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
407 &nbsp;&nbsp;if&nbsp;(!filterIds.contains(organizationId)&nbsp;&&&nbsp;!filterIds.isEmpty())<br>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
408 &nbsp;&nbsp;&nbsp;&nbsp;continue;<br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
409 &nbsp;&nbsp;TreeNode&nbsp;roleIdNode&nbsp;=&nbsp;roleNode.getChildren().at(1).b();<br>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
410 &nbsp;&nbsp;return&nbsp;roleIdNode.getAttributes().getString("text-roleRefId");<br>
2
tatsuki
parents: 1
diff changeset
411 }<br>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
412 return null;
2
tatsuki
parents: 1
diff changeset
413 </div>
tatsuki
parents: 1
diff changeset
414 <p>役割のデータが入ったノードのiteratorをfor文で回して役割を取得する</p>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
415 <p>iteratorで取得できるノードの0番目の子供には役割を与える組織idが</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
416 <p>1番目のノードには与えられる役割idを保持している</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
417 <p>0番目の子供から組織idを取得し検索結果の絞込を行う</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
418 <p>その後1番目のノードから役割idを返す</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
419 <p>役割のノードのiteratorが空になったら、nullを返す</p>
1
tatsuki
parents:
diff changeset
420 </font>
tatsuki
parents:
diff changeset
421 </div>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
422 -->
1
tatsuki
parents:
diff changeset
423
tatsuki
parents:
diff changeset
424 <div>
tatsuki
parents:
diff changeset
425 <font size=5>
tatsuki
parents:
diff changeset
426 <h1>木構造の親を辿るQuery</h1>
2
tatsuki
parents: 1
diff changeset
427 <p>maTrixで許認可を判断する際に、木構造の親を辿る検索が必要になる場合がある</p>
1
tatsuki
parents:
diff changeset
428 <p>以下に親を辿る検索を行う例を記す</p>
tatsuki
parents:
diff changeset
429 <ol>
tatsuki
parents:
diff changeset
430 <li>Aさんが、maTrixに工学部の学生にのみ貸出を行っている書籍の貸出許可を求める</li>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
431 <li>maTrixは、書籍の貸出許可を与えるかを判断するためのポリシーファイルを参照する</li>
1
tatsuki
parents:
diff changeset
432 <li>Aさんの所属している組織の情報を取得する(情報工学科)</li>
tatsuki
parents:
diff changeset
433 <li>情報工学科の親の情報を取得する(工学部)</li>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
434 <li>maTrixは、Aさんは工学部に所属しているため本の貸出を許可する</li>
1
tatsuki
parents:
diff changeset
435 </ol>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
436 <p>4番目の処理で親ノードを辿る処理を行っています</p>
2
tatsuki
parents: 1
diff changeset
437 </font>
tatsuki
parents: 1
diff changeset
438 </div>
tatsuki
parents: 1
diff changeset
439
tatsuki
parents: 1
diff changeset
440
tatsuki
parents: 1
diff changeset
441 <div>
tatsuki
parents: 1
diff changeset
442 <h1>親を辿るQueryのコード</h1>
tatsuki
parents: 1
diff changeset
443 <font size=5>
tatsuki
parents: 1
diff changeset
444 <p>以下に親の取得を行う部分のコードを記述する</p>
tatsuki
parents: 1
diff changeset
445 <p>idには工学部のidが、orgNodeにはAさんが所属している組織のidを持ったノードが入っている</p>
tatsuki
parents: 1
diff changeset
446 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
447 while(true) {<br>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
448 &nbsp;&nbsp;String orgId = orgNode.getAttributes().getString("Organization-id");<br>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
449 &nbsp;&nbsp;if (id.equals(orgId))<br>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
450 &nbsp;&nbsp;&nbsp;&nbsp;return true;<br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
451 &nbsp;&nbsp;Optional&lt;TreeNode&gt; parentOrgNodeOptional = parentIndex.get(orgNode);<br>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
452 &nbsp;&nbsp;if (parentOrgNodeOptional.isPresent())<br>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
453 &nbsp;&nbsp;&nbsp;&nbsp;orgNode = parentOrgNodeOptional.get();<br>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
454 &nbsp;&nbsp;else<br>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
455 &nbsp;&nbsp;&nbsp;&nbsp;return false;<br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
456 }<br>
2
tatsuki
parents: 1
diff changeset
457 </div>
tatsuki
parents: 1
diff changeset
458 <ol>
tatsuki
parents: 1
diff changeset
459 <li>orgNodeから組織のidを取得する</li>
tatsuki
parents: 1
diff changeset
460 <li>idと取得した組織のidを比較する</li>
tatsuki
parents: 1
diff changeset
461 <li>一致した場合はtrueを、しなかった場合はorgNodeの親を取得する</li>
tatsuki
parents: 1
diff changeset
462 </ol>
tatsuki
parents: 1
diff changeset
463 <p>以上の処理を取得できる親ノードが無くなるまで行う</p>
tatsuki
parents: 1
diff changeset
464 </font>
tatsuki
parents: 1
diff changeset
465 </div>
tatsuki
parents: 1
diff changeset
466
tatsuki
parents: 1
diff changeset
467 <div>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
468 <h1>ポリシーファイルのインタプリタ</h1>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
469 <font size=5>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
470 <p>maTrixのポリシーファイルを読み込んで許認可を判断するインタプリタの実装を行った</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
471 <p>引数にポリシーファイルと、誰が(subject)、何に(Resource)、どうするか(Action)を取る</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
472 <p>返り値は、許可(Permit) or 拒否(Deny)がある</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
473 <p>実際にJungleの上で許認可判断が行えるようになった</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
474 </font>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
475 </div>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
476
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
477
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
478 <div>
2
tatsuki
parents: 1
diff changeset
479 <h1>ベンチマーク</h1>
tatsuki
parents: 1
diff changeset
480 <font size=5>
tatsuki
parents: 1
diff changeset
481 <p>Jungle上にmaTrixの実装を行ったので、性能測定を行った</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
482 <p>測定はmongoDBとの比較とマルチプロセッサー上での性能評価の2つを行った</p>
2
tatsuki
parents: 1
diff changeset
483 <p>木構造をそのまま格納できること、属性名を指定することで属性値が取得できるなど、Jungleと似た特徴を持っているmongoDBを比較対象に選択した</p>
tatsuki
parents: 1
diff changeset
484 </font>
tatsuki
parents: 1
diff changeset
485 </div>
tatsuki
parents: 1
diff changeset
486
tatsuki
parents: 1
diff changeset
487 <div>
tatsuki
parents: 1
diff changeset
488 <h1>測定環境</h1>
tatsuki
parents: 1
diff changeset
489 <font size=5>
tatsuki
parents: 1
diff changeset
490 <p>今回の測定は以下の環境で行った</p>
tatsuki
parents: 1
diff changeset
491 <li>Mac OS X 10.10.2</li>
tatsuki
parents: 1
diff changeset
492 <li>2*2.66 GHz 6-Core Intel Xeon</li>
tatsuki
parents: 1
diff changeset
493 <li>Memory 16GB 1333MHz DDR3</li>
tatsuki
parents: 1
diff changeset
494 <li>java 1.8.0-45</li>
tatsuki
parents: 1
diff changeset
495 <li>mongoDB 3.0.2</li>
tatsuki
parents: 1
diff changeset
496 <li>javascript V8JavaScriptengine</li>
1
tatsuki
parents:
diff changeset
497 </font>
tatsuki
parents:
diff changeset
498 </div>
tatsuki
parents:
diff changeset
499
tatsuki
parents:
diff changeset
500
tatsuki
parents:
diff changeset
501 <div>
2
tatsuki
parents: 1
diff changeset
502 <h1>mongoDBとの比較</h1>
1
tatsuki
parents:
diff changeset
503 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
504 <p>1万個のデータをmongoDBとJungleに格納し、データの検索にかかる時間の測定を行った</p>
2
tatsuki
parents: 1
diff changeset
505 <p>各DBに挿入するデータは以下のような構造を持つ</p>
tatsuki
parents: 1
diff changeset
506 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
507 {PersonId: 固有のPersonId ,roleId:ランダムな役割Id}<br>
2
tatsuki
parents: 1
diff changeset
508 </div>
tatsuki
parents: 1
diff changeset
509 </font>
tatsuki
parents: 1
diff changeset
510 </div>
tatsuki
parents: 1
diff changeset
511
tatsuki
parents: 1
diff changeset
512 <div>
tatsuki
parents: 1
diff changeset
513 <h1>mongoDBとの比較</h1>
tatsuki
parents: 1
diff changeset
514 <font size=5>
tatsuki
parents: 1
diff changeset
515 <p>mongoDBでのデータの読み込みは以下のように行った</p>
tatsuki
parents: 1
diff changeset
516 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
tatsuki
parents: 1
diff changeset
517 &nbsp;&nbsp;var personData = db.person1.find({PersonId:"p:9"}).next();<br>
tatsuki
parents: 1
diff changeset
518 &nbsp;&nbsp;var roleId = personData.roleId<br>
tatsuki
parents: 1
diff changeset
519 </div>
tatsuki
parents: 1
diff changeset
520 <p>dbからpersonIdがp:9のuserを取得する</p>
tatsuki
parents: 1
diff changeset
521 <p>取得したuserのroleIdを取得する</p>
tatsuki
parents: 1
diff changeset
522 </font>
tatsuki
parents: 1
diff changeset
523 </div>
tatsuki
parents: 1
diff changeset
524
tatsuki
parents: 1
diff changeset
525 <div>
tatsuki
parents: 1
diff changeset
526 <h1>mongoDBとの比較</h1>
tatsuki
parents: 1
diff changeset
527 <font size=5>
tatsuki
parents: 1
diff changeset
528 <p>Jungleのデータの読み込みは以下のように行った</p>
tatsuki
parents: 1
diff changeset
529 <div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333;">
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
530 InterfaceTraverser traverser = tree.getTraverser(true);<br>
2
tatsuki
parents: 1
diff changeset
531 &nbsp;&nbsp;Iterator&lt;TreeNode&gt;&nbsp;it&nbsp;=&nbsp;traverser.find((TreeNode&nbsp;node)&nbsp;-&gt;&nbsp;{<br>
tatsuki
parents: 1
diff changeset
532 &nbsp;&nbsp;String&nbsp;nodeId&nbsp;=&nbsp;node.getAttributes().getString("Person-id");<br>
tatsuki
parents: 1
diff changeset
533 &nbsp;&nbsp;if&nbsp;(nodeId.equals("p:9"))<br>
tatsuki
parents: 1
diff changeset
534 &nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;<br>
tatsuki
parents: 1
diff changeset
535 &nbsp;&nbsp;return&nbsp;false;<br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
536 },&nbsp;"Person-id",&nbsp;"p:9");<br>
2
tatsuki
parents: 1
diff changeset
537 if (it.hasNext()) {<br>
tatsuki
parents: 1
diff changeset
538 &nbsp;&nbsp;TreeNode targetNode = it.next();<br>
tatsuki
parents: 1
diff changeset
539 &nbsp;&nbsp;String targetRoleId = targetNode.getAttributes().getString("roleId");<br>
tatsuki
parents: 1
diff changeset
540 }<br>
tatsuki
parents: 1
diff changeset
541 </div><br>
tatsuki
parents: 1
diff changeset
542 <p>TreeからpersonIdがp:9のノードを取得する</p>
tatsuki
parents: 1
diff changeset
543 <p>取得したノードからroleIdを取得する</p>
1
tatsuki
parents:
diff changeset
544 </font>
tatsuki
parents:
diff changeset
545 </div>
tatsuki
parents:
diff changeset
546
tatsuki
parents:
diff changeset
547 <div>
2
tatsuki
parents: 1
diff changeset
548 <h1>mongoDBとの比較</h1>
tatsuki
parents: 1
diff changeset
549 <embed src="images/mongoJungleperfomance.svg" width="700" height="700" align="left"/>
1
tatsuki
parents:
diff changeset
550 <font size=5>
2
tatsuki
parents: 1
diff changeset
551 <br>
tatsuki
parents: 1
diff changeset
552 <p>Jungleの方がmongoDBより高速で動いた理由として、<br>通信の有無が大きい</p>
tatsuki
parents: 1
diff changeset
553 <p>mongoDBはMongoShellからデータベースにアクセスする際に<br>通信を行っている</p>
tatsuki
parents: 1
diff changeset
554 <p>それに対しJungleは、通信を行わないため高速に動作する</p>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
555 <p>データへのアクセスもmongoDBは<br>ディスクにあるデータに対しmmapを用いて行う</p>
2
tatsuki
parents: 1
diff changeset
556 <p>Jungleは初めからメモリにあるデータにアクセスする</p>
tatsuki
parents: 1
diff changeset
557 <p>その部分も差が出た理由の1つである</p>
tatsuki
parents: 1
diff changeset
558 <p>その結果JungleはmongoDBの約500倍の性能が出ている</p>
1
tatsuki
parents:
diff changeset
559 </font>
tatsuki
parents:
diff changeset
560 </div>
tatsuki
parents:
diff changeset
561
tatsuki
parents:
diff changeset
562 <div>
2
tatsuki
parents: 1
diff changeset
563 <h1>マルチプロセッサー上でのJungleの読み書き性能</h1>
1
tatsuki
parents:
diff changeset
564 <font size=5>
2
tatsuki
parents: 1
diff changeset
565 <p>Jungleがマルチプロセッサ上で性能が出るか測定を行った</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
566 <p>複数スレッドからJungleに読み込みだけを行った場合と、1スレッドだけ書き込みを行い続け、<br>残りのスレッドで読み込み行った場合で測定を行った</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
567 <p>Jungleに格納したデータはmaTrixで実際に使われているユーザーデータ400人分</p>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
568 <p>読み込みではmaTrixで実際に使われている検索関数isActive(personId , version)を用いた</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
569 <p>この関数引数で与えた人が、maTrixにアカウントを持っているか調べる関数である</p>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
570 </font>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
571 </div>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
572
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
573 <div>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
574 <h1>マルチプロセッサー上でのJungleの読み書き性能</h1>
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
575 <font size=5>
2
tatsuki
parents: 1
diff changeset
576 <embed src="images/transactionPersecond.svg" width="700" height="700"align="left"/>
tatsuki
parents: 1
diff changeset
577 <br>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
578 <p>Jungleでは、書き込みと読み込みを同時に行っても<br>ほぼ性能低下はおこらなかった</p>
2
tatsuki
parents: 1
diff changeset
579 <p>ハイパースレッディングに引っかかるまでは<br>リニアに性能が出ている</p>
tatsuki
parents: 1
diff changeset
580 <p>書き込みと読み込みを同時に行った場合、<br>読み込みのCPUCOUNTが2の時だけ性能が出ていない</p>
tatsuki
parents: 1
diff changeset
581 <p>これは、書き込みを連続で行っているため<br>読み込みと書き込みで競合が起きている</p>
tatsuki
parents: 1
diff changeset
582 <p>しかし読み込みのスレッドが増えると<br>読み込みが優先されるので性能が出るようになっている</p>
tatsuki
parents: 1
diff changeset
583 <p>読み込みと書き込み同時に行っている方が<br>CPUCOUNT11で性能上昇が止まっているのは<br>書き込みに1スレッド使用しているからである</p>
tatsuki
parents: 1
diff changeset
584 </font>
tatsuki
parents: 1
diff changeset
585 </div>
tatsuki
parents: 1
diff changeset
586
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
587 <div>
2
tatsuki
parents: 1
diff changeset
588 <h1>考察</h1>
tatsuki
parents: 1
diff changeset
589 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
590 <p>マルチプロセッサ上でもJungleは並列に動作する</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
591 <p>性能比較では、JungleのほうがMongoDBより高速に動いたが、全てのアプリケーションでJungleの方が早いわけではない</p>
2
tatsuki
parents: 1
diff changeset
592 <p>Jungleは、木構造の形と使われ方がアルゴリズム的に一致している場合に性能が出る</p>
tatsuki
parents: 1
diff changeset
593 </font>
tatsuki
parents: 1
diff changeset
594 </div>
tatsuki
parents: 1
diff changeset
595
tatsuki
parents: 1
diff changeset
596 <div>
tatsuki
parents: 1
diff changeset
597 <h1>Jungleに向いているアプリケーション</h1>
tatsuki
parents: 1
diff changeset
598 <font size=5>
tatsuki
parents: 1
diff changeset
599 <p>Jungleは、書き込み時の処理が木の大きさで変わる</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
600 <p>そのため、比較的小さな木がたくさんあり、木の深い部分に対し変更があまり行われないアプリケーションが得意</p>
2
tatsuki
parents: 1
diff changeset
601 <p>また、書き込みより読み込みを重視したDBであるため、読み込みが多いアプリケーションが性能が出る</p>
tatsuki
parents: 1
diff changeset
602 <p>そのため、Jungleの上に構築するアプリケーション例としてBBSやWEBページなどがある</p>
tatsuki
parents: 1
diff changeset
603 </font>
tatsuki
parents: 1
diff changeset
604 </div>
tatsuki
parents: 1
diff changeset
605
tatsuki
parents: 1
diff changeset
606 <div>
tatsuki
parents: 1
diff changeset
607 <h1>Jungleに不向きなアプリケーション</h1>
tatsuki
parents: 1
diff changeset
608 <font size=5>
tatsuki
parents: 1
diff changeset
609 <p>逆に、1つの大きな木に対し変更が頻繁に行われるようなアプリケーションは向いていない</p>
tatsuki
parents: 1
diff changeset
610 <p>そういった場合、木を分割して複数の小さな木にすることで性能を上げることは可能である</p>
tatsuki
parents: 1
diff changeset
611 <p>しかし、木を分割するための設計手法がまだ無いので、設計手法の確立は今後の課題である</p>
1
tatsuki
parents:
diff changeset
612 </font>
tatsuki
parents:
diff changeset
613 </div>
tatsuki
parents:
diff changeset
614
tatsuki
parents:
diff changeset
615
tatsuki
parents:
diff changeset
616 <div>
2
tatsuki
parents: 1
diff changeset
617 <h1>今後の課題</h1>
1
tatsuki
parents:
diff changeset
618 <font size=5>
2
tatsuki
parents: 1
diff changeset
619 <p>1. RDBとの比較</p>
tatsuki
parents: 1
diff changeset
620 <p>&nbsp;&nbsp;もともとmaTrixはRDB上で動いているアプリケーションなので、RDB版maTrixとの性能測定を行いたい</p>
tatsuki
parents: 1
diff changeset
621 <p>2.データの書き出し部分の改良</p>
tatsuki
parents: 1
diff changeset
622 <p>&nbsp;&nbsp;Jungleはデータをディスクに書き出すことが可能である</p>
tatsuki
parents: 1
diff changeset
623 <p>&nbsp;&nbsp;書きだしたデータを読み込む機能もあるのでトラブルが発生し、Jungleが強制終了されても元の状態に復旧できる</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
624 <p>&nbsp;&nbsp;今の実装は、データの書き出しは、変更が加わる度に行われるので、非効率的である</p>
2
tatsuki
parents: 1
diff changeset
625 <p>&nbsp;&nbsp;できれば複数回分の変更をバッファリングしておいて一気に書き出しを行いたい</p>
3
082148d6bf7f change slide
tatsuki
parents: 2
diff changeset
626 <p>&nbsp;&nbsp;ある値を行ったり来たりするような、書き出す必要が無いデータもあるため、書き出す部分の最適化を行う必要がある</p>
2
tatsuki
parents: 1
diff changeset
627 </font>
tatsuki
parents: 1
diff changeset
628 </div>
tatsuki
parents: 1
diff changeset
629
tatsuki
parents: 1
diff changeset
630 <div>
tatsuki
parents: 1
diff changeset
631 <h1>今後の課題</h1>
tatsuki
parents: 1
diff changeset
632 <font size=5>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
633 <p>3.メモリの効率的な利用</p>
2
tatsuki
parents: 1
diff changeset
634 <p>&nbsp;&nbsp;Jungleは非破壊でデータを保持し続けるため、非常に多くのメモリを消費する</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
635 <p>&nbsp;&nbsp;ある程度のタイミングで過去のデータをメモリから解放する必要がある</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
636 <p>&nbsp;&nbsp;しかし、データを解放するタイミングは、Jungle上に実装するアプリケーションによって変わる</p>
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
637 <p>&nbsp;&nbsp;そこを含め、データを解放するAPIの設計を行う必要がある</p>
2
tatsuki
parents: 1
diff changeset
638 <p>4.分散環境でのmaTrixの構築</p>
tatsuki
parents: 1
diff changeset
639 <p>&nbsp;&nbsp;Jungleはもともと分散データベースである</p>
tatsuki
parents: 1
diff changeset
640 <p>&nbsp;&nbsp;分散版Jungle上にmaTrixを構築し、性能測定を行いたい</p>
1
tatsuki
parents:
diff changeset
641 </font>
tatsuki
parents:
diff changeset
642 </div>
tatsuki
parents:
diff changeset
643
2
tatsuki
parents: 1
diff changeset
644
tatsuki
parents: 1
diff changeset
645 <div>
tatsuki
parents: 1
diff changeset
646 <h1>今後の課題</h1>
tatsuki
parents: 1
diff changeset
647 <font size=5>
tatsuki
parents: 1
diff changeset
648 <p>5.設計手法の確立</p>
tatsuki
parents: 1
diff changeset
649 <p>&nbsp;&nbsp;Jungleは木構造のデータをそのまま格納できる</p>
tatsuki
parents: 1
diff changeset
650 <p>&nbsp;&nbsp;木のサイズが大きいと、データ更新の負荷が大きくなるため分割を行う必要がある</p>
tatsuki
parents: 1
diff changeset
651 <p>&nbsp;&nbsp;分割を行った木同士の参照はIdを用いた間接的なものになる</p>
tatsuki
parents: 1
diff changeset
652 <p>&nbsp;&nbsp;このようにJungleはRDBと異なり格納するデータの自由度が大きい</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
653 <p>&nbsp;&nbsp;Jungleの設計手法を確立させる必要がある</p>
2
tatsuki
parents: 1
diff changeset
654 </font>
tatsuki
parents: 1
diff changeset
655 </div>
tatsuki
parents: 1
diff changeset
656
tatsuki
parents: 1
diff changeset
657 <div>
tatsuki
parents: 1
diff changeset
658 <h1>まとめ</h1>
tatsuki
parents: 1
diff changeset
659 <font size=5>
tatsuki
parents: 1
diff changeset
660 <p>当研究室で開発している非破壊的木構造データベースJungle上に許認可管理アプリケーションmaTrixを実装した</p>
tatsuki
parents: 1
diff changeset
661 <p>その際必要になった検索APIやIndexの実装を行った</p>
4
84bbcfe22656 change slide
tatsuki
parents: 3
diff changeset
662 <p>またFunctionalJavaのTreeMapでは性能が出なかったので、非破壊TreeMapを自作した</p>
2
tatsuki
parents: 1
diff changeset
663 <p>性能測定ではmongoDBより高速に動き、マルチプロセッサ上でも並列に動作した</p>
tatsuki
parents: 1
diff changeset
664 </font>
tatsuki
parents: 1
diff changeset
665 </div>
1
tatsuki
parents:
diff changeset
666 </div> <!-- presentation -->
tatsuki
parents:
diff changeset
667 </body>
tatsuki
parents:
diff changeset
668 </html>