/
SharedTestDataADM.scala
3046 lines (2862 loc) · 130 KB
/
SharedTestDataADM.scala
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
/*
* Copyright © 2015-2018 the contributors (see Contributors.md).
*
* This file is part of Knora.
*
* Knora is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Knora is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with Knora. If not, see <http://www.gnu.org/licenses/>.
*/
package org.knora.webapi.sharedtestdata
import java.net.URLEncoder
import java.time.Instant
import java.util.UUID
import org.knora.webapi.IRI
import org.knora.webapi.messages.admin.responder.groupsmessages.GroupADM
import org.knora.webapi.messages.admin.responder.permissionsmessages.{PermissionADM, PermissionsDataADM}
import org.knora.webapi.messages.admin.responder.projectsmessages.ProjectADM
import org.knora.webapi.messages.admin.responder.usersmessages.UserADM
import org.knora.webapi.messages.store.triplestoremessages.StringLiteralV2
import org.knora.webapi.messages.util.KnoraSystemInstances
import org.knora.webapi.messages.{OntologyConstants, StringFormatter}
import org.knora.webapi.sharedtestdata.SharedOntologyTestDataADM.IMAGES_ONTOLOGY_IRI
/**
* This object holds the same user which are loaded with 'test_data/all_data/admin-data.ttl'. Using this object
* in tests, allows easier updating of details as they change over time.
*/
object SharedTestDataADM {
/** ***********************************/
/** System Admin Data **/
/** ***********************************/
val SYSTEM_PROJECT_IRI: IRI = OntologyConstants.KnoraAdmin.SystemProject // built-in project
val testPass: String = java.net.URLEncoder.encode("test", "utf-8")
/* represents the user profile of 'root' as found in admin-data.ttl */
def rootUser: UserADM = UserADM(
id = "http://rdfh.ch/users/root",
username = "root",
email = "root@example.com",
password = Option("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "System",
familyName = "Administrator",
status = true, lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq.empty[ProjectADM],
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
SYSTEM_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.SystemAdmin)
),
administrativePermissionsPerProject = Map.empty[IRI, Set[PermissionADM]]
))
/* represents the user profile of 'superuser' as found in admin-data.ttl */
def superUser: UserADM = UserADM(
id = "http://rdfh.ch/users/superuser",
username = "superuser",
email = "super.user@example.com",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "Super",
familyName = "User",
status = true,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq.empty[ProjectADM],
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
SYSTEM_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.SystemAdmin)
)
))
/* represents the user profile of 'superuser' as found in admin-data.ttl */
def normalUser: UserADM = UserADM(
id = "http://rdfh.ch/users/normaluser",
username = "normaluser",
email = "normal.user@example.com",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "Normal",
familyName = "User",
status = true,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq.empty[ProjectADM],
sessionId = None,
permissions = PermissionsDataADM())
/* represents the user profile of 'inactive user' as found in admin-data.ttl */
def inactiveUser: UserADM = UserADM(
id = "http://rdfh.ch/users/inactiveuser",
username = "inactiveuser",
email = "inactive.user@example.com",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "Inactive",
familyName = "User",
status = false,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq.empty[ProjectADM],
sessionId = None,
permissions = PermissionsDataADM())
/* represents an anonymous user */
def anonymousUser: UserADM = KnoraSystemInstances.Users.AnonymousUser
/* represents the 'multiuser' as found in admin-data.ttl */
def multiuserUser: UserADM = UserADM(
id = "http://rdfh.ch/users/multiuser",
username = "multiuser",
email = "multi.user@example.com",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "Multi",
familyName = "User",
status = true,
lang = "de",
groups = Seq(imagesReviewerGroup),
projects = Seq(incunabulaProject, imagesProject),
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
INCUNABULA_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.ProjectMember, OntologyConstants.KnoraAdmin.ProjectAdmin),
IMAGES_PROJECT_IRI -> List("http://rdfh.ch/groups/00FF/images-reviewer", OntologyConstants.KnoraAdmin.ProjectMember, OntologyConstants.KnoraAdmin.ProjectAdmin)
),
administrativePermissionsPerProject = Map(
INCUNABULA_PROJECT_IRI -> Set(
PermissionADM.ProjectAdminAllPermission,
PermissionADM.ProjectResourceCreateAllPermission
),
IMAGES_PROJECT_IRI -> Set(
PermissionADM.ProjectAdminAllPermission,
PermissionADM.ProjectResourceCreateAllPermission
)
)
))
/* represents the full project info of the Knora System project */
def systemProject: ProjectADM = ProjectADM(
id = OntologyConstants.KnoraAdmin.SystemProject,
shortname = "SystemProject",
shortcode = "FFFF",
longname = Some("Knora System Project"),
description = Seq(StringLiteralV2(value = "Knora System Project", language = Some("en"))),
keywords = Seq.empty[String],
logo = None,
ontologies = Seq(OntologyConstants.KnoraBase.KnoraBaseOntologyIri, OntologyConstants.KnoraAdmin.KnoraAdminOntologyIri, OntologyConstants.SalsahGui.SalsahGuiOntologyIri, OntologyConstants.Standoff.StandoffOntologyIri),
status = true,
selfjoin = false
)
val DefaultSharedOntologiesProjectIri: IRI = OntologyConstants.KnoraAdmin.DefaultSharedOntologiesProject // built-in project
/* represents the full project info of the default shared ontologies project */
def defaultSharedOntologiesProject: ProjectADM = ProjectADM(
id = OntologyConstants.KnoraAdmin.DefaultSharedOntologiesProject,
shortname = "DefaultSharedOntologiesProject",
shortcode = "0000",
longname = Some("Default Knora Shared Ontologies Project"),
description = Seq(StringLiteralV2(value = "Default Knora Shared Ontologies Project", language = Some("en"))),
keywords = Seq.empty[String],
logo = None,
ontologies = Seq.empty[IRI],
status = true,
selfjoin = false
)
/** ***********************************/
/** Images Demo Project Admin Data **/
/** ***********************************/
val IMAGES_PROJECT_IRI = "http://rdfh.ch/projects/00FF"
/* represents 'user01' as found in admin-data.ttl */
def imagesUser01: UserADM = UserADM(
id = "http://rdfh.ch/users/c266a56709",
username = "user01.user1", email = "user01.user1@example.com",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "User01",
familyName = "User",
status = true,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq(imagesProject),
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
IMAGES_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.ProjectMember, OntologyConstants.KnoraAdmin.ProjectAdmin)
),
administrativePermissionsPerProject = Map(
IMAGES_PROJECT_IRI -> Set(
PermissionADM.ProjectAdminAllPermission,
PermissionADM.ProjectResourceCreateAllPermission
)
)
))
/* represents 'user02' as found in admin-data.ttl */
def imagesUser02: UserADM = UserADM(
id = "http://rdfh.ch/users/97cec4000f",
username = "user02.user",
email = "user02.user@example.com",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "User02",
familyName = "User",
status = true,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq(imagesProject),
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
IMAGES_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.ProjectMember)
),
administrativePermissionsPerProject = Map(
IMAGES_PROJECT_IRI -> Set(
PermissionADM.ProjectResourceCreateAllPermission
)
)
))
/* represents 'images-reviewer-user' as found in admin-data.ttl */
def imagesReviewerUser: UserADM = UserADM(
id = "http://rdfh.ch/users/images-reviewer-user",
username = "images-reviewer-user",
email = "images-reviewer-user@example.com",
password = Some("$2a$10$fTEr/xVjPq7UBAy1O6KWKOM1scLhKGeRQdR4GTA997QPqHzXv0MnW"),
token = None,
givenName = "User03",
familyName = "User",
status = true,
lang = "de",
groups = Seq(imagesReviewerGroup),
projects = Seq(imagesProject),
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
IMAGES_PROJECT_IRI -> List("http://rdfh.ch/groups/00FF/images-reviewer", OntologyConstants.KnoraAdmin.ProjectMember)
),
administrativePermissionsPerProject = Map(
IMAGES_PROJECT_IRI -> Set(
PermissionADM.projectResourceCreateRestrictedPermission(s"$IMAGES_ONTOLOGY_IRI#bild"),
PermissionADM.projectResourceCreateRestrictedPermission(s"$IMAGES_ONTOLOGY_IRI#bildformat")
)
)
))
/* represents the full project info of the images project */
def imagesProject: ProjectADM = ProjectADM(
id = IMAGES_PROJECT_IRI,
shortname = "images",
shortcode = "00FF",
longname = Some("Image Collection Demo"),
description = Seq(StringLiteralV2(value = "A demo project of a collection of images", language = Some("en"))),
keywords = Seq("images", "collection").sorted,
logo = None,
ontologies = Seq(SharedOntologyTestDataADM.IMAGES_ONTOLOGY_IRI),
status = true,
selfjoin = false
)
/* represents the full GroupInfoV1 of the images ProjectAdmin group */
def imagesProjectAdminGroup: GroupADM = GroupADM(
id = "-",
name = "ProjectAdmin",
description = "Default Project Admin Group",
project = imagesProject,
status = true,
selfjoin = false
)
/* represents the full GroupInfoV1 of the images ProjectMember group */
def imagesProjectMemberGroup: GroupADM = GroupADM(
id = "-",
name = "ProjectMember",
description = "Default Project Member Group",
project = imagesProject,
status = true,
selfjoin = false
)
/* represents the full GroupInfoV1 of the images project reviewer group */
def imagesReviewerGroup: GroupADM = GroupADM(
id = "http://rdfh.ch/groups/00FF/images-reviewer",
name = "Image reviewer",
description = "A group for image reviewers.",
project = imagesProject,
status = true,
selfjoin = false
)
/** ***********************************/
/** Incunabula Project Admin Data **/
/** ***********************************/
val INCUNABULA_PROJECT_IRI = "http://rdfh.ch/projects/0803"
/* represents 'testuser' (Incunabula ProjectAdmin) as found in admin-data.ttl */
def incunabulaProjectAdminUser: UserADM = UserADM(
id = "http://rdfh.ch/users/b83acc5f05",
username = "user.test",
email = "user.test@example.com",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "User",
familyName = "Test",
status = true,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq(incunabulaProject),
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
INCUNABULA_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.ProjectMember, OntologyConstants.KnoraAdmin.ProjectAdmin)
),
administrativePermissionsPerProject = Map(
INCUNABULA_PROJECT_IRI -> Set(
PermissionADM.ProjectAdminAllPermission,
PermissionADM.ProjectResourceCreateAllPermission
)
)
))
/* represents 'root-alt' (Incunabula ProjectMember) as found in admin-data.ttl */
def incunabulaCreatorUser: UserADM = UserADM(
id = "http://rdfh.ch/users/91e19f1e01",
username = "root-alt",
email = "root-alt@example.com",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "Administrator-alt",
familyName = "Admin-alt",
status = true,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq(incunabulaProject),
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
INCUNABULA_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.ProjectMember)
),
administrativePermissionsPerProject = Map(
INCUNABULA_PROJECT_IRI -> Set(
PermissionADM.ProjectResourceCreateAllPermission
)
)
))
/* represents 'root-alt' (Incunabula Creator and ProjectMember) as found in admin-data.ttl */
def incunabulaMemberUser: UserADM = UserADM(
id = "http://rdfh.ch/users/incunabulaMemberUser",
username = "incunabulaMemberUser"
, email = "test.user2@test.ch", password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"), token = None, givenName = "User", familyName = "Test2", status = true, lang = "de", groups = Seq.empty[GroupADM], projects = Seq(incunabulaProject), sessionId = None, permissions = PermissionsDataADM(
groupsPerProject = Map(
INCUNABULA_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.ProjectMember)
),
administrativePermissionsPerProject = Map(
INCUNABULA_PROJECT_IRI -> Set(
PermissionADM.ProjectResourceCreateAllPermission
)
)
))
/* represents the ProjectInfoV1 of the incunabula project */
def incunabulaProject: ProjectADM = ProjectADM(
id = INCUNABULA_PROJECT_IRI,
shortname = "incunabula",
shortcode = "0803",
longname = Some("Bilderfolgen Basler Frühdrucke"),
description = Seq(StringLiteralV2(value = "<p>Das interdisziplinäre Forschungsprojekt \"<b><em>Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre</em></b>\" verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n</p>\n<p>Das Projekt wird durchgeführt vom <a href=\"http://kunsthist.unibas.ch\">Kunsthistorischen Seminar</a> der Universität Basel (Prof. B. Schellewald) und dem <a href=\"http://www.dhlab.unibas.ch\">Digital Humanities Lab</a> der Universität Basel (PD Dr. L. Rosenthaler).\n</p>\n<p>\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n</p>\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n</p>", language = None)),
keywords = Seq("Basler Frühdrucke", "Inkunabel", "Narrenschiff", "Wiegendrucke", "Sebastian Brant", "Bilderfolgen", "early print", "incunabula", "ship of fools", "Kunsthistorisches Seminar Universität Basel", "Late Middle Ages", "Letterpress Printing", "Basel", "Contectualisation of images").sorted,
logo = Some("incunabula_logo.png"),
ontologies = Seq(SharedOntologyTestDataADM.INCUNABULA_ONTOLOGY_IRI),
status = true,
selfjoin = false
)
/** **********************************/
/** Anything Admin Data **/
/** **********************************/
val ANYTHING_PROJECT_IRI = "http://rdfh.ch/projects/0001"
val customResourceIRI: IRI = "http://rdfh.ch/0001/a-thing-with-IRI"
val customResourceIRI_resourceWithValues: IRI = "http://rdfh.ch/0001/a-thing-with-value-IRI"
val customValueIRI_withResourceIriAndValueIRIAndValueUUID: IRI = "http://rdfh.ch/0001/a-thing-with-value-IRI/values/a-value-with-IRI-and-UUID"
val customValueUUID = "IN4R19yYR0ygi3K2VEHpUQ"
val customValueIRI: IRI = "http://rdfh.ch/0001/a-thing-with-value-IRI/values/a-value-with-IRI"
val customResourceCreationDate: Instant = Instant.parse("2019-01-09T15:45:54.502951Z")
val customValueCreationDate: Instant = Instant.parse("2020-06-09T17:04:54.502951Z")
val customListIRI: IRI = "http://rdfh.ch/lists/0001/a-list-with-IRI"
val customProjectIri: IRI = "http://rdfh.ch/projects/3333"
def anythingAdminUser: UserADM = UserADM(
id = "http://rdfh.ch/users/AnythingAdminUser",
username = "AnythingAdminUser",
email = "anything.admin@example.org",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "Anything",
familyName = "Admin",
status = true,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq(anythingProject),
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
ANYTHING_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.ProjectMember, OntologyConstants.KnoraAdmin.ProjectAdmin)
),
administrativePermissionsPerProject = Map(
ANYTHING_PROJECT_IRI -> Set(
PermissionADM.ProjectAdminAllPermission,
PermissionADM.ProjectResourceCreateAllPermission
)
)
))
def anythingUser1: UserADM = UserADM(
id = "http://rdfh.ch/users/9XBCrDV3SRa7kS1WwynB4Q",
username = "anything.user01",
email = "anything.user01@example.org",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "Anything",
familyName = "User01",
status = true,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq(anythingProject),
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
ANYTHING_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.ProjectMember, "http://rdfh.ch/groups/0001/thing-searcher")
),
administrativePermissionsPerProject = Map(
ANYTHING_PROJECT_IRI -> Set(
PermissionADM.ProjectResourceCreateAllPermission
)
)
))
def anythingUser2: UserADM = UserADM(
id = "http://rdfh.ch/users/BhkfBc3hTeS_IDo-JgXRbQ",
username = "anything.user02",
email = "anything.user02@example.org",
password = Some("$2a$12$7XEBehimXN1rbhmVgQsyve08.vtDmKK7VMin4AdgCEtE4DWgfQbTK"),
token = None,
givenName = "Anything",
familyName = "User02",
status = true,
lang = "de",
groups = Seq.empty[GroupADM],
projects = Seq(anythingProject),
sessionId = None,
permissions = PermissionsDataADM(
groupsPerProject = Map(
ANYTHING_PROJECT_IRI -> List(OntologyConstants.KnoraAdmin.ProjectMember)
),
administrativePermissionsPerProject = Map(
ANYTHING_PROJECT_IRI -> Set(
PermissionADM.ProjectResourceCreateAllPermission
)
)
))
def anythingProject: ProjectADM = ProjectADM(
id = ANYTHING_PROJECT_IRI,
shortname = "anything",
shortcode = "0001",
longname = Some("Anything Project"),
description = Seq(StringLiteralV2(value = "Anything Project", language = None)),
keywords = Seq("things", "arbitrary test data").sorted,
logo = None,
ontologies = Seq("http://www.knora.org/ontology/0001/anything",
"http://www.knora.org/ontology/0001/something"),
status = true,
selfjoin = false
)
/* represents the full GroupInfoV1 of the Thing searcher group */
def thingSearcherGroup: GroupADM = GroupADM(
id = "http://rdfh.ch/groups/0001/thing-searcher",
name = "Thing searcher",
description = "A group for thing searchers.",
project = anythingProject,
status = true,
selfjoin = true
)
/** **********************************/
/** BEOL **/
/** **********************************/
val BEOL_PROJECT_IRI = "http://rdfh.ch/projects/yTerZGyxjZVqFMNNKXCDPF"
def beolProject: ProjectADM = ProjectADM(
id = BEOL_PROJECT_IRI,
shortname = "beol",
shortcode = "0801",
longname = Some("Bernoulli-Euler Online"),
description = Seq(StringLiteralV2(value = "Bernoulli-Euler Online", language = None)),
keywords = Seq.empty[String],
logo = None,
ontologies = Seq("http://www.knora.org/ontology/0801/beol", "http://www.knora.org/ontology/0801/biblio",
"http://www.knora.org/ontology/0801/leibniz", "http://www.knora.org/ontology/0801/newton"),
status = true,
selfjoin = false
)
/* represents the user profile of 'superuser' as found in admin-data.ttl */
def beolUser: UserADM = UserADM(
id = "http://rdfh.ch/users/PSGbemdjZi4kQ6GHJVkLGE",
username = "beol",
email = "beol@example.com",
password = Some("$2a$10$fTEr/xVjPq7UBAy1O6KWKOM1scLhKGeRQdR4GTA997QPqHzXv0MnW"),
token = None,
givenName = "BEOL",
familyName = "BEOL",
status = true,
lang = "en",
groups = Seq.empty[GroupADM],
projects = Seq(beolProject),
sessionId = None,
permissions = PermissionsDataADM()
)
/** **********************************/
/** DOKUBIB **/
/** **********************************/
val DOKUBIB_PROJECT_IRI = "http://rdfh.ch/projects/0804"
def dokubibProject: ProjectADM = ProjectADM(
id = DOKUBIB_PROJECT_IRI,
shortname = "dokubib",
shortcode = "0804",
longname = Some("Dokubib"),
description = Seq(StringLiteralV2(value = "Dokubib", language = None)),
keywords = Seq.empty[String],
logo = None,
ontologies = Seq("http://www.knora.org/ontology/0804/dokubib"),
status = false,
selfjoin = false
)
/** **********************************/
/** Test requests **/
/** **********************************/
val createGroupRequest: String =
s"""{
| "name": "NewGroup",
| "description": "NewGroupDescription",
| "project": "$IMAGES_PROJECT_IRI",
| "status": true,
| "selfjoin": false
|}""".stripMargin
val createGroupWithCustomIriRequest: String =
s"""{ "id": "http://rdfh.ch/groups/00FF/group-with-customIri",
| "name": "NewGroupWithCustomIri",
| "description": "A new group with a custom Iri",
| "project": "$IMAGES_PROJECT_IRI",
| "status": true,
| "selfjoin": false
|}""".stripMargin
val updateGroupRequest: String =
s"""{
| "name": "UpdatedGroupName",
| "description": "UpdatedGroupDescription"
|}""".stripMargin
val changeGroupStatusRequest: String =
s"""{
| "status": true
|}""".stripMargin
val createProjectRequest: String =
s"""{
| "shortname": "newproject",
| "shortcode": "1111",
| "longname": "project longname",
| "description": [{"value": "project description", "language": "en"}],
| "keywords": ["keywords"],
| "logo": "/fu/bar/baz.jpg",
| "status": true,
| "selfjoin": false
|}""".stripMargin
val createProjectWithCustomIRIRequest: String =
s"""{
| "id": "$customProjectIri",
| "shortname": "newprojectWithIri",
| "shortcode": "3333",
| "longname": "new project with a custom IRI",
| "description": [{"value": "a project created with a custom IRI", "language": "en"}],
| "keywords": ["projectIRI"],
| "logo": "/fu/bar/baz.jpg",
| "status": true,
| "selfjoin": false
|}""".stripMargin
val updateProjectRequest: String =
s"""{
| "shortname": "newproject",
| "longname": "updated project longname",
| "description": [{"value": "updated project description", "language": "en"}],
| "keywords": ["updated", "keywords"],
| "logo": "/fu/bar/baz-updated.jpg",
| "status": true,
| "selfjoin": true
|}""".stripMargin
val createUserRequest: String =
s"""{
| "username": "donald.duck",
| "email": "donald.duck@example.org",
| "givenName": "Donald",
| "familyName": "Duck",
| "password": "test",
| "status": true,
| "lang": "en",
| "systemAdmin": false
|}""".stripMargin
val createUserWithCustomIriRequest: String =
s"""{
| "id": "http://rdfh.ch/users/userWithCustomIri",
| "username": "userWithCustomIri",
| "email": "userWithCustomIri@example.org",
| "givenName": "a user",
| "familyName": "with a custom Iri",
| "password": "test",
| "status": true,
| "lang": "en",
| "systemAdmin": false
|}""".stripMargin
val updateUserRequest: String =
s"""{
| "username": "donald.big.duck",
| "email": "donald.big.duck@example.org",
| "givenName": "Big Donald",
| "familyName": "Duckmann",
| "lang": "de"
|}""".stripMargin
val changeUserPasswordRequest: String =
s"""{
| "requesterPassword": "test",
| "newPassword": "test123456"
|}""".stripMargin
val changeUserStatusRequest: String =
s"""{
| "status": false
|}""".stripMargin
val changeUserSystemAdminMembershipRequest: String =
s"""{
| "systemAdmin": true
|}""".stripMargin
val createListRequest: String =
s"""{
| "projectIri": "${SharedTestDataADM.ANYTHING_PROJECT_IRI}",
| "labels": [{ "value": "Neue Liste", "language": "de"}],
| "comments": []
|}""".stripMargin
val createListWithCustomIriRequest: String =
s"""{
| "id": "${SharedTestDataADM.customListIRI}",
| "projectIri": "${SharedTestDataADM.ANYTHING_PROJECT_IRI}",
| "labels": [{ "value": "New list with a custom IRI", "language": "en"}],
| "comments": []
|}""".stripMargin
val createAdministrativePermissionRequest: String =
s"""{
| "forGroup":"${SharedTestDataADM.thingSearcherGroup.id}",
| "forProject":"${SharedTestDataADM.ANYTHING_PROJECT_IRI}",
| "hasPermissions":[{"additionalInformation":null,"name":"ProjectAdminGroupAllPermission","permissionCode":null}]
|}""".stripMargin
val createDefaultObjectAccessPermissionRequest: String =
s"""{
| "forGroup":"${SharedTestDataADM.thingSearcherGroup.id}",
| "forProject":"${SharedTestDataADM.ANYTHING_PROJECT_IRI}",
| "forProperty":null,
| "forResourceClass":null,
| "hasPermissions":[{"additionalInformation":"http://www.knora.org/ontology/knora-admin#ProjectMember","name":"D","permissionCode":7}]
|}""".stripMargin
val createAdministrativePermissionWithCustomIriRequest: String =
s"""{
| "id": "http://rdfh.ch/permissions/0001/AP-with-customIri",
| "forGroup":"${SharedTestDataADM.thingSearcherGroup.id}",
| "forProject":"${SharedTestDataADM.ANYTHING_PROJECT_IRI}",
| "hasPermissions":[{"additionalInformation":null,"name":"ProjectAdminGroupAllPermission","permissionCode":null}]
|}""".stripMargin
val createDefaultObjectAccessPermissionWithCustomIriRequest: String =
s"""{
| "id": "http://rdfh.ch/permissions/00FF/DOAP-with-customIri",
| "forGroup":null,
| "forProject":"${SharedTestDataADM.IMAGES_PROJECT_IRI}",
| "forProperty":null,
| "forResourceClass":"${SharedOntologyTestDataADM.IMAGES_BILD_RESOURCE_CLASS}",
| "hasPermissions":[{"additionalInformation":"http://www.knora.org/ontology/knora-admin#ProjectMember","name":"D","permissionCode":7}]
|}""".stripMargin
def updateListInfoRequest(listIri: IRI): String = {
s"""{
| "listIri": "$listIri",
| "projectIri": "${SharedTestDataADM.ANYTHING_PROJECT_IRI}",
| "labels": [{ "value": "Neue geänderte Liste", "language": "de"}, { "value": "Changed list", "language": "en"}],
| "comments": [{ "value": "Neuer Kommentar", "language": "de"}, { "value": "New comment", "language": "en"}]
|}""".stripMargin
}
def addChildListNodeRequest(parentNodeIri: IRI,
name: String,
label: String,
comment: String): String = {
s"""{
| "parentNodeIri": "$parentNodeIri",
| "projectIri": "${SharedTestDataADM.ANYTHING_PROJECT_IRI}",
| "name": "$name",
| "labels": [{ "value": "$label", "language": "en"}],
| "comments": [{ "value": "$comment", "language": "en"}]
|}""".stripMargin
}
def createIntValueRequest(resourceIri: IRI, intValue: Int): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasInteger" : {
| "@type" : "knora-api:IntValue",
| "knora-api:intValueAsInt" : $intValue
| },
| "@context" : {
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
}
def createIntValueWithCustomIRIRequest(resourceIri: IRI,
intValue: Int,
valueIri: IRI,
valueUUID: String,
valueCreationDate: Instant): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasInteger" : {
| "@id" : "$valueIri",
| "@type" : "knora-api:IntValue",
| "knora-api:intValueAsInt" : $intValue,
| "knora-api:valueHasUUID" : "$valueUUID",
| "knora-api:valueCreationDate" : {
| "@type" : "xsd:dateTimeStamp",
| "@value" : "$valueCreationDate"
| }
| },
| "@context" : {
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#",
| "xsd" : "http://www.w3.org/2001/XMLSchema#"
| }
|}""".stripMargin
}
def createIntValueWithCustomUUIDRequest(resourceIri: IRI,
intValue: Int,
valueUUID: String): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasInteger" : {
| "@type" : "knora-api:IntValue",
| "knora-api:intValueAsInt" : $intValue,
| "knora-api:valueHasUUID" : "$valueUUID"
| },
| "@context" : {
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#",
| "xsd" : "http://www.w3.org/2001/XMLSchema#"
| }
|}""".stripMargin
}
def createIntValueWithCustomValueIriRequest(resourceIri: IRI, intValue: Int, valueIri: IRI): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasInteger" : {
| "@id" : "$valueIri",
| "@type" : "knora-api:IntValue",
| "knora-api:intValueAsInt" : $intValue
| },
| "@context" : {
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#",
| "xsd" : "http://www.w3.org/2001/XMLSchema#"
| }
|}""".stripMargin
}
def createIntValueWithCustomCreationDateRequest(resourceIri: IRI, intValue: Int, creationDate: Instant): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasInteger" : {
| "@type" : "knora-api:IntValue",
| "knora-api:intValueAsInt" : $intValue,
| "knora-api:valueCreationDate" : {
| "@type" : "xsd:dateTimeStamp",
| "@value" : "$creationDate"
| }
| },
| "@context" : {
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#",
| "xsd" : "http://www.w3.org/2001/XMLSchema#"
| }
|}""".stripMargin
}
def createIntValueWithCustomPermissionsRequest(resourceIri: IRI, intValue: Int, permissions: String): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasInteger" : {
| "@type" : "knora-api:IntValue",
| "knora-api:intValueAsInt" : $intValue,
| "knora-api:hasPermissions" : "$permissions"
| },
| "@context" : {
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
}
def createTextValueWithoutStandoffRequest(resourceIri: IRI, valueAsString: String): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasText" : {
| "@type" : "knora-api:TextValue",
| "knora-api:valueAsString" : "$valueAsString"
| },
| "@context" : {
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
}
val standardMappingIri: IRI = "http://rdfh.ch/standoff/mappings/StandardMapping"
val textValue1AsXmlWithStandardMapping: String =
"""<?xml version="1.0" encoding="UTF-8"?>
|<text documentType="html">
| <p>This an <span data-description="an "event"" data-date="GREGORIAN:2017-01-27 CE" class="event">event</span>.</p>
|</text>""".stripMargin
def createTextValueWithStandoffRequest(resourceIri: IRI, textValueAsXml: String, mappingIri: String)(implicit stringFormatter: StringFormatter): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasText" : {
| "@type" : "knora-api:TextValue",
| "knora-api:textValueAsXml" : ${stringFormatter.toJsonEncodedString(textValueAsXml)},
| "knora-api:textValueHasMapping" : {
| "@id": "$mappingIri"
| }
| },
| "@context" : {
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
}
def createTextValueWithCommentRequest(resourceIri: IRI, valueAsString: String, valueHasComment: String): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasText" : {
| "@type" : "knora-api:TextValue",
| "knora-api:valueAsString" : "$valueAsString",
| "knora-api:valueHasComment" : "$valueHasComment"
| },
| "@context" : {
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
}
def createDecimalValueRequest(resourceIri: IRI, decimalValue: BigDecimal): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasDecimal" : {
| "@type" : "knora-api:DecimalValue",
| "knora-api:decimalValueAsDecimal" : {
| "@type" : "xsd:decimal",
| "@value" : "$decimalValue"
| }
| },
| "@context" : {
| "xsd" : "http://www.w3.org/2001/XMLSchema#",
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
}
def createDateValueWithDayPrecisionRequest(resourceIri: IRI,
dateValueHasCalendar: String,
dateValueHasStartYear: Int,
dateValueHasStartMonth: Int,
dateValueHasStartDay: Int,
dateValueHasStartEra: String,
dateValueHasEndYear: Int,
dateValueHasEndMonth: Int,
dateValueHasEndDay: Int,
dateValueHasEndEra: String): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasDate" : {
| "@type" : "knora-api:DateValue",
| "knora-api:dateValueHasCalendar" : "$dateValueHasCalendar",
| "knora-api:dateValueHasStartYear" : $dateValueHasStartYear,
| "knora-api:dateValueHasStartMonth" : $dateValueHasStartMonth,
| "knora-api:dateValueHasStartDay" : $dateValueHasStartDay,
| "knora-api:dateValueHasStartEra" : "$dateValueHasStartEra",
| "knora-api:dateValueHasEndYear" : $dateValueHasEndYear,
| "knora-api:dateValueHasEndMonth" : $dateValueHasEndMonth,
| "knora-api:dateValueHasEndDay" : $dateValueHasEndDay,
| "knora-api:dateValueHasEndEra" : "$dateValueHasEndEra"
| },
| "@context" : {
| "xsd" : "http://www.w3.org/2001/XMLSchema#",
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
}
def createDateValueWithMonthPrecisionRequest(resourceIri: IRI,
dateValueHasCalendar: String,
dateValueHasStartYear: Int,
dateValueHasStartMonth: Int,
dateValueHasStartEra: String,
dateValueHasEndYear: Int,
dateValueHasEndMonth: Int,
dateValueHasEndEra: String): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasDate" : {
| "@type" : "knora-api:DateValue",