-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRules.ts
More file actions
2954 lines (2571 loc) · 126 KB
/
Rules.ts
File metadata and controls
2954 lines (2571 loc) · 126 KB
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
export const RULES: string[] = [`@prefix string: <http://www.w3.org/2000/10/swap/string#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix : <http://example.org/> .
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix list: <http://www.w3.org/2000/10/swap/list#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
@prefix report: <https://w3id.org/force/compliance-report#> .
@prefix temp: <http://example.com/request/> .
@prefix sotw: <https://w3id.org/force/sotw#> .
@prefix : <http://example.org/> .
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix list: <http://www.w3.org/2000/10/swap/list#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
@prefix report: <https://w3id.org/force/compliance-report#> .
@prefix temp: <http://example.com/request/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
@prefix cc: <http://creativecommons.org/ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
@prefix cc: <http://creativecommons.org/ns#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
# uuid backward rule (component)
{
?input :getUUID ?urnUuid
}
<=
{
?input log:skolem ?uniqueNode .
?uniqueNode log:uuid ?uuidString .
( "urn:uuid:" ?uuidString ) string:concatenation ?urnUuidString .
?urnUuid log:uri ?urnUuidString .
} .
# Constraint report
# Connect constraint Report to Rule Report
{
?rule odrl:constraint ?constraint.
?ruleReport report:rule ?rule .
?premiseReport report:constraint ?constraint .
} => {
?ruleReport report:premiseReport ?premiseReport .
}.
# Creates a premiseReport for each constraint there is (starting from a rule)
{
_:a odrl:constraint ?constraint .
( ?constraint ) :getUUID ?premiseReport .
} => {
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint .
}.
# Creates a premiseReport for each constraint there is (starting from a logical operator)
{
_:a ?logicaloperand ?constraint .
?logicaloperand list:in ( odrl:or odrl:xone odrl:and odrl:andSequence ) .
( ?constraint ) :getUUID ?premiseReport .
} => {
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint .
} .
#######################################################################################################################
# Left Operand Conversion
# odrl:dateTime to xsd:dateTime
# https://www.w3.org/TR/odrl-vocab/#term-dateTime
{
# bind created premiseReport
?premiseReport report:constraint ?constraint .
?constraint odrl:leftOperand odrl:dateTime .
temp:currentTime dct:issued ?dateTime .
# TODO: check whether rightoperand is xsd:dateTime -> Not here; SHACL validation of constraints
} => {
?premiseReport report:constraintLeftOperand ?dateTime .
}.
# Other ODRL constraint Left operands
# Create empty premise report for leftOperands (no leftOperand present in the evaluation request)
{
# acceptable ODRL Left Operands
?leftOperand list:in ( odrl:absolutePosition odrl:absoluteSize odrl:absoluteSpatialPosition odrl:absoluteTemporalPosition odrl:count odrl:delayPeriod odrl:deliveryChannel odrl:device odrl:elapsedTime odrl:event odrl:fileFormat odrl:industry odrl:language odrl:media odrl:meteredTime odrl:payAmount odrl:percentage odrl:product odrl:purpose odrl:recipient odrl:relativePosition odrl:relativeSize odrl:relativeSpatialPosition odrl:relativeTemporalPosition odrl:resolution odrl:spatial odrl:spatialCoordinates odrl:system odrl:systemDevice odrl:timeInterval odrl:unitOfCount odrl:version odrl:virtualLocation ) .
# check for number of leftOperands in evaluation request
(
?template
{
?requestPermission sotw:context ?requestContextConstraint .
?requestContextConstraint odrl:leftOperand ?leftOperand .
}
?L
) log:collectAllIn ?SCOPE .
# number of leftOperands in evaluation request is 0
?L list:length 0 .
# a rule with a leftOperand constraint
_:a odrl:constraint ?constraint .
?constraint odrl:leftOperand ?leftOperand .
# created premiseReport
?premiseReport report:constraint ?constraint .
} => {
?premiseReport report:constraintLeftOperand "" . #TODO: do we need a default null left operand value?
}.
# Create empty premise report for leftOperands (one present in the evaluation request)
{
# acceptable ODRL Left Operands
?leftOperand list:in ( odrl:absolutePosition odrl:absoluteSize odrl:absoluteSpatialPosition odrl:absoluteTemporalPosition odrl:count odrl:delayPeriod odrl:deliveryChannel odrl:device odrl:elapsedTime odrl:event odrl:fileFormat odrl:industry odrl:language odrl:media odrl:meteredTime odrl:payAmount odrl:percentage odrl:product odrl:purpose odrl:recipient odrl:relativePosition odrl:relativeSize odrl:relativeSpatialPosition odrl:relativeTemporalPosition odrl:resolution odrl:spatial odrl:spatialCoordinates odrl:system odrl:systemDevice odrl:timeInterval odrl:unitOfCount odrl:version odrl:virtualLocation ) .
?requestPermission sotw:context ?requestContextConstraint .
?requestContextConstraint odrl:leftOperand ?leftOperand .
?requestContextConstraint odrl:rightOperand ?requestedPurpose .
# check for number of leftOperands in evaluation request
(
?template
{
?requestPermission sotw:context ?requestContextConstraint .
?requestContextConstraint odrl:leftOperand ?leftOperand .
}
?L
) log:collectAllIn ?SCOPE .
# number of leftOperands in evaluation request is 1
?L list:length 1 .
# a rule with a purpose constraint
_:a odrl:constraint ?constraint .
?constraint odrl:leftOperand ?leftOperand .
# created premiseReport
?premiseReport report:constraint ?constraint .
} => {
?premiseReport report:constraintLeftOperand ?requestedPurpose .
}.
#######################################################################################################################
# Comparing the operators using the different odrl operators
# Ordered operators
# Less than: odrl:lt
{
?constraint
odrl:operator odrl:lt ;
odrl:rightOperand ?rightOperand .
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?leftOperand math:lessThan ?rightOperand .
} =>
{
?premiseReport
report:constraintOperator odrl:lt ;
report:constraintRightOperand ?rightOperand ;
report:satisfactionState report:Satisfied .
} .
# Greater than: odrl:gt
{
?constraint
odrl:operator odrl:gt ;
odrl:rightOperand ?rightOperand .
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?leftOperand math:greaterThan ?rightOperand .
} =>
{
?premiseReport
report:constraintOperator odrl:gt ;
report:constraintRightOperand ?rightOperand ;
report:satisfactionState report:Satisfied .
} .
# Equal to: odrl:eq
# Recommendation by Jos on 03/10/2025: equality is difficult. Use both math:equalTo and log:equalTo
# OR operator does not exist in N3, so that's why you have to do it like this
# https://w3c.github.io/N3/reports/20230703/builtins.html#math:equalTo
{
?constraint
odrl:operator odrl:eq ;
odrl:rightOperand ?rightOperand .
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?leftOperand math:equalTo ?rightOperand .
} =>
{
?premiseReport
report:constraintOperator odrl:eq ;
report:constraintRightOperand ?rightOperand ;
report:satisfactionState report:Satisfied .
} .
# https://w3c.github.io/N3/reports/20230703/builtins.html#log:equalTo
{
?constraint
odrl:operator odrl:eq ;
odrl:rightOperand ?rightOperand .
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?leftOperand log:equalTo ?rightOperand .
} =>
{
?premiseReport
report:constraintOperator odrl:eq ;
report:constraintRightOperand ?rightOperand ;
report:satisfactionState report:Satisfied .
} .
# Greater than or equal to: odrl:gteq
# https://w3c.github.io/N3/reports/20230703/builtins.html#math:notLessThan
{
?constraint
odrl:operator odrl:gteq ;
odrl:rightOperand ?rightOperand .
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?leftOperand math:notLessThan ?rightOperand .
} =>
{
?premiseReport
report:constraintOperator odrl:gteq ;
report:constraintRightOperand ?rightOperand ;
report:satisfactionState report:Satisfied .
} .
# Less than or equal to: odrl:lteq
# https://w3c.github.io/N3/reports/20230703/builtins.html#math:notGreaterThan
{
?constraint
odrl:operator odrl:lteq ;
odrl:rightOperand ?rightOperand .
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?leftOperand math:notGreaterThan ?rightOperand .
} =>
{
?premiseReport
report:constraintOperator odrl:lteq ;
report:constraintRightOperand ?rightOperand ;
report:satisfactionState report:Satisfied .
} .
# Not equal to: odrl:neq
# https://w3c.github.io/N3/reports/20230703/builtins.html#math:notEqualTo
{
?constraint
odrl:operator odrl:neq ;
odrl:rightOperand ?rightOperand .
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?leftOperand math:notEqualTo ?rightOperand .
} =>
{
?premiseReport
report:constraintOperator odrl:neq ;
report:constraintRightOperand ?rightOperand ;
report:satisfactionState report:Satisfied .
} .
# Set-based Operators
# Is any of: odrl:isAnyOf
# There is a right operand value that equals the value that is actually present (through the sotw or evaluation request)
# https://w3c.github.io/N3/reports/20230703/builtins.html#log:equalTo
{
?constraint
odrl:operator odrl:isAnyOf ;
odrl:rightOperand ?rightOperand .
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?leftOperand log:equalTo ?rightOperand .
} =>
{
?premiseReport
report:constraintOperator odrl:isAnyOf ;
report:constraintRightOperand ?rightOperand ;
report:satisfactionState report:Satisfied .
} .
# Is an instance of: odrl:isA
{
?constraint
odrl:operator odrl:isA ;
odrl:rightOperand ?rightOperand .
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?leftOperand a ?instance .
?instance log:equalTo ?rightOperand .
} =>
{
?premiseReport
report:constraintOperator odrl:isA ;
report:constraintRightOperand ?rightOperand ;
report:satisfactionState report:Satisfied .
} .
# Is none of: odrl:isNoneOf
{
?premiseReport a report:ConstraintReport ;
report:constraint ?constraint ;
report:constraintLeftOperand ?leftOperand .
?constraint odrl:operator odrl:isNoneOf .
# Verify that there are no matches between the right operand value and the value that is actually present (through the sotw or evaluation request)
(
?template
{
?constraint odrl:rightOperand ?rightOperand .
?leftOperand log:equalTo ?rightOperand .
}
?L
) log:collectAllIn ?SCOPE .
?L list:length 0 .
} =>
{
?premiseReport
report:constraintOperator odrl:isNoneOf ;
report:satisfactionState report:Satisfied .
} .
# Make set-based reports complete by logging the remainder
{
?premiseReport report:constraintOperator ?operator ;
report:constraint ?constraint .
?operator list:in ( odrl:isAnyOf odrl:isNoneOf) .
?constraint odrl:rightOperand ?rightOperand .
} => {
?premiseReport report:constraintRightOperand ?rightOperand .
} .
#######################################################################################################################
# Logical operands
# logical operand premisereport generation
{
# match and constraint
?constraint a odrl:LogicalConstraint;
?operandType ?otherConstraint .
?operandType list:in ( odrl:and odrl:or odrl:xone odrl:andSequence) .
# create uuid
( ?constraint ) :getUUID ?logicalConstraintReportID .
# I think the below rule might be troublesome in the future (with uc policies having reports themselves)
} => {
?logicalConstraintReportID a report:ConstraintReport .
?logicalConstraintReportID report:constraint ?constraint .
# Again, I don't think I can do it without explanation
?logicalConstraintReportID report:constraintLogicalOperand ?operandType .
}.
# connect logical operand constraints with other premise reports
{
?logicalConstraintReportID a report:ConstraintReport .
?logicalConstraintReportID report:constraint ?constraint .
?constraint ?operandType ?otherConstraint.
?operandType list:in ( odrl:and odrl:or odrl:xone odrl:andSequence) .
?otherConstraintReportID report:constraint ?otherConstraint.
} => {
?logicalConstraintReportID report:premiseReport ?otherConstraintReportID .
} .
# Is and constraint report satisfied? (same for andsequence if you ask me)
{
?logicalConstraintReportID a report:ConstraintReport ;
report:constraintLogicalOperand ?operandType .
?operandType list:in ( odrl:and odrl:andSequence) .
# check for number of constraint reports
(
?template
{
?logicalConstraintReportID report:premiseReport _:s
}
?L
) log:collectAllIn ?SCOPE .
?L list:length ?numberConstraints .
# check for satisfied constraints
(
?template
{
?logicalConstraintReportID report:premiseReport ?premiseReport .
?premiseReport report:satisfactionState report:Satisfied .
}
?list
) log:collectAllIn ?SCOPE .
?list list:length ?satisfiedConstraints .
?satisfiedConstraints log:equalTo ?numberConstraints .
# TODO: when there are none satisfied, this is equal -> There is a need for other constraints to be unsatisfiable too (which is not the case yet)
} => {
?logicalConstraintReportID report:satisfactionState report:Satisfied .
}.
{
?logicalConstraintReportID a report:ConstraintReport ;
report:constraintLogicalOperand ?operandType .
?operandType list:in ( odrl:and odrl:andSequence) .
# check for number of constraint reports
(
?template
{
?logicalConstraintReportID report:premiseReport _:s
}
?L
) log:collectAllIn ?SCOPE .
?L list:length ?numberConstraints .
# check for satisfied constraints
(
?premiseReport
{
?logicalConstraintReportID report:premiseReport ?premiseReport .
?premiseReport report:satisfactionState report:Satisfied .
}
?list
) log:collectAllIn ?SCOPE .
?list list:length ?satisfiedConstraints .
?satisfiedConstraints log:notEqualTo ?numberConstraints .
} => {
?logicalConstraintReportID report:satisfactionState report:Unsatisfied .
}.
# Is or constraint report satisfied?
{
?logicalConstraintReportID a report:ConstraintReport ;
report:constraintLogicalOperand odrl:or .
# check for satisfied constraints: At least on of them MUST be satisfied
(
?template
{
?logicalConstraintReportID report:premiseReport ?premiseReport .
?premiseReport report:satisfactionState report:Satisfied .
}
?list
) log:collectAllIn ?SCOPE .
?list list:length ?satisfiedConstraints .
?satisfiedConstraints math:notLessThan 1 .
} => {
?logicalConstraintReportID report:satisfactionState report:Satisfied .
}.
{
?logicalConstraintReportID a report:ConstraintReport ;
report:constraintLogicalOperand odrl:or .
# check for satisfied constraints: At least on of them MUST be satisfied
(
?template
{
?logicalConstraintReportID report:premiseReport ?premiseReport .
?premiseReport report:satisfactionState report:Satisfied .
}
?list
) log:collectAllIn ?SCOPE .
?list list:length ?satisfiedConstraints .
?satisfiedConstraints log:equalTo 0 .
} => {
?logicalConstraintReportID report:satisfactionState report:Unsatisfied .
}.
# is xone premise report satisfied? only one, and not more, of the Constraints MUST be satisfied
{
?logicalConstraintReportID a report:ConstraintReport ;
report:constraintLogicalOperand odrl:xone .
# check for satisfied constraints: At least on of them MUST be satisfied
(
?template
{
?logicalConstraintReportID report:premiseReport ?premiseReport .
?premiseReport report:satisfactionState report:Satisfied .
}
?list
) log:collectAllIn ?SCOPE .
?list list:length ?satisfiedConstraints .
?satisfiedConstraints log:equalTo 1 .
} => {
?logicalConstraintReportID report:satisfactionState report:Satisfied .
}.
#######################################################################################################################
# Policy report
{
?policy a ?policyType .
?policyType list:in ( odrl:Agreement odrl:Set odrl:Policy odrl:Offer ) .
?policyRequest a odrl:Request .
temp:currentTime dct:issued ?time .
( ?policy ) :getUUID ?urnUuid .
}
=>
{
?urnUuid a report:PolicyReport ;
dct:created ?time ;
report:policy ?policy ;
report:policyRequest ?policyRequest .
} .
# Permission report (expecting explicit permission type)
# create permission report
{
?policyReport a report:PolicyReport ;
report:policy ?policy ;
report:policyRequest ?policyRequest .
?policy odrl:permission ?permission .
?policyRequest odrl:permission ?requestPermission .
( ?permission ) :getUUID ?urnUuid .
}
=>
{
?policyReport report:ruleReport ?urnUuid .
?urnUuid a report:PermissionReport ;
report:attemptState report:Attempted ;
report:rule ?permission ;
report:ruleRequest ?requestPermission .
} .
# Prohibition report (expecting explicit prohibition type)
# create prohibition report
{
?policyReport a report:PolicyReport ;
report:policy ?policy ;
report:policyRequest ?policyRequest .
?policy odrl:prohibition ?prohibition .
?policyRequest odrl:permission ?requestProhibition .
( ?prohibition ) :getUUID ?urnUuid .
}
=>
{
?policyReport report:ruleReport ?urnUuid .
?urnUuid a report:ProhibitionReport ;
report:attemptState report:Attempted ;
report:rule ?prohibition ;
report:ruleRequest ?requestProhibition .
} .
# Target report
# Create target report
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
?permission odrl:target ?resource .
( ?resource ) :getUUID ?urnUuid .
}
=>
{
?ruleReport report:premiseReport ?urnUuid .
?urnUuid a report:TargetReport .
} .
# Calculate satisfaction state (simple asset)
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission ;
report:premiseReport ?targetReport .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
?targetReport a report:TargetReport .
?permission odrl:target ?resource .
?requestPermission odrl:target ?requestedResource .
?resource log:equalTo ?requestedResource .
# make sure not an asset collection
(
?template
{
?resource a odrl:AssetCollection .
}
?L
) log:collectAllIn ?SCOPE .
?L list:length ?resourceCollectionsLength .
?resourceCollectionsLength log:equalTo 0 .
}
=>
{
?targetReport report:satisfactionState report:Satisfied .
} .
# Calculate satisfaction state (asset collection)
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission ;
report:premiseReport ?targetReport .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
?targetReport a report:TargetReport .
?permission odrl:target ?assetCollection .
?assetCollection a odrl:AssetCollection.
?requestPermission odrl:target ?resourceInCollection .
?resourceInCollection odrl:partOf ?assetCollection .
}
=>
{
?targetReport report:satisfactionState report:Satisfied .
} .
# Party report
# Create party report
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission .
?permission odrl:assignee ?party .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
( ?party ) :getUUID ?urnUuid .
}
=>
{
?ruleReport report:premiseReport ?urnUuid .
?urnUuid a report:PartyReport .
} .
# Calculate satisfaction state (simple party)
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission ;
report:premiseReport ?partyReport .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
?partyReport a report:PartyReport .
?permission odrl:assignee ?party .
?requestPermission odrl:assignee ?requestedParty .
?party log:equalTo ?requestedParty .
# make sure not a party collection
(
?template
{
?party a odrl:PartyCollection .
}
?L
) log:collectAllIn ?SCOPE .
?L list:length ?partyCollectionsLength .
?partyCollectionsLength log:equalTo 0 .
}
=>
{
?partyReport report:satisfactionState report:Satisfied .
} .
# Calculate satisfaction state (party collection)
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission ;
report:premiseReport ?partyReport .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
?partyReport a report:PartyReport .
?permission odrl:assignee ?partyCollection .
?partyCollection a odrl:PartyCollection.
?requestPermission odrl:assignee ?requestedParty .
?requestedParty odrl:partOf ?partyCollection .
}
=>
{
?partyReport report:satisfactionState report:Satisfied .
} .
# Action report -> simple action
# Create action report
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
?permission odrl:action ?action .
( ?action ) :getUUID ?urnUuid .
}
=>
{
?ruleReport report:premiseReport ?urnUuid .
?urnUuid a report:ActionReport .
} .
# Calculate satisfaction state (simple action)
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission ;
report:premiseReport ?actionReport .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
?actionReport a report:ActionReport .
?permission odrl:action ?action .
?requestPermission odrl:action ?requestedAction .
?action log:equalTo ?requestedAction .
}
=>
{
?actionReport a report:ActionReport ;
report:satisfactionState report:Satisfied .
} .
# Calculate satisfaction state (included in)
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission ;
report:premiseReport ?actionReport .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
?actionReport a report:ActionReport .
?permission odrl:action ?action .
?requestPermission odrl:action ?requestedAction .
?requestedAction odrl:includedIn ?action .
} =>
{
?actionReport a report:ActionReport ;
report:satisfactionState report:Satisfied .
} .
# Calculate satisfaction state (exact match)
{
?ruleReport a ?ruleReportType ;
report:rule ?permission ;
report:ruleRequest ?requestPermission ;
report:premiseReport ?actionReport .
?ruleReportType list:in (report:PermissionReport report:RuleReport report:ProhibitionReport) .
?actionReport a report:ActionReport .
?permission odrl:action ?action .
?requestPermission odrl:action ?requestedAction .
?requestedAction skos:exactMatch ?action .
} =>
{
?actionReport a report:ActionReport ;
report:satisfactionState report:Satisfied .
} .
# ODRL Vocabulary
cc:Attribution a skos:Concept, odrl:Action ;
rdfs:isDefinedBy <http://www.w3.org/ns/odrl/2/> ;
rdfs:label "Attribution"@en ;
skos:definition "Credit be given to copyright holder and/or author."@en ;
skos:note "This term is defined by Creative Commons."@en ;
skos:scopeNote "Non-Normative"@en ;
odrl:includedIn odrl:use .
cc:CommercialUse a skos:Concept, odrl:Action ;
rdfs:isDefinedBy <http://www.w3.org/ns/odrl/2/> ;
rdfs:label "Commercial Use"@en ;
skos:definition "Exercising rights for commercial purposes."@en ;
skos:note "This term is defined by Creative Commons."@en ;
skos:scopeNote "Non-Normative"@en ;
odrl:includedIn odrl:use .
cc:DerivativeWorks a skos:Concept, odrl:Action ;
rdfs:isDefinedBy <http://www.w3.org/ns/odrl/2/> ;
rdfs:label "Derivative Works"@en ;
skos:definition "Distribution of derivative works."@en ;
skos:note "This term is defined by Creative Commons."@en ;
skos:scopeNote "Non-Normative"@en ;
odrl:includedIn odrl:use .
cc:Distribution a skos:Concept, odrl:Action ;
rdfs:isDefinedBy <http://www.w3.org/ns/odrl/2/> ;
rdfs:label "Distribution"@en ;
skos:definition "Distribution, public display, and publicly performance."@en ;
skos:note "This term is defined by Creative Commons."@en ;
skos:scopeNote "Non-Normative"@en ;
odrl:includedIn odrl:use .
cc:Notice a skos:Concept, odrl:Action ;
rdfs:isDefinedBy <http://www.w3.org/ns/odrl/2/> ;
rdfs:label "Notice"@en ;
skos:definition "Copyright and license notices be kept intact."@en ;
skos:note "This term is defined by Creative Commons."@en ;
skos:scopeNote "Non-Normative"@en ;
odrl:includedIn odrl:use .
cc:Reproduction a skos:Concept, odrl:Action ;
rdfs:isDefinedBy <http://www.w3.org/ns/odrl/2/> ;
rdfs:label "Reproduction"@en ;
skos:definition "Making multiple copies."@en ;
skos:note "This term is defined by Creative Commons."@en ;
skos:scopeNote "Non-Normative"@en ;
odrl:includedIn odrl:use .
cc:ShareAlike a skos:Concept, odrl:Action ;
rdfs:isDefinedBy <http://www.w3.org/ns/odrl/2/> ;
rdfs:label "Share Alike"@en ;
skos:definition "Derivative works be licensed under the same terms or compatible terms as the original work."@en ;
skos:note "This term is defined by Creative Commons."@en ;
skos:scopeNote "Non-Normative"@en ;
odrl:includedIn odrl:use .
cc:Sharing a skos:Concept, odrl:Action ;
rdfs:isDefinedBy <http://www.w3.org/ns/odrl/2/> ;
rdfs:label "Sharing"@en ;
skos:definition "Permits commercial derivatives, but only non-commercial distribution."@en ;
skos:note "This term is defined by Creative Commons."@en ;
skos:scopeNote "Non-Normative"@en ;
odrl:includedIn odrl:use .
cc:SourceCode a skos:Concept, odrl:Action ;
rdfs:isDefinedBy <http://www.w3.org/ns/odrl/2/> ;
rdfs:label "Source Code"@en ;
skos:definition "Source code (the preferred form for making modifications) must be provided when exercising some rights granted by the license."@en ;
skos:note "This term is defined by Creative Commons."@en ;
skos:scopeNote "Non-Normative"@en ;
odrl:includedIn odrl:use .
dcterms:contributor a owl:AnnotationProperty .
dcterms:creator a owl:AnnotationProperty .
dcterms:description a owl:AnnotationProperty .
dcterms:format a owl:AnnotationProperty .
dcterms:issued a owl:AnnotationProperty .
dcterms:isVersionOf a owl:AnnotationProperty .
dcterms:license a owl:AnnotationProperty .
dcterms:subject a owl:AnnotationProperty .
skos:broader a owl:AnnotationProperty .
skos:broaderTransitive a owl:AnnotationProperty .
skos:Collection a owl:Class .
skos:Concept a owl:Class .
skos:ConceptScheme a owl:Class .
skos:definition a owl:AnnotationProperty .
skos:hasTopConcept a owl:AnnotationProperty .
skos:member a owl:AnnotationProperty .
skos:note a owl:AnnotationProperty .
skos:prefLabel a owl:AnnotationProperty .
skos:scopeNote a owl:AnnotationProperty .
<http://www.w3.org/ns/odrl/2/> dcterms:contributor "W3C Permissions & Obligations Expression Working Group" ;
dcterms:creator "Michael Steidl", "Renato Iannella", "Stuart Myles", "Víctor Rodríguez-Doncel" ;
dcterms:description "The ODRL Vocabulary and Expression defines a set of concepts and terms (the vocabulary) and encoding mechanism (the expression) for permissions and obligations statements describing digital content usage based on the ODRL Information Model."@en ;
dcterms:license <https://www.w3.org/Consortium/Legal/2002/ipr-notice-20021231#Copyright/> ;
a owl:Ontology ;
rdfs:comment "This is the RDF ontology for ODRL Version 2.2."@en ;
rdfs:label "ODRL Version 2.2"@en ;
owl:versionInfo "2.2" .
<http://www.w3.org/ns/odrl/2/#actionConcepts> a skos:Collection ;
skos:member odrl:action, odrl:Action, odrl:implies, odrl:includedIn ;
skos:prefLabel "Action"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#actions> a skos:Collection ;
skos:member odrl:transfer, odrl:use ;
skos:prefLabel "Actions for Rules"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#actionsCommon> a skos:Collection ;
skos:member cc:Attribution, cc:CommercialUse, cc:DerivativeWorks, cc:Distribution, cc:Notice, cc:Reproduction, cc:ShareAlike, cc:Sharing, cc:SourceCode, odrl:acceptTracking, odrl:aggregate, odrl:annotate, odrl:anonymize, odrl:archive, odrl:attribute, odrl:compensate, odrl:concurrentUse, odrl:delete, odrl:derive, odrl:digitize, odrl:display, odrl:distribute, odrl:ensureExclusivity, odrl:execute, odrl:extract, odrl:give, odrl:grantUse, odrl:include, odrl:index, odrl:inform, odrl:install, odrl:modify, odrl:move, odrl:nextPolicy, odrl:obtainConsent, odrl:play, odrl:present, odrl:print, odrl:read, odrl:reproduce, odrl:reviewPolicy, odrl:sell, odrl:stream, odrl:synchronize, odrl:textToSpeech, odrl:transform, odrl:translate, odrl:uninstall, odrl:watermark ;
skos:prefLabel "Actions for Rules"@en ;
skos:scopeNote "ODRL Common Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#assetConcepts> a skos:Collection ;
skos:member odrl:Asset, odrl:AssetCollection ;
skos:prefLabel "Asset"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#assetParty> a skos:Collection ;
skos:member odrl:partOf, odrl:source ;
skos:prefLabel "Asset and Party"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#assetRelations> a skos:Collection ;
skos:member odrl:hasPolicy, odrl:target ;
skos:prefLabel "Asset Relations"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#assetRelationsCommon> a skos:Collection ;
skos:member odrl:output ;
skos:prefLabel "Asset Relations"@en ;
skos:scopeNote "ODRL Common Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#conflictConcepts> a skos:Collection ;
skos:member odrl:conflict, odrl:ConflictTerm, odrl:invalid, odrl:perm, odrl:prohibit ;
skos:prefLabel "Policy Conflict Strategy"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#constraintLeftOperandCommon> a skos:Collection ;
skos:member odrl:absolutePosition, odrl:absoluteSize, odrl:absoluteSpatialPosition, odrl:absoluteTemporalPosition, odrl:count, odrl:dateTime, odrl:delayPeriod, odrl:deliveryChannel, odrl:elapsedTime, odrl:event, odrl:fileFormat, odrl:industry, odrl:language, odrl:media, odrl:meteredTime, odrl:payAmount, odrl:percentage, odrl:product, odrl:purpose, odrl:recipient, odrl:relativePosition, odrl:relativeSize, odrl:relativeSpatialPosition, odrl:relativeTemporalPosition, odrl:resolution, odrl:spatial, odrl:spatialCoordinates, odrl:systemDevice, odrl:timeInterval, odrl:unitOfCount, odrl:version, odrl:virtualLocation ;
skos:prefLabel "Constraint Left Operands"@en ;
skos:scopeNote "ODRL Common Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#constraintLogicalOperands> a skos:Collection ;
skos:member odrl:and, odrl:andSequence, odrl:or, odrl:xone ;
skos:prefLabel "Logical Constraint Operands"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#constraintRelationalOperators> a skos:Collection ;
skos:member odrl:eq, odrl:gt, odrl:gteq, odrl:hasPart, odrl:isA, odrl:isAllOf, odrl:isAnyOf, odrl:isNoneOf, odrl:isPartOf, odrl:lt, odrl:lteq, odrl:neq ;
skos:prefLabel "Constraint Operators"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#constraintRightOpCommon> a skos:Collection ;
skos:member odrl:policyUsage ;
skos:prefLabel "Constraint Right Operands"@en ;
skos:scopeNote "ODRL Common Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#constraints> a skos:Collection ;
skos:member odrl:constraint, odrl:Constraint, odrl:dataType, odrl:leftOperand, odrl:LeftOperand, odrl:operator, odrl:Operator, odrl:refinement, odrl:rightOperand, odrl:RightOperand, odrl:rightOperandReference, odrl:status, odrl:unit ;
skos:prefLabel "Constraint"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#deprecatedTerms> a skos:Collection ;
skos:member odrl:adHocShare, odrl:All, odrl:All2ndConnections, odrl:AllConnections, odrl:AllGroups, odrl:append, odrl:appendTo, odrl:AssetScope, odrl:attachPolicy, odrl:attachSource, odrl:commercialize, odrl:copy, odrl:device, odrl:export, odrl:extractChar, odrl:extractPage, odrl:extractWord, odrl:Group, odrl:ignore, odrl:Individual, odrl:inheritAllowed, odrl:inheritRelation, odrl:lease, odrl:lend, odrl:license, odrl:PartyScope, odrl:pay, odrl:payeeParty, odrl:preview, odrl:proximity, odrl:scope, odrl:secondaryUse, odrl:share, odrl:shareAlike, odrl:support, odrl:system, odrl:timedCount, odrl:undefined, odrl:UndefinedTerm, odrl:write, odrl:writeTo ;
skos:prefLabel "Deprecated Terms"@en .
<http://www.w3.org/ns/odrl/2/#duties> a skos:Collection ;
skos:member odrl:consequence, odrl:duty, odrl:Duty, odrl:obligation, odrl:remedy ;
skos:prefLabel "Duty"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#logicalConstraints> a skos:Collection ;
skos:member odrl:LogicalConstraint, odrl:operand ;
skos:prefLabel "Logical Constraint"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#partyConcepts> a skos:Collection ;
skos:member odrl:Party, odrl:PartyCollection ;
skos:prefLabel "Party"@en ;
skos:scopeNote "ODRL Core Vocabulary Terms"@en .
<http://www.w3.org/ns/odrl/2/#partyRoles> a skos:Collection ;
skos:member odrl:assignee, odrl:assigneeOf, odrl:assigner, odrl:assignerOf ;