Browse Source

added extra context tot data

Taco 1 year ago
parent
commit
faec1db233
3 changed files with 393 additions and 110 deletions
  1. 33 3
      diff.xml
  2. 272 88
      entitlements.html
  3. 88 19
      entitlements.org

+ 33 - 3
diff.xml

@@ -2,7 +2,7 @@
2 2
 <result>
3 3
   <request>
4 4
     <application>decodeapp:facebook</application>
5
-    <contextType>0</contextType>
5
+    <contextType>5</contextType>
6 6
     <required>
7 7
       <property>decode:name</property>
8 8
       <property>decode:email</property>
@@ -24,7 +24,7 @@
24 24
       <except/>
25 25
     </diff>
26 26
     <diff>
27
-      <contextName>professional</contextName>
27
+      <contextName>Waag society</contextName>
28 28
       <intersect>
29 29
         <property>decode:name</property>
30 30
         <property>decode:email</property>
@@ -34,10 +34,22 @@
34 34
         <property>decode:phone</property>
35 35
       </except>
36 36
     </diff>
37
+    <diff>
38
+      <contextName>Dyne</contextName>
39
+      <intersect>
40
+        <property>decode:name</property>
41
+        <property>decode:email</property>
42
+      </intersect>
43
+      <except>
44
+        <property>decode:address</property>
45
+        <property>decode:phone</property>
46
+      </except>
47
+    </diff>
37 48
   </diffs>
38 49
   <profile>
39 50
     <contextObj>
40 51
       <contextName>personal</contextName>
52
+      <contextType>5</contextType>
41 53
       <plSum>7</plSum>
42 54
       <properties>
43 55
         <property>
@@ -63,7 +75,8 @@
63 75
       </properties>
64 76
     </contextObj>
65 77
     <contextObj>
66
-      <contextName>professional</contextName>
78
+      <contextName>Waag society</contextName>
79
+      <contextType>2</contextType>
67 80
       <plSum>4</plSum>
68 81
       <properties>
69 82
         <property>
@@ -83,5 +96,22 @@
83 96
         </property>
84 97
       </properties>
85 98
     </contextObj>
99
+    <contextObj>
100
+      <contextName>Dyne</contextName>
101
+      <contextType>2</contextType>
102
+      <plSum>3</plSum>
103
+      <properties>
104
+        <property>
105
+          <type>decode:name</type>
106
+          <value>Ocat</value>
107
+          <pl>1</pl>
108
+        </property>
109
+        <property>
110
+          <type>decode:email</type>
111
+          <value>taco@gogs.dyne.org</value>
112
+          <pl>2</pl>
113
+        </property>
114
+      </properties>
115
+    </contextObj>
86 116
   </profile>
87 117
 </result>

+ 272 - 88
entitlements.html

@@ -3,7 +3,7 @@
3 3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5 5
 <head>
6
-<!-- 2018-04-06 Fri 16:25 -->
6
+<!-- 2018-04-06 Fri 17:22 -->
7 7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8 8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
9 9
 <title>&lrm;</title>
@@ -234,45 +234,45 @@ for the JavaScript code in this tag.
234 234
 <h2>Table of Contents</h2>
235 235
 <div id="text-table-of-contents">
236 236
 <ul>
237
-<li><a href="#orgdb176e6">1. Introduction</a></li>
238
-<li><a href="#org733e1aa">2. Data Model</a>
237
+<li><a href="#orgf028445">1. Introduction</a></li>
238
+<li><a href="#orgcad91ad">2. Data Model</a>
239 239
 <ul>
240
-<li><a href="#orgae8725d">2.1. Example wallet profile</a>
240
+<li><a href="#org63ebda6">2.1. Example wallet profile</a>
241 241
 <ul>
242
-<li><a href="#org998aa04">2.1.1. Things to further investigate</a></li>
242
+<li><a href="#org6c6b85a">2.1.1. Things to further investigate</a></li>
243 243
 </ul>
244 244
 </li>
245
-<li><a href="#org0f1aa15">2.2. Example request</a>
245
+<li><a href="#org0aa5864">2.2. Example request</a>
246 246
 <ul>
247
-<li><a href="#org5767244">2.2.1. Things to further investigate</a></li>
247
+<li><a href="#org6aefbaa">2.2.1. Things to further investigate</a></li>
248 248
 </ul>
249 249
 </li>
250 250
 </ul>
251 251
 </li>
252
-<li><a href="#orgf88b6fa">3. Data Comparison</a>
252
+<li><a href="#org6ccc64f">3. Data Comparison</a>
253 253
 <ul>
254 254
 <li>
255 255
 <ul>
256
-<li><a href="#org1ea58b1">3.0.1. Things to further investigate</a></li>
256
+<li><a href="#org7fbac77">3.0.1. Things to further investigate</a></li>
257 257
 </ul>
258 258
 </li>
259 259
 </ul>
260 260
 </li>
261
-<li><a href="#orgc346fdb">4. Visualization</a>
261
+<li><a href="#org065a5b0">4. Visualization</a>
262 262
 <ul>
263
-<li><a href="#org428a791">4.1. Request</a></li>
264
-<li><a href="#org5e2cb1e">4.2. Contexts</a>
263
+<li><a href="#orge8089d8">4.1. Request</a></li>
264
+<li><a href="#org48ef283">4.2. Contexts</a>
265 265
 <ul>
266
-<li><a href="#orgd9d5835">4.2.1. Things to further investigate</a></li>
266
+<li><a href="#org7551d85">4.2.1. Things to further investigate</a></li>
267 267
 </ul>
268 268
 </li>
269 269
 </ul>
270 270
 </li>
271
-<li><a href="#org7cb73b5">5. Interaction</a>
271
+<li><a href="#orge46c738">5. Interaction</a>
272 272
 <ul>
273 273
 <li>
274 274
 <ul>
275
-<li><a href="#org2fae9f9">5.0.1. Things to further investigate</a></li>
275
+<li><a href="#orgff14b8e">5.0.1. Things to further investigate</a></li>
276 276
 </ul>
277 277
 </li>
278 278
 </ul>
@@ -280,8 +280,8 @@ for the JavaScript code in this tag.
280 280
 </ul>
281 281
 </div>
282 282
 </div>
283
-<div id="outline-container-orgdb176e6" class="outline-2">
284
-<h2 id="orgdb176e6"><span class="section-number-2">1</span> Introduction</h2>
283
+<div id="outline-container-orgf028445" class="outline-2">
284
+<h2 id="orgf028445"><span class="section-number-2">1</span> Introduction</h2>
285 285
 <div class="outline-text-2" id="text-1">
286 286
 <p>
287 287
 The purpose of this document is to investigate possible User Interaction designs for Decode task 4.4.
@@ -315,12 +315,12 @@ A preliminary definition of context types
315 315
 </div>
316 316
 </div>
317 317
 
318
-<div id="outline-container-org733e1aa" class="outline-2">
319
-<h2 id="org733e1aa"><span class="section-number-2">2</span> Data Model</h2>
318
+<div id="outline-container-orgcad91ad" class="outline-2">
319
+<h2 id="orgcad91ad"><span class="section-number-2">2</span> Data Model</h2>
320 320
 <div class="outline-text-2" id="text-2">
321 321
 </div>
322
-<div id="outline-container-orgae8725d" class="outline-3">
323
-<h3 id="orgae8725d"><span class="section-number-3">2.1</span> Example wallet profile</h3>
322
+<div id="outline-container-org63ebda6" class="outline-3">
323
+<h3 id="org63ebda6"><span class="section-number-3">2.1</span> Example wallet profile</h3>
324 324
 <div class="outline-text-3" id="text-2-1">
325 325
 <p>
326 326
 This sample wallet profile datastructure consists of multiple contexts.
@@ -339,11 +339,12 @@ It overrides the default privacy level specified by the property type.
339 339
 </p>
340 340
 
341 341
 <div class="org-src-container">
342
-<pre class="src src-js" id="orgccb09d3"><span style="color: #4f97d7; font-weight: bold;">var</span> <span style="color: #7590db;">profile</span> = <span style="color: #4f97d7;">{</span>
342
+<pre class="src src-js" id="orgf704401"><span style="color: #4f97d7; font-weight: bold;">var</span> <span style="color: #7590db;">profile</span> = <span style="color: #4f97d7;">{</span>
343 343
     contexts : 
344 344
     <span style="color: #bc6ec5;">[</span>
345 345
         <span style="color: #2d9574;">{</span>
346 346
            title : <span style="color: #2d9574;">"personal"</span>,
347
+           context_type : <span style="color: #a45bad;">5</span>,<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">PERSONAL</span>
347 348
             properties : 
348 349
             <span style="color: #67b11d;">[</span>
349 350
                 <span style="color: #b1951d;">{</span>
@@ -370,7 +371,8 @@ It overrides the default privacy level specified by the property type.
370 371
             pl_sum: <span style="color: #a45bad;">7</span> <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">this is a calculated value based on the attributed pl values or default if they were not user specified</span>
371 372
         <span style="color: #2d9574;">}</span>,
372 373
         <span style="color: #2d9574;">{</span>
373
-            title: <span style="color: #2d9574;">"professional"</span>,
374
+            title: <span style="color: #2d9574;">"Waag society"</span>,
375
+            context_type: <span style="color: #a45bad;">2</span>,<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">WORK</span>
374 376
             properties : 
375 377
             <span style="color: #67b11d;">[</span>
376 378
                 <span style="color: #b1951d;">{</span>
@@ -390,6 +392,22 @@ It overrides the default privacy level specified by the property type.
390 392
                 <span style="color: #b1951d;">}</span>
391 393
             <span style="color: #67b11d;">]</span>,
392 394
             pl_sum: <span style="color: #a45bad;">4</span>
395
+        <span style="color: #2d9574;">}</span>,
396
+        <span style="color: #2d9574;">{</span>
397
+          title: <span style="color: #2d9574;">"Dyne"</span>,
398
+          context_type: <span style="color: #a45bad;">2</span>,<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">WORK</span>
399
+          properties :<span style="color: #67b11d;">[</span><span style="color: #b1951d;">{</span>
400
+             type : <span style="color: #2d9574;">"decode:name"</span>,
401
+             value : <span style="color: #2d9574;">"Ocat"</span>,
402
+             pl: <span style="color: #a45bad;">1</span>
403
+             <span style="color: #b1951d;">}</span>,
404
+             <span style="color: #b1951d;">{</span>
405
+               type : <span style="color: #2d9574;">"decode:email"</span>,
406
+               value: <span style="color: #2d9574;">"taco@gogs.dyne.org"</span>,
407
+               pl: <span style="color: #a45bad;">2</span>
408
+             <span style="color: #b1951d;">}</span>
409
+          <span style="color: #67b11d;">]</span>,
410
+          pl_sum: <span style="color: #a45bad;">3</span>
393 411
         <span style="color: #2d9574;">}</span>
394 412
     <span style="color: #bc6ec5;">]</span>
395 413
 <span style="color: #4f97d7;">}</span>;
@@ -398,8 +416,8 @@ process.stdout.write<span style="color: #4f97d7;">(</span>JSON.stringify<span st
398 416
 </div>
399 417
 </div>
400 418
 
401
-<div id="outline-container-org998aa04" class="outline-4">
402
-<h4 id="org998aa04"><span class="section-number-4">2.1.1</span> Things to further investigate</h4>
419
+<div id="outline-container-org6c6b85a" class="outline-4">
420
+<h4 id="org6c6b85a"><span class="section-number-4">2.1.1</span> Things to further investigate</h4>
403 421
 <div class="outline-text-4" id="text-2-1-1">
404 422
 <ul class="org-ul">
405 423
 <li>Apply default weights to each property type, these can be overridden by attributing a privacy level to the property</li>
@@ -411,8 +429,8 @@ process.stdout.write<span style="color: #4f97d7;">(</span>JSON.stringify<span st
411 429
 </div>
412 430
 </div>
413 431
 
414
-<div id="outline-container-org0f1aa15" class="outline-3">
415
-<h3 id="org0f1aa15"><span class="section-number-3">2.2</span> Example request</h3>
432
+<div id="outline-container-org0aa5864" class="outline-3">
433
+<h3 id="org0aa5864"><span class="section-number-3">2.2</span> Example request</h3>
416 434
 <div class="outline-text-3" id="text-2-2">
417 435
 <p>
418 436
 This sample application request consists of an application name, a set of required property types and a set of optional property types.
@@ -422,9 +440,9 @@ and the cumulative privacy weight by adding the privacy levels of each property
422 440
 </p>
423 441
 
424 442
 <div class="org-src-container">
425
-<pre class="src src-js" id="org697a49e"><span style="color: #4f97d7; font-weight: bold;">var</span> <span style="color: #7590db;">request</span> = <span style="color: #4f97d7;">{</span>
443
+<pre class="src src-js" id="orgfe0255c"><span style="color: #4f97d7; font-weight: bold;">var</span> <span style="color: #7590db;">request</span> = <span style="color: #4f97d7;">{</span>
426 444
     application : <span style="color: #2d9574;">"decodeapp:facebook"</span>,
427
-    context_type : <span style="color: #a45bad;">0</span>,<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">personal</span>
445
+    context_type : <span style="color: #a45bad;">5</span>,<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">personal</span>
428 446
     required : <span style="color: #bc6ec5;">[</span><span style="color: #2d9574;">"decode:name"</span>, <span style="color: #2d9574;">"decode:email"</span>, <span style="color: #2d9574;">"decode:address"</span><span style="color: #bc6ec5;">]</span>,
429 447
     optional : <span style="color: #bc6ec5;">[</span><span style="color: #2d9574;">"decode:phone"</span><span style="color: #bc6ec5;">]</span>
430 448
 <span style="color: #4f97d7;">}</span>
@@ -434,8 +452,8 @@ process.stdout.write<span style="color: #4f97d7;">(</span>data<span style="color
434 452
 </div>
435 453
 </div>
436 454
 
437
-<div id="outline-container-org5767244" class="outline-4">
438
-<h4 id="org5767244"><span class="section-number-4">2.2.1</span> Things to further investigate</h4>
455
+<div id="outline-container-org6aefbaa" class="outline-4">
456
+<h4 id="org6aefbaa"><span class="section-number-4">2.2.1</span> Things to further investigate</h4>
439 457
 <div class="outline-text-4" id="text-2-2-1">
440 458
 <ul class="org-ul">
441 459
 <li>Create a generator that seeds a request with random required and optional property types</li>
@@ -447,8 +465,8 @@ process.stdout.write<span style="color: #4f97d7;">(</span>data<span style="color
447 465
 </div>
448 466
 
449 467
 
450
-<div id="outline-container-orgf88b6fa" class="outline-2">
451
-<h2 id="orgf88b6fa"><span class="section-number-2">3</span> Data Comparison</h2>
468
+<div id="outline-container-org6ccc64f" class="outline-2">
469
+<h2 id="org6ccc64f"><span class="section-number-2">3</span> Data Comparison</h2>
452 470
 <div class="outline-text-2" id="text-3">
453 471
 <p>
454 472
 During the interaction we want to give the user insight into a couple of things;
@@ -464,7 +482,7 @@ In below ruby code a comparison is made by on creating the intersection and its
464 482
 </p>
465 483
 
466 484
 <div class="org-src-container">
467
-<pre class="src src-ruby" id="org3a15b08"><span style="color: #4f97d7;">require</span> <span style="color: #2d9574;">'json'</span>
485
+<pre class="src src-ruby" id="org1288a0e"><span style="color: #4f97d7;">require</span> <span style="color: #2d9574;">'json'</span>
468 486
   <span style="color: #4f97d7;">require</span> <span style="color: #2d9574;">'nokogiri'</span> <span style="color: #2aa1ae; background-color: #292e34;">#</span><span style="color: #2aa1ae; background-color: #292e34;">for creating xml</span>
469 487
 
470 488
   request = <span style="color: #ce537a; font-weight: bold;">JSON</span>.parse<span style="color: #4f97d7;">(</span>request_data<span style="color: #4f97d7;">)</span>
@@ -485,8 +503,8 @@ In below ruby code a comparison is made by on creating the intersection and its
485 503
 </div>
486 504
 </div>
487 505
 
488
-<div id="outline-container-org1ea58b1" class="outline-4">
489
-<h4 id="org1ea58b1"><span class="section-number-4">3.0.1</span> Things to further investigate</h4>
506
+<div id="outline-container-org7fbac77" class="outline-4">
507
+<h4 id="org7fbac77"><span class="section-number-4">3.0.1</span> Things to further investigate</h4>
490 508
 <div class="outline-text-4" id="text-3-0-1">
491 509
 <ul class="org-ul">
492 510
 <li>Calculate the weight (sum of privacy levels of the properties it contains) of each context before and after giving permission</li>
@@ -505,8 +523,8 @@ request is size 3
505 523
 </div>
506 524
 </div>
507 525
 
508
-<div id="outline-container-orgc346fdb" class="outline-2">
509
-<h2 id="orgc346fdb"><span class="section-number-2">4</span> Visualization</h2>
526
+<div id="outline-container-org065a5b0" class="outline-2">
527
+<h2 id="org065a5b0"><span class="section-number-2">4</span> Visualization</h2>
510 528
 <div class="outline-text-2" id="text-4">
511 529
 <p>
512 530
 We want to visualize the following things;
@@ -525,7 +543,7 @@ Different tones within the hue can be mapped to each privacy level.
525 543
 </p>
526 544
 
527 545
 <div class="org-src-container">
528
-<pre class="src src-java" id="orgf9dcee7"><span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">color definitions</span>
546
+<pre class="src src-java" id="orgd2c28f5"><span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">color definitions</span>
529 547
 <span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">a3</span> = #<span style="color: #a45bad;">3A3B58</span>;
530 548
 <span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">b3</span> = #<span style="color: #a45bad;">734246</span>;
531 549
 <span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">d3</span> = #B4561F;
@@ -610,7 +628,7 @@ Below snippet exemplifies a color for the SELF context with a privacy level SECR
610 628
 </p>
611 629
 
612 630
 <div class="org-src-container">
613
-<pre class="src src-java" id="org103bb47"><span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">draw</span><span style="color: #4f97d7;">(){</span>
631
+<pre class="src src-java" id="org5a20965"><span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">draw</span><span style="color: #4f97d7;">(){</span>
614 632
   size<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">100</span>,<span style="color: #a45bad;">100</span><span style="color: #bc6ec5;">)</span>;
615 633
   background<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">0</span><span style="color: #bc6ec5;">)</span>;
616 634
   noStroke<span style="color: #bc6ec5;">()</span>;
@@ -715,7 +733,7 @@ void draw(){
715 733
 </script> <canvas id="ob-493b0e9920a023276fc640f0a2b7a91f2af5a827"></canvas>
716 734
 
717 735
 <div class="org-src-container">
718
-<pre class="src src-java" id="orgf9b56bd"><span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">draw</span><span style="color: #4f97d7;">(){</span>
736
+<pre class="src src-java" id="org3010b58"><span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">draw</span><span style="color: #4f97d7;">(){</span>
719 737
   size<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">100</span>,<span style="color: #a45bad;">100</span><span style="color: #bc6ec5;">)</span>;
720 738
   background<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">0</span><span style="color: #bc6ec5;">)</span>;
721 739
   noStroke<span style="color: #bc6ec5;">()</span>;
@@ -944,22 +962,21 @@ void draw()
944 962
 </script> <canvas id="ob-3265860db5d715da2187d13bc5ac96386a2d517a"></canvas>
945 963
 </div>
946 964
 
947
-<div id="outline-container-org428a791" class="outline-3">
948
-<h3 id="org428a791"><span class="section-number-3">4.1</span> Request</h3>
965
+<div id="outline-container-orge8089d8" class="outline-3">
966
+<h3 id="orge8089d8"><span class="section-number-3">4.1</span> Request</h3>
949 967
 <div class="outline-text-3" id="text-4-1">
950 968
 <div class="org-src-container">
951
-<pre class="src src-java" id="org939bc44">size<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">200</span>,<span style="color: #a45bad;">200</span><span style="color: #4f97d7;">)</span>;
969
+<pre class="src src-java" id="org6682efe">size<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">200</span>,<span style="color: #a45bad;">200</span><span style="color: #4f97d7;">)</span>;
952 970
 <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">background(0);</span>
953 971
 noFill<span style="color: #4f97d7;">()</span>;
954 972
 
955 973
 <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">the size of request is fixed for now</span>
956
-<span style="color: #ce537a; font-weight: bold;">ffloat</span> <span style="color: #7590db;">centerX</span> = width/<span style="color: #a45bad;">2</span>;
974
+<span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">centerX</span> = width/<span style="color: #a45bad;">2</span>;
957 975
 <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">centerY</span> = height/<span style="color: #a45bad;">2</span>;
958 976
 <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">rsize</span> = <span style="color: #a45bad;">55</span>;
959 977
 
960 978
 <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">color of request is mapped to the privacy type of the request, each request has one.</span>
961
-<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">INTIMATE because it's in the middle of the privacy level continuum</span>
962
-<span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">reqColor</span> = getColor<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">PrivacyLevel</span>.INTIMATE, request.contextType<span style="color: #4f97d7;">)</span>;
979
+<span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">reqColor</span> = getColor<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">PrivacyLevel</span>.PUBLIC, request.contextType<span style="color: #4f97d7;">)</span>;
963 980
 fill<span style="color: #4f97d7;">(</span>reqColor<span style="color: #4f97d7;">)</span>; 
964 981
 ellipse<span style="color: #4f97d7;">(</span>centerX, centerY, rsize, rsize<span style="color: #4f97d7;">)</span>;
965 982
 
@@ -971,7 +988,7 @@ text<span style="color: #4f97d7;">(</span>request.application, centerX, centerY
971 988
 </div>
972 989
 
973 990
 <script src="processing.js"></script>
974
- <script type="text/processing" data-processing-target="ob-b9c6fc9143eec1b3105c4ed7c212a01679fd1bf0">
991
+ <script type="text/processing" data-processing-target="ob-dffb4f15e39f84663e954fb9ee6af88f16dd15fa">
975 992
 //color definitions
976 993
 color a3 = #3A3B58;
977 994
 color b3 = #734246;
@@ -1097,13 +1114,15 @@ class Context
1097 1114
 {
1098 1115
   public String title;
1099 1116
   public int plSum;
1117
+  public int contextType;
1100 1118
   public Property[] properties;
1101 1119
 
1102
-  public Context(String title, int plSum, Property[] properties)
1120
+  public Context(String title, int plSum, int contextType, Property[] properties)
1103 1121
   {
1104 1122
     this.title = title;
1105 1123
     this.plSum = plSum;
1106 1124
     this.properties = properties;
1125
+    this.contextType = contextType;
1107 1126
   }
1108 1127
 }
1109 1128
 
@@ -1138,9 +1157,10 @@ Context[] parseProfile(XMLElement xml)
1138 1157
   for(int i = 0; i < contexts.length; i++)
1139 1158
   {
1140 1159
     String contextName = profile.getChild(i).getChild(0).getContent();
1141
-    int plSum = parseInt(profile.getChild(i).getChild(1).getContent());
1160
+    int contextType = parseInt(profile.getChild(i).getChild(1).getContent());
1161
+    int plSum = parseInt(profile.getChild(i).getChild(2).getContent());
1142 1162
 
1143
-    XMLElement propertiesEl = profile.getChild(i).getChild(2);
1163
+    XMLElement propertiesEl = profile.getChild(i).getChild(3);
1144 1164
     Property[] properties = new Property[propertiesEl.getChildCount()];
1145 1165
     for(int j = 0; j < properties.length; j++)
1146 1166
     {
@@ -1148,7 +1168,7 @@ Context[] parseProfile(XMLElement xml)
1148 1168
       properties[j] = prop;
1149 1169
     }
1150 1170
 
1151
-    Context context = new Context(contextName, plSum, properties);
1171
+    Context context = new Context(contextName, plSum, contextType, properties);
1152 1172
     contexts[i] = context;
1153 1173
   }
1154 1174
   return contexts;
@@ -1197,13 +1217,12 @@ size(200,200);
1197 1217
 noFill();
1198 1218
 
1199 1219
 //the size of request is fixed for now
1200
-ffloat centerX = width/2;
1220
+float centerX = width/2;
1201 1221
 float centerY = height/2;
1202 1222
 float rsize = 55;
1203 1223
 
1204 1224
 //color of request is mapped to the privacy type of the request, each request has one.
1205
-//INTIMATE because it's in the middle of the privacy level continuum
1206
-color reqColor = getColor(PrivacyLevel.INTIMATE, request.contextType);
1225
+color reqColor = getColor(PrivacyLevel.PUBLIC, request.contextType);
1207 1226
 fill(reqColor); 
1208 1227
 ellipse(centerX, centerY, rsize, rsize);
1209 1228
 
@@ -1211,31 +1230,151 @@ ellipse(centerX, centerY, rsize, rsize);
1211 1230
 fill(0);
1212 1231
 textAlign(CENTER,CENTER);
1213 1232
 text(request.application, centerX, centerY + rsize/1.5);
1214
-</script> <canvas id="ob-b9c6fc9143eec1b3105c4ed7c212a01679fd1bf0"></canvas>
1233
+</script> <canvas id="ob-dffb4f15e39f84663e954fb9ee6af88f16dd15fa"></canvas>
1215 1234
 </div>
1216 1235
 </div>
1217 1236
 
1218
-<div id="outline-container-org5e2cb1e" class="outline-3">
1219
-<h3 id="org5e2cb1e"><span class="section-number-3">4.2</span> Contexts</h3>
1237
+<div id="outline-container-org48ef283" class="outline-3">
1238
+<h3 id="org48ef283"><span class="section-number-3">4.2</span> Contexts</h3>
1220 1239
 <div class="outline-text-3" id="text-4-2">
1221 1240
 <p>
1222
-How do we visulize each context? Intend to do this in processing too.
1241
+We want to draw each context in relation to the request, 
1242
+so we place each context equidistant from the request in the center.
1223 1243
 </p>
1224 1244
 
1225 1245
 <div class="org-src-container">
1226
-<pre class="src src-java" id="org21eedc8"><span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">draw the difference for each context with the request</span>
1227
-size<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">200</span>,<span style="color: #a45bad;">200</span><span style="color: #4f97d7;">)</span>;
1228
-background<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">0</span><span style="color: #4f97d7;">)</span>;
1229
-noFill<span style="color: #4f97d7;">()</span>;
1230
-stroke<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">255</span><span style="color: #4f97d7;">)</span>;
1231
-ellipse<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">56</span>, <span style="color: #a45bad;">46</span>, <span style="color: #a45bad;">55</span>, <span style="color: #a45bad;">55</span><span style="color: #4f97d7;">)</span>;
1232
-text<span style="color: #4f97d7;">(</span>diffs<span style="color: #bc6ec5;">[</span><span style="color: #a45bad;">0</span><span style="color: #bc6ec5;">]</span>.context, <span style="color: #a45bad;">10</span>, <span style="color: #a45bad;">10</span><span style="color: #4f97d7;">)</span>;
1233
-text<span style="color: #4f97d7;">(</span>contexts<span style="color: #bc6ec5;">[</span><span style="color: #a45bad;">0</span><span style="color: #bc6ec5;">]</span>.properties<span style="color: #bc6ec5;">[</span><span style="color: #a45bad;">0</span><span style="color: #bc6ec5;">]</span>.value, <span style="color: #a45bad;">10</span>, <span style="color: #a45bad;">50</span><span style="color: #4f97d7;">)</span>;
1246
+<pre class="src src-java" id="orgc2de2ec"><span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">setup</span><span style="color: #4f97d7;">(){</span>
1247
+  size<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">800</span>,<span style="color: #a45bad;">800</span><span style="color: #bc6ec5;">)</span>;
1248
+  smooth<span style="color: #bc6ec5;">()</span>;
1249
+  noLoop<span style="color: #bc6ec5;">()</span>;
1250
+<span style="color: #4f97d7;">}</span>
1251
+
1252
+<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">divide the circle by the amount of contexts </span>
1253
+<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">to get the angle between the lines that indicate the center of each context</span>
1254
+<span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">eqd_angle</span> = TWO_PI / contexts.length;
1255
+
1256
+<span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">draw</span><span style="color: #4f97d7;">()</span>
1257
+<span style="color: #4f97d7;">{</span>
1258
+  <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #cc9393;">TODO</span><span style="color: #2aa1ae; background-color: #292e34;"> move draw request to a function</span>
1259
+  <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">the size of request is fixed for now</span>
1260
+  <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">centerX</span> = width/<span style="color: #a45bad;">2</span>;
1261
+  <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">centerY</span> = height/<span style="color: #a45bad;">2</span>;
1262
+  <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">rsize</span> = <span style="color: #a45bad;">55</span>;
1263
+
1264
+  <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">color of request is mapped to the privacy type of the request, each request has one.</span>
1265
+  <span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">reqColor</span> = getColor<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">PrivacyLevel</span>.PUBLIC, request.contextType<span style="color: #bc6ec5;">)</span>;
1266
+  fill<span style="color: #bc6ec5;">(</span>reqColor<span style="color: #bc6ec5;">)</span>; 
1267
+  ellipse<span style="color: #bc6ec5;">(</span>centerX, centerY, rsize, rsize<span style="color: #bc6ec5;">)</span>;
1268
+
1269
+  <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">show the name of the application that makes the request, centered below the circle</span>
1270
+  fill<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">0</span><span style="color: #bc6ec5;">)</span>;
1271
+  textAlign<span style="color: #bc6ec5;">(</span>CENTER,CENTER<span style="color: #bc6ec5;">)</span>;
1272
+  text<span style="color: #bc6ec5;">(</span>request.application, centerX, centerY + rsize/<span style="color: #a45bad;">1</span>.<span style="color: #a45bad;">5</span><span style="color: #bc6ec5;">)</span>;
1273
+
1274
+  <span style="color: #ce537a; font-weight: bold;">int</span> <span style="color: #7590db;">count</span> = <span style="color: #a45bad;">0</span>;
1275
+  <span style="color: #4f97d7; font-weight: bold;">for</span><span style="color: #bc6ec5;">(</span><span style="color: #ce537a; font-weight: bold;">Context</span> <span style="color: #7590db;">context</span> : contexts<span style="color: #bc6ec5;">)</span>
1276
+  <span style="color: #bc6ec5;">{</span>
1277
+    <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">angle</span> = <span style="color: #2d9574;">(</span>count * eqd_angle<span style="color: #2d9574;">)</span> - <span style="color: #2d9574;">(</span>PI/<span style="color: #a45bad;">2</span><span style="color: #2d9574;">)</span>;<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">start drawing at the top</span>
1278
+
1279
+    <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">distance</span> = <span style="color: #a45bad;">200</span>;<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">random(100,300);//random between 50 and 300</span>
1280
+    <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">csize</span> = <span style="color: #a45bad;">100</span>;<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">random(50,100); //random between 50 and 100</span>
1281
+    <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">x</span> = centerX + distance * cos<span style="color: #2d9574;">(</span>angle<span style="color: #2d9574;">)</span>; <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">calculate xPos</span>
1282
+    <span style="color: #ce537a; font-weight: bold;">float</span> <span style="color: #7590db;">y</span> = centerY + distance * sin<span style="color: #2d9574;">(</span>angle<span style="color: #2d9574;">)</span>; <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">calculate yPos</span>
1283
+
1284
+    <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">each context should have a contextType too, in order to base the color on it.</span>
1285
+    <span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">contextColor</span> = getColor<span style="color: #2d9574;">(</span><span style="color: #a45bad;">PrivacyLevel</span>.PUBLIC, context.contextType<span style="color: #2d9574;">)</span>;
1286
+    fill<span style="color: #2d9574;">(</span>contextColor<span style="color: #2d9574;">)</span>;
1287
+    ellipse<span style="color: #2d9574;">(</span>x, y, csize, csize<span style="color: #2d9574;">)</span>;<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">fixed sizes and distances for now.</span>
1288
+
1289
+    <span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">show context label</span>
1290
+    fill<span style="color: #2d9574;">(</span><span style="color: #a45bad;">0</span><span style="color: #2d9574;">)</span>;
1291
+    textAlign<span style="color: #2d9574;">(</span>CENTER,CENTER<span style="color: #2d9574;">)</span>;
1292
+    text<span style="color: #2d9574;">(</span>context.title, x, y + csize/<span style="color: #a45bad;">1</span>.<span style="color: #a45bad;">5</span><span style="color: #2d9574;">)</span>;
1293
+    count++;
1294
+  <span style="color: #bc6ec5;">}</span>
1295
+<span style="color: #4f97d7;">}</span>
1234 1296
 </pre>
1235 1297
 </div>
1236 1298
 
1237 1299
 <script src="processing.js"></script>
1238
- <script type="text/processing" data-processing-target="ob-74f1a6b8e72f844b929f5904bea850acb6918dbb">
1300
+ <script type="text/processing" data-processing-target="ob-229253fd493ee5516fed8b7699685319f5c7f734">
1301
+//color definitions
1302
+color a3 = #3A3B58;
1303
+color b3 = #734246;
1304
+color d3 = #B4561F;
1305
+color c3 = #336F60;
1306
+color f3 = #7A3E2A;
1307
+color g3 = #A48137;
1308
+color e2 = #97BBCB;
1309
+color a4 = #3B4257;
1310
+color b4 = #6A4345;
1311
+color d4 = #86451F;
1312
+color c4 = #345A48;
1313
+color f4 = #A92F21;
1314
+color g4 = #BC983B;
1315
+color a5 = #3D4358;
1316
+color b5 = #402623;
1317
+color d5 = #85442D;
1318
+color c5 = #3B403A;
1319
+color f5 = #7A150B;
1320
+color g5 = #252F2B;
1321
+color a1 = #597099;
1322
+color e4 = #0A3878;
1323
+color b1 = #D16365;
1324
+color d1 = #FFD43B;
1325
+color c1 = #B7BF98;
1326
+color e1 = #CAD2C8;
1327
+color e0 = #F5EDE5;
1328
+color f1 = #D17978;
1329
+color g1 = #FDD23E;
1330
+color a0 = #C5C3CC;
1331
+color e3 = #0485B1;
1332
+color b0 = #FFDCD6;
1333
+color d0 = #FFE9BE;
1334
+color c0 = #F0E9D5;
1335
+color f0 = #E4C8BF;
1336
+color g0 = #FBE6BA;
1337
+color a2 = #3D4B79;
1338
+color e5 = #084064;
1339
+color b2 = #974244;
1340
+color d2 = #F8AA08;
1341
+color c2 = #4E937F;
1342
+color f2 = #8F4330;
1343
+color g2 = #FFDB03;
1344
+
1345
+color colors[][] = {
1346
+  {b0,b1,b2,b3,b4,b5},
1347
+  {c0,c1,c2,c3,c4,c5},
1348
+  {a0,a1,a2,a3,a4,a5},
1349
+  {d0,d1,d2,d3,d4,d5},
1350
+  {e0,e1,e2,e3,e4,e5},
1351
+  {f0,f1,f2,f3,f4,f5},
1352
+  {g0,g1,g2,g3,g4,g5}
1353
+};
1354
+
1355
+class PrivacyLevel {
1356
+  public static int SECRET = 5;
1357
+  public static int PRIVATE = 4;
1358
+  public static int INTIMATE = 3;
1359
+  public static int AFFILIATE = 2;
1360
+  public static int PUBLIC = 1;
1361
+  public static int COMMONS = 0;
1362
+}
1363
+
1364
+class ContextType {
1365
+  public static int FINANCIAL = 6;
1366
+  public static int PERSONAL = 5; 
1367
+  public static int HEALTH = 4;
1368
+  public static int EDUCATION = 3;
1369
+  public static int WORK = 2;
1370
+  public static int HOBBY = 1;
1371
+  public static int OTHER = 0;
1372
+}
1373
+
1374
+public int getColor(int privacy_level, int context_type)
1375
+{
1376
+  return colors[context_type][privacy_level];
1377
+}
1239 1378
 class Request
1240 1379
 {
1241 1380
   public String application;
@@ -1284,13 +1423,15 @@ class Context
1284 1423
 {
1285 1424
   public String title;
1286 1425
   public int plSum;
1426
+  public int contextType;
1287 1427
   public Property[] properties;
1288 1428
 
1289
-  public Context(String title, int plSum, Property[] properties)
1429
+  public Context(String title, int plSum, int contextType, Property[] properties)
1290 1430
   {
1291 1431
     this.title = title;
1292 1432
     this.plSum = plSum;
1293 1433
     this.properties = properties;
1434
+    this.contextType = contextType;
1294 1435
   }
1295 1436
 }
1296 1437
 
@@ -1325,9 +1466,10 @@ Context[] parseProfile(XMLElement xml)
1325 1466
   for(int i = 0; i < contexts.length; i++)
1326 1467
   {
1327 1468
     String contextName = profile.getChild(i).getChild(0).getContent();
1328
-    int plSum = parseInt(profile.getChild(i).getChild(1).getContent());
1469
+    int contextType = parseInt(profile.getChild(i).getChild(1).getContent());
1470
+    int plSum = parseInt(profile.getChild(i).getChild(2).getContent());
1329 1471
 
1330
-    XMLElement propertiesEl = profile.getChild(i).getChild(2);
1472
+    XMLElement propertiesEl = profile.getChild(i).getChild(3);
1331 1473
     Property[] properties = new Property[propertiesEl.getChildCount()];
1332 1474
     for(int j = 0; j < properties.length; j++)
1333 1475
     {
@@ -1335,7 +1477,7 @@ Context[] parseProfile(XMLElement xml)
1335 1477
       properties[j] = prop;
1336 1478
     }
1337 1479
 
1338
-    Context context = new Context(contextName, plSum, properties);
1480
+    Context context = new Context(contextName, plSum, contextType, properties);
1339 1481
     contexts[i] = context;
1340 1482
   }
1341 1483
   return contexts;
@@ -1379,19 +1521,61 @@ Diff[] parseDiffs(xml)
1379 1521
 Request request = parseRequest(doc);
1380 1522
 Diff[] diffs = parseDiffs(doc);
1381 1523
 Context[] contexts = parseProfile(doc);
1382
-//draw the difference for each context with the request
1383
-size(200,200);
1384
-background(0);
1385
-noFill();
1386
-stroke(255);
1387
-ellipse(56, 46, 55, 55);
1388
-text(diffs[0].context, 10, 10);
1389
-text(contexts[0].properties[0].value, 10, 50);
1390
-</script> <canvas id="ob-74f1a6b8e72f844b929f5904bea850acb6918dbb"></canvas>
1524
+void setup(){
1525
+  size(800,800);
1526
+  smooth();
1527
+  noLoop();
1528
+}
1529
+
1530
+//divide the circle by the amount of contexts 
1531
+//to get the angle between the lines that indicate the center of each context
1532
+float eqd_angle = TWO_PI / contexts.length;
1533
+  
1534
+void draw()
1535
+{
1536
+  //TODO move draw request to a function
1537
+  //the size of request is fixed for now
1538
+  float centerX = width/2;
1539
+  float centerY = height/2;
1540
+  float rsize = 55;
1541
+  
1542
+  //color of request is mapped to the privacy type of the request, each request has one.
1543
+  color reqColor = getColor(PrivacyLevel.PUBLIC, request.contextType);
1544
+  fill(reqColor); 
1545
+  ellipse(centerX, centerY, rsize, rsize);
1546
+  
1547
+  //show the name of the application that makes the request, centered below the circle
1548
+  fill(0);
1549
+  textAlign(CENTER,CENTER);
1550
+  text(request.application, centerX, centerY + rsize/1.5);
1551
+
1552
+  int count = 0;
1553
+  for(Context context : contexts)
1554
+  {
1555
+    float angle = (count * eqd_angle) - (PI/2);//start drawing at the top
1556
+    
1557
+    float distance = 200;//random(100,300);//random between 50 and 300
1558
+    float csize = 100;//random(50,100); //random between 50 and 100
1559
+    float x = centerX + distance * cos(angle); //calculate xPos
1560
+    float y = centerY + distance * sin(angle); //calculate yPos
1561
+    
1562
+    //each context should have a contextType too, in order to base the color on it.
1563
+    color contextColor = getColor(PrivacyLevel.PUBLIC, context.contextType);
1564
+    fill(contextColor);
1565
+    ellipse(x, y, csize, csize);//fixed sizes and distances for now.
1566
+    
1567
+    //show context label
1568
+    fill(0);
1569
+    textAlign(CENTER,CENTER);
1570
+    text(context.title, x, y + csize/1.5);
1571
+    count++;
1572
+  }
1573
+}
1574
+</script> <canvas id="ob-229253fd493ee5516fed8b7699685319f5c7f734"></canvas>
1391 1575
 </div>
1392 1576
 
1393
-<div id="outline-container-orgd9d5835" class="outline-4">
1394
-<h4 id="orgd9d5835"><span class="section-number-4">4.2.1</span> Things to further investigate</h4>
1577
+<div id="outline-container-org7551d85" class="outline-4">
1578
+<h4 id="org7551d85"><span class="section-number-4">4.2.1</span> Things to further investigate</h4>
1395 1579
 <div class="outline-text-4" id="text-4-2-1">
1396 1580
 <ul class="org-ul">
1397 1581
 <li>How do we show relation between request and each context with color?</li>
@@ -1403,16 +1587,16 @@ text(contexts[0].properties[0].value, 10, 50);
1403 1587
 </div>
1404 1588
 </div>
1405 1589
 
1406
-<div id="outline-container-org7cb73b5" class="outline-2">
1407
-<h2 id="org7cb73b5"><span class="section-number-2">5</span> Interaction</h2>
1590
+<div id="outline-container-orge46c738" class="outline-2">
1591
+<h2 id="orge46c738"><span class="section-number-2">5</span> Interaction</h2>
1408 1592
 <div class="outline-text-2" id="text-5">
1409 1593
 <p>
1410 1594
 We intend to investigate this in Processing as well.
1411 1595
 </p>
1412 1596
 </div>
1413 1597
 
1414
-<div id="outline-container-org2fae9f9" class="outline-4">
1415
-<h4 id="org2fae9f9"><span class="section-number-4">5.0.1</span> Things to further investigate</h4>
1598
+<div id="outline-container-orgff14b8e" class="outline-4">
1599
+<h4 id="orgff14b8e"><span class="section-number-4">5.0.1</span> Things to further investigate</h4>
1416 1600
 <div class="outline-text-4" id="text-5-0-1">
1417 1601
 <ul class="org-ul">
1418 1602
 <li>How does the end user actually accept the request? Is it by dragging the request onto the context?</li>
@@ -1424,7 +1608,7 @@ We intend to investigate this in Processing as well.
1424 1608
 </div>
1425 1609
 <div id="postamble" class="status">
1426 1610
 <p class="author">Author: Taco</p>
1427
-<p class="date">Created: 2018-04-06 Fri 16:25</p>
1611
+<p class="date">Created: 2018-04-06 Fri 17:22</p>
1428 1612
 <p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
1429 1613
 </div>
1430 1614
 </body>

File diff suppressed because it is too large
+ 88 - 19
entitlements.org