forked from Javert899/pm4js-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ocel.html
1822 lines (1652 loc) · 77.8 KB
/
ocel.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html>
<head>
<link rel="stylesheet" href="ocel.css">
<script src="scripts/generic/jquery.min.js"></script>
<script src="scripts/generic/viz.js"></script>
<script src="scripts/generic/download-utility.js"></script>
<script src="scripts/generic/plotly-2.1.0.min.js"></script>
<script src="scripts/generic/sweetalert2.all.min.js"></script>
<script src="scripts/generic/bootstrap.min.js"></script>
<script src="scripts/generic/navigation.min.js"></script>
<script src="scripts/generic/fontawesome-all.min.js"></script>
<script src="scripts/generic/sorttable.js"></script>
<script src="scripts/generic/mxClient.min.js"></script>
<script src="scripts/generic/sql.js"></script>
<script src="scripts/generic/isolation-forest.js"></script>
<script src="scripts/pm4js_latest.js"></script>
<script src="scripts/ocel/eventsView.js"></script>
<script src="scripts/ocel/objectsView.js"></script>
<script src="scripts/ocel/edgesView.js"></script>
<script src="scripts/ocel/ocdfg_execution_graph.js"></script>
<script src="scripts/ocel/ocel_conf_num_objs.js"></script>
<script src="scripts/ocel/ocel_conf_lifecycle_objects.js"></script>
<script src="scripts/ocel/ocel_conf_duration_objects.js"></script>
<script src="scripts/ocel/ocdfg-model.js"></script>
<script src="scripts/ocel/ocdfg-visualization.js"></script>
<script src="scripts/ocel/eventsList.js"></script>
<script src="scripts/ocel/objectsList.js"></script>
<script src="scripts/ocel/plotly-graphs.js"></script>
<script src="scripts/ocel/celonis_connection.js"></script>
<script src="scripts/ocel/celonis_download.js"></script>
<script src="scripts/ocel/celonis_upload.js"></script>
<script src="scripts/ocel/ml-generic.js"></script>
<script src="scripts/ocel/ml-sql.js"></script>
<script src="scripts/ocel/ml-isolationForest.js"></script>
<script src="scripts/ocel/ml-pca.js"></script>
<script src="scripts/ocel/advanced_filtering.js"></script>
<script src="scripts/generic/jszip.min.js"></script>
<script src="scripts/generic/jszip-utils.min.js"></script>
<!--<script src="scripts/generic/ml.min.js"></script>-->
<script src="scripts/generic/decision-tree-min.js"></script>
<script src="scripts/ocel/ml-dt.js"></script>
<script src="scripts/generic/druid.min.js"></script>
<script src="scripts/generic/statistics.min.js"></script>
<script src="scripts/ocel/ml-stats.js"></script>
<link rel="stylesheet" href="static/bootstrap.min.css"></link>
<link rel="stylesheet" href="static/bootstrap-grid.min.css"></link>
<link rel="stylesheet" href="static/bootstrap-reboot.min.css"></link>
<link rel="stylesheet" href="static/navx-navigation.min.css"></link>
<link rel="stylesheet" href="static/navx-styles.css"></link>
<link rel="stylesheet" href="static/fontawesome-all.min.css"></link>
</head>
<body>
<div id="mainViewNoLoader" style="z-index: 100; display: ">
<script type="text/javascript">
let selectedActivity = null;
let selectedOt = null;
let selectedEdge = null;
let visualization = null;
let celonisUrl = null;
let celonisApi = null;
let celonisMapper = null;
let celonis1DWrapper = new Celonis1DWrapper(null);
let celonisNDWrapper = new CelonisNDWrapper(null);
let strAttributesForExtraction = null;
let numAttributesForExtraction = null;
let db = null;
let evFeatures = null;
let objFeatures = null;
let evFeaturesTable = null;
let objFeaturesTable = null;
let sqlDefaultQuery = "SELECT * FROM OCEL_OBJECTS LIMIT 20";
let evFeaturesNormalizedFiltered = null;
let objFeaturesNormalizedFiltered = null;
let evFeaturesCorrDct = null;
let objFeaturesCorrDct = null;
let featVarianceThreshold = 0.05;
var csvOcelContent = null;
var arr = null;
</script>
<div id="uploadPart" style="display: ">
<!--<img src="static/pads_rwth.png" /><br />
<h3>OC-DFG visualization</h3>
Welcome! Please upload an object-centric event log in the OCEL-XML and/or the OCEL-JSON formats.
-->
<div class=" h-100 d-flex justify-content-center align-items-center">
<div>
<img src="static/ocpm.png"></img>
<div style="height: 5%;">
</div>
<div style="text-align: center;">
<div>OC-PM is a novel application for object-centric process mining.</div>
<div>Logs in the JSON/XML-OCEL formats can be ingested,
and advanced visualizations/statistics are provided.</div>
<div>Please start by uploading an event log in the application.</div>
</div>
<div id="drop_zone" ondrop="handleFileSelect2(event)" ondragover="allowDrop(event)" style="height: 25%; width: 100%" class="d-flex justify-content-center align-items-center">
<p>Drag an object-centric event log to this drop zone ...</p>
</div>
<div id="initial_upload" style="height: 20%; width: 100%; display: " class="d-flex justify-content-center align-items-center">
... Or upload it using the following button: <input type="file" id="upload" />
</div>
<div id="celonis_connection_parameters" style="width: 100%; display: " style="text-align: center;">
<div>.. Or connect to Celonis and retrieve an analysis!</div>
<div>Celonis URL: <input id="celonis_url" type="text"></input> Celonis API: <input id="celonis_api" type="text"></input> <button class="btn btn-primary" onclick="javascript:connectToCelonis()">Connect</button></div>
</div>
<div id="celonis_waiting_circle" style="display: none; text-align: center;">
<div>Please select the analysis to download:</div>
<div>
<select name="dataModelSelectionUpload" id="dataModelSelectionUpload">
</select>
<button class="btn btn-primary" onclick="javascript:downloadDataModelFromCelonis()">Download</button>
</div>
</div>
</div>
</div>
</div>
<div id="csvUpload" style="display: none">
<script>
function CSVrenderTable(content=null, maxrow=15, targetTable="parsedCSV") {
if (content != null) {
csvOcelContent = content;
}
let sep = document.getElementById("CSVseparator").value;
let quotechar = document.getElementById("CSVquotechar").value;
arr = CsvImporter.parseCSV(csvOcelContent, sep, quotechar);
let innerHTML = [];
innerHTML.push("<table border='1' class='table'>");
innerHTML.push("<thead><tr>");
let j = 0;
while (j < arr[0].length) {
innerHTML.push("<th>"+arr[0][j]+"</th>");
j++;
}
innerHTML.push("</tr>");
innerHTML.push("</thead>");
innerHTML.push("<tbody>");
innerHTML.push("<tr>");
j = 0;
while (j < arr[0].length) {
innerHTML.push("<td><select id='csvoption_"+j+"' class='csvoption'>");
let actSelected = arr[0][j].toLowerCase().indexOf("act") > -1;
let timestSelected = arr[0][j].toLowerCase().indexOf("time") > -1;
let evIdSelected = arr[0][j].toLowerCase().indexOf("id") > -1;
let objTypeSelected = arr[0][j].toLowerCase().indexOf("type") > -1;
let selected = "";
if (!(actSelected || timestSelected || evIdSelected || objTypeSelected)) {
selected = " selected";
}
innerHTML.push("<option value='attribute'"+selected+">Event Attribute</option>");
selected = "";
if (actSelected) {
selected = " selected";
}
innerHTML.push("<option value='activity'"+selected+">Activity</option>");
selected = "";
if (timestSelected && (!(actSelected || evIdSelected || objTypeSelected))) {
selected = " selected";
}
innerHTML.push("<option value='timestamp'"+selected+">Timestamp</option>");
selected = "";
if (evIdSelected && (!(actSelected || timestSelected || objTypeSelected))) {
selected = " selected";
}
innerHTML.push("<option value='evid'"+selected+">Event ID</option>");
selected = "";
if (objTypeSelected && (!(actSelected || evIdSelected || timestSelected))) {
selected = " selected";
}
innerHTML.push("<option value='objtype'"+selected+">Object Type</option>");
innerHTML.push("</select></td>");
j++;
}
innerHTML.push("</tr>");
let i = 1;
while (i < Math.min(maxrow, arr.length)) {
innerHTML.push("<tr>");
j = 0;
while (j < arr[i].length) {
innerHTML.push("<td>"+arr[i][j]+"</td>");
j++;
}
innerHTML.push("</tr>");
i++;
}
innerHTML.push("</tbody></table>");
document.getElementById(targetTable).innerHTML = innerHTML.join();
}
function CSVconvertToOCEL() {
let sep = document.getElementById("CSVseparator").value;
let quotechar = document.getElementById("CSVquotechar").value;
let separators = [];
let objectQuotes = document.getElementById("CSVobjectquotes").value;
if (objectQuotes == "classic") {
separators = ["'", "\""];
}
let evIdColumn = [];
let activityColumn = [];
let timestColumn = [];
let attributes = [];
let objTypes = [];
for (let sel of document.getElementsByClassName("csvoption")) {
att = arr[0][parseInt(sel.id.split("csvoption_")[1])];
value = sel.value;
if (value == "evid") {
evIdColumn.push(att);
}
else if (value == "activity") {
activityColumn.push(att);
}
else if (value == "timestamp") {
timestColumn.push(att);
}
else if (value == "attribute") {
attributes.push(att);
}
else if (value == "objtype") {
objTypes.push(att);
}
}
let errors = [];
if (evIdColumn.length > 1) {
errors.push("At most one column must be selected as event identifier!");
}
if (activityColumn.length != 1) {
errors.push("Exactly one column must be selected as activity!");
}
if (timestColumn.length != 1) {
errors.push("Exactly one column must be selected as timestamp!");
}
if (objTypes.length == 0) {
errors.push("At least a column must be selected as object type!");
}
if (errors.length == 0) {
// can proceed
if (evIdColumn.length == 1) {
evIdColumn = evIdColumn[0];
}
else {
evIdColumn = null;
}
eventLog = CsvOcelImporter.apply(csvOcelContent, activityColumn[0], timestColumn[0], objTypes, attributes, evIdColumn, separators, sep, quotechar);
document.getElementById("uploadPart").style.display = "none";
document.getElementById("mainApplication").style.display = "";
document.getElementById("csvUpload").style.display = "none";
createVisualization();
}
else {
let innerHTML = "";
for (let err of errors) {
innerHTML += "<p style='color: red'>"+err+"</p>";
}
document.getElementById("CSVimportingErrors").innerHTML = innerHTML;
}
}
</script>
<div id="CSVpreliminaryParameters" class="container-fluid">
<p>Please select the correct values for the separator and the quote character of the CSV. Moreover, please provide a mapping for the columns
(i.e., which column is the activity, timestamp, object type, event attribute, event identifier).</p>
<span>Separator: <input type="text" id="CSVseparator" value=","></input></span>
<span>Quote characters: <input type="text" id="CSVquotechar" value='"'></input></span>
<span>Object Quotes:
<select id="CSVobjectquotes">
<option value="classic">Classic (' or ")</option>
<option value="absent">Absent</option>
</select>
</span>
<span><button onclick="javascript:CSVrenderTable()">Re-Build Table</button></span>
</div>
<div id="parsedCSV">
</div>
<div id="CSVimportingErrors">
</div>
<button onclick="javascript:CSVconvertToOCEL()">Obtain OCEL</button>
</div>
<div id="mainApplication" style="display: none" class="container-fluid">
<div id="header" style="background-color:" class="border-bottom" style="height: 81px">
<nav id="navigationHeader" class="navigation navigation-justified" style="background-image: url('static/top-background.png'); background-size:100% 100%;">
<div class="navigation-header">
</div>
<div class="navigation-body">
<ul class="navigation-menu">
<li class="navigation-item">
<div class="spinningcircle" id="spinningcircle" style="display: none"></div>
</li>
<li class="navigation-item">
<a href="ocel.html"><img src="static/ocpm_red.png"></img></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:showProcessModelPage()"><i class="fas fa-project-diagram"></i> <span style="font-size: 8pt"> Process Schema</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:showEventsList()"><i class="fas fa-atom"></i><span style="font-size: 10pt"> Events</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:showObjectsList()"><i class="fas fa-database"></i> <span style="font-size: 10pt"> Objects</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:showMachineLearning()"><i class="fab fa-mixer"></i> <span style="font-size: 8pt"> Machine Learning</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:showAdvancedFiltering()"><i class="fas fa-camera"></i> <span style="font-size: 8pt"> Advanced Filtering</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:showGraphs()"><i class="fas fa-chart-pie"></i> <span style="font-size: 10pt"> Statistics</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:showConformance()"><i class="fas fa-bell"></i> <span style="font-size: 10pt"> Conformance</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:downloadSVG()"><i class="fas fa-download"></i> <span style="font-size: 10pt"> SVG</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:downloadJsonOcel()"><i class="fas fa-download"></i> <span style="font-size: 10pt"> JSON</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:downloadXmlOcel2()"><i class="fas fa-download"></i> <span style="font-size: 10pt"> XML2</span></a>
</li>
<!--<li class="navigation-item">
<a class="navigation-link" href="javascript:downloadSqliteOcel2()"><i class="fas fa-download"></i> <span style="font-size: 10pt"> SQLite</span></a>
</li>-->
</ul>
</div>
</nav>
</div>
<div id="processModelPage" style="display:; overflow: hidden">
<div class="row" id="processModelStatsModelContainer" style="height: calc(100vh - 81px);">
<!-- style="background-image: url('static/left-background.png'); background-size:100% 100%;"-->
<div class="align-self-center text-center" style="width: 190px">
<div class="panel panel-default">
<div class="panel-heading"><h4>Statistics</h4></div>
<div class="panel-body">
<div>N. Events:</div>
<div id="numEvents0">
<span id="numEvents" style="font-family: geneva; font-weight: bold; font-size: 18pt">0</span>/<span id="numEventsOriginal" style="font-family: geneva; font-weight: bold; font-size: 18pt">0</span>
</div>
<div>N. Unique Objects:</div>
<div id="numUniqueObjects0">
<span id="numUniqObjects" style="font-family: geneva; font-weight: bold; font-size: 18pt">0</span>/<span id="numUniqObjectsOriginal" style="font-family: geneva; font-weight: bold; font-size: 18pt">0</span>
</div>
<div>N. Total Objects:</div>
<div id="numTotalObjects0">
<span id="numTotalObjects" style="font-family: geneva; font-weight: bold; font-size: 18pt">0</span>/<span id="numTotalObjectsOriginal" style="font-family: geneva; font-weight: bold; font-size: 18pt">0</span>
</div>
</div>
</div>
<div> </div>
<div class="panel panel-default">
<div class="panel-heading"><h4>Sliders</h4></div>
<div class="panel-body">
<div>% of Activities:</div>
<div><input id="af_slider" type="range" min="0" max="100" value="70" class="slider form-range"></div>
<div>% of Paths:</div>
<div><input id="pf_slider" type="range" min="0" max="100" value="0" class="slider form-range"></div>
<div> </div>
<div><button id="apply_changes" onclick="doVisualization()" class="btn btn-primary">Apply Sliders</button></div>
</div>
</div>
</div>
<div class="border-left" style="width: calc(98vw - 190px);">
<div id="graphContainerHeader">
<nav id="navigationGraph" class="navigation navigation-justified border-bottom">
<div class="navigation-header">
</div>
<div class="navigation-body">
<ul class="navigation-menu">
<div class="navigation-row" style="font-size: 13pt">
<div>Visualization:
<select id="visualizationType" class="form-select">
<option value="bpmn">OC-BPMN</option>
<option value="bpmnPerformance">OC-BPMN (performance)</option>
<option value="petriNet">OC-Petri Net</option>
<option value="petriNetPerformance">OC-Petri Net (performance)</option>
<option value="dfg" selected>OC-DFG</option>
</select></div>
<div>Annotation:
<select id="annotationSelector" class="form-select">
<option id="events" value="0">Events (E/EC)</option>
<option id="unique_objects" value="1" selected>Unique Objects (UO)</option>
<option id="total_objects" value="2">Total Objects (TO)</option>
</select></div>
<div>Orientation:
<select id="orientationSelector" class="form-select">
<option id="horizontal" value="horizontal" selected>Horizontal</option>
<option id="vertical" value="vertical">Vertical</option>
</select></div>
<div><button id="apply_changes2" onclick="doVisualization()" class="btn btn-primary">Apply</button></div>
</div>
<div class="navigation-row" style="font-size: 13pt">
<div>Filters:</div>
<div id="filtersList" style="font-weight: bold">
No filter is applied currently.
</div>
<div><button id="reset_filters" onclick="resetFilters()" class="btn btn-primary">Reset All Filters</button></div>
</div>
</ul>
</div>
</nav>
</div>
<div id="graphContainer0" style="height: calc(100vh - 162px); width: 100%; background-color: white; overflow: scroll;">
<div id="graphContainer"></div>
</div>
</div>
<ul id="menu" style="display: none">
</ul>
</div>
<script type="text/javascript">
var navigationGraph = null;
var conformanceNavigation = null;
var mlNavigation = null;
var allFilters = [];
function doVisualization(initNavGraph=true) {
let af = document.getElementById("af_slider").value / 100.0;
let pf = document.getElementById("pf_slider").value / 100.0;
let annotation = parseInt(document.getElementById("annotationSelector").value);
visualization.ACTIVITY_FREQUENCY = af;
visualization.PATHS_FREQUENCY = pf;
visualization.IDX = annotation;
visualization.displayType = document.getElementById("visualizationType").value;
visualization.DEFAULT_DIRECTION = document.getElementById("orientationSelector").value;
visualization.represent();
if (navigationGraph == null && initNavGraph) {
navigationGraph = new Navigation(document.getElementById("navigationGraph"));
navigationGraph = 1;
}
}
function resetFilters() {
resetPageFilters();
visualization.resetFilters();
doVisualization(false);
}
function resetPageFilters() {
allFilters = [];
let filtersContainer = document.getElementById("filtersList");
filtersContainer.innerHTML = "No filter is applied currently. ";
}
function deleteFilter(index) {
allFilters.splice(index, 1);
setFilters();
doVisualization(false);
}
function setFilters() {
visualization.resetFilters();
for (let filter of allFilters) {
addFilter(filter[0], filter[1], false);
}
setFiltersOnPage();
}
function addFilter(filterDescription, filterMethod, addToPage=true) {
let thisUuid = Pm4JS.startAlgorithm({"name": "OCPM addFilter"});
setTimeout(function() {
if (addToPage) {
this.allFilters.push([filterDescription, filterMethod]);
}
setFiltersOnPage();
eval(filterMethod);
Pm4JS.stopAlgorithm(thisUuid, {});
}, 100);
}
function setFiltersOnPage() {
let filtersContainer = document.getElementById("filtersList");
if (allFilters.length == 0) {
filtersContainer.innerHTML = "No filter is applied currently. ";
}
else {
filtersContainer.innerHTML = "";
for (let filterId in allFilters) {
let filterLi = document.createElement("div");
filtersContainer.appendChild(filterLi);
filterLi.innerHTML = allFilters[filterId][0];
let cancelFilter = document.createElement("a");
cancelFilter.href = "javascript:deleteFilter("+filterId+")";
cancelFilter.innerHTML = "<i class=\"fas fa-trash\"></i> ";
filterLi.appendChild(cancelFilter);
}
}
}
function downloadJsonOcel() {
let thisUuid = Pm4JS.startAlgorithm({"name": "OCPM downloadJsonOcel"});
setTimeout(function() {
let jsonStri = JsonOcel2Exporter.apply(visualization.model.ocel);
download(jsonStri, "obj-centr-log.jsonocel", "text/json");
Pm4JS.stopAlgorithm(thisUuid, {});
}, 100);
}
function downloadSVG() {
let thisUuid = Pm4JS.startAlgorithm({"name": "OCPM downloadSVG"});
setTimeout(function() {
visualization.exportSvg(visualization.graph);
Pm4JS.stopAlgorithm(thisUuid, {});
}, 100);
}
function downloadXmlOcel() {
let thisUuid = Pm4JS.startAlgorithm({"name": "OCPM downloadXmlOcel"});
setTimeout(function() {
let xmlStri = XmlOcelExporter.exportLog(visualization.model.ocel);
download(xmlStri, "obj-centr-log.xmlocel", "text/xml");
Pm4JS.stopAlgorithm(thisUuid, {});
}, 100);
}
function downloadXmlOcel2() {
let thisUuid = Pm4JS.startAlgorithm({"name": "OCPM downloadXmlOcel2"});
setTimeout(function() {
let xmlStri = Xml2OcelExporter.exportLog(visualization.model.ocel);
download(xmlStri, "obj-centr-log.xml", "text/xml");
Pm4JS.stopAlgorithm(thisUuid, {});
}, 100);
}
function downloadSqliteOcel2() {
let thisUuid = Pm4JS.startAlgorithm({"name": "OCPM downloaSqliteOcel2"});
setTimeout(function() {
let xmlStri = SqliteOcel2Exporter.exportLog(visualization.model.ocel);
download(xmlStri, "obj-centr-log.sqlite", "application/x-sqlite3");
Pm4JS.stopAlgorithm(thisUuid, {});
}, 100);
}
function downloadCsvOcel() {
let thisUuid = Pm4JS.startAlgorithm({"name": "OCPM downloadCsvOcel"});
setTimeout(function() {
let csvStri = CsvOcelExporter.apply(visualization.model.ocel);
download(csvStri, "obj-centr-log.csv", "text/csv");
Pm4JS.stopAlgorithm(thisUuid, {});
}, 100);
}
function flattenEventLog() {
let thisUuid = Pm4JS.startAlgorithm({"name": "OCPM downloadCsvOcel"});
setTimeout(function() {
let ot = document.getElementById("flatteningOt").value;
let eventLog = OcelFlattening.flatten(visualization.model.ocel, ot);
let xmlStri = XesExporter.apply(eventLog);
download(xmlStri, "flattened.xes", "text/xml");
Pm4JS.stopAlgorithm(thisUuid, {});
}, 100);
}
function expandActivity() {
setTimeout(function() {
visualization.doExpandActivity(selectedActivity);
visualization.represent();
}, 100);
}
function expandEdge() {
setTimeout(function() {
visualization.expandedEdges[selectedEdge] = 0;
visualization.represent();
}, 100);
}
function seeRelatedObjAct() {
let relObj = visualization.model.getRelObjActivity(selectedActivity, selectedOt);
let stru = relObj.toString();
if (stru.length > 1000) {
stru = stru.substring(0, 999) + "...";
}
Swal.fire({title: "Related Objects", confirmButton: "ok", html: stru});
}
function filterRelatedObjectsActivity() {
return addFilter("<i class=\"fas fa-plus-circle\"></i>Related objects ("+selectedActivity+";"+selectedOt+") ", "filterRelatedObjectsActivitySpecific(\""+selectedActivity+"\", \""+selectedOt+"\")");
}
function filterNonRelatedObjectsActivity() {
return addFilter("<i class=\"fas fa-minus-circle\"></i> Non related objects ("+selectedActivity+";"+selectedOt+") ", "filterNonRelatedObjectsActivitySpecific(\""+selectedActivity+"\", \""+selectedOt+"\")");
}
function filterNonStartingWith() {
return addFilter("<i class=\"fas fa-chevron-right\"></i> Non starting with ("+selectedActivity+";"+selectedOt+") ", "filterNonStartingWithSpecific(\""+selectedActivity+"\", \""+selectedOt+"\")");
}
function filterNonEndingWith() {
return addFilter("<i class=\"fas fa-chevron-left\"></i> Non ending with ("+selectedActivity+";"+selectedOt+") ", "filterNonEndingWithSpecific(\""+selectedActivity+"\", \""+selectedOt+"\")");
}
function filterRelatedObjectsEdge() {
return addFilter("<i class=\"fas fa-user-plus\"></i> Related objects to edge ("+selectedEdge[0]+"->"+selectedEdge[1]+"@"+selectedEdge[2]+") ", "filterRelatedObjectsEdgeSpecific(\""+selectedEdge[0]+"\", \""+selectedEdge[1]+"\", \""+selectedEdge[2]+"\")");
}
function filterNonRelatedObjectsEdge() {
return addFilter("<i class=\"fas fa-user-minus\"></i> Non related objects to edge ("+selectedEdge[0]+"->"+selectedEdge[1]+"@"+selectedEdge[2]+") ", "filterNonRelatedObjectsEdgeSpecific(\""+selectedEdge[0]+"\", \""+selectedEdge[1]+"\", \""+selectedEdge[2]+"\")");
}
function filterObjectTypes() {
let selectedOptions = [];
for (let option of document.getElementById("objectTypes").children) {
if (option.selected) {
selectedOptions.push(option.value);
}
}
return addFilter("<i class=\"fab fa-superpowers\"></i> Object types filter ", "filterObjectsTypesSpecific(\""+selectedOptions.toString()+"\")");
}
function filterRelatedObjectsActivitySpecific(selectedActivity, selectedOt) {
if (selectedOt == "null") {
selectedOt = null;
}
let relObj = visualization.model.getRelObjActivity(selectedActivity, selectedOt);
let filteredModel = visualization.model.filterRelatedObjects(relObj);
visualization.setFilteredModel(filteredModel);
}
function filterNonRelatedObjectsActivitySpecific(selectedActivity, selectedOt) {
if (selectedOt == "null") {
selectedOt = null;
}
let relObj = visualization.model.getRelObjActivity(selectedActivity, selectedOt);
let allObjOt = Object.keys(visualization.model.otObjectsView[selectedOt].objectsIds);
let difference = allObjOt.filter(x => !relObj.includes(x));
let filteredModel = visualization.model.filterNonRelatedObjects(difference, relObj);
visualization.setFilteredModel(filteredModel);
}
function filterNonStartingWithSpecific(selectedActivity, selectedOt) {
if (selectedOt == "null") {
selectedOt = null;
}
let startingWith = visualization.model.otObjectsView[selectedOt].getStartingWith(selectedActivity);
let allObjOt = Object.keys(visualization.model.otObjectsView[selectedOt].objectsIds);
let difference = allObjOt.filter(x => !startingWith.includes(x));
let filteredModel = visualization.model.filterNonRelatedObjects(difference, startingWith);
visualization.setFilteredModel(filteredModel);
}
function filterNonEndingWithSpecific(selectedActivity, selectedOt) {
if (selectedOt == "null") {
selectedOt = null;
}
let endingWith = visualization.model.otObjectsView[selectedOt].getEndingWith(selectedActivity);
let allObjOt = Object.keys(visualization.model.otObjectsView[selectedOt].objectsIds);
let difference = allObjOt.filter(x => !endingWith.includes(x));
let filteredModel = visualization.model.filterNonRelatedObjects(difference, endingWith);
visualization.setFilteredModel(filteredModel);
}
function filterRelatedObjectsEdgeSpecific(sourceActivity, targetActivity, objectType) {
if (selectedOt == "null") {
selectedOt = null;
}
let relObj = visualization.model.getRelObjEdge([sourceActivity, targetActivity], objectType);
let filteredModel = visualization.model.filterRelatedObjects(relObj);
visualization.setFilteredModel(filteredModel);
}
function filterNonRelatedObjectsEdgeSpecific(sourceActivity, targetActivity, objectType) {
if (selectedOt == "null") {
selectedOt = null;
}
let relObj = visualization.model.getRelObjEdge([selectedEdge[0], selectedEdge[1]], selectedEdge[2]);
let allObjOt = Object.keys(visualization.model.otObjectsView[selectedEdge[2]].objectsIds);
let difference = allObjOt.filter(x => !relObj.includes(x));
let filteredModel = visualization.model.filterNonRelatedObjects(difference, relObj);
visualization.setFilteredModel(filteredModel);
}
function filterObjectsTypesSpecific(selectedOptions) {
selectedOptions = selectedOptions.split(",");
let filteredModel = visualization.model.filterObjectTypes(selectedOptions);
visualization.setFilteredModel(filteredModel);
}
function seeRelatedObjEdge() {
let relObj = visualization.model.getRelObjEdge([selectedEdge[0], selectedEdge[1]], selectedEdge[2]);
let stru = relObj.toString();
if (stru.length > 1000) {
stru = stru.substring(0, 999) + "...";
}
Swal.fire({title: "Related Objects", confirmButton: "ok", html: stru});
}
function callbackActivity(activity, ot) {
selectedActivity = activity;
selectedOt = ot;
}
function callbackEdge(edge) {
selectedEdge = edge;
}
function callbackStatistics(events, uo, to, originalEvents, originalUo, originalTo) {
document.getElementById("numEvents").innerHTML = events;
document.getElementById("numUniqObjects").innerHTML = uo;
document.getElementById("numTotalObjects").innerHTML = to;
document.getElementById("numEventsOriginal").innerHTML = originalEvents;
document.getElementById("numUniqObjectsOriginal").innerHTML = originalUo;
document.getElementById("numTotalObjectsOriginal").innerHTML = originalTo;
}
function allowDrop(ev) {
ev.preventDefault();
}
function handleFileSelect2(evt) {
console.log(evt);
evt.preventDefault();
var files = evt.dataTransfer.files;
f = files[0];
var reader = new FileReader();
reader.onload = function(e) {
loadFileCommon(e, f);
}
reader.readAsBinaryString(f);
//reader.readAsText(f);
}
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
// use the 1st file from the list
f = files[0];
var reader = new FileReader();
reader.onload = function(e) {
loadFileCommon(e, f);
}
reader.readAsBinaryString(f);
//reader.readAsText(f);
}
function loadFileCommon(e, f) {
let contentStri = e.target.result;
return loadContentStri(f.name, contentStri);
}
function loadContentStri(fileName, contentStri) {
if (fileName.endsWith(".zip")) {
JSZip.loadAsync(contentStri).then(function (zip) {
for (f in zip.files) {
zip.file(f).async("string").then(function(unzipped) {
loadContentStri(f, unzipped);
});
break;
}
});
}
else if (fileName.endsWith(".xml") || fileName.endsWith(".xml2")) {
eventLog = Xml2OcelImporter.importLog(contentStri);
createVisualization();
}
else if (fileName.endsWith(".xmlocel")) {
eventLog = XmlOcelImporter.importLog(contentStri);
createVisualization();
}
else if (fileName.endsWith(".jsonocel")) {
eventLog = JsonOcelImporter.importLog(contentStri);
createVisualization();
}
else if (fileName.endsWith(".sqlite")) {
eventLog = SqliteOcel2Importer.importLog(contentStri);
createVisualization();
}
else {
document.getElementById("uploadPart").style.display = "none";
document.getElementById("mainApplication").style.display = "none";
document.getElementById("csvUpload").style.display = "";
CSVrenderTable(contentStri);
}
}
function createVisualization() {
document.getElementById("mainApplication").style.display = "";
document.getElementById("csvUpload").style.display = "none";
document.getElementById("uploadPart").style.display = "none";
visualization = new OcdfgVisualization(new OcdfgModel(eventLog), "graphContainer");
visualization.callbackActivity = callbackActivity;
visualization.callbackEdge = callbackEdge;
visualization.callbackStatistics = callbackStatistics;
visualization.populateStatistics();
doVisualization();
}
document.getElementById('upload').addEventListener('change', handleFileSelect, false);
</script>
</div>
<script type="text/javascript">
var numEvents = 0;
var currStart0 = 0;
var currEnd0 = 0;
var currStart = 0;
var currEnd = 0;
var pageSize = 500;
</script>
<div id="eventsListPage" style="display: none; font-size: 15pt;">
<p>The page shows the list of events of the log. Each event is distinguished by its fundamental properties (ID, activity and timestamp),
a list of related objects for each type, and values for some attributes. Clicking an object, it is possible to see the lifecycle
of the object.</p>
<div>
<b>Number of events:</b> <span id="numEventsEventsPage"></span>
<b>Current displayed range:</b> <span id="currStartEventsPage"></span>-<span id="currEndEventsPage"></span>
<button class="button" onclick="javascript:decreaseRange()">←</button><button class="button" onclick="javascript:increaseRange()">→</button>
</div>
<table id="eventsListTable" border="1" class="table">
</table>
</div>
<div id="objectsListPage" style="display: none; font-size: 15pt;">
<nav id="objectsPageNavigation" class="navigation navigation-justified border-bottom">
<div class="navigation-header">
</div>
<div class="navigation-body">
<ul class="navigation-menu">
<li class="navigation-item">
<a class="navigation-link" href="javascript:showObjectsList1()"><i class="fas fa-database"></i> <span style="font-size: 13pt">Objects List</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:showObjectsObjRelations1()"><i class="fas fa-database"></i> <span style="font-size: 13pt">Relations Visualization (1)</span></a>
</li>
<li class="navigation-item">
<a class="navigation-link" href="javascript:showObjectsObjRelations2()"><i class="fas fa-database"></i> <span style="font-size: 13pt">Relations Visualization (2)</span></a>
</li>
</ul>
</div>
</nav>
<div id="objectsListPage1" style="display: none">
<p>The page shows the properties of the objects, after the selection of an object type. Each object is distinguished by the timestamp of the first
event of its lifecycle, the timestamp of the last event of its lifecycle, and the difference between them.</p>
<p>To start, please select an object type:
<select id="otObjListSelection" class="form-select">
</select>
<button id="showObjListOt" onclick="showObjListOt()" class="btn btn-primary">Show the list of Objects</button>
</p>
<div style="height: 80%; overflow-y: scroll">
<table id="objectsListTable" border="1" class="table">
</table>
</div>
</div>
<div id="objectsObjRelations1" style="display: none">
<div id="objectsObjRelations1Vis">
</div>
</div>
<div id="objectsObjRelations2" style="display: none">
<div id="objectsObjRelations2Vis">
</div>
</div>
</div>
<div id="executionsPage" style="display: none; font-size: 15pt;">
<p>An execution describes the connection between the lifecycle of different objects. Executions can be grouped together if they are equivalent in
the involved object types.</p>
<table id="executionsTable" border="1" class="table">
</table>
</div>
<div id="networkAnalysisPage" style="display: none; font-size: 15pt;">
<table id="networkAnalysisContainer" style="width: 100%; height: 85%">
<tr>
<td style="width: 15%; font-size: 9pt">
<p>
Link Method<br />
<select id="NAlinkMethod" name="NAlinkMethod">
<option value="graph" selected>Graph-based</option>
<option value="outIn">OUT-IN attribute</option>
</select>
</p>
<p>
Graph Link<br />
<select id="NAgraphLink" name="NAgraphLink">
<option value="descendants" selected>Descendants Graph</option>
<option value="interaction">Interaction Graph</option>
<option value="cobirth">Cobirth Graph</option>
<option value="codeath">Codeath Graph</option>
<option value="inheritance">Inheritance Graph</option>
</select>
</p>
<p>
OUT-attribute<br />
<select id="NAoutAttribute" name="NAoutAttribute">
<option value="ocel:activity" selected>ocel:activity</option>
</select>
</p>
<p>
IN-attribute<br />
<select id="NAinAttribute" name="NAinAttribute">
<option value="ocel:activity" selected>ocel:activity</option>
</select>
</p>
<p>
<input type="checkbox" id="NAkeepFirst" name="NAkeepFirst" checked></input>
<label for="NAkeepFirst">Keep First Link</label>
</p>
<p>
<input type="checkbox" id="NAexpandLinks" name="NAexpandLinks"></input>
<label for="NAexpandLinks">Expand Links</label>
</p>
<p>
SN aggregation<br />
<select id="NAsnAttribute" name="NAsnAttribute">
<option value="ocel:activity" selected>ocel:activity</option>
</select>
</p>
<p>
TN aggregation<br />
<select id="NAtnAttribute" name="NAtnAttribute">
<option value="ocel:activity" selected>ocel:activity</option>
</select>
</p>
<p>
E agg. place<br />
<select id="NAedgeAggPlace" name="NAedgeAggPlace">
<option value="source" selected>Source Node</option>
<option value="target">Target Node</option>
</select>
</p>
<p>
E agg. attr.<br />
<select id="NAedgeAggAttribute" name="NAedgeAggAttribute">
<option value="ocel:activity" selected>ocel:activity</option>
</select>
</p>
<p>
Annotation<br />
<select id="NAannotation" name="NAannotation">
<option value="frequency" selected>Frequency</option>
<option value="performance">Performance</option>
</select>
</p>
<button class="btn btn-primary" id="NAapply" name="NAapply" onclick="javascript:applyNetworkAnalysisConfiguration()">Apply Configuration</button>
</td>
<td style="width: 85%;">
<div id="naGraphvizContainer">
</div>
</td>
</tr>
</table>
</div>
<div id="advancedFilteringPage" style="display: none; font-size: 15pt;">
<div>
<h4><a href="javascript:filterMinOccurrencesActivity()">Filter Activities having a Minimum Number of Occurrences</a></h4>
</div>
<div>
<h4><a href="javascript:filterEssentialEvents()">Filter Essential Events</a></h4>
</div>
<div>
<h4><a href="javascript:filterEssentialEventsOrMinOccurrencesActivity()">Filter Essential Events OR Activities having a Minimum Number of Occurrences</a></h4>
</div>
<div>
<h4><a href="javascript:filterOtMinNumRelatedObjects()">Filter Object Types having a Minimum Number of Objects</a></h4>
</div>
<div>
<h4><a href="javascript:filterOtMinNumRelatedEvents()">Filter Object Types having a Minimum Number of Related Events</a></h4>
</div>
<div>
<h4><a href="javascript:filterRateUniqueActivities()">Filter Object Types having a Minimum Rate of Unique Activities</a></h4>
</div>
<div>
<h4><a href="javascript:sampleEventLogFiltering()">Random Sampling Event Log (connected components)</a></h4>
</div>
<div>
<h4><a href="javascript:randomSampleEvents()">Random Sampling Event Log (random events)</a></h4>
</div>
<div>
<h4><a href="javascript:randomSampleObjects()">Random Sampling Event Log (random objects)</a></h4>
</div>
<div>
<h4><a href="javascript:randomSampleObjectTypes()">Random Sampling Event Log (random object types)</a></h4>
</div>
<div>