index.html
288 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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>RIF Production Rule Dialect</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<style type="text/css">
.editsection { display: none; }
</style>
<link href="tr.css" rel="stylesheet" type="text/css" />
<link href="http://www.w3.org/StyleSheets/TR/W3C-REC" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="head">
<a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72" /></a><h1 id="title" style="clear:both"><span id="short-title">RIF Production Rule Dialect</span></h1>
<h2 id="W3C-doctype">W3C Recommendation 22 June 2010</h2>
<!-- no inplace warning -->
<dl>
<dt>This version:</dt>
<dd><a href="http://www.w3.org/TR/2010/REC-rif-prd-20100622/" id="this-version-url">http://www.w3.org/TR/2010/REC-rif-prd-20100622/</a></dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/rif-prd/">http://www.w3.org/TR/rif-prd/</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2010/PR-rif-prd-20100511/">http://www.w3.org/TR/2010/PR-rif-prd-20100511/</a> (<a href="http://www.w3.org/TR/2010/REC-rif-prd-20100622/diff-from-20100511">color-coded diff</a>)</dd>
</dl>
<dl><dt>Editors:</dt><dd>Christian de Sainte Marie, IBM/ILOG</dd>
<dd>Gary Hallmark, Oracle</dd>
<dd>Adrian Paschke, Freie Universitaet Berlin</dd>
</dl>
<p>Please refer to the <a href="http://www.w3.org/2010/rif/errata"><strong>errata</strong></a> for this document, which may include some normative corrections.</p>
<p>This document is also available in these non-normative formats: <a href="http://www.w3.org/2010/pdf/REC-rif-prd-20100622.pdf">PDF version</a>.</p>
<p>See also <a href="http://www.w3.org/2010/rif/translation/rif-prd">translations</a>.</p>
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2010 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
</div>
<hr />
<h2><a id="abstract" name="abstract">Abstract</a></h2>
<div>
<div><p></p> <p></p> <p></p> <p>This document, developed by the <a class="external text" href="http://www.w3.org/2005/rules" title="http://www.w3.org/2005/rules">Rule Interchange Format (RIF) Working Group</a>, specifies the production rule dialect of the W3C rule interchange format (RIF-PRD), a standard XML serialization format for production rule languages. </p> <p></p></div>
</div>
<h2 class="no-toc no-num">
<a id="w3c_status" name="w3c_status">Status of this Document</a>
</h2>
<h4 class="no-toc no-num" id="may-be">May Be Superseded</h4>
<p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em></p>
<h4 class="no-toc no-num" id="related">Set of Documents</h4>
<p>This document is being published as one of a set of 11 documents: </p>
<ol>
<li><a href="http://www.w3.org/TR/2010/NOTE-rif-overview-20100622/">RIF Overview</a></li>
<li><a href="http://www.w3.org/TR/2010/REC-rif-core-20100622/">RIF Core Dialect</a></li>
<li><a href="http://www.w3.org/TR/2010/REC-rif-bld-20100622/">RIF Basic Logic Dialect</a></li>
<li><a href="http://www.w3.org/TR/2010/REC-rif-prd-20100622/">RIF Production Rule Dialect</a> (this document)</li>
<li><a href="http://www.w3.org/TR/2010/REC-rif-fld-20100622/">RIF Framework for Logic Dialects</a></li>
<li><a href="http://www.w3.org/TR/2010/REC-rif-dtb-20100622/">RIF Datatypes and Built-Ins 1.0</a></li>
<li><a href="http://www.w3.org/TR/2010/REC-rif-rdf-owl-20100622/">RIF RDF and OWL Compatibility</a></li>
<li><a href="http://www.w3.org/TR/2010/NOTE-rif-owl-rl-20100622/">OWL 2 RL in RIF</a></li>
<li><a href="http://www.w3.org/TR/2010/WD-rif-xml-data-20100622/">RIF Combination with XML data</a></li>
<li><a href="http://www.w3.org/TR/2010/WD-rif-in-rdf-20100622/">RIF In RDF</a></li>
<li><a href="http://www.w3.org/TR/2010/WD-rif-test-20100622/">RIF Test Cases</a></li>
</ol>
<!-- no eventStatusExtra -->
<!-- no statusExtra -->
<div>
<h4 class="no-toc no-num" id="sotd-xml-dep">XML Schema Datatypes Dependency</h4>
<p>RIF is defined to use datatypes defined in the <a href="http://www.w3.org/TR/xmlschema-2/">XML Schema Definition Language (XSD)</a>. As of this writing, the latest W3C Recommendation for XSD is version 1.0, with <a href="http://www.w3.org/TR/xmlschema11-1/">version 1.1</a> progressing toward Recommendation. RIF has been designed to take advantage of the new datatypes and clearer explanations available in XSD 1.1, but for now those advantages are being partially put on hold. Specifically, until XSD 1.1 becomes a W3C Recommendation, the elements of RIF which are based on it should be considered <em>optional</em>, as detailed in <a href="http://www.w3.org/TR/2010/REC-rif-dtb-20100622/#XML_Schema_Datatypes">Datatypes and Builtins, section 2.3</a>. Upon the publication of XSD 1.1 as a W3C Recommendation, those elements will cease to be optional and are to be considered required as otherwise specified.</p>
<p>We suggest that for now developers and users follow the <a href="http://www.w3.org/TR/2009/WD-xmlschema11-1-20091203/">XSD 1.1 Last Call Working Draft</a>. Based on discussions between the Schema, RIF and OWL Working Groups, we do not expect any implementation changes will be necessary as XSD 1.1 advances to Recommendation.</p>
</div>
<h4 class="no-toc no-num" id="status-changes">Document Unchanged</h4>
<p>There have been no changes to the body of this document since the <a href="http://www.w3.org/TR/2010/PR-rif-prd-20100511/">previous version</a>. For details on earlier changes, see the <a href="#changelog">change log</a>.</p>
<h4 class="no-toc no-num" id="please">Please Send Comments</h4><p>Please send any comments to <a class="mailto" href="mailto:public-rif-comments@w3.org">public-rif-comments@w3.org</a>
(<a class="http" href="http://lists.w3.org/Archives/Public/public-rif-comments/">public
archive</a>). Although work on this document by the <a href="http://www.w3.org/2005/rules/wg.html">Rule Interchange Format (RIF) Working Group</a> is complete, comments may be addressed in the <a href="http://www.w3.org/2010/rif/errata">errata</a> or in future revisions. Open discussion among developers is welcome at <a class="mailto" href="mailto:public-rif-dev@w3.org">public-rif-dev@w3.org</a> (<a class="http" href="http://lists.w3.org/Archives/Public/public-rif-dev/">public archive</a>).</p>
<h4 class="no-toc no-num" id="endorsement">Endorsed By W3C</h4>
<p><em>This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.</em></p>
<h4 class="no-toc no-num" id="patents">Patents</h4>
<p><em>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/38457/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent.</em></p>
<hr title="Separator After Status Section" />
<p><span class="anchor" id="sec-overview"></span>
</p>
<table class="toc" id="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Table of Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="#Overview"><span class="tocnumber">1</span> <span class="toctext">Overview</span></a>
<ul>
<li class="toclevel-2"><a href="#Production_rule_interchange"><span class="tocnumber">1.1</span> <span class="toctext">Production rule interchange</span></a></li>
<li class="toclevel-2"><a href="#Running_example"><span class="tocnumber">1.2</span> <span class="toctext">Running example</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Conditions"><span class="tocnumber">2</span> <span class="toctext">Conditions</span></a>
<ul>
<li class="toclevel-2"><a href="#Abstract_syntax"><span class="tocnumber">2.1</span> <span class="toctext">Abstract syntax</span></a>
<ul>
<li class="toclevel-3"><a href="#Terms"><span class="tocnumber">2.1.1</span> <span class="toctext">Terms</span></a></li>
<li class="toclevel-3"><a href="#Atomic_formulas"><span class="tocnumber">2.1.2</span> <span class="toctext">Atomic formulas</span></a></li>
<li class="toclevel-3"><a href="#Formulas"><span class="tocnumber">2.1.3</span> <span class="toctext">Formulas</span></a></li>
<li class="toclevel-3"><a href="#Well-formed_formulas"><span class="tocnumber">2.1.4</span> <span class="toctext">Well-formed formulas</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Operational_semantics_of_condition_formulas"><span class="tocnumber">2.2</span> <span class="toctext">Operational semantics of condition formulas</span></a>
<ul>
<li class="toclevel-3"><a href="#Matching_substitution"><span class="tocnumber">2.2.1</span> <span class="toctext">Matching substitution</span></a></li>
<li class="toclevel-3"><a href="#Condition_satisfaction"><span class="tocnumber">2.2.2</span> <span class="toctext">Condition satisfaction</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1"><a href="#Actions"><span class="tocnumber">3</span> <span class="toctext">Actions</span></a>
<ul>
<li class="toclevel-2"><a href="#Abstract_syntax_2"><span class="tocnumber">3.1</span> <span class="toctext">Abstract syntax</span></a>
<ul>
<li class="toclevel-3"><a href="#Actions_2"><span class="tocnumber">3.1.1</span> <span class="toctext">Actions</span></a></li>
<li class="toclevel-3"><a href="#Action_blocks"><span class="tocnumber">3.1.2</span> <span class="toctext">Action blocks</span></a></li>
<li class="toclevel-3"><a href="#Well-formed_action_blocks"><span class="tocnumber">3.1.3</span> <span class="toctext">Well-formed action blocks</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Operational_semantics_of_atomic_actions"><span class="tocnumber">3.2</span> <span class="toctext">Operational semantics of atomic actions</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Production_rules_and_rule_sets"><span class="tocnumber">4</span> <span class="toctext">Production rules and rule sets</span></a>
<ul>
<li class="toclevel-2"><a href="#Abstract_syntax_3"><span class="tocnumber">4.1</span> <span class="toctext">Abstract syntax</span></a>
<ul>
<li class="toclevel-3"><a href="#Rules"><span class="tocnumber">4.1.1</span> <span class="toctext">Rules</span></a></li>
<li class="toclevel-3"><a href="#Groups"><span class="tocnumber">4.1.2</span> <span class="toctext">Groups</span></a></li>
<li class="toclevel-3"><a href="#Safeness"><span class="tocnumber">4.1.3</span> <span class="toctext">Safeness</span></a></li>
<li class="toclevel-3"><a href="#Well-formed_rules_and_groups"><span class="tocnumber">4.1.4</span> <span class="toctext">Well-formed rules and groups</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Operational_semantics_of_rules_and_rule_sets"><span class="tocnumber">4.2</span> <span class="toctext">Operational semantics of rules and rule sets</span></a>
<ul>
<li class="toclevel-3"><a href="#Motivation_and_example"><span class="tocnumber">4.2.1</span> <span class="toctext">Motivation and example</span></a></li>
<li class="toclevel-3"><a href="#Rules_normalization"><span class="tocnumber">4.2.2</span> <span class="toctext">Rules normalization</span></a></li>
<li class="toclevel-3"><a href="#Definitions_and_notational_conventions"><span class="tocnumber">4.2.3</span> <span class="toctext">Definitions and notational conventions</span></a></li>
<li class="toclevel-3"><a href="#Operational_semantics_of_a_production_rule_system"><span class="tocnumber">4.2.4</span> <span class="toctext">Operational semantics of a production rule system</span></a></li>
<li class="toclevel-3"><a href="#Conflict_resolution"><span class="tocnumber">4.2.5</span> <span class="toctext">Conflict resolution</span></a></li>
<li class="toclevel-3"><a href="#Halting_test"><span class="tocnumber">4.2.6</span> <span class="toctext">Halting test</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1"><a href="#Document_and_imports"><span class="tocnumber">5</span> <span class="toctext">Document and imports</span></a>
<ul>
<li class="toclevel-2"><a href="#Abstract_syntax_4"><span class="tocnumber">5.1</span> <span class="toctext">Abstract syntax</span></a>
<ul>
<li class="toclevel-3"><a href="#Import_directive"><span class="tocnumber">5.1.1</span> <span class="toctext">Import directive</span></a></li>
<li class="toclevel-3"><a href="#RIF-PRD_document"><span class="tocnumber">5.1.2</span> <span class="toctext">RIF-PRD document</span></a></li>
<li class="toclevel-3"><a href="#Well-formed_documents"><span class="tocnumber">5.1.3</span> <span class="toctext">Well-formed documents</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Operational_semantics_of_RIF-PRD_documents"><span class="tocnumber">5.2</span> <span class="toctext">Operational semantics of RIF-PRD documents</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Built-in_functions.2C_predicates_and_actions"><span class="tocnumber">6</span> <span class="toctext">Built-in functions, predicates and actions</span></a>
<ul>
<li class="toclevel-2"><a href="#Built-in_actions"><span class="tocnumber">6.1</span> <span class="toctext">Built-in actions</span></a>
<ul>
<li class="toclevel-3"><a href="#act:print"><span class="tocnumber">6.1.1</span> <span class="toctext">act:print</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1"><a href="#Conformance_and_interoperability"><span class="tocnumber">7</span> <span class="toctext">Conformance and interoperability</span></a>
<ul>
<li class="toclevel-2"><a href="#Semantics-preserving_transformations"><span class="tocnumber">7.1</span> <span class="toctext">Semantics-preserving transformations</span></a></li>
<li class="toclevel-2"><a href="#Conformance_Clauses"><span class="tocnumber">7.2</span> <span class="toctext">Conformance Clauses</span></a></li>
<li class="toclevel-2"><a href="#Interoperability"><span class="tocnumber">7.3</span> <span class="toctext">Interoperability</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#XML_Syntax"><span class="tocnumber">8</span> <span class="toctext">XML Syntax</span></a>
<ul>
<li class="toclevel-2"><a href="#Notational_conventions"><span class="tocnumber">8.1</span> <span class="toctext">Notational conventions</span></a>
<ul>
<li class="toclevel-3"><a href="#Namespaces"><span class="tocnumber">8.1.1</span> <span class="toctext">Namespaces</span></a></li>
<li class="toclevel-3"><a href="#BNF_pseudo-schemas"><span class="tocnumber">8.1.2</span> <span class="toctext">BNF pseudo-schemas</span></a></li>
<li class="toclevel-3"><a href="#Syntactic_components"><span class="tocnumber">8.1.3</span> <span class="toctext">Syntactic components</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Relative_IRIs_and_XML_base"><span class="tocnumber">8.2</span> <span class="toctext">Relative IRIs and XML base</span></a></li>
<li class="toclevel-2"><a href="#Conditions_2"><span class="tocnumber">8.3</span> <span class="toctext">Conditions</span></a>
<ul>
<li class="toclevel-3"><a href="#TERM"><span class="tocnumber">8.3.1</span> <span class="toctext">TERM</span></a>
<ul>
<li class="toclevel-4"><a href="#Const"><span class="tocnumber">8.3.1.1</span> <span class="toctext">Const</span></a></li>
<li class="toclevel-4"><a href="#Var"><span class="tocnumber">8.3.1.2</span> <span class="toctext">Var</span></a></li>
<li class="toclevel-4"><a href="#List"><span class="tocnumber">8.3.1.3</span> <span class="toctext">List</span></a></li>
<li class="toclevel-4"><a href="#External"><span class="tocnumber">8.3.1.4</span> <span class="toctext">External</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#ATOMIC"><span class="tocnumber">8.3.2</span> <span class="toctext">ATOMIC</span></a>
<ul>
<li class="toclevel-4"><a href="#Atom"><span class="tocnumber">8.3.2.1</span> <span class="toctext">Atom</span></a></li>
<li class="toclevel-4"><a href="#Equal"><span class="tocnumber">8.3.2.2</span> <span class="toctext">Equal</span></a></li>
<li class="toclevel-4"><a href="#Member"><span class="tocnumber">8.3.2.3</span> <span class="toctext">Member</span></a></li>
<li class="toclevel-4"><a href="#Subclass"><span class="tocnumber">8.3.2.4</span> <span class="toctext">Subclass</span></a></li>
<li class="toclevel-4"><a href="#Frame"><span class="tocnumber">8.3.2.5</span> <span class="toctext">Frame</span></a></li>
<li class="toclevel-4"><a href="#External_2"><span class="tocnumber">8.3.2.6</span> <span class="toctext">External</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#FORMULA"><span class="tocnumber">8.3.3</span> <span class="toctext">FORMULA</span></a>
<ul>
<li class="toclevel-4"><a href="#ATOMIC_2"><span class="tocnumber">8.3.3.1</span> <span class="toctext">ATOMIC</span></a></li>
<li class="toclevel-4"><a href="#And"><span class="tocnumber">8.3.3.2</span> <span class="toctext">And</span></a></li>
<li class="toclevel-4"><a href="#Or"><span class="tocnumber">8.3.3.3</span> <span class="toctext">Or</span></a></li>
<li class="toclevel-4"><a href="#INeg"><span class="tocnumber">8.3.3.4</span> <span class="toctext">INeg</span></a></li>
<li class="toclevel-4"><a href="#Exists"><span class="tocnumber">8.3.3.5</span> <span class="toctext">Exists</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#Actions_3"><span class="tocnumber">8.4</span> <span class="toctext">Actions</span></a>
<ul>
<li class="toclevel-3"><a href="#ACTION"><span class="tocnumber">8.4.1</span> <span class="toctext">ACTION</span></a>
<ul>
<li class="toclevel-4"><a href="#Assert"><span class="tocnumber">8.4.1.1</span> <span class="toctext">Assert</span></a></li>
<li class="toclevel-4"><a href="#Retract"><span class="tocnumber">8.4.1.2</span> <span class="toctext">Retract</span></a></li>
<li class="toclevel-4"><a href="#Modify"><span class="tocnumber">8.4.1.3</span> <span class="toctext">Modify</span></a></li>
<li class="toclevel-4"><a href="#Execute"><span class="tocnumber">8.4.1.4</span> <span class="toctext">Execute</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#ACTION_BLOCK"><span class="tocnumber">8.4.2</span> <span class="toctext">ACTION_BLOCK</span></a>
<ul>
<li class="toclevel-4"><a href="#New"><span class="tocnumber">8.4.2.1</span> <span class="toctext">New</span></a></li>
<li class="toclevel-4"><a href="#Do"><span class="tocnumber">8.4.2.2</span> <span class="toctext">Do</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#Rules_and_Groups"><span class="tocnumber">8.5</span> <span class="toctext">Rules and Groups</span></a>
<ul>
<li class="toclevel-3"><a href="#RULE"><span class="tocnumber">8.5.1</span> <span class="toctext">RULE</span></a>
<ul>
<li class="toclevel-4"><a href="#ACTION_BLOCK_2"><span class="tocnumber">8.5.1.1</span> <span class="toctext">ACTION_BLOCK</span></a></li>
<li class="toclevel-4"><a href="#Implies"><span class="tocnumber">8.5.1.2</span> <span class="toctext">Implies</span></a></li>
<li class="toclevel-4"><a href="#Forall"><span class="tocnumber">8.5.1.3</span> <span class="toctext">Forall</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Group"><span class="tocnumber">8.5.2</span> <span class="toctext">Group</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Document_and_directives"><span class="tocnumber">8.6</span> <span class="toctext">Document and directives</span></a>
<ul>
<li class="toclevel-3"><a href="#Import"><span class="tocnumber">8.6.1</span> <span class="toctext">Import</span></a></li>
<li class="toclevel-3"><a href="#Document"><span class="tocnumber">8.6.2</span> <span class="toctext">Document</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Constructs_carrying_no_semantics"><span class="tocnumber">8.7</span> <span class="toctext">Constructs carrying no semantics</span></a>
<ul>
<li class="toclevel-3"><a href="#Annotation"><span class="tocnumber">8.7.1</span> <span class="toctext">Annotation</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1"><a href="#Presentation_syntax_.28Informative.29"><span class="tocnumber">9</span> <span class="toctext">Presentation syntax (Informative)</span></a></li>
<li class="toclevel-1"><a href="#Acknowledgements"><span class="tocnumber">10</span> <span class="toctext">Acknowledgements</span></a></li>
<li class="toclevel-1"><a href="#References"><span class="tocnumber">11</span> <span class="toctext">References</span></a>
<ul>
<li class="toclevel-2"><a href="#Normative_references"><span class="tocnumber">11.1</span> <span class="toctext">Normative references</span></a></li>
<li class="toclevel-2"><a href="#Informational_references"><span class="tocnumber">11.2</span> <span class="toctext">Informational references</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Appendix:_Model-theoretic_semantics_of_RIF-PRD_condition_formulas"><span class="tocnumber">12</span> <span class="toctext">Appendix: Model-theoretic semantics of RIF-PRD condition formulas</span></a>
<ul>
<li class="toclevel-2"><a href="#Semantic_structures"><span class="tocnumber">12.1</span> <span class="toctext">Semantic structures</span></a></li>
<li class="toclevel-2"><a href="#Interpretation_of_condition_formulas"><span class="tocnumber">12.2</span> <span class="toctext">Interpretation of condition formulas</span></a></li>
<li class="toclevel-2"><a href="#Condition_satisfaction_2"><span class="tocnumber">12.3</span> <span class="toctext">Condition satisfaction</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Appendix:_XML_schema"><span class="tocnumber">13</span> <span class="toctext">Appendix: XML schema</span></a></li>
<li class="toclevel-1"><a href="#Appendix:_Change_Log_.28Informative.29"><span class="tocnumber">14</span> <span class="toctext">Appendix: Change Log (Informative)</span></a></li>
</ul>
</td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
<a id="Overview" name="Overview"></a><h2> <span class="mw-headline">1 Overview </span></h2>
<p>This document specifies the production rule dialect of the W3C rule interchange format (RIF-PRD), a standard XML serialization format for production rule languages.
</p><p>The production rule dialect is one of a set of rule interchange dialects that also includes the RIF Core dialect ([<a href="#ref-core" title="">RIF-Core</a>]) and the RIF basic logic dialect ([<a href="#ref-rif-bld" title="">RIF-BLD</a>]).
</p><p>RIF-Core, the core dialect of the W3C rule interchange format, is designed to support the interchange of definite Horn rules without function symbols ("Datalog"). RIF-Core has both a standard first-order semantics and an operational semantics. Syntactically, RIF-Core has a number of extensions of Datalog:
</p>
<ul><li> frames as in F-logic [<a href="#ref-klw95" title="">KLW95</a>],
</li><li> internationalized resource identifiers (or IRIs, defined by [<a href="#ref-rfc-3987" title="">RFC-3987</a>]) as identifiers for concepts, and
</li><li> XML Schema datatypes [<a href="#ref-xml-schema2" title="">XML-SCHEMA2</a>].
</li></ul>
<p>RIF-Core is based on a rich set of datatypes and built-ins that are aligned with Web-aware rule system implementations [<a href="#ref-rif-dtb" title="">RIF-DTB</a>]. In addition, the RIF RDF and OWL Compatibility document [<a href="#ref-rif-rdf-owl" title="">RIF-RDF-OWL</a>] specifies the syntax and semantics of combinations of RIF-Core, RDF, and OWL documents.
</p><p>RIF-Core is intended to be the common core of all RIF dialects, and it has been designed,
in particular, to be a useful common subset of RIF-BLD and RIF-PRD. RIF-PRD includes and extends RIF-Core, and, therefore, RIF-PRD inherits all RIF-Core features. These features make RIF-PRD a Web-aware (even a semantic Web-aware) language. However, it should be kept in mind that RIF is designed to enable interoperability among rule languages in general, and its uses are not limited to the Web.
</p><p>This document targets designers and developers of RIF-PRD implementations. A RIF-PRD implementation is a software application that serializes production rules as RIF-PRD XML (producer application) and/or that deserializes RIF-PRD XML documents into production rules (consumer application).
</p>
<a id="Production_rule_interchange" name="Production_rule_interchange"></a><h3> <span class="mw-headline">1.1 Production rule interchange </span></h3>
<p>Production rules have an <i>if</i> part, or <i>condition</i>, and a <i>then</i> part, or <i>action</i>. The condition is like the condition part of logic rules (as covered by RIF-Core and its basic logic dialect extension, RIF-BLD). The <i>then</i> part contains actions. An action can assert facts, modify facts, retract facts, and have other side-effects. In general, an action is different from the conclusion of a logic rule, which contains only a logical statement. However, the conclusion of rules interchanged using RIF-Core can be interpreted, according to RIF-PRD operational semantics, as actions that assert facts in the knowledge base.
</p>
<div class="example">
<p><b>Example 1.1.</b> The following are examples of production rules:
</p>
<ul><li> <em>A customer becomes a "Gold" customer when his cumulative purchases during the current year reach $5000</em>.
</li><li> <em>Customers that become "Gold" customers must be notified immediately, and a golden customer card will be printed and sent to them within one week</em>.
</li><li> <em>For shopping carts worth more than $1000, "Gold" customers receive an additional discount of 10% of the total amount.</em> ☐
</li></ul>
</div>
<p>Because RIF-PRD is a production rule interchange format, it specifies
an abstract syntax that shares features with concrete
production rule languages, and it associates the abstract constructs with normative semantics and a normative XML concrete syntax. Annotations (<i>e.g.</i> rule author) are the only constructs in RIF-PRD without a formal semantics.
</p><p>The abstract syntax is specified in mathematical English, and the abstract syntactic constructs that are defined in the sections <a href="#sec-conditions-abstract-syntax" title="">Abstract Syntax of Conditions</a>, <a href="#sec-actions-abstract-syntax" title="">Abstract Syntax of Actions</a> and <a href="#sec-rules-abstract-syntax" title="">Abstract Syntax of Rules and Rulesets</a>, are mapped into the concrete XML constructs in the section <a href="#sec-xml-syntax" title="">XML syntax</a>. A lightweight notation is used, instead of the XML syntax, to tie the abstract syntax to the specification of the semantics. A more complete presentation syntax is specified using an EBNF in <a href="#sec-presentation-syntax" title="">Presentation Syntax</a>. However, only the XML syntax and the associated semantics are normative. The normative XML schema is included in <a href="#appendix-xml-schema" title="">Appendix: XML Schema</a>.
</p>
<div class="example">
<p><b>Example 1.2.</b> In RIF-PRD presentation syntax, the first rule in example 1.1. can be represented as follows:
</p>
<pre>Prefix(ex <http://example.com/2008/prd1#>)
(* ex:rule_1 *)
Forall ?customer ?purchasesYTD (
If And( ?customer#ex:Customer
?customer[ex:purchasesYTD->?purchasesYTD]
External(pred:numeric-greater-than(?purchasesYTD 5000)) )
Then Do( Modify(?customer[ex:status->"Gold"]) ) )
</pre>
<p>☐
</p>
</div>
<p>Production rules are statements of programming logic that specify the execution of one or more actions when their conditions are satisfied. Production rules have an operational semantics, that the OMG Production Rule Representation specification [<a href="#ref-prr" title="">OMG-PRR</a>] summarizes as follows:
</p>
<ol><li> <i>Match:</i> the rules are instantiated based on the definition of the rule conditions and the current state of the data source;
</li><li> <i>Conflict resolution:</i> a decision algorithm, often called <i>the conflict resolution strategy</i>, is applied to select which rule instance will be executed;
</li><li> <i>Act:</i> the state of the data source is changed, by executing the selected rule instance's actions. If a terminal state has not been reached, the control loops back to the first step (<i>Match</i>).
</li></ol>
<p>In the section <a href="#sec-operational-semantics-of-rules-and-rule-sets" title="">Operational semantics of rules and rule sets</a>, the semantics for rules and rule sets is specified, accordingly, as a labeled terminal transition system (<a href="#ref-ltts" title="">PLO04</a>), where state transitions result from executing the action part of instantiated rules. When several rules are found to be executable at the same time, during
the rule execution process, a <i>conflict resolution strategy</i> is used to
select the rule to execute. The section <a href="#sec-conflict-resolution" title="">Conflict resolution</a> specifies how a conflict resolution strategy can be attached to a rule set. RIF-PRD defines a default conflict resolution strategy.
</p><p>In the section <a href="#sec-semantics-of-condition-formulas" title="">Semantics of condition formulas</a>, the semantics of the condition part of rules in RIF-PRD is specified operationally, in terms of matching substitutions. To emphasize the overlap between the rule conditions of RIF-BLD and RIF-PRD, and to share the same RIF definitions for datatypes and built-ins [<a href="#ref-rif-dtb" title="">RIF-DTB</a>], an alternative, and equivalent, specification of the semantics of rule conditions in RIF-PRD, using a model theory, is provided in the appendix <a href="#appendix-model-theory" title="">Model-theoretic semantics of RIF-PRD condition formulas</a>.
</p><p>The semantics of condition formulas and the semantics of rules and rule sets make no assumption regarding how condition formulas are evaluated. In particular, they do not require that condition formula be evaluated using pattern matching. However, RIF-PRD conformance, as defined in the section <a href="#Conformance_and_interoperability" title="">Conformance and interoperability</a>, requires only support for <a href="#def-safe-rule" title="">safe rules</a>, that is, forward-chaining rules where the conditions can be evaluated based on pattern matching only.
</p><p>In the section <a href="#sec-operational-semantics-of-atomic-actions" title="">Operational semantics of actions</a>, the semantics of the action part of rules in RIF-PRD is specified using a transition relation between successive states of the data source, represented by ground condition formulas, thus making the link between the model-theoretic semantics of conditions and the operational semantics of rules and rule sets.
</p><p>The abstract syntax of RIF-PRD documents, and the semantics of the combination of multiple RIF-PRD documents, is specified in the section <a href="#sec-document-and-imports" title="">Document and imports</a>.
</p><p>In addition to externally specified functions and predicates, and in particular, in addition to the functions and predicates built-ins defined in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>], RIF-PRD supports externally specified actions, and defines one action built-in, as specified in the section <a href="#sec-builtins" title="">Built-in functions, predicates and actions</a>.
</p><p><br />
</p><p><span class="anchor" id="sec-running-example"></span>
</p>
<a id="Running_example" name="Running_example"></a><h3> <span class="mw-headline">1.2 Running example </span></h3>
<p>The same example rules will be used throughout the document to illustrate the syntax and the semantics of RIF-PRD.
</p><p>The rules are about the status of customers at a shop, and the discount awarded to them. The rule set contains four rules, to be applied when a customer checks out:
</p>
<ol><li> Gold rule: <i>A "Silver" customer with a shopping cart worth at least $2,000 is awarded the "Gold" status</i>.
</li><li> Discount rule: <i>"Silver" and "Gold" customers are awarded a 5% discount on the total worth of their shopping cart</i>.
</li><li> New customer and widget rule: <i>A "New" customer who buys a widget is awarded a 10% discount on the total worth of her shopping cart, but she looses any voucher she may have been awarded</i>.
</li><li> Unknown status rule: <i>A message must be printed, identifying any customer whose status is unknown (that is, neither "New", "Bronze", "Silver" or "Gold"), and the customer must be assigned the status: "New"</i>.
</li></ol>
<p>The <i>Gold rule</i> must be applied first; that is, e.g., a customer with "Silver" status and a shopping cart worth exactly $2,000 should be promoted to "Gold" status, before being given the 5% discount that would disallow the application of the <i>Gold rule</i> (since the total worth of his shopping cart would then be only $1,900).
</p><p>In the remainder of this document, the prefix <tt>ex1</tt> stands for the fictitious namespace of this example: <tt>http://example.com/2009/prd2#</tt>.
</p><p><span class="anchor" id="sec-conditions"></span>
</p>
<a id="Conditions" name="Conditions"></a><h2> <span class="mw-headline">2 Conditions </span></h2>
<p>This section specifies the syntax and semantics of the condition language of RIF-PRD.
</p><p>The RIF-PRD condition language specification depends on Section Constants, Symbol Spaces, and Datatypes, in the RIF data types and builtins specification [<a href="#ref-rif-dtb" title="">RIF-DTB</a>].
</p><p><span class="anchor" id="sec-conditions-abstract-syntax"></span>
</p>
<a id="Abstract_syntax" name="Abstract_syntax"></a><h3> <span class="mw-headline">2.1 Abstract syntax </span></h3>
<p>The alphabet of the RIF-PRD condition language consists of:
</p>
<ul><li> a countably infinite set of <i><b>constant symbols</b></i> <tt>Const</tt>,
</li><li> a countably infinite set of <i><b>variable symbols</b></i> <tt>Var</tt> (disjoint from <tt>Const</tt>),
</li><li> and syntactic constructs to denote:
<ul><li> lists,
</li><li> function calls,
</li><li> relations, including equality, class membership and subclass relations
</li><li> conjunction, disjunction and negation,
</li><li> and existential conditions.
</li></ul>
</li></ul>
<p>For the sake of readability and simplicity, this specification introduces a notation for these constructs. The notation is not intended to be a concrete syntax, so it leaves out many details. The only concrete syntax for RIF-PRD is the XML syntax.
</p><p>RIF-PRD supports externally defined functions only (including the built-in functions specified in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>]). RIF-PRD, unlike <a href="#ref-rif-bld" title="">RIF-BLD</a>, does not support uninterpreted function symbols (sometimes called logically defined functions).
</p><p>RIF-PRD supports a form of negation. Neither <a href="#ref-core" title="">RIF-Core</a> nor <a href="#ref-rif-bld" title="">RIF-BLD</a> support negation, because logic rule languages use many different and incompatible kinds of negation. See also the RIF framework for logic dialects [<a href="#ref-fld" title="">RIF-FLD</a>].
</p><p><span class="anchor" id="sec-terms"></span>
</p>
<a id="Terms" name="Terms"></a><h4> <span class="mw-headline">2.1.1 Terms </span></h4>
<p>The most basic construct in the RIF-PRD condition language is the <i>term</i>. RIF-PRD defines several kinds of term: <i>constants</i>, <i>variables</i>, <i>lists</i> and <i>positional</i> terms.
</p><p><span class="anchor" id="def-bld-term"></span>
<b>Definition (Term)</b>.
</p>
<ol><li> <i>Constants and variables</i>. If <tt>t</tt> ∈ <tt>Const</tt> or <tt>t</tt> ∈ <tt>Var</tt> then <tt>t</tt> is a <i><b>simple term</b></i>;
</li><li> <i>List terms</i>. A <i><b>list</b></i> has the form <tt>List(t</tt><sub>1</sub> ... <tt>t</tt><sub>m</sub><tt>)</tt>, where <tt>m≥0</tt> and <tt>t</tt><sub>1</sub>, ..., <tt>t</tt><sub>m</sub> are ground terms, i.e. without variables. A list of the form <tt>List()</tt> (i.e., a list in which <tt>m=0</tt>) is called the <i><b>empty list</b></i>;
</li><li> <i>Positional terms</i>. If <tt>t</tt> ∈ <tt>Const</tt> and <tt>t<sub>1</sub></tt>, ..., <tt>t<sub>n</sub></tt>, <tt>n≥0</tt>, are terms then <tt>t(t<sub>1</sub> ... t<sub>n</sub>)</tt> is a <i><b>positional term</b></i>.<br />Here, the constant <tt>t</tt> represents a function and <tt>t<sub>1</sub></tt>, ..., <tt>t<sub>n</sub></tt> represent argument values. ☐
</li></ol>
<p>To emphasize interoperability with <a href="#ref-rif-bld" title="">RIF-BLD</a>, positional terms may also be written: <tt>External(t(t<sub>1</sub>...t<sub>n</sub>))</tt>.
</p><p><span class="anchor" id="ref-ex21"></span>
</p>
<div class="example">
<p><b>Example 2.1.</b>
</p>
<ul><li> <tt>List("New" "Bronze" "Silver" "Gold")</tt> is a term that denotes the list of the values for a customer's status that are known to the system. The elements of the list, <tt>"New"</tt>, <tt>"Bronze"</tt>, <tt>"Silver"</tt> and <tt>"Gold"</tt> are terms denoting string constants;
</li><li> <tt>func:numeric-multiply(?value, 0.90)</tt> is a positional term that denotes the product of the value assigned to the variable <tt>?value</tt> and the constant <tt>0.90</tt>. That positional term can be used, for instance, to represent the new value, taking the discount into account, to be assigned a customer's shopping cart, in the rule <i>New customer and widget rule</i>. An alternative notation is to mark explicitly the positional term as externally defined, by wrapping it with the <tt>External</tt> indication: <tt>External(func:numeric-multiply(?value, 0.90))</tt> ☐
</li></ul>
</div>
<p><span class="anchor" id="sec-atomic-formulas"></span>
</p>
<a id="Atomic_formulas" name="Atomic_formulas"></a><h4> <span class="mw-headline">2.1.2 Atomic formulas </span></h4>
<p><i>Atomic formulas</i> are the basic tests of the RIF-PRD condition language.
</p><p><span class="anchor" id="def-prd-atomic"></span>
<span class="anchor" id="def-prd-atomic-formula"></span>
<b>Definition (Atomic formula)</b>.
An <i><b>atomic formula</b></i> can have several different forms and is defined as follows:
</p>
<ol><li> <i>Positional atomic formulas</i>. If <tt>t</tt> ∈ <tt>Const</tt> and <tt>t<sub>1</sub></tt>, ..., <tt>t<sub>n</sub></tt>, <tt>n≥0</tt>, are terms then <tt>t(t<sub>1</sub> ... t<sub>n</sub>)</tt> is a <i><b>positional atomic formula</b></i> (or simply an <i><b>atom</b></i>)
</li><li> <i>Equality atomic formulas</i>. <tt>t = s</tt> is an <i><b>equality atomic formula</b></i> (or simply an <i><b>equality</b></i>), if <tt>t</tt> and <tt>s</tt> are terms
</li><li> <i>Class membership atomic formulas</i>. <tt>t#s</tt> is a <i><b>membership atomic formula</b></i> (or simply <i><b>membership</b></i>) if <tt>t</tt> and <tt>s</tt> are terms. The term <tt>t</tt> is the <i>object</i> and the term <tt>s</tt> is the <i>class</i>
</li><li> <i>Subclass atomic formulas</i>. <tt>t##s</tt> is a <i><b>subclass atomic formula</b></i> (or simply a <i><b>subclass</b></i>) if <tt>t</tt> and <tt>s</tt> are terms
</li><li> <i>Frame atomic formulas</i>. <tt>t[p<sub>1</sub>->v<sub>1</sub> ... p<sub>n</sub>->v<sub>n</sub>]</tt> is a <i><b>frame atomic formula</b></i> (or simply a <i><b>frame</b></i>) if <tt>t</tt>, <tt>p<sub>1</sub></tt>, ..., <tt>p<sub>n</sub></tt>, <tt>v<sub>1</sub></tt>, ..., <tt>v<sub>n</sub></tt>, <tt>n ≥ 0</tt>, are terms. The term <tt>t</tt> is the <i>object</i> of the frame; the <tt>p<sub>i</sub></tt> are the <i>property</i> or <i>attribute</i> names; and the <tt>v<sub>i</sub></tt> are the property or attribute <i>values</i>. In this document, an attribute/value pair is sometimes called a <i>slot</i>
</li><li> <i>Externally defined atomic formulas.</i> If <tt>t</tt> is a positional atomic formula then <tt>External(t)</tt> is an <i><b>externally defined atomic formula</b></i>. ☐
</li></ol>
<p>Class membership, subclass, and frame atomic formulas are used to represent classifications, class hierarchies and object-attribute-value relations.
</p><p>Externally defined atomic formulas are used, in particular, for representing built-in predicates.
</p><p>In the <a href="#ref-rif-bld" title="">RIF-BLD</a> specification, as is common practice in logic languages,
atomic formulas are also called <i>terms</i>.
</p><p><span class="anchor" id="ref-ex22"></span>
</p>
<div class="example">
<p><b>Example 2.2.</b>
</p>
<ul><li> The membership formula <tt>?customer # ex1:Customer</tt> tests whether the individual bound to the variable <tt>?customer</tt> is a member of the class denoted by <tt>ex1:Customer</tt>.
</li><li> The atom <tt>ex1:Gold(?customer)</tt> tests whether the customer represented by the variable <tt>?customer</tt> has the <i>"Gold"</i> status.
</li><li> Alternatively, gold status can be tested in a way that is closer to an object-oriented representation using the frame formula <tt>?customer[ex1:status->"Gold"]</tt>.
</li><li> The following atom uses the built-in predicate <tt>pred:list-contains</tt> to validate the status of a customer against a list of allowed customer statuses: <tt>External(pred:list-contains(List("New", "Bronze", "Silver", "Gold"), ?status))</tt>. ☐
</li></ul>
</div>
<p><span class="anchor" id="sec-formulas"></span>
</p>
<a id="Formulas" name="Formulas"></a><h4> <span class="mw-headline">2.1.3 Formulas </span></h4>
<p>Composite truth-valued constructs are called <i>formulas</i>, in RIF-PRD.
</p><p>Note that terms (constants, variables, lists and functions) are <i>not</i> formulas.
</p><p>More general formulas are constructed out of atomic formulas with the help of logical connectives.
</p><p><span class="anchor" id="def-bld-formula"></span>
<b>Definition (Condition formula)</b>.
A <i><b>condition formula</b></i> can have several different forms and is defined as follows:
</p>
<ol><li> <i>Atomic formula</i>: If <tt>φ</tt> is an atomic formula then it is also a condition formula.
</li><li> <i>Conjunction</i>: If <tt>φ<sub>1</sub></tt>, ..., <tt>φ<sub>n</sub></tt>, <tt>n ≥ 0</tt>, are condition formulas then so is <tt>And(φ<sub>1</sub> ... φ<sub>n</sub>)</tt>, called a <i>conjunctive</i> formula. As a special case, <tt>And()</tt> is allowed and is treated as a tautology, i.e., a formula that is always true.
</li><li> <i>Disjunction</i>: If <tt>φ<sub>1</sub></tt>, ..., <tt>φ<sub>n</sub></tt>, <tt>n ≥ 0</tt>, are condition formulas then so is <tt>Or(φ<sub>1</sub> ... φ<sub>n</sub>)</tt>, called a <i>disjunctive</i> formula. As a special case, <tt>Or()</tt> is permitted and is treated as a contradiction, i.e., a formula that is always false.
</li><li> <i>Negation</i>: If <tt>φ</tt> is a condition formula, then so is <tt>Not(φ)</tt>, called a <i>negative</i> formula.
</li><li> <i>Existentials</i>: If <tt>φ</tt> is a condition formula and <tt>?V<sub>1</sub></tt>, ..., <tt>?V<sub>n</sub></tt>, <tt>n>0</tt>, are variables then <tt>Exists ?V<sub>1</sub> ... ?V<sub>n</sub>(φ)</tt> is an <i>existential</i> formula. ☐
</li></ol>
<p>In the definition of a formula, the component formulas <tt>φ</tt> and <tt>φ<sub>i</sub></tt> are said to be <span class="anchor" id="def-subformula"><i><b>subformulas</b></i></span> of the respective condition formulas that are built using these components.
</p><p><span class="anchor" id="ref-ex23"></span>
</p>
<div class="example">
<p><b>Example 2.3.</b>
</p>
<ul><li> The condition of the <a href="#sec-running-example" title=""><i>New customer and widget rule</i></a>: <i>A "New" customer who buys a widget</i>, can be represented by the following RIF-PRD condition formula:
</li></ul>
<pre>And( ?customer # ex1:Customer
?customer[ex1:status->"New"]
Exists ?shoppingCart ?item ( And ( ?customer[ex1:shoppingCart->?shoppingCart]
?shoppingCart[ex1:containsItem->?item]
?item # ex1:Widget) )
)
)
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="def-free_var_base"></span>
The function <i><b>Var</b></i>, that maps a term, an atomic formula or a condition formula to the set of its free variables is defined as follows:
</p>
<ul><li> if <i>e</i> ∈ <i>Const</i>, then <i>Var(e) = ∅</i>;
</li><li> if <i>e</i> ∈ <i>Var</i>, then <i>Var(e)</i> = {<i>e</i>};
</li><li> if <i>e</i> is a <i>list term</i>, then <i>Var(e) = ∅</i>;
</li><li> if <i>f(arg<sub>1</sub>...arg<sub>n</sub>)</i>, <i>n ≥ 0</i>, is a positional term, then, <i>Var(f(arg<sub>1</sub>...arg<sub>n</sub>)</i> = ∪<sub>i=1...n</sub> <i>Var(arg<sub>i</sub>)</i>;
</li><li> if <i>p(arg<sub>1</sub>...arg<sub>n</sub>)</i>, n ≥ 0, is an atom, then, <i>Var(p(arg<sub>1</sub>...arg<sub>n</sub>)</i> = <i>Var(External(p(arg<sub>1</sub>...arg<sub>n</sub>))</i> = ∪<sub>i=1...n</sub> <i>Var(arg<sub>i</sub>)</i>;
</li><li> if <i>t<sub>1</sub></i> and <i>t<sub>2</sub></i> are terms, then <i>Var(t<sub>1</sub> [=|#|##] t<sub>2</sub>)</i> = <i>Var(t<sub>1</sub>)</i> ∪ <i>Var(t<sub>2</sub>)</i>;
</li><li> if <i>o'</i>, <i>k</i><sub>i</sub>, <i>i</i> = 1...n, and <i>v</i><sub>i</sub>, <i>i</i> = 1...n, n ≥ 1, are terms, then <i>Var(o[k<sub>1</sub>->v<sub>1</sub> ... k<sub>n</sub>->v<sub>n</sub>])</i> = <i>Var(o)</i> ∪<sub>i=1...n</sub> <i>Var(k<sub>i</sub>)</i> ∪<sub>i=1...n</sub> <i>Var(v<sub>i</sub>)</i>.
</li><li> if <i>f<sub>i</sub></i>, <i>i</i> = 0...n, n ≥ 0, are condition formulas, then <i>Var([And|Or](f<sub>1</sub>...f<sub>n</sub>))</i> = ∪<sub>i=0...n</sub> <i>Var(f<sub>i</sub>)</i>;
</li><li> if <i>f</i> is a condition formula, then <i>Var(Not(f))</i> = <i>Var(f)</i>;
</li><li> if <i>f</i> is a condition formula and <i>x<sub>i</sub></i> ∈ <i>Var</i> for <i>i</i> = 1...n, <i>n ≥ 1</i>, then, <i>Var(Exists x<sub>1</sub> ... x<sub>n</sub> (f))</i> = <i>Var(f)</i> - <i>{x<sub>1</sub>...x<sub>n</sub>}</i>.
</li></ul>
<p><span class="anchor" id="def-prd-ground-formula"></span>
<b>Definition (Ground formula)</b>. A condition formula <tt>φ</tt> is a <i><b>ground formula</b></i> if and only if <i>Var</i><tt>φ</tt> = {} and <tt>φ</tt> does not contain any existential subformula. ☐
</p><p>In other words, a ground formula does not contain any variable term.
</p><p><span class="anchor" id="sec-well-formed-formulas"></span>
</p>
<a id="Well-formed_formulas" name="Well-formed_formulas"></a><h4> <span class="mw-headline">2.1.4 Well-formed formulas </span></h4>
<p>Not all formulas are well-formed in RIF-PRD: it is required that no constant appear in more than one context. What this means precisely is explained below.
</p><p>The set of all constant symbols, <tt>Const</tt>, is partitioned into the following subsets:
</p>
<ul><li> A subset of individuals. The symbols in <tt>Const</tt> that belong to the primitive datatypes are required to be individuals;
</li><li> A subset for external function symbols;
</li><li> A subset of plain predicate symbols;
</li><li> A subset for external predicate symbols.
</li></ul>
<p>As seen from the following definitions, these subsets are not specified explicitly but, rather, are inferred from the occurrences of the symbols.
</p><p><br />
<span class="anchor" id="def-bld-context"></span>
<b>Definition (Context of a symbol)</b>.
The <i><b>context of an occurrence</b></i> of a symbol, <tt>s∈Const</tt>, in a formula, <tt>φ</tt>, is determined as follows:
</p>
<ul><li> If <tt>s</tt> occurs as a predicate in an atomic <a href="#def-subformula" title="">subformula</a> of the form <tt>s(...)</tt> then <tt>s</tt> occurs in the <i>context of a (plain) predicate symbol</i>;
</li><li> If <tt>s</tt> occurs as a predicate in an atomic subformula <tt>External(s(...))</tt> then <tt>s</tt> occurs in the <i>context of an external predicate symbol</i>;
</li><li> If <tt>s</tt> occurs as a function in a term (which is not a subformula) <tt>s(...)</tt> (or <tt>External(s(...))</tt>) then <tt>s</tt> occurs in the <i>context of an (external) function symbol</i>;
</li><li> If <tt>s</tt> occurs in any other context (e.g. in a frame: <tt>s[...]</tt>, <tt>...[s->...]</tt>, or <tt>...[...->s]</tt>; or in a positional atom: <tt>p(...s...)</tt>), it is said to occur as an <i>individual</i>. ☐
</li></ul>
<p><span class="anchor" id="def-bld-wff"></span>
<b>Definition (Well-formed formula)</b>.
A formula <tt>φ</tt> is <i><b>well-formed</b></i> iff:
</p>
<ul><li> every constant symbol mentioned in <tt>φ</tt> occurs in exactly one <a href="#def-bld-context" title="">context</a>;
</li><li> whenever a formula contains a positional term, <tt>t</tt> (or <tt>External(t)</tt>), or an external atomic formula, <tt>External(t)</tt>, <tt>t</tt> must be an instance of a schema in the coherent set of external schemas (Section Schemas for Externally Defined Terms in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>]) associated with the <a href="#def-prd-lang" title="">language of RIF-PRD</a>;
</li><li> if <tt>t</tt> is an instance of a schema in the coherent set of external schemas associated with the language then <tt>t</tt> can occur only as an external term or atomic formula. ☐
</li></ul>
<p><span class="anchor" id="def-prd-lang"></span>
<b>Definition (RIF-PRD condition language)</b>.
The <i><b>RIF-PRD condition language</b></i> consists of the set of all well-formed formulas. ☐
</p><p><span class="anchor" id="sec-semantics-of-condition-formulas"></span>
</p>
<a id="Operational_semantics_of_condition_formulas" name="Operational_semantics_of_condition_formulas"></a><h3> <span class="mw-headline">2.2 Operational semantics of condition formulas </span></h3>
<p>This section specifies the semantics of the condition formulas in a RIF-PRD document.
</p><p>Informally, a condition formula is evaluated with respect to a state of facts and it is <i>satisfied</i>, or <i>true</i>, if and only if:
</p>
<ul><li> it is an atomic condition formula and its variables are bound to individuals such that, when these constants are substituted for the variables, either
<ul><li> it matches a fact, or
</li><li> it is implied by some background knowledge, or
</li><li> it is an externally defined predicate, and its evaluation yelds <i>true</i>, or
</li></ul>
</li><li> it is a compound condition formula: conjunction, disjunction, negation or existential; and it is evaluated as expected, based on the truth value of its atomic components.
</li></ul>
<p>The semantics is specified in terms of matching substitutions in the sections below. The specification makes no assumption regarding how matching substitutions are determined. In particular, it does not require from <a href="#def-bld-wff" title="">well-formed condition formulas</a> that they can be evaluated using pattern matching only. However, RIF-PRD requires <a href="#def-safe-rule" title="">safeness</a> from <a href="#def-wf-rule" title="">well-formed rules</a>, which implies that all the variables in the left-hand side can be bound by pattern matching.
</p><p>For compatibility with other RIF specifications (in particular, RIF data types and built-ins [<a href="#ref-rif-dtb" title="">RIF-DTB</a>] and RIF RDF and OWL compatibility [<a href="#ref-rif-rdf-owl" title="">RIF-RDF-OWL</a>]), and to make explicit the interoperability with RIF logic dialects (in particular RIF Core [<a href="#ref-core" title="">RIF-Core</a>] and RIF-BLD [<a href="#ref-rif-bld" title="">RIF-BLD</a>]), the semantics of RIF-PRD condition formulas is also specified using model theory, in <a href="#appendix-model-theory" title="">appendix Model theoretic semantics of RIF-PRD condition formulas</a>.
</p><p>The two specifications are equivalent and normative.
</p><p><span class="anchor" id="sec-matching-substitution"></span>
</p>
<a id="Matching_substitution" name="Matching_substitution"></a><h4> <span class="mw-headline">2.2.1 Matching substitution </span></h4>
<p>Let <tt>Term</tt> be the set of the terms in the RIF-PRD condition language (as defined in section <a href="#sec-terms" title="">Terms</a>).
</p><p><span class="anchor" id="def-substitution"></span>
<b>Definition (Substitution).</b> A <i><b>substitution</b></i> is a finitely non-identical assignment of terms to variables; i.e., a function <i>σ</i> from <tt>Var</tt> to <tt>Term</tt> such that the set {<i>x</i> ∈ <tt>Var</tt> | <i>x</i> ≠ σ(<i>x</i>)} is finite. This set is called the domain of σ and denoted by <i>Dom</i>(σ). Such a substitution is also written as a set such as σ = {<i>t<sub>i</sub></i>/<i>x<sub>i</sub></i>}<sub>i=1..n</sub> where <i>Dom</i>(σ) = {<i>x<sub>i</sub></i>}<sub>i=1..n</sub> and σ(<i>x<sub>i</sub></i>) = <i>t<sub>i</sub></i>, <i>i</i> = 1..n. ☐
</p><p><span class="anchor" id="def-ground-subst"></span>
<b>Definition (Ground Substitution).</b> A <i>ground substitution</i> is a substitution σ that assigns only ground terms to the variables in <i>Dom</i>(σ): ∀ <i>x</i> ∈ <i>Dom</i>(σ), <i>Var</i>(σ(<i>x</i>)) = ∅ ☐
</p><p>Because RIF-PRD covers only externally defined interpreted functions, a ground functional term can always be replaced by its value. As a consequence, a ground substitution can always be restricted, without loss of generality, to assign only constants to the variable in its domain. In the remainder of this document, it will always be assumed that a ground substitution assigns only constants to the variables in its domain.
</p><p>If <i>t</i> is a term or a condition formula, and if <i>σ</i> is a ground substitution such that <i>Var(t) ∈ Dom(σ)</i>, <i>σ(t)</i> denotes the ground term or the ground condition formula obtained by substituting, in <i>t</i>:
</p>
<ul><li> <i>σ(x)</i> for all <i>x ∈ Var(t)</i>, and
</li><li> the externally defined results of interpreting a function with ground arguments, for all externally defined terms.
</li></ul>
<p><span class="anchor" id="def-matching-substitution"></span>
<b>Definition (Matching substitution).</b> Let <i>ψ</i> be a RIF-PRD condition formula; let <i>σ</i> be a ground substitution such that <i>Var(ψ) ⊆ Dom(σ)</i>; and let <i>Φ</i> be a set of ground RIF-PRD atomic formulas.
</p><p>We say that the ground substitution <i>σ</i> <i><b>matches</b></i> <i>ψ</i> to <i>Φ</i> if and only if one of the following is true:
</p>
<ul><li> <i>ψ</i> is an atomic formula and either
<ul><li> <i>σ(ψ)</i> ∈ <i>Φ</i>, or
</li><li> <i>ψ</i> is an equality formula, <tt>t<sub>1</sub> = t<sub>2</sub></tt>, and the ground terms <i>σ(t<sub>1</sub>)</i> and <i>σ(t<sub>2</sub>)</i> have the same value; or
</li><li> <i>ψ</i> is an external atomic formula and the external definition maps <i>σ(ψ)</i> to <b>t</b> (or <i>true</i>),
</li></ul>
</li><li> <i>ψ</i> is <tt>Not(f)</tt> and <i>σ</i> does not match the condition formula <tt>f</tt> to <i>Φ</i>,
</li><li> <i>ψ</i> is <tt>And(f<sub>1</sub> ... f<sub>n</sub>)</tt> and either <tt>n = 0</tt> or <i>∀ i, 1 ≤ i ≤ n</i>, <i>σ</i> matches <tt>f<sub>i</sub></tt> to <i>Φ</i>,
</li><li> <i>ψ</i> is <tt>Or(f<sub>1</sub> ... f<sub>n</sub>)</tt> and <tt>n</tt> <i>> 0</i> and ∃ <i>i, 1 ≤ i ≤ n</i>, such that <i>σ</i> matches <tt>f<sub>i</sub></tt> to <i>Φ</i>, or
</li><li> <i>ψ</i> is <tt>Exists ?v<sub>1</sub> ... ?v<sub>n</sub> (f)</tt>, and there is a substitution <i>σ' </i> that extends <i>σ</i> in such a way that <i>σ' </i> agrees with <i>σ</i> where <i>σ</i> is defined, and <i>Var(<tt>f</tt>) ⊆ Dom(σ')</i>; and <i>σ' </i> matches <tt>f</tt> to <i>Φ</i>. ☐
</li></ul>
<p><span class="anchor" id="sec-satisfaction-of-condition"></span>
</p>
<a id="Condition_satisfaction" name="Condition_satisfaction"></a><h4> <span class="mw-headline">2.2.2 Condition satisfaction </span></h4>
<p>We define, now, what it means for a <i>state of the fact base</i> to satisfy a condition formula. The satisfaction of condition formulas in a state of the fact base provides formal underpinning to the operational semantics of rule sets interchanged using RIF-PRD.
</p><p><span class="anchor" id="def-state"></span>
<b>Definition (State of the fact base).</b> A <i><b>state of the fact base</b></i>, <i>w<sub>Φ</sub></i>, is associated to every set of ground atomic formulas, <i>Φ</i>, that satisfies, at least, the following conditions, for all triple of constants <i>c<sub>1</sub>, c<sub>2</sub></i>, <i>c<sub>3</sub></i>:
</p>
<ul><li> if <i>c<sub>1</sub>##c<sub>2</sub> ∈ Φ</i> and <i>c<sub>2</sub>##c<sub>3</sub> ∈ Φ</i>, then <i>c<sub>1</sub>##c<sub>3</sub> ∈ Φ</i>;
</li><li> and if <i>c<sub>1</sub>#c<sub>2</sub> ∈ Φ</i> and <i>c<sub>2</sub>##c<sub>3</sub> ∈ Φ</i>, then <i>c<sub>1</sub>#c<sub>3</sub> ∈ Φ</i>.
</li></ul>
<p>We say that <i>w<sub>Φ</sub></i> is <i>represented</i> by <i>Φ</i>; or, equivalently, by the conjunction of all the ground atomic formulas in <i>Φ</i>. ☐
</p><p>Each ground atomic formula in <i>Φ</i> represents a single <b>fact</b>, and, often, the ground atomic formulas, themselves, are called <i>facts</i>, as well.
</p><p><span class="anchor" id="def-condition-satisfaction"></span>
<b>Definition (Condition satisfaction).</b> A RIF-PRD condition formula <tt>ψ</tt> is <i><b>satisfied</b></i> in a state of the fact base, <i>w</i>, if and only if <i>w</i> is represented by a set of ground atomic formulas <i>Φ</i>, and there is a ground substitution <i>σ</i> that matches <i>ψ</i> to <i>Φ</i>. ☐
</p><p>Alternative, but equivalent, definitions of a state of the fact base and of the satisfaction of a condition are given in the <a href="#appendix-model-theory" title="">appendix Model theoretic semantics of RIF-PRD condition formulas</a>: they provide the formal link between the model theory of RIF-PRD condition formulas and the operational semantics of RIF-PRD documents.
</p><p><span class="anchor" id="sec-actions"></span>
</p>
<a id="Actions" name="Actions"></a><h2> <span class="mw-headline">3 Actions </span></h2>
<p>This section specifies the syntax and semantics of the RIF-PRD <i>action</i> language. The conclusion of a production rule is often called the <i>action</i> part, the <i>then</i> part, or the <i>right-hand side</i>, or <i>RHS</i>.
</p><p>The RIF-PRD action language is used to add, delete and modify facts in the fact base.
As a rule interchange format, RIF-PRD does not make any assumption regarding the nature of the data sources that the producer or the consumer of a RIF-PRD document uses (e.g. a rule engine's working memory, an external data base, etc). As a consequence, the syntax of the actions that RIF-PRD supports are defined with respect to the RIF-PRD condition formulas that represent the facts that the actions affect.
In the same way, the semantics of the actions is specified in terms of how their execution affects the evaluation of rule conditions.
</p><p><span class="anchor" id="sec-actions-abstract-syntax"></span>
</p>
<a id="Abstract_syntax_2" name="Abstract_syntax_2"></a><h3> <span class="mw-headline">3.1 Abstract syntax </span></h3>
<p>The alphabet of the RIF-PRD action language includes symbols to denote:
</p>
<ul><li> the assertion of a fact represented by a positional atom, a frame, or a membership atomic formula,
</li><li> the retraction of a fact represented by a positional atom or a frame,
</li><li> the retraction of all the facts about the values of a given slot of a given frame object,
</li><li> the addition of a new frame object,
</li><li> the removal of a frame object and the retraction of all the facts about it, represented by the corresponding frame and class membership atomic formulas,
</li><li> the replacement of all the values of an object's attribute by a single, new value,
</li><li> the execution of an externally defined action, and
</li><li> a sequence of these actions, including the declaration of local variables and a mechanism to bind a local variable to a frame slot value or a new frame object.
</li></ul>
<p><span class="anchor" id="sec-atomic-actions"></span>
</p>
<a id="Actions_2" name="Actions_2"></a><h4> <span class="mw-headline">3.1.1 Actions </span></h4>
<p>The RIF-PRD action language includes constructs for actions that are atomic, from a transactional point of view, and constructs that represent compounds of atomic actions. Action constructs take constructs from the RIF-PRD condition language as their arguments.
</p><p><span class="anchor" id="def-atomic-action"></span>
<b>Definition (Atomic action).</b> An <i><b>atomic action</b></i> is a construct that represents an atomic transaction. An atomic action can have several different forms and is defined as follows:
</p>
<ol><li> <i>Assert fact</i>: If <tt>φ</tt> is a <a href="#def-prd-atomic-formula" title="">positional atom</a>, a <a href="#def-prd-atomic-formula" title="">frame</a> or a <a href="#def-prd-atomic-formula" title="">membership atomic formula</a> in the RIF-PRD condition language, then <tt>Assert(φ)</tt> is an atomic action. <tt>φ</tt> is called the <i>target</i> of the action.
</li><li> <i>Retract fact</i>: If <tt>φ</tt> is a <a href="#def-prd-atomic-formula" title="">positional atom</a> or a <a href="#def-prd-atomic-formula" title="">frame</a> in the RIF-PRD condition language, then <tt>Retract(φ)</tt> is an atomic action. <tt>φ</tt> is called the <i>target</i> of the action.
</li><li> <i>Retract all slot values</i>: If <tt>o</tt> and <tt>s</tt> are terms in the RIF-PRD condition language, then <tt>Retract(o s)</tt> is an atomic action. The pair <tt>(o, s)</tt> is called the <i>target</i> of the action.
</li><li> <i>Retract object</i>: If <tt>t</tt> is a <a href="#def-bld-term" title="">term</a> in the RIF-PRD condition language, then <tt>Retract(t)</tt> is an atomic action. <tt>t</tt> is called the <i>target</i> of the action.
</li><li> <i>Execute</i>: if <tt>φ</tt> is a <a href="#def-prd-atomic-formula" title="">positional atom</a> in the RIF-PRD condition language, then <tt>Execute(φ)</tt> is an atomic action. <tt>φ</tt> is called the <i>target</i> of the action. ☐
</li></ol>
<p><span class="anchor" id="def-compound-action"></span>
<b>Definition (Compound action).</b> A <i><b>compound action</b></i> is a construct that can be replaced equivalently by a pre-defined, and fixed, sequence of atomic actions. RIF-PRD defines a single compound action, defined as follows:
</p>
<ol><li> <i>Modify fact</i>: if <tt>φ</tt> is a <a href="#def-prd-atomic-formula" title="">frame</a> in the RIF-PRD condition language: <tt>φ</tt> = <tt>o[s->v]</tt>; then <tt>Modify(φ)</tt> is a compound action, defined by the sequence: <a href="#def-atomic-action" title=""><tt>Retract(o s)</tt></a>, followed by <a href="#def-atomic-action" title=""><tt>Assert(φ)</tt></a>. <tt>φ</tt> is called the <i>target</i> of the action. ☐
</li></ol>
<p><span class="anchor" id="def-simple-action"></span>
<b>Definition (Action).</b> A <i><b>action</b></i> is either an <a href="#def-atomic-action" title="">atomic action</a> or a <a href="#def-compound-action" title="">compound action</a>. ☐
</p><p><span class="anchor" id="def-ground-action"></span>
<b>Definition (Ground action).</b> An action with target <tt>t</tt> is a <i><b>ground action</b></i> if and only if
</p>
<ul><li> <tt>t</tt> is an atomic formula and <i>Var</i>(<tt>t</tt>) = ∅;
</li><li> or <tt>t = (o, s)</tt> is a pair of terms and <i>Var</i>(<tt>o</tt>) = <i>Var</i>(<tt>s</tt>) = ∅.
</li></ul>
<p> ☐
</p><p><span class="anchor" id="ex-31"></span>
</p>
<div class="example">
<p><b>Example 3.1.</b>
</p>
<ul><li> <tt>Assert( ?customer[ex1:voucher->?voucher] )</tt> and <tt>Retract( ?customer[ex1:voucher->?voucher] )</tt> denote two atomic actions with the frame <tt>?customer[ex1:voucher->?voucher]</tt> as their target,
</li><li> <tt>Retract( ?customer ex1:voucher )</tt> denotes an atomic action with the pair of terms <tt>(?customer, ex1:voucher)</tt> as its target,
</li><li> <tt>Modify(?customer[ex1:voucher->?voucher])</tt> denotes a compound action with the frame <tt>?customer[ex1:voucher->?voucher]</tt> as its target. <tt>Modify(?customer[ex1:voucher->?voucher])</tt> can always be equivalently replaced by the sequence: <tt>Retract( ?customer ex1:voucher )</tt> then <tt>Assert( ?customer[ex1:voucher->?voucher] )</tt>;
</li><li> <tt>Retract( ?voucher )</tt> denotes an atomic action whose target is the individual bound to the variable <tt>?voucher</tt>,
</li><li> <tt>Execute( <a href="#sec-act-print" title="">act:print</a>("Hello, world!") )</tt> denotes an atomic action whose target is the externally defined action <tt>act:print</tt>. ☐
</li></ul>
</div>
<p><span class="anchor" id="sec-action-blocks"></span>
</p>
<a id="Action_blocks" name="Action_blocks"></a><h4> <span class="mw-headline">3.1.2 Action blocks </span></h4>
<p>The <i>action block</i> is the top level construct to represent the conclusions of RIF-PRD rules. An action block contains a non-empty sequence of <a href="#def-simple-action" title="">actions</a>. It may also include <i>action variable declarations</i>.
</p><p>The <i>action variable declaration</i> construct is used to declare variables that are local to the action block, called <i>action variables</i>, and to assign them a value within the action block.
</p><p><span class="anchor" id="def-action-variable-declaration"></span>
<b>Definition (Action variable declaration).</b> An <i><b>action variable declaration</b></i> is a pair, <i>(v p)</i> made of an <i>action variable</i>, <i>v</i>, and an <i>action variable binding</i> (or, simply, <i>binding</i>), <i>p</i>, where <i>p</i> has one of two forms:
</p>
<ol><li> <i>frame object declaration</i>: if the action variable, <i>v</i>, is to be assigned the identifier of a new frame, then the action variable binding is a <i>frame object declaration</i>: <tt>New()</tt>. In that case, the notation for the action variable declaration is: <tt>(?o New())</tt>;
</li><li> <i>frame slot value</i>: if the action variable, <i>v</i>, is to be assigned the value of a slot of a ground frame, then the action variable binding is a frame: <i>p</i> = <tt>o[s-></tt><i>v</i><tt>]</tt>, where <tt>o</tt> is a term that represents the identifier of the ground frame and <tt>s</tt> is a term that represents the name of the slot. The associated notation is: <tt>(?value o[s->?value])</tt>. ☐
</li></ol>
<p><span class="anchor" id="def-action-block"></span>
<b>Definition (Action block).</b> If <tt>(v<sub>1</sub> p<sub>1</sub>), ..., (v<sub>n</sub> p<sub>n</sub>)</tt>, <i>n ≥ 0</i>, are action variable declarations, and if <tt>a<sub>1</sub>, ..., a<sub>m</sub></tt>, <i>m ≥ 1</i>, are <a href="#def-simple-action" title="">actions</a>, then <tt>Do((v<sub>1</sub> p<sub>1</sub>) ... (v<sub>n</sub> p<sub>n</sub>) a<sub>1</sub> ... a<sub>m</sub>)</tt> denotes an <b>action block</b>. ☐
</p><p><span class="anchor" id="ex-32"></span>
</p>
<div class="example">
<p><b>Example 3.2.</b> In the following action block, a local variable <tt>?oldValue</tt> is bound to a value of the attribute <tt>value</tt> of the object bound to the variable <tt>?shoppingCart</tt>. The <tt>?oldValue</tt> is then used to compute a new value, and the <tt>Modify</tt> action is used to overwrite the old value with the new value in the fact base:
</p>
<pre>Do( (?oldValue ?shoppingCart[ex1:value->?oldValue])
Modify( ?shoppingCart[ex1:value->func:numeric-multiply(?oldValue 0.90)] ) )
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-well-formed-action-blocks"></span>
</p>
<a id="Well-formed_action_blocks" name="Well-formed_action_blocks"></a><h4> <span class="mw-headline">3.1.3 Well-formed action blocks </span></h4>
<p>Not all action blocks are well-formed in RIF-PRD:
</p>
<ul><li> one and only one action variable binding can assign a value to each action variable, and
</li><li> the assertion of a membership atomic formula is meaningful only if it is about a frame object that is created in the same action block.
</li></ul>
<p>The notion of well-formedness, already <a href="#def-bld-wff" title="">defined for condition formulas</a>, is extended to actions, action variable declarations and action blocks.
</p><p><span class="anchor" id="def-wf-atomic-action"></span>
<b>Definition (Well-formed action).</b> An <a href="#def-simple-action" title="">action</a> <tt>α</tt> is <i><b>well-formed</b></i> if and only if one of the following is true:
</p>
<ul><li> <tt>α</tt> is an <tt>Assert</tt> and its target is a well-formed atom, a well-formed frame or a well-formed membership atomic formula,
</li><li> <tt>α</tt> is a <tt>Retract</tt> with one single argument and its target is a well-formed term or a well-formed atom or a well-formed frame atomic formula,
</li><li> <tt>α</tt> is a <tt>Retract</tt> with two arguments: <tt>o</tt> and <tt>s</tt>, and both are terms and there is at least one term, <tt>v</tt>, such that <tt>o[s->v]</tt> is a well-formed frame atomic formula,
</li><li> <tt>α</tt> is a <tt>Modify</tt> and its target is a well-formed frame, or
</li><li> <tt>α</tt> is an <tt>Execute</tt> and its content is an instance of the coherent set of external schemas (Section Schemas for Externally Defined Terms in RIF data types and builtins [<a href="#ref-rif-dtb" title="">RIF-DTB</a>]) associated with the RIF-PRD language (section <a href="#sec-builtins" title="">Built-in functions, predicates and actions</a>). ☐
</li></ul>
<p><span class="anchor" id="def-wf-action-var-decl"></span>
<b>Definition (Well-formed action variable declaration).</b> An action variable declaration <tt>(?v</tt> <i>p</i><tt>)</tt> is <i><b>well-formed</b></i> if and only if one of the following is true:
</p>
<ul><li> the action variable binding, <i>p</i>, is the declaration of a new frame object: <i>p</i> = <tt>New()</tt>, or
</li><li> the action variable binding, <i>p</i>, is a well formed frame atomic formula, <i>p</i> = <tt>o[a<sub>1</sub>->t<sub>1</sub>...a<sub>n</sub>->t<sub>n</sub>]</tt>, <i>n ≥ 1</i>, and the action variable, <tt>v</tt> occurs in the position of a slot value, and nowhere else, that is: <tt>v</tt> ∈ {<tt>t<sub>1</sub> ... t<sub>n</sub></tt>} and ∀ <tt>t<sub>i</sub></tt>, either <i>v</i> = <tt>t<sub>i</sub></tt> or <i>v</i> ∉ <i>Var(</i><tt>t<sub>i</sub></tt><i>)</i> and <tt>v</tt> ∉ <i>Var(o) ∪ Var(<tt>a<sub>1</sub></tt>) ∪ ... ∪ Var(<tt>a<sub>n</sub></tt>)</i>. ☐
</li></ul>
<p><span class="anchor" id="def-free_var_action"></span>
For the definition of a well-formed action block, the function <i>Var(f)</i>, that has been <a href="#def-free_var_base" title="">defined for condition formulas</a>, is extended to actions and frame object declarations as follows:
</p>
<ul><li> if <i>f</i> is an action with target <i>t</i> and <i>t</i> is an atomic formula, then <i>Var(f) = Var(t)</i>;
</li><li> if <i>f</i> is an action with target <i>t</i> and <i>t</i> is a pair, <i>(o, s)</i> of terms, then <i>Var(f) = Var(o) ∪ Var(s)</i>;
</li><li> if <i>f</i> is a frame object declaration, <tt>New()</tt>, then <i>Var(f) = ∅</i>.
</li></ul>
<p><span class="anchor" id="def-wf-action-block"></span>
<b>Definition (Well-formed action block).</b> An action block is <i><b>well-formed</b></i> if and only if all of the following are true:
</p>
<ul><li> all the action variable declarations, if any, are well-formed,
</li><li> each action variable, if any, is assigned a value by one and only one action variable binding, that is: if <i>b<sub>1</sub></i> = <tt>(v<sub>1</sub> p<sub>1</sub>)</tt> and <i>b<sub>2</sub></i> = <tt>(v<sub>2</sub> p<sub>2</sub>)</tt> are two action variable declarations in the action block with different bindings: <i><tt>p<sub>1</sub></tt> ≠ <tt>p<sub>2</sub></tt></i>, then <i><tt>v<sub>1</sub></tt> ≠ <tt>v<sub>2</sub></tt></i>,
</li><li> in addition, the action variable declarations, if any, are partially ordered by the ordering defined as follows: if <i>b<sub>1</sub></i> = <tt>(v<sub>1</sub> p<sub>1</sub>)</tt> and <i>b<sub>2</sub></i> = <tt>(v<sub>2</sub> p<sub>2</sub>)</tt> are two action variable declarations in the action block, then <i>b<sub>1</sub> ≤ b<sub>2</sub></i> if and only if <tt>v<sub>1</sub></tt> ∈ <i>Var(</i><tt>p<sub>2</sub></tt><i>)</i>,
</li><li> all the actions in the action block are well-formed actions, and
</li><li> if an action in the action block asserts a membership atomic formula, <tt>Assert(t<sub>1</sub> # t<sub>2</sub>)</tt>, then the object term in the membership atomic formula, <tt>t<sub>1</sub></tt>, is an action variable that is declared in the action block and the action variable binding is a <a href="#def-action-variable-declaration" title="">frame object declaration</a>. ☐
</li></ul>
<p><span class="anchor" id="def-prd-action-lang"></span>
<b>Definition (RIF-PRD action language).</b> The <i><b>RIF-PRD action language</b></i> consists of the set of all the well-formed action blocks. ☐
</p><p><span class="anchor" id="sec-operational-semantics-of-atomic-actions"></span>
</p>
<a id="Operational_semantics_of_atomic_actions" name="Operational_semantics_of_atomic_actions"></a><h3> <span class="mw-headline">3.2 Operational semantics of atomic actions </span></h3>
<p>This section specifies the semantics of the atomic actions in a RIF-PRD document.
</p><p>The effect of the ground atomic actions in the RIF-PRD action language is to modify the state of the fact base, in such a way that it changes the set of conditions that are satisfied before and after each atomic action is performed.
</p><p>As a consequence, the semantics of the ground atomic actions in the RIF-PRD action language determines a relation, called the <i>RIF-PRD transition relation</i>: →<sub><sub>RIF-PRD</sub></sub> ⊆ <i>W</i> × <i>L</i> × <i>W</i>, where <i>W</i> denotes the set of all the states of the fact base, and where <i>L</i> denotes the set of all the ground atomic actions in the RIF-PRD action language.
</p><p>The semantics of a compound action follows directly from the semantics of the atomic actions that compose it.
</p><p>Individual states of the fact base are represented by sets of ground atomic formulas (Section <a href="#sec-satisfaction-of-condition" title="">Satisfaction of a condition</a>). In the following, the operational semantics of RIF-PRD actions, rules, and rule sets is specified by describing the changes they induce in the fact base.
</p><p><span class="anchor" id="def-rif-prd-transition-relation"></span>
<b>Definition (RIF-PRD transition relation).</b> The semantics of RIF-PRD atomic actions is specified by the <b>transition relation →<sub><sub>RIF-PRD</sub></sub></b> ⊆ <i>W</i> × <i>L</i> × <i>W</i>. <i>(w, <tt>α</tt>, w') ∈ →<sub><sub>RIF-PRD</sub></sub></i> if and only if <i>w</i> ∈ <i>W</i>, <i>w' </i>∈ <i>W</i>, <tt>α</tt> is a ground atomic action, and one of the following is true:
</p>
<ol><li> <tt>α</tt> is <tt>Assert(φ)</tt>, where φ is a ground atomic formula, and <i>w' = w ∪ {φ}</i>;
</li><li> <tt>α</tt> is <tt>Retract(φ)</tt>, where φ is a ground atomic formula, and <i>w' = w \ {φ}</i>;
</li><li> <tt>α</tt> is <tt>Retract(o s)</tt>, where <tt>o</tt> and <tt>s</tt> are constants, and <i>w' = (w \ {<tt>o[s->v]</tt> | for all the values of <tt>v</tt>});</i>
</li><li> <tt>α</tt> is <tt>Retract(o)</tt>, where <tt>o</tt> is a constant, and <i>w' = w \ {<tt>o[s->v]</tt> | for all the values of terms <tt>s</tt> and <tt>v</tt>} - {<tt>o#c</tt> | for all the values of term <tt>c</tt>}</i>;
</li><li> <tt>α</tt> is <tt>Execute(φ)</tt>, where φ is a ground atomic builtin action, and <i>w' = w</i>. ☐
</li></ol>
<p>Rule 1 says that all the condition formulas that were satisfied before an assertion will be satisfied after, and that, in addition, the condition formulas that are satisfied by the asserted ground formula will be satisfied after the assertion. No other condition formula will be satisfied after the execution of the action.
</p><p>Rule 2 says that all the condition formulas that were satisfied before a retraction will be satisfied after, except if they are satisfied only by the retracted fact. No other condition formula will be satisfied after the execution of the action.
</p><p>Rule 3 says that all the condition formulas that were satisfied before the retraction of all the values of a given slot of a given object will be satisfied after, except if they are satisfied only by one of the frame formulas about the object and the slot that are the target of the action, or a conjunction of such formulas. No other condition formula will be satisfied after the execution of the action.
</p><p>Rule 4 says that all the condition formulas that were satisfied before the removal of a frame object will be satisfied after, except if they are satisfied only by one of the frame or membership formulas about the removed object or a conjunction of such formulas. No other condition formula will be satisfied after the execution of the action.
</p><p>Rule 5 says that all the condition formulas that were satisfied before the execution of an action builtin will be satisfied after. No other condition formula will be satisfied after the execution of the action.
</p><p><span class="anchor" id="ex-33"></span>
</p>
<div class="example">
<p><b>Example 3.3.</b> Assume an initial state of the fact base that is represented by the following set, <i>w<sub>0</sub></i>, of ground atomic formulas, where <tt>_c1</tt>, <tt>_v1</tt> and <tt>_s1</tt> denote individuals and where <tt>ex1:Customer</tt>, <tt>ex1:Voucher</tt> and <tt>ex1:ShoppingCart</tt> represent classes:
</p>
<div style="margin-left: 3em;">
<p>Initial state:
</p>
<ul><li> <i>w<sub>0</sub> = {<tt>_c1#ex1:Customer _v1#ex1:Voucher _s1#ex1:ShoppingCart _c1[ex1:voucher->_v1] _c1[ex1:shoppingCart->_s1] _v1[ex1:value->5] _s1[ex1:value->500]</tt>}</i>
</li></ul>
</div>
<ol><li> <tt>Assert( _c1[ex1:status->"New"] )</tt> denotes an atomic action that adds to the fact base, a fact that is represented by the ground atomic formula: <tt>_c1[ex1:status->"New"]</tt>. After the action is executed, the new state of the fact base is represented by
<ul><li> <i>w<sub>1</sub> = {<tt>_c1#ex1:Customer _v1#ex1:Voucher _s1#ex1:ShoppingCart _c1[ex1:voucher->_v1] _c1[ex1:shoppingCart->_s1] _v1[ex1:value->5] _s1[ex1:value->500] _c1[ex1:status->"New"]</tt>}</i>
</li></ul>
</li><li> <tt>Retract( _c1[ex1:voucher->_v1] )</tt> denotes an atomic action that removes from the fact base, the fact that is represented by the ground atomic formula <tt>_c1[ex1:voucher->_v1]</tt>. After the action, the new state of the fact base is represenetd by:
<ul><li> <i>w<sub>2</sub> = {<tt>_c1#ex1:Customer _v1#ex1:Voucher _s1#ex1:ShoppingCart _c1[ex1:shoppingCart->_s1] _v1[ex1:value->5] _s1[ex1:value->500] _c1[ex1:status->"New"]</tt>}</i>
</li></ul>
</li><li> <tt>Retract( _v1 )</tt> denotes an atomic action that removes the individual denoted by the constant <tt>_v1</tt> from the fact base. All the class membership and the object-attribute-value facts where <tt>_v1</tt> is the object are removed. After the action, the new state of the fact base is represenetd by:
<ul><li> <i>w<sub>3</sub> = {<tt>_c1#ex1:Customer _s1#ex1:ShoppingCart _c1[ex1:shoppingCart->_s1] _s1[ex1:value->500] _c1[ex1:status->"New"]</tt>}</i>
</li></ul>
</li><li> <tt>Retract( _s1 ex1:value )</tt> denotes an atomic action that removes all the object-attribute-value facts that assign a <tt>ex1:value</tt> to the <tt>ex1:ShoppingCart</tt> <tt>_s1</tt>. After the action, the new state of the fact base is represented by
<ul><li> <i>w<sub>4</sub> = {<tt>_c1#ex1:Customer _s1#ex1:ShoppingCart _c1[ex1:shoppingCart->_s1] _c1[ex1:status->"New"]</tt>}</i>
</li></ul>
</li><li> <tt>Assert( _s1[ex1:value->450] ) adds in the fact base_the single fact that is represented by the ground frame: <tt>_s1[ex1:value->450]</tt>. After the action, the new state of the fact base is represented by:
<ul><li> <i>w<sub>5</sub> = {<tt>_c1#ex1:Customer _s1#ex1:ShoppingCart _c1[ex1:shoppingCart->_s1] _s1[ex1:value->450] _c1[ex1:status->"New"]</tt>}</i>
</li></ul>
</li><li> <tt>Execute( <a href="#sec-act-print" title="">act:print</a>(func:concat("New customer: " _c1)) )</tt> denotes an action that does not impact the state of the fact base, but that prints a string to an output stream. After the action, the new state of the fact base is represented by:
<ul><li> <i>w<sub>6</sub> = w<sub>5</sub> = {<tt>_c1#ex1:Customer _s1#ex1:ShoppingCart _c1[ex1:shoppingCart->_s1] _s1[ex1:value->450] _c1[ex1:status->"New"]</tt>}</i>
</li></ul>
</li></ol>
<p>Notice that steps 4 and 5 can be equivalently replaced by the single compound action:
</p>
<ul><li> <tt>Modify( _s1[ex1:value->450] )</tt>, which denotes an action that replaces all the object-attribute-value facts that assign a <tt>ex1:value</tt> to the <tt>ex1:ShoppingCart</tt> <tt>_s1</tt> by the single fact that is represented by the ground frame: <tt>_s1[ex1:value->450]</tt>.
</li></ul>
<p> ☐
</p>
</div>
<p><span class="anchor" id="sec-production-rules-and-rulesets"></span>
</p>
<a id="Production_rules_and_rule_sets" name="Production_rules_and_rule_sets"></a><h2> <span class="mw-headline">4 Production rules and rule sets </span></h2>
<p>This section specifies the syntax and semantics of RIF-PRD rules and rule sets.
</p><p><span class="anchor" id="sec-rules-abstract-syntax"></span>
</p>
<a id="Abstract_syntax_3" name="Abstract_syntax_3"></a><h3> <span class="mw-headline">4.1 Abstract syntax </span></h3>
<p>The alphabet of the RIF-PRD rule language includes the alphabets of the <a href="#sec-conditions-abstract-syntax" title="">RIF-PRD condition language</a> and the <a href="#sec-actions-abstract-syntax" title="">RIF-PRD action language</a> and adds symbols for:
</p>
<ul><li> combining a condition and an action block into a rule,
</li><li> declaring (some) variables that are free in a rule <i>R</i>, specifying their bindings, and combining them with <i>R</i> into a new rule <i>R'</i> (with fewer free variables),
</li><li> grouping rules and associating specific operational semantics to groups of rules.
</li></ul>
<p><span class="anchor" id="sec-rules"></span>
</p>
<a id="Rules" name="Rules"></a><h4> <span class="mw-headline">4.1.1 Rules </span></h4>
<p><span class="anchor" id="def-rule"></span>
<b>Definition (Rule).</b> A <i><b>rule</b></i> can be one of:
</p>
<ul><li> an <i>unconditional action block</i>,
</li><li> a <i>conditional action block</i>: if <tt>condition</tt> is a formula in the RIF-PRD condition language, and if <tt>action</tt> is a well-formed action block, then <tt>If condition, Then action</tt> is a rule,
</li><li> a <i>rule with variable declaration</i>: if <tt>?v<sub>1</sub> ... ?v<sub>n</sub></tt>, <i>n ≥ 1</i>, are variables; <tt>p<sub>1</sub> ... p<sub>m</sub></tt>, <i>m ≥ 1</i>, are condition formulas (called <i>patterns</i>), and <tt>rule</tt> is a rule, then <tt>Forall ?v<sub>1</sub>...?v<sub>n</sub> such that (p<sub>1</sub>...p<sub>m</sub>) (rule)</tt> is a rule. ☐
</li></ul>
<p><br />
<span class="anchor" id="ex-41"></span>
</p>
<div class="example">
<p><b>Example 4.1.</b> The <i>Gold rule</i>, from the <a href="#sec-running-example" title="">running example</a>: <i>A "Silver" customer with a shopping cart worth at least $2,000 is awarded the "Gold" status</i>, can be represented using the following rule with variable declaration:
</p>
<pre>Forall ?customer such that And( ?customer # ex1:Customer
?customer[ex1:status->"Silver"] )
(Forall ?shoppingCart such that And( ?shoppingCart # ex1:ShoppingCart
?customer[ex1:shoppingCart->?shoppingCart] )
(If Exists ?value (And( ?shoppingCart[ex1:value->?value]
pred:numeric-greater-than-or-equal(?value 2000))
Then Do( Modify( ?customer[ex1:status->"Gold"] ) ) )
</pre>
<p>☐
</p>
</div>
<p>The function <i>Var(f)</i>, that has been <a href="#def-free_var_base" title="">defined for condition formulas</a> and <a href="#def-free_var_action" title="">extended to actions</a>, is further extended to rules, as follows:
</p>
<ul>
<li> if <i>f</i> is an action block that declares action variables <tt>?v<sub>1</sub> ... ?v<sub>n</sub></tt>, <i>n ≥ 0</i>, and that contains actions <tt>a<sub>1</sub> ... a<sub>m</sub></tt>, <i>m ≥ 1</i>, then <i>Var(f) = <big>∪</big><sub>1 ≤ i ≤ m</sub> Var(<tt>a<sub>i</sub></tt>) \ {<tt>?v<sub>1</sub> ... ?v<sub>n</sub></tt>}</i>;</li>
<li> if <i>f</i> is a conditional action block where <tt>c</tt> is the condition formula and <tt>a</tt> is the action block, then <i>Var(f) = Var(c) ∪ Var(a)</i>;</li>
<li> if <i>f</i> is a quantified rule where <tt>?v<sub>1</sub> ... ?v<sub>n</sub></tt>, <i>n > 0</i>, are the declared variables; <tt>p<sub>1</sub> ... p<sub>m</sub></tt>, <i>m ≥ 0</i>, are the patterns, and <tt>r</tt> is the rule, then <i>Var(f) = (Var(<tt>r</tt>) ∪ Var(<tt>p<sub>1</sub></tt>) ∪ ... ∪ Var(<tt>p<sub>m</sub></tt>)) \ {<tt>?v<sub>1</sub> ... ?v<sub>n</sub></tt>}</i>.</li>
</ul>
<p><span class="anchor" id="sec-groups"></span>
</p>
<a id="Groups" name="Groups"></a><h4> <span class="mw-headline">4.1.2 Groups </span></h4>
<p>As was already mentioned in the <a href="#sec-overview" title="">Overview</a>, production rules have an operational semantics that can be described in terms of matching rules against states of the fact base, selecting rule instances to be executed, and executing rule instances' actions to transition to new states of the fact base.
</p><p>When production rules are interchanged, the intended rule instance selection strategy, often called the <i>conflict resolution strategy</i>, needs to be interchanged along with the rules. In RIF-PRD, the <i>group</i> construct is used to group sets of rules and to associate them with a conflict resolution strategy. Many production rule systems use priorities associated with rules as part of their conflict resolution strategy. In RIF-PRD, the group is also used to carry the priority information that may be associated with the interchanged rules.
</p><p><span class="anchor" id="def-group"></span>
<b>Definition (Group).</b> A <i><b>group</b></i> consists of a, possibly empty, set of rules and groups, associated with a resolution conflict strategy and, a priority. If <tt>strategy</tt> is an IRI that identifies a conflict resolution strategy, if <tt>priority</tt> is an integer, and if each <tt>rg<sub>j</sub></tt>, <i>0 ≤ j ≤ n</i>, is either a rule or a group, then any of the following represents a group:
</p>
<ul><li> <tt>Group (rg<sub>0</sub> ... rg<sub>n</sub>)</tt>, <i>n ≥ 0</i>;
</li><li> <tt>Group strategy (rg<sub>0</sub> ... rg<sub>n</sub>)</tt>, <i>n ≥ 0</i>;
</li><li> <tt>Group priority (rg<sub>0</sub> ... rg<sub>n</sub>)</tt>, <i>n ≥ 0</i>;
</li><li> <tt>Group strategy priority (rg<sub>0</sub> ... rg<sub>n</sub>)</tt>, <i>n ≥ 0</i>.
</li></ul>
<p>If a conflict resolution strategy is not explicitly attached to a group, the strategy defaults to <tt>rif:forwardChaining</tt> (specified below, in <a href="#sec-conflict-resolution" title="">section Conflict resolution</a>). ☐
</p><p><span class="anchor" id="sec-safeness"></span>
</p>
<a id="Safeness" name="Safeness"></a><h4> <span class="mw-headline">4.1.3 Safeness </span></h4>
<p>The definitions in this section are unchanged from the definitions in the section Safeness in [<a href="#ref-core" title="">RIF-Core</a>], except for the definition of <i><a href="#def-safe-rule" title="">RIF-PRD rule safeness</a></i>, that is extended from the definition of <i>RIF-Core rule safeness</i>. The definitions are reproduced for the reader's convenience.
</p><p>Intuitively, safeness of rules guarantees that all the variables in a rule can be bound, using pattern matching only, before they are used, in a test or in an action.
</p><p>To define safeness, we need to define, first, the notion of <i>binding patterns</i> for externally defined functions and predicates, as well as under what conditions variables are considered <i>bound</i>.
</p><p><b>Definition (Binding pattern).</b> (from [<a href="#ref-core" title="">RIF-Core</a>]) <i><b>Binding patterns</b></i> for externally defined functions and predicates are lists of the form (<tt>p<sub>1</sub></tt>, <tt>...</tt>, <tt>p<sub>n</sub></tt>), such that <tt>p<sub>i</sub></tt>=<tt>b</tt> or <tt>p<sub>i</sub></tt>=<tt>u</tt>, for <tt>1 ≤ i ≤ n</tt>: <tt>b</tt> stands for a "bound" and <tt>u</tt> stands for an "unbound" argument. ☐
</p><p>Each external function or predicate has an associated list of <i><b>valid binding patterns</b></i>. We define here the binding patterns valid for the functions and predicates defined in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>].
</p><p>Every function or predicate <tt>f</tt> defined in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>] has a valid binding pattern for each of its schemas with only the symbol <tt>b</tt> such that its length is the number of arguments in the schema. In addition,
</p>
<ul><li> the external predicate <tt>pred:iri-string</tt> has the valid binding patterns (<tt>b</tt>, <tt>u</tt>) and (<tt>u</tt>, <tt>b</tt>) and
</li><li> the external predicate <tt>pred:list-contains</tt> has the valid binding pattern (<tt>b</tt>, <tt>u</tt>).
</li></ul>
<p>The functions and predicates defined in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>] have no other valid binding patterns.
</p><p>To keep the definitions concise and intuitive, boundedness and safeness are defined, in [<a href="#ref-core" title="">RIF-Core</a>], for condition formulas in disjunctive normal form, that can be existentially quantified themselves, but that contain, otherwise, no existential sub-formula. The definitions apply to any valid RIF-Core condition formula, because they can always, in principle, be put in that form, by applying the following syntactic transforms, in sequence:
</p>
<ol><li> if <i>f</i> contains existential sub-formulas, all the quantified variables are renamed, if necessary, and given a name that is unique in <i>f</i>, and the scope of the quantifiers is extended to <i>f</i>. Assume, for instance, that <i>f</i> has an existential sub-formula, <i>sf = <tt>Exists v<sub>1</sub>...v<sub>n</sub> (sf')</tt>, n ≥ 1</i>, such that the names <i><tt>v<sub>1</sub>...v<sub>n</sub></tt></i> do not occur in <i>f</i> outside of <i>sf</i>. After the transform, <i>f</i> becomes <i><tt>Exists v<sub>1</sub>...v<sub>n</sub> (f')</tt></i>, where <i>f' </i> is <i>f</i> with <i>sf</i> replaced by <i>sf' </i>. The transform is applied iteratively to all the existential sub-formulas in <i>f</i>;
</li><li> the (possibly existentially quantified) resulting formula is rewritten in disjunctive normal form ([<a href="#ref-mendelson97" title="">Mendelson97</a>], p. 30).
</li></ol>
<p>In RIF-PRD, the definitions apply to conditions formulas in the same form as in [<a href="#ref-core" title="">RIF-Core</a>], with the exception that, in the disjunctive normal form, negated sub-formulas can be atomic formulas or existential formulas: in the latter case, the existentially quantified formula must be, itself, in disjunctive normal form, and contain no further existential sub-formulas. The definitions apply to any valid RIF-PRD condition formula, because they can always, in principle, be put in that form, by applying the above syntactic transform, modified as follows to take negation into account:
</p>
<ul><li> if the condition formula under consideration, <i>f</i>, contains negative sub-formulas, existential formulas that occur inside a negated formula are handled as if they were atomic formulas, with respect to the two processing steps. Extending the scope of an existential quantifier beyond a negation would require its transformation into an universal quantifier, and universal formulas are not part of RIF-PRD condition language;
</li><li> in addition, the two pre-processing steps are applied, separately, to these existentially quantified formulas, to be able to determine the status of the existentially quantified variables with respect to boundedness.
</li></ul>
<p><b>Definition (Boundedness).</b> (from [<a href="#ref-core" title="">RIF-Core</a>]) An external term <tt>External(f(t<sub>1</sub>,...,t<sub>n</sub>))</tt> is <i><b>bound</b></i> in a condition formula, if and only if <tt>f</tt> has a valid binding pattern (<tt>p<sub>1</sub></tt>, <tt>...</tt>, <tt>p<sub>n</sub></tt>) and, for all <i>j, 1 ≤ j ≤ n</i>, such that <tt>p<sub>j</sub></tt>=<tt>b</tt>, <tt>t<sub>j</sub></tt> is bound in the formula.
</p><p>A variable, <i>v</i>, is <i><b>bound</b></i> in an atomic formula, <i>a</i>, if and only if
</p>
<ul><li> <i>a</i> is neither an equality nor an external predicate, and <i>v</i> occurs as an argument in <i>a</i>;
</li><li> or <i>v</i> is bound in the conjunctive formula <i>f = <tt>And(a)</tt></i>.
</li></ul>
<p>A variable, <i>v</i>, is <i><b>bound</b></i> in a conjunction formula, <i>f = <tt>And(c<sub>1</sub>...c<sub>n</sub>)</tt>, n ≥ 1</i>, if and only if, either
</p>
<ul><li> <i>v</i> is bound in at least one of the conjuncts;
</li><li> or <i>v</i> occurs as the <i>j-th</i> argument in a conjunct, <i><tt>c<sub>i</sub></tt></i>, that is an externally defined predicate, and the <i>j-th</i> position in a binding pattern that is associated with <i><tt>c<sub>i</sub></tt></i> is <tt>u</tt>, and all the arguments that occur, in <i><tt>c<sub>i</sub></tt></i>, in positions with value <i><tt>b</tt></i> in the same binding pattern are bound in <i>f' = <tt>And(c<sub>1</sub>...c<sub>i-1</sub> c<sub>i+1</sub>...c<sub>n</sub>)</tt></i>;
</li><li> or <i>v</i> occurs in a conjunct, <i><tt>c<sub>i</sub></tt></i>, that is an equality formula, and <i>v</i> occurs as the term on one side of the equality, and the term on the other side of the equality is bound in <i>f' = <tt>And(c<sub>1</sub>...c<sub>i-1</sub> c<sub>i+1</sub>...c<sub>n</sub>)</tt></i>.
</li></ul>
<p>A variable, <i>v</i>, is <i><b>bound</b></i> in a disjunction formula, if and only if <i>v</i> is bound in every disjunct where it occurs;
</p><p>A variable, <i>v</i>, is <i><b>bound</b></i> in an existential formula, <tt>Exists v<sub>1</sub>,...,v<sub>n</sub> (f')</tt>, <i>n ≥ 1</i>, if and only if <i>v</i> is bound in <i><tt>f'</tt></i>. ☐
</p><p>Notice that the variables, <tt>v<sub>1</sub>,...,v<sub>n</sub></tt>, that are existentially quantified in an existential formula <i>f = <tt>Exists v<sub>1</sub>,...,v<sub>n</sub> (f')</tt></i>, are bound in any formula, <i>F</i>, that contains <i>f</i> as a sub-formula, if and only if they are bound in <i>f</i>, since they do not exist outside of <i>f</i>.
</p><p><b>Definition (Variable safeness).</b> (from [<a href="#ref-core" title="">RIF-Core</a>]) A variable, <i>v</i>, is <i><b>safe</b></i> in a condition formula, <i>f</i>, if and only if
</p>
<ul><li> <i>f</i> is an atomic formula and <i>f</i> is not an equality formula in which both terms are variables and <i>v</i> occurs in <i>f</i>;
</li><li> or <i>f</i> is a conjunction, , <i>f = <tt>And(c<sub>1</sub>...c<sub>n</sub>)</tt>, n ≥ 1</i>, and <i>v</i> is safe in at least one conjunct in <i>f</i>, or <i>v</i> occurs in a conjunct, <i><tt>c<sub>i</sub></tt></i>, that is an equality formula in which both terms are variables, and <i>v</i> occurs as the term on one side of the equality, and the variable on the other side of the equality is safe in <i>f' = <tt>And(c<sub>1</sub>...c<sub>i-1</sub> c<sub>i+1</sub>...c<sub>n</sub>)</tt></i>;
</li><li> or <i>f</i> is a disjunction, and <i>v</i> is safe in every disjunct;
</li><li> or <i>f</i> is an existential formula, <i>f = <tt>Exists v<sub>1</sub>,...,v<sub>n</sub> (f')</tt>, n ≥ 1</i>, and <i>v</i> is safe in <i>f' </i>. ☐
</li></ul>
<p>Notice that the two definitions, above, are not extended for negation and, followingly, that an universally quantified (rule) variable is never bound or safe in a condition formula as a consequence of occurring in a negative formula.
</p><p>The definition of <i>rule safeness</i> is replaced by the following one, that extends the one for RIF-Core rules.
</p><p><span class="anchor" id="def-safe-rule"></span>
<b>Definition (RIF-PRD rule safeness).</b> A RIF-PRD rule, <i>r</i>, is <i><b>safe</b></i> if and only if
</p>
<ul><li> <i>r</i> is an unconditional action block, and <i>Var(r) = ∅</i>;
</li><li> or <i>r</i> is a conditional action block, <tt>If C Then A</tt>, and all the variables in <i>Var(A)</i> are safe in <i>C</i>, and all the variables in <i>Var(r)</i> are bound in <i>C</i>;
</li><li> or <i>r</i> is a rule with variable declaration, <tt>∀ v<sub>1</sub>...v<sub>n</sub> such that p<sub>1</sub>...p<sub>m</sub> (r')</tt>, <i>n ≥ 1, m ≥ 0</i>, and either
<ul><li> <i>r' </i> is an unconditional action block, <tt>A</tt>, and the conditional action block <tt>If And(p<sub>1</sub>...p<sub>m</sub>) Then A</tt> is safe;
</li><li> or <i>r' </i> is a conditional action block, <tt>If C Then A</tt>, and the conditional action block <tt>If And(C p<sub>1</sub>...p<sub>m</sub>) Then A</tt> is safe;
</li><li> or <i>r' </i> is a rule with variable declaration, <tt>∀ v'<sub>1</sub>...v'<sub>n'</sub> such that p'<sub>1</sub>...p'<sub>m'</sub> (r")</tt>, <i>n' ≥ 1, m' ≥ 0</i>, and the rule with variable declaration <tt>∀ v<sub>1</sub>...v<sub>n</sub> v'<sub>1</sub>...v'<sub>n'</sub> such that p<sub>1</sub>...p<sub>m</sub> p'<sub>1</sub>...p'<sub>m'</sub> (r")</tt>, is safe. ☐
</li></ul>
</li></ul>
<p><span class="anchor" id="def-safe-group"></span>
<b>Definition (Group safeness).</b> (from [<a href="#ref-core" title="">RIF-Core</a>]) A group, <tt>Group (s<sub>1</sub>...s<sub>n</sub>)</tt>, <i>n ≥ 0</i>, is <i><b>safe</b></i> if and only if
</p>
<ul><li> it is empty, that is, <i>n = 0</i>;
</li><li> or <i>s<sub>1</sub></i> and ... and <i>s<sub>n</sub></i> are safe. ☐
</li></ul>
<p><span class="anchor" id="sec-well-formed-rules-and-groups"></span>
</p>
<a id="Well-formed_rules_and_groups" name="Well-formed_rules_and_groups"></a><h4> <span class="mw-headline">4.1.4 Well-formed rules and groups </span></h4>
<p>If <i>f</i> is a rule, <i>Var(f)</i> is the set of the free variables in <i>f</i>.
</p><p><span class="anchor" id="def-wf-rule"></span>
<b>Definition (Well-formed rule).</b> A rule, <tt>r</tt>, is a <i><b>well-formed rule</b></i> if and only if either
</p>
<ul><li> <tt>r</tt> is an unconditional <a href="#def-wf-action-block" title="">well-formed action block</a>, <tt>a</tt>,
</li><li> or <tt>r</tt> is a conditional action block where the condition formula, <tt>c</tt>, is a <a href="#def-bld-wff" title="">well-formed condition formula</a>, and the action block, <tt>a</tt>, is a <a href="#def-wf-action-block" title="">well-formed action block</a>,
</li><li> or <tt>r</tt> is a quantified rule (with or without patterns), <tt>Forall V [such that P](r')</tt>, and
<ul><li> each of the patterns, <tt>p<sub>i</sub></tt> ∈ <tt>P = {p<sub>1</sub>,...,p<sub>n</sub>}</tt>, <i>n ≥ 0</i>, is a <a href="#def-bld-wff" title="">well-formed condition formula</a>,
</li><li> and the quantified rule, <tt>r'</tt>, is a well-formed rule. ☐
</li></ul>
</li></ul>
<p><span class="anchor" id="def-wf-group"></span>
<b>Definition (Well-formed group).</b> A group is <i><b>well-formed group</b></i> if and only if it is <a href="#def-safe-group" title="">safe</a> and it contains only well-formed groups, <i>g<sub>1</sub>...g<sub>n</sub>, n ≥ 0</i>, and well-formed rules, <i>r<sub>1</sub>...r<sub>m</sub>, m ≥ 0</i>, such that <i>Var(r<sub>i</sub>) = ∅</i> for all <i>i, 0 ≤ i ≤ m</i>. ☐
</p><p>The set of the well-formed groups contains all the production rule sets that can be meaningfully interchanged using RIF-PRD.
</p><p><span class="anchor" id="sec-operational-semantics-of-rules-and-rule-sets"></span>
</p>
<a id="Operational_semantics_of_rules_and_rule_sets" name="Operational_semantics_of_rules_and_rule_sets"></a><h3> <span class="mw-headline">4.2 Operational semantics of rules and rule sets </span></h3>
<a id="Motivation_and_example" name="Motivation_and_example"></a><h4> <span class="mw-headline">4.2.1 Motivation and example </span></h4>
<p>As mentioned in the <a href="#sec-overview" title="">Overview</a>, the description of a production rule system as a transition system is used to specify the semantics of production rules and rule sets interchanged using RIF-PRD.
</p><p>The intuition of describing a production rule system as a transition system is that, given a set of production rules <i>RS</i> and a fact base <i>w<sub>0</sub></i>, the rules in <i>RS</i> that are satisfied, in some sense, in <i>w<sub>0</sub></i> determine an action <i>a<sub>1</sub></i>, whose execution results in a new fact base <i>w<sub>1</sub></i>; the rules in <i>RS</i> that are satisfied in <i>w<sub>1</sub></i> determine an action <i>a<sub>2</sub></i> to execute in <i>w<sub>1</sub></i>, and so on, until the system reaches a final state and stops. The result is the fact base <i>w<sub>n</sub></i> when the system stops.
</p><p><span class="anchor" id="ref-ex42"></span>
</p>
<div class="example">
<p><b>Example 4.2.</b> The Rif Shop, Inc. is a rif-raf retail chain, with brick and mortar shops all over the world and virtual storefronts in many on-line shops. The Rif Shop, Inc. maintains its customer fidelity management policies in the form of production rule sets. The customer management department uses RIF-PRD to publish rule sets to all the shops and licensees so that everyone uses the latest version of the rules, even though several different rule engines are in use (in fact, some of the smallest shops actually run the rules by hand).
</p><p>Here is a small rule set that governs discounts and customer status updates at checkout time (to keep the example short, this is a subset of the rules described in the <a href="#sec-running-example" title="">running example</a>):
</p>
<pre>(* ex1:CheckoutRuleset *)
Group rif:forwardChaining (
(* ex1:GoldRule *)
Group 10 (
Forall ?customer such that (And( ?customer # ex1:Customer
?customer[ex1:status->"Silver"] ) )
(Forall ?shoppingCart such that (?customer[ex1:shoppingCart->?shoppingCart])
(If Exists ?value (And( ?shoppingCart[ex1:value->?value]
pred:numeric-greater-than-or-equal(?value 2000))
Then Do( Modify( ?customer[ex1:status->"Gold"] ) ) ) )
(* ex1:DiscountRule *)
Group (
Forall ?customer such that (And( ?customer # ex1:Customer ) )
(If Or (?customer[ex1:status->"Silver"]
?customer[ex1:status->"Gold"] )
Then Do( (?s ?customer[ex1:shoppingCart->?s])
(?v ?s[ex1:value->?v])
Modify( ?s[ex1:value->func:numeric-multiply(?v 0.95)] ) ) ) )
</pre>
<p>To see how the rule set works, consider the case of a shop where the checkout processing of customer John is about to start. The initial state of the fact base can be represented as follows:
</p><p><i>w<sub>0</sub> = {<tt>_john#ex1:Customer _john[ex1:status->"Silver"] _s1#ex1:ShoppingCart _john[ex1:shoppingCart->_s1] _s1[ex1:value->2000]</tt>}</i>
</p><p>When instantiated against <i>w<sub>0</sub></i>, the first pattern in the "Gold rule", <tt>And( ?customer#ex1:Customer ?customer[ex1:status->"Silver"] )</tt>, yields the single matching substitution: <i>{(_john/?customer)}</i>. The second pattern in the same rule also yields a single matching substitution: <i>{(_john/?customer)(_s1/?shoppingCart)}</i>, for which the existential condition is satisfied.
</p><p>Likewise, the instantiation of the "Discount rule" yields a single matching substitution that satisfies the condition: <i>{(_john/?customer)}</i>. The conflict set is:<br />{ex1:GoldRule/{(_john/?customer)(_s1/?shoppingCart)}, ex1:DiscountRule/{(_john/?customer)}}
</p><p>The instance <i>ex1:GoldRule/{(_john/?customer)(_s1/?shoppingCart)}</i> is selected because of its higher priority. The ground compound action: <tt>Modify(_john[ex1:status->"Gold"])</tt>, is executed, resulting in a new state of the fact base, represented as follows:
</p><p><i>w<sub>1</sub> = {<tt>_john#ex1:Customer _john[ex1:status->"Gold"] _s1#ex1:ShoppingCart _john[ex1:shoppingCart->_s1] _s1[ex1:value->2000]</tt>}</i>
</p><p>In the next cycle, there is no substitution for the rule variable <tt>?customer</tt> that matches the pattern to the state of the fact base, and the only matching rule instance is: ex1:DiscountRule/{(_john/?customer)}, which is selected for execution. The action variables <tt>?s</tt> and <tt>?v</tt> are bound, based on the state of the fact base, to <tt>_s1</tt> and <tt>200</tt>, respectively, and the ground compound action, <tt>Modify(_s1[ex1:value->1900])</tt>, is executed, resulting in a new state of the fact base:
</p><p><i>w<sub>2</sub> = {<tt>_john#ex1:Customer _john[ex1:status->"Gold"] _s1#ex1:ShoppingCart _john[ex1:shoppingCart->_s1] _s1[ex1:value->1900]</tt>}</i>
</p><p>In <i>w<sub>2</sub></i>, the only matching rule instance is, again: ex1:DiscountRule/{(_john/?customer)}. However, that same instance has already been selected and the corresponding action has been executed. Nothing has changed in the state of the fact base that would justify that the rule instance be selected gain. The principle of refraction applies, and the rule instance is removed from consideration.
</p><p>This leaves the conflict set empty, and the system, having detected a final state, stops.
</p><p>The result of the execution of the system is <i>w<sub>2</sub></i>. ☐
</p>
</div>
<p><span class="anchor" id="sec-rules-normalization"></span>
</p>
<a id="Rules_normalization" name="Rules_normalization"></a><h4> <span class="mw-headline">4.2.2 Rules normalization </span></h4>
<p>A rule, <i>R</i>, whose condition, rewritten in disjunctive normal form as described in <a href="#sec-safeness" title="">section Safeness</a>, consists of more than one disjunct, is equivalent, logically as well as operationally, to a set (or conjunction) of rules that have, all, the same conclusion as <i>R</i>, and each rule has one of the disjuncts as its condition: the rule <i>R: If C<sub>1</sub> Or ... Or C<sub>n</sub> Then A</i> is equivalent to the set of rules <i>{r<sub>i=0..n</sub>| r<sub>i</sub>: If C<sub>i</sub> Then A}</i>.
</p><p>Without loss of generality, and to keep the specification as simple and intuitive as possible, the operational semantics of production rules and rule sets is specified, in the following sections, for rules and rule sets that have been normalized as follows:
</p>
<ol><li> All the rules are rewritten in disjunctive normal form as described in <a href="#sec-safeness" title="">section Safeness</a>;
</li><li> Each rule is replaced by a <a href="#def-group" title="">group</a> of rules
<ul><li> with the same priority as the rule it replaces,
</li><li> that contains as many rules as the condition of the original rule in disjunctive normal form contains disjuncts,
</li><li> where the condition, in each rule in the group is one of the disjunct in the condition of the original rule,
</li><li> and where all the rules in the group have a different condition and the same action part as the original rule.
</li></ul>
</li></ol>
<p>In the same way, without loss of generality, and to keep the specification as simple and intuitive as possible, the operational semantics of production rules and rule sets is specified, in the following sections, for rules and rule sets where all the <a href="#def-compound-action" title="">compound actions</a> have been replaced by the equivalent sequences of <a href="#def-atomic-action" title="">atomic actions</a>.
</p><p><span class="anchor" id="sec-definitions-and-notational-conventions"></span>
</p>
<a id="Definitions_and_notational_conventions" name="Definitions_and_notational_conventions"></a><h4> <span class="mw-headline">4.2.3 Definitions and notational conventions </span></h4>
<p>Formally, a production rule system is defined as a labeled terminal transition system (e.g. <a href="#ref-ltts" title="">PLO04</a>), for the purpose of specifying the semantics of a RIF-PRD <a href="#def-rule" title="">rule</a> or <a href="#def-group" title="">group of rules</a>.
</p><p><span class="anchor" id="def-ltts"></span>
<b>Definition (labeled terminal transition system):</b> A labeled terminal transition system is a structure {<b>C</b>, <b>L</b>, →, <b>T</b>}, where
</p>
<ul><li> <b>C</b> is a set of elements, <i>c</i>, called configurations, or states;
</li><li> <b>L</b> is a set of elements, <i>a</i>, called labels, or actions;
</li><li> → ⊆ C × L × C is the transition relation, that is: (<i>c, a, c' </i>) ∈ → iff there is a transition labeled <i>a</i> from the state <i>c</i> to the state <i>c' </i>. In the case of a production rule system: in the state <i>c</i> of the fact base, the execution of action <i>a</i> causes a transition to state the <i>c' </i> of the fact base;
</li><li> <b>T</b> ⊆ C is the set of final states, that is, the set of all the states <i>c</i> from which there are no transitions: T = {<i>c</i> ∈ C | ∀ <i>a</i> ∈ L, ∀ <i>c' </i> ∈ C, (<i>c, a, c'</i>) ∉ →}. ☐
</li></ul>
<p>For many purposes, a representation of the states of the fact base is an appropriate representation of the states of a production rule system seen as a transition system. However, the most widely used conflict resolution strategies require information about the history of the system, in particular with respect to the rule instances that have been selected for execution in previous states. Therefore, each state of the transition system used to represent a production rule system must keep a memory of the previous states and of the rule instances that where selected and that triggered the transition in those states.
</p><p>Here, a <i>rule instance</i> is defined as the result of the substitution of constants for all the rule variables in a rule.
</p><p>Let <i>R</i> denote the set of all the rules in the rule language under consideration.
</p><p><span class="anchor" id="def-rule-instance"></span>
<b>Definition (Rule instance).</b> Given a rule, <i>r ∈ R</i>, and a <a href="#def-ground-subst" title="">ground substitution</a>, σ, such that <i>CVar(r) ⊆ Dom(σ)</i>, where <i>CVar(r)</i> denotes the set of the rule variables in <i>r</i>, the result, <i>ri = σ(r)</i>, of the substitution of the constant <i>σ(<tt>?x</tt>)</i> for each variable <tt>?x</tt> <i>∈ CVar(r)</i> is a <i><b>rule instance</b></i> (or, simply, an <i><b>instance</b></i>) of <i>r</i>. ☐
</p><p>Given a rule instance <i>ri</i>, let <i>rule(ri)</i> identify the rule from which <i>ri</i> is derived by substitution of constants for the rule variables, and let <i>substitution(ri)</i> denote the substitution by which <i>ri</i> is derived from <i>rule(ri)</i>.
</p><p>In the following, two rule instances <i>ri<sub>1</sub></i> and <i>ri<sub>2</sub></i> of a same rule <i>r</i> will be considered <i>different</i> if and only if <i>substitution(ri<sub>1</sub>)</i> and <i>substitution(ri<sub>2</sub>)</i> substitute a different constant for at least one of the rule variables in <i>CVar(r)</i>.
</p><p>A rule instance, <i>ri</i>, is said to match a state of a fact base, <i>w</i>, if its defining substitution, <i>substitution(ri)</i>, matches the RIF-PRD condition formula that represents the condition of the instantiated rule, <i>rule(ri)</i>, to the set of ground atomic formulas that represents the state of facts <i>w</i>.
</p><p>Let <i>W</i> denote the set of all the possible states of a fact base.
</p><p><span class="anchor" id="def-matching-rule-instance"></span>
<b>Definition (Matching rule instance).</b> Given a rule instance, <i>ri</i>, and a state of the fact base, <i>w ∈ W</i>, <i>ri</i> is said to <i><b>match</b></i> <i>w</i> if and only if one of the following is true:
</p>
<ul><li> <i>rule(ri)</i> is an <a href="#def-rule" title="">unconditional action block</a>;
</li><li> <i>rule(ri)</i> is a <a href="#def-rule" title="">conditional action block</a>: <tt>If condition, Then action</tt>, and <i>substitution(ri)</i> <a href="#def-matching-substitution" title="">matches</a> the condition formula <tt>condition</tt> to the set of ground atomic condition formulas that represents <i>w</i>;
</li><li> <i>rule(ri)</i> is a <a href="#def-rule" title="">rule with variable declaration</a>: <tt>Forall ?v<sub>1</sub>...?v<sub>n</sub> (p<sub>1</sub>...p<sub>m</sub>) (r')</tt>, <i>n ≥ 0</i>, <i>m ≥ 0</i>, and <i>substitution(ri)</i> <a href="#def-matching-substitution" title="">matches</a> each of the condition formulas <tt>p<sub>i</sub></tt>, <i>0 ≤ i ≤ m</i>, to the set of ground atomic condition formulas that represents <i>w</i>, and the rule instance <i>ri' </i> matches <i>w</i>, where <i>rule(ri')</i> = <tt>r'</tt> and <i>substitution(ri') = substitution(ri)</i>. ☐
</li></ul>
<p><span class="anchor" id="def-action-instance"></span>
<b>Definition (Action instance).</b> Given a state of the fact base, <i>w ∈ W</i>, given a rule instance, <i>ri</i>, of a rule in a rule set, <i>RS</i>, and given the action block in the action part of the rule <i>rule(ri)</i>: <tt>Do((v<sub>1</sub> p<sub>1</sub>)...(v<sub>n</sub> p<sub>n</sub>) a<sub>1</sub>...a<sub>m</sub>)</tt>, <i>n ≥ 0</i>, <i>m ≥ 1</i>, where the <tt>(v<sub>1</sub> p<sub>1</sub>)</tt>, <i>0 ≤ i ≤ n</i>, represent the <a href="#def-action-variable-declaration" title="">action variable declarations</a> and the <tt>a<sub>j</sub></tt>, <i>1 ≤ j ≤ m</i>, represent the sequence of atomic actions in the action block; if <i>ri</i> matches <i>w</i>, the substitution <i>σ = substitution(ri)</i> is extended to the action variables <i>v<sub>1</sub>...v<sub>n</sub>, n ≥ 0</i>, in the following way:
</p>
<ul><li> if the binding, <tt>p<sub>i</sub></tt>, associated to <i>v<sub>i</sub></i>, in the action variable declaration, is the declaration of a new frame object: <tt>(</tt><i>v<sub>i</sub></i> <tt>New())</tt>, then <i>σ(v<sub>i</sub>) = c<sub>new</sub></i>, where <i>c<sub>new</sub></i> is a constant of type <tt>rif:IRI</tt> that does not occur in any of the ground atomic formulas in <i>w</i>;
</li><li> if <i>v<sub>i</sub></i> is assigned the value of a frame's slot by the action variable declaration: <tt>(</tt><i>v<sub>i</sub></i> <tt>o[s-></tt><i>v<sub>i</sub></i><tt>])</tt>, then <i>σ(v<sub>i</sub>)</i> is a constant such that the subtitution σ <a href="#def-matching-substitution" title="">matches</a> the frame formula <tt>o[s-></tt><i>v<sub>i</sub></i><tt>]</tt> to <i>w</i>.
</li></ul>
<p>The sequence of ground atomic actions that is the result of substituting a constant for each variable in the atomic actions of the action block
of the rule instance, <i>ri</i>, according to the extended substitution, is the <i><b>action instance</b></i> associated to <i>ri</i>. ☐
</p><p>Let <i>actions(ri)</i> denote the action instance that is associated to a rule instance <i>ri</i>. By extension, given an ordered set of rule instances, <i>ori</i>, <i>actions(ori)</i> denotes the sequence of ground atomic actions that is the concatenation, preserving the order in <i>ori</i>, of the action instances associated to the rule instances in <i>ori</i>.
</p><p>The components of the states of a production rule system seen as a transition system can now be defined more precisely. To avoid confusion between the states of the fact base and the states of the transition system, the latter will be called <i>production rule system states</i>.
</p><p><span class="anchor" id="def-system-state"></span>
<b>Definition (Production rule system state).</b> A <i><b>production rule system state</b></i> (or, simply, a <i><b>system state</b></i>) is either a <i><b>system cycle state</b></i> or a <i><b>system transitional state</b></i>. Every production rule system state, <i>s</i>, cycle or transitional, is characterized by
</p>
<ul><li> a state of the fact base, <i>facts(s)</i>;
</li><li> if <i>s</i> is not the current state, an ordered set of rule instances, <i>picked(s)</i>, defined as follows:
<ul><li> if <i>s</i> is a system cycle state, <i>picked(s)</i> is the ordered set of rule instances picked by the conflict resolution strategy, among the set of all the rule instances that matched <i>facts(s)</i>;
</li><li> if <i>s</i> is a system transitional state, <i>picked(s)</i> is the empty set;
</li></ul>
</li><li> if <i>s</i> is not the initial state, a previous system state, <i>previous(s)</i>, defined as follows: given a system cycle state, <i>s<sub>c</sub></i>, and given the sequence of system transitional states, <i>s<sub>1</sub>,...,s<sub>n</sub></i>, <i>n ≥ 0</i>, such that the execution of the first ground atomic action in <i>action(picked(s<sub>c</sub>))</i> transitioned the system from <i>s<sub>c</sub></i> to <i>s<sub>1</sub></i> and ... and the <i>n-th</i> ground atomic action in <i>action(picked(s<sub>c</sub>))</i> transitioned the system from <i>s<sub>n-1</sub></i> to <i>s<sub>n</sub></i>, then <i>previous(s) = s<sub>n</sub></i> if and only if the <i>(n+1)-th</i> ground atomic action in <i>action(picked(s<sub>c</sub>))</i> transitioned the system from <i>s<sub>n</sub></i> to <i>s</i>. ☐
</li></ul>
<p>In the following, we will write <i>previous(s) = NIL</i> to denote that a system state <i>s</i> is the initial state.
</p><p><span class="anchor" id="def-conflict-set"></span>
<b>Definition (Conflict set).</b> Given a rule set, <i>RS ⊆ R</i>, and a system state, <i>s</i>, the <i><b>conflict set</b></i> determined by <i>RS</i> in <i>s</i> is the set, <i>conflictSet(RS, s)</i> of all the different instances of the rules in <i>RS</i> that match the state of the fact base, <i>facts(s) ∈ W</i>. ☐
</p><p>The rule instances that are in the conflict set are, sometimes, said to be <i>fireable</i>.
</p><p>In each non-final cycle state, <i>s</i>, of a production rule system, a subset, <i>picked(s)</i>, of the rule instances in the conflict set is selected and ordered; their action parts are instantiated, and the resulting sequence of ground atomic actions is executed. This is sometimes called: <i>firing</i> the selected instances.
</p><p><span class="anchor" id="sec-operational-semantics-of-a-production-rule-system"></span>
</p>
<a id="Operational_semantics_of_a_production_rule_system" name="Operational_semantics_of_a_production_rule_system"></a><h4> <span class="mw-headline">4.2.4 Operational semantics of a production rule system </span></h4>
<p>All the elements that are required to define a production rule system as a <a href="#def-ltts" title="">labeled terminal transition system</a> have now been defined.
</p><p><span class="anchor" id="def-prs"></span>
<b>Definition (RIF-PRD Production Rule System).</b> A <i><b>RIF-PRD production rule system</b></i> is defined as a labeled terminal transition system <i>PRS = {S, A, →<sub><small>PRS</small></sub>, T}</i>, where :
</p>
<ul><li> <i>S</i> is a set of system states, called the <i><a href="#def-system-state" title="">system cycle states</a></i>;
</li><li> <i>A</i> is a set of transition labels, where each transition label is a sequence of ground RIF-PRD atomic actions;
</li><li> The transition relation →<sub><sub>PRS</sub></sub> ⊆ <i>S</i> × <i>A</i> × <i>S</i>, is defined as follows:<br />∀ (<i>s</i>, <i>a</i>, <i>s' </i>) ∈ <i>S</i> × <i>A</i> × <i>S</i>, (<i>s</i>, <i>a</i>, <i>s' </i>) ∈ →<sub><sub>PRS</sub></sub> if and only if all of the following hold:
<ol><li> <i>(facts(s), a, facts(s'))</i> ∈ →<sup>*</sup><sub><sub>RIF-PRD</sub></sub>, where →<sup>*</sup><sub><sub>RIF-PRD</sub></sub> denotes the transitive closure of the transition relation →<sub><sub>RIF-PRD</sub></sub> that is determined by the specification of the semantics of the atomic actions supported by RIF-PRD;
</li><li> <i>a = actions(picked(s))</i>;
</li></ol>
</li><li> <i>T ⊆ S</i>, a set of final system states. ☐
</li></ul>
<p>Intuitively, the first condition in the definition of the transition relation →<sub><sub>PRS</sub></sub> states that a production rule system can transition from one system cycle state to another only if the state of facts in the latter system cycle state can be reached from the state of facts in the former by performing a sequence of ground atomic actions supported by RIF-PRD, according to the <a href="#sec-operational-semantics-of-atomic-actions" title="">semantics of the atomic actions</a>.
</p><p>The second condition states that the allowed paths out of any given system cycle state are determined only by how rule instances are <i>picked</i> for execution, from the conflict set, by the conflict resolution strategy.
</p>
Given a rule set <i>RS ⊆ R</i>, the associated conflict resolution strategy, <i>LS</i>, and halting test, <i>H</i>, and an initial state of the fact base, <i>w ∈ W</i>, the input function to a <a href="#def-prs" title="">RIF-PRD production rule system</a> is defined as:<br /><center><i>Eval(RS, LS, H, w) →<sub><sub>PRS</sub></sub> s ∈ S</i>, such that <i>facts(s) = w</i> and <i>previous(s) = NIL</i>.</center>
Using <i>→<sup>*</sup><sub><sub>PRS</sub></sub></i> to denote the transitive closure of the transition relation <i>→<sub><sub>PRS</sub></sub></i>, there are zero, one or more final states of the system, <i>s' ∈ T</i>, such that:<br /><center><i>Eval(RS, LS, H, w) →<sup>*</sup><sub><sub>PRS</sub></sub> s'.</i></center>
<p>The execution of a rule set, <i>RS</i>, in a state, <i>w</i>, of a fact base, may result in zero, one or more final state of the fact base, <i>w' = facts(s')</i>, depending on the conflict resolution strategy and the set of final system states.
</p><p>Therefore, the behavior of a <a href="#def-prs" title="">RIF-PRD production rule system</a> also depends on:
</p>
<ol><li> the conflict resolution strategy, that is, how rule instances are precisely selected for execution from the rule instances that match a given state of the fact base, and
</li><li> how the set <i>T</i> of final system states is precisely defined.
</li></ol>
<p><span class="anchor" id="sec-conflict-resolution"></span>
</p>
<a id="Conflict_resolution" name="Conflict_resolution"></a><h4> <span class="mw-headline">4.2.5 Conflict resolution </span></h4>
<p>The process of selecting one or more <a href="#def-rule-instance" title="">rule instances</a> from the <a href="#def-conflict-set" title="">conflict set</a> for firing is often called: <i>conflict resolution</i>.
</p><p>In RIF-PRD the conflict resolution algorithm (or conflict resolution <i>strategy</i>) that is intended for a set of rules is denoted by a keyword or a set of keywords that is attached to the rule set. In this version of the RIF-PRD specification, a single conflict resolution strategy is specified normatively: it is denoted by the keyword <tt>rif:forwardChaining</tt> (a constant of type <i>rif:IRI</i>), because it accounts for a common conflict resolution strategy used in most forward-chaining production rule systems. That conflict resolution strategy selects a single rule instance for execution.
</p><p>Future versions of the RIF-PRD specification may specify normatively the intended conflict resolution strategies to be attached to additional keywords. In addition, RIF-PRD documents may include non-standard keywords: it is the responsibility of the producers and consumers of such document to agree on the intended conflict resolution strategies that are denoted by such non-standard keywords. Future or non-standard conflict resolution strategies may select an ordered set of rule instances for execution, instead of a single one: the functions <i>picked</i> and <i>actions</i>, in the previous section, have been defined to take this case into account.
</p><p><span class="anchor" id="sec-forward-chaining"></span>
<b>Conflict resolution strategy: <tt>rif:forwardChaining</tt></b>
</p><p>Most existing production rule systems implement conflict resolution algorithms that are a combination of the following elements (under these or other, idiosyncratic names; and possibly combined with additional, idiosyncratic rules):
</p>
<ul><li> <i>Refraction.</i> The essential idea of <i>refraction</i> is that a given instance of a rule must not be fired more than once as long as the reasons that made it eligible for firing hold. In other terms, if an instance has been fired in a given state of the system, it is no longer eligible for firing as long as it satisfies the states of facts associated to all the subsequent system states (cycle and transitional);
</li><li> <i>Priority.</i> The rule instances are ordered by priority of the instantiated rules, and only the rule instances with the highest priority are eligible for firing;
</li><li> <i>Recency.</i> the rule instances are ordered by the number of consecutive system states, cycle and transitional, in which they have been in the conflict set, and only the most recently fireable ones are eligible for firing. Note that the recency rule, used alone, results in depth-first processing.
</li></ul>
<p>Many existing production rule systems implement also some kind of <i>fire the most specific rule first</i> strategy, in combination with the above. However, whereas they agree on the definition of refraction and the priority or recency ordering, existing production rule systems vary widely on the precise definition of the specificity ordering. As a consequence, rule instance specificity was not included in the basic conflict resolution strategy that RIF-PRD specifies normatively.
</p><p>The RIF-PRD keyword <tt>rif:forwardChaining</tt> denotes the common conflict resolution strategy that can be summarized as follows:
given a conflict set
</p>
<ol><li> Refraction is applied to the conflict set, that is, all the refracted rule instances are removed from further consideration;
</li><li> The remaining rule instances are ordered by decreasing priority, and only the rule instances with the highest priority are kept for further consideration;
</li><li> The remaining rule instances are ordered by decreasing recency, and only the most recent rule instances are kept for further consideration;
</li><li> Any remaining tie is broken is some way, and a single rule instance is kept for firing.
</li></ol>
<p>As specified earlier, <i>picked(s)</i> denotes the ordered list of the rule instances that were picked in a system state, <i>s</i>. Under the conflict resolution strategy denoted by <tt>rif:forwardChaining</tt>, for any given system cycle state, <i>s</i>, the list denoted by <i>picked(s)</i> contains a single rule instance. By definiiton, if <i>s</i> is a <a href="#def-system-state" title="">system transitional state</a>, <i>picked(s)</i> is the empty set.
</p><p>Given a system state, <i>s</i>, a rule set, <i>RS</i>, and a rule instance, <i>ri ∈ <a href="#def-conflict-set" title="">conflictSet(RS, s)</a></i>, let <i>recency(ri, s)</i> denote the number of system states before <i>s</i>, in which <i>ri</i> has been continuously a matching instance: if <i>s</i> is the current system state, <i>recency(ri, s)</i> provides a measure of the recency of the rule instance <i>ri</i>. <i>recency(ri, s)</i> is specified recursively as follows:
</p>
<ul><li> if <i>previous(s) = NIL</i>, then <i>recency(ri, s) = 1</i>;
</li><li> else if <i>ri ∈ conflictSet(RS, previous(s))</i>, then <i>recency(ri, s) = 1 + recency(ri, previous(s))</i>;
</li><li> else, <i>recency(ri, s) = 1</i>.
</li></ul>
<p>In the same way, given a rule instance, <i>ri</i>, and a system state, <i>s</i>, let <i>lastPicked(ri, s)</i> denote the number of system states before <i>s</i>, since <i>ri</i> has been last fired. <i>lastPicked(ri, s)</i> is specified recursively as follows:
</p>
<ul><li> if <i>previous(s) = NIL</i>, then <i>lastPicked(ri, s) = 1</i>;
</li><li> else if <i>ri ∈ picked(previous(s))</i>, then <i>lastPicked(ri, s) = 1</i>;
</li><li> else, <i>lastPicked(ri, s) = 1 + lastPicked(ri, previous(s))</i>.
</li></ul>
<p>Given a rule instance, <i>ri</i>, let <i>priority(ri)</i> denote the priority that is associated to <i>rule(ri)</i>, or zero, if no priority is associated to <i>rule(ri)</i>. If <i>rule(ri)</i> is inside nested <tt>Group</tt>s, <i>priority(ri)</i> denotes the priority that is associated with the innermost <tt>Group</tt> to which a priority is explicitly associated, or zero.
</p><p><span class="anchor" id="ref-ex43"></span>
</p>
<div class="example">
<p><b>Example 4.3.</b> Consider the following RIF-PRD document:
</p>
<pre>Document (
Prefix( ex2 <http://example.com/2009/prd3#> )
(* ex2:ExampleRuleSet *)
Group (
(* ex2:Rule_1 *) Forall ...
(* ex2:HighPriorityRules *)
Group 10 (
(* ex2:Rule_2 *) Forall ...
(* ex2:Rule_3 *)
Group 9 (Forall ... ) )
(* ex2:NoPriorityRules *)
Group (
(* ex2:Rule_4 *) Forall ...
(* ex2:Rule_5 *) Forall ... )
)
</pre>
<p>No conflict resolution strategy is identified explicitly, so the default strategy <tt>rif:forwardChaining</tt> is used.
</p><p>Because the <i>ex2:ExampleRuleSet</i> group does not specify a priority, the default priority <i>0</i> is used. Rule 1, not being in any other group, inherits its priority, <i>0</i>, from the top-level group.
</p><p>Rule 2 inherits its priority, <i>10</i>, from the enclosing group, identified as <i>ex2:HighPriorityRules</i>. Rule 3 specifies its own, lower, priority: <i>9</i>.
</p><p>Since neither Rule 4 nor Rule 5 specify a priority, they inherit their priority from the enclosing group <i>ex2:NoPriorityRules</i>, which does not specify one either, and, thus, they inherit <i>0</i> from the top-level group, <i>ex2:ExampleRuleSet</i>. ☐
</p>
</div>
<p>Given a set of rule instances, <i>cs</i>, the conflict resolution strategy <tt>rif:forwardChaining</tt> can now be described with the help of four rules, where <i>ri</i> and <i>ri' </i> are rule instances:
</p>
<ol><li> <b>Refraction rule</b>: if <i>ri ∈ cs</i> and <i>lastPicked(ri, s) < recency(ri, s)</i>, then <i>cs = cs - ri</i>;
</li><li> <b>Priority rule</b>: if <i>ri ∈ cs</i> and <i>ri' ∈ cs</i> and <i>priority(ri) < priority(ri')</i>, then <i>cs = cs - ri</i>;
</li><li> <b>Recency rule</b>: if <i>ri ∈ cs</i> and <i>ri' ∈ cs</i> and <i>recency(ri, s) > recency(ri', s)</i>, then <i>cs = cs - ri</i>;
</li><li> <b>Tie-break rule</b>: if <i>ri ∈ cs</i>, then <i>cs = {ri}</i>. RIF-PRD does not specify the tie-break rule more precisely: how a single instance is selected from the remaining set is implementation specific.
</li></ol>
<p>The <i>refraction rule</i> removes the instances that have been in the conflict set in all the system states at least since they were last fired; the <i>priority rule</i> removes the instances such that there is at least one instance with a higher priority; the <i>recency rule</i> removes the instances such that there is at least one instance that is more recent; and the <i>tie-break rule</i> keeps one rule from the set.
</p><p>To select the singleton rule instance, <i>picked(s)</i>, to be fired in a system state, <i>s</i>, given a rule set, <i>RS</i>, the conflict resolution strategy denoted by the keyword <tt>rif:forwardChaining</tt> consists of the following sequence of steps:
</p>
<ol><li> initialize <i>picked(s)</i> with the conflict set, that a rule set <i>RS</i> determines in a system state <i>s</i>: <i>picked(s) = conflictSet(RS, s)</i>;
</li><li> apply the <i>refraction rule</i> to all the rule instances in <i>picked(s)</i>;
</li><li> then apply the <i>priority rule</i> to all the remaining instances in <i>picked(s)</i>;
</li><li> then apply the <i>recency rule</i> to all the remaining instances in <i>picked(s)</i>;
</li><li> then apply the <i>tie-break rule</i> to the remaing instance in <i>picked(s)</i>;
</li><li> return <i>picked(s)</i>.
</li></ol>
<p><span class="anchor" id="ref-ex44"></span>
</p>
<div class="example">
<p><b>Example 4.4.</b> Consider, from <a href="#ref-ex42" title="">example 4.2</a>, the conflict set that the rule set <tt>ex1:CheckoutRuleset</tt> determines in the system state, <i>s<sub>2</sub></i>, that corresponds to the state <i>w<sub>2</sub> = facts(s<sub>2</sub>)</i> of the fact base, and use it to initialize the set of rule instance considered for firing, <i>picked(s<sub>2</sub>)</i>:
</p><p><i>conflictSet(<tt>ex1:CheckoutRuleset</tt>, s<sub>2</sub>) = { ex1:DiscountRule/{(_john/?customer)} } = picked(s<sub>2</sub>)</i>
</p><p>The single rule instance in the conflict set, <i>ri = ex1:DiscountRule/{(_john/?customer)}</i>, did already belong to the conflict sets in the two previous states, <i>conflictSet(<tt>ex1:CheckoutRuleset</tt>, s<sub>1</sub>)</i> and <i>conflictSet(<tt>ex1:CheckoutRuleset</tt>, s<sub>0</sub>)</i>; so that its recency in <i>s<sub>2</sub></i> is: <i>recency(ri, s<sub>2</sub>) = 3</i>.
</p><p>On the other hand, that rule instance was fired in system state <i>s<sub>1</sub></i>: <i>picked(s<sub>1</sub>) = (ex1:DiscountRule/{(_john/?customer)})</i>; so that, in <i>s<sub>2</sub></i>, it has been last fired one cycle before: <i>lastPicked(ri, s<sub>2</sub>) = 1</i>.
</p><p>Therefore, <i>lastPicked(ri, s<sub>2</sub>) < recency(ri, s<sub>2</sub>)</i>, and <i>ri</i> is removed from <i>picked(s<sub>2</sub>)</i> by refraction, leaving <i>picked(s<sub>2</sub>)</i> empty. ☐
</p>
</div>
<p><span class="anchor" id="sec-halting-test"></span>
</p>
<a id="Halting_test" name="Halting_test"></a><h4> <span class="mw-headline">4.2.6 Halting test </span></h4>
<p>By default, a system state is final, given a rule set, <i>RS</i>, and a conflict resolution strategy, <i>LS</i>, if there is no rule instance available for firing after application of the conflict resolution strategy.
</p><p>For the conflict resolution strategy identified by the RIF-PRD keyword <tt>rif:forwardChaining</tt>, a system state, <i>s</i>, is <i><b>final</b></i> given a rule set, <i>RS</i> if and only if the remaining conflict set is empty after application of the <i>refraction rule</i> to all the rule instances in <i>conflictSet(RS, s)</i>. In particular, all the system states, <i>s</i>, such that <i>conflictSet(RS, s) = ∅</i> are final.
</p><p><span class="anchor" id="sec-document-and-imports"></span>
</p>
<a id="Document_and_imports" name="Document_and_imports"></a><h2> <span class="mw-headline">5 Document and imports </span></h2>
<p>This section specifies the structure of a RIF-PRD document and its semantics when it includes import directives.
</p>
<a id="Abstract_syntax_4" name="Abstract_syntax_4"></a><h3> <span class="mw-headline">5.1 Abstract syntax </span></h3>
<p>In addition to the language of conditions, actions, and rules, RIF-PRD provides a construct to denote the import of a RIF or non-RIF document. Import enables the modular interchange of RIF documents, and the interchange of combinations of multiple RIF and non-RIF documents.
</p><p><span class="anchor" id="sec-import-directive"></span>
</p>
<a id="Import_directive" name="Import_directive"></a><h4> <span class="mw-headline">5.1.1 Import directive </span></h4>
<p><span class="anchor" id="def-import-directive"></span>
<b>Definition (Import directive).</b> An <i><b>import directive</b></i> consists of:
</p>
<ul><li> an IRI, the <i>locator</i>, that identifies and locates the document to be imported, and
</li><li> an optional second IRI that identifies the <i>profile</i> of the import. ☐
</li></ul>
<p>RIF-PRD gives meaning to one-argument import directives only. Such directives can be used to import other RIF-PRD and RIF-Core documents. Two-argument import directives are provided to enable import of other types of documents, and their semantics is covered by other specifications. For example, the syntax and semantics of the import of RDF and OWL documents, and their combination with a RIF document, is specified in [<a href="#ref-rif-rdf-owl" title="">RIF-RDF-OWL</a>].
</p><p><span class="anchor" id="sec-prd-document"></span>
</p>
<a id="RIF-PRD_document" name="RIF-PRD_document"></a><h4> <span class="mw-headline">5.1.2 RIF-PRD document </span></h4>
<p><span class="anchor" id="def-prd-document"></span>
<b>Definition (RIF-PRD document).</b> A RIF-PRD <i><b>document</b></i> consists of zero or more import directives, and zero or one <a href="#def-group" title="">group</a>. ☐
</p><p><span class="anchor" id="def-imported-document"></span>
<b>Definition (Imported document).</b> A document is said to be <i><b>directly imported</b></i> by a RIF document, <i>D</i>, if and only if it is identified by the locator IRI in an import directive in <i>D</i>. A document is said to be <i><b>imported</b></i> by a RIF document, <i>D</i>, if it is directly imported by <i>D</i>, or if it is imported, directly or not, by a RIF document that is directly imported by <i>D</i>. ☐
</p><p><span class="anchor" id="def-safe-document"></span>
<b>Definition (Document safeness).</b> (from [<a href="#ref-core" title="">RIF-Core</a>]) A document is <i><b>safe</b></i> if and only if it
</p>
<ul><li> it contains a safe group, or no group at all,
</li><li> and all the documents that it imports are safe. ☐
</li></ul>
<p><span class="anchor" id="sec-wf-documents"></span>
</p>
<a id="Well-formed_documents" name="Well-formed_documents"></a><h4> <span class="mw-headline">5.1.3 Well-formed documents </span></h4>
<p><span class="anchor" id="def-associated-crs"></span>
<b>Definition (Conflict resolution strategy associated with a document).</b> A <i><b>conflict resolution strategy is associated with a RIF-PRD document</b></i>, <i>D</i>, if and only if
</p>
<ul><li> it is explicitly or implicitly attached to the top-level group in <i>D</i>, or
</li><li> it is explicitly or implicitly attached to the top-level group in a RIF-PRD document that is imported by <i>D</i>. ☐
</li></ul>
<p><span class="anchor" id="def-wf-prd-document"></span>
<b>Definition (Well-formed RIF-PRD document).</b> A RIF-PRD document, <i>D</i>, is <i><b>well-formed</b></i> if and only if it satisfies all the following conditions:
</p>
<ul><li> the locator IRI provided by all the import directives in <i>D</i>, if any, identify well-formed RIF-PRD documents,
</li><li> <i>D</i> contains a well-formed group or no group at all,
</li><li> <i>D</i> has only one associated conflict resolution strategy (that is, all the conflict resolution strategies that can be associated with it are the same), and
</li><li> every non-<tt>rif:local</tt> constant that occurs in <i>D</i> or in one of the documents imported by <i>D</i>, occurs in the same context in <i>D</i> and in all the documents imported by <i>D</i>. ☐
</li></ul>
<p>The last condition in the above definition makes the intent behind the <tt>rif:local</tt> constants clear: occurrences of such constants in different documents can be interpreted differently even if they have the same name. Therefore, each document can choose the names for the <tt>rif:local</tt> constants freely and without regard to the names of such constants used in the imported documents.
</p><p><span class="anchor" id="sec-operational-semantics-of-documents"></span>
</p>
<a id="Operational_semantics_of_RIF-PRD_documents" name="Operational_semantics_of_RIF-PRD_documents"></a><h3> <span class="mw-headline">5.2 Operational semantics of RIF-PRD documents </span></h3>
<p>The semantics of a <a href="#def-wf-prd-document" title="">well-formed RIF-PRD document</a> that contains no import directive is the semantics of the rule set that is represented by the top-level group in the document, evaluated with the <a href="#def-associated-crs" title="">conflict resolution strategy that is associated to the document</a>, and the default halting test, as specified above, in <a href="#sec-halting-test" title="">section Halting test</a>.
</p><p>The semantics of a <a href="#def-wf-prd-document" title="">well-formed RIF-PRD document</a>, <i>D</i>, that imports the <a href="#def-wf-prd-document" title="">well-formed RIF-PRD documents</a> <i>D<sub>1</sub></i>, ..., <i>D<sub>n</sub></i>, <i>n ≥ 1</i>, is the semantics of the rule set that is the union of the rule sets represented by the top-level groups in <i>D</i> and the imported documents, with the <tt>rif:local</tt> constants renamed to ensure that the same symbol does not occur in two different component rule sets, and evaluated with the <a href="#def-associated-crs" title="">conflict resolution strategy that is associated to the document</a>, and the <a href="#sec-halting-test" title="">default halting test</a>.
</p><p><span class="anchor" id="sec-builtins"></span>
</p>
<a id="Built-in_functions.2C_predicates_and_actions" name="Built-in_functions.2C_predicates_and_actions"></a><h2> <span class="mw-headline">6 Built-in functions, predicates and actions </span></h2>
<p>In addition to externally specified functions and predicates, and in particular, in addition to the functions and predicates built-ins defined in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>], RIF-PRD supports externally specified actions, and defines action built-ins.
</p><p>The syntax and semantics of action built-ins are specified like for the other buit-ins, as described in the section Syntax and Semantics of Built-ins in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>]. However, their formal semantics is trivial: action built-ins behave like predicates that are always true, since action built-ins, in RIF-PRD, MUST NOT affect the semantics of the rules.
</p><p>Although they must not affect the semantics of the rules, action built-ins may have other side effects.
</p><p>RIF action built-ins are defined in the namespace: <a class="external free" href="http://www.w3.org/2007/rif-builtin-action" title="http://www.w3.org/2007/rif-builtin-action#">http://www.w3.org/2007/rif-builtin-action#</a>. In this document, we will use the prefix: <tt>act:</tt> to denote the RIF action built-ins namespace.
</p><p><span class="anchor" id="sec-builtin-actions"></span>
</p>
<a id="Built-in_actions" name="Built-in_actions"></a><h3> <span class="mw-headline">6.1 Built-in actions </span></h3>
<p><span class="anchor" id="sec-act-print"></span>
</p>
<a id="act:print" name="act:print"></a><h4> <span class="mw-headline">6.1.1 act:print </span></h4>
<ul>
<li>
<em>Schema</em>:
<p>
<tt>(?arg; act:print(?arg))</tt>
</p>
</li>
<li>
<em>Domains</em>:
<p>
The value space of the single argument is <tt>xs:string</tt>.
</p>
</li>
<li>
<em>Mapping:</em>
<p>When <tt>s</tt> belongs to its domain, <i><b>I</b></i><sub>truth</sub><tt> ο </tt><i><b>I</b></i><sub>External</sub>( ?arg; act:print(?arg) )(s) = <b>t</b>.
</p>
<p>
If an argument value is outside of its domain, the truth value of the function is left unspecified.
</p>
</li>
<li>
<em>Side effects:</em>
<p>
The value of the argument MUST be printed to an output stream, to be determined by the user implementation.
</p>
</li>
</ul>
<p><span class="anchor" id="sec-conformance"></span>
</p>
<a id="Conformance_and_interoperability" name="Conformance_and_interoperability"></a><h2> <span class="mw-headline">7 Conformance and interoperability </span></h2>
<p><span class="anchor" id="sec-semantics-preserving-transformations"></span>
</p>
<a id="Semantics-preserving_transformations" name="Semantics-preserving_transformations"></a><h3> <span class="mw-headline">7.1 Semantics-preserving transformations </span></h3>
<p>RIF-PRD conformance is described partially in terms of semantics-preserving transformations.
</p><p>The intuitive idea is that, for any initial state of facts, the conformant consumer of a conformant RIF-PRD document must reach at least one of the final state of facts intended by the conformant producer of the document, and that it must never reach any final state of facts that was not intended by the producer. That is:
</p>
<ul><li> a conformant RIF-PRD producer, <i>P</i>, must translate any rule set from its own rule language, <i>L<sub>P</sub></i>, into RIF-PRD, in such a way that, for any possible initial state of the fact base, the RIF-PRD translation of the rule set must never produce, according to the semantics specified in this document, a final state of the fact base that would not be a possible result of the execution of the rule set according to the semantics of <i>L<sub>P</sub></i> (where the state of the facts base are meant to be represented in <i>L<sub>P</sub></i> or in RIF-PRD as appropriate), and
</li><li> a conformant RIF-PRD consumer, <i>C</i>, must translate any rule set from a RIF-PRD document into a rule set in its own language, <i>L<sub>C</sub></i>, in such a way that, for any possible initial state of the fact base, the translation in <i>L<sub>C</sub></i> of the rule set, must never produce, according to the semantics of <i>L<sub>C</sub></i>, a final state of the fact base that would not be a possible result of the execution of the rule set according to the semantics specified in this document (where the state of the facts base are meant to be represented in <i>L<sub>C</sub></i> or in RIF-PRD as appropriate).
</li></ul>
<p>Let Τ be a set of datatypes and symbol spaces that includes the datatypes specified in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>] and the symbol spaces <tt>rif:iri</tt> and <tt>rif:local</tt>. Suppose also that Ε is a set of external predicates and functions that includes the built-ins listed in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>] and in the <a href="#sec-builtin-actions" title="">section Built-in actions</a>. We say that a rule <i>r</i> is a <i>RIF-PRD</i><sub>Τ,Ε</sub> rule if and only if
</p>
<ul>
<li>
<i>r</i> is a <a href="#def-wf-rule" title="">well-formed RIF-PRD rule</a>,
</li>
<li>
all the datatypes and symbol spaces used in <i>r</i> are in Τ, and
</li>
<li>
all the externally defined functions and predicates used in <i>r</i> are in Ε.
</li>
</ul>
<p>Suppose, further, that C is a set of conflict resolution strategies that includes the one specified in <a href="#sec-conflict-resolution" title="">section Conflict resolution</a>, and that H is a set of halting tests that includes the one specified in <a href="#sec-halting-test" title="">section Halting test</a>: we say that a rule set , <i>R</i>, is a <i>RIF-PRD</i><sub>Τ,Ε,C,H</sub> rule set if and only if
</p>
<ul><li> <i>R</i> contains only <i>RIF-PRD</i><sub>Τ,Ε</sub> rules,
</li><li> the conflict resolution strategy that is associated to <i>R</i> is in C, and
</li><li> the halting test that is associated to <i>R</i> is in H.
</li></ul>
<p>Given a <i>RIF-PRD</i><sub>Τ,Ε,C,H</sub> rule set, <i>R</i>, an initial state of the fact base, <i>w</i>, a conflict resolution strategy <i>c ∈</i> C and a halting test <i>h ∈</i> H, let <i>F<sub>R,w,c,h</sub></i> denote the set of all the sets, <i>f</i>, of RIF-PRD ground atomic formulas that represent final states of the fact base, <i>w' </i>, according to the <a href="#sec-operational-semantics-of-a-production-rule-system" title="">operational semantics of a RIF-PRD production rule system</a>, that is: <i>f ∈ F<sub>R,w,c,h</sub></i> if and only if there is a state, <i>s' </i>, of the system, such that <i>Eval(R, c, h, w) →<sup>*</sup><sub><sub>PRS</sub></sub> s' </i> and <i>w' = facts(s')</i> and <i>f</i> is a representation of <i>w' </i>.
</p><p>In addition, given a rule language, <i>L</i>, a rule set expressed in <i>L</i>, <i>R<sub>L</sub></i>, a conflict resolution strategy, <i>c</i>, a halting test, <i>h</i>, and an initial state of the fact base, <i>w</i>, let <i>F<sub>L,R<sub>L</sub>, c, h, w</sub></i> denote the set of all the formulas in <i>L</i> that represent a final state of the fact base that an <i>L</i> processor can possibly reach.
</p><p><span class="anchor" id="def-semantics-preserving-mapping"></span>
<b>Definition (Semantics preserving mapping).</b>
</p>
<ul><li> A mapping from a <i>RIF-PRD</i><sub>Τ,Ε,C,H</sub>, <i>R</i>, to a rule set, <i>R<sub>L</sub></i>, expressed in a language <i>L</i>, is <b>semantics-preserving</b> if and only if, for any initial state of the fact base, <i>w</i>, conflict resolution strategy, <i>c</i>, and halting test, <i>h</i>, it also maps each <i>L</i> formula in <i>F<sub>L,R<sub>L</sub>, c, h, w</sub></i> onto a set of RIF-PRD ground formulas in <i>F<sub>R,w,c,h</sub></i>;
</li><li> A mapping from a rule set, <i>R<sub>L</sub></i>, expressed in a language <i>L</i>, to a <i>RIF-PRD</i><sub>Τ,Ε,C,H</sub>, <i>R</i>, is <b>semantics-preserving</b> if an only if, for any initial state of the fact base, <i>w</i>, conflict resolution strategy, <i>c</i>, and halting test, <i>h</i>, it also maps each set of ground RIF-PRD atomic formulas in <i>F<sub>R,w,c,h</sub></i> onto an <i>L</i> formula in <i>F<sub>L,R<sub>L</sub>, c, h, w</sub></i>. ☐
</li></ul>
<p><span class="anchor" id="sec-conformance-clauses"></span>
</p>
<a id="Conformance_Clauses" name="Conformance_Clauses"></a><h3> <span class="mw-headline">7.2 Conformance Clauses </span></h3>
<p><span class="anchor" id="def-conformance"></span>
<b>Definition (RIF-PRD conformance).</b>
</p>
<ul><li> A RIF processor is a <i><b>conformant</b></i> <i>RIF-PRD</i><sub>Τ,Ε,C,H</sub> <i><b>consumer</b></i> iff it implements a <a href="#def-semantics-preserving-mapping" title=""><i>semantics-preserving mapping</i></a> from the set of all <a href="#def-safe-rule" title=""><i>safe</i></a> <i>RIF-PRD</i><sub>Τ,Ε,C,H</sub> rule sets to the language <i>L</i> of the processor;
</li><li> A RIF processor is a <i><b>conformant</b></i> <i>RIF-PRD</i><sub>Τ,Ε,C,H</sub> <i><b>producer</b></i> iff it implements a <a href="#def-semantics-preserving-mapping" title=""><i>semantics-preserving mapping</i></a> from a subset of the language <i>L</i> of the processor to a set of <a href="#def-safe-rule" title=""><i>safe</i></a> <i>RIF-PRD</i><sub>Τ,Ε,C,H</sub> rule sets;
</li><li> An <i><b>admissible document</b></i> is an XML document that conforms to all the syntactic constraints of RIF-PRD, including ones that cannot be checked by an XML Schema validator;
</li><li> A <i><b>conformant RIF-PRD consumer</b></i> is a conformant RIF-PRD<sub>Τ,Ε,C,H</sub> consumer in which Τ consists only of the symbol spaces and datatypes, Ε consists only of the externally defined functions and predicates, C consists only of the conflict resolution strategies, and H consists only of halting tests that are required by RIF-PRD. The required symbol spaces are <tt>rif:iri</tt> and <tt>rif:local</tt>, and the datatypes and externally defined terms (built-ins) are the ones specified in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>] and in the <a href="#sec-builtin-actions" title="">section Built-in actions</a>. The required conflict resolution strategy is the one that is identified as <tt>rif:forwardChaining</tt>, as specified in <a href="#sec-conflict-resolution" title="">section Conflict resolution</a>; and the required halting test is the one specified in <a href="#sec-halting-test" title="">section Halting test</a>. A conformant RIF-PRD consumer must reject any document containing features it does not support.
</li><li> A <i><b>conformant RIF-PRD producer</b></i> is a conformant RIF-PRD<sub>Τ,Ε,C,H</sub> producer which produces documents that include only the symbol spaces, datatypes, externals, conflict resolution strategies and halting tests that are required by RIF-PRD. ☐
</li></ul>
<p>In addition, conformant RIF-PRD producers and consumers SHOULD preserve annotations.
</p><p><span class="anchor" id="sec-interoperability"></span>
</p>
<a id="Interoperability" name="Interoperability"></a><h3> <span class="mw-headline">7.3 Interoperability </span></h3>
<p>[<a href="#ref-core" title="">RIF-Core</a>] is specified as a specialization of RIF-PRD: all valid [<a href="#ref-core" title="">RIF-Core</a>] documents are valid RIF-PRD documents and must be accepted by any conformant RIF-PRD consumer.
</p><p>Conversely, it is desirable that any valid RIF-PRD document that uses only abstract syntax that is defined in [<a href="#ref-core" title="">RIF-Core</a>] be a valid [<a href="#ref-core" title="">RIF-Core</a>] document as well. For some abstract constructs that are defined in both RIF-Core and RIF-PRD, RIF-PRD defines alternative XML syntax that is not valid RIF-Core XML syntax. For example, an <a href="#def-action-block" title="">action block</a> that contains no <a href="#def-action-variable-declaration" title="">action variable declaration</a> and only <a href="#def-atomic-action" title="">assert atomic actions</a> can be expressed in RIF-PRD using the XML elements <tt>Do</tt> or <tt>And</tt>. Only the latter option is valid RIF-Core XML syntax.
</p><p>To maximize interoperability with RIF-Core and its non-RIF-PRD extensions, a conformant RIF-PRD consumer SHOULD produce valid [<a href="#ref-core" title="">RIF-Core</a>] documents whenever possible. Specifically, a conformant RIF-PRD producer SHOULD use only valid [<a href="#ref-core" title="">RIF-Core</a>] XML syntax to serialize a rule set that satisfies all of the following:
</p>
<ul><li> the conflict resolution strategy is effectively equivalent to the stratagy that RIF-PRD identifies by the IRI <a href="#sec-conflict-resolution" title=""><tt>rif:forwardChaining</tt></a>,
</li><li> no <a href="#def-bld-formula" title="">condition formula</a> contains a negation, in any rule in the rule set,
</li><li> no rule in the rule set has an<a href="#def-action-block" title="">action block</a> that contains a <a href="#def-action-variable-declaration" title="">action variable declaration</a>, and
</li><li> in all the rules in the rule set, the <a href="#def-action-block" title="">action block</a> contains only <a href="#def-atomic-action" title="">assert atomic actions</a>.
</li></ul>
<p>When processing a rule set that satisfies all the above conditions, a RIF-PRD producer is guaranteed to produce a valid [<a href="#ref-core" title="">RIF-Core</a>] XML document by applying the following rules recursively:
</p>
<ol><li> <i>Remove redundant information</i>. The <tt>behavior</tt> role element and all its sub-elements should be omitted in the RIF-PRD XML document;
</li><li> <i>Remove nested rule variable declarations</i>. If the <tt>rule</tt> inside a <a href="#def-rule" title="">rule with variable delcaration</a>, <i>r<sub>1</sub></i>, is also a <a href="#def-rule" title="">rule with variable declaration</a>, <i>r<sub>2</sub></i>, all the rule variable delarations and all the patterns that occur in <i>r<sub>1</sub></i> (and not in <i>r<sub>2</sub></i>) should be added to the rule variable declarations and the patterns that occur in <i>r<sub>2</sub></i>, and, after the transform, <i>r<sub>1</sub></i> should be replaced by <i>r<sub>2</sub></i>, in the rule set;
</li><li> <i>Remove patterns</i>. If a pattern occurs in a <a href="#def-rule" title="">rule with variable declaration</a>, <i>r<sub>1</sub></i>:
<ul><li> if the <tt>rule</tt> inside <i>r<sub>1</sub></i> is a <a href="#def-rule" title="">unconditional action block</a>, <i>r<sub>2</sub></i>, <i>r<sub>2</sub></i> should be transformed into a <a href="#def-rule" title="">conditional action block</a>, where the condition is the pattern, and the pattern should be removed from <i>r<sub>1</sub></i>,
</li><li> if the <tt>rule</tt> inside <i>r<sub>1</sub></i> is a <a href="#def-rule" title="">conditional action block</a>, <i>r<sub>2</sub></i>, the formula that represents the condition in <i>r<sub>2</sub></i> should be replaced by the conjunction of that formula and the formula that represents the pattern, and the pattern should be removed from <i>r<sub>1</sub></i>;
</li></ul>
</li><li> <i>Convert action blocks</i>. The action block, in each rule, should be replaced by a conjunction, and, inside the conjunction, each <a href="#def-atomic-action" title="">assert action</a> should be replaced by its target atomic formula.
</li></ol>
<div class="example">
<p><b>Example 7.1.</b> Consider the following rule, <i>R</i>, derived from the <i>Gold rule</i>, in the <a href="#sec-running-example" title="">running example</a>, to have only assertions in the action part:
</p>
<pre>R: Forall ?customer such that (And( ?customer # ex1:Customer
?customer[status->"Silver"] ) )
(Forall ?shoppingCart such that (?customer[shoppingCart->?shoppingCart])
(If Exists ?value (And( ?shoppingCart[value->?value]
pred:numeric-greater-than-or-equal(?value 2000))
Then Do( Assert(ex1:Foo(?customer))
Assert(ex1:Bar(?shoppingCart)) ) ) )
</pre>
<p>The serialization of <i>R</i> in the following RIF-Core conformant XML form does not impacts its semantics (see <a href="#ex-512" title="">example 8.12</a> for another valid RIF-PRD XML serialization, that is not RIF-Core conformant):
</p>
<pre><Forall>
<declare><Var>?customer</Var></declare>
<declare><Var>?shoppingCart</Var></declare>
<formula>
<Implies>
<if>
<And>
<formula> <!-- first pattern -->
<And>
<formula><Member> ... </Member></formula>
<formula><Frame> ... </Frame></formula>
</And>
</formula>
<formula> <!-- second pattern -->
<Member> ... </Member>
</formula>
<formula> <!-- original existential condition -->
...
</formula>
</And>
</if>
<then>
<And>
<formula> <!-- serialization of ex1:Foo(?customer) -->
...
</formula>
<formula> <!-- serialization of ex1:Bar(?shoppingCart) -->
...
</formula>
</then>
</Implies>
</formula>
</Forall>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-xml-syntax"></span>
</p>
<a id="XML_Syntax" name="XML_Syntax"></a><h2> <span class="mw-headline">8 XML Syntax </span></h2>
<p>This section specifies the concrete XML syntax of RIF-PRD. The concrete syntax is derived from the abstract syntax defined in sections 2.1, 3.1 and 4.1 using simple mappings. The semantics of the concrete syntax is the same as the semantics of the abstract syntax.
</p><p><span class="anchor" id="sec-notational-conventions"></span>
</p>
<a id="Notational_conventions" name="Notational_conventions"></a><h3> <span class="mw-headline">8.1 Notational conventions </span></h3>
<p><span class="anchor" id="sec-namespaces"></span>
</p>
<a id="Namespaces" name="Namespaces"></a><h4> <span class="mw-headline">8.1.1 Namespaces </span></h4>
<p>Throughout this document, the <tt>xsd:</tt> prefix stands for the XML Schema namespace URI <tt>http://www.w3.org/2001/XMLSchema#</tt>, the <tt>rdf:</tt> prefix stands for <tt>http://www.w3.org/1999/02/22-rdf-syntax-ns#</tt>, and <tt>rif:</tt> stands for the URI of the RIF namespace, <tt>http://www.w3.org/2007/rif#</tt>.
</p><p>Syntax such as <tt>xsd:string</tt> should be understood as a compact URI [<a href="#ref-curie" title="">CURIE</a>] -- a macro that expands to a concatenation of the character sequence denoted by the prefix <tt>xsd</tt> and the string <tt>string</tt>. The compact URI notation is used for brevity only, and <tt>xsd:string</tt> should be understood, in this document, as an abbreviation for <tt>http://www.w3.org/2001/XMLSchema#string</tt>.
</p><p><span class="anchor" id="sec-bnf-pseudo-schemas"></span>
</p>
<a id="BNF_pseudo-schemas" name="BNF_pseudo-schemas"></a><h4> <span class="mw-headline">8.1.2 BNF pseudo-schemas </span></h4>
<p>The XML syntax of RIF-PRD is specified for each component as a pseudo-schema, as part of the description of the component. The pseudo-schemas use BNF-style conventions for attributes and elements: "?" denotes optionality (i.e. zero or one occurrences), "*" denotes zero or more occurrences, "+" one or more occurrences, "<tt>[</tt>" and "<tt>]</tt>" are used to form groups, and "|" represents choice. Attributes are conventionally assigned a value which corresponds to their type, as defined in the normative schema. Elements are conventionally assigned a value which is the name of the syntactic class of their content, as defined in the normative schema.
</p>
<pre><!-- sample pseudo-schema -->
<<b>defined_element</b>
required_attribute_of_type_string="<i>xs:string</i>"
optional_attribute_of_type_int="<i>xs:int</i>"? >
<required_element />
<optional_element />?
<one_or_more_of_these_elements />+
[ <choice_1 /> | <choice_2 /> ]*
</<b>defined_element</b>>
</pre>
<p><span class="anchor" id="sec-syntactic-components"></span>
</p>
<a id="Syntactic_components" name="Syntactic_components"></a><h4> <span class="mw-headline">8.1.3 Syntactic components </span></h4>
<p>Three kinds of syntactic components are used to specify RIF-PRD:
</p>
<ul><li> <i><b>Abstract classes</b></i> are defined only by their subclasses: they are not visible in the XML markup and can be thought of as extension points. In this document, abstract constructs will be denoted with all-uppercase names;
</li><li> <i><b>Concrete classes</b></i> have a concrete definition, and they are associated with specific XML markup. In this document, concrete constructs will be denoted with CamelCase names with leading capital letter;
</li><li> <i><b>Properties</b></i>, or <i>roles</i>, define how two classes relate to each other. They have concrete definitions and are associated with specific XML markup. In this document, properties will be denoted with camelCase names with leading smallcase letter.
</li></ul>
<p><span class="anchor" id="sec-xml-base"></span>
</p>
<a id="Relative_IRIs_and_XML_base" name="Relative_IRIs_and_XML_base"></a><h3> <span class="mw-headline">8.2 Relative IRIs and XML base </span></h3>
<p>Relative IRIs are allowed in RIF-PRD XML syntax, anywhere IRIs are allowed, including constant types, symbol spaces, location, and profile. The attribute <tt>xml:base</tt> [<a href="#xml-base" title="">XML-Base</a>] is used to make them absolute.
</p><p><span class="anchor" id="sec-xml-conditions"></span>
</p>
<a id="Conditions_2" name="Conditions_2"></a><h3> <span class="mw-headline">8.3 Conditions </span></h3>
<p>This section specifies the XML constructs that are used in RIF-PRD to serialize <a href="#def-bld-formula" title="">condition formulas</a>.
</p><p><span class="anchor" id="sec-TERM"></span>
</p>
<a id="TERM" name="TERM"></a><h4> <span class="mw-headline">8.3.1 TERM </span></h4>
<p>The <tt>TERM</tt> class of constructs is used to serialize <a href="#def-bld-term" title="">terms</a>, be they <a href="#def-bld-term" title="">simple terms</a>, that is, constants and variables; lists; or <a href="#def-bld-term" title="">positional terms</a>, the latter being, per the definition of a <a href="#def-bld-wff" title="">well-formed formula</a>, representations of externally defined functions.
</p><p>As an abstract class, <tt>TERM</tt> is not associated with specific XML markup in RIF-PRD instance documents.
</p>
<pre> [ <i><b>Const</b></i> | <i><b>Var</b></i> | <i><b>List</b></i> | <i><b>External</b></i> ]
</pre>
<p><span class="anchor" id="sec-const"></span>
</p>
<a id="Const" name="Const"></a><h5> <span class="mw-headline">8.3.1.1 Const </span></h5>
<p>In RIF, the <tt>Const</tt> element is used to serialize a <a href="#def-bld-term" title="">constant</a>.
</p><p>The <tt>Const</tt> element has a required <tt>type</tt> attribute and an optional <tt>xml:lang</tt> attribute:
</p>
<ul><li> The value of the <tt>type</tt> attribute is the identifier of the <tt>Const</tt> symbol space. It must be a <tt>rif:iri</tt>;
</li><li> The <tt>xml:lang</tt> attribute, as defined by <a class="external text" href="http://www.w3.org/TR/REC-xml/#sec-lang-tag" title="http://www.w3.org/TR/REC-xml/#sec-lang-tag">2.12 Language Identification</a> of <a class="external text" href="http://www.w3.org/TR/2000/REC-xml-20001006" title="http://www.w3.org/TR/2000/REC-xml-20001006">XML 1.0</a> or its successor specifications in the W3C recommendation track, is optionally used to identify the language for the presentation of the <tt>Const</tt> to the user. It is allowed only in association with constants of the type <tt>rdf:plainLiteral</tt>. A compliant implementation MUST ignore the <tt>xml:lang</tt> attribute if the type of the <tt>Const</tt> is not <tt>rdf:plainLiteral</tt>.
</li></ul>
<p>The content of the <tt>Const</tt> element is the constant's literal, which can be any Unicode character string.
</p>
<pre> <Const type=<i><b>rif:iri</b></i> [xml:lang=<i><b>xsd:language</b></i>]? >
<i><b>Any Unicode string</b></i>
</Const>
</pre>
<p><span class="anchor" id="ex-51"></span>
</p>
<div class="example">
<p><b>Example 8.1.</b>
</p><p>a. A constant with built-in type <i>xsd:integer</i> and value <i>2,000</i>:
</p>
<pre><Const type="xsd:integer">2000</Const>
</pre>
<p>b. The <i>Customer</i> class, in the <a href="#sec-running-example" title="">running example</a>, is identified by a constant of type <tt>rif:iri</tt>, in the namespace <i>http://example.com/2009/prd2#</i>:
</p>
<pre><Const type="rif:iri">
http://example.com/2009/prd2#Customer
</Const>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-var"></span>
</p>
<a id="Var" name="Var"></a><h5> <span class="mw-headline">8.3.1.2 Var </span></h5>
<p>In RIF, the <tt>Var</tt> element is used to serialize a <a href="#def-bld-term" title="">variable</a>.
</p><p>The content of the <tt>Var</tt> element is the variable's name, serialized as an <a class="external text" href="http://www.w3.org/TR/xmlschema-2/#NCName" title="http://www.w3.org/TR/xmlschema-2/#NCName">NCName</a>.
</p>
<pre> <Var> <i><b>xsd:NCName</b></i> </Var>
</pre>
<p><span class="anchor" id="sec-list-term"></span>
</p>
<a id="List" name="List"></a><h5> <span class="mw-headline">8.3.1.3 List </span></h5>
<p>In RIF, the <tt>List</tt> element is used to serialize a <a href="#def-bld-term" title="">list</a>.
</p><p>The <tt>List</tt> element contains one <tt>items</tt> element, that contains zero or more <tt>TERM</tt>s (without variables) that serialize the elements of the list. The order of the sub-elements is significant and MUST be preserved. This is emphasized by the fixed value <tt>"yes"</tt> of the mandatory attribute <tt>ordered</tt> in the <tt>items</tt> element.
</p>
<pre> <List>
<items ordered="yes">
<i><b>GROUNDTERM</b></i>*
</items>
</List>
</pre>
<p><span class="anchor" id="ex-52"></span>
</p>
<div class="example">
<p><b>Example 8.2.</b>
</p>
<ul><li> The list of customer status values from <a href="#ref-ex21" title="">example 2.1</a>:
</li></ul>
<pre><List>
<items ordered="yes">
<Const type="xsd:string> New </Const>
<Const type="xsd:string> Bronze </Const>
<Const type="xsd:string> Silver </Const>
<Const type="xsd:string> Gold </Const>
</items>
</List>
</pre>
<ul><li> The empty list:
</li></ul>
<pre><List>
<items ordered="yes">
</items>
</List>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-external-term"></span>
</p>
<a id="External" name="External"></a><h5> <span class="mw-headline">8.3.1.4 External </span></h5>
<p>As a <tt>TERM</tt>, the <tt>External</tt> element is used to serialize a <a href="#def-bld-term" title="">positional term</a>. In RIF-PRD, a positional term represents always a call to an externally defined function, e.g. a built-in, a user-defined function, a query to an external data source, etc.
</p><p>The <tt>External</tt> element contains one <tt>content</tt> element, which in turn contains one <tt>Expr</tt> element that contains one <tt>op</tt> element, followed zero or one <tt>args</tt> element:
</p>
<ul><li> The <tt>External</tt> and the <tt>content</tt> elements ensure compatibility with the RIF Basic Logic Dialect [<a href="#ref-rif-bld" title="">RIF-BLD</a>] that allows non-evaluated (that is, logic) functions to be serialized using an <tt>Expr</tt> element alone;
</li><li> The content of the <tt>op</tt> element must be a <tt>Const</tt>. When the <tt>External</tt> is a <tt>TERM</tt>, the content of the <tt>op</tt> element serializes a constant symbol of type <tt>rif:iri</tt> that must uniquely identify the externallu defined function to be applied to the <tt>args TERM</tt>s;
</li><li> The optional <tt>args</tt> element contains one or more constructs from the <tt>TERM</tt> abstract class. The <tt>args</tt> element is used to serialize the arguments of a <a href="#def-bld-term" title="">positional term</a>. The order of the <tt>args</tt> sub-elements is, therefore, significant and MUST be preserved. This is emphasized by the required value <tt>"yes"</tt> of the attribute <tt>ordered</tt>.
</li></ul>
<pre> <External>
<content>
<Expr>
<op> <i><b>Const</b></i> </op>
<args ordered="yes"> <i><b>TERM</b></i>+ </args>?
</Expr>
</content>
</External>
</pre>
<p><span class="anchor" id="ex-53"></span>
</p>
<div class="example">
<p><b>Example 8.3.</b> The example shows one way to serialize, in RIF-PRD, the product of a variable named <tt>?value</tt> and the <tt>xsd:decimal</tt> value <i>0.9</i>, where the operation conforms to the specification of the built-in <tt>func:numeric-multiply</tt>, as specified in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>].
</p><p>RIF built-in functions are associated with the namespace <a class="external free" href="http://www.w3.org/2007/rif-builtin-function" title="http://www.w3.org/2007/rif-builtin-function#">http://www.w3.org/2007/rif-builtin-function#</a>.
</p>
<pre><External>
<content>
<Expr>
<op> <Const type="rif:iri"> http://www.w3.org/2007/rif-builtin-function#numeric-multiply </Const> </op>
<args ordered="yes">
<Var> ?value </Var>
<Const type="xsd:decimal"> 0.9 </Const>
</args>
</Expr>
</content>
</External>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-ATOMIC"></span>
</p>
<a id="ATOMIC" name="ATOMIC"></a><h4> <span class="mw-headline">8.3.2 ATOMIC </span></h4>
<p>The <tt>ATOMIC</tt> class is used to serialize <a href="#def-prd-atomic" title="">atomic formulas</a>: positional atoms, equality, membership and subclass atomic formulas, frame atomic formulas and externally defined atomic formulas.
</p><p>As an abstract class, <tt>ATOMIC</tt> is not associated with specific XML markup in RIF-PRD instance documents.
</p>
<pre> [ <i><b>Atom</b></i> | <i><b>Equal</b></i> | <i><b>Member</b></i> | <i><b>Subclass</b></i> | <i><b>Frame</b></i> | <i><b>External</b></i> ]
</pre>
<p><span class="anchor" id="sec-atom"></span>
</p>
<a id="Atom" name="Atom"></a><h5> <span class="mw-headline">8.3.2.1 Atom </span></h5>
<p>In RIF, the <tt>Atom</tt> element is used to serialize a <a href="#def-prd-atomic" title="">positional atomic formula</a>.
</p><p>The <tt>Atom</tt> element contains one <tt>op</tt> element, followed by zero or one <tt>args</tt> element:
</p>
<ul><li> The content of the <tt>op</tt> element must be a <tt>Const</tt>. It serializes the predicate symbol (the name of a relation);
</li><li> The optional <tt>args</tt> element contains one or more constructs from the <tt>TERM</tt> abstract class. The <tt>args</tt> element is used to serialize the arguments of a <a href="#def-prd-atomic" title="">positional atomic formula</a>. The order of the <tt>arg</tt>'s sub-elements is, therefore, significant and MUST be preserved. This is emphasized by the required value <tt>"yes"</tt> of the attribute <tt>ordered</tt>.
</li></ul>
<pre> <Atom>
<op> <i><b>Const</b></i> </op>
<args ordered="yes"> <i><b>TERM</b></i>+ </args>?
</Atom>
</pre>
<p><span class="anchor" id="ex-54"></span>
</p>
<div class="example">
<p><b>Example 8.4.</b> The example shows the RIF XML serialization of the positional atom <i>ex1:gold(?customer)</i>, where the predicate symbol <i>gold</i> is defined in the example namespace <i>http://example.com/2009/prd2#</i>.
</p>
<pre><Atom>
<op>
<Const type="rif:iri">
http://example.com/2009/prd2#gold
</Const>
</op>
<args ordered="yes">
<Var> ?customer </Var>
</args>
</Atom>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-equal"></span>
</p>
<a id="Equal" name="Equal"></a><h5> <span class="mw-headline">8.3.2.2 Equal </span></h5>
<p>In RIF, the <tt>Equal</tt> element is used to serialize <a href="#def-prd-atomic" title="">equality atomic formulas</a>.
</p><p>The <tt>Equal</tt> element must contain one <tt>left</tt> sub-element and one <tt>right</tt> sub-element. The content of the <tt>left</tt> and <tt>right</tt> elements must be a construct from the <tt>TERM</tt> abstract class, that serialize the terms of the equality. The order of the sub-elements is not significant.
</p>
<pre> <Equal>
<left> <i><b>TERM</b></i> </left>
<right> <i><b>TERM</b></i> </right>
</Equal>
</pre>
<p><span class="anchor" id="sec-member"></span>
</p>
<a id="Member" name="Member"></a><h5> <span class="mw-headline">8.3.2.3 Member </span></h5>
<p>In RIF, the <tt>Member</tt> element is used to serialize <a href="#def-prd-atomic" title="">membership atomic formulas</a>.
</p><p>The <tt>Member</tt> element contains two required sub-elements:
</p>
<ul><li> the <tt>instance</tt> elements must be a construct from the <tt>TERM</tt> abstract class that serializes the reference to the object;
</li><li> the <tt>class</tt> element must be a construct from the <tt>TERM</tt> abstract class that serializes the reference to the class.
</li></ul>
<pre> <Member>
<instance> <i><b>TERM</b></i> </instance>
<class> <i><b>TERM</b></i> </class>
</Member>
</pre>
<p><span class="anchor" id="ex-55"></span>
</p>
<div class="example">
<p><b>Example 8.5.</b> The example shows the RIF XML serialization of class membership atom that tests whether a variable named <tt>?customer</tt> belongs to a class identified by the name <tt>Customer</tt> in the namespace <i>http://example.com/2009/prd2#</i>
</p>
<pre><Member>
<instance> <Var> ?customer </Var> </instance>
<class>
<Const type="rif:iri">
http://example.com/2009/prd2#Customer
</Const>
</class>
</Member>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-subclass"></span>
</p>
<a id="Subclass" name="Subclass"></a><h5> <span class="mw-headline">8.3.2.4 Subclass </span></h5>
<p>In RIF, the <tt>Subclass</tt> element is used to serialize <a href="#def-prd-atomic" title="">subclass atomic formulas</a>.
</p><p>The <tt>Subclass</tt> element contains two required sub-elements:
</p>
<ul><li> the <tt>sub</tt> element must be a construct from the <tt>TERM</tt> abstract class that serializes the reference to the sub-class;
</li><li> the <tt>super</tt> elements must be a construct from the <tt>TERM</tt> abstract class that serializes the reference to the super-class.
</li></ul>
<pre> <Subclass>
<sub> <i><b>TERM</b></i> </sub>
<super> <i><b>TERM</b></i> </super>
</Subclass>
</pre>
<p><span class="anchor" id="sec-frame"></span>
</p>
<a id="Frame" name="Frame"></a><h5> <span class="mw-headline">8.3.2.5 Frame </span></h5>
<p>In RIF, the <tt>Frame</tt> element is used to serialize <a href="#def-prd-atomic" title="">frame atomic formulas</a>.
</p><p>Accordingly, a <tt>Frame</tt> element must contain:
</p>
<ul><li> an <tt>object</tt> element, that contains an element of the <tt>TERM</tt> abstract class that serializes the reference to the frame's object;
</li><li> zero to many <tt>slot</tt> elements, serializing an attribute-value pair as a pair of elements of the <tt>TERM</tt> abstract class, the first one that serializes the name of the attribute (or property); the second that serializes the attribute's value. The order of the <tt>slot</tt>'s sub-elements is significant and MUST be preserved. This is emphasized by the required value <tt>"yes"</tt> of the required attribute <tt>ordered</tt>.
</li></ul>
<pre> <Frame>
<object> <i><b>TERM</b></i> </object>
<slot ordered="yes"> <i><b>TERM</b></i> <i><b>TERM</b></i> </slot>*
</Frame>
</pre>
<p><span class="anchor" id="ex-56"></span>
</p>
<div class="example">
<p><b>Example 8.6.</b> The example shows the RIF XML serialization of an expression that states that the object denoted by the variable <i>?customer</i> has the value denoted by the string <i>"Gold"</i> for the property identified by the symbol <i>status</i> that is defined in the example namespace <i>http://example.com/2009/prd2#</i>
</p>
<pre><Frame>
<object> <Var> ?customer </Var> </object>
<slot ordered="yes">
<Const type="rif:iri">
http://example.com/2009/prd2#status
</Const>
<Const type="xsd:string> Gold </Const>
</slot>
</Frame>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-external-atomic"></span>
</p>
<a id="External_2" name="External_2"></a><h5> <span class="mw-headline">8.3.2.6 External </span></h5>
<p>In RIF-PRD, the <tt>External</tt> element is also used to serialize an <a href="#def-prd-atomic" title="">externally defined atomic formula</a>, in addition to <a href="#sec-external-term" title="">serializing externally defined functions</a>.
</p><p>When it is an <tt>ATOMIC</tt> (as opposed to a <tt>TERM</tt>; that is, in particular, when it appears in a place where an <tt>ATOMIC</tt> is expected, and not a <tt>TERM</tt>), the <tt>External</tt> element contains one <tt>content</tt> element that contains one <tt>Atom</tt> element. The <tt>Atom</tt> element serializes the <a href="#def-prd-atomic" title="">externally defined atom</a> properly said:
</p><p>The <tt>op</tt> <tt>Const</tt> in the <tt>Atom</tt> element must be a symbol of type <tt>rif:iri</tt> that must uniquely identify the externally defined predicate to be applied to the <tt>args TERM</tt>s.
</p>
<pre> <External>
<content>
<i><b>Atom</b></i>
</content>
</External>
</pre>
<p><span class="anchor" id="ex-57"></span>
</p>
<div class="example">
<p><b>Example 8.7.</b> The example below shows the RIF XML serialization of an externally defined atomic formula that tests whether the value denoted by the variable named <i>?value</i> is greater than or equal to the integer value <i>2000</i>, where the test is intended to behave like the built-in predicate pred:numeric-greater-than-or-equal as specified in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>]:
</p><p>RIF built-in predicates are associated with the namespace <i><a class="external free" href="http://www.w3.org/2007/rif-builtin-predicate" title="http://www.w3.org/2007/rif-builtin-predicate#">http://www.w3.org/2007/rif-builtin-predicate#</a></i>.
</p>
<pre><External>
<content>
<Atom>
<op> <Const type="rif:iri"> http://www.w3.org/2007/rif-builtin-predicate#numeric-greater-than-or-equal </Const> </op>
<args ordered="yes">
<Var> ?value </Var>
<Const type="xsd:integer"> 2000 </Const>
</args>
</Atom>
</content>
</External>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-FORMULA"></span>
</p>
<a id="FORMULA" name="FORMULA"></a><h4> <span class="mw-headline">8.3.3 FORMULA </span></h4>
<p>The <tt>FORMULA</tt> class is used to serialize <a href="#def-bld-formula" title="">condition formulas</a>, that is, atomic formulas, conjunctions, disjunctions, negations and existentials.
</p><p>As an abstract class, <tt>FORMULA</tt> is not associated with specific XML markup in RIF-PRD instance documents.
</p>
<pre> [ <i><b>ATOMIC</b></i> | <i><b>And</b></i> | <i><b>Or</b></i> | <i><b>INeg</b></i> | <i><b>Exists</b></i> ]
</pre>
<p><span class="anchor" id="sec-atomic-formula"></span>
</p>
<a id="ATOMIC_2" name="ATOMIC_2"></a><h5> <span class="mw-headline">8.3.3.1 ATOMIC </span></h5>
<p>An <a href="#def-prd-atomic-formula" title="">atomic formula</a> is serialized using a single <tt>ATOMIC</tt> statement. See specification of <a href="#sec-ATOMIC" title="">ATOMIC</a>, above.
</p><p><span class="anchor" id="sec-and"></span>
</p>
<a id="And" name="And"></a><h5> <span class="mw-headline">8.3.3.2 And </span></h5>
<p>A <a href="#def-bld-formula" title="">conjunction</a> is serialized using the <tt>And</tt> element.
</p><p>The <tt>And</tt> element contains zero or more <tt>formula</tt> sub-elements, each containing an element of the <tt>FORMULA</tt> group, that serializes one of the conjuncts.
</p>
<pre> <And>
<formula> <i><b>FORMULA</b></i> </formula>*
</And>
</pre>
<p><span class="anchor" id="sec-or"></span>
</p>
<a id="Or" name="Or"></a><h5> <span class="mw-headline">8.3.3.3 Or </span></h5>
<p>A <a href="#def-bld-formula" title="">disjunction</a> is serialized using the <tt>Or</tt> element.
</p><p>The <tt>Or</tt> element contains zero or more <tt>formula</tt> sub-elements, each containing an element of the <tt>FORMULA</tt> group, that serializes one of the disjuncts.
</p>
<pre> <Or>
<formula> <i><b>FORMULA</b></i> </formula>*
</Or>
</pre>
<p><span class="anchor" id="sec-ineg"></span>
</p>
<a id="INeg" name="INeg"></a><h5> <span class="mw-headline">8.3.3.4 INeg </span></h5>
<p>The kind of <a href="#def-bld-formula" title="">negation</a> that is used in RIF-PRD is serialized using the <tt>INeg</tt> element.
</p><p>The <tt>Negate</tt> element contains exactly one <tt>formula</tt> sub-element. The <tt>formula</tt> element contains an element of the <tt>FORMULA</tt> group, that serializes the negated statement.
</p>
<pre> <INeg>
<formula> <i><b>FORMULA</b></i> </formula>
</INeg>
</pre>
<p><span class="anchor" id="sec-exists"></span>
</p>
<a id="Exists" name="Exists"></a><h5> <span class="mw-headline">8.3.3.5 Exists </span></h5>
<p>An <a href="#def-bld-formula" title="">existentially quantified formula</a> is serialized using the <tt>Exists</tt> element.
</p><p>The <tt>Exists</tt> element contains:
</p>
<ul><li> one or more <tt>declare</tt> sub-elements, each containing one <a href="#sec-var" title=""><tt>Var</tt></a> element that serializes one of the existentially quantified variables;
</li><li> exactly one required <tt>formula</tt> sub-element that contains an element from the <tt>FORMULA</tt> abstract class, that serializes the formula in the scope of the quantifier.
</li></ul>
<pre> <Exists>
<declare> <i><b>Var</b></i> </declare>+
<formula> <i><b>FORMULA</b></i> </formula>
</Exists>
</pre>
<p><span class="anchor" id="ex-58"></span>
</p>
<div class="example">
<p><b>Example 8.8.</b> The example shows the RIF XML serialization of a condition on the existence of a value greater than or equal to 2.000, in the <i>Gold rule</i> of the <a href="#sec-running-example" title="">running example</a>, as represented in <a href="#ref-ex42" title="">example 4.2</a>.
</p>
<pre><Exists>
<declare> <Var> ?value </Var> </declare>
<formula>
<And>
<Frame>
<object> <Var> ?shoppingCart </Var> </object>
<slot ordered="yes">
<Const type="rif:iri">
http://example.com/2009/prd2#value
</Const>
<Var> ?value </Var>
</slot>
</Frame>
<External>
<content>
<Atom>
<op> <Const type="rif:iri"> http://www.w3.org/2007/rif-builtin-predicate#numeric-greater-than-or-equal </Const> </op>
<args ordered="yes">
<Var> ?value </Var>
<Const type="xsd:integer"> 2000 </Const>
</args>
</Atom>
</content>
</External>
</And>
</formula>
</Exists>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-xml-actions"></span>
</p>
<a id="Actions_3" name="Actions_3"></a><h3> <span class="mw-headline">8.4 Actions </span></h3>
<p>This section specifies the XML syntax that is used to serialize the action part of a rule supported by RIF-PRD.
</p>
<a id="ACTION" name="ACTION"></a><h4> <span class="mw-headline">8.4.1 ACTION </span></h4>
<p>The <tt>ACTION</tt> class of elements is used to serialize the <a href="#def-simple-action" title="">actions</a>: <i>assert</i>, <i>retract</i>, <i>modify</i> and <i>execute</i>.
</p><p>As an abstract class, <tt>ACTION</tt> is not associated with specific XML markup in RIF-PRD instance documents.
</p>
<pre> [ <i><b>Assert</b></i> | <i><b>Retract</b></i> | <i><b>Modify</b></i> | <i><b>Execute</b></i> ]
</pre>
<p><span class="anchor" id="sec-assert"></span>
</p>
<a id="Assert" name="Assert"></a><h5> <span class="mw-headline">8.4.1.1 Assert </span></h5>
<p>An <a href="#def-atomic-action" title="">atomic assertion action</a> is serialized using the <tt>Assert</tt> element.
</p><p>The <tt>Assert</tt> element has one <tt>target</tt> sub-element that contains an <tt>Atom</tt>, a <tt>Frame</tt> or a <tt>Member</tt> element that represents the target of the action.
</p><p><br />
</p>
<pre> <Assert>
<target> [ <i><b>Atom</b></i> | <i><b>Frame</b></i> | <i><b>Member</b></i> ] </target>
</Assert>
</pre>
<p><span class="anchor" id="sec-retract"></span>
</p>
<a id="Retract" name="Retract"></a><h5> <span class="mw-headline">8.4.1.2 Retract </span></h5>
<p>The <tt>Retract</tt> construct is used to serialize <a href="#def-atomic-action" title="">retract atomic actions</a>.
</p><p>The <tt>Retract</tt> element has one <tt>target</tt> sub-element that contains an <tt>Atom</tt>, a <tt>Frame</tt>, a <tt>TERM</tt>, or a pair of <tt>TERM</tt> constructs that represent the target of the action. The <tt>target</tt> element has an optional attribute, <tt>ordered</tt>, that MUST be present when the element contains two <tt>TERM</tt> sub-elements: the order of the sub-elements is significant and MUST be preserved. This is emphasized by the required value "<tt>yes</tt>" of the attribute.
</p>
<pre> <Retract>
<target ordered="yes"?>
[ <i><b>Atom</b></i> | <i><b>Frame</b></i> | <i><b>TERM</b></i> | <i><b>TERM TERM</b></i> ]
</target>
</Retract>
</pre>
<p><span class="anchor" id="sec-modify"></span>
</p>
<a id="Modify" name="Modify"></a><h5> <span class="mw-headline">8.4.1.3 Modify </span></h5>
<p>A <a href="#def-compound-action" title="">compound modification</a> is serialized using the <tt>Modify</tt> element.
</p><p>The <tt>Modify</tt> element has one <tt>target</tt> sub-element that contains one <tt>Frame</tt> that represents the target of the action.
</p>
<pre> <Modify>
<target> <i><b>Frame</b></i> </target>
</Modify>
</pre>
<p><br />
<span class="anchor" id="ex-59"></span>
</p>
<div class="example">
<p><b>Example 8.9.</b> The example shows the RIF XML representation of the action that updates the status of a customer, in the <i>Gold rule</i>, in the <a href="#sec-running-example" title="">running example</a>, as represented in <a href="#ref-ex42" title="">example 4.2</a>: <tt>Modify(?customer[status->"Gold"])</tt>
</p>
<pre><Modify>
<target>
<Frame>
<object>
<Var> ?customer </Var>
</object>
<slot ordered="yes">
<Const type="rif:iri"> http://example.com/2009/prd2#status </Const>
<Const type="xsd:string"> Gold </Const>
</slot>
</Frame>
</target>
</Modify>
</pre>
<p>The action could be equivalently serialized as the sequence of a <tt>Retract</tt> and an <tt>Assert</tt> atomic actions:
</p>
<pre><Retract>
<target ordered="yes">
<Var> ?customer </Var>
<Const type="rif:iri"> http://example.com/2009/prd2#status </Const>
</target>
</Retract>
<Assert>
<target>
<Frame>
<object>
<Var> ?customer </Var>
</object>
<slot ordered="yes">
<Const type="rif:iri"> http://example.com/2009/prd2#status </Const>
<Const type="xsd:string"> Gold </Const>
</slot>
</Frame>
</target>
</Assert>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-execute"></span>
</p>
<a id="Execute" name="Execute"></a><h5> <span class="mw-headline">8.4.1.4 Execute </span></h5>
<p>The <a href="#def-atomic-action" title="">execution of an externally defined action</a> is serialized using the <tt>Execute</tt> element.
</p><p>The <tt>Execute</tt> element has one <tt>target</tt> sub-element that contains an <tt>Atom</tt>, that represents the externally defined action to be executed.
</p><p>The <tt>op</tt> <tt>Const</tt> in the <a href="#sec-atom" title=""><tt>Atom</tt> element</a> must be a symbol of type <tt>rif:iri</tt> that must uniquely identify the <a href="#sec-builtin-actions" title="">externally defined action</a> to be applied to the <tt>args TERM</tt>s.
</p>
<pre> <Execute>
<target> <i><b>Atom</b></i> </target>
</Execute>
</pre>
<div class="example">
<p><b>Example 8.10.</b> The example shows the RIF XML serialization of the message printing action, in the <i>Unknonw status rule</i>, in the <a href="#sec-running-example" title="">running example</a>, using the <a href="#sec-act-print" title=""><tt>act:print</tt></a> action built-in.
</p><p>The namespace for RIF-PRD action built-ins is <i>http://www.w3.org/2007/rif-builtin-action#</i>.
</p>
<pre><Execute>
<target>
<Atom>
<op>
<Constant type="rif:iri"> http://www.w3.org/2007/rif-builtin-action#print </Const>
</op>
<args ordered="yes">
<External>
<content>
<Expr>
<op>
<Constant type="rif:iri"> http://www.w3.org/2007/rif-builtin-function#concat </Const>
</op>
<args ordered="yes">
<Const type="xsd:string> New customer: </Const>
<var> ?customer </var>
</args>
</Expr>
</content>
</External>
</args>
</Atom>
</target>
</Execute>
</pre>
<p>☐
</p>
</div>
<a id="ACTION_BLOCK" name="ACTION_BLOCK"></a><h4> <span class="mw-headline">8.4.2 ACTION_BLOCK </span></h4>
<p>The <tt>ACTION_BLOCK</tt> class of constructs is used to represent the <a href="#sec-action-blocks" title="">conclusion, or action part, of a production rule</a> serialized using RIF-PRD.
</p><p>If action variables are declared in the action part of a rule, or if some <a href="#def-simple-action" title="">actions</a> are not assertions, the conclusion must be serialized as a full <a href="#def-action-block" title="">action block</a>, using the <tt>Do</tt> element. However, simple action blocks that contain only one or more assert actions SHOULD be serialized like the conclusions of logic rules using <a href="#ref-core" title="">RIF-Core</a> or <a href="#ref-rif-bld" title="">RIF-BLD</a>, that is, as a single asserted <tt>Atom</tt> or <tt>Frame</tt>, or as a conjunction of the asserted facts, using the <tt>And</tt> element.
</p><p>In the latter case, to conform with the <a href="#def-wf-action-block" title="">definition of an action block well-formedness</a>, the formulas that serialize the individual conjuncts MUST be atomic <tt>Atom</tt>s and/or <tt>Frame</tt>s.
</p><p>As an abstract class, <tt>ACTION_BLOCK</tt> is not associated with specific XML markup in RIF-PRD instance documents.
</p>
<pre> [ <i><b>Do</b></i> | <i><b>And</b></i> | <i><b>Atom</b></i> | <i><b>Frame</b></i> ]
</pre>
<a id="New" name="New"></a><h5> <span class="mw-headline">8.4.2.1 New </span></h5>
<p>The <tt>New</tt> element is used to serialize the construct used to create a new frame identifer, in an <a href="#def-action-variable-declaration" title="">action variable declaration</a>.
</p><p>The <tt>New</tt> element is always empty.
</p>
<pre> <New />
</pre>
<a id="Do" name="Do"></a><h5> <span class="mw-headline">8.4.2.2 Do </span></h5>
<p>An <a href="#def-action-block" title="">action block</a> is serialized using the <tt>Do</tt> element.
</p><p>A <tt>Do</tt> element contains:
</p>
<ul><li> zero or more <tt>actionVar</tt> sub-elements, each of them used to serialize one <a href="#def-action-variable-declaration" title="">action variable declaration</a>. Accordingly, an <tt>actionVar</tt> element must contain a <tt>Var</tt> sub-element, that serializes the declared variable; followed by the serialization of an <a href="#def-action-variable-declaration" title="">action variable binding</a>, that assigns an initial value to the declared variable, that is: either a <tt>frame</tt> or the empty element <tt>New</tt>;
</li><li> one <tt>actions</tt> sub-element that serializes the sequence of actions in the action block, and that contains, accordingly, a sequence of one or more sub-elements of the <tt>ACTION</tt> class. The order of the actions is significant, and the order MUST be preserved, as emphasized by the required <tt>ordered="yes"</tt> attribute.
</li></ul>
<pre> <Do>
<actionVar ordered="yes">
<i><b>Var</b></i>
[ <i><b>New</b></i> | <i><b>Frame</b></i> ]
</actionVar>*
<actions ordered="yes">
<i><b>ACTION</b></i>+
</actions>
</Do>
</pre>
<p><span class="anchor" id="ex-511"></span>
</p>
<div class="example">
<p><b>Example 8.11.</b> The example shows the RIF XML serialization of an action block that asserts that a customer gets a new $5 voucher.
</p>
<pre><Do>
<actionVar ordered="yes">
<Var>?voucher</Var>
<New />
</actionVar>
<actions ordered="yes">
<Assert>
<target>
<Member>
<instance><Var>?voucher</Var></instance>
<class>
<Const type="rif:iri">http://example.com/2009/prd2#Voucher</Const>
</class>
</Member>
</target>
</Assert>
<Assert>
<target>
<Frame>
<object><Var>?voucher</Var></object>
<slot ordered="yes">
<Const type="rif:iri">http://example.com/2009/prd2#value</Const>
<Const type="xsd:integer">5</Const>
</slot>
</Frame>
</target>
</Assert>
<Assert>
<target>
<Frame>
<object><Var>?customer</Var></object>
<slot ordered="yes">
<Const type="rif:iri">http://example.com/2009/prd2#voucher</Const>
<Var>?voucher</Var>
</slot>
</Frame>
</target>
</Assert>
</actions>
</Do>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-rules-and-groups"></span>
</p>
<a id="Rules_and_Groups" name="Rules_and_Groups"></a><h3> <span class="mw-headline">8.5 Rules and Groups </span></h3>
<p>This section specifies the XML constructs that are used, in RIR-PRD, to serialize <a href="#def-rule" title="">rules</a> and <a href="#def-group" title="">groups</a>.
</p><p><span class="anchor" id="sec-RULE"></span>
</p>
<a id="RULE" name="RULE"></a><h4> <span class="mw-headline">8.5.1 RULE </span></h4>
<p>In RIF-PRD, the <tt>RULE</tt> class of constructs is used to serialize <a href="#def-rule" title="">rules</a>, that is, unconditional as well as conditional actions, or rules with bound variables.
</p><p>As an abstract class, <tt>RULE</tt> is not associated with specific XML markup in RIF-PRD instance documents.
</p>
<pre> [ <i><b>Implies</b></i> | <i><b>Forall</b></i> | <i><b>ACTION_BLOCK</b></i> ]
</pre>
<p><span class="anchor" id="sec-action-rule"></span>
</p>
<a id="ACTION_BLOCK_2" name="ACTION_BLOCK_2"></a><h5> <span class="mw-headline">8.5.1.1 ACTION_BLOCK </span></h5>
<p>An <a href="#def-rule" title="">unconditional action block</a> is serialized, in RIF-PRD XML, using the <tt>ACTION_BLOCK</tt> class of construct.
</p><p><span class="anchor" id="sec-implies"></span>
</p>
<a id="Implies" name="Implies"></a><h5> <span class="mw-headline">8.5.1.2 Implies </span></h5>
<p><a href="#def-rule" title="">Conditional actions</a> are serialized, in RIF-PRD, using the XML element <tt>Implies</tt>.
</p><p>The <tt>Implies</tt> element contains an <tt>if</tt> sub-element and a <tt>then</tt> sub-element:
</p>
<ul><li> the required <tt>if</tt> element contains an element from the <tt>FORMULA</tt> class of constructs, that serializes the condition of the rule;
</li><li> the required <tt>then</tt> element contains one element from the <tt>ACTION_BLOCK</tt> class of constructs, that serializes its conlusion.
</li></ul>
<pre> <Implies>
<if> <i><b>FORMULA</b></i> </if>
<then> <i><b>ACTION_BLOCK</b></i> </then>
</Implies>
</pre>
<p><span class="anchor" id="sec-forall"></span>
</p>
<a id="Forall" name="Forall"></a><h5> <span class="mw-headline">8.5.1.3 Forall </span></h5>
<p>The <tt>Forall</tt> construct is used, in RIF-PRD, to represent <a href="#def-rule" title="">rules with bound variables</a>.
</p><p>The <tt>Forall</tt> element contains:
</p>
<ul><li> one or more <tt>declare</tt> sub-elements, each containing one <tt>Var</tt> element that represents one of the declared rule variables;
</li><li> zero or more <tt>pattern</tt> sub-elements, each containing one element from the <tt>FORMULA</tt> group of constructs, that serializes one <a href="#def-rule" title="">pattern</a>;
</li><li> exactly one <tt>formula</tt> sub-element that serializes the formula in the scope of the variables binding, and that contains an element of the <tt>RULE</tt> group.
</li></ul>
<pre> <Forall>
<declare> <i><b>Var</b></i> </declare>+
<pattern> <i><b>FORMULA</b></i> </pattern>*
<formula> <i><b>RULE</b></i> </formula>
</Forall>
</pre>
<p><span class="anchor" id="ex-512"></span>
</p>
<div class="example">
<p><b>Example 8.12.</b> The example shows the rule variables declaration part of the <i>Gold rule</i>, from the <a href="#sec-running-example" title="">running example</a>, as represented in <a href="#ref-ex42" title="">example 4.2</a>.
</p>
<pre><Forall>
<declare><Var>?customer</Var></declare>
<pattern>
<And>
<formula><Member> ... </Member></formula>
<formula><Frame> ... </Frame></formula>
</And>
</pattern>
<formula>
<Forall>
<declare><Var>?shoppingCart</Var></declare>
<pattern><Member> ... </Member></pattern>
<formula>
<Implies> ... </Implies>
</formula>
</Forall>
</formula>
</Forall>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-group"></span>
</p>
<a id="Group" name="Group"></a><h4> <span class="mw-headline">8.5.2 Group </span></h4>
<p>The <tt>Group</tt> construct is used to serialize a <a href="#def-group" title="">group</a>.
</p><p>The <tt>Group</tt> element has zero or one <tt>behavior</tt> sub-element and zero or more <tt>sentence</tt> sub-elements:
</p>
<ul><li> the <tt>behavior</tt> element contains
<ul><li> zero or one <tt>ConflictResolution</tt> sub-element that contains exactly one IRI. The IRI identifies the conflict resolution strategy that is associated with the <tt>Group</tt>;
</li><li> zero or one <tt>Priority</tt> sub-element that contains exactly one signed integer between -10,000 and 10,000. The integer associates a priority with the <tt>Group</tt>'s sentences;
</li></ul>
</li><li> a <tt>sentence</tt> element contains either a <tt>Group</tt> element or an element of the <tt>RULE</tt> abstract class of constructs.
</li></ul>
<pre> <Group>
<behavior>
<ConflictResolution> <i><b>xsd:anyURI</b></i> </ConflictResolution>?
<Priority> <i><b>-10,000 ≤ xsd:int ≤ 10,000</b></i> </Priority>?
</behavior>?
<sentence> [ <i><b>RULE</b></i> | <i><b>Group</b></i> ] </sentence>*
</Group>
</pre>
<p><span class="anchor" id="sec-directives"></span>
</p>
<a id="Document_and_directives" name="Document_and_directives"></a><h3> <span class="mw-headline">8.6 Document and directives </span></h3>
<a id="Import" name="Import"></a><h4> <span class="mw-headline">8.6.1 Import </span></h4>
<p>The <tt>Import</tt> directive is used to serialize the reference to an RDF graph or an OWL ontology to be combined with a RIF document. The <tt>Import</tt> directive is inherited from [<a href="#ref-core" title="">RIF-Core</a>]. Its abstract syntax and its semantics are specified in [<a href="#ref-rif-rdf-owl" title="">RIF-RDF-OWL</a>].
</p><p>The <tt>Import</tt> directive contains:
</p>
<ul><li> exactly one <tt>location</tt> sub-element, that contains an IRI, that serializes the location of the RDF or OWL document to be combined with the RIF document;
</li><li> zero or one <tt>profile</tt> sub-element, that contains an IRI. The admitted values for that constant and their semantics are listed in the section Profiles of Imports, in [<a href="#ref-rif-rdf-owl" title="">RIF-RDF-OWL</a>].
</li></ul>
<pre> <Import>
<location> <i><b>xsd:anyURI</b></i> </location>
<profile> <i><b>xsd:anyURI</b></i> </profile>?
</Import>
</pre>
<p><span class="anchor" id="sec-document"></span>
</p>
<a id="Document" name="Document"></a><h4> <span class="mw-headline">8.6.2 Document </span></h4>
<p>The <tt>Document</tt> is the root element of any RIF-PRD instance document.
</p><p>The <tt>Document</tt> contains zero or more <tt>directive</tt> sub-elements, each containing an <tt>Import</tt> directive, and zero or one <tt>payload</tt> sub-element, that must contain a <tt>Group</tt> element.
</p>
<pre> <Document>
<directive> <i><b>Import</b></i> </Import>*
<payload> <i><b>Group</b></i> </payload>?
</Document>
</pre>
<p>The semantics of a document that imports RDF and/or OWL documents is specified in [<a href="#ref-rif-rdf-owl" title="">RIF-RDF-OWL</a>] and [<a href="#ref-rif-bld" title="">RIF-BLD</a>]. The semantics of a document that does not import other documents is the semantics of the rule set that is serialised by the <tt>Group</tt> in the <tt>document</tt>'s <tt>payload</tt> sub-element, if any.
</p><p><br />
<span class="anchor" id="sec-constructs-carrying-no-semantics"></span>
</p>
<a id="Constructs_carrying_no_semantics" name="Constructs_carrying_no_semantics"></a><h3> <span class="mw-headline">8.7 Constructs carrying no semantics </span></h3>
<p><span class="anchor" id="sec-metadata"></span>
</p>
<a id="Annotation" name="Annotation"></a><h4> <span class="mw-headline">8.7.1 Annotation </span></h4>
<p>Annotations can be associated with any concrete class element in RIF-PRD: those are the elements with a CamelCase tagname starting with an upper-case character:
</p>
<pre> CLASSELT = [ <i><b>TERM</b></i> | <i><b>ATOMIC</b></i> | <i><b>FORMULA</b></i> | <i><b>ACTION</b></i> | <i><b>ACTION_BLOCK</b></i> | <i><b>New</b></i> | <i><b>RULE</b></i> | <i><b>Group</b></i> | <i><b>Document</b></i> | <i><b>Import</b></i> ]
</pre>
<p>An identifier can be associated to any instance element of the abstract <tt>CLASSELT</tt> class of constructs, as an optional <tt>id</tt> sub-element that MUST contain a <tt>Const</tt> of type <tt>rif:iri</tt>.
</p><p>Annotations can be included in any instance of a concrete class element using the <tt>meta</tt> sub-element.
</p><p>The <tt>Frame</tt> construct is used to serialize annotations: the content of the <tt>Frame</tt>'s <tt>object</tt> sub-element identifies the object to which the annotation is associated:, and the <tt>Frame</tt>'s <tt>slot</tt>s represent the annotation properly said as property-value pairs.
</p><p>If all the annotations are related to the same object, the <tt>meta</tt> element can contain a single <tt>Frame</tt> sub-element. If annotations related to several different objects need be serialized, the <tt>meta</tt> role element can contain an <tt>And</tt> element with zero or more <tt>formula</tt> sub-elements, each containing one <tt>Frame</tt> element, that serializes the annotations relative to one identified object.
</p>
<pre> <<i>any concrete element in CLASSELT</i>>
<id> <i><b>Const</b></i> </id>?
<meta>
[ <i><b>Frame</b></i>
|
<And>
<formula> <i><b>Frame</b></i> </formula>*
</And>
]
</meta>?
<i><b>other CLASSELT content</b></i>
</<i>any concrete element in CLASSELT</i>>
</pre>
<p>Notice that the content of the <tt>meta</tt> sub-element of an instance of a RIF-PRD class element is not necessarily associated to that same instance element: only the content of the <tt>object</tt> sub-element of the <tt>Frame</tt> that represents the annotations specifies what the annotations are about, not where it is included in the instance RIF document.
</p><p>It is suggested to use Dublin Core, RDFS, and OWL properties for annotations, along the lines of <a class="external free" href="http://www.w3.org/TR/owl-ref/#Annotations" title="http://www.w3.org/TR/owl-ref/#Annotations">http://www.w3.org/TR/owl-ref/#Annotations</a> -- specifically owl:versionInfo, rdfs:label, rdfs:comment, rdfs:seeAlso, rdfs:isDefinedBy, dc:creator, dc:description, dc:date, and foaf:maker.
</p><p><span class="anchor" id="ex-513"></span>
</p>
<div class="example">
<p><b>Example 8.13.</b> The example shows the structure of the document that contains the <a href="#sec-running-example" title="">runnig example rule set</a>, as represented in <a href="#ref-ex42" title="">example 4.2</a>, including annotations such as rule set and rule names.
</p>
<pre><Document>
<payload>
<Group>
<id><Const type="rif:iri">http://example.com/2009/prd2#CheckoutRuleSet</Const></id>
<meta>
<Frame>
<object><Const type="rif:iri">http://example.com/2009/prd2#CheckoutRuleSet</Const></object>
<slot ordered="yes">
<Const type="rif:iri">http://dublincore.org/documents/dcmi-namespace/#creator</Const>
<Const type="xsd:string>W3C RIF WG</Const>
</slot>
<slot>
<Const type="rif:iri">http://dublincore.org/documents/dcmi-namespace/#description</Const>
<Const type="xsd:string">Running example rule set from the RIF-PRD specification</Const>
</slot>
</Frame>
</meta>
<behavior> ... </behavior>
<sentence>
<Group>
<id><Const type="rif:iri">http://example.com/2009/prd2#GoldRule</Const></id>
<behavior> ... </behavior>
<sentence><Forall> ... </Forall></sentence>
</Group>
</sentence>
<sentence>
<Group>
<id><Const type="rif:iri">http://example.com/2009/prd2#DiscountRule</Const></id>
<sentence><Forall> ... </Forall></sentence>
</Group>
</sentence>
</Group>
</payload>
</Document>
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-presentation-syntax"></span>
</p>
<a id="Presentation_syntax_.28Informative.29" name="Presentation_syntax_.28Informative.29"></a><h2> <span class="mw-headline">9 Presentation syntax (Informative) </span></h2>
<p>To make it easier to read, a non-normative, lightweight notation was introduced to complement the mathematical English specification of the abstract syntax and the semantics of RIF-PRD. This section specifies a presentation syntax for RIF-PRD, that extends that notation. The presentation syntax is not normative. However, it may help implementers by providing a more succinct overview of RIF-PRD syntax.
</p><p>The EBNF for the RIF-PRD presentation syntax is given as follows. For convenience of reading we show the entire EBNF in its four parts (rules, conditions, actions, and annotations).
</p><p><span class="anchor" id="part-rule-language"></span>
<b>Rule Language:</b>
</p>
<pre> Document ::= IRIMETA? 'Document' '(' Base? Prefix* Import* Group? ')'
Base ::= 'Base' '(' ANGLEBRACKIRI ')'
Prefix ::= 'Prefix' '(' Name ANGLEBRACKIRI ')'
Import ::= IRIMETA? 'Import' '(' LOCATOR PROFILE? ')'
Group ::= IRIMETA? 'Group' Strategy? Priority? '(' (RULE | Group)* ')'
Strategy ::= Const
Priority ::= Const
RULE ::= (IRIMETA? 'Forall' Var+ (' such that ' FORMULA+)? '(' RULE ')') | CLAUSE
CLAUSE ::= Implies | ACTION_BLOCK
Implies ::= IRIMETA? 'If' FORMULA 'Then' ACTION_BLOCK
LOCATOR ::= ANGLEBRACKIRI
PROFILE ::= ANGLEBRACKIRI
</pre>
<p><span class="anchor" id="part-action-language"></span>
<b>Action Language:</b>
</p>
<pre> ACTION ::= IRIMETA? (Assert | Retract | Modify | Execute )
Assert ::= 'Assert' '(' IRIMETA? (Atom | Frame | Member) ')'
Retract ::= 'Retract' '(' ( IRIMETA? (Atom | Frame) | TERM | TERM TERM ) ')'
Modify ::= 'Modify' '(' IRIMETA? Frame ')'
Execute ::= 'Execute' '(' IRIMETA? Atom ')'
ACTION_BLOCK ::= IRIMETA? ('Do (' ('(' IRIMETA? Var IRIMETA? (Frame | 'New()') ')')* ACTION+ ')' |
'And (' ( IRIMETA? (Atom | Frame) )* ')' | Atom | Frame)
</pre>
<p><span class="anchor" id="part-condition-language"></span>
<b>Condition Language:</b>
</p>
<pre> FORMULA ::= IRIMETA? 'And' '(' FORMULA* ')' |
IRIMETA? 'Or' '(' FORMULA* ')' |
IRIMETA? 'Exists' (IRIMETA? Var)+ '(' FORMULA ')' |
ATOMIC |
IRIMETA? NEGATEDFORMULA |
IRIMETA? Equal |
IRIMETA? Member |
IRIMETA? Subclass |
IRIMETA? 'External' '(' IRIMETA? Atom ')'
ATOMIC ::= IRIMETA? (Atom | Frame)
Atom ::= UNITERM
UNITERM ::= (IRIMETA? Const) '(' (TERM* ')'
GROUNDUNITERM ::= (IRIMETA? Const) '(' (GROUNDTERM* ')'
NEGATEDFORMULA ::= 'Not' '(' FORMULA ')' | 'INeg' '(' FORMULA ')'
Equal ::= TERM '=' TERM
Member ::= TERM '#' TERM
Subclass ::= TERM '##' TERM
Frame ::= TERM '[' (TERM '->' TERM)* ']'
TERM ::= IRIMETA? (Const | Var | List | 'External' '(' Expr ')')
GROUNDTERM ::= IRIMETA? (Const | List | 'External' '(' GROUNDUNITERM ')')
Expr ::= UNITERM
List ::= 'List' '(' GROUNDTERM* ')'
Const ::= '"' UNICODESTRING '"^^' SYMSPACE | CONSTSHORT
Var ::= '?' Name
Name ::= NCName
SYMSPACE ::= ANGLEBRACKIRI | CURIE
</pre>
<p><br />
<span class="anchor" id="part-annotations"></span>
<b>Annotations:</b>
</p>
<pre> IRIMETA ::= '(*' IRICONST? (Frame | 'And' '(' Frame* ')')? '*)'
</pre>
<p>A NEGATEDFORMULA can be written using either <i>Not</i> or <i>INeg</i>. <i>INeg</i> is short for <i>inflationary negation</i> and is preferred over 'Not' to avoid ambiguity about the semantics of the negation.
</p><p>The RIF-PRD presentation syntax does not commit to any particular vocabulary and permits arbitrary Unicode strings in constant symbols, argument names, and variables. Constant symbols can have this form: <tt>"UNICODESTRING"^^SYMSPACE</tt>, where <tt>SYMSPACE</tt> is an <tt>ANGLEBRACKIRI</tt> or <tt>CURIE</tt> that represents the identifier of the symbol space of the constant, and <tt>UNICODESTRING</tt> is a Unicode string from the lexical space of that symbol space. <tt>ANGLEBRACKIRI</tt> and <tt>CURIE</tt> are defined in the section Shortcuts for Constants in RIF's Presentation Syntax in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>]. Constant symbols can also have several shortcut forms, which are represented by the non-terminal <tt>CONSTSHORT</tt>. These shortcuts are also defined in the same section of [<a href="#ref-rif-dtb" title="">RIF-DTB</a>]. One of them is the <tt>CURIE</tt> shortcut, which is extensively used in the examples in this document.
Names are XML <tt>NCName</tt>s. Variables are composed of <tt>NCName</tt> symbols prefixed with a <tt>?</tt>-sign.
</p>
<div class="example">
<p><b>Example 9.1.</b> Here is the transcription, in the RIF-PRD presentation syntax, of the complete RIF-PRD document corresponding to the <a href="#sec-running-example" title="">running example</a>:
</p>
<pre>Document(
Prefix( ex1 <http://example.com/2009/prd2> )
(* ex1:CheckoutRuleset *)
Group rif:forwardChaining (
(* ex1:GoldRule *)
Group 10 (
Forall ?customer such that (And( ?customer # ex1:Customer
?customer[status->"Silver"] ))
(Forall ?shoppingCart such that (?customer[shoppingCart->?shoppingCart])
(If Exists ?value (And( ?shoppingCart[value->?value]
pred:numeric-greater-than-or-equal(?value 2000))
Then Do( Modify( ?customer[status->"Gold"] ) ) ) ) ) )
(* ex1:DiscountRule *)
Group (
Forall ?customer such that (And( ?customer # ex1:Customer ) )
(If Or( ?customer[status->"Silver"]
?customer[status->"Gold"] )
Then Do( (?s ?customer[shoppingCart->?s])
(?v ?s[value->?v])
Modify( ?s[value->func:numeric-multiply(?v 0.95)] ) ) ) )
(* ex1:NewCustomerAndWidgetRule *)
Group
Forall ?customer such that (And( ?customer # ex1:Customer
?customer[status->"New"] ) )
(If Exists ?shoppingCart ?item
( And ( ?customer[shoppingCart->?shoppingCart]
?shoppingCart[containsItem->?item]
?item # ex1:Widget ) ) )
Then Do( (?s ?customer[shoppingCart->?s])
(?val ?s[value->?val])
(?voucher ?customer[voucher->?voucher])
Retract( ?customer[voucher->?voucher] )
Retract( ?voucher )
Modify( ?s[value->func:numeric-multiply(?val 0.90)] ) ) ) )
(* ex1:UnknownStatusRule *)
Group (
Forall ?customer such that ( ?customer # ex1:Customer )
(If Not(Exists ?status
(And( ?customer[status->?status]
External(pred:list-contains(List("New", "Bronze", "Silver", "Gold"), ?status)) )))
Then Do( Execute( <a href="#sec-act-print" title="">act:print</a>(func:concat("New customer: " ?customer)) )
Assert( ?customer[status->"New"] ) ) ) ) )
)
</pre>
<p>☐
</p>
</div>
<p><span class="anchor" id="sec-acknowledgements"></span>
</p>
<a id="Acknowledgements" name="Acknowledgements"></a><h2> <span class="mw-headline">10 Acknowledgements </span></h2>
<p>This document is the product of the Rules Interchange Format (RIF) Working Group (see below) whose
members deserve recognition for their time and commitment. The editors extend special thanks to Harold Boley and Changhai Ke for their thorough reviews and insightful discussions; the working group chairs, Chris Welty and Christian de Sainte Marie, for their invaluable technical help and inspirational leadership; and W3C staff contact Sandro Hawke, a constant source of ideas, help, and feedback.
</p><p><br />
The regular attendees at meetings of the Rule Interchange Format (RIF) Working Group at the time of the publication were:
Adrian Paschke (Freie Universitaet Berlin),
Axel Polleres (DERI),
Changhai Ke (IBM),
Chris Welty (IBM),
Christian de Sainte Marie (IBM),
Dave Reynolds (HP),
Gary Hallmark (ORACLE),
Harold Boley (NRC),
Hassan Aït-Kaci (IBM),
Jos de Bruijn (FUB),
Leora Morgenstern (IBM),
Michael Kifer (Stony Brook),
Mike Dean (BBN),
Sandro Hawke (W3C/MIT), and
Stella Mitchell (IBM).
</p><p><span class="anchor" id="sec-references"></span>
</p>
<a id="References" name="References"></a><h2> <span class="mw-headline">11 References </span></h2>
<a id="Normative_references" name="Normative_references"></a><h3> <span class="mw-headline">11.1 Normative references </span></h3>
<p><span class="anchor" id="ref-prr"></span>
</p>
<dl><dt> [OMG-PRR]
</dt><dd> <i><a class="external text" href="http://www.omg.org/spec/PRR/1.0/Beta1/" title="http://www.omg.org/spec/PRR/1.0/Beta1/">Production Rule Representation (PRR)</a></i>, OMG specification, version 1.0, 2007.
</dd></dl>
<p><span class="anchor" id="ref-rdf-concepts"></span>
</p>
<dl><dt> [RDF-CONCEPTS]
</dt><dd> <i>Resource Description Framework (RDF): Concepts and Abstract Syntax</i>, Klyne G., Carroll J. (Editors), W3C Recommendation, 10 February 2004, <a class="external free" href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/" title="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/">http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/</a>. Latest version available at <a class="external free" href="http://www.w3.org/TR/rdf-concepts/" title="http://www.w3.org/TR/rdf-concepts/">http://www.w3.org/TR/rdf-concepts/</a>.
</dd></dl>
<p><span class="anchor" id="ref-rdf-schema"></span>
</p>
<dl><dt> [RDF-SCHEMA]
</dt><dd> <i>RDF Vocabulary Description Language 1.0: RDF Schema</i>, Brian McBride, Editor, W3C Recommendation 10 February 2004, <a class="external free" href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/" title="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/">http://www.w3.org/TR/2004/REC-rdf-schema-20040210/</a>. Latest version available at <a class="external free" href="http://www.w3.org/TR/rdf-schema/" title="http://www.w3.org/TR/rdf-schema/">http://www.w3.org/TR/rdf-schema/</a>.
</dd></dl>
<p><span class="anchor" id="ref-rfc-3066"></span>
</p>
<dl><dt> [RFC-3066]
</dt><dd> <i><a class="external" href="http://tools.ietf.org/html/rfc3066" title="http://tools.ietf.org/html/rfc3066">RFC 3066</a> - Tags for the Identification of Languages</i>, H. Alvestrand, IETF, January 2001, at <a class="external free" href="http://www.ietf.org/rfc/rfc3066" title="http://www.ietf.org/rfc/rfc3066">http://www.ietf.org/rfc/rfc3066</a>.
</dd></dl>
<p><span class="anchor" id="ref-rfc-3987"></span>
</p>
<dl><dt> [RFC-3987]
</dt><dd> <i><a class="external" href="http://tools.ietf.org/html/rfc3987" title="http://tools.ietf.org/html/rfc3987">RFC 3987</a> - Internationalized Resource Identifiers (IRIs)</i>, M. Duerst and M. Suignard, IETF, January 2005, <a class="external free" href="http://www.ietf.org/rfc/rfc3987.txt" title="http://www.ietf.org/rfc/rfc3987.txt">http://www.ietf.org/rfc/rfc3987.txt</a>.
</dd></dl>
<p><span class="anchor" id="ref-rif-bld"></span>
</p>
<dl><dt> [RIF-BLD]
</dt><dd><span><cite><a href="http://www.w3.org/TR/2010/REC-rif-bld-20100622/"><span>RIF Basic Logic Dialect</span></a></cite> Harold Boley, Michael Kifer, eds. W3C Recommendation, 22 June 2010, <a href="http://www.w3.org/TR/2010/REC-rif-bld-20100622/">http://www.w3.org/TR/2010/REC-rif-bld-20100622/</a>. Latest version available at <a href="http://www.w3.org/TR/rif-bld/">http://www.w3.org/TR/rif-bld/</a>.</span></dd></dl>
<p><span class="anchor" id="ref-core"></span>
</p>
<dl><dt> [RIF-Core]
</dt><dd><span><cite><a href="http://www.w3.org/TR/2010/REC-rif-core-20100622/"><span>RIF Core Dialect</span></a></cite> Harold Boley, Gary Hallmark, Michael Kifer, Adrian Paschke, Axel Polleres, Dave Reynolds, eds. W3C Recommendation, 22 June 2010, <a href="http://www.w3.org/TR/2010/REC-rif-core-20100622/">http://www.w3.org/TR/2010/REC-rif-core-20100622/</a>. Latest version available at <a href="http://www.w3.org/TR/rif-core/">http://www.w3.org/TR/rif-core/</a>.</span></dd></dl>
<p><span class="anchor" id="ref-rif-dtb"></span>
</p>
<dl><dt> [RIF-DTB]
</dt><dd><span><cite><a href="http://www.w3.org/TR/2010/REC-rif-dtb-20100622/"><span>RIF Datatypes and Built-Ins 1.0</span></a></cite> Axel Polleres, Harold Boley, Michael Kifer, eds. W3C Recommendation, 22 June 2010, <a href="http://www.w3.org/TR/2010/REC-rif-dtb-20100622/">http://www.w3.org/TR/2010/REC-rif-dtb-20100622/</a>. Latest version available at <a href="http://www.w3.org/TR/rif-dtb/">http://www.w3.org/TR/rif-dtb/</a>.</span></dd></dl>
<p><span class="anchor" id="ref-fld"></span>
</p>
<dl><dt> [RIF-FLD]
</dt><dd><span><cite><a href="http://www.w3.org/TR/2010/REC-rif-fld-20100622/"><span>RIF Framework for Logic Dialects</span></a></cite> Harold Boley, Michael Kifer, eds. W3C Recommendation, 22 June 2010, <a href="http://www.w3.org/TR/2010/REC-rif-fld-20100622/">http://www.w3.org/TR/2010/REC-rif-fld-20100622/</a>. Latest version available at <a href="http://www.w3.org/TR/rif-fld/">http://www.w3.org/TR/rif-fld/</a>.</span></dd></dl>
<p><span class="anchor" id="ref-rif-rdf-owl"></span>
</p>
<dl><dt> [RIF-RDF-OWL]
</dt><dd><span><cite><a href="http://www.w3.org/TR/2010/REC-rif-rdf-owl-20100622/"><span>RIF RDF and OWL Compatibility</span></a></cite> Jos de Bruijn, editor. W3C Recommendation, 22 June 2010, <a href="http://www.w3.org/TR/2010/REC-rif-rdf-owl-20100622/">http://www.w3.org/TR/2010/REC-rif-rdf-owl-20100622/</a>. Latest version available at <a href="http://www.w3.org/TR/rif-rdf-owl/">http://www.w3.org/TR/rif-rdf-owl/</a>.</span></dd></dl>
<p><span class="anchor" id="ref-xdm"></span>
</p>
<dl><dt> [XDM]
</dt><dd> <i>XQuery 1.0 and XPath 2.0 Data Model (XDM)</i>, W3C Recommendation, World Wide Web Consortium, 23 January 2007. This version is <a class="external free" href="http://www.w3.org/TR/2007/REC-xpath-datamodel-20070123/" title="http://www.w3.org/TR/2007/REC-xpath-datamodel-20070123/">http://www.w3.org/TR/2007/REC-xpath-datamodel-20070123/</a>. Latest version available at <a class="external free" href="http://www.w3.org/TR/xpath-datamodel/" title="http://www.w3.org/TR/xpath-datamodel/">http://www.w3.org/TR/xpath-datamodel/</a>.
</dd></dl>
<p><span class="anchor" id="xml-base"></span>
</p>
<dl><dt> [XML-Base]
</dt><dd> <i>XML Base (second edition)</i>, W3C Recommendation, World Wide Web Consortium, 28 January 2009, <a class="external free" href="http://www.w3.org/TR/2009/REC-xmlbase-20090128/" title="http://www.w3.org/TR/2009/REC-xmlbase-20090128/">http://www.w3.org/TR/2009/REC-xmlbase-20090128/</a>. Latest version available at <a class="external free" href="http://www.w3.org/TR/xmlbase/" title="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>.
</dd></dl>
<p><span class="anchor" id="ref-xml-schema2"></span>
</p>
<dl><dt> [XML-SCHEMA2]
</dt><dd> <i>XML Schema Part 2: Datatypes Second Edition</i>, W3C Recommendation, World Wide Web Consortium, 28 October 2004, <a class="external free" href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/" title="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/">http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/</a>. Latest version available at <a class="external free" href="http://www.w3.org/TR/xmlschema-2/" title="http://www.w3.org/TR/xmlschema-2/">http://www.w3.org/TR/xmlschema-2/</a>.
</dd></dl>
<p><span class="anchor" id="ref-xpath-functions"></span>
</p>
<dl><dt> [XPath-Functions]
</dt><dd> <i>XQuery 1.0 and XPath 2.0 Functions and Operators</i>, W3C Recommendation, World Wide Web Consortium, 23 January 2007, <a class="external free" href="http://www.w3.org/TR/2007/REC-xpath-functions-20070123/" title="http://www.w3.org/TR/2007/REC-xpath-functions-20070123/">http://www.w3.org/TR/2007/REC-xpath-functions-20070123/</a>. Latest version available at <a class="external free" href="http://www.w3.org/TR/xpath-functions/" title="http://www.w3.org/TR/xpath-functions/">http://www.w3.org/TR/xpath-functions/</a>.
</dd></dl>
<a id="Informational_references" name="Informational_references"></a><h3> <span class="mw-headline">11.2 Informational references </span></h3>
<p><span class="anchor" id="ref-matching"></span>
</p>
<dl><dt> [CIR04]
</dt><dd> <i><a class="external text" href="http://hal.inria.fr/docs/00/28/09/38/PDF/rete.formalisation.pdf" title="http://hal.inria.fr/docs/00/28/09/38/PDF/rete.formalisation.pdf">Production Systems and Rete Algorithm Formalisation</a></i>, Cirstea H., Kirchner C., Moossen M., Moreau P.-E. Rapport de recherche n° inria-00280938 - version 1 (2004).
</dd></dl>
<p><span class="anchor" id="ref-curie"></span>
</p>
<dl><dt>[CURIE]
</dt><dd> <i><a class="external text" href="http://www.w3.org/TR/2009/CR-curie-20090116" title="http://www.w3.org/TR/2009/CR-curie-20090116">CURIE Syntax 1.0</a></i>, M. Birbeck, S. McCarron, W3C Candidate Recommendation, 16 January 2009, <a class="external free" href="http://www.w3.org/TR/2009/CR-curie-20090116" title="http://www.w3.org/TR/2009/CR-curie-20090116">http://www.w3.org/TR/2009/CR-curie-20090116</a>. <a class="external text" href="http://www.w3.org/TR/curie/" title="http://www.w3.org/TR/curie/">Latest version</a> available at <a class="external free" href="http://www.w3.org/TR/curie/" title="http://www.w3.org/TR/curie/">http://www.w3.org/TR/curie/</a>.
</dd></dl>
<p><span class="anchor" id="ref-enderton01"></span>
</p>
<dl><dt> [Enderton01]
</dt><dd> <i>A Mathematical Introduction to Logic, Second Edition</i>, H. B. Enderton. Academic Press, 2001.
</dd></dl>
<p><span class="anchor" id="ref-fitting"></span>
</p>
<dl><dt> [FIT02]
</dt><dd> <i><a class="external text" href="http://ii.fmph.uniba.sk/~sefranek/links/FixPointSurvey.pdf" title="http://ii.fmph.uniba.sk/~sefranek/links/FixPointSurvey.pdf">Fixpoint Semantics for Logic Programming: A Survey</a></i>, Melvin Fitting, Theoretical Computer Science. Vol. 278, no. 1-2, pp. 25-51. 6 May 2002.
</dd></dl>
<p><span class="anchor" id="ref-substitution"></span>
</p>
<dl><dt> [HAK07]
</dt><dd> <i><a class="external text" href="http://www.cs.brown.edu/people/pvh/CPL/Papers/v1/hak.pdf" title="http://www.cs.brown.edu/people/pvh/CPL/Papers/v1/hak.pdf">Data Models as Constraint Systems: A Key to the Semantic Web</a></i>, Hassan Ait-Kaci, Constraint Programming Letters, 1:33--88, 2007.
</dd></dl>
<p><span class="anchor" id="ref-klw95"></span>
</p>
<dl><dt> [KLW95]
</dt><dd> <i>Logical foundations of object-oriented and frame-based languages,</i> M. Kifer, G. Lausen, J. Wu. Journal of ACM, July 1995, pp. 741--843.
</dd></dl>
<p><span class="anchor" id="ref-mendelson97"></span>
</p>
<dl><dt> [Mendelson97]
</dt><dd> <i>Introduction to Mathematical Logic, Fourth Edition</i>, E. Mendelson. Chapman & Hall, 1997.
</dd></dl>
<p><span class="anchor" id="ref-ltts"></span>
</p>
<dl><dt> [PLO04]
</dt><dd> <i><a class="external text" href="http://homepages.inf.ed.ac.uk/gdp/publications/sos_jlap.pdf" title="http://homepages.inf.ed.ac.uk/gdp/publications/sos_jlap.pdf">A Structural Approach to Operational Semantics</a></i>, Gordon D. Plotkin, Journal of Logic and Algebraic Programming, Volumes 60-61, Pages 17-139 (July - December 2004).
</dd></dl>
<p><span class="anchor" id="appendix-model-theory"></span>
</p>
<a id="Appendix:_Model-theoretic_semantics_of_RIF-PRD_condition_formulas" name="Appendix:_Model-theoretic_semantics_of_RIF-PRD_condition_formulas"></a><h2> <span class="mw-headline">12 Appendix: Model-theoretic semantics of RIF-PRD condition formulas </span></h2>
<p>This appendix provides an alternative specification of the <a href="#sec-semantics-of-condition-formulas" title="">Semantics of condition formulas</a>, and it is also normative.
</p><p>This alternative specification is provided for the convenience of the reader, for compatibility with other RIF specifications, such as [<a href="#ref-rif-dtb" title="">RIF-DTB</a>] and [<a href="#ref-rif-rdf-owl" title="">RIF-RDF-OWL</a>], and to make explicit the interoperability with RIF logic dialects, in particular [<a href="#ref-core" title="">RIF-Core</a>] and [<a href="#ref-rif-bld" title="">RIF-BLD</a>].
</p><p><span class="anchor" id="sec-semantic-structures"></span>
</p>
<a id="Semantic_structures" name="Semantic_structures"></a><h4> <span class="mw-headline">12.1 Semantic structures </span></h4>
<p>The key concept in a model-theoretic semantics of a logic language is the notion of a semantic structure [Enderton01, Mendelson97].
</p><p><span class="anchor" id="def-sem-struct"></span>
<b>Definition (Semantic structure)</b>.
A <i><b>semantic structure</b></i>, <i><b>I</b></i>, is a tuple of the form
<<i><b>TV</b></i>, <i><b>DTS</b></i>, <i><b>D</b></i>, <i><b>D</b></i><sub>ind</sub>,
<i><b>D</b></i><sub>func</sub>, <i><b>I</b></i><sub>C</sub>, <i><b>I</b></i><sub>V</sub>, <i><b>I</b></i><sub>list</sub>, <i><b>I</b></i><sub>tail</sub>,
<i><b>I</b></i><sub>P</sub>, <i><b>I</b></i><sub>frame</sub>,
<i><b>I</b></i><sub>sub</sub>, <i><b>I</b></i><sub>isa</sub>, <i><b>I</b></i><sub>=</sub>,
<i><b>I</b></i><sub>external</sub>, <i><b>I</b></i><sub>truth</sub>>. Here <i><b>D</b></i> is a non-empty set of elements called the <i><b>Herbrand domain</b></i> of <i><b>I</b></i>, that is, the set of all ground terms which can be formed by using the elements of <tt>Const</tt>. <i><b>D</b></i><sub>ind</sub>, <i><b>D</b></i><sub>func</sub> are nonempty subsets of <i><b>D</b></i>. <i><b>D</b></i><sub>ind</sub> is used to interpret the elements of <tt>Const</tt> that are individuals and <i><b>D</b></i><sub>func</sub> is used to interpret the elements of <tt>Const</tt> that are function symbols. <tt>Const</tt> denotes the set of all constant symbols and <tt>Var</tt> the set of all variable symbols. <i><b>TV</b></i> denotes the set of truth values that the semantic structure uses and <i><b>DTS</b></i> is a set of identifiers for primitive datatypes (please refer to Section Datatypes in the RIF data types and builtins specification [<a href="#ref-rif-dtb" title="">RIF-DTB</a>] for the semantics of datatypes).
</p><p>As far as the assignment of a standard meaning to formulas in the RIF-PRD condition language is concerned, the set <i><b>TV</b></i> of truth values consists of just two values, <b>t</b> and <b>f</b>.
</p><p>The other components of <i><b>I</b></i> are <i>total</i> mappings defined as follows:
</p>
<ol>
<li>
<i><b>I</b></i><sub>C</sub> maps <tt>Const</tt> to <i><b>D</b></i>.
<p>
This mapping interprets constant symbols. In addition:
</p>
<ul>
<li>
If a constant, <tt>c</tt> ∈ <tt>Const</tt>,
is an <i>individual</i> then it is required that
<i><b>I</b></i><sub>C</sub>(<tt>c</tt>) ∈ <i><b>D</b></i><sub>ind</sub>.
</li>
<li>
If <tt>c</tt> ∈ <tt>Const</tt>, is a <i>function symbol</i> then it is required that <i><b>I</b></i><sub>C</sub>(<tt>c</tt>) ∈ <i><b>D</b></i><sub>func</sub>.
</li>
</ul>
</li>
<li>
<i><b>I</b></i><sub>V</sub> maps <tt>Var</tt> to <i><b>D</b></i><sub>ind</sub>.
<p>This mapping interprets variable symbols.</p>
</li>
<li><i><b>I</b></i><sub>list</sub> and <i><b>I</b></i><sub>tail</sub> are used to interpret lists. They are mappings of the following form:
<ul>
<li>
<i><b>I</b></i><sub>list</sub> : <i><b>D</b></i><sub>ind</sub><sup>*</sup> → <i><b>D</b></i><sub>ind</sub>
</li>
<li>
<i><b>I</b></i><sub>tail</sub> : <i><b>D</b></i><sub>ind</sub><sup>+</sup>×<i><b>D</b></i><sub>ind</sub> → <i><b>D</b></i><sub>ind</sub>
</li>
</ul>
<p>
In addition, these mappings are required to satisfy the following conditions:
</p>
<ul>
<li>
<i><b>I</b></i><sub>list</sub> is an injective one-to-one function.
</li>
<li>
<i><b>I</b></i><sub>list</sub>(<i><b>D</b></i><sub>ind</sub>) is disjoint from the value spaces of all data types in <i><b>DTS</b></i>.
</li>
<li>
<i><b>I</b></i><sub>tail</sub>(<tt>a</tt><sub>1</sub>, ..., <tt>a</tt><sub>k</sub>, <i><b>I</b></i><sub>list</sub>(<tt>a</tt><sub>k+1</sub>, ..., <tt>a</tt><sub>k+m</sub>)) = <i><b>I</b></i><sub>list</sub>(<tt>a</tt><sub>1</sub>, ..., <tt>a</tt><sub>k</sub>, <tt>a</tt><sub>k+1</sub>, ..., <tt>a</tt><sub>k+m</sub>).
</li>
</ul>
<p>
Note that the last condition above restricts <i><b>I</b></i><sub>tail</sub> only when its last argument is in <i><b>I</b></i><sub>list</sub>(<i><b>D</b></i><sub>ind</sub>), the image of <i><b>I</b></i><sub>list</sub>. If the last argument of <i><b>I</b></i><sub>tail</sub> is not in <i><b>I</b></i><sub>list</sub>(<i><b>D</b></i><sub>ind</sub>), then the list is malformed and there are no restrictions on the value of <i><b>I</b></i><sub>tail</sub> except that it must be in <i><b>D</b></i><sub>ind</sub>.
</p>
</li>
<li>
<i><b>I</b></i><sub>P</sub> maps <i><b>D</b></i> to functions <i><b>D*</b></i><sub>ind</sub> → <i><b>D</b></i> (here <i><b>D*</b></i><sub>ind</sub> is a set of all sequences of any finite length over the domain <i><b>D</b></i><sub>ind</sub>).
<p>This mapping interprets positional terms atoms.</p>
</li>
<li><i><b>I</b></i><sub>frame</sub> maps <i><b>D</b></i><sub>ind</sub> to total functions of the form <tt>SetOfFiniteBags</tt>(<i><b>D</b></i><sub>ind</sub> × <i><b>D</b></i><sub>ind</sub>) → <i><b>D</b></i>.
<p>This mapping interprets frame terms. An argument, <tt>d</tt> ? <i><b>D</b></i><sub>ind</sub>, to <i><b>I</b></i><sub>frame</sub> represents an object and the finite bag {<<tt>a1,v1</tt>>, ..., <<tt>ak,vk</tt>>} represents a bag of attribute-value pairs for <tt>d</tt>. We will see shortly how <i><b>I</b></i><sub>frame</sub> is used to determine the truth valuation of frame terms. </p>
<p>Bags (multi-sets) are used here because the order of the attribute/value pairs in a frame is immaterial and pairs may repeat. Such repetitions arise naturally when variables are instantiated with constants. For instance, <tt>o[?A->?B ?C->?D]</tt> becomes <tt>o[a->b a->b]</tt> if variables <tt>?A</tt> and <tt>?C</tt> are instantiated with the symbol <tt>a</tt> while <tt>?B</tt> and <tt>?D</tt> are instantiated with <tt>b</tt>. (We shall see later that <tt>o[a->b a->b]</tt> is equivalent to <tt>o[a->b]</tt>.)
</p>
</li>
<li><i><b>I</b></i><sub>sub</sub> gives meaning to the subclass relationship. It is a mapping of the form <i><b>D</b></i><sub>ind</sub> × <i><b>D</b></i><sub>ind</sub> → <i><b>D</b></i>.
<p>The operator <tt>##</tt> is required to be transitive, i.e., <tt>c1 ## c2</tt> and <tt>c2 ## c3</tt> must imply <tt>c1 ## c3</tt>. TThis is ensured by a restriction in Section <a href="#sec-interpretation-of-formulas" title="">Interpretation of condition formulas</a>; </p>
</li>
<li><i><b>I</b></i><sub>isa</sub> gives meaning to class membership. It is a mapping of the form <i><b>D</b></i><sub>ind</sub> × <i><b>D</b></i><sub>ind</sub> → <i><b>D</b></i>.
<p>The relationships <tt>#</tt> and <tt>##</tt> are required to have the usual property that all members of a subclass are also members of the superclass, i.e., <tt>o # cl</tt> and <tt>cl ## scl</tt> must imply <tt>o # scl</tt>. This is ensured by a restriction in Section <a href="#sec-interpretation-of-formulas" title="">Interpretation of condition formulas</a>; </p>
</li>
<li><i><b>I</b></i><sub>=</sub> is a mapping of the form <i><b>D</b></i><sub>ind</sub> × <i><b>D</b></i><sub>ind</sub> → <i><b>D</b></i>.
<p>It gives meaning to the equality operator.</p>
</li>
<li>
<i><b>I</b></i><sub>truth</sub> is a mapping of the form <i><b>D</b></i> → <i><b>TV</b></i>.
<p>It is used to define truth valuation for formulas.</p>
</li>
<li>
<i><b>I</b></i><sub>external</sub> is a mapping from the coherent set of schemas for externally defined functions to total functions <i><b>D</b></i>* → <i><b>D</b></i>. For each external schema <tt>σ = (?X<sub>1</sub> ... ?X<sub>n</sub>; τ)</tt> in the coherent set of external schemas associated with the language, <i><b>I</b></i><sub>external</sub>(<tt>σ</tt>) is a function of the form <i><b>D</b></i><sup>n</sup> → <i><b>D</b></i>.
<p>
For every external schema, <tt>σ</tt>, associated with the language, <i><b>I</b></i><sub>external</sub>(<tt>σ</tt>) is assumed to be specified externally in some document (hence the name <i>external schema</i>). In particular, if <tt>σ</tt> is a schema of a RIF built-in predicate, function or action, <i><b>I</b></i><sub>external</sub>(<tt>σ</tt>) is specified so that:
</p>
<ul>
<li>
If <tt>σ</tt> is a schema of a built-in function then <i><b>I</b></i><sub>external</sub>(<tt>σ</tt>) must be the function defined in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>];
</li>
<li>
If <tt>σ</tt> is a schema of a built-in predicate then
<i><b>I</b></i><sub>truth</sub><tt> ο </tt>(<i><b>I</b></i><sub>external</sub>(<tt>σ</tt>)) (the composition of <i><b>I</b></i><sub>truth</sub> and <i><b>I</b></i><sub>external</sub>(<tt>σ</tt>), a truth-valued function) must be as specified in [<a href="#ref-rif-dtb" title="">RIF-DTB</a>];
</li>
<li>
If <tt>σ</tt> is a schema of a built-in action then
<i><b>I</b></i><sub>truth</sub><tt> ο </tt>(<i><b>I</b></i><sub>external</sub>(<tt>σ</tt>)) (the composition of <i><b>I</b></i><sub>truth</sub> and <i><b>I</b></i><sub>external</sub>(<tt>σ</tt>), a truth-valued function) must be as specified in the <a href="#sec-builtin-actions" title="">section Built-in actions</a> in this document.
</li>
</ul>
</li>
</ol>
<p>For convenience, we also define the following mapping <i><b>I</b></i> from terms to <i><b>D</b></i>:
</p>
<ul><li> <i><b>I</b></i>(<tt>k</tt>) = <i><b>I</b></i><sub>C</sub>(<tt>k</tt>), if <tt>k</tt> is a symbol in <tt>Const</tt>;
</li><li> <i><b>I</b></i>(<tt>?v</tt>) = <i><b>I</b></i><sub>V</sub>(<tt>?v</tt>), if <tt>?v</tt> is a variable in <tt>Var</tt>;
</li><li> For list terms, the mapping is defined as follows:
<ul><li> <i><b>I</b></i>(<tt>List( )</tt>) = <i><b>I</b></i><sub>list</sub>(<tt><></tt>). Here <tt><></tt> denotes an empty list of elements of <i><b>D</b></i><sub>ind</sub>. (Note that the domain of <i><b>I</b></i><sub>list</sub> is <i><b>D</b></i><sub>ind</sub><sup>*</sup>, so <i><b>D</b></i><sub>ind</sub><sup>0</sup> is an empty list of elements of <i><b>D</b></i><sub>ind</sub>.)
</li><li> <i><b>I</b></i>(<tt>List(t</tt><sub>1</sub> ... <tt>t</tt><sub>n</sub>)) = <i><b>I</b></i><sub>list</sub>(<i><b>I</b></i>(<tt>t</tt><sub>1</sub>), ..., <i><b>I</b></i>(<tt>t</tt><sub>n</sub>)), if <tt>n>0</tt>.
</li><li> <i><b>I</b></i>(<tt>List(t</tt><sub>1</sub> ... <tt>t</tt><sub>n</sub> | <tt>t</tt>)) = <i><b>I</b></i><sub>tail</sub>(<i><b>I</b></i>(<tt>t</tt><sub>1</sub>), ..., <i><b>I</b></i>(<tt>t</tt><sub>n</sub>), <i><b>I</b></i>(<tt>t</tt>)), if <tt>n>0</tt>.
</li></ul>
</li><li> <i><b>I</b></i>(<tt>p(t<sub>1</sub> ... t<sub>n</sub>)</tt>) = <i><b>I</b></i><sub>P</sub>(<i><b>I</b></i>(<tt>p</tt>))(<i><b>I</b></i>(<tt>t<sub>1</sub></tt>),...,<i><b>I</b></i>(<tt>t<sub>n</sub></tt>));
</li><li> <i><b>I</b></i>(<tt>o[a<sub>1</sub>->v<sub>1</sub> ... a<sub>k</sub>->v<sub>k</sub>]</tt>) = <i><b>I</b></i><sub>frame</sub>(<i><b>I</b></i>(<tt>o</tt>))({<<i><b>I</b></i>(<tt>a<sub>1</sub></tt>),<i><b>I</b></i>(<tt>v<sub>1</sub></tt>)>, ..., <<i><b>I</b></i>(<tt>a<sub>n</sub></tt>),<i><b>I</b></i>(<tt>v<sub>n</sub></tt>)>})<br />Here {...} denotes a bag of attribute/value pairs.
</li><li> <i><b>I</b></i>(<tt>c1##c2</tt>) = <i><b>I</b></i><sub>sub</sub>(<i><b>I</b></i>(<tt>c1</tt>), <i><b>I</b></i>(<tt>c2</tt>));
</li><li> <i><b>I</b></i>(<tt>o#c</tt>) = <i><b>I</b></i><sub>isa</sub>(<i><b>I</b></i>(<tt>o</tt>), <i><b>I</b></i>(<tt>c</tt>));
</li><li> <i><b>I</b></i>(<tt>x=y</tt>) = <i><b>I</b></i><sub>=</sub>(<i><b>I</b></i>(x), <i><b>I</b></i>(y));
</li><li> <i><b>I</b></i>(<tt>External(t)</tt>) = <i><b>I</b></i><sub>external</sub>(<tt>σ</tt>)(<i><b>I</b></i>(<tt>s<sub>1</sub></tt>), ..., <i><b>I</b></i>(<tt>s<sub>n</sub></tt>)), if <tt>t</tt> is an instance of the external schema <tt>σ = (?X<sub>1</sub> ... ?X<sub>n</sub>; τ)</tt> by substitution <tt>?X<sub>1</sub>/s<sub>1</sub> ... ?X<sub>n</sub>/s<sub>1</sub></tt>.<br />Note that, by definition, <tt>External(t)</tt> is well-formed only if <tt>t</tt> is an instance of an external schema. Furthermore, by the definition of coherent sets of external schemas, <tt>t</tt> can be an instance of at most one such schema, so <i><b>I</b></i>(<tt>External(t)</tt>) is well-defined.
</li></ul>
<p><i><b>The effect of datatypes.</b></i> The set <i><b>DTS</b></i> must include the datatypes described in Section Primitive Datatypes of the RIF data types and builtins specification [<a href="#ref-rif-dtb" title="">RIF-DTB</a>].
</p><p>The datatype identifiers in <i><b>DTS</b></i> impose the following restrictions. Given <tt>dt</tt> ∈ <i><b>DTS</b></i>, let <i><b>LS</b></i><sub>dt</sub> denote the lexical space of <tt>dt</tt>, <i><b>VS</b></i><sub>dt</sub> denote its value space, and <i><b>L</b></i><sub>dt</sub>: <i><b>LS</b></i><sub>dt</sub> → <i><b>VS</b></i><sub>dt</sub> the lexical-to-value-space mapping (for the definitions of these concepts, see Section Primitive Datatypes of the RIF data types and builtins specification [<a href="#ref-rif-dtb" title="">RIF-DTB</a>]. Then the following must hold:
</p>
<ul><li> <i><b>VS</b></i><sub>dt</sub> ⊆ <i><b>D</b></i><sub>ind</sub>; and
</li><li> For each constant <tt>"lit"^^dt</tt> such that <tt>lit</tt> ∈ <i><b>LS</b></i><sub>dt</sub>, <i><b>I</b></i><sub>C</sub>(<tt>"lit"^^dt</tt>) = <i><b>L</b></i><sub>dt</sub>(<tt>lit</tt>).
</li></ul>
<p>That is, <i><b>I</b></i><sub>C</sub> must map the constants of a datatype <tt>dt</tt> in accordance with <i><b>L</b></i><sub>dt</sub>.
</p><p>RIF-PRD does not impose restrictions on <i><b>I</b></i><sub>C</sub> for constants in symbol spaces that are not datatypes included in <i><b>DTS</b></i>. ☐
</p><p><span class="anchor" id="sec-interpretation-of-formulas"></span>
</p>
<a id="Interpretation_of_condition_formulas" name="Interpretation_of_condition_formulas"></a><h4> <span class="mw-headline">12.2 Interpretation of condition formulas </span></h4>
<p>This section defines how a semantic structure, <i><b>I</b></i>, determines
the truth value <i>TVal</i><sub>I</sub>(<tt>φ</tt>) of a condition formula, <tt>φ</tt>.
</p><p>We define a mapping, <i>TVal</i><sub>I</sub>, from the set of all condition formulas to <i><b>TV</b></i>. Note that the definition implies that <i>TVal</i><sub>I</sub>(<tt>φ</tt>) is defined <em>only if</em> the set <i><b>DTS</b></i> of the datatypes of <i><b>I</b></i> includes all the datatypes mentioned in <tt>φ</tt> and <i><b>I</b></i><sub>external</sub> is defined on all externally defined functions and predicates in <tt>φ</tt>.
</p><p><span class="anchor" id="def-bld-truth"></span>
<b>Definition (Truth valuation)</b>.
<i><b>Truth valuation</b></i> for well-formed condition formulas in RIF-PRD is determined using the following function, denoted <i>TVal</i><sub>I</sub>:
</p>
<ul><li> <i>Positional atomic formulas</i>: <i>TVal</i><sub>I</sub>(<tt>r(t<sub>1</sub> ... t<sub>n</sub>)</tt>) = <i><b>I</b></i><sub>truth</sub>(<i><b>I</b></i>(<tt>r(t<sub>1</sub> ... t<sub>n</sub>)</tt>));
</li><li> <i>Equality</i>: <i>TVal</i><sub>I</sub>(<tt>x = y</tt>) = <i><b>I</b></i><sub>truth</sub>(<i><b>I</b></i>(<tt>x = y</tt>)).<br />To ensure that equality has precisely the expected properties, it is required that:
<ul><li> <i><b>I</b></i><sub>truth</sub>(<i><b>I</b></i>(<tt>x = y</tt>)) = <b>t</b> if <i><b>I</b></i>(<tt>x</tt>) = <i><b>I</b></i>(<tt>y</tt>) and that <i><b>I</b></i><sub>truth</sub>(<i><b>I</b></i>(<tt>x = y</tt>)) = <b>f</b> otherwise. This is tantamount to saying that <i>TVal</i><sub>I</sub>(<tt>x = y</tt>) = <b>t</b> iff <i><b>I</b></i>(x) = <i><b>I</b></i>(y);
</li></ul>
</li><li> <i>Subclass</i>: <i>TVal</i><sub>I</sub>(<tt>sc ## cl</tt>) = <i><b>I</b></i><sub>truth</sub>(<i><b>I</b></i>(<tt>sc ## cl</tt>)).<br />To ensure that the operator <tt>##</tt> is transitive, i.e., <tt>c1 ## c2</tt> and <tt>c2 ## c3</tt> imply <tt>c1 ## c3</tt>, the following is required:
<ul><li> For all <tt>c1</tt>, <tt>c2</tt>, <tt>c3</tt> ∈ <i><b>D</b></i>, if <i>TVal</i><sub>I</sub>(<tt>c1 ## c2</tt>) = <i>TVal</i><sub>I</sub>(<tt>c2 ## c3</tt>) = <b>t</b> then <i>TVal</i><sub>I</sub>(<tt>c1 ## c3</tt>) = <b>t</b>;
</li></ul>
</li><li> <i>Membership</i>: <i>TVal</i><sub>I</sub>(<tt>o # cl</tt>) = <i><b>I</b></i><sub>truth</sub>(<i><b>I</b></i>(<tt>o # cl</tt>)).<br />To ensure that all members of a subclass are also members of the superclass, i.e., <tt>o # cl</tt> and <tt>cl ## scl</tt> implies <tt>o # scl</tt>, the following is required:
<ul><li> For all <tt>o</tt>, <tt>cl</tt>, <tt>scl</tt> ∈ <i><b>D</b></i>, if <i>TVal</i><sub>I</sub>(<tt>o # cl</tt>) = <i>TVal</i><sub>I</sub>(<tt>cl ## scl</tt>) = <b>t</b> then <i>TVal</i><sub>I</sub>(<tt>o # scl</tt>) = <b>t</b>;
</li></ul>
</li><li> <i>Frame</i>: <i>TVal</i><sub>I</sub>(<tt>o[a<sub>1</sub>->v<sub>1</sub> ... a<sub>k</sub>->v<sub>k</sub>]</tt>) = <i><b>I</b></i><sub>truth</sub>(<i><b>I</b></i>(<tt>o[a<sub>1</sub>->v<sub>1</sub> ... a<sub>k</sub>->v<sub>k</sub>]</tt>)).<br />Since the bag of attribute/value pairs represents the conjunctions of all the pairs, the following is required, if <tt>k > 0</tt>:
<ul><li> <i>TVal</i><sub>I</sub>(<tt>o[a<sub>1</sub>->v<sub>1</sub> ... a<sub>k</sub>->v<sub>k</sub>]</tt>) = <b>t</b> if and only if <i>TVal</i><sub>I</sub>(<tt>o[a<sub>1</sub>->v<sub>1</sub>]</tt>) = ... = <i>TVal</i><sub>I</sub>(<tt>o[a<sub>k</sub>->v<sub>k</sub>]</tt>) = <b>t</b>;
</li></ul>
</li><li> <i>Externally defined atomic formula</i>: <i>TVal</i><sub>I</sub>(<tt>External(t)</tt>) = <i><b>I</b></i><sub>truth</sub>(<i><b>I</b></i><sub>external</sub>(<tt>σ</tt>)(<i><b>I</b></i>(<tt>s<sub>1</sub></tt>), ..., <i><b>I</b></i>(<tt>s<sub>n</sub></tt>))), if <tt>t</tt> is an atomic formula that is an instance of the external schema <tt>σ = (?X<sub>1</sub> ... ?X<sub>n</sub>; τ)</tt> by substitution <tt>?X<sub>1</sub>/s<sub>1</sub> ... ?X<sub>n</sub>/s<sub>1</sub></tt>.<br />Note that, by definition, <tt>External(t)</tt> is well-formed only if <tt>t</tt> is an instance of an external schema. Furthermore, by the definition of coherent sets of external schemas, <tt>t</tt> can be an instance of at most one such schema, so <i><b>I</b></i>(<tt>External(t)</tt>) is well-defined;
</li><li> <i>Conjunction</i>: <i>TVal</i><sub>I</sub>(<tt>And(</tt>c<sub>1</sub> ... c<sub>n</sub><tt>)</tt>) = <b>t</b> if and only if <i>TVal</i><sub>I</sub>(c<sub>1</sub>) = ... = <i>TVal</i><sub>I</sub>(c<sub>n</sub>) = <b>t</b>. Otherwise, <i>TVal</i><sub>I</sub>(<tt>And(</tt>c<sub>1</sub> ... c<sub>n</sub><tt>)</tt>) = <b>f</b>.<br />The empty conjunction is treated as a tautology, so <i>TVal</i><sub>I</sub>(<tt>And()</tt>) = <b>t</b>;
</li><li> <i>Disjunction</i>: <i>TVal</i><sub>I</sub>(<tt>Or(</tt>c<sub>1</sub> ... c<sub>n</sub><tt>)</tt>) = <b>f</b> if and only if <i>TVal</i><sub>I</sub>(c<sub>1</sub>) = ... = <i>TVal</i><sub>I</sub>(c<sub>n</sub>) = <b>f</b>. Otherwise, <i>TVal</i><sub>I</sub>(<tt>Or(</tt>c<sub>1</sub> ... c<sub>n</sub><tt>)</tt>) = <b>t</b>.<br />The empty disjunction is treated as a contradiction, so <i>TVal</i><sub>I</sub>(<tt>Or()</tt>) = <b>f</b>;
</li><li> <i>Negation</i>: <i>TVal</i><sub>I</sub>(<tt>Not(</tt>c<tt>)</tt>) = <b>f</b> if and only if <i>TVal</i><sub>I</sub>(c) = <b>t</b>. Otherwise, <i>TVal</i><sub>I</sub>(<tt>Not(</tt>c<tt>)</tt>) = <b>t</b>;
</li><li> <i>Existence</i>: <i>TVal</i><sub>I</sub>(<tt>Exists ?v<sub>1</sub> ... ?v<sub>n</sub> (φ)</tt>) = <b>t</b> if and only if for some <i><b>I</b></i>*, described below, <i>TVal</i><sub>I*</sub>(<tt>φ</tt>) = <b>t</b>.<br />Here <i><b>I</b></i>* is a semantic structure of the form <<i><b>TV</b></i>, <i><b>DTS</b></i>, <i><b>D</b></i>, <i><b>D</b></i><sub>ind</sub>, <i><b>D</b></i><sub>pred</sub>, <i><b>I</b></i><sub>C</sub>, <i><b>I</b></i>*<sub>V</sub>, <i><b>I</b></i><sub>P</sub>, <i><b>I</b></i><sub>frame</sub>, <i><b>I</b></i><sub>NP</sub>, <i><b>I</b></i><sub>sub</sub>, <i><b>I</b></i><sub>isa</sub>, <i><b>I</b></i><sub>=</sub>, <i><b>I</b></i><sub>external</sub>, <i><b>I</b></i><sub>truth</sub>>, which is exactly like <i><b>I</b></i>, except that the mapping <i><b>I</b></i>*<sub>V</sub>, is used instead of <i><b>I</b></i><sub>V</sub>. <i><b>I</b></i>*<sub>V</sub> is defined to coincide with <i><b>I</b></i><sub>V</sub> on all variables except, possibly, on <tt>?v<sub>1</sub></tt>,...,<tt>?v<sub>n</sub></tt>. ☐
</li></ul>
<p><span class="anchor" id="sec-satisfaction-of-condition2"></span>
</p>
<a id="Condition_satisfaction_2" name="Condition_satisfaction_2"></a><h4> <span class="mw-headline">12.3 Condition satisfaction </span></h4>
<p>We define, now, what it means for a <i>state of the fact base</i> to satisfy a condition formula. The satisfaction of condition formulas in a state of the fact base provides formal underpinning to the operational semantics of rule sets interchanged using RIF-PRD.
</p><p><span class="anchor" id="def-model"></span>
<b>Definition (Models).</b>
A semantic structure <i><b>I</b></i> is a <i><b>model</b></i> of a condition formula, <tt>φ</tt>, written as <i><b>I</b></i><tt> |= φ</tt>, iff <i>TVal</i><sub>I</sub>(<tt>φ</tt>) = <b>t</b>. ☐
</p><p><br />
<span class="anchor" id="def-herbrand-interpretation"></span>
<b>Definition (Herbrand interpretation).</b> Given a non-empty set of constants, <tt>Const</tt>, the <i>Herbrand domain</i> is the set of all the ground terms that can be formed using the elements of <tt>Const</tt>, and the <i>Herbrand base</i> is the set of all the well-formed ground atomic formulas that can be formed with the elements in the Herbrand domain.
</p><p>A semantic structure, <i><b>I</b></i>, is a <i><b>Herbrand interpretation</b></i>, if the set of all the ground formulas which are true with respect to <i><b>I</b></i> (that is, of which <i><b>I</b></i> is a model), is a subset of the corresponding Herbrand base, <i>B<sub>I</sub></i>. ☐
</p><p>In RIF-PRD, the semantics of condition formulas is defined with respect to semantic structures where the domain, <i><b>D</b></i> is the Herbrand domain that is determined by the set of all the constants, <tt>Const</tt>; that is, with respect to Herbrand interpretations.
</p><p><span class="anchor" id="def-state2"></span>
<b>Definition (State of the fact base).</b> To every Herbrand interpretation <i><b>I</b></i>, we associate a <i><b>state of the fact base</b></i>, <i>w<sub>I</sub></i>, that is represented by the subset of the Herbrand base that contains all the ground atomic formulas of which <i><b>I</b></i> is a model; or, equivalently, by the conjunction of all these ground atomic formulas. ☐
</p><p><span class="anchor" id="def-condition-satisfaction2"></span>
<b>Definition (Condition satisfaction).</b> A RIF-PRD condition formula <tt>φ</tt> is <i><b>satisfied</b></i> in a state of the fact base, <i>w<sub>I</sub></i>, if and only if <i><b>I</b></i> is a model of <tt>φ</tt>. ☐
</p><p>At the syntactic level, the interpretation of the variables by a valuation function <i><b>I</b></i><sub>V</sub> is realized by a <a href="#def-substitution" title="">substitution</a>. As a consequence, a ground substitution <i>σ</i> <a href="#def-matching-substitution" title="">matches</a> a condition formula <i>ψ</i> to a set of ground atomic formulas <i>Φ</i> if and only if <i>σ</i> realizes the valuation function <i><b>I</b></i><sub>V</sub> of a semantics structure <i><b>I</b></i> that is a model of <i>ψ</i> and <i>Φ</i> is a representation of a state of the fact base, <i>w<sub>I</sub></i> (as defined <a href="#def-state2" title="">above</a>), that is associated to <i><b>I</b></i>; that is, if and only if <i>ψ</i> is satisfied in <i>w<sub>I</sub></i> (as defined <a href="#def-condition-satisfaction2" title="">above</a>).
</p><p>This provides the formal link between the <a href="#def-condition-satisfaction2" title="">satisfaction of a condition formula</a>, as defined above, and a <a href="#def-matching-substitution" title="">matching substitution</a>, and, followingly, between the alternative definitions of a state of facts and the satisfaction of a condition, here and in <a href="#sec-semantics-of-condition-formulas" title="">section Semantics of condition formulas</a>.
</p><p><br />
<span class="anchor" id="appendix-xml-schema"></span>
</p>
<a id="Appendix:_XML_schema" name="Appendix:_XML_schema"></a><h2> <span class="mw-headline">13 Appendix: XML schema </span></h2>
<p>The RIF-PRD XML Schema is specified below as a redefinition and an extension of the RIF-Core XML Schema [<a href="#ref-core" title="">RIF-Core</a>] and is also available at <a class="external free" href="http://www.w3.org/2010/rif-schema/prd/" title="http://www.w3.org/2010/rif-schema/prd/">http://www.w3.org/2010/rif-schema/prd/</a>.
</p>
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
targetNamespace="http://www.w3.org/2007/rif#"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns="http://www.w3.org/2007/rif#"
elementFormDefault="qualified">
<xs:import namespace='http://www.w3.org/XML/1998/namespace'
schemaLocation='http://www.w3.org/2001/xml.xsd'/>
<!-- ================================================== -->
<!-- Redefine some elements in the Core Conditions -->
<!-- Extension of the choice -->
<!-- ================================================== -->
<xs:group name="ATOMIC">
<xs:choice>
<xs:element ref="Atom"/>
<xs:element ref="Frame"/>
<xs:element ref="Member"/>
<xs:element ref="Equal"/>
<xs:element ref="Subclass"/> <!-- Subclass is not in RIF-Core -->
<xs:element name="External" type="External-FORMULA.type"/>
</xs:choice>
</xs:group>
<xs:group name="FORMULA">
<xs:choice>
<xs:group ref="ATOMIC"/>
<xs:element ref="And"/>
<xs:element ref="Or"/>
<xs:element ref="Exists"/>
<xs:element ref="INeg"/> <!-- INeg is nt in RIF-Core -->
</xs:choice>
</xs:group>
<!-- ================================================== -->
<!-- Additional elements to the Core Condition schema -->
<!-- ================================================== -->
<xs:element name="Subclass">
<!-- -->
<!-- <Subclass> -->
<!-- <sub> TERM </sub> -->
<!-- <super> TERM </super> -->
<!-- </Subclass> -->
<!-- -->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="sub">
<xs:complexType>
<xs:group ref="TERM" minOccurs="1" maxOccurs="1"/>
</xs:complexType>
</xs:element>
<xs:element name="super">
<xs:complexType>
<xs:group ref="TERM" minOccurs="1" maxOccurs="1"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="INeg">
<!-- -->
<!-- <INeg> -->
<!-- <formula> FORMULA </formula> -->
<!-- </INeg> -->
<!-- -->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="formula" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- ============================================ -->
<!-- CoreCond.xsd starts here -->
<!-- ============================================ -->
<xs:complexType name="External-FORMULA.type">
<!-- sensitive to FORMULA (Atom) context-->
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="content" type="content-FORMULA.type"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="content-FORMULA.type">
<!-- sensitive to FORMULA (Atom) context-->
<xs:sequence>
<xs:element ref="Atom"/>
</xs:sequence>
</xs:complexType>
<xs:element name="And">
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="formula" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Or">
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="formula" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Exists">
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="declare" minOccurs="1" maxOccurs="unbounded"/>
<xs:element ref="formula"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="formula">
<xs:complexType>
<xs:sequence>
<xs:group ref="FORMULA"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="declare">
<xs:complexType>
<xs:sequence>
<xs:element ref="Var"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Atom">
<!--
Atom ::= UNITERM
-->
<xs:complexType>
<xs:sequence>
<xs:group ref="UNITERM"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:group name="UNITERM">
<!--
UNITERM ::= Const '(' (TERM* ')'
-->
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="op"/>
<xs:element name="args" type="args-UNITERM.type" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:group>
<xs:group name="GROUNDUNITERM">
<!-- sensitive to ground terms
GROUNDUNITERM ::= Const '(' (GROUNDTERM* ')'
-->
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="op"/>
<xs:element name="args" type="args-GROUNDUNITERM.type" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:group>
<xs:element name="op">
<xs:complexType>
<xs:sequence>
<xs:element ref="Const"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="args-UNITERM.type">
<!-- sensitive to UNITERM (TERM) context-->
<xs:sequence>
<xs:group ref="TERM" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ordered" type="xs:string" fixed="yes"/>
</xs:complexType>
<xs:complexType name="args-GROUNDUNITERM.type">
<!-- sensitive to GROUNDUNITERM (TERM) context-->
<xs:sequence>
<xs:group ref="GROUNDTERM" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ordered" type="xs:string" fixed="yes"/>
</xs:complexType>
<xs:element name="Equal">
<!--
Equal ::= TERM '=' ( TERM | IRIMETA? 'External' '(' Expr ')' )
-->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="left"/>
<xs:element ref="right"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="left">
<xs:complexType>
<xs:sequence>
<xs:group ref="TERM"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="right">
<xs:complexType>
<xs:group ref="TERM"/>
</xs:complexType>
</xs:element>
<xs:element name="Member">
<!--
Member ::= TERM '#' TERM
-->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="instance"/>
<xs:element ref="class"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="instance">
<xs:complexType>
<xs:sequence>
<xs:group ref="TERM"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="class">
<xs:complexType>
<xs:sequence>
<xs:group ref="TERM"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Frame">
<!--
Frame ::= TERM '[' (TERM '->' TERM)* ']'
-->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="object"/>
<xs:element name="slot" type="slot-Frame.type" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="object">
<xs:complexType>
<xs:sequence>
<xs:group ref="TERM"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="slot-Frame.type">
<!-- sensitive to Frame (TERM) context-->
<xs:sequence>
<xs:group ref="TERM"/>
<xs:group ref="TERM"/>
</xs:sequence>
<xs:attribute name="ordered" type="xs:string" fixed="yes"/>
</xs:complexType>
<xs:group name="TERM">
<!--
TERM ::= IRIMETA? (Const | Var | External | List )
-->
<xs:choice>
<xs:element ref="Const"/>
<xs:element ref="Var"/>
<xs:element name="External" type="External-TERM.type"/>
<xs:element ref="List"/>
</xs:choice>
</xs:group>
<xs:group name="GROUNDTERM">
<!--
GROUNDTERM ::= IRIMETA? (Const | List | 'External' '(' 'Expr' '(' GROUNDUNITERM ')' ')')
-->
<xs:choice>
<xs:element ref="Const"/>
<xs:element ref="List"/>
<xs:element name="External" type="External-GROUNDUNITERM.type"/>
</xs:choice>
</xs:group>
<xs:element name="List">
<!--
List ::= 'List' '(' GROUNDTERM* ')'
-->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="items">
<xs:complexType>
<xs:sequence>
<xs:group ref="GROUNDTERM" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ordered" type="xs:string" fixed="yes"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="External-TERM.type">
<!-- sensitive to TERM (Expr) context-->
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="content" type="content-TERM.type"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="External-GROUNDUNITERM.type">
<!-- sensitive to GROUNDTERM (Expr) context-->
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="content" type="content-GROUNDUNITERM.type"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="content-TERM.type">
<!-- sensitive to TERM (Expr) context-->
<xs:sequence>
<xs:element ref="Expr"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="content-GROUNDUNITERM.type">
<!-- sensitive to GROUNDTERM (Expr) context-->
<xs:sequence>
<xs:element name="Expr" type="content-GROUNDEXPR.type"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="content-GROUNDEXPR.type">
<!-- sensitive to GROUNDEXPR context-->
<xs:sequence>
<xs:group ref="GROUNDUNITERM"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Expr">
<!--
Expr ::= Const '(' (TERM | IRIMETA? 'External' '(' Expr ')')* ')'
-->
<xs:complexType>
<xs:sequence>
<xs:element ref="op"/>
<xs:element name="args" type="args-Expr.type" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="args-Expr.type">
<!-- sensitive to Expr (TERM) context-->
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:group ref="TERM"/>
</xs:choice>
<xs:attribute name="ordered" type="xs:string" fixed="yes"/>
</xs:complexType>
<xs:element name="Const">
<!--
Const ::= '"' UNICODESTRING '"^^' SYMSPACE | CONSTSHORT
-->
<xs:complexType mixed="true">
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="type" type="xs:anyURI" use="required"/>
<xs:attribute ref="xml:lang"/>
</xs:complexType>
</xs:element>
<xs:element name="Var">
<!--
Var ::= '?' NCName
-->
<xs:complexType mixed="true">
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:group name="IRIMETA">
<!--
IRIMETA ::= '(*' IRICONST? (Frame | 'And' '(' Frame* ')')? '*)'
-->
<xs:sequence>
<xs:element ref="id" minOccurs="0" maxOccurs="1"/>
<xs:element ref="meta" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:group>
<xs:element name="id">
<xs:complexType>
<xs:sequence>
<xs:element name="Const" type="IRICONST.type"/> <!-- type="&rif;iri" -->
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="meta">
<xs:complexType>
<xs:choice>
<xs:element ref="Frame"/>
<xs:element name="And" type="And-meta.type"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:complexType name="And-meta.type">
<!-- sensitive to meta (Frame) context-->
<xs:sequence>
<xs:element name="formula" type="formula-meta.type" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="formula-meta.type">
<!-- sensitive to meta (Frame) context-->
<xs:sequence>
<xs:element ref="Frame"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="IRICONST.type" mixed="true">
<!-- sensitive to location/id context-->
<xs:sequence/>
<xs:attribute name="type" type="xs:anyURI" use="required" fixed="http://www.w3.org/2007/rif#iri"/>
</xs:complexType>
<!-- ============================================ -->
<!-- Definition of the actions (not in RIF-Core) -->
<!-- ============================================ -->
<xs:element name="New">
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:group name="INITIALIZATION">
<xs:choice>
<xs:element ref="New"/>
<xs:element ref="Frame"/>
</xs:choice>
</xs:group>
<xs:element name="Do">
<!-- -->
<!-- <Do> -->
<!-- <actionVar ordered="yes"> -->
<!-- Var -->
<!-- INITIALIZATION -->
<!-- </actionVar>* -->
<!-- <actions ordered="yes"> -->
<!-- ACTION+ -->
<!-- </actions> -->
<!-- </Do> -->
<!-- -->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="actionVar" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element ref="Var" minOccurs="1" maxOccurs="1"/>
<xs:group ref="INITIALIZATION" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="ordered" type="xs:string" fixed="yes"/>
</xs:complexType>
</xs:element>
<xs:element name="actions" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:group ref="ACTION" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ordered" type="xs:string" fixed="yes"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:group name="ACTION">
<xs:choice>
<xs:element ref="Assert"/>
<xs:element ref="Retract"/>
<xs:element ref="Modify"/>
<xs:element ref="Execute"/>
</xs:choice>
</xs:group>
<xs:element name="Assert">
<!-- -->
<!-- <Assert> -->
<!-- <target> [ Atom -->
<!-- | Frame -->
<!-- | Member ] -->
<!-- </target> -->
<!-- </Assert> -->
<!-- -->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="target" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:choice>
<xs:element ref="Atom"/>
<xs:element ref="Frame"/>
<xs:element ref="Member"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Retract">
<!-- -->
<!-- <Retract> -->
<!-- <target ordered="yes"?> -->
<!-- [ Atom -->
<!-- | Frame -->
<!-- | TERM -->
<!-- | TERM TERM ] -->
<!-- </target> -->
<!-- </Assert> -->
<!-- -->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="target" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:choice>
<xs:element ref="Atom"/>
<xs:element ref="Frame"/>
<xs:group ref="TERM"/>
<xs:sequence>
<xs:group ref="TERM"/>
<xs:group ref="TERM"/>
</xs:sequence>
</xs:choice>
<xs:attribute name="ordered" type="xs:string" fixed="yes"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Modify">
<!-- -->
<!-- <Modify> -->
<!-- <target> Frame </target> -->
<!-- </Modify> -->
<!-- -->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="target" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element ref="Frame"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Execute">
<!-- -->
<!-- <Execute> -->
<!-- <target> Atom </target> -->
<!-- </Execute> -->
<!-- -->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element name="target" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element ref="Atom"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- ================================================== -->
<!-- Redefine Group related Core construct -->
<!-- ================================================== -->
<xs:complexType name="Group-contents">
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="behavior" minOccurs="0" maxOccurs="1"/>
<!-- behavior in not in RIF-Core -->
<xs:element ref="sentence" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- ================================================== -->
<!-- Group related addition -->
<!-- ================================================== -->
<xs:element name="behavior">
<!-- -->
<!-- <behavior> -->
<!-- <ConflictResolution> -->
<!-- xsd:anyURI -->
<!-- <ConflictResolution>? -->
<!-- <Priority> -->
<!-- -10,000 ≤ xsd:int ≤ 10,000 -->
<!-- </Priority>? -->
<!-- </behavior> -->
<!-- -->
<xs:complexType>
<xs:sequence>
<xs:element name="ConflictResolution" minOccurs="0" maxOccurs="1" type="xs:anyURI"/>
<xs:element name="Priority" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="-10000"/>
<xs:maxInclusive value="10000"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- ================================================== -->
<!-- Redefine rule related Core constructs -->
<!-- ================================================== -->
<xs:group name="RULE">
<!--
RULE ::= (IRIMETA? 'Forall' Var+ '(' CLAUSE ')') | CLAUSE
-->
<xs:choice>
<xs:element name="Forall" type="Forall-premises"/>
<xs:group ref="CLAUSE"/>
</xs:choice>
</xs:group>
<xs:complexType name="Forall-premises">
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="declare" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="pattern" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:group ref="FORMULA"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- different from formula in And, Or and Exists -->
<xs:element name="formula">
<xs:complexType>
<xs:group ref="RULE"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:group name="CLAUSE">
<!--
CLAUSE ::= Implies | ACTION_BLOCK
-->
<xs:choice>
<xs:element ref="Implies"/>
<xs:group ref="ACTION_BLOCK"/>
</xs:choice>
</xs:group>
<xs:complexType name="then-part">
<xs:group ref="ACTION_BLOCK" minOccurs="1" maxOccurs="1"/>
</xs:complexType>
<!-- ================================================== -->
<!-- Rule related additions -->
<!-- ================================================== -->
<xs:group name="ACTION_BLOCK">
<!--
ACTION_BLOCK ::= 'Do (' (Var (Frame | 'New'))* ACTION+ ')' |
'And (' (Atom | Frame)* ')' | Atom | Frame
-->
<xs:choice>
<xs:element ref="Do"/>
<xs:element name="And" type="And-then.type"/>
<xs:element ref="Atom"/>
<xs:element ref="Frame"/>
</xs:choice>
</xs:group>
<!-- ================================================== -->
<!-- CoreRule.xsd starts here -->
<!-- ================================================== -->
<xs:element name="Document">
<!--
Document ::= IRIMETA? 'Document' '(' Base? Prefix* Import* Group? ')'
-->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="directive" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="payload" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="directive">
<!--
Base and Prefix represented directly in XML
-->
<xs:complexType>
<xs:sequence>
<xs:element ref="Import"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="payload">
<xs:complexType>
<xs:sequence>
<xs:element name="Group" type="Group-contents"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Import">
<!--
Import ::= IRIMETA? 'Import' '(' IRICONST PROFILE? ')'
-->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="location"/>
<xs:element ref="profile" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="location" type="xs:anyURI"/>
<xs:element name="profile" type="xs:anyURI"/>
<xs:element name="sentence">
<xs:complexType>
<xs:choice>
<xs:element name="Group" type="Group-contents"/>
<xs:group ref="RULE"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="Implies">
<!--
Implies ::= IRIMETA? ATOMIC ':-' FORMULA
-->
<xs:complexType>
<xs:sequence>
<xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
<xs:element ref="if"/>
<xs:element name="then" type="then-part"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="if">
<xs:complexType>
<xs:sequence>
<xs:group ref="FORMULA"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="And-then.type">
<!-- sensitive to then (And) context-->
<xs:sequence>
<xs:element name="formula" type="formula-then.type" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="formula-then.type">
<!-- sensitive to then (And) context-->
<xs:choice>
<xs:element ref="Atom"/>
<xs:element ref="Frame"/>
</xs:choice>
</xs:complexType>
</xs:schema>
</pre>
<p><span class="anchor" id="appendix-change-log"></span>
</p>
<div id="changelog">
<a id="Appendix:_Change_Log_.28Informative.29" name="Appendix:_Change_Log_.28Informative.29"></a><h2> <span class="mw-headline">14 Appendix: Change Log (Informative) </span></h2>
<p>This appendix summarizes the main changes to this document since its publication as a Candidate Recommendation.
</p><p>Changes since the <a class="external text" href="http://www.w3.org/TR/2009/CR-rif-prd-20091001/" title="http://www.w3.org/TR/2009/CR-rif-prd-20091001/">draft of October 1st, 2009</a>:
</p>
<ul><li> <tt>Modify</tt> is now a <a href="#def-compound-action" title="">compound action</a>;
</li><li> The default conflict resolution strategy <a href="#sec-conflict-resolution" title="">rif:forwardChaining</a> takes now into account the intermediate states of the fact base after each atomic action;
</li><li> The <a href="#sec-operational-semantics-of-rules-and-rule-sets" title="">operational semantics of rules and rule sets</a> is now defined with respect to rules that have been <a href="#sec-rules-normalization" title="">normalized</a> to eliminate disjunctive conditions;
</li><li> <a href="#sec-xml-base" title="">Section xml:base</a> has been added to clarify the use of the attribute <tt>xml:base</tt> in the RIF-PRD/XML syntax.
</li></ul>
<p>Changes since the <a class="external text" href="http://www.w3.org/TR/2010/WD-rif-prd-20100211/" title="http://www.w3.org/TR/2010/WD-rif-prd-20100211/">draft of February 12th, 2010</a>:
</p>
<ul><li> Changed the content of the <tt><a href="#sec-var" title="">Var</a></tt> element to <a class="external text" href="http://www.w3.org/TR/xmlschema-2/#NCName" title="http://www.w3.org/TR/xmlschema-2/#NCName">xsd:NCName</a>, aligning it with RIF-BLD; changed the <a href="#sec-presentation-syntax" title="">presentation syntax</a> accordingly;
</li><li> Simplified the definition of a <a href="#def-conformance" title="">conformant consummer</a> according to the working group resolution (<a class="external text" href="http://lists.w3.org/Archives/Public/public-rif-wg/2010Mar/0077.html" title="http://lists.w3.org/Archives/Public/public-rif-wg/2010Mar/0077.html">minutes of March 23, 2010, teleconference</a>);
</li><li> Added the missing optional annotation (<tt>IRIMETA</tt>) to the content of the elements where it was missing, namely: <tt>List, Subclass, Assert, Retract, Modify, Execute, Do, New</tt>;
</li><li> Modified the syntax of <tt>List</tt>, adding the <tt>items</tt> role element as a container for the list elements;
</li><li> Corrected a typo in the XML Schema: the minimum occurence of a <tt>GROUNDTERM</tt> is 1 in an <tt>args-GROUNDUNITERM.type</tt>, not 0.
</li></ul>
</div>
</body>
</html>