Browse Source

updated glue

Taco 1 year ago
parent
commit
d4f2074d67
2 changed files with 276 additions and 109 deletions
  1. 163 81
      entitlements.html
  2. 113 28
      entitlements.org

+ 163 - 81
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-03-30 Fri 17:09 -->
6
+<!-- 2018-04-06 Fri 14:48 -->
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="#orga6d51e4">1. Introduction</a></li>
238
-<li><a href="#orge2a2818">2. Data Model</a>
237
+<li><a href="#org1f7ea23">1. Introduction</a></li>
238
+<li><a href="#org90c1308">2. Data Model</a>
239 239
 <ul>
240
-<li><a href="#org6656845">2.1. Example wallet profile</a>
240
+<li><a href="#org07a93b4">2.1. Example wallet profile</a>
241 241
 <ul>
242
-<li><a href="#orgc5958ba">2.1.1. Things to further investigate</a></li>
242
+<li><a href="#org0f80798">2.1.1. Things to further investigate</a></li>
243 243
 </ul>
244 244
 </li>
245
-<li><a href="#orgf1897dc">2.2. Example request</a>
245
+<li><a href="#orgedffc2e">2.2. Example request</a>
246 246
 <ul>
247
-<li><a href="#orgcb60792">2.2.1. Things to further investigate</a></li>
247
+<li><a href="#org6e6c14e">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="#org31d317a">3. Data Comparison</a>
252
+<li><a href="#orgc2accfe">3. Data Comparison</a>
253 253
 <ul>
254 254
 <li>
255 255
 <ul>
256
-<li><a href="#org95edd4f">3.0.1. Things to further investigate</a></li>
256
+<li><a href="#org911d641">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="#orgbe43276">4. Visualization</a>
261
+<li><a href="#orgcf6cba0">4. Visualization</a>
262 262
 <ul>
263
-<li><a href="#org217ca68">4.1. Request</a></li>
264
-<li><a href="#org1c7ab82">4.2. Contexts</a>
263
+<li><a href="#org89701f3">4.1. Request</a></li>
264
+<li><a href="#org1db413c">4.2. Contexts</a>
265 265
 <ul>
266
-<li><a href="#org5f5862d">4.2.1. Things to further investigate</a></li>
266
+<li><a href="#orgd3563e0">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="#org4cf1be2">5. Interaction</a>
271
+<li><a href="#orgbb8d8f0">5. Interaction</a>
272 272
 <ul>
273 273
 <li>
274 274
 <ul>
275
-<li><a href="#org9d5fad8">5.0.1. Things to further investigate</a></li>
275
+<li><a href="#org0d0d22b">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-orga6d51e4" class="outline-2">
284
-<h2 id="orga6d51e4"><span class="section-number-2">1</span> Introduction</h2>
283
+<div id="outline-container-org1f7ea23" class="outline-2">
284
+<h2 id="org1f7ea23"><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.
@@ -314,12 +314,12 @@ A preliminary definition of 6 context types (ordered from the self outwards, but
314 314
 </div>
315 315
 </div>
316 316
 
317
-<div id="outline-container-orge2a2818" class="outline-2">
318
-<h2 id="orge2a2818"><span class="section-number-2">2</span> Data Model</h2>
317
+<div id="outline-container-org90c1308" class="outline-2">
318
+<h2 id="org90c1308"><span class="section-number-2">2</span> Data Model</h2>
319 319
 <div class="outline-text-2" id="text-2">
320 320
 </div>
321
-<div id="outline-container-org6656845" class="outline-3">
322
-<h3 id="org6656845"><span class="section-number-3">2.1</span> Example wallet profile</h3>
321
+<div id="outline-container-org07a93b4" class="outline-3">
322
+<h3 id="org07a93b4"><span class="section-number-3">2.1</span> Example wallet profile</h3>
323 323
 <div class="outline-text-3" id="text-2-1">
324 324
 <p>
325 325
 This sample wallet profile datastructure consists of multiple contexts.
@@ -338,7 +338,7 @@ It overrides the default privacy level specified by the property type.
338 338
 </p>
339 339
 
340 340
 <div class="org-src-container">
341
-<pre class="src src-js" id="org684e7d9"><span style="color: #4f97d7; font-weight: bold;">var</span> <span style="color: #7590db;">profile</span> = <span style="color: #4f97d7;">{</span>
341
+<pre class="src src-js" id="org70c7367"><span style="color: #4f97d7; font-weight: bold;">var</span> <span style="color: #7590db;">profile</span> = <span style="color: #4f97d7;">{</span>
342 342
     contexts : 
343 343
     <span style="color: #bc6ec5;">[</span>
344 344
         <span style="color: #2d9574;">{</span>
@@ -397,8 +397,8 @@ process.stdout.write<span style="color: #4f97d7;">(</span>JSON.stringify<span st
397 397
 </div>
398 398
 </div>
399 399
 
400
-<div id="outline-container-orgc5958ba" class="outline-4">
401
-<h4 id="orgc5958ba"><span class="section-number-4">2.1.1</span> Things to further investigate</h4>
400
+<div id="outline-container-org0f80798" class="outline-4">
401
+<h4 id="org0f80798"><span class="section-number-4">2.1.1</span> Things to further investigate</h4>
402 402
 <div class="outline-text-4" id="text-2-1-1">
403 403
 <ul class="org-ul">
404 404
 <li>Apply default weights to each property type, these can be overridden by attributing a privacy level to the property</li>
@@ -410,8 +410,8 @@ process.stdout.write<span style="color: #4f97d7;">(</span>JSON.stringify<span st
410 410
 </div>
411 411
 </div>
412 412
 
413
-<div id="outline-container-orgf1897dc" class="outline-3">
414
-<h3 id="orgf1897dc"><span class="section-number-3">2.2</span> Example request</h3>
413
+<div id="outline-container-orgedffc2e" class="outline-3">
414
+<h3 id="orgedffc2e"><span class="section-number-3">2.2</span> Example request</h3>
415 415
 <div class="outline-text-3" id="text-2-2">
416 416
 <p>
417 417
 This sample application request consists of an application name, a set of required property types and a set of optional property types.
@@ -421,7 +421,7 @@ and the cumulative privacy weight by adding the privacy levels of each property
421 421
 </p>
422 422
 
423 423
 <div class="org-src-container">
424
-<pre class="src src-js" id="org71aadcf"><span style="color: #4f97d7; font-weight: bold;">var</span> <span style="color: #7590db;">request</span> = <span style="color: #4f97d7;">{</span>
424
+<pre class="src src-js" id="org5a023e5"><span style="color: #4f97d7; font-weight: bold;">var</span> <span style="color: #7590db;">request</span> = <span style="color: #4f97d7;">{</span>
425 425
     application : <span style="color: #2d9574;">"decodeapp:facebook"</span>,
426 426
     preferred_context_type : <span style="color: #bc6ec5;">[</span><span style="color: #a45bad;">3</span>,<span style="color: #a45bad;">4</span>,<span style="color: #a45bad;">5</span><span style="color: #bc6ec5;">]</span>,<span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">i think facebook would think they apply to these three contexts (self,family and friends)</span>
427 427
     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>,
@@ -433,8 +433,8 @@ process.stdout.write<span style="color: #4f97d7;">(</span>data<span style="color
433 433
 </div>
434 434
 </div>
435 435
 
436
-<div id="outline-container-orgcb60792" class="outline-4">
437
-<h4 id="orgcb60792"><span class="section-number-4">2.2.1</span> Things to further investigate</h4>
436
+<div id="outline-container-org6e6c14e" class="outline-4">
437
+<h4 id="org6e6c14e"><span class="section-number-4">2.2.1</span> Things to further investigate</h4>
438 438
 <div class="outline-text-4" id="text-2-2-1">
439 439
 <ul class="org-ul">
440 440
 <li>Create a generator that seeds a request with random required and optional property types</li>
@@ -446,8 +446,8 @@ process.stdout.write<span style="color: #4f97d7;">(</span>data<span style="color
446 446
 </div>
447 447
 
448 448
 
449
-<div id="outline-container-org31d317a" class="outline-2">
450
-<h2 id="org31d317a"><span class="section-number-2">3</span> Data Comparison</h2>
449
+<div id="outline-container-orgc2accfe" class="outline-2">
450
+<h2 id="orgc2accfe"><span class="section-number-2">3</span> Data Comparison</h2>
451 451
 <div class="outline-text-2" id="text-3">
452 452
 <p>
453 453
 During the interaction we want to give the user insight into a couple of things;
@@ -463,7 +463,7 @@ In below ruby code a comparison is made by on creating the intersection and its
463 463
 </p>
464 464
 
465 465
 <div class="org-src-container">
466
-<pre class="src src-ruby" id="org567012f"><span style="color: #4f97d7;">require</span> <span style="color: #2d9574;">'json'</span>
466
+<pre class="src src-ruby" id="org0f1d714"><span style="color: #4f97d7;">require</span> <span style="color: #2d9574;">'json'</span>
467 467
   <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>
468 468
 
469 469
   request = <span style="color: #ce537a; font-weight: bold;">JSON</span>.parse<span style="color: #4f97d7;">(</span>request_data<span style="color: #4f97d7;">)</span>
@@ -484,8 +484,8 @@ In below ruby code a comparison is made by on creating the intersection and its
484 484
 </div>
485 485
 </div>
486 486
 
487
-<div id="outline-container-org95edd4f" class="outline-4">
488
-<h4 id="org95edd4f"><span class="section-number-4">3.0.1</span> Things to further investigate</h4>
487
+<div id="outline-container-org911d641" class="outline-4">
488
+<h4 id="org911d641"><span class="section-number-4">3.0.1</span> Things to further investigate</h4>
489 489
 <div class="outline-text-4" id="text-3-0-1">
490 490
 <ul class="org-ul">
491 491
 <li>Calculate the weight (sum of privacy levels of the properties it contains) of each context before and after giving permission</li>
@@ -504,8 +504,8 @@ request is size 3
504 504
 </div>
505 505
 </div>
506 506
 
507
-<div id="outline-container-orgbe43276" class="outline-2">
508
-<h2 id="orgbe43276"><span class="section-number-2">4</span> Visualization</h2>
507
+<div id="outline-container-orgcf6cba0" class="outline-2">
508
+<h2 id="orgcf6cba0"><span class="section-number-2">4</span> Visualization</h2>
509 509
 <div class="outline-text-2" id="text-4">
510 510
 <p>
511 511
 We want to visualize the following things;
@@ -524,7 +524,7 @@ Different tones within the hue can be mapped to each privacy level.
524 524
 </p>
525 525
 
526 526
 <div class="org-src-container">
527
-<pre class="src src-java" id="org9bf75b0"><span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">color definitions</span>
527
+<pre class="src src-java" id="org3eae36f"><span style="color: #2aa1ae; background-color: #292e34;">//</span><span style="color: #2aa1ae; background-color: #292e34;">color definitions</span>
528 528
 <span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">a3</span> = #<span style="color: #a45bad;">3A3B58</span>;
529 529
 <span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">b3</span> = #<span style="color: #a45bad;">734246</span>;
530 530
 <span style="color: #ce537a; font-weight: bold;">color</span> <span style="color: #7590db;">d3</span> = #B4561F;
@@ -608,7 +608,7 @@ Below snippet exemplifies a color for the SELF context with a privacy level SECR
608 608
 </p>
609 609
 
610 610
 <div class="org-src-container">
611
-<pre class="src src-java" id="org2c57c1d"><span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">draw</span><span style="color: #4f97d7;">(){</span>
611
+<pre class="src src-java" id="orgd8bd243"><span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">draw</span><span style="color: #4f97d7;">(){</span>
612 612
   size<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">100</span>,<span style="color: #a45bad;">100</span><span style="color: #bc6ec5;">)</span>;
613 613
   background<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">0</span><span style="color: #bc6ec5;">)</span>;
614 614
   noStroke<span style="color: #bc6ec5;">()</span>;
@@ -712,7 +712,7 @@ void draw(){
712 712
 </script> <canvas id="ob-16a3bfeaae0796f9c0bb86df72e7c664178dbee9"></canvas>
713 713
 
714 714
 <div class="org-src-container">
715
-<pre class="src src-java" id="org7d6f2ed"><span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">draw</span><span style="color: #4f97d7;">(){</span>
715
+<pre class="src src-java" id="orgd450db5"><span style="color: #ce537a; font-weight: bold;">void</span> <span style="color: #bc6ec5; font-weight: bold;">draw</span><span style="color: #4f97d7;">(){</span>
716 716
   size<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">100</span>,<span style="color: #a45bad;">100</span><span style="color: #bc6ec5;">)</span>;
717 717
   background<span style="color: #bc6ec5;">(</span><span style="color: #a45bad;">0</span><span style="color: #bc6ec5;">)</span>;
718 718
   noStroke<span style="color: #bc6ec5;">()</span>;
@@ -816,25 +816,21 @@ void draw(){
816 816
 </script> <canvas id="ob-aa9a4cb8275feb0ce1c5423b4f8d6a81fa9e4a49"></canvas>
817 817
 </div>
818 818
 
819
-<div id="outline-container-org217ca68" class="outline-3">
820
-<h3 id="org217ca68"><span class="section-number-3">4.1</span> Request</h3>
819
+<div id="outline-container-org89701f3" class="outline-3">
820
+<h3 id="org89701f3"><span class="section-number-3">4.1</span> Request</h3>
821 821
 <div class="outline-text-3" id="text-4-1">
822 822
 <div class="org-src-container">
823
-<pre class="src src-java" id="org93259cc"><span style="color: #ce537a; font-weight: bold;">Request</span> <span style="color: #7590db;">r</span> = parseRequest<span style="color: #4f97d7;">(</span>doc<span style="color: #4f97d7;">)</span>;
824
-<span style="color: #ce537a; font-weight: bold;">Diff</span><span style="color: #4f97d7;">[]</span> <span style="color: #7590db;">d</span> = parseDiffs<span style="color: #4f97d7;">(</span>doc<span style="color: #4f97d7;">)</span>;
825
-<span style="color: #ce537a; font-weight: bold;">Context</span><span style="color: #4f97d7;">[]</span> <span style="color: #7590db;">c</span> = parseProfile<span style="color: #4f97d7;">(</span>doc<span style="color: #4f97d7;">)</span>;
826
-
827
-size<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">200</span>,<span style="color: #a45bad;">200</span><span style="color: #4f97d7;">)</span>;
823
+<pre class="src src-java" id="orgba23a8a">size<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">200</span>,<span style="color: #a45bad;">200</span><span style="color: #4f97d7;">)</span>;
828 824
 background<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">0</span><span style="color: #4f97d7;">)</span>;
829 825
 noFill<span style="color: #4f97d7;">()</span>;
830 826
 stroke<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">255</span><span style="color: #4f97d7;">)</span>;
831 827
 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>;
832
-text<span style="color: #4f97d7;">(</span>r.application, <span style="color: #a45bad;">10</span>, <span style="color: #a45bad;">10</span><span style="color: #4f97d7;">)</span>;
828
+text<span style="color: #4f97d7;">(</span>request.application, <span style="color: #a45bad;">10</span>, <span style="color: #a45bad;">10</span><span style="color: #4f97d7;">)</span>;
833 829
 </pre>
834 830
 </div>
835 831
 
836 832
 <script src="processing.js"></script>
837
- <script type="text/processing" data-processing-target="ob-5526b37e71e6fc325c46270b443c073478ef0ab8">
833
+ <script type="text/processing" data-processing-target="ob-1d9a0699e09552d1b193ca638825c0e13ad78a91">
838 834
 class Request
839 835
 {
840 836
   public String application;
@@ -863,23 +859,38 @@ class Diff
863 859
   } 
864 860
 }
865 861
 
866
-//TODO: add Profile / Context / Property classes here
862
+class Property
863
+{
864
+  public String type;
865
+  public String value;
866
+  public int pl;//privacy level
867
+
868
+  public Property(String type, String value, int pl)
869
+  {
870
+    this.type = type;
871
+    this.value = value;
872
+    this.pl = pl;
873
+  }
874
+}
875
+
867 876
 class Context
868 877
 {
869 878
   public String title;
870 879
   public int plSum;
880
+  public Property[] properties;
871 881
 
872
-  public Context(String title, int plSum)
882
+  public Context(String title, int plSum, Property[] properties)
873 883
   {
874 884
     this.title = title;
875 885
     this.plSum = plSum;
886
+    this.properties = properties;
876 887
   }
877 888
 }
878 889
 
879 890
 XMLElement doc = new XMLElement(this, 'diff.xml');
880 891
 
881 892
 //create typed versions because this is java :-(
882
-Request parseRequest(xml)
893
+Request parseRequest(XMLElement xml)
883 894
 {
884 895
   XMLElement req = xml.getChild(0);
885 896
   String name = req.getChild(0).getContent();
@@ -898,9 +909,36 @@ Request parseRequest(xml)
898 909
   return r;
899 910
 }
900 911
 
901
-Context[] parseProfile(xml)
912
+Context[] parseProfile(XMLElement xml)
913
+{
914
+  XMLElement profile = xml.getChild(2);
915
+  Context[] contexts = new Context[profile.getChildCount()];
916
+
917
+  for(int i = 0; i < contexts.length; i++)
918
+  {
919
+    String contextName = profile.getChild(i).getChild(0).getContent();
920
+    int plSum = parseInt(profile.getChild(i).getChild(1).getContent());
921
+
922
+    XMLElement propertiesEl = profile.getChild(i).getChild(2);
923
+    Property[] properties = new Property[propertiesEl.getChildCount()];
924
+    for(int j = 0; j < properties.length; j++)
925
+    {
926
+      Property prop = parseProperty(propertiesEl.getChild(j));
927
+      properties[j] = prop;
928
+    }
929
+
930
+    Context context = new Context(contextName, plSum, properties);
931
+    contexts[i] = context;
932
+  }
933
+  return contexts;
934
+}
935
+
936
+Property parseProperty(XMLElement propertyEl)
902 937
 {
903
-  return null;
938
+  String propertyType = propertyEl.getChild(0).getContent();
939
+  String value = propertyEl.getChild(1).getContent();
940
+  int pl = parseInt(propertyEl.getChild(2).getContent());
941
+  return new Property(propertyType, value, pl);
904 942
 }
905 943
 
906 944
 //create typed versions because this is java :-(
@@ -929,42 +967,41 @@ Diff[] parseDiffs(xml)
929 967
   }
930 968
   return diffs;
931 969
 }
932
-Request r = parseRequest(doc);
933
-Diff[] d = parseDiffs(doc);
934
-Context[] c = parseProfile(doc);
935 970
 
971
+Request request = parseRequest(doc);
972
+Diff[] diffs = parseDiffs(doc);
973
+Context[] contexts = parseProfile(doc);
936 974
 size(200,200);
937 975
 background(0);
938 976
 noFill();
939 977
 stroke(255);
940 978
 ellipse(56, 46, 55, 55);
941
-text(r.application, 10, 10);
942
-</script> <canvas id="ob-5526b37e71e6fc325c46270b443c073478ef0ab8"></canvas>
979
+text(request.application, 10, 10);
980
+</script> <canvas id="ob-1d9a0699e09552d1b193ca638825c0e13ad78a91"></canvas>
943 981
 </div>
944 982
 </div>
945 983
 
946
-<div id="outline-container-org1c7ab82" class="outline-3">
947
-<h3 id="org1c7ab82"><span class="section-number-3">4.2</span> Contexts</h3>
984
+<div id="outline-container-org1db413c" class="outline-3">
985
+<h3 id="org1db413c"><span class="section-number-3">4.2</span> Contexts</h3>
948 986
 <div class="outline-text-3" id="text-4-2">
949 987
 <p>
950 988
 How do we visulize each context? Intend to do this in processing too.
951 989
 </p>
952 990
 
953 991
 <div class="org-src-container">
954
-<pre class="src src-java" id="org0bf6c35"><span style="color: #ce537a; font-weight: bold;">Request</span> <span style="color: #7590db;">r</span> = parseRequest<span style="color: #4f97d7;">(</span>doc<span style="color: #4f97d7;">)</span>;
955
-<span style="color: #ce537a; font-weight: bold;">Diff</span><span style="color: #4f97d7;">[]</span> <span style="color: #7590db;">d</span> = parseDiffs<span style="color: #4f97d7;">(</span>doc<span style="color: #4f97d7;">)</span>;
956
-<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>
992
+<pre class="src src-java" id="orgfa7ec11"><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>
957 993
 size<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">200</span>,<span style="color: #a45bad;">200</span><span style="color: #4f97d7;">)</span>;
958 994
 background<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">0</span><span style="color: #4f97d7;">)</span>;
959 995
 noFill<span style="color: #4f97d7;">()</span>;
960 996
 stroke<span style="color: #4f97d7;">(</span><span style="color: #a45bad;">255</span><span style="color: #4f97d7;">)</span>;
961 997
 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>;
962
-text<span style="color: #4f97d7;">(</span>d<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>;
998
+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>;
999
+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>;
963 1000
 </pre>
964 1001
 </div>
965 1002
 
966 1003
 <script src="processing.js"></script>
967
- <script type="text/processing" data-processing-target="ob-ffb0bd11bfee301d2643b23f19a7cda5418f1c1f">
1004
+ <script type="text/processing" data-processing-target="ob-07ccb7088b2ee119415adddbb05248cf0ef709d9">
968 1005
 class Request
969 1006
 {
970 1007
   public String application;
@@ -993,23 +1030,38 @@ class Diff
993 1030
   } 
994 1031
 }
995 1032
 
996
-//TODO: add Profile / Context / Property classes here
1033
+class Property
1034
+{
1035
+  public String type;
1036
+  public String value;
1037
+  public int pl;//privacy level
1038
+
1039
+  public Property(String type, String value, int pl)
1040
+  {
1041
+    this.type = type;
1042
+    this.value = value;
1043
+    this.pl = pl;
1044
+  }
1045
+}
1046
+
997 1047
 class Context
998 1048
 {
999 1049
   public String title;
1000 1050
   public int plSum;
1051
+  public Property[] properties;
1001 1052
 
1002
-  public Context(String title, int plSum)
1053
+  public Context(String title, int plSum, Property[] properties)
1003 1054
   {
1004 1055
     this.title = title;
1005 1056
     this.plSum = plSum;
1057
+    this.properties = properties;
1006 1058
   }
1007 1059
 }
1008 1060
 
1009 1061
 XMLElement doc = new XMLElement(this, 'diff.xml');
1010 1062
 
1011 1063
 //create typed versions because this is java :-(
1012
-Request parseRequest(xml)
1064
+Request parseRequest(XMLElement xml)
1013 1065
 {
1014 1066
   XMLElement req = xml.getChild(0);
1015 1067
   String name = req.getChild(0).getContent();
@@ -1028,9 +1080,36 @@ Request parseRequest(xml)
1028 1080
   return r;
1029 1081
 }
1030 1082
 
1031
-Context[] parseProfile(xml)
1083
+Context[] parseProfile(XMLElement xml)
1032 1084
 {
1033
-  return null;
1085
+  XMLElement profile = xml.getChild(2);
1086
+  Context[] contexts = new Context[profile.getChildCount()];
1087
+
1088
+  for(int i = 0; i < contexts.length; i++)
1089
+  {
1090
+    String contextName = profile.getChild(i).getChild(0).getContent();
1091
+    int plSum = parseInt(profile.getChild(i).getChild(1).getContent());
1092
+
1093
+    XMLElement propertiesEl = profile.getChild(i).getChild(2);
1094
+    Property[] properties = new Property[propertiesEl.getChildCount()];
1095
+    for(int j = 0; j < properties.length; j++)
1096
+    {
1097
+      Property prop = parseProperty(propertiesEl.getChild(j));
1098
+      properties[j] = prop;
1099
+    }
1100
+
1101
+    Context context = new Context(contextName, plSum, properties);
1102
+    contexts[i] = context;
1103
+  }
1104
+  return contexts;
1105
+}
1106
+
1107
+Property parseProperty(XMLElement propertyEl)
1108
+{
1109
+  String propertyType = propertyEl.getChild(0).getContent();
1110
+  String value = propertyEl.getChild(1).getContent();
1111
+  int pl = parseInt(propertyEl.getChild(2).getContent());
1112
+  return new Property(propertyType, value, pl);
1034 1113
 }
1035 1114
 
1036 1115
 //create typed versions because this is java :-(
@@ -1059,20 +1138,23 @@ Diff[] parseDiffs(xml)
1059 1138
   }
1060 1139
   return diffs;
1061 1140
 }
1062
-Request r = parseRequest(doc);
1063
-Diff[] d = parseDiffs(doc);
1141
+
1142
+Request request = parseRequest(doc);
1143
+Diff[] diffs = parseDiffs(doc);
1144
+Context[] contexts = parseProfile(doc);
1064 1145
 //draw the difference for each context with the request
1065 1146
 size(200,200);
1066 1147
 background(0);
1067 1148
 noFill();
1068 1149
 stroke(255);
1069 1150
 ellipse(56, 46, 55, 55);
1070
-text(d[0].context, 10, 10);
1071
-</script> <canvas id="ob-ffb0bd11bfee301d2643b23f19a7cda5418f1c1f"></canvas>
1151
+text(diffs[0].context, 10, 10);
1152
+text(contexts[0].properties[0].value, 10, 50);
1153
+</script> <canvas id="ob-07ccb7088b2ee119415adddbb05248cf0ef709d9"></canvas>
1072 1154
 </div>
1073 1155
 
1074
-<div id="outline-container-org5f5862d" class="outline-4">
1075
-<h4 id="org5f5862d"><span class="section-number-4">4.2.1</span> Things to further investigate</h4>
1156
+<div id="outline-container-orgd3563e0" class="outline-4">
1157
+<h4 id="orgd3563e0"><span class="section-number-4">4.2.1</span> Things to further investigate</h4>
1076 1158
 <div class="outline-text-4" id="text-4-2-1">
1077 1159
 <ul class="org-ul">
1078 1160
 <li>How do we show relation between request and each context with color?</li>
@@ -1084,16 +1166,16 @@ text(d[0].context, 10, 10);
1084 1166
 </div>
1085 1167
 </div>
1086 1168
 
1087
-<div id="outline-container-org4cf1be2" class="outline-2">
1088
-<h2 id="org4cf1be2"><span class="section-number-2">5</span> Interaction</h2>
1169
+<div id="outline-container-orgbb8d8f0" class="outline-2">
1170
+<h2 id="orgbb8d8f0"><span class="section-number-2">5</span> Interaction</h2>
1089 1171
 <div class="outline-text-2" id="text-5">
1090 1172
 <p>
1091 1173
 We intend to investigate this in Processing as well.
1092 1174
 </p>
1093 1175
 </div>
1094 1176
 
1095
-<div id="outline-container-org9d5fad8" class="outline-4">
1096
-<h4 id="org9d5fad8"><span class="section-number-4">5.0.1</span> Things to further investigate</h4>
1177
+<div id="outline-container-org0d0d22b" class="outline-4">
1178
+<h4 id="org0d0d22b"><span class="section-number-4">5.0.1</span> Things to further investigate</h4>
1097 1179
 <div class="outline-text-4" id="text-5-0-1">
1098 1180
 <ul class="org-ul">
1099 1181
 <li>How does the end user actually accept the request? Is it by dragging the request onto the context?</li>
@@ -1105,7 +1187,7 @@ We intend to investigate this in Processing as well.
1105 1187
 </div>
1106 1188
 <div id="postamble" class="status">
1107 1189
 <p class="author">Author: Taco</p>
1108
-<p class="date">Created: 2018-03-30 Fri 17:09</p>
1190
+<p class="date">Created: 2018-04-06 Fri 14:48</p>
1109 1191
 <p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
1110 1192
 </div>
1111 1193
 </body>

+ 113 - 28
entitlements.org

@@ -575,23 +575,38 @@ class Diff
575 575
   } 
576 576
 }
577 577
 
578
-//TODO: add Profile / Context / Property classes here
578
+class Property
579
+{
580
+  public String type;
581
+  public String value;
582
+  public int pl;//privacy level
583
+
584
+  public Property(String type, String value, int pl)
585
+  {
586
+    this.type = type;
587
+    this.value = value;
588
+    this.pl = pl;
589
+  }
590
+}
591
+
579 592
 class Context
580 593
 {
581 594
   public String title;
582 595
   public int plSum;
596
+  public Property[] properties;
583 597
 
584
-  public Context(String title, int plSum)
598
+  public Context(String title, int plSum, Property[] properties)
585 599
   {
586 600
     this.title = title;
587 601
     this.plSum = plSum;
602
+    this.properties = properties;
588 603
   }
589 604
 }
590 605
 
591 606
 XMLElement doc = new XMLElement(this, 'diff.xml');
592 607
 
593 608
 //create typed versions because this is java :-(
594
-Request parseRequest(xml)
609
+Request parseRequest(XMLElement xml)
595 610
 {
596 611
   XMLElement req = xml.getChild(0);
597 612
   String name = req.getChild(0).getContent();
@@ -610,10 +625,36 @@ Request parseRequest(xml)
610 625
   return r;
611 626
 }
612 627
 
613
-Context[] parseProfile(xml)
628
+Context[] parseProfile(XMLElement xml)
614 629
 {
615
-  //TODO: implement this! so that we can finally start on the real visualization
616
-  return null;
630
+  XMLElement profile = xml.getChild(2);
631
+  Context[] contexts = new Context[profile.getChildCount()];
632
+
633
+  for(int i = 0; i < contexts.length; i++)
634
+  {
635
+    String contextName = profile.getChild(i).getChild(0).getContent();
636
+    int plSum = parseInt(profile.getChild(i).getChild(1).getContent());
637
+
638
+    XMLElement propertiesEl = profile.getChild(i).getChild(2);
639
+    Property[] properties = new Property[propertiesEl.getChildCount()];
640
+    for(int j = 0; j < properties.length; j++)
641
+    {
642
+      Property prop = parseProperty(propertiesEl.getChild(j));
643
+      properties[j] = prop;
644
+    }
645
+
646
+    Context context = new Context(contextName, plSum, properties);
647
+    contexts[i] = context;
648
+  }
649
+  return contexts;
650
+}
651
+
652
+Property parseProperty(XMLElement propertyEl)
653
+{
654
+  String propertyType = propertyEl.getChild(0).getContent();
655
+  String value = propertyEl.getChild(1).getContent();
656
+  int pl = parseInt(propertyEl.getChild(2).getContent());
657
+  return new Property(propertyType, value, pl);
617 658
 }
618 659
 
619 660
 //create typed versions because this is java :-(
@@ -642,21 +683,21 @@ Diff[] parseDiffs(xml)
642 683
   }
643 684
   return diffs;
644 685
 }
686
+
687
+Request request = parseRequest(doc);
688
+Diff[] diffs = parseDiffs(doc);
689
+Context[] contexts = parseProfile(doc);
645 690
 #+END_SRC
646 691
 
647 692
 ** Request
648 693
 #+name: draw_request_src
649 694
 #+BEGIN_SRC java
650
-Request r = parseRequest(doc);
651
-Diff[] d = parseDiffs(doc);
652
-Context[] c = parseProfile(doc);
653
-
654 695
 size(200,200);
655 696
 background(0);
656 697
 noFill();
657 698
 stroke(255);
658 699
 ellipse(56, 46, 55, 55);
659
-text(r.application, 10, 10);
700
+text(request.application, 10, 10);
660 701
 #+END_SRC
661 702
 
662 703
 #+name: draw_request
@@ -668,7 +709,7 @@ text(r.application, 10, 10);
668 709
 #+RESULTS: draw_request
669 710
 #+BEGIN_EXPORT html
670 711
 <script src="processing.js"></script>
671
- <script type="text/processing" data-processing-target="ob-5526b37e71e6fc325c46270b443c073478ef0ab8">
712
+ <script type="text/processing" data-processing-target="ob-45703f82a800b7bb16cef7d12c47ae59501bcf3c">
672 713
 class Request
673 714
 {
674 715
   public String application;
@@ -734,7 +775,19 @@ Request parseRequest(xml)
734 775
 
735 776
 Context[] parseProfile(xml)
736 777
 {
737
-  return null;
778
+  //TODO: implement this! so that we can finally start on the real visualization
779
+  XMLElement profile = xml.getChild(2);
780
+  Context[] contexts = new Context[profile.getChildCount()];
781
+
782
+  for(int i = 0; i < contexts.length; i++)
783
+  {
784
+    String contextName = profile.getChild(i).getChild(0).getContent();
785
+    int plSum = profile.getChild(i).getChild(0).getContent();
786
+
787
+    Context context = new Context(contextName, plSum);
788
+    contexts[i] = context;
789
+  }
790
+  return contexts;
738 791
 }
739 792
 
740 793
 //create typed versions because this is java :-(
@@ -763,17 +816,17 @@ Diff[] parseDiffs(xml)
763 816
   }
764 817
   return diffs;
765 818
 }
766
-Request r = parseRequest(doc);
767
-Diff[] d = parseDiffs(doc);
768
-Context[] c = parseProfile(doc);
769 819
 
820
+Request request = parseRequest(doc);
821
+Diff[] diffs = parseDiffs(doc);
822
+Context[] contexts = parseProfile(doc);
770 823
 size(200,200);
771 824
 background(0);
772 825
 noFill();
773 826
 stroke(255);
774 827
 ellipse(56, 46, 55, 55);
775
-text(r.application, 10, 10);
776
-</script> <canvas id="ob-5526b37e71e6fc325c46270b443c073478ef0ab8"></canvas>
828
+text(request.application, 10, 10);
829
+</script> <canvas id="ob-45703f82a800b7bb16cef7d12c47ae59501bcf3c"></canvas>
777 830
 #+END_EXPORT
778 831
 
779 832
 ** Contexts
@@ -781,15 +834,14 @@ text(r.application, 10, 10);
781 834
 
782 835
 #+name: draw_context_src
783 836
 #+BEGIN_SRC java
784
-Request r = parseRequest(doc);
785
-Diff[] d = parseDiffs(doc);
786 837
 //draw the difference for each context with the request
787 838
 size(200,200);
788 839
 background(0);
789 840
 noFill();
790 841
 stroke(255);
791 842
 ellipse(56, 46, 55, 55);
792
-text(d[0].context, 10, 10);
843
+text(diffs[0].context, 10, 10);
844
+text(contexts[0].properties[0].value, 10, 50);
793 845
 #+END_SRC
794 846
 
795 847
 #+name: draw_context
@@ -801,7 +853,7 @@ text(d[0].context, 10, 10);
801 853
 #+RESULTS: draw_context
802 854
 #+BEGIN_EXPORT html
803 855
 <script src="processing.js"></script>
804
- <script type="text/processing" data-processing-target="ob-1233b6269f6ad9dae9260cd0fea081e8622a0cf4">
856
+ <script type="text/processing" data-processing-target="ob-c5ac3c4c54147ecffc2f4eea88af7cca0a1a2f6d">
805 857
 class Request
806 858
 {
807 859
   public String application;
@@ -830,9 +882,23 @@ class Diff
830 882
   } 
831 883
 }
832 884
 
885
+//TODO: add Profile / Context / Property classes here
886
+class Context
887
+{
888
+  public String title;
889
+  public int plSum;
890
+
891
+  public Context(String title, int plSum)
892
+  {
893
+    this.title = title;
894
+    this.plSum = plSum;
895
+  }
896
+}
897
+
833 898
 XMLElement doc = new XMLElement(this, 'diff.xml');
899
+
834 900
 //create typed versions because this is java :-(
835
-void parseRequest(xml)
901
+Request parseRequest(xml)
836 902
 {
837 903
   XMLElement req = xml.getChild(0);
838 904
   String name = req.getChild(0).getContent();
@@ -851,8 +917,25 @@ void parseRequest(xml)
851 917
   return r;
852 918
 }
853 919
 
920
+Context[] parseProfile(xml)
921
+{
922
+  //TODO: implement this! so that we can finally start on the real visualization
923
+  XMLElement profile = xml.getChild(2);
924
+  Context[] contexts = new Context[profile.getChildCount()];
925
+
926
+  for(int i = 0; i < contexts.length; i++)
927
+  {
928
+    String contextName = profile.getChild(i).getChild(0).getContent();
929
+    int plSum = profile.getChild(i).getChild(0).getContent();
930
+
931
+    Context context = new Context(contextName, plSum);
932
+    contexts[i] = context;
933
+  }
934
+  return contexts;
935
+}
936
+
854 937
 //create typed versions because this is java :-(
855
-void parseDiffs(xml)
938
+Diff[] parseDiffs(xml)
856 939
 {
857 940
   XMLElement diffsEl = xml.getChild(1);
858 941
   Diff[] diffs = new Diff[diffsEl.getChildCount()];
@@ -877,16 +960,18 @@ void parseDiffs(xml)
877 960
   }
878 961
   return diffs;
879 962
 }
880
-Request r = parseRequest(doc);
881
-Diff[] d = parseDiffs(doc);
963
+
964
+Request request = parseRequest(doc);
965
+Diff[] diffs = parseDiffs(doc);
966
+Context[] contexts = parseProfile(doc);
882 967
 //draw the difference for each context with the request
883 968
 size(200,200);
884 969
 background(0);
885 970
 noFill();
886 971
 stroke(255);
887 972
 ellipse(56, 46, 55, 55);
888
-text(d[0].context, 10, 10);
889
-</script> <canvas id="ob-1233b6269f6ad9dae9260cd0fea081e8622a0cf4"></canvas>
973
+text(diffs[0].context, 10, 10);
974
+</script> <canvas id="ob-c5ac3c4c54147ecffc2f4eea88af7cca0a1a2f6d"></canvas>
890 975
 #+END_EXPORT
891 976
 
892 977
 *** Things to further investigate