This file is indexed.

/usr/share/doc/libghc-swish-doc/html/swish.txt is in libghc-swish-doc 0.9.1.7-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A semantic web toolkit.
--   
--   Swish is a framework, written in the purely functional programming
--   language Haskell, for performing deductions in RDF data using a
--   variety of techniques. Swish is conceived as a toolkit for
--   experimenting with RDF inference, and for implementing stand-alone RDF
--   file processors (usable in similar style to CWM, but with a view to
--   being extensible in declarative style through added Haskell function
--   and data value declarations). It explores Haskell as "a scripting
--   language for the Semantic Web".
--   
--   Swish is a work-in-progress, and currently incorporates:
--   
--   <ul>
--   <li>Turtle, Notation3 and NTriples input and output. The N3 support is
--   incomplete (no handling of <tt>@forAll</tt>).</li>
--   <li>RDF graph isomorphism testing and merging.</li>
--   <li>Display of differences between RDF graphs.</li>
--   <li>Inference operations in forward chaining, backward chaining and
--   proof-checking modes.</li>
--   <li>Simple Horn-style rule implementations, extendable through
--   variable binding modifiers and filters.</li>
--   <li>Class restriction rule implementation, primarily for datatype
--   inferences.</li>
--   <li>RDF formal semantics entailment rule implementation.</li>
--   <li>Complete, ready-to-run, command-line and script-driven
--   programs.</li>
--   </ul>
--   
--   Changes are given in the
--   <a>https://bitbucket.org/doug_burke/swish/src/tip/CHANGELOG</a>.
--   
--   References:
--   
--   <ul>
--   <li><a>http://www.ninebynine.org/RDFNotes/Swish/Intro.html</a></li>
--   <li><a>http://www.ninebynine.org/Software/swish-0.2.1.html</a></li>
--   <li>CWM: <a>http://www.w3.org/2000/10/swap/doc/cwm.html</a></li>
--   </ul>
@package swish
@version 0.9.1.7


module Swish.Utils.ListHelpers

-- | Apply list of functions to some value, returning list of results. It's
--   kind of like an converse map.
--   
--   This is similar to the <tt>ap</tt> function in the Monad library.
flist :: [a -> b] -> a -> [b]


-- | This module defines a Labelled Directed Graph and Label classes, and
--   the Arc datatype.
module Swish.GraphClass

-- | Labelled Directed Graph class.
--   
--   Minimum required implementation: <a>emptyGraph</a>, <a>setArcs</a>,
--   and <a>getArcs</a>.
class LDGraph lg lb where extract sel = update (filter sel) addGraphs addg = update (union (getArcs addg)) delete g1 g2 = setArcs g2 (getArcs g2 `difference` getArcs g1) labels = getComponents arcLabels . getArcs nodes = getComponents arcNodes . getArcs update f g = setArcs g (f (getArcs g))

-- | Create the empty graph.
emptyGraph :: LDGraph lg lb => lg lb

-- | Replace the existing arcs in the graph.
setArcs :: LDGraph lg lb => lg lb -> ArcSet lb -> lg lb

-- | Extract all the arcs from a graph
getArcs :: LDGraph lg lb => lg lb -> ArcSet lb

-- | Extract those arcs that match the given <a>Selector</a>.
extract :: (LDGraph lg lb, Ord lb) => Selector lb -> lg lb -> lg lb

-- | Add the two graphs
addGraphs :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb

-- | Remove those arcs in the first graph from the second graph
delete :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb

-- | Enumerate the distinct labels contained in a graph; that is, any label
--   that appears in the subject, predicate or object position of an
--   <a>Arc</a>.
labels :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb

-- | Enumerate the distinct nodes contained in a graph; that is, any label
--   that appears in the subject or object position of an <a>Arc</a>.
nodes :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb

-- | Update the arcs in a graph using a supplied function.
update :: LDGraph lg lb => (ArcSet lb -> ArcSet lb) -> lg lb -> lg lb

-- | Label class.
--   
--   A label may have a fixed binding, which means that the label
--   identifies (is) a particular graph node, and different such labels are
--   always distinct nodes. Alternatively, a label may be unbound
--   (variable), which means that it is a placeholder for an unknown node
--   label. Unbound node labels are used as graph-local identifiers for
--   indicating when the same node appears in several arcs.
--   
--   For the purposes of graph-isomorphism testing, fixed labels are
--   matched when they are the same. Variable labels may be matched with
--   any other variable label. Our definition of isomorphism (for RDF
--   graphs) does not match variable labels with fixed labels.
class (Ord lb, Show lb) => Label lb

-- | Does this node have a variable binding?
labelIsVar :: Label lb => lb -> Bool

-- | Calculate the hash of the label using the supplied seed.
labelHash :: Label lb => Int -> lb -> Int

-- | Extract the local id from a variable node.
getLocal :: Label lb => lb -> String

-- | Make a label value from a local id.
makeLabel :: Label lb => String -> lb

-- | Arc type.
--   
--   Prior to <tt>0.7.0.0</tt> you could also use <tt>asubj</tt>,
--   <tt>apred</tt> and <tt>aobj</tt> to access the elements of the arc.
data Arc lb
Arc :: lb -> lb -> lb -> Arc lb

-- | The subject of the arc.
[arcSubj] :: Arc lb -> lb

-- | The predicate (property) of the arc.
[arcPred] :: Arc lb -> lb

-- | The object of the arc.
[arcObj] :: Arc lb -> lb

-- | A set - or graph - of arcs.
type ArcSet lb = Set (Arc lb)

-- | Identify arcs.
type Selector lb = Arc lb -> Bool

-- | Create an arc.
arc :: lb -> lb -> lb -> Arc lb

-- | Convert an Arc into a tuple.
arcToTriple :: Arc lb -> (lb, lb, lb)

-- | Create an Arc from a tuple.
arcFromTriple :: (lb, lb, lb) -> Arc lb

-- | Does the arc contain the label in any position (subject, predicate, or
--   object)?
hasLabel :: (Eq lb) => lb -> Arc lb -> Bool

-- | Return all the labels in an arc.
arcLabels :: Arc lb -> [lb]

-- | Extract components from a set.
getComponents :: Ord b => (a -> [b]) -> Set a -> Set b
instance Data.Traversable.Traversable Swish.GraphClass.Arc
instance Data.Foldable.Foldable Swish.GraphClass.Arc
instance GHC.Base.Functor Swish.GraphClass.Arc
instance GHC.Classes.Eq lb => GHC.Classes.Eq (Swish.GraphClass.Arc lb)
instance Data.Hashable.Class.Hashable lb => Data.Hashable.Class.Hashable (Swish.GraphClass.Arc lb)
instance GHC.Classes.Ord lb => GHC.Classes.Ord (Swish.GraphClass.Arc lb)
instance GHC.Show.Show lb => GHC.Show.Show (Swish.GraphClass.Arc lb)


-- | This module contains functions for partitioning a graph into subgraphs
--   that rooted from different subject nodes.
module Swish.GraphPartition

-- | Representation of a graph as a collection of (possibly nested)
--   partitions. Each node in the graph appears at least once as the root
--   value of a <a>GraphPartition</a> value:
--   
--   <ul>
--   <li>Nodes that are the subject of at least one statement appear as the
--   first value of exactly one <a>PartSub</a> constructor, and may also
--   appear in any number of <a>PartObj</a> constructors.</li>
--   <li>Nodes appearing only as objects of statements appear only in
--   <a>PartObj</a> constructors.</li>
--   </ul>
data PartitionedGraph lb
PartitionedGraph :: [GraphPartition lb] -> PartitionedGraph lb

-- | Returns all the arcs in the partitioned graph.
getArcs :: PartitionedGraph lb -> [Arc lb]

-- | Returns a list of partitions.
getPartitions :: PartitionedGraph lb -> [GraphPartition lb]

-- | Represent a partition of a graph by a node and (optional) contents.
data GraphPartition lb
PartObj :: lb -> GraphPartition lb
PartSub :: lb -> (NonEmpty (lb, GraphPartition lb)) -> GraphPartition lb

-- | Returns the node for the partition.
node :: GraphPartition lb -> lb

-- | Creates a list of arcs from the partition. The empty list is returned
--   for <a>PartObj</a>.
toArcs :: GraphPartition lb -> [Arc lb]

-- | Turning a partitioned graph into a flat graph is easy. The interesting
--   challenge is to turn a flat graph into a partitioned graph that is
--   more useful for certain purposes. Currently, I'm interested in:
--   
--   <ol>
--   <li>isolating differences between graphs</li>
--   <li>pretty-printing graphs</li>
--   </ol>
--   
--   For (1), the goal is to separate subgraphs that are known to be
--   equivalent from subgraphs that are known to be different, such that:
--   
--   <ul>
--   <li>different sub-graphs are minimized,</li>
--   <li>different sub-graphs are placed into 1:1 correspondence (possibly
--   with null subgraphs), and</li>
--   <li>only deterministic matching decisions are made.</li>
--   </ul>
--   
--   For (2), the goal is to decide when a subgraph is to be treated as
--   nested in another partition, or treated as a new top-level partition.
--   If a subgraph is referenced by exactly one graph partition, it should
--   be nested in that partition, otherwise it should be a new top-level
--   partition.
--   
--   Strategy. Examining just subject and object nodes:
--   
--   <ul>
--   <li>all non-blank subject nodes are the root of a top-level
--   partition</li>
--   <li>blank subject nodes that are not the object of exactly one
--   statement are the root of a top-level partition.</li>
--   <li>blank nodes referenced as the object of exactly 1 statement of an
--   existing partition are the root of a sub-partition of the refering
--   partition.</li>
--   <li>what remain are circular chains of blank nodes not referenced
--   elsewhere: for each such chain, pick a root node arbitrarily.</li>
--   </ul>
partitionGraph :: (Label lb) => [Arc lb] -> PartitionedGraph lb

-- | Create a list of pairs of corresponding Partitions that are unequal.
comparePartitions :: (Label lb) => PartitionedGraph lb -> PartitionedGraph lb -> [(Maybe (GraphPartition lb), Maybe (GraphPartition lb))]

-- | Convert a partition into a string with a leading separator string.
partitionShowP :: (Label lb) => String -> GraphPartition lb -> String
instance Swish.GraphClass.Label lb => GHC.Show.Show (Swish.GraphPartition.PartitionedGraph lb)
instance Swish.GraphClass.Label lb => GHC.Classes.Eq (Swish.GraphPartition.PartitionedGraph lb)
instance Swish.GraphClass.Label lb => GHC.Classes.Eq (Swish.GraphPartition.GraphPartition lb)
instance Swish.GraphClass.Label lb => GHC.Classes.Ord (Swish.GraphPartition.GraphPartition lb)
instance Swish.GraphClass.Label lb => GHC.Show.Show (Swish.GraphPartition.GraphPartition lb)


-- | This module contains graph-matching logic.
--   
--   The algorithm used is derived from a paper on RDF graph matching by
--   Jeremy Carroll
--   <a>http://www.hpl.hp.com/techreports/2001/HPL-2001-293.html</a>.
module Swish.GraphMatch

-- | Graph matching function accepting two lists of arcs and returning a
--   node map if successful
graphMatch :: (Label lb) => (lb -> lb -> Bool) -> ArcSet lb -> ArcSet lb -> (Bool, LabelMap (ScopedLabel lb))

-- | A label lookup table specialized to <a>LabelIndex</a> indices.
type LabelMap lb = GenLabelMap lb LabelIndex

-- | Type for label-&gt;index lookup table
data (Label lb, Eq lv, Show lv) => GenLabelMap lb lv
LabelMap :: Word32 -> (Map lb lv) -> GenLabelMap lb lv

-- | A label associated with a <a>LabelIndex</a>
type LabelEntry lb = GenLabelEntry lb LabelIndex

-- | A Mapping between a label and a value (e.g. an index value).
data (Label lb) => GenLabelEntry lb lv
LabelEntry :: lb -> lv -> GenLabelEntry lb lv

-- | This instance of class label adds a graph identifier to each variable
--   label, so that variable labels from different graphs are always seen
--   as distinct values.
--   
--   The essential logic added by this class instance is embodied in the eq
--   and hash functions. Note that variable label hashes depend only on the
--   graph in which they appear, and non-variable label hashes depend only
--   on the variable. Label hash values are used when initializing a label
--   equivalence-class map (and, for non-variable labels, also for
--   resolving hash collisions).
data (Label lb) => ScopedLabel lb
ScopedLabel :: Int -> lb -> ScopedLabel lb

-- | Create a scoped label given an identifier and label.
makeScopedLabel :: (Label lb) => Int -> lb -> ScopedLabel lb

-- | Create an arc containining a scoped label with the given identifier.
makeScopedArc :: (Label lb) => Int -> Arc lb -> Arc (ScopedLabel lb)

-- | LabelIndex is a unique value assigned to each label, such that labels
--   with different values are definitely different values in the graph;
--   e.g. do not map to each other in the graph bijection. The first member
--   is a generation counter that ensures new values are distinct from
--   earlier passes.
type LabelIndex = (Word32, Word32)

-- | Type for equivalence class description (An equivalence class is a
--   collection of labels with the same <a>LabelIndex</a> value.)
type EquivalenceClass lb = (LabelIndex, [lb])

-- | The null, or empty, index value.
nullLabelVal :: LabelIndex

-- | The empty label map table.
emptyMap :: (Label lb) => LabelMap lb

-- | Does this node have a variable binding?
labelIsVar :: Label lb => lb -> Bool

-- | Calculate the hash of the label using the supplied seed.
labelHash :: Label lb => Int -> lb -> Int

-- | Map a label to its corresponding label index value in the supplied
--   LabelMap.
mapLabelIndex :: (Label lb) => LabelMap lb -> lb -> LabelIndex

-- | Replace a label and its associated value in a label map with a new
--   value using the supplied hash value and the current <a>LabelMap</a>
--   generation number. If the key is not found, then no change is made to
--   the label map.
setLabelHash :: (Label lb) => LabelMap lb -> (lb, Word32) -> LabelMap lb

-- | Replace selected values in a label map with new values from the
--   supplied list of labels and new label index values. The generation
--   number is supplied from the current label map. The generation number
--   in the resulting label map is incremented.
newLabelMap :: (Label lb) => LabelMap lb -> [(lb, Word32)] -> LabelMap lb

-- | Return the set of distinct labels used in the graph.
graphLabels :: (Label lb) => ArcSet lb -> Set lb

-- | Scan label list, assigning initial label map values, adding new values
--   to the label map supplied.
--   
--   Label map values are assigned on the basis of the label alone, without
--   regard for it's connectivity in the graph. (cf. <a>reclassify</a>).
--   
--   All variable node labels are assigned the same initial value, as they
--   may be matched with each other.
assignLabelMap :: (Label lb) => Set lb -> LabelMap lb -> LabelMap lb

-- | Increment the generation of the label map.
--   
--   Returns a new label map identical to the supplied value but with an
--   incremented generation number.
newGenerationMap :: (Label lb) => LabelMap lb -> LabelMap lb

-- | Recursive graph matching function
--   
--   This function assumes that no variable label appears in both graphs.
--   (Function <a>graphMatch</a>, which calls this, ensures that all
--   variable labels are distinct.)
graphMatch1 :: (Label lb) => Bool -> (lb -> lb -> Bool) -> ArcSet lb -> ArcSet lb -> LabelMap lb -> [(EquivalenceClass lb, EquivalenceClass lb)] -> (Bool, LabelMap lb)

-- | Auxiliary graph matching function
--   
--   This function is called when deterministic decomposition of node
--   mapping equivalence classes has run its course.
--   
--   It picks a pair of equivalence classes in ecpairs, and arbitrarily
--   matches pairs of nodes in those equivalence classes, recursively
--   calling the graph matching function until a suitable node mapping is
--   discovered (success), or until all such pairs have been tried
--   (failure).
--   
--   This function represents a point to which arbitrary choices are
--   backtracked. The list comprehension <tt>glp</tt> represents the
--   alternative choices at the point of backtracking
--   
--   The selected pair of nodes are placed in a new equivalence class based
--   on their original equivalence class value, but with a new NodeVal
--   generation number.
graphMatch2 :: (Label lb) => (lb -> lb -> Bool) -> ArcSet lb -> ArcSet lb -> LabelMap lb -> [(EquivalenceClass lb, EquivalenceClass lb)] -> (Bool, LabelMap lb)

-- | Return the equivalence classes of the supplied nodes using the label
--   map.
equivalenceClasses :: (Label lb) => LabelMap lb -> Set lb -> [EquivalenceClass lb]

-- | Reclassify labels
--   
--   Examines the supplied label equivalence classes (based on the supplied
--   label map), and evaluates new equivalence subclasses based on node
--   values and adjacency (for variable nodes) and rehashing (for
--   non-variable nodes).
--   
--   Note, assumes that all all equivalence classes supplied are
--   non-singletons; i.e. contain more than one label.
reclassify :: (Label lb) => ArcSet lb -> ArcSet lb -> LabelMap lb -> [(EquivalenceClass lb, EquivalenceClass lb)] -> (LabelMap lb, [(EquivalenceClass lb, EquivalenceClass lb)], Bool, Bool)
instance (Swish.GraphClass.Label lb, GHC.Show.Show lv) => GHC.Show.Show (Swish.GraphMatch.GenLabelEntry lb lv)
instance (Swish.GraphClass.Label lb, GHC.Classes.Eq lv) => GHC.Classes.Eq (Swish.GraphMatch.GenLabelEntry lb lv)
instance (Swish.GraphClass.Label lb, GHC.Classes.Ord lv) => GHC.Classes.Ord (Swish.GraphMatch.GenLabelEntry lb lv)
instance Swish.GraphClass.Label lb => GHC.Show.Show (Swish.GraphMatch.LabelMap lb)
instance Swish.GraphClass.Label lb => GHC.Classes.Eq (Swish.GraphMatch.LabelMap lb)
instance Swish.GraphClass.Label lb => Swish.GraphClass.Label (Swish.GraphMatch.ScopedLabel lb)
instance Swish.GraphClass.Label lb => GHC.Classes.Eq (Swish.GraphMatch.ScopedLabel lb)
instance Swish.GraphClass.Label lb => GHC.Show.Show (Swish.GraphMatch.ScopedLabel lb)
instance Swish.GraphClass.Label lb => GHC.Classes.Ord (Swish.GraphMatch.ScopedLabel lb)


-- | This module defines a simple memory-based graph instance.
module Swish.GraphMem

-- | Simple memory-based graph type.
data GraphMem lb
GraphMem :: ArcSet lb -> GraphMem lb
[arcs] :: GraphMem lb -> ArcSet lb

-- | Minimal graph label value - for testing
data LabelMem
LF :: String -> LabelMem
LV :: String -> LabelMem

-- | Replace the existing arcs in the graph.
setArcs :: LDGraph lg lb => lg lb -> ArcSet lb -> lg lb

-- | Extract all the arcs from a graph
getArcs :: LDGraph lg lb => lg lb -> ArcSet lb

-- | Add the two graphs
addGraphs :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb

-- | Remove those arcs in the first graph from the second graph
delete :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb

-- | Extract those arcs that match the given <a>Selector</a>.
extract :: (LDGraph lg lb, Ord lb) => Selector lb -> lg lb -> lg lb

-- | Enumerate the distinct labels contained in a graph; that is, any label
--   that appears in the subject, predicate or object position of an
--   <a>Arc</a>.
labels :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb

-- | Does this node have a variable binding?
labelIsVar :: Label lb => lb -> Bool

-- | Calculate the hash of the label using the supplied seed.
labelHash :: Label lb => Int -> lb -> Int

-- | GraphMem matching function accepting GraphMem value and returning node
--   map if successful
matchGraphMem :: (Label lb) => GraphMem lb -> GraphMem lb -> (Bool, LabelMap (ScopedLabel lb))
instance Swish.GraphClass.LDGraph Swish.GraphMem.GraphMem lb
instance Swish.GraphClass.Label lb => GHC.Classes.Eq (Swish.GraphMem.GraphMem lb)
instance Swish.GraphClass.Label lb => GHC.Classes.Ord (Swish.GraphMem.GraphMem lb)
instance Swish.GraphClass.Label lb => GHC.Show.Show (Swish.GraphMem.GraphMem lb)
instance Swish.GraphClass.Label lb => GHC.Base.Monoid (Swish.GraphMem.GraphMem lb)
instance Data.Hashable.Class.Hashable Swish.GraphMem.LabelMem
instance Swish.GraphClass.Label Swish.GraphMem.LabelMem
instance GHC.Classes.Eq Swish.GraphMem.LabelMem
instance GHC.Classes.Ord Swish.GraphMem.LabelMem
instance GHC.Show.Show Swish.GraphMem.LabelMem


-- | <ul>
--   <li>This module is deprecated and will be removed*</li>
--   </ul>
--   
--   This module no-longer does anything since <a>URI</a> now has an
--   <a>Ord</a> instance by default (prior to <tt>network </tt>2.4.0.0@
--   this was not the case).
--   
--   This module used to provide an ordering for earlier versions of the
--   network package, but with the split of <a>URI</a> out to the
--   <tt>network-uri</tt> in version <tt>2.6.0.0</tt>, the CPP needed to
--   keep this going got annoying enough for me to just require a recent
--   <tt>network</tt> package.
module Network.URI.Ord


-- | This module defines an extension of the <a>Show</a> class for
--   displaying multi-line values. It serves the following purposes:
--   
--   <ol>
--   <li>provides a method with greater layout control of multiline
--   values,</li>
--   <li>provides a possibility to override the default <a>Show</a>
--   behaviour for programs that use the extended <a>ShowLines</a>
--   interface, and</li>
--   <li>uses a <a>ShowS</a> intermediate value to avoid unnecessary
--   concatenation of long strings.</li>
--   </ol>
module Data.String.ShowLines

-- | ShowLines is a type class for values that may be formatted in
--   multi-line displays.
class (Show sh) => ShowLines sh where showls _ = shows

-- | Multi-line value display method
--   
--   Create a multiline displayable form of a value, returned as a
--   <a>ShowS</a> value. The default implementation behaves just like a
--   normal instance of <a>Show</a>.
--   
--   This function is intended to allow the calling function some control
--   of multiline displays by providing:
--   
--   <ol>
--   <li>the first line of the value is not preceded by any text, so it may
--   be appended to some preceding text on the same line,</li>
--   <li>the supplied line break string is used to separate lines of the
--   formatted text, and may include any desired indentation, and</li>
--   <li>no newline is output following the final line of text.</li>
--   </ol>
showls :: ShowLines sh => String -> sh -> ShowS


-- | This module provides methods to support operations on partially
--   ordered collections. The partial ordering relationship is represented
--   by <a>Maybe</a> <a>Ordering</a>.
--   
--   Thanks to members of the haskell-cafe mailing list - Robert
--   (rvollmert-lists@gmx.net) and Tom Pledger (Tom.Pledger@peace.com) -
--   who suggested key ideas on which some of the code in this module is
--   based.
module Data.Ord.Partial

-- | Partial comparison function.
type PartCompare a = a -> a -> Maybe Ordering

-- | This function finds the minima in a list of partially ordered values,
--   preserving the sequence of retained values from the supplied list.
--   
--   It returns all those values in the supplied list for which there is no
--   smaller element in the list.
minima :: PartCompare a -> [a] -> [a]

-- | This function finds the maxima in a list of partially ordered values,
--   preserving the sequence of retained values from the supplied list.
--   
--   It returns all those values in the supplied list for which there is no
--   larger element in the list.
maxima :: PartCompare a -> [a] -> [a]

-- | Partial ordering for Eq values
partCompareEq :: (Eq a) => PartCompare a

-- | Part-ordering comparison on pairs of values, where each has a
--   part-ordering relationship
partComparePair :: PartCompare a -> PartCompare b -> (a, b) -> (a, b) -> Maybe Ordering

-- | Part-ordering comparison on lists of Maybe values.
partCompareListMaybe :: (Eq a) => [Maybe a] -> [Maybe a] -> Maybe Ordering

-- | Part-ordering comparison on lists based on subset relationship
partCompareListSubset :: (Eq a) => [a] -> [a] -> Maybe Ordering


-- | Support interning URIs.
module Data.Interned.URI

-- | An interned URI. The hashing is based on the reversed URI (as a
--   string).
data InternedURI
instance GHC.Classes.Eq (Data.Interned.Internal.Description Data.Interned.URI.InternedURI)
instance Data.String.IsString Data.Interned.URI.InternedURI
instance GHC.Classes.Eq Data.Interned.URI.InternedURI
instance GHC.Classes.Ord Data.Interned.URI.InternedURI
instance GHC.Show.Show Data.Interned.URI.InternedURI
instance Data.Interned.Internal.Interned Data.Interned.URI.InternedURI
instance Data.Interned.Internal.Uninternable Data.Interned.URI.InternedURI
instance Data.Hashable.Class.Hashable (Data.Interned.Internal.Description Data.Interned.URI.InternedURI)


-- | This module defines an algebraic datatype for qualified names
--   (QNames), which represents a <a>URI</a> as the combination of a
--   namespace <a>URI</a> and a local component (<a>LName</a>), which can
--   be empty.
--   
--   Although RDF supports using IRIs, the use of <a>URI</a> here precludes
--   this, which means that, for instance, <a>LName</a> only accepts a
--   subset of valid characters. There is currently no attempt to convert
--   from an IRI into a URI.
module Swish.QName

-- | A qualified name, consisting of a namespace URI and the local part of
--   the identifier, which can be empty. The serialisation of a QName is
--   formed by concatanating the two components.
--   
--   <pre>
--   Prelude&gt; :set prompt "swish&gt; "
--   swish&gt; :set -XOverloadedStrings
--   swish&gt; :m + Swish.QName
--   swish&gt; let qn1 = "http://example.com/" :: QName
--   swish&gt; let qn2 = "http://example.com/bob" :: QName
--   swish&gt; let qn3 = "http://example.com/bob/fred" :: QName
--   swish&gt; let qn4 = "http://example.com/bob/fred#x" :: QName
--   swish&gt; let qn5 = "http://example.com/bob/fred:joe" :: QName
--   swish&gt; map getLocalName [qn1, qn2, qn3, qn4, qn5]
--   ["","bob","fred","x","fred:joe"]
--   swish&gt; getNamespace qn1
--   http://example.com/
--   swish&gt; getNamespace qn2
--   http://example.com/
--   swish&gt; getNamespace qn3
--   http://example.com/bob/
--   swish&gt; getNamespace qn4
--   http://example.com/bob/fred#
--   </pre>
data QName

-- | A local name, which can be empty.
--   
--   At present, the local name can not contain a space character and can
--   only contain ascii characters (those that match <a>isAscii</a>).
--   
--   In version <tt>0.9.0.3</tt> and earlier, the following characters were
--   not allowed in local names: '#', ':', or '/' characters.
--   
--   This is all rather experimental.
data LName

-- | The empty local name.
emptyLName :: LName

-- | Create a local name.
newLName :: Text -> Maybe LName

-- | Extract the local name.
getLName :: LName -> Text

-- | Create a new qualified name with an explicit local component.
newQName :: URI -> LName -> QName

-- | Create a new qualified name.
qnameFromURI :: URI -> Maybe QName

-- | Return the URI of the namespace stored in the QName. This does not
--   contain the local component.
getNamespace :: QName -> URI

-- | Return the local component of the QName.
getLocalName :: QName -> LName

-- | Returns the full URI of the QName (ie the combination of the namespace
--   and local components).
getQNameURI :: QName -> URI

-- | Convert a filepath to a file: URI stored in a QName. If the input file
--   path is relative then the current working directory is used to convert
--   it into an absolute path.
--   
--   If the input represents a directory then it *must* end in the
--   directory separator - so for Posix systems use <tt>"/foo/bar/"</tt>
--   rather than <tt>"/foo/bar"</tt>.
--   
--   This has not been tested on Windows.
qnameFromFilePath :: FilePath -> IO QName
instance GHC.Classes.Ord Swish.QName.LName
instance GHC.Classes.Eq Swish.QName.LName
instance GHC.Show.Show Swish.QName.LName
instance Data.String.IsString Swish.QName.LName
instance Data.String.IsString Swish.QName.QName
instance GHC.Classes.Eq Swish.QName.QName
instance GHC.Classes.Ord Swish.QName.QName
instance GHC.Show.Show Swish.QName.QName


-- | This module defines algebraic datatypes for namespaces and scoped
--   names.
--   
--   For these purposes, a namespace is a prefix and URI used to identify a
--   namespace (cf. XML namespaces), and a scoped name is a name that is
--   scoped by a specified namespace.
module Swish.Namespace

-- | A NameSpace value consists of an optional prefix and a corresponding
--   URI.
data Namespace

-- | Create a name space from a URI and an optional prefix label.
makeNamespace :: Maybe Text -> URI -> Namespace

-- | Create a qualified name by combining the URI from the name space with
--   a local component.
makeNamespaceQName :: Namespace -> LName -> QName

-- | Returns the prefix stored in the name space.
getNamespacePrefix :: Namespace -> Maybe Text

-- | Returns the URI stored in the name space.
getNamespaceURI :: Namespace -> URI

-- | Convert the name space to a (prefix, URI) tuple.
getNamespaceTuple :: Namespace -> (Maybe Text, URI)

-- | A full ScopedName value has a QName prefix, namespace URI and a local
--   part. ScopedName values may omit the prefix (see <a>Namespace</a>) or
--   the local part.
--   
--   Some applications may handle null namespace URIs as meaning the local
--   part is relative to some base URI.
data ScopedName

-- | Returns the namespace.
getScopeNamespace :: ScopedName -> Namespace

-- | Returns the local part.
getScopeLocal :: ScopedName -> LName

-- | Returns the prefix of the namespace, if set.
getScopePrefix :: ScopedName -> Maybe Text

-- | Returns the URI of the namespace.
getScopeURI :: ScopedName -> URI

-- | Get the QName corresponding to a scoped name.
getQName :: ScopedName -> QName

-- | Get URI corresponding to a scoped name (using RDF conventions).
getScopedNameURI :: ScopedName -> URI

-- | Test if supplied string matches the display form of a scoped name.
matchName :: String -> ScopedName -> Bool

-- | Construct a ScopedName.
makeScopedName :: Maybe Text -> URI -> LName -> ScopedName

-- | Construct a ScopedName from a QName.
makeQNameScopedName :: Maybe Text -> QName -> ScopedName

-- | Construct a ScopedName for a bare URI (the label is set to "").
makeURIScopedName :: URI -> ScopedName

-- | Construct a ScopedName.
makeNSScopedName :: Namespace -> LName -> ScopedName

-- | This should never appear as a valid name
nullScopedName :: ScopedName

-- | Utility routine to create a @prefix line (matching N3/Turtle) grammar
--   for this namespace.
namespaceToBuilder :: Namespace -> Builder
instance GHC.Classes.Eq Swish.Namespace.Namespace
instance GHC.Classes.Ord Swish.Namespace.Namespace
instance GHC.Show.Show Swish.Namespace.Namespace
instance Data.String.IsString Swish.Namespace.ScopedName
instance GHC.Classes.Eq Swish.Namespace.ScopedName
instance GHC.Classes.Ord Swish.Namespace.ScopedName
instance GHC.Show.Show Swish.Namespace.ScopedName


-- | This module defines a framework for defining inference rules over some
--   expression form. It is intended to be used with RDF graphs, but the
--   structures aim to be quite generic with respect to the expression
--   forms allowed.
module Swish.Rule

-- | Expression is a type class for values over which proofs may be
--   constructed.
class (Eq ex) => Expression ex

-- | Is expression true in all interpretations? If so, then its truth is
--   assumed without justification.
isValid :: Expression ex => ex -> Bool

-- | A Formula is a named expression.
data Formula ex
Formula :: ScopedName -> ex -> Formula ex

-- | Name used for formula in proof chain
[formName] :: Formula ex -> ScopedName

-- | Named formula value
[formExpr] :: Formula ex -> ex

-- | Rule is a data type for inference rules that can be used to construct
--   a step in a proof.
data Rule ex
Rule :: ScopedName -> ([ex] -> [ex]) -> (ex -> [[ex]]) -> ([ex] -> ex -> Bool) -> Rule ex

-- | Name of rule, for use when displaying a proof
[ruleName] :: Rule ex -> ScopedName

-- | Forward application of a rule, takes a list of expressions and returns
--   a list (possibly empty) of forward applications of the rule to
--   combinations of the antecedent expressions. Note that all of the
--   results returned can be assumed to be (simultaneously) true, given the
--   antecedents provided.
[fwdApply] :: Rule ex -> [ex] -> [ex]

-- | Backward application of a rule, takes an expression and returns a list
--   of alternative antecedents, each of which is a list of expressions
--   that jointly yield the given consequence through application of the
--   inference rule. An empty list is returned if no antecedents will allow
--   the consequence to be inferred.
[bwdApply] :: Rule ex -> ex -> [[ex]]

-- | Inference check. Takes a list of antecedent expressions and a
--   consequent expression, returning True if the consequence can be
--   obtained from the antecedents by application of the rule. When the
--   antecedents and consequent are both given, this is generally more
--   efficient that using either forward or backward chaining. Also, a
--   particular rule may not fully support either forward or backward
--   chaining, but all rules are required to fully support this function.
--   
--   A default implementation based on forward chaining is given below.
[checkInference] :: Rule ex -> [ex] -> ex -> Bool

-- | A set of rules labelled with their name.
type RuleMap ex = Map ScopedName (Rule ex)

-- | The namespace <tt>http://id.ninebynine.org/2003/Ruleset/null</tt> with
--   the prefix <tt>null:</tt>.
nullScope :: Namespace

-- | Create a scoped name with the null namespace.
nullSN :: LName -> ScopedName

-- | The null formula.
nullFormula :: Formula ex

-- | The null rule.
nullRule :: Rule ex

-- | Checks that consequence is a result of applying the rule to the
--   antecedants.
fwdCheckInference :: (Eq ex) => Rule ex -> [ex] -> ex -> Bool

-- | Checks that the antecedants are all required to create the consequence
--   using the given rule.
bwdCheckInference :: (Eq ex) => Rule ex -> [ex] -> ex -> Bool

-- | Create a displayable form of a labelled formula
showsFormula :: (ShowLines ex) => String -> Formula ex -> ShowS

-- | Return a displayable form of a list of labelled formulae
showsFormulae :: (ShowLines ex) => String -> [Formula ex] -> String -> ShowS

-- | Show a string left justified in a field of at least the specified
--   number of characters width.
showsWidth :: Int -> String -> ShowS
instance GHC.Show.Show ex => GHC.Show.Show (Swish.Rule.Formula ex)
instance GHC.Classes.Eq (Swish.Rule.Formula ex)
instance GHC.Classes.Ord (Swish.Rule.Formula ex)
instance GHC.Classes.Eq (Swish.Rule.Rule ex)
instance GHC.Classes.Ord (Swish.Rule.Rule ex)
instance GHC.Show.Show (Swish.Rule.Rule ex)


-- | This module defines a ruleset data type, used to collect information
--   about a ruleset that may contribute torwards inferences in RDF; e.g.
--   RDF and RDFS are rulesets.
--   
--   A <a>Ruleset</a> consists of a namespace, a collection of axioms, and
--   a collection of rules.
module Swish.Ruleset

-- | A Rule set.
data Ruleset ex
Ruleset :: Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex

-- | Namespace.
[rsNamespace] :: Ruleset ex -> Namespace

-- | Axioms.
[rsAxioms] :: Ruleset ex -> [Formula ex]

-- | Rules.
[rsRules] :: Ruleset ex -> [Rule ex]

-- | A set of Rulesets labelled by their Namespace.
type RulesetMap ex = Map Namespace (Ruleset ex)

-- | Create a ruleset.
makeRuleset :: Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex

-- | Extract the namespace of a ruleset.
getRulesetNamespace :: Ruleset ex -> Namespace

-- | Extract the axioms from a ruleset.
getRulesetAxioms :: Ruleset ex -> [Formula ex]

-- | Extract the rules from a ruleset.
getRulesetRules :: Ruleset ex -> [Rule ex]

-- | Find a named axiom in a ruleset.
getRulesetAxiom :: ScopedName -> Ruleset ex -> Maybe (Formula ex)

-- | Find a named rule in a ruleset.
getRulesetRule :: ScopedName -> Ruleset ex -> Maybe (Rule ex)

-- | Find a named axiom in a proof context.
getContextAxiom :: ScopedName -> Formula ex -> [Ruleset ex] -> Formula ex

-- | Find a named axiom in a proof context.
getMaybeContextAxiom :: ScopedName -> [Ruleset ex] -> Maybe (Formula ex)

-- | Find a named rule in a proof context.
getContextRule :: ScopedName -> Rule ex -> [Ruleset ex] -> Rule ex

-- | Find a named rule in a proof context.
getMaybeContextRule :: ScopedName -> [Ruleset ex] -> Maybe (Rule ex)
instance GHC.Classes.Eq (Swish.Ruleset.Ruleset ex)


-- | This module defines a framework for constructing proofs over some
--   expression form. It is intended to be used with RDF graphs, but the
--   structures aim to be quite generic with respect to the expression
--   forms allowed.
--   
--   It does not define any proof-finding strategy.
module Swish.Proof

-- | Proof is a structure that presents a chain of rule applications that
--   yield a result expression from a given expression
data Proof ex
Proof :: [Ruleset ex] -> Formula ex -> Formula ex -> [Step ex] -> Proof ex

-- | Proof context: list of rulesets, each of which provides a number of
--   axioms and rules.
[proofContext] :: Proof ex -> [Ruleset ex]

-- | Given expression
[proofInput] :: Proof ex -> Formula ex

-- | Result expression
[proofResult] :: Proof ex -> Formula ex

-- | Chain of inference rule applications progressing from input to result
[proofChain] :: Proof ex -> [Step ex]

-- | Step in proof chain
--   
--   The display name for a proof step comes from the display name of its
--   consequence formula.
data Step ex
Step :: Rule ex -> [Formula ex] -> Formula ex -> Step ex

-- | Inference rule used
[stepRule] :: Step ex -> Rule ex

-- | Antecedents of inference rule
[stepAnt] :: Step ex -> [Formula ex]

-- | Named consequence of inference rule
[stepCon] :: Step ex -> Formula ex

-- | Check consistency of given proof. The supplied rules and axioms are
--   assumed to be correct.
checkProof :: (Expression ex, Ord ex) => Proof ex -> Bool

-- | Check proof. If there is an error then return information about the
--   failing step.
explainProof :: (Expression ex, Ord ex) => Proof ex -> Maybe String

-- | A proof step is valid if rule is in list of rules and the antecedents
--   are sufficient to obtain the conclusion and the antecedents are in the
--   list of formulae already proven.
--   
--   Note: this function depends on the ruleName of any rule being unique
--   among all rules. In particular the name of the step rule being in
--   correspondence with the name of one of the indicated valid rules of
--   inference.
checkStep :: Ord ex => [Rule ex] -> [ex] -> Step ex -> Bool

-- | Returns a simple string representation of a proof.
showProof :: (ShowLines ex) => String -> Proof ex -> String

-- | Create a displayable form of a proof, returned as a <a>ShowS</a>
--   value.
--   
--   This function is intended to allow the calling function some control
--   of multiline displays by providing:
--   
--   <ol>
--   <li>the first line of the proof is not preceded by any text, so it may
--   be appended to some preceding text on the same line,</li>
--   <li>the supplied newline string is used to separate lines of the
--   formatted text, and may include any desired indentation, and</li>
--   <li>no newline is output following the final line of text.</li>
--   </ol>
showsProof :: (ShowLines ex) => String -> Proof ex -> ShowS

-- | Create a displayable form of a labelled formula
showsFormula :: (ShowLines ex) => String -> Formula ex -> ShowS
instance GHC.Show.Show ex => GHC.Show.Show (Swish.Proof.Step ex)


-- | This module defines some commonly used vocabulary terms from the RDF
--   (<a>http://www.w3.org/TR/rdf-syntax-grammar/</a>) and RDF Schema
--   (<a>http://www.w3.org/TR/rdf-schema/</a>) documents.
module Swish.RDF.Vocabulary.RDF

-- | Maps <tt>rdf</tt> to
--   <a>http://www.w3.org/1999/02/22-rdf-syntax-ns#</a>.
namespaceRDF :: Namespace

-- | Maps <tt>rdfs</tt> to <a>http://www.w3.org/2000/01/rdf-schema#</a>.
namespaceRDFS :: Namespace

-- | <tt>rdf:RDF</tt>.
rdfRDF :: ScopedName

-- | <tt>rdf:Description</tt>.
rdfDescription :: ScopedName

-- | <tt>rdf:ID</tt>.
rdfID :: ScopedName

-- | <tt>rdf:about</tt>.
rdfAbout :: ScopedName

-- | <tt>rdf:parseType</tt>.
rdfParseType :: ScopedName

-- | <tt>rdf:resource</tt>.
rdfResource :: ScopedName

-- | <tt>rdf:li</tt>.
rdfLi :: ScopedName

-- | <tt>rdf:nodeID</tt>.
rdfNodeID :: ScopedName

-- | <tt>rdf:datatype</tt>.
rdfDatatype :: ScopedName

-- | <tt>rdf:_1</tt>.
rdf1 :: ScopedName

-- | <tt>rdf:_2</tt>.
rdf2 :: ScopedName

-- | Create a <tt>rdf:_n</tt> entity.
--   
--   There is no check that the argument is not 0, so it is possible to
--   create the un-defined label <tt>rdf:_0</tt>.
rdfn :: Word32 -> ScopedName

-- | <tt>rdfs:Resource</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_resource</a>.
rdfsResource :: ScopedName

-- | <tt>rdfs:Class</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_class</a>.
rdfsClass :: ScopedName

-- | <tt>rdfs:Literal</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_literal</a>.
rdfsLiteral :: ScopedName

-- | <tt>rdfs:Datatype</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_datatype</a>.
rdfsDatatype :: ScopedName

-- | <tt>rdf:XMLLiteral</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_xmlliteral</a>.
rdfXMLLiteral :: ScopedName

-- | <tt>rdf:Property</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_property</a>.
rdfProperty :: ScopedName

-- | <tt>rdfs:range</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_range</a>.
rdfsRange :: ScopedName

-- | <tt>rdfs:domain</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_domain</a>.
rdfsDomain :: ScopedName

-- | <tt>rdf:type</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_type</a>.
rdfType :: ScopedName

-- | <tt>rdfs:subClassOf</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_subclassof</a>.
rdfsSubClassOf :: ScopedName

-- | <tt>rdfs:subPropertyOf</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_subpropertyof</a>.
rdfsSubPropertyOf :: ScopedName

-- | <tt>rdfs:label</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_label</a>.
rdfsLabel :: ScopedName

-- | <tt>rdfs:comment</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_comment</a>.
rdfsComment :: ScopedName

-- | <tt>rdfs:Container</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_container</a>.
rdfsContainer :: ScopedName

-- | <tt>rdf:Bag</tt> from <a>http://www.w3.org/TR/rdf-schema/#ch_bag</a>.
rdfBag :: ScopedName

-- | <tt>rdf:Seq</tt> from <a>http://www.w3.org/TR/rdf-schema/#ch_seq</a>.
rdfSeq :: ScopedName

-- | <tt>rdf:Alt</tt> from <a>http://www.w3.org/TR/rdf-schema/#ch_alt</a>.
rdfAlt :: ScopedName

-- | <tt>rdfs:ContainerMembershipProperty</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_containermembershipproperty</a>.
rdfsContainerMembershipProperty :: ScopedName

-- | <tt>rdfs:member</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_member</a>.
rdfsMember :: ScopedName

-- | <tt>rdf:List</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_list</a>.
rdfList :: ScopedName

-- | <tt>rdf:first</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_first</a>.
rdfFirst :: ScopedName

-- | <tt>rdf:rest</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_rest</a>.
rdfRest :: ScopedName

-- | <tt>rdf:nil</tt> from <a>http://www.w3.org/TR/rdf-schema/#ch_nil</a>.
rdfNil :: ScopedName

-- | <tt>rdf:Statement</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_statement</a>.
rdfStatement :: ScopedName

-- | <tt>rdf:subject</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_subject</a>.
rdfSubject :: ScopedName

-- | <tt>rdf:predicate</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_predicate</a>.
rdfPredicate :: ScopedName

-- | <tt>rdf:object</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_object</a>.
rdfObject :: ScopedName

-- | <tt>rdfs:seeAlso</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_seealso</a>.
rdfsSeeAlso :: ScopedName

-- | <tt>rdfs:isDefinedBy</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_isdefinedby</a>.
rdfsIsDefinedBy :: ScopedName

-- | <tt>rdf:value</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_value</a>.
rdfValue :: ScopedName


-- | This module defines vocabulary terms from the OWL vocabulary. Note
--   that there is an unfortunate mixture of styles for property names -
--   e.g. <a>owlSameAs</a> and <a>owlequivalentClass</a>. At present there
--   is no systematic attempt to include terms from the vocabulary.
module Swish.RDF.Vocabulary.OWL

-- | Maps <tt>owl</tt> to <a>http://www.w3.org/2002/07/owl#</a>.
namespaceOWL :: Namespace

-- | <tt>owl:Ontology</tt>.
owlOntology :: ScopedName

-- | <tt>owl:imports</tt>.
owlimports :: ScopedName

-- | <tt>owl:versionInfo</tt>.
owlversionInfo :: ScopedName

-- | <tt>owl:deprecated</tt>.
owldeprecated :: ScopedName

-- | <tt>owl:priorVersion</tt>.
owlpriorVersion :: ScopedName

-- | <tt>owl:backwartCompatibleWith</tt>.
owlbackwardCompatibleWith :: ScopedName

-- | <tt>owl:incompatibleWith</tt>.
owlincompatibleWith :: ScopedName

-- | <tt>owl:Class</tt>.
owlClass :: ScopedName

-- | <tt>owl:Thing</tt>.
owlThing :: ScopedName

-- | <tt>owl:Thing</tt>.
owlNothing :: ScopedName

-- | <tt>owl:NamedIndividual</tt>.
owlNamedIndividual :: ScopedName

-- | <tt>owl:sameAs</tt>.
owlSameAs :: ScopedName

-- | <tt>owl:equivalentClass</tt>.
owlequivalentClass :: ScopedName

-- | <tt>owl:equivalentProperty</tt>.
owlequivalentProperty :: ScopedName

-- | <tt>owl:ObjectProperty</tt>.
owlObjectProperty :: ScopedName

-- | <tt>owl:DatatypeProperty</tt>.
owlDatatypeProperty :: ScopedName

-- | <tt>owl:AnnotationProperty</tt>.
owlAnnotationProperty :: ScopedName

-- | <tt>owl:rational</tt>.
owlrational :: ScopedName

-- | <tt>owl:real</tt>.
owlreal :: ScopedName


-- | This module defines vocabulary terms from the XSD document.
module Swish.RDF.Vocabulary.XSD

-- | Maps <tt>xsd</tt> to <a>http://www.w3.org/2001/XMLSchema#</a>.
namespaceXSD :: Namespace

-- | Create a scoped name for an XSD datatype with the given name.
xsdType :: LName -> ScopedName

-- | <tt>xsd:string</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#string</a>.
xsdString :: ScopedName

-- | <tt>xsd:boolean</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#boolean</a>.
xsdBoolean :: ScopedName

-- | <tt>xsd:decimal</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#decimal</a>.
xsdDecimal :: ScopedName

-- | <tt>xsd:float</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#float</a>.
xsdFloat :: ScopedName

-- | <tt>xsd:double</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#double</a>.
xsdDouble :: ScopedName

-- | <tt>xsd:dateTime</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#dateTime</a>.
xsdDateTime :: ScopedName

-- | <tt>xsd:time</tt> from <a>http://www.w3.org/TR/xmlschema-2/#time</a>.
xsdTime :: ScopedName

-- | <tt>xsd:date</tt> from <a>http://www.w3.org/TR/xmlschema-2/#date</a>.
xsdDate :: ScopedName

-- | <tt>xsd:anyURI</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#anyURI</a>.
xsdAnyURI :: ScopedName

-- | <tt>xsd:integer</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#integer</a>.
xsdInteger :: ScopedName

-- | <tt>xsd:nonPositiveInteger</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger</a>.
xsdNonPosInteger :: ScopedName

-- | <tt>xsd:negativeInteger</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#negativeInteger</a>.
xsdNegInteger :: ScopedName

-- | <tt>xsd:long</tt> from <a>http://www.w3.org/TR/xmlschema-2/#long</a>.
xsdLong :: ScopedName

-- | <tt>xsd:int</tt> from <a>http://www.w3.org/TR/xmlschema-2/#int</a>.
xsdInt :: ScopedName

-- | <tt>xsd:short</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#short</a>.
xsdShort :: ScopedName

-- | <tt>xsd:byte</tt> from <a>http://www.w3.org/TR/xmlschema-2/#byte</a>.
xsdByte :: ScopedName

-- | <tt>xsd:nonNegativeInteger</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger</a>.
xsdNonNegInteger :: ScopedName

-- | <tt>xsd:unsignedLong</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#unsignedLong</a>.
xsdUnsignedLong :: ScopedName

-- | <tt>xsd:unsignedInt</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#unsignedInt</a>.
xsdUnsignedInt :: ScopedName

-- | <tt>xsd:unsignedShort</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#unsignedShort</a>.
xsdUnsignedShort :: ScopedName

-- | <tt>xsd:unsignedByte</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#unsignedByte</a>.
xsdUnsignedByte :: ScopedName

-- | <tt>xsd:positiveInteger</tt> from
--   <a>http://www.w3.org/TR/xmlschema-2/#positiveInteger</a>.
xsdPosInteger :: ScopedName


-- | This module defines some commonly used vocabulary terms, using the
--   <a>Namespace</a> and <a>ScopedName</a> data types. Additional
--   vocabularies are available in the set of
--   <tt>Swish.RDF.Vocabulary.*</tt> modules, parts of which are
--   re-exported by this module
module Swish.RDF.Vocabulary

-- | Maps <tt>rdfd</tt> to
--   <tt>http://id.ninebynine.org/2003/rdfext/rdfd#</tt>.
namespaceRDFD :: Namespace

-- | Create a namespace for the datatype family schema used by Swish.
namespaceXsdType :: LName -> Namespace

-- | Maps <tt>math</tt> to <a>http://www.w3.org/2000/10/swap/math#</a>.
namespaceMATH :: Namespace

-- | Maps <tt>log</tt> to <a>http://www.w3.org/2000/10/swap/log#</a>.
namespaceLOG :: Namespace

-- | Maps <tt>daml</tt> to <a>http://www.daml.org/2000/10/daml-ont#</a>.
namespaceDAML :: Namespace

-- | Maps <tt>default</tt> to <tt>http://id.ninebynine.org/default/</tt>.
namespaceDefault :: Namespace

-- | Maps <tt>swish</tt> to <tt>http://id.ninebynine.org/2003/Swish/</tt>.
namespaceSwish :: Namespace

-- | Maps <tt>rs_rdf</tt> to
--   <tt>http://id.ninebynine.org/2003/Ruleset/rdf#</tt>.
scopeRDF :: Namespace

-- | Maps <tt>rs_rdfs</tt> to
--   <tt>http://id.ninebynine.org/2003/Ruleset/rdfs#</tt>.
scopeRDFS :: Namespace

-- | Maps <tt>rs_rdfd</tt> to
--   <tt>http://id.ninebynine.org/2003/Ruleset/rdfd#</tt>.
scopeRDFD :: Namespace

-- | Represent the language tag for a literal string, following RFC 3066
--   <a>http://www.ietf.org/rfc/rfc3066.txt</a>.
--   
--   Use <a>toLangTag</a> to create a tag and <a>fromLangTag</a> to convert
--   back. The case is preserved for the tag, although comparison (both the
--   <a>Eq</a> instance and <tt>compareLangTag</tt>) is done using the
--   lower-case form of the tags.
--   
--   As an example:
--   
--   <pre>
--   Prelude&gt; :set prompt "swish&gt; "
--   swish&gt; :set -XOverloadedStrings
--   swish&gt; :m + Swish.RDF.Vocabulary
--   swish&gt; let en = "en" :: LanguageTag
--   swish&gt; let us = "en-us" :: LanguageTag
--   swish&gt; let gb = "en-GB" :: LanguageTag
--   swish&gt; gb
--   en-GB
--   swish&gt; gb == "en-gb"
--   True
--   swish&gt; en == us
--   False
--   swish&gt; en `isBaseLang` us
--   True
--   swish&gt; us `isBaseLang` en
--   False
--   swish&gt; us `isBaseLang` gb
--   False
--   </pre>
data LanguageTag

-- | Create a <a>LanguageTag</a> element from the label.
--   
--   Valid tags follow the ABNF from RCF 3066, which is
--   
--   <pre>
--   Language-Tag = Primary-subtag *( "-" Subtag )
--   Primary-subtag = 1*8ALPHA
--   Subtag = 1*8(ALPHA / DIGIT)
--   </pre>
--   
--   There are no checks that the primary or secondary sub tag values are
--   defined in any standard, such as ISO 639, or obey any other
--   syntactical restriction than given above.
toLangTag :: Text -> Maybe LanguageTag

-- | Convert a language tag back into text form.
fromLangTag :: LanguageTag -> Text

-- | Compare language tags using the Language-range specification in
--   section 2.5 of RFC 3066.
--   
--   <a>True</a> is returned if the comparison tag is the same as, or
--   matches a prefix of, the base tag (where the match must be over
--   complete sub tags).
--   
--   Note that
--   
--   <pre>
--   l1 `isBaseLang` l2 == l2 `isBaseLang` l1
--   </pre>
--   
--   only when
--   
--   <pre>
--   l1 == l2
--   </pre>
isBaseLang :: LanguageTag -> LanguageTag -> Bool

-- | Convert a local name to a scoped name in the <tt>swish</tt> namespace
--   (<a>namespaceSwish</a>).
swishName :: LName -> ScopedName

-- | <tt>rdfd:GeneralRestriction</tt>.
rdfdGeneralRestriction :: ScopedName

-- | <tt>rdfd:onProperties</tt>.
rdfdOnProperties :: ScopedName

-- | <tt>rdfd:constraint</tt>.
rdfdConstraint :: ScopedName

-- | <tt>rdfd:maxCardinality</tt>.
rdfdMaxCardinality :: ScopedName

-- | <tt>log:implies</tt>.
logImplies :: ScopedName

-- | <tt>default:base</tt>.
defaultBase :: ScopedName
instance GHC.Show.Show Swish.RDF.Vocabulary.LanguageTag
instance Data.String.IsString Swish.RDF.Vocabulary.LanguageTag
instance GHC.Classes.Eq Swish.RDF.Vocabulary.LanguageTag
instance GHC.Classes.Ord Swish.RDF.Vocabulary.LanguageTag


-- | This module defines a memory-based RDF graph instance. At present only
--   RDF 1.0 is explicitly supported; I have not gone through the RDF 1.1
--   changes to see how the code needs to be updated. This means that you
--   can have untyped strings in your graph that do not match the same
--   content but with an explicit <tt>xsd:string</tt> datatype.
--   
--   Note that the identifiers for blank nodes may <i>not</i> be propogated
--   when a graph is written out using one of the formatters, such as
--   <a>Turtle</a>. There is limited support for generating new blank nodes
--   from an existing set of triples; e.g. <a>newNode</a> and
--   <a>newNodes</a>.
module Swish.RDF.Graph

-- | RDF graph node values
--   
--   cf. <a>http://www.w3.org/TR/rdf-concepts/#section-Graph-syntax</a>
--   version 1.0
--   
--   This is extended from the RDF abstract graph syntax in the following
--   ways:
--   
--   (a) a graph can be part of a resource node or blank node (cf.
--   Notation3 formulae)
--   
--   (b) a "variable" node option is distinguished from a blank node. I
--   have found this useful for encoding and handling queries, even though
--   query variables can be expressed as blank nodes.
--   
--   (c) a "NoNode" option is defined. This might otherwise be handled by
--   <tt>Maybe (RDFLabel g)</tt>.
--   
--   Prior to version <tt>0.7.0.0</tt>, literals were represented by a
--   single constructor, <tt>Lit</tt>, with an optional argument. Language
--   codes for literals was also stored as a <a>ScopedName</a> rather than
--   as a <a>LanguageTag</a>.
data RDFLabel

-- | resource
Res :: ScopedName -> RDFLabel

-- | plain literal
--   (<a>http://www.w3.org/TR/rdf-concepts/#dfn-plain-literal</a>)
Lit :: Text -> RDFLabel

-- | plain literal
LangLit :: Text -> LanguageTag -> RDFLabel

-- | typed literal
--   (<a>http://www.w3.org/TR/rdf-concepts/#dfn-typed-literal</a>)
TypedLit :: Text -> ScopedName -> RDFLabel

-- | blank node
Blank :: String -> RDFLabel

-- | variable (not used in ordinary graphs)
Var :: String -> RDFLabel

-- | no node (not used in ordinary graphs)
NoNode :: RDFLabel

-- | A type that can be converted to a RDF Label.
--   
--   The String instance converts to an untyped literal (so no language tag
--   is assumed).
--   
--   The <a>UTCTime</a> and <a>Day</a> instances assume values are in UTC.
--   
--   The conversion for XSD types attempts to use the canonical form
--   described in section 2.3.1 of
--   <a>http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#lexical-space</a>.
--   
--   Note that this is similar to <a>toRDFLabel</a>; the code should
--   probably be combined at some point.
class ToRDFLabel a
toRDFLabel :: ToRDFLabel a => a -> RDFLabel

-- | A type that can be converted from a RDF Label, with the possibility of
--   failure.
--   
--   The String instance converts from an untyped literal (so it can not be
--   used with a string with a language tag).
--   
--   The following conversions are supported for common XSD types
--   (out-of-band values result in <tt>Nothing</tt>):
--   
--   <ul>
--   <li><tt>xsd:boolean</tt> to <tt>Bool</tt></li>
--   <li><tt>xsd:integer</tt> to <tt>Int</tt> and <tt>Integer</tt></li>
--   <li><tt>xsd:float</tt> to <tt>Float</tt></li>
--   <li><tt>xsd:double</tt> to <tt>Double</tt></li>
--   <li><tt>xsd:dateTime</tt> to <tt>UTCTime</tt></li>
--   <li><tt>xsd:date</tt> to <tt>Day</tt></li>
--   </ul>
--   
--   Note that this is similar to <a>fromRDFLabel</a>; the code should
--   probably be combined at some point.
class FromRDFLabel a
fromRDFLabel :: FromRDFLabel a => RDFLabel -> Maybe a

-- | Test if supplied labal is a literal node (<a>Lit</a>, <a>LangLit</a>,
--   or <a>TypedLit</a>).
isLiteral :: RDFLabel -> Bool

-- | Test if supplied labal is an untyped literal node (either <a>Lit</a>
--   or <a>LangLit</a>).
isUntypedLiteral :: RDFLabel -> Bool

-- | Test if supplied labal is a typed literal node (<a>TypedLit</a>).
isTypedLiteral :: RDFLabel -> Bool

-- | Test if supplied labal is a XML literal node
isXMLLiteral :: RDFLabel -> Bool

-- | Test if supplied label is a typed literal node of a given datatype
isDatatyped :: ScopedName -> RDFLabel -> Bool

-- | Test if supplied label is a container membership property
--   
--   Check for namespace is RDF namespace and first character of local name
--   is '_' and remaining characters of local name are all digits
isMemberProp :: RDFLabel -> Bool

-- | Test if supplied labal is a URI resource node
isUri :: RDFLabel -> Bool

-- | Test if supplied labal is a blank node
isBlank :: RDFLabel -> Bool

-- | Test if supplied labal is a query variable
isQueryVar :: RDFLabel -> Bool

-- | Extract text value from a literal node (including the Language and
--   Typed variants). The empty string is returned for other nodes.
getLiteralText :: RDFLabel -> Text

-- | Extract the ScopedName value from a resource node
--   (<a>nullScopedName</a> is returned for non-resource nodes).
getScopedName :: RDFLabel -> ScopedName

-- | Make a blank node from a supplied query variable, or return the
--   supplied label unchanged. (Use this in when substituting an
--   existential for an unsubstituted query variable.)
makeBlank :: RDFLabel -> RDFLabel

-- | Turtle-style quoting rules for a string.
--   
--   At present the choice is between using one or three double quote
--   (<tt>"</tt>) characters to surround the string; i.e. using single
--   quote (<tt>'</tt>) characters is not supported.
--   
--   As of Swish 0.9.0.6, the <tt>\f</tt> character is converted to
--   <tt>\u000C</tt> rather than left as is to aid interoperability with
--   some other tools.
quote :: Bool -> String -> String

-- | See <a>quote</a>.
quoteT :: Bool -> Text -> Text

-- | A set of RDF triples.
type RDFArcSet = ArcSet RDFLabel

-- | RDF Triple (statement)
--   
--   At present there is no check or type-level constraint that stops the
--   subject or predicate of the triple from being a literal.
type RDFTriple = Arc RDFLabel

-- | Convert 3 RDF labels to a RDF triple.
--   
--   See also <tt>Swish.RDF.GraphClass.arcFromTriple</tt>.
toRDFTriple :: (ToRDFLabel s, ToRDFLabel p, ToRDFLabel o) => s -> p -> o -> RDFTriple

-- | Extract the contents of a RDF triple.
--   
--   See also <tt>Swish.RDF.GraphClass.arcToTriple</tt>.
fromRDFTriple :: (FromRDFLabel s, FromRDFLabel p, FromRDFLabel o) => RDFTriple -> Maybe (s, p, o)

-- | Memory-based graph with namespaces and subgraphs.
--   
--   The primary means for adding arcs to an existing graph are:
--   
--   <ul>
--   <li><a>setArcs</a> from the <a>LDGraph</a> instance, which replaces
--   the existing set of arcs and does not change the namespace map.</li>
--   <li><a>addArc</a> which checks that the arc is unknown before adding
--   it but does not change the namespace map or re-label any blank nodes
--   in the arc.</li>
--   </ul>
data NSGraph lb
NSGraph :: NamespaceMap -> FormulaMap lb -> ArcSet lb -> NSGraph lb

-- | the namespaces to use
[namespaces] :: NSGraph lb -> NamespaceMap

-- | any associated formulae (a.k.a. sub- or named- graps)
[formulae] :: NSGraph lb -> FormulaMap lb

-- | the statements in the graph
[statements] :: NSGraph lb -> ArcSet lb

-- | Memory-based RDF graph type
type RDFGraph = NSGraph RDFLabel

-- | Create a new RDF graph from a supplied set of arcs.
--   
--   This version will attempt to fill up the namespace map of the graph
--   based on the input labels (including datatypes on literals). For
--   faster creation of a graph you can use:
--   
--   <pre>
--   emptyRDFGraph { statements = arcs }
--   </pre>
--   
--   which is how this routine was defined in version <tt>0.3.1.1</tt> and
--   earlier.
toRDFGraph :: RDFArcSet -> RDFGraph

-- | Create a new, empty RDF graph (it is just <a>mempty</a>).
emptyRDFGraph :: RDFGraph

-- | Namespace prefix list entry
--   
--   A map for name spaces (key is the prefix).
type NamespaceMap = Map (Maybe Text) URI

-- | Create an empty namespace map.
emptyNamespaceMap :: NamespaceMap

-- | Graph formula entry
data LookupFormula lb gr
Formula :: lb -> gr -> LookupFormula lb gr

-- | The label for the formula
[formLabel] :: LookupFormula lb gr -> lb

-- | The contents of the formula
[formGraph] :: LookupFormula lb gr -> gr

-- | A named formula.
type Formula lb = LookupFormula lb (NSGraph lb)

-- | A map for named formulae.
type FormulaMap lb = Map lb (NSGraph lb)

-- | Create an empty formula map.
emptyFormulaMap :: FormulaMap RDFLabel

-- | Add an arc to the graph. It does not relabel any blank nodes in the
--   input arc, nor does it change the namespace map, but it does ensure
--   that the arc is unknown before adding it.
addArc :: (Label lb) => Arc lb -> NSGraph lb -> NSGraph lb

-- | Merge RDF graphs, renaming blank and query variable nodes as needed to
--   neep variable nodes from the two graphs distinct in the resulting
--   graph.
--   
--   Currently formulae are not guaranteed to be preserved across a merge.
merge :: (Label lb) => NSGraph lb -> NSGraph lb -> NSGraph lb

-- | Return list of all labels (including properties) in the graph
--   satisfying a supplied filter predicate. This routine includes the
--   labels in any formulae.
allLabels :: (Label lb) => (lb -> Bool) -> NSGraph lb -> Set lb

-- | Return list of all subjects and objects in the graph satisfying a
--   supplied filter predicate.
allNodes :: (Label lb) => (lb -> Bool) -> NSGraph lb -> Set lb

-- | Remap selected nodes in graph.
--   
--   This is the node renaming operation that prevents graph-scoped
--   variable nodes from being merged when two graphs are merged.
remapLabels :: (Label lb) => [lb] -> [lb] -> (lb -> lb) -> NSGraph lb -> NSGraph lb

-- | Externally callable function to construct a list of (old,new) values
--   to be used for graph label remapping.
remapLabelList :: (Label lb) => [lb] -> [lb] -> [(lb, lb)]

-- | Given a node and a list of existing nodes, find a new node for the
--   supplied node that does not clash with any existing node. (Generates
--   an non-terminating list of possible replacements, and picks the first
--   one that isn't already in use.)
newNode :: (Label lb) => lb -> [lb] -> lb

-- | Given a node and a list of existing nodes, generate a list of new
--   nodes for the supplied node that do not clash with any existing node.
newNodes :: (Label lb) => lb -> [lb] -> [lb]

-- | Replace the namespace information in the graph.
setNamespaces :: NamespaceMap -> NSGraph lb -> NSGraph lb

-- | Retrieve the namespace map in the graph.
getNamespaces :: NSGraph lb -> NamespaceMap

-- | Replace the formulae in the graph.
setFormulae :: FormulaMap lb -> NSGraph lb -> NSGraph lb

-- | Retrieve the formulae in the graph.
getFormulae :: NSGraph lb -> FormulaMap lb

-- | Add (or replace) a formula.
setFormula :: (Label lb) => Formula lb -> NSGraph lb -> NSGraph lb

-- | Find a formula in the graph, if it exists.
getFormula :: (Label lb) => NSGraph lb -> lb -> Maybe (NSGraph lb)

-- | <a>fmap</a> for <a>NSGraph</a> instances.
fmapNSGraph :: (Ord lb) => (lb -> lb) -> NSGraph lb -> NSGraph lb

-- | <a>traverse</a> for <a>NSGraph</a> instances.
traverseNSGraph :: (Applicative f, Ord a) => (a -> f a) -> NSGraph a -> f (NSGraph a)

-- | Labelled Directed Graph class.
--   
--   Minimum required implementation: <a>emptyGraph</a>, <a>setArcs</a>,
--   and <a>getArcs</a>.
class LDGraph lg lb where extract sel = update (filter sel) addGraphs addg = update (union (getArcs addg)) delete g1 g2 = setArcs g2 (getArcs g2 `difference` getArcs g1) labels = getComponents arcLabels . getArcs nodes = getComponents arcNodes . getArcs update f g = setArcs g (f (getArcs g))

-- | Create the empty graph.
emptyGraph :: LDGraph lg lb => lg lb

-- | Replace the existing arcs in the graph.
setArcs :: LDGraph lg lb => lg lb -> ArcSet lb -> lg lb

-- | Extract all the arcs from a graph
getArcs :: LDGraph lg lb => lg lb -> ArcSet lb

-- | Extract those arcs that match the given <a>Selector</a>.
extract :: (LDGraph lg lb, Ord lb) => Selector lb -> lg lb -> lg lb

-- | Add the two graphs
addGraphs :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb

-- | Remove those arcs in the first graph from the second graph
delete :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb

-- | Enumerate the distinct labels contained in a graph; that is, any label
--   that appears in the subject, predicate or object position of an
--   <a>Arc</a>.
labels :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb

-- | Enumerate the distinct nodes contained in a graph; that is, any label
--   that appears in the subject or object position of an <a>Arc</a>.
nodes :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb

-- | Update the arcs in a graph using a supplied function.
update :: LDGraph lg lb => (ArcSet lb -> ArcSet lb) -> lg lb -> lg lb

-- | Label class.
--   
--   A label may have a fixed binding, which means that the label
--   identifies (is) a particular graph node, and different such labels are
--   always distinct nodes. Alternatively, a label may be unbound
--   (variable), which means that it is a placeholder for an unknown node
--   label. Unbound node labels are used as graph-local identifiers for
--   indicating when the same node appears in several arcs.
--   
--   For the purposes of graph-isomorphism testing, fixed labels are
--   matched when they are the same. Variable labels may be matched with
--   any other variable label. Our definition of isomorphism (for RDF
--   graphs) does not match variable labels with fixed labels.
class (Ord lb, Show lb) => Label lb

-- | Does this node have a variable binding?
labelIsVar :: Label lb => lb -> Bool

-- | Calculate the hash of the label using the supplied seed.
labelHash :: Label lb => Int -> lb -> Int

-- | Extract the local id from a variable node.
getLocal :: Label lb => lb -> String

-- | Make a label value from a local id.
makeLabel :: Label lb => String -> lb

-- | Arc type.
--   
--   Prior to <tt>0.7.0.0</tt> you could also use <tt>asubj</tt>,
--   <tt>apred</tt> and <tt>aobj</tt> to access the elements of the arc.
data Arc lb
Arc :: lb -> lb -> lb -> Arc lb

-- | The subject of the arc.
[arcSubj] :: Arc lb -> lb

-- | The predicate (property) of the arc.
[arcPred] :: Arc lb -> lb

-- | The object of the arc.
[arcObj] :: Arc lb -> lb

-- | Create an arc.
arc :: lb -> lb -> lb -> Arc lb

-- | Identify arcs.
type Selector lb = Arc lb -> Bool

-- | <tt>rdf:RDF</tt>.
resRdfRDF :: RDFLabel

-- | <tt>rdf:Description</tt>.
resRdfDescription :: RDFLabel

-- | <tt>rdf:ID</tt>.
resRdfID :: RDFLabel

-- | <tt>rdf:about</tt>.
resRdfAbout :: RDFLabel

-- | <tt>rdf:parseType</tt>.
resRdfParseType :: RDFLabel

-- | <tt>rdf:resource</tt>.
resRdfResource :: RDFLabel

-- | <tt>rdf:li</tt>.
resRdfLi :: RDFLabel

-- | <tt>rdf:nodeID</tt>.
resRdfNodeID :: RDFLabel

-- | <tt>rdf:datatype</tt>.
resRdfDatatype :: RDFLabel

-- | <tt>rdf:_1</tt>.
resRdf1 :: RDFLabel

-- | <tt>rdf:_2</tt>.
resRdf2 :: RDFLabel

-- | Create a <tt>rdf:_n</tt> entity.
--   
--   There is no check that the argument is not <tt>0</tt>.
resRdfn :: Word32 -> RDFLabel

-- | <tt>rdfs:Resource</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_resource</a>.
resRdfsResource :: RDFLabel

-- | <tt>rdfs:Class</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_class</a>.
resRdfsClass :: RDFLabel

-- | <tt>rdfs:Literal</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_literal</a>.
resRdfsLiteral :: RDFLabel

-- | <tt>rdfs:Datatype</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_datatype</a>.
resRdfsDatatype :: RDFLabel

-- | <tt>rdf:XMLLiteral</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_xmlliteral</a>.
resRdfXMLLiteral :: RDFLabel

-- | <tt>rdf:Property</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_property</a>.
resRdfProperty :: RDFLabel

-- | <tt>rdfs:range</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_range</a>.
resRdfsRange :: RDFLabel

-- | <tt>rdfs:domain</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_domain</a>.
resRdfsDomain :: RDFLabel

-- | <tt>rdf:type</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_type</a>.
resRdfType :: RDFLabel

-- | <tt>rdfs:subClassOf</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_subclassof</a>.
resRdfsSubClassOf :: RDFLabel

-- | <tt>rdfs:subPropertyOf</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_subpropertyof</a>.
resRdfsSubPropertyOf :: RDFLabel

-- | <tt>rdfs:label</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_label</a>.
resRdfsLabel :: RDFLabel

-- | <tt>rdfs:comment</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_comment</a>.
resRdfsComment :: RDFLabel

-- | <tt>rdfs:Container</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_container</a>.
resRdfsContainer :: RDFLabel

-- | <tt>rdf:Bag</tt> from <a>http://www.w3.org/TR/rdf-schema/#ch_bag</a>.
resRdfBag :: RDFLabel

-- | <tt>rdf:Seq</tt> from <a>http://www.w3.org/TR/rdf-schema/#ch_seq</a>.
resRdfSeq :: RDFLabel

-- | <tt>rdf:Alt</tt> from <a>http://www.w3.org/TR/rdf-schema/#ch_alt</a>.
resRdfAlt :: RDFLabel

-- | <tt>rdfs:ContainerMembershipProperty</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_containermembershipproperty</a>.
resRdfsContainerMembershipProperty :: RDFLabel

-- | <tt>rdfs:member</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_member</a>.
resRdfsMember :: RDFLabel

-- | <tt>rdf:List</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_list</a>.
resRdfList :: RDFLabel

-- | <tt>rdf:first</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_first</a>.
resRdfFirst :: RDFLabel

-- | <tt>rdf:rest</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_rest</a>.
resRdfRest :: RDFLabel

-- | <tt>rdf:nil</tt> from <a>http://www.w3.org/TR/rdf-schema/#ch_nil</a>.
resRdfNil :: RDFLabel

-- | <tt>rdf:Statement</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_statement</a>.
resRdfStatement :: RDFLabel

-- | <tt>rdf:subject</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_subject</a>.
resRdfSubject :: RDFLabel

-- | <tt>rdf:predicate</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_predicate</a>.
resRdfPredicate :: RDFLabel

-- | <tt>rdf:object</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_object</a>.
resRdfObject :: RDFLabel

-- | <tt>rdfs:seeAlso</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_seealso</a>.
resRdfsSeeAlso :: RDFLabel

-- | <tt>rdfs:isDefinedBy</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_isdefinedby</a>.
resRdfsIsDefinedBy :: RDFLabel

-- | <tt>rdf:value</tt> from
--   <a>http://www.w3.org/TR/rdf-schema/#ch_value</a>.
resRdfValue :: RDFLabel

-- | <tt>owl:sameAs</tt>.
resOwlSameAs :: RDFLabel

-- | <tt>rdfd:GeneralRestriction</tt>.
resRdfdGeneralRestriction :: RDFLabel

-- | <tt>rdfd:onProperties</tt>.
resRdfdOnProperties :: RDFLabel

-- | <tt>rdfd:constraint</tt>.
resRdfdConstraint :: RDFLabel

-- | <tt>rdfd:maxCardinality</tt>.
resRdfdMaxCardinality :: RDFLabel

-- | <tt>log:implies</tt>.
resLogImplies :: RDFLabel

-- | Match graphs, returning <a>True</a> if they are equivalent, with a map
--   of labels to equivalence class identifiers (see <a>graphMatch</a> for
--   further details).
grMatchMap :: (Label lb) => NSGraph lb -> NSGraph lb -> (Bool, LabelMap (ScopedLabel lb))

-- | Graph equality.
grEq :: (Label lb) => NSGraph lb -> NSGraph lb -> Bool

-- | Remap a single graph node.
--   
--   If the node is not one of those to be remapped, the supplied value is
--   returned unchanged.
mapnode :: (Label lb) => [lb] -> [lb] -> (lb -> lb) -> lb -> lb

-- | Construct a list of (oldnode,newnode) values to be used for graph
--   label remapping. The function operates recursively, adding new nodes
--   generated to the accumulator and also to the list of nodes to be
--   avoided.
maplist :: (Label lb) => [lb] -> [lb] -> (lb -> lb) -> [(lb, lb)] -> [(lb, lb)]
instance GHC.Classes.Eq Swish.RDF.Graph.RDFLabel
instance GHC.Show.Show Swish.RDF.Graph.RDFLabel
instance GHC.Classes.Ord Swish.RDF.Graph.RDFLabel
instance Swish.GraphClass.Label Swish.RDF.Graph.RDFLabel
instance Data.String.IsString Swish.RDF.Graph.RDFLabel
instance Swish.RDF.Graph.ToRDFLabel Swish.RDF.Graph.RDFLabel
instance Swish.RDF.Graph.FromRDFLabel Swish.RDF.Graph.RDFLabel
instance Swish.RDF.Graph.ToRDFLabel GHC.Types.Char
instance Swish.RDF.Graph.FromRDFLabel GHC.Types.Char
instance Swish.RDF.Graph.ToRDFLabel GHC.Base.String
instance Swish.RDF.Graph.FromRDFLabel GHC.Base.String
instance Swish.RDF.Graph.ToRDFLabel GHC.Types.Bool
instance Swish.RDF.Graph.FromRDFLabel GHC.Types.Bool
instance Swish.RDF.Graph.ToRDFLabel GHC.Types.Float
instance Swish.RDF.Graph.FromRDFLabel GHC.Types.Float
instance Swish.RDF.Graph.ToRDFLabel GHC.Types.Double
instance Swish.RDF.Graph.FromRDFLabel GHC.Types.Double
instance Swish.RDF.Graph.ToRDFLabel GHC.Types.Int
instance Swish.RDF.Graph.FromRDFLabel GHC.Types.Int
instance Swish.RDF.Graph.ToRDFLabel GHC.Integer.Type.Integer
instance Swish.RDF.Graph.FromRDFLabel GHC.Integer.Type.Integer
instance Swish.RDF.Graph.ToRDFLabel Data.Time.Clock.UTC.UTCTime
instance Swish.RDF.Graph.FromRDFLabel Data.Time.Clock.UTC.UTCTime
instance Swish.RDF.Graph.ToRDFLabel Data.Time.Calendar.Days.Day
instance Swish.RDF.Graph.FromRDFLabel Data.Time.Calendar.Days.Day
instance Swish.RDF.Graph.ToRDFLabel Swish.Namespace.ScopedName
instance Swish.RDF.Graph.FromRDFLabel Swish.Namespace.ScopedName
instance Swish.RDF.Graph.ToRDFLabel Swish.QName.QName
instance Swish.RDF.Graph.FromRDFLabel Swish.QName.QName
instance Swish.RDF.Graph.ToRDFLabel Network.URI.URI
instance Swish.RDF.Graph.FromRDFLabel Network.URI.URI
instance (GHC.Classes.Eq lb, GHC.Classes.Eq gr) => GHC.Classes.Eq (Swish.RDF.Graph.LookupFormula lb gr)
instance (GHC.Classes.Ord lb, GHC.Classes.Ord gr) => GHC.Classes.Ord (Swish.RDF.Graph.LookupFormula lb gr)
instance Swish.GraphClass.Label lb => GHC.Show.Show (Swish.RDF.Graph.Formula lb)
instance Swish.GraphClass.LDGraph Swish.RDF.Graph.NSGraph lb
instance Swish.GraphClass.Label lb => GHC.Base.Monoid (Swish.RDF.Graph.NSGraph lb)
instance Swish.GraphClass.Label lb => GHC.Classes.Eq (Swish.RDF.Graph.NSGraph lb)
instance Swish.GraphClass.Label lb => GHC.Classes.Ord (Swish.RDF.Graph.NSGraph lb)
instance Swish.GraphClass.Label lb => GHC.Show.Show (Swish.RDF.Graph.NSGraph lb)


-- | This module provides an in-memory RDF Graph (it re-exports
--   <a>Swish.RDF.Graph</a>).
module Swish.RDF


-- | Support for the RDF Parsing modules.
module Swish.RDF.Parser.Utils

-- | Type for special name lookup table
type SpecialMap = Map String ScopedName

-- | Define default table of namespaces
prefixTable :: [Namespace]

-- | Define default special-URI table.
specialTable :: Maybe ScopedName -> [(String, ScopedName)]

-- | Run the parser and return the successful parse or an error message
--   which consists of the standard Polyparse error plus a fragment of the
--   unparsed input to provide context.
runParserWithError :: Parser a b -> a -> Text -> Either String b

-- | The result of a parse, which is either an error message or a graph.
type ParseResult = Either String RDFGraph

-- | Run the parser and ignore the result.
ignore :: (Applicative f) => f a -> f ()

-- | Match the character.
char :: Char -> Parser s Char

-- | Match the character, ignoring the result.
ichar :: Char -> Parser s ()

-- | Match the text.
string :: String -> Parser s String

-- | Match the text.
stringT :: Text -> Parser s Text

-- | Match the given string and any trailing <a>whiteSpace</a>.
symbol :: String -> Parser s String

-- | As <a>symbol</a> but ignoring the result.
isymbol :: String -> Parser s ()

-- | Convert a parser into one that also matches, and ignores, trailing
--   <a>whiteSpace</a>.
lexeme :: Parser s a -> Parser s a

-- | Succeed if the next character does not match the given function.
notFollowedBy :: (Char -> Bool) -> Parser s ()

-- | Match white space: a space or a comment (<tt>#</tt> character and
--   anything following it up to to a new line).
whiteSpace :: Parser s ()

-- | Run the parser <a>many</a> times and ignore the result.
skipMany :: Parser s a -> Parser s ()

-- | Run the parser <a>many1</a> times and ignore the result.
skipMany1 :: Parser s a -> Parser s ()

-- | Match zero or more occurences of parser followed by separator.
endBy :: Parser s a -> Parser s b -> Parser s [a]

-- | Match zero or more occurences of the parser followed by the separator.
sepEndBy :: Parser s a -> Parser s b -> Parser s [a]

-- | Accept one or more occurences of the parser separated by the
--   separator. Unlike <a>endBy</a> the last separator is optional.
sepEndBy1 :: Parser s a -> Parser s b -> Parser s [a]

-- | Accept zero or more runs of the parser ending with the delimiter.
manyTill :: Parser s a -> Parser s b -> Parser s [a]

-- | Accept any character that is not a member of the given string.
noneOf :: String -> Parser s Char

-- | Match the end-of-line sequence (<tt>"\n"</tt>, <tt>"\r"</tt>, or
--   <tt>"\r\n"</tt>).
eoln :: Parser s ()

-- | Matches <a>.</a>.
fullStop :: Parser s ()

-- | A four-digit hex value (e.g. <tt>1a34</tt> or <tt>03F1</tt>).
hex4 :: Parser a Char

-- | An eight-digit hex value that has a maximum of <tt>0010FFFF</tt>.
hex8 :: Parser a Char

-- | Append the two URIs. Given the change in signature of
--   <a>relativeTo</a> in version <tt>2.4.0.0</tt> of <tt>network</tt>, it
--   is not clear that this function is necessary. At the very least, it
--   should be changed to just return a <a>URI</a>.
appendURIs :: URI -> URI -> Either String URI


-- | This Module implements a NTriples parser, returning a new
--   <a>RDFGraph</a> consisting of triples and namespace information parsed
--   from the supplied NTriples input string, or an error indication.
--   
--   REFERENCES:
--   
--   <ul>
--   <li>"RDF Test Cases", W3C Recommendation 10 February 2004,
--   <a>http://www.w3.org/TR/rdf-testcases/#ntriples</a></li>
--   </ul>
--   
--   NOTES:
--   
--   <ul>
--   <li>If the URI is actually an IRI (Internationalized Resource
--   Identifiers) then the parser will fail since <a>parseURI</a>
--   fails.</li>
--   <li>The case of language tags is retained.</li>
--   <li>Update to the document "N-Triples. A line-based syntax for an RDF
--   graph" W3C Working Group Note 09 April 2013,
--   <a>http://www.w3.org/TR/2013/NOTE-n-triples-20130409/</a></li>
--   </ul>
module Swish.RDF.Parser.NTriples

-- | The result of a parse, which is either an error message or a graph.
type ParseResult = Either String RDFGraph

-- | Parse a string.
parseNT :: Text -> ParseResult


-- | This module defines functions for representing and manipulating query
--   binding variable sets. This is the key data that mediates between
--   query and back substitution when performing inferences. A framework of
--   query variable modifiers is provided that can be used to implement
--   richer inferences, such as filtering of query results, or replacing
--   values based on known relationships.
module Swish.VarBinding

-- | VarBinding is the type of an arbitrary variable bindings value, where
--   the type of the bound values is not specified.
data VarBinding a b
VarBinding :: (a -> Maybe b) -> Set (a, b) -> Bool -> VarBinding a b
[vbMap] :: VarBinding a b -> a -> Maybe b
[vbEnum] :: VarBinding a b -> Set (a, b)
[vbNull] :: VarBinding a b -> Bool

-- | The null, or empry, binding maps no query variables. This is the
--   <a>mempty</a> instance of the Monoid.
nullVarBinding :: VarBinding a b

-- | Return a list of the variables bound by a supplied variable binding
boundVars :: (Ord a, Ord b) => VarBinding a b -> Set a

-- | VarBinding subset function, tests to see if one query binding is a
--   subset of another; i.e. every query variable mapping defined by one is
--   also defined by the other.
subBinding :: (Ord a, Ord b) => VarBinding a b -> VarBinding a b -> Bool

-- | Function to make a variable binding from a list of pairs of variable
--   and corresponding assigned value.
makeVarBinding :: (Ord a, Ord b) => [(a, b)] -> VarBinding a b

-- | Apply query binding to a supplied value, returning the value unchanged
--   if no binding is defined
applyVarBinding :: VarBinding a a -> a -> a

-- | Join a pair of query bindings, returning a new binding that maps all
--   variables recognized by either of the input bindings. If the bindings
--   should overlap, such overlap is not detected and the value from the
--   first binding provided is used.
joinVarBindings :: (Ord a, Ord b) => VarBinding a b -> VarBinding a b -> VarBinding a b

-- | Add a single new value to a variable binding and return the resulting
--   new variable binding.
addVarBinding :: (Ord a, Ord b) => a -> b -> VarBinding a b -> VarBinding a b

-- | Define the type of a function to modify variable bindings in forward
--   chaining based on rule antecedent matches. This function is used to
--   implement the "allocated to" logic described in Appendix B of the RDF
--   semantics document, in which a specific blank node is associated with
--   all matches of some specific value by applications of the rule on a
--   given graph. Use <a>id</a> if no modification of the variable bindings
--   is required.
--   
--   This datatype consists of the modifier function itself, which operates
--   on a list of variable bindings rather than a single variable binding
--   (because some modifications share context across a set of bindings),
--   and some additional descriptive information that allows possible usage
--   patterns to be analyzed.
--   
--   Some usage patterns (see <a>vbmUsage</a> for more details):
--   
--   <ul>
--   <li><i>filter</i> all variables are input variables, and the effect of
--   the modifier function is to drop variable bindings that don't satisfy
--   some criterion. Identifiable by an empty element in
--   <tt>vbmUsage</tt>.</li>
--   <li><i>source</i> all variables are output variables: a raw query
--   could be viewed as a source of variable bindings. Identifiable by an
--   element of <tt>vbmUsage</tt> equal to <tt>vbmVocab</tt>.</li>
--   <li><i>modifier</i> for each supplied variable binding, one or more
--   new variable bindings may be created that contain the input variables
--   bound as supplied plus some additional variables. Identifiable by an
--   element of <tt>vbmUsage</tt> some subset of <tt>vbmVocab</tt>.</li>
--   </ul>
--   
--   A variety of variable usage patterns may be supported by a given
--   modifier: a modifier may be used to define new variable bindings from
--   existing bindings in a number of ways, or simply to check that some
--   required relationship between bindings is satisfied. (Example, for
--   <tt>a + b = c</tt>, any one variable can be deduced from the other
--   two, or all three may be supplied to check that the relationship does
--   indeed hold.)
data VarBindingModify a b
VarBindingModify :: ScopedName -> ([VarBinding a b] -> [VarBinding a b]) -> [a] -> [[a]] -> VarBindingModify a b

-- | Name used to identify this variable binding modifier when building
--   inference rules.
[vbmName] :: VarBindingModify a b -> ScopedName

-- | Apply variable binding modifier to a list of variable bindings,
--   returning a new list. The result list is not necessarily the same
--   length as the supplied list.
[vbmApply] :: VarBindingModify a b -> [VarBinding a b] -> [VarBinding a b]

-- | List of variables used by this modifier. All results of applying this
--   modifier contain bindings for these variables.
[vbmVocab] :: VarBindingModify a b -> [a]

-- | List of binding modifier usage patterns supported. Each pattern is
--   characterized as a list of variables for which new bindings may be
--   created by some application of this modifier, assuming that bindings
--   for all other variables in <tt>vbmVocab</tt> are supplied.
[vbmUsage] :: VarBindingModify a b -> [[a]]

-- | Type for variable binding modifier that has yet to be instantiated
--   with respect to the variables that it operates upon.
type OpenVarBindingModify lb vn = [lb] -> VarBindingModify lb vn

-- | Extract variable binding name from <tt>OpenVarBindingModify</tt> value
--   
--   (Because only the name is required, the application to an undefined
--   list of variable labels should never be evaluated, as long as the name
--   is not dependent on the variable names in any way.)
--   
--   NOT QUITE... some of the functions that create
--   <tt>OpenVarBindingModify</tt> instances also pattern-match the number
--   of labels provided, forcing evaluation of the labels parameter, even
--   though it's not used.
openVbmName :: OpenVarBindingModify lb vn -> ScopedName

-- | Variable binding modifier compatibility test.
--   
--   Given a list of bound variables and a variable binding modifier,
--   return a list of new variables that may be bound, or <tt>Nothing</tt>.
--   
--   Note: if the usage pattern component is well-formed (i.e. all elements
--   different) then at most one element can be compatible with a given
--   input variable set.
vbmCompatibility :: (Eq a) => VarBindingModify a b -> [a] -> Maybe [a]

-- | Compose variable binding modifiers.
--   
--   Returns <tt>Just a</tt> new variable binding modifier that corresponds
--   to applying the first supplied modifier and then applying the second
--   one, or <tt>Nothing</tt> if the two modifiers cannot be compatibly
--   composed.
--   
--   NOTE: this function does not, in general, commute.
--   
--   NOTE: if there are different ways to achieve the same usage, that
--   usage is currently repeated in the result returned.
vbmCompose :: (Eq a) => VarBindingModify a b -> VarBindingModify a b -> Maybe (VarBindingModify a b)

-- | Compose sequence of variable binding modifiers.
composeSequence :: (Eq a) => [VarBindingModify a b] -> Maybe (VarBindingModify a b)

-- | Find all compatible compositions of a list of variable binding
--   modifiers for a given set of supplied bound variables.
findCompositions :: (Eq a) => [VarBindingModify a b] -> [a] -> [VarBindingModify a b]

-- | Return <tt>Just a</tt> compatible composition of variable binding
--   modifiers for a given set of supplied bound variables, or
--   <tt>Nothing</tt> if there is no compatible composition
findComposition :: (Eq a) => [VarBindingModify a b] -> [a] -> Maybe (VarBindingModify a b)

-- | VarBindingFilter is a function type that tests to see if a query
--   binding satisfies some criterion.
--   
--   Queries often want to apply some kind of filter or condition to the
--   variable bindings that are processed. In inference rules, it sometimes
--   seems desirable to stipulate additional conditions on the things that
--   are matched.
--   
--   This function type is used to perform such tests. A number of simple
--   implementations are included below.
data VarBindingFilter a b
VarBindingFilter :: ScopedName -> [a] -> (VarBinding a b -> Bool) -> VarBindingFilter a b
[vbfName] :: VarBindingFilter a b -> ScopedName
[vbfVocab] :: VarBindingFilter a b -> [a]
[vbfTest] :: VarBindingFilter a b -> VarBinding a b -> Bool

-- | Make a variable binding modifier from a variable binding filter value.
makeVarFilterModify :: VarBindingFilter a b -> VarBindingModify a b

-- | Make a variable test filter for a named variable using a supplied
--   value testing function.
makeVarTestFilter :: ScopedName -> (b -> Bool) -> a -> VarBindingFilter a b

-- | Make a variable comparison filter for named variables using a supplied
--   value comparison function.
makeVarCompareFilter :: ScopedName -> (b -> b -> Bool) -> a -> a -> VarBindingFilter a b

-- | Variable binding modifier that returns exactly those variable bindings
--   presented.
varBindingId :: VarBindingModify a b

-- | Null variable binding modifier
--   
--   This is like <a>varBindingId</a> except parameterized by some labels.
--   I think this is redundant, and should be eliminated.
nullVarBindingModify :: OpenVarBindingModify a b

-- | This function composes a number of query binding filters into a
--   composite filter that accepts any query binding that satisfies at
--   least one of the component values.
varFilterDisjunction :: (Eq a) => [VarBindingFilter a b] -> VarBindingFilter a b

-- | This function composes a number of query binding filters into a
--   composite filter that accepts any query binding that satisfies all of
--   the component values.
--   
--   The same function could be achieved by composing the component
--   filter-based modifiers, but this function is more convenient as it
--   avoids the need to check for modifier compatibility.
varFilterConjunction :: (Eq a) => [VarBindingFilter a b] -> VarBindingFilter a b

-- | This function generates a query binding filter that ensures that two
--   indicated query variables are mapped to the same value.
varFilterEQ :: (Eq b) => a -> a -> VarBindingFilter a b

-- | This function generates a query binding filter that ensures that two
--   indicated query variables are mapped to different values.
varFilterNE :: (Eq b) => a -> a -> VarBindingFilter a b
instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Eq (Swish.VarBinding.VarBinding a b)
instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Swish.VarBinding.VarBinding a b)
instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Base.Monoid (Swish.VarBinding.VarBinding a b)
instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Swish.VarBinding.VarBinding a b)
instance GHC.Show.Show (Swish.VarBinding.OpenVarBindingModify a b)


-- | This module defines the structures used to represent and manipulate
--   datatypes. It is designed as a basis for handling datatyped RDF
--   literals, but the functions in this module are more generic.
module Swish.Datatype

-- | Datatype wraps a <a>DatatypeVal</a> value, hiding the value type that
--   is used only in implementations of the datatype. Users see just the
--   datatype name and associated ruleset.
data Datatype ex lb vn
Datatype :: (DatatypeVal ex vt lb vn) -> Datatype ex lb vn

-- | Get type name from Datatype value
typeName :: Datatype ex lb vn -> ScopedName

-- | Get static rules from Datatype value
typeRules :: Datatype ex lb vn -> Ruleset ex

-- | Make rules for Datatype value based on supplied expression
typeMkRules :: Datatype ex lb vn -> ex -> [Rule ex]

-- | Make variable binding modifiers based on values supplied
typeMkModifiers :: Datatype ex lb vn -> [OpenVarBindingModify lb vn]

-- | Get the canonical form of a datatype value.
typeMkCanonicalForm :: Datatype ex lb vn -> Text -> Maybe Text

-- | Get the named axiom from a Datatype value.
getTypeAxiom :: ScopedName -> Datatype ex lb vn -> Maybe (Formula ex)

-- | Get the named rule from a Datatype value.
getTypeRule :: ScopedName -> Datatype ex lb vn -> Maybe (Rule ex)

-- | DatatypeVal is a structure that defines a number of functions and
--   values that characterize the behaviour of a datatype.
--   
--   A datatype is specified with respect to (polymophic in) a given type
--   of (syntactic) expression with which it may be used, and a value type
--   (whose existence is hidden as an existential type within
--   <a>DatatypeMap</a>).
--   
--   (I tried hiding the value type with an internal existential
--   declaration, but that wouldn't wash. Hence this two-part structure
--   with <a>Datatype</a> in which the internal detail of the value type is
--   hidden from users of the <a>Datatype</a> class.)
--   
--   The datatype characteristic functions have two goals:
--   
--   <ol>
--   <li>to support the general datatype entailment rules defined by the
--   RDF semantics specification, and</li>
--   <li>to define additional datatype-specific inference patterns by means
--   of which provide additional base functionality to applications based
--   on RDF inference.</li>
--   </ol>
--   
--   Datatype-specific inferences are provided using the <a>DatatypeRel</a>
--   structure for a datatype, which allows a number of named relations to
--   be defined on datatype values, and provides mechanisms to calculate
--   missing values in a partially-specified member of a relation.
--   
--   Note that rules and variable binding modifiers that deal with combined
--   values of more than one datatype may be defined separately.
--   Definitions in this module are generally applicable only when using a
--   single datatype.
--   
--   An alternative model for datatype value calculations is inspired by
--   that introduced by CWM for arithmetic operations, e.g.
--   
--   <pre>
--   (1 2 3) math:sum ?x =&gt; ?x rdf:value 6
--   </pre>
--   
--   (where the bare integer <tt>n</tt> here is shorthand for
--   <tt>"n"^^xsd:integer</tt>).
--   
--   Datatype-specific inference patterns are provided in two ways:
--   
--   <ul>
--   <li>by variable binding modifiers that can be combined with the query
--   results during forward- for backward-chaining of inference rules,
--   and</li>
--   <li>by the definition of inference rulesets that involve datatype
--   values.</li>
--   </ul>
--   
--   I believe the first method to be more flexible than the second, in
--   that it more readily supports forward and backward chaining, but can
--   be used only through the definition of new rules.
--   
--   Type parameters:
--   
--   <ul>
--   <li><i><tt>ex</tt></i> is the type of expression with which the
--   datatype may be used.</li>
--   <li><i><tt>vt</tt></i> is the internal value type with which the
--   labels are associated.</li>
--   <li><i><tt>lb</tt></i> is the type of label that may be used as a
--   variable in an expression or rule.</li>
--   <li><i><tt>vn</tt></i> is the type of node that may be used to carry a
--   value in an expression or rule.</li>
--   </ul>
data DatatypeVal ex vt lb vn
DatatypeVal :: ScopedName -> Ruleset ex -> (ex -> [Rule ex]) -> [OpenVarBindingModify lb vn] -> DatatypeMap vt -> [DatatypeRel vt] -> [DatatypeMod vt lb vn] -> DatatypeVal ex vt lb vn

-- | Identifies the datatype, and also its value space class.
[tvalName] :: DatatypeVal ex vt lb vn -> ScopedName

-- | A set of named expressions and rules that are valid in in any theory
--   that recognizes the current datatype.
[tvalRules] :: DatatypeVal ex vt lb vn -> Ruleset ex

-- | A function that accepts an expression and devives some
--   datatype-dependent rules from it. This is provided as a hook for
--   creating datatyped class restriction rules.
[tvalMkRules] :: DatatypeVal ex vt lb vn -> ex -> [Rule ex]

-- | Constructs a list of open variable binding modifiers based on tvalMod,
--   but hiding the actual value type.
[tvalMkMods] :: DatatypeVal ex vt lb vn -> [OpenVarBindingModify lb vn]

-- | Lexical to value mapping, where <tt>vt</tt> is a datatype used within
--   a Haskell program to represent and manipulate values in the datatype's
--   value space
[tvalMap] :: DatatypeVal ex vt lb vn -> DatatypeMap vt

-- | A set of named relations on datatype values. Each relation accepts a
--   list of <tt>Maybe vt</tt>, and computes any unspecified values that
--   are in the relation with values supplied.
[tvalRel] :: DatatypeVal ex vt lb vn -> [DatatypeRel vt]

-- | A list of named values that are used to construct variable binding
--   modifiers, which in turn may be used by a rule definition.
--   
--   TODO: In due course, this value may be calculated automatically from
--   the supplied value for <tt>tvalRel</tt>.
[tvalMod] :: DatatypeVal ex vt lb vn -> [DatatypeMod vt lb vn]

-- | Return the named datatype value modifier, if it exists.
getDTMod :: ScopedName -> DatatypeVal ex vt lb vn -> Maybe (DatatypeMod vt lb vn)

-- | Return the named datatype relation, if it exists.
getDTRel :: ScopedName -> DatatypeVal ex vt lb vn -> Maybe (DatatypeRel vt)

-- | Get the canonical form of a datatype value, or <tt>Nothing</tt>.
tvalMkCanonicalForm :: DatatypeVal ex vt lb vn -> Text -> Maybe Text

-- | DatatypeMap consists of methods that perform lexical-to-value and
--   value-to-canonical-lexical mappings for a datatype.
--   
--   The datatype mappings apply to string lexical forms which are stored
--   as <a>Text</a>.
data DatatypeMap vt
DatatypeMap :: (Text -> Maybe vt) -> (vt -> Maybe Text) -> DatatypeMap vt

-- | Function to map a lexical string to the datatype value. This
--   effectively defines the lexical space of the datatype to be all
--   strings for which yield a value other than <tt>Nothing</tt>.
[mapL2V] :: DatatypeMap vt -> Text -> Maybe vt

-- | Function to map a value to its canonical lexical form, if it has such.
[mapV2L] :: DatatypeMap vt -> vt -> Maybe Text

-- | Datatype for a named relation on values of a datatype.
data DatatypeRel vt
DatatypeRel :: ScopedName -> DatatypeRelFn vt -> DatatypeRel vt
[dtRelName] :: DatatypeRel vt -> ScopedName
[dtRelFunc] :: DatatypeRel vt -> DatatypeRelFn vt

-- | Type for a datatype relation inference function.
--   
--   A datatype relation defines tuples of values that satisfy some
--   relation. A datatype relation inference function calculates values
--   that complete a relation with values supplied.
--   
--   The function accepts a list of <tt>Maybe vt</tt>, where vt is the
--   datatype value type. It returns one of:
--   
--   <ul>
--   <li>Just a list of lists, where each inner list returned is a complete
--   set of values, including the values supplied, that are in the
--   relation.</li>
--   <li>Just an empty list is returned if the supplied values are
--   insufficient to compute any complete sets of values in the
--   relation.</li>
--   <li>Nothing if the supplied values are not consistent with the
--   relation.</li>
--   </ul>
type DatatypeRelFn vt = [Maybe vt] -> Maybe [[vt]]

-- | Type for datatype relation predicate: accepts a list of values and
--   determines whether or not they satisfy the relation.
type DatatypeRelPr vt = [vt] -> Bool

-- | Given a list of argument values and a list of functions for
--   calculating new values from supplied values, return a list of argument
--   values, or <tt>Nothing</tt> if the supplied values are inconsistent
--   with the calculations specified.
--   
--   Each list of values returned corresponds to a set of values that
--   satisfy the relation, consistent with the values supplied.
--   
--   Functions are described as tuple consisting of:
--   
--   (a) a predicate that the argument is required to satisfy
--   
--   (b) a function to apply,
--   
--   (c) a function to apply function (b) to a list of arguments
--   
--   (d) argument list index values to which the function is applied.
--   
--   Each supplied argument is of the form <tt>Maybe a</tt>, where the
--   argument has value type a. <tt>Nothing</tt> indicates arguments of
--   unknown value.
--   
--   The basic idea is that, for each argument position in the relation, a
--   function may be supplied to calculate that argument's possible values
--   from some combination of the other arguments. The results calculated
--   in this way are compared with the original arguments provided: if the
--   values conflict then the relation is presumed to be unsatisfiable with
--   the supplied values, and <tt>Nothing</tt> is returned; if there are
--   any calculated values for arguments supplied without any values, then
--   tbe calculated values are used. If there are any arguments for which
--   no values are supplied or calculated, then the relation is presumed to
--   be underdetermined, and <tt>Just []</tt> is returned.
altArgs :: (Eq vt) => DatatypeRelPr vt -> [(vt -> Bool, [b])] -> ((vt -> Bool) -> b -> [Maybe vt] -> Maybe [vt]) -> DatatypeRelFn vt

-- | <a>altArgs</a> support for unary functions: function descriptor type
type UnaryFnDescr a = (a -> a, Int)

-- | <a>altArgs</a> support for unary functions: function descriptor table
--   type
type UnaryFnTable a = [(a -> Bool, [UnaryFnDescr a])]

-- | <a>altArgs</a> support for unary functions: function applicator type
type UnaryFnApply a = (a -> Bool) -> UnaryFnDescr a -> [Maybe a] -> Maybe [a]

-- | <a>altArgs</a> support for unary functions: function applicator
unaryFnApp :: UnaryFnApply a

-- | <a>altArgs</a> support for binary functions: function descriptor type
type BinaryFnDescr a = (a -> a -> a, Int, Int)

-- | <a>altArgs</a> support for binary functions: function descriptor table
--   type
type BinaryFnTable a = [(a -> Bool, [BinaryFnDescr a])]

-- | <a>altArgs</a> support for binary functions: function applicator type
type BinaryFnApply a = (a -> Bool) -> BinaryFnDescr a -> [Maybe a] -> Maybe [a]

-- | <a>altArgs</a> support for binary functions: function applicator
binaryFnApp :: BinaryFnApply a

-- | <a>altArgs</a> support for binary function with provision for
--   indicating inconsistent supplied values: function descriptor type
type BinMaybeFnDescr a = (a -> a -> Maybe [a], Int, Int)

-- | <a>altArgs</a> support for binary function with provision for
--   indicating inconsistent supplied values: function descriptor table
--   type
type BinMaybeFnTable a = [(a -> Bool, [BinMaybeFnDescr a])]

-- | <a>altArgs</a> support for binary function with provision for
--   indicating inconsistent supplied values: function applicator type
type BinMaybeFnApply a = (a -> Bool) -> BinMaybeFnDescr a -> [Maybe a] -> Maybe [a]

-- | <a>altArgs</a> support for binary function with provision for
--   indicating inconsistent supplied values: function applicator
binMaybeFnApp :: BinMaybeFnApply a

-- | <a>altArgs</a> support for list functions (e.g. sum over list of
--   args), where first element of list is a fold over the rest of the
--   list, and remaining elements of list can be calculated in terms of the
--   result of the fold and the remaining elements
--   
--   List function descriptor is
--   
--   (a) list-fold function, f (e.g. (+)
--   
--   (b) list-fold identity, z (e.g. 0)
--   
--   (c) list-fold-function inverse, g (e.g. (-))
--   
--   (d) index of element to evaluate
--   
--   such that:
--   
--   <pre>
--   (a `f` z) == (z `f` a) == a
--   (a `g` c) == b &lt;=&gt; a == b `f` c
--   (a `g` z) == a
--   (a `g` a) == z
--   </pre>
--   
--   and the result of the folded function does not depend on the order
--   that the list elements are processed.
--   
--   NOTE: the list of <a>ListFnDescr</a> values supplied to <a>altArgs</a>
--   must be at least as long as the argument list. In many cases, Haskell
--   lazy evaluation can be used to supply an arbitrarily long list. See
--   test cases in spike-altargs.hs for an example.
--   
--   Function descriptor type
type ListFnDescr a = (a -> a -> a, a, a -> a -> a, Int)

-- | Function table type
type ListFnTable a = [(a -> Bool, [ListFnDescr a])]

-- | <a>altArgs</a> support for list functions: function applicator type
type ListFnApply a = (a -> Bool) -> ListFnDescr a -> [Maybe a] -> Maybe [a]

-- | <a>altArgs</a> support for list functions: function applicator
listFnApp :: ListFnApply a

-- | Wrapper for data type variable binding modifier included in a datatype
--   value.
data DatatypeMod vt lb vn
DatatypeMod :: ScopedName -> [ModifierFn vt] -> ApplyModifier lb vn -> DatatypeMod vt lb vn
[dmName] :: DatatypeMod vt lb vn -> ScopedName
[dmModf] :: DatatypeMod vt lb vn -> [ModifierFn vt]
[dmAppf] :: DatatypeMod vt lb vn -> ApplyModifier lb vn

-- | Datatype value modifier functions type
--   
--   Each function accepts a list of values and returns a list of values.
--   The exact significance of the different values supplied and returned
--   depends on the variable binding pattern used (cf.
--   <a>ApplyModifier</a>), but in all cases an empty list returned means
--   that the corresponding inputs are not consistent with the function and
--   cannot be used.
type ModifierFn vn = [vn] -> [vn]

-- | Type of function used to apply a data value modifier to specified
--   variables in a supplied variable binding. It also accepts the name of
--   the datatype modifier and carries it into the resulting variable
--   binding modifier.
--   
--   (Note that <tt>vn</tt> is not necessarily the same as <tt>vt</tt>, the
--   datatype value type: the modifier functions may be lifted or otherwise
--   adapted to operate on some other type from which the raw data values
--   are extracted.)
type ApplyModifier lb vn = ScopedName -> [ModifierFn vn] -> OpenVarBindingModify lb vn

-- | Null datatype value modifier
nullDatatypeMod :: DatatypeMod vt lb vn

-- | <a>ApplyModifier</a> function for use with <a>DatatypeMod</a> in cases
--   when the value mapping is a <tt>1-&gt;1</tt> function and inverse,
--   such as negate.
--   
--   <ul>
--   <li><i><tt>nam</tt></i> is the name from the <a>DatatypeMod</a> value
--   that is carried into the resulting variable binding modifier.</li>
--   <li><i><tt>fns</tt></i> are functions used to implement details of the
--   variable binding modifier:<ol><li>is <tt>[x,y] -&gt; [?]</tt>, used as
--   a filter (i.e. not creating any new variable bindings), returning a
--   non-empty list if <tt>x</tt> and <tt>y</tt> are in the appropriate
--   relationship.</li><li>is <tt>[y] -&gt; [x]</tt>, used to perform the
--   calculation in a forward direction.</li><li>is <tt>[x] -&gt; [y]</tt>,
--   used to perform the calculation in a backward direction. This may be
--   the same as (2) (e.g. for negation) or may be different (e.g.
--   increment).</li></ol></li>
--   <li><i><tt>lbs</tt></i> is a list of specific label values for which a
--   variable binding modifier will be generated. (The intent is that a
--   variable-free value can be generated as a Curried function, and
--   instantiated for particular variables as required.)</li>
--   </ul>
--   
--   Note: an irrefutable pattern match for <tt>lbs</tt> is used so that a
--   name for the <a>VarBindingModify</a> value can be extracted using an
--   undefined label value.
makeVmod11inv :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | <a>ApplyModifier</a> function for use with <a>DatatypeMod</a> in cases
--   when the value mapping is a non-invertable <tt>1-&gt;1</tt> injection,
--   such as absolute value.
--   
--   <ul>
--   <li><i><tt>nam</tt></i> is the name from the <a>DatatypeMod</a> value
--   that is carried into the resulting variable binding modifier.</li>
--   <li><i><tt>fns</tt></i> are functions used to implement details of the
--   variable binding modifier:<ol><li>is <tt>[x,y] -&gt; [?]</tt>, used as
--   a filter (i.e. not creating any new variable bindings), returning a
--   non-empty list if <tt>x</tt> and <tt>y</tt> are in the appropriate
--   relationship.</li><li>is <tt>[x]</tt> -&gt; <tt>[y]</tt>, used to
--   perform the calculation.</li></ol></li>
--   <li><i><tt>lbs</tt></i> is a list of specific label values for which a
--   variable binding modifier will be generated.</li>
--   </ul>
--   
--   Note: an irrefutable pattern match for <tt>lbs</tt> is used so that a
--   name for the <a>VarBindingModify</a> value can be extracted using an
--   undefined label value.
makeVmod11 :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | <a>ApplyModifier</a> function for use with <a>DatatypeMod</a> in cases
--   when the value mapping is a <tt>2-&gt;1</tt> invertable function, such
--   as addition or subtraction.
--   
--   <ul>
--   <li><i><tt>nam</tt></i> is the name from the <a>DatatypeMod</a> value
--   that is carried into the resulting variable binding modifier.</li>
--   <li><i><tt>fns</tt></i> are functions used to implement details of the
--   variable binding modifier:<ol><li>is <tt>[x,y,z] -&gt; [?]</tt>, used
--   as a filter (i.e. not creating any new variable bindings), returning a
--   non-empty list if <tt>x</tt>, <tt>y</tt> and <tt>z</tt> are in the
--   appropriate relationship.</li><li>is <tt>[y,z] -&gt; [x]</tt>, used to
--   perform the calculation in a forward direction.</li><li>is <tt>[x,z]
--   -&gt; [y]</tt>, used to run the calculation backwards to determine the
--   first input argument</li><li>is <tt>[x,y] -&gt; [z]</tt>, used to run
--   the calculation backwards to determine the second input
--   argument</li></ol></li>
--   <li><i><tt>lbs</tt></i> is a list of specific label values for which a
--   variable binding modifier will be generated.</li>
--   </ul>
--   
--   Note: an irrefutable pattern match for <tt>lbs</tt> is used so that a
--   name for the <a>VarBindingModify</a> value can be extracted using an
--   undefined label value.
makeVmod21inv :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | <a>ApplyModifier</a> function for use with <a>DatatypeMod</a> in cases
--   when the value mapping is a <tt>2-&gt;1</tt> non-invertable function,
--   such as logical <tt>AND</tt> or <tt>OR</tt>.
--   
--   <ul>
--   <li><i><tt>nam</tt></i> is the name from the <a>DatatypeMod</a> value
--   that is carried into the resulting variable binding modifier.</li>
--   <li><i><tt>fns</tt></i> are functions used to implement details of the
--   variable binding modifier:<ol><li>is <tt>[x,y,z] -&gt; [?]</tt>, used
--   as a filter (i.e. not creating any new variable bindings), returning a
--   non-empty list if <tt>x</tt>, <tt>y</tt> and <tt>z</tt> are in the
--   appropriate relationship.</li><li>is <tt>[y,z] -&gt; [x]</tt>, used to
--   perform the calculation in a forward direction.</li></ol></li>
--   <li><i><tt>lbs</tt></i> is a list of specific label values for which a
--   variable binding modifier will be generated.</li>
--   </ul>
--   
--   Note: an irrefutable pattern match for <tt>lbs</tt> is used so that a
--   name for the <a>VarBindingModify</a> value can be extracted using an
--   undefined label value.
makeVmod21 :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | <a>ApplyModifier</a> function for use with <a>DatatypeMod</a> in cases
--   when the value mapping is a simple comparson of two values.
--   
--   <ul>
--   <li><i><tt>nam</tt></i> is the name from the <a>DatatypeMod</a> value
--   that is carried into the resulting variable binding modifier.</li>
--   <li><i><tt>fns</tt></i> are functions used to implement details of the
--   variable binding modifier:<ol><li>is <tt>[x,y] -&gt; [?]</tt>, used as
--   a filter (i.e. not creating any new variable bindings), returning a
--   non-empty list if <tt>x</tt> and <tt>y</tt> are in the appropriate
--   relationship.</li></ol></li>
--   <li><i><tt>lbs</tt></i> is a list of specific label values for which a
--   variable binding modifier will be generated.</li>
--   </ul>
--   
--   Note: an irrefutable pattern match for <tt>lbs</tt> is used so that a
--   name for the <a>VarBindingModify</a> value can be extracted using an
--   undefined label value.
makeVmod20 :: (Eq lb, Show lb, Eq vn, Show vn) => ApplyModifier lb vn

-- | <a>ApplyModifier</a> function for use with <a>DatatypeMod</a> in cases
--   when the value mapping is a <tt>2-&gt;2</tt> non-invertable function,
--   such as quotient/remainder
--   
--   <ul>
--   <li><i><tt>nam</tt></i> is the name from the <a>DatatypeMod</a> value
--   that is carried into the resulting variable binding modifier.</li>
--   <li><i><tt>fns</tt></i> are functions used to implement details of the
--   variable binding modifier:<ol><li>is <tt>[w,x,y,z] -&gt; [?]</tt>,
--   used as a filter (i.e. not creating any new variable bindings),
--   returning a non-empty list if <tt>w</tt>, <tt>x</tt>, <tt>y</tt> and
--   <tt>z</tt> are in the appropriate relationship.</li><li>is <tt>[y,z]
--   -&gt; [w,x]</tt>, used to perform the calculation given two input
--   values.</li></ol></li>
--   <li><i><tt>lbs</tt></i> is a list of specific label values for which a
--   variable binding modifier will be generated.</li>
--   </ul>
--   
--   Note: an irrefutable pattern match for <tt>lbs</tt> is used so that a
--   name for the <a>VarBindingModify</a> value can be extracted using an
--   undefined label value.
--   
--   NOTE: this might be generalized to allow one of <tt>w</tt> or
--   <tt>x</tt> to be specified, and return null if it doesn't match the
--   calculated value.
makeVmod22 :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | <a>ApplyModifier</a> function for use with <a>DatatypeMod</a> in cases
--   when the value mapping is a <tt>N-&gt;1</tt> function, such as Sigma
--   (sum) of a vector.
--   
--   <ul>
--   <li><i><tt>nam</tt></i> is the name from the <a>DatatypeMod</a> value
--   that is carried into the resulting variable binding modifier.</li>
--   <li><i><tt>fns</tt></i> are functions used to implement details of the
--   variable binding modifier:<ol><li>is <tt>[x,y...] -&gt; [?]</tt>, used
--   as a filter (i.e. not creating any new variable bindings), returning a
--   non-empty list if <tt>x</tt> and <tt>y...</tt> are in the appropriate
--   relationship.</li><li>is <tt>[y...] -&gt; [x]</tt>, used to perform
--   the calculation.</li></ol></li>
--   <li><i><tt>lbs</tt></i> is a list of specific label values for which a
--   variable binding modifier will be generated.</li>
--   </ul>
--   
--   Note: an irrefutable pattern match for <tt>lbs</tt> is used so that a
--   name for the <a>VarBindingModify</a> value can be extracted using an
--   undefined label value.
makeVmodN1 :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | Describe a subtype/supertype relationship between a pair of datatypes.
--   
--   Originally, I had this as a supertype field of the DatatypeVal
--   structure, but that suffered from some problems:
--   
--   <ul>
--   <li>supertypes may be introduced retrospectively,</li>
--   <li>the relationship expressed with respect to a single datatype
--   cannot indicate how to do injections/restrictions between the
--   underlying value types.</li>
--   </ul>
--   
--   <ul>
--   <li><i><tt>ex</tt></i> is the type of expression with which the
--   datatype may be used.</li>
--   <li><i><tt>lb</tt></i> is the type of the variable labels used.</li>
--   <li><i><tt>vn</tt></i> is the type of value node used to contain a
--   datatyped value</li>
--   <li><i><tt>supvt</tt></i> is the internal value type of the
--   super-datatype</li>
--   <li><i><tt>subvt</tt></i> is the internal value type of the
--   sub-datatype</li>
--   </ul>
data DatatypeSub ex lb vn supvt subvt
DatatypeSub :: DatatypeVal ex supvt lb vn -> DatatypeVal ex subvt lb vn -> (subvt -> supvt) -> (supvt -> Maybe subvt) -> DatatypeSub ex lb vn supvt subvt

-- | Datatype that is a supertype of <tt>trelSub</tt>, having value space
--   <tt>supvt</tt>.
[trelSup] :: DatatypeSub ex lb vn supvt subvt -> DatatypeVal ex supvt lb vn

-- | Datatype that is a subtype of <tt>trelSup</tt>, having value space
--   <tt>supvt</tt>.
[trelSub] :: DatatypeSub ex lb vn supvt subvt -> DatatypeVal ex subvt lb vn

-- | Function that maps subtype value to corresponding supertype value.
[trelToSup] :: DatatypeSub ex lb vn supvt subvt -> subvt -> supvt

-- | Function that maps supertype value to corresponding subtype value, if
--   there is such a value.
[trelToSub] :: DatatypeSub ex lb vn supvt subvt -> supvt -> Maybe subvt


-- | This module defines the datatytpe mapping and relation values used for
--   RDF dataype <tt>xsd:decimal</tt>.
module Swish.RDF.Datatype.XSD.MapDecimal

-- | Functions that perform lexical-to-value and value-to-canonical-lexical
--   mappings for <tt>xsd:decimal</tt> values.
mapXsdDecimal :: DatatypeMap Double


-- | This module defines the datatytpe mapping and relation values used for
--   RDF dataype <tt>xsd:integer</tt>.
module Swish.RDF.Datatype.XSD.MapInteger

-- | Functions that perform lexical-to-value and value-to-canonical-lexical
--   mappings for <tt>xsd:integer</tt> values.
mapXsdInteger :: DatatypeMap Integer


-- | This module instantiates the <a>VarBinding</a> types and methods for
--   use with RDF graph labels.
module Swish.RDF.VarBinding

-- | <tt>RDFVarBinding</tt> is the specific type type of a variable binding
--   value used with RDF graph queries.
type RDFVarBinding = VarBinding RDFLabel RDFLabel

-- | Define type of query binding modifier for RDF graph inference
type RDFVarBindingModify = VarBindingModify RDFLabel RDFLabel

-- | Open variable binding modifier that operates on RDFLabel values
type RDFOpenVarBindingModify = OpenVarBindingModify RDFLabel RDFLabel

-- | Define type for lookup map of open query binding modifiers
type RDFOpenVarBindingModifyMap = Map ScopedName RDFOpenVarBindingModify

-- | <tt>RDFVarBindingFilter</tt> is a function type that tests to see if a
--   query binding satisfies some criterion, and is used to create a
--   variable binding modifier that simply filers given variable bindings.
--   
--   Queries often want to apply some kind of filter or condition to the
--   variable bindings that are processed. In inference rules, it sometimes
--   seems desirable to stipulate additional conditions on the things that
--   are matched.
--   
--   This function type is used to perform such tests. A number of simple
--   implementations are included.
type RDFVarBindingFilter = VarBindingFilter RDFLabel RDFLabel

-- | maps no query variables.
nullRDFVarBinding :: RDFVarBinding

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a URI reference.
rdfVarBindingUriRef :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a blank node.
rdfVarBindingBlank :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a literal value.
rdfVarBindingLiteral :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to an untyped literal value.
rdfVarBindingUntypedLiteral :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a typed literal value.
rdfVarBindingTypedLiteral :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to an XML literal value.
rdfVarBindingXMLLiteral :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a literal value with a datatype whose
--   URI is bound to another node
rdfVarBindingDatatyped :: RDFLabel -> RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to container membership property.
rdfVarBindingMemberProp :: RDFLabel -> RDFVarBindingFilter


-- | This module defines the structures used by Swish to represent and
--   manipulate RDF datatypes.
module Swish.RDF.Datatype

-- | RDF datatype wrapper used with RDF graph values
type RDFDatatype = Datatype RDFGraph RDFLabel RDFLabel

-- | RDF datatype value used with RDF graph values
type RDFDatatypeVal vt = DatatypeVal RDFGraph vt RDFLabel RDFLabel

-- | RDF datatype modifier used with RDF graph values
type RDFDatatypeMod vt = DatatypeMod vt RDFLabel RDFLabel

-- | RDF value modifier function type
--   
--   This indicates a modifier function that operates on <a>RDFLabel</a>
--   values.
type RDFModifierFn = ModifierFn RDFLabel

-- | RDF value modifier application function type
--   
--   This indicates a function that applies RDFModifierFn functions.
type RDFApplyModifier = ApplyModifier RDFLabel RDFLabel

-- | Create an <a>RDFOpenVarBindingModify</a> value.
--   
--   The key purpose of this function is to lift the supplied variable
--   constraint functions from operating on data values directly to a
--   corresponding list of functions that operate on values contained in
--   RDF graph labels (i.e. RDF literal nodes). It also applies node type
--   checking, such that if the actual RDF nodes supplied do not contain
--   appropriate values then the variable binding is not accepted.
makeRdfDtOpenVarBindingModify :: RDFDatatypeVal vt -> RDFDatatypeMod vt -> RDFOpenVarBindingModify

-- | Create all RDFOpenVarBindingModify values for a given datatype value.
--   See <a>makeRdfDtOpenVarBindingModify</a>.
makeRdfDtOpenVarBindingModifiers :: RDFDatatypeVal vt -> [RDFOpenVarBindingModify]

-- | Apply a datatype modifier using supplied RDF labels to a supplied RDF
--   variable binding.
applyRDFDatatypeMod :: RDFDatatypeVal vt -> RDFDatatypeMod vt -> [RDFLabel] -> [RDFVarBinding] -> [RDFVarBinding]

-- | Describe a subtype/supertype relationship between a pair of RDF
--   datatypes.
type RDFDatatypeSub supvt subvt = DatatypeSub RDFGraph RDFLabel RDFLabel supvt subvt

-- | Convert from a typed literal to a Haskell value, with the possibility
--   of failure.
fromRDFLabel :: RDFDatatypeVal vt -> RDFLabel -> Maybe vt

-- | Convert a Haskell value to a typed literal (label), with the
--   possibility of failure.
toRDFLabel :: RDFDatatypeVal vt -> vt -> Maybe RDFLabel

-- | Create a typed literal. No conversion is made to the string
--   representation.
makeDatatypedLiteral :: ScopedName -> Text -> RDFLabel


-- | This Module implements a Turtle parser, returning a new
--   <a>RDFGraph</a> consisting of triples and namespace information parsed
--   from the supplied input string, or an error indication.
--   
--   REFERENCES:
--   
--   <ul>
--   <li>"Turtle, Terse RDF Triple Language", W3C Candidate Recommendation
--   19 February 2013
--   (&lt;<a>http://www.w3.org/TR/2013/CR-turtle-20130219/L)</a>,
--   <a>http://www.w3.org/TR/turtle/</a></li>
--   </ul>
--   
--   NOTES:
--   
--   <ul>
--   <li>Prior to version <tt>0.9.0.4</tt>, the parser followed the W3C
--   Working Draft 09 August 2011
--   (<a>http://www.w3.org/TR/2011/WD-turtle-20110809/</a>)</li>
--   <li>Strings with no language tag are converted to a <tt>LitTag</tt>
--   not a <tt>TypedLitTag</tt> with a type of <tt>xsd:string</tt> (e.g.
--   see <a>http://www.w3.org/TR/2011/WD-turtle-20110809/#terms</a>).</li>
--   <li>If the URI is actually an IRI (Internationalized Resource
--   Identifiers) then the parser will fail since <a>parseURI</a>
--   fails.</li>
--   <li>The current (August 2013) Turtle test suite from
--   <a>http://www.w3.org/2013/TurtleTests/</a> passes except for the four
--   tests with non-ASCII local names, namely:
--   <tt>localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundaries</tt>,
--   <tt>localName_with_assigned_nfc_PN_CHARS_BASE_character_boundaries</tt>,
--   <tt>localName_with_nfc_PN_CHARS_BASE_character_boundaries</tt>, and
--   <tt>localName_with_non_leading_extras</tt>.</li>
--   </ul>
module Swish.RDF.Parser.Turtle

-- | The result of a parse, which is either an error message or a graph.
type ParseResult = Either String RDFGraph

-- | Parse a string with an optional base URI.
--   
--   Unlike <tt>parseN3</tt> we treat the base URI as a URI and not a
--   QName.
parseTurtle :: Text -> Maybe URI -> ParseResult

-- | Parse as Turtle (with no real base URI).
--   
--   See <a>parseTurtle</a> if you need to provide a base URI.
parseTurtlefromText :: Text -> ParseResult
instance GHC.Show.Show Swish.RDF.Parser.Turtle.TurtleState


-- | This Module implements a Notation 3 parser, returning a new
--   <a>RDFGraph</a> consisting of triples and namespace information parsed
--   from the supplied N3 input string, or an error indication.
--   
--   REFERENCES:
--   
--   <ul>
--   <li>"Notation3 (N3): A readable RDF syntax", W3C Team Submission 14
--   January 2008,
--   <a>http://www.w3.org/TeamSubmission/2008/SUBM-n3-20080114/</a></li>
--   <li>Tim Berners-Lee's design issues series notes and description,
--   <a>http://www.w3.org/DesignIssues/Notation3.html</a></li>
--   <li>Notation 3 Primer by Sean Palmer,
--   <a>http://www.w3.org/2000/10/swap/Primer.html</a></li>
--   </ul>
--   
--   NOTES:
--   
--   <ul>
--   <li>The parser needs to be updated to the latest version ("W3C Team
--   Submission 28 March 2011",
--   <a>http://www.w3.org/TeamSubmission/2011/SUBM-n3-20110328/</a>)</li>
--   <li>UTF-8 handling is not really tested.</li>
--   <li>No performance testing has been applied.</li>
--   <li>Not all N3 grammar elements are supported, including:</li>
--   <li><tt>@forSome</tt> (we read it in but ignore the arguments)</li>
--   <li><tt>@forAll</tt> (this causes a parse error)</li>
--   <li>formulae are lightly tested</li>
--   <li>string support is incomplete (e.g. unrecognized escape characters
--   such as <tt>\q</tt> are probably handled incorrectly)</li>
--   </ul>
module Swish.RDF.Parser.N3

-- | The result of a parse, which is either an error message or a graph.
type ParseResult = Either String RDFGraph

-- | Parse a string with an optional base URI.
--   
--   See also <tt>parseN3fromString</tt>.
parseN3 :: Text -> Maybe QName -> ParseResult

-- | Parse a string as N3 (with no real base URI).
--   
--   See <a>parseN3</a> if you need to provide a base URI.
parseN3fromText :: Text -> ParseResult

-- | Function to supply initial context and parse supplied term.
parseAnyfromText :: N3Parser a -> Maybe QName -> Text -> Either String a

-- | Used in testing.
parseTextFromText :: String -> Text -> Either String String

-- | Used in testing.
parseAltFromText :: String -> String -> Text -> Either String String

-- | Used in testing.
parseNameFromText :: Text -> Either String String

-- | Used in testing.
parseAbsURIrefFromText :: Text -> Either String URI

-- | Used in testing.
parseLexURIrefFromText :: Text -> Either String URI

-- | Used in testing.
parseURIref2FromText :: Text -> Either String ScopedName

-- | The N3 parser.
type N3Parser a = Parser N3State a

-- | N3 parser state
data N3State
N3State :: RDFGraph -> RDFLabel -> NamespaceMap -> SpecialMap -> Word32 -> [Text] -> Bool -> N3State
[graphState] :: N3State -> RDFGraph
[thisNode] :: N3State -> RDFLabel
[prefixUris] :: N3State -> NamespaceMap
[syntaxUris] :: N3State -> SpecialMap
[nodeGen] :: N3State -> Word32
[keywordsList] :: N3State -> [Text]
[allowLocalNames] :: N3State -> Bool

-- | Type for special name lookup table
type SpecialMap = Map String ScopedName

-- | Process the remainder of an <tt>@prefix</tt> line (after this has been
--   processed). The prefix value and URI are added to the parser state.
getPrefix :: N3Parser ()

-- | Match a N3 symbol (an explicit URI or a QName) and convert it to a
--   <a>ScopedName</a>.
n3symbol :: N3Parser ScopedName

-- | Match <tt>?<a>name</a></tt>.
quickVariable :: N3Parser RDFLabel

-- | An explicitly given URI followed by white space.
lexUriRef :: N3Parser URI

-- | Process a N3 document, returning a graph.
document :: N3Parser RDFGraph

-- | Process a sub graph and assign it to the given label.
subgraph :: RDFLabel -> N3Parser RDFGraph

-- | Create a new blank node.
newBlankNode :: N3Parser RDFLabel


-- | This module defines functions for querying an RDF graph to obtain a
--   set of variable substitutions, and to apply a set of variable
--   substitutions to a query pattern to obtain a new graph.
--   
--   It also defines a few primitive graph access functions.
--   
--   A minimal example is shown below, where we query a very simple graph:
--   
--   <pre>
--   &gt;&gt;&gt; :set -XOverloadedStrings
--   
--   &gt;&gt;&gt; import Swish.RDF
--   
--   &gt;&gt;&gt; import Swish.RDF.Parser.N3 (parseN3fromText)
--   
--   &gt;&gt;&gt; import Swish.RDF.Query
--   
--   &gt;&gt;&gt; import Swish.VarBinding (VarBinding(vbMap))
--   
--   &gt;&gt;&gt; import Network.URI (parseURI)
--   
--   &gt;&gt;&gt; import Data.Maybe (fromJust, mapMaybe)
--   
--   &gt;&gt;&gt; let qparse = either error id . parseN3fromText
--   
--   &gt;&gt;&gt; let igr = qparse "@prefix a: &lt;http://example.com/&gt;. a:a a a:A ; a:foo a:bar. a:b a a:B ; a:foo a:bar."
--   
--   &gt;&gt;&gt; let qgr = qparse "?node a ?type."
--   
--   &gt;&gt;&gt; let ans = rdfQueryFind qgr igr
--   
--   &gt;&gt;&gt; :t ans
--   ans :: [Swish.RDF.VarBinding.RDFVarBinding]
--   
--   &gt;&gt;&gt; ans
--   [[(?node,a:a),(?type,a:A)],[(?node,a:b),(?type,a:B)]]
--   
--   &gt;&gt;&gt; let bn = toRDFLabel . fromJust . parseURI $ "http://example.com/B"
--   
--   &gt;&gt;&gt; let arcs = rdfFindArcs (rdfObjEq bn) igr
--   
--   &gt;&gt;&gt; :t arcs
--   arcs :: [RDFTriple]
--   
--   &gt;&gt;&gt; arcs
--   [(a:b,rdf:type,a:B)]
--   
--   &gt;&gt;&gt; let lbls = mapMaybe (`vbMap` (Var "type")) ans
--   
--   &gt;&gt;&gt; :t lbls
--   lbls :: [RDFLabel]
--   
--   &gt;&gt;&gt; lbls
--   [a:A,a:B]
--   </pre>
module Swish.RDF.Query

-- | Basic graph-query function.
--   
--   The triples of the query graph are matched sequentially against the
--   target graph, each taking account of any variable bindings that have
--   already been determined, and adding new variable bindings as triples
--   containing query variables are matched against the graph.
rdfQueryFind :: RDFGraph -> RDFGraph -> [RDFVarBinding]

-- | RDF query filter.
--   
--   This function applies a supplied query binding filter to the result
--   from a call of <a>rdfQueryFind</a>.
--   
--   If none of the query bindings found satisfy the filter, a null list is
--   returned (which is what <a>rdfQueryFind</a> returns if the query
--   cannot be satisfied).
--   
--   (Because of lazy evaluation, this should be as efficient as applying
--   the filter as the search proceeds. I started to build the filter logic
--   into the query function itself, with consequent increase in
--   complexity, until I remembered lazy evaluation lets me keep things
--   separate.)
rdfQueryFilter :: RDFVarBindingFilter -> [RDFVarBinding] -> [RDFVarBinding]

-- | Reverse graph-query function.
--   
--   Similar to <a>rdfQueryFind</a>, but with different success criteria.
--   The query graph is matched against the supplied graph, but not every
--   triple of the query is required to be matched. Rather, every triple of
--   the target graph must be matched, and substitutions for just the
--   variables thus bound are returned. In effect, these are subsitutions
--   in the query that entail the target graph (where <tt>rdfQueryFind</tt>
--   returns substitutions that are entailed by the target graph).
--   
--   Multiple substitutions may be used together, so the result returned is
--   a list of lists of query bindings. Each inner list contains several
--   variable bindings that must all be applied separately to the closure
--   antecendents to obtain a collection of expressions that together are
--   antecedent to the supplied conclusion. A null list of bindings
--   returned means the conclusion can be inferred without any antecedents.
--   
--   Note: in back-chaining, the conditions required to prove each target
--   triple are derived independently, using the inference rule for each
--   such triple, so there are no requirements to check consistency with
--   previously determined variable bindings, as there are when doing
--   forward chaining. A result of this is that there may be redundant
--   triples generated by the back-chaining process. Any process using
--   back-chaining should deal with the results returned accordingly.
--   
--   An empty outer list is returned if no combination of substitutions can
--   infer the supplied target.
rdfQueryBack :: RDFGraph -> RDFGraph -> [[RDFVarBinding]]

-- | RDF back-chaining query filter. This function applies a supplied query
--   binding filter to the result from a call of <a>rdfQueryBack</a>.
--   
--   Each inner list contains bindings that must all be used to satisfy the
--   backchain query, so if any query binding does not satisfy the filter,
--   the entire corresponding row is removed
rdfQueryBackFilter :: RDFVarBindingFilter -> [[RDFVarBinding]] -> [[RDFVarBinding]]

-- | RDF back-chaining query modifier. This function applies a supplied
--   query binding modifier to the result from a call of
--   <a>rdfQueryBack</a>.
--   
--   Each inner list contains bindings that must all be used to satisfy a
--   backchaining query, so if any query binding does not satisfy the
--   filter, the entire corresponding row is removed
rdfQueryBackModify :: VarBindingModify a b -> [[VarBinding a b]] -> [[VarBinding a b]]

-- | Simple entailment (instance) graph query.
--   
--   This function queries a graph to find instances of the query graph in
--   the target graph. It is very similar to the normal forward chaining
--   query <a>rdfQueryFind</a>, except that blank nodes rather than query
--   variable nodes in the query graph are matched against nodes in the
--   target graph. Neither graph should contain query variables.
--   
--   An instance is defined by the RDF semantics specification, per
--   <a>http://www.w3.org/TR/rdf-mt/</a>, and is obtained by replacing
--   blank nodes with URIs, literals or other blank nodes. RDF simple
--   entailment can be determined in terms of instances. This function
--   looks for a subgraph of the target graph that is an instance of the
--   query graph, which is a necessary and sufficient condition for RDF
--   entailment (see the Interpolation Lemma in RDF Semantics, section
--   1.2).
--   
--   It is anticipated that this query function can be used in conjunction
--   with backward chaining to determine when the search for sufficient
--   antecendents to determine some goal has been concluded.
rdfQueryInstance :: RDFGraph -> RDFGraph -> [RDFVarBinding]

-- | Graph substitution function.
--   
--   Uses the supplied variable bindings to substitute variables in a
--   supplied graph, returning a list of result graphs corresponding to
--   each set of variable bindings applied to the input graph. This
--   function is used for formward chaining substitutions, and returns only
--   those result graphs for which all query variables are bound.
rdfQuerySubs :: [RDFVarBinding] -> RDFGraph -> [RDFGraph]

-- | Graph back-substitution function.
--   
--   Uses the supplied variable bindings from <a>rdfQueryBack</a> to
--   perform a series of variable substitutions in a supplied graph,
--   returning a list of lists of result graphs corresponding to each set
--   of variable bindings applied to the input graphs.
--   
--   The outer list of the result contains alternative antecedent lists
--   that satisfy the query goal. Each inner list contains graphs that must
--   all be inferred to satisfy the query goal.
rdfQueryBackSubs :: [[RDFVarBinding]] -> RDFGraph -> [[(RDFGraph, [RDFLabel])]]

-- | Graph substitution function.
--   
--   This function performs the substitutions and returns a list of result
--   graphs each paired with a list unbound variables in each.
rdfQuerySubsAll :: [RDFVarBinding] -> RDFGraph -> [(RDFGraph, [RDFLabel])]

-- | Graph substitution function.
--   
--   This function performs each of the substitutions in <tt>vars</tt>, and
--   replaces any nodes corresponding to unbound query variables with new
--   blank nodes.
rdfQuerySubsBlank :: [RDFVarBinding] -> RDFGraph -> [RDFGraph]

-- | Graph back-substitution function, replacing variables with bnodes.
--   
--   Uses the supplied variable bindings from <a>rdfQueryBack</a> to
--   perform a series of variable substitutions in a supplied graph,
--   returning a list of lists of result graphs corresponding to each set
--   of variable bindings applied to the input graphs.
--   
--   The outer list of the result contains alternative antecedent lists
--   that satisfy the query goal. Each inner list contains graphs that must
--   all be inferred to satisfy the query goal.
rdfQueryBackSubsBlank :: [[RDFVarBinding]] -> RDFGraph -> [[RDFGraph]]

-- | Take a predicate on an RDF statement and a graph, and returns all
--   statements in the graph satisfying that predicate.
--   
--   Use combinations of these as follows:
--   
--   <ul>
--   <li>find all statements with given subject: <tt>rdfFindArcs (rdfSubjEq
--   s)</tt></li>
--   <li>find all statements with given property: <tt>rdfFindArcs
--   (rdfPredEq p)</tt></li>
--   <li>find all statements with given object: <tt>rdfFindArcs (rdfObjEq
--   o)</tt></li>
--   <li>find all statements matching conjunction of these conditions:
--   <tt>rdfFindArcs (<a>allp</a> [...])</tt></li>
--   <li>find all statements matching disjunction of these conditions:
--   <tt>rdfFindArcs (<a>anyp</a> [...])</tt></li>
--   </ul>
--   
--   Custom predicates can also be used.
rdfFindArcs :: (RDFTriple -> Bool) -> RDFGraph -> [RDFTriple]

-- | Test if statement has given subject
rdfSubjEq :: RDFLabel -> RDFTriple -> Bool

-- | Test if statement has given predicate
rdfPredEq :: RDFLabel -> RDFTriple -> Bool

-- | Test if statement has given object
rdfObjEq :: RDFLabel -> RDFTriple -> Bool

-- | Find values of given predicate for a given subject
rdfFindPredVal :: RDFLabel -> RDFLabel -> RDFGraph -> [RDFLabel]

-- | Find integer values of a given predicate for a given subject
rdfFindPredInt :: RDFLabel -> RDFLabel -> RDFGraph -> [Integer]

-- | Find all subjects that match (subject, predicate, object) in the
--   graph.
rdfFindValSubj :: RDFLabel -> RDFLabel -> RDFGraph -> [RDFLabel]

-- | Return a list of nodes that comprise an rdf:collection value, given
--   the head element of the collection. If the list is ill-formed then an
--   arbitrary value is returned.
rdfFindList :: RDFGraph -> RDFLabel -> [RDFLabel]

-- | Test if a value satisfies all predicates in a list
allp :: [a -> Bool] -> a -> Bool

-- | Test if a value satisfies any predicate in a list
anyp :: [a -> Bool] -> a -> Bool

-- | This function applies a substitution for a single set of variable
--   bindings, returning the result and a list of unbound variables. It
--   uses a state transformer monad to collect the list of unbound
--   variables.
--   
--   Adding an empty graph forces elimination of duplicate arcs.
rdfQuerySubs2 :: RDFVarBinding -> RDFGraph -> (RDFGraph, [RDFLabel])


-- | This module defines some datatypes and functions that are used to
--   define rules and rulesets over RDF graphs.
--   
--   For the routines that accept a graph in N3 format, the following
--   namespaces are pre-defined for use by the graph: <tt>rdf:</tt> and
--   <tt>rdfs:</tt>.
module Swish.RDF.Ruleset

-- | A named formula expressed as a RDF Graph.
type RDFFormula = Formula RDFGraph

-- | A named inference rule expressed in RDF.
type RDFRule = Rule RDFGraph

-- | A map for <a>RDFRule</a> rules.
type RDFRuleMap = RuleMap RDFGraph

-- | A <a>GraphClosure</a> for RDF statements.
type RDFClosure = GraphClosure RDFLabel

-- | A <a>Ruleset</a> for RDF.
type RDFRuleset = Ruleset RDFGraph

-- | A map for <a>RDFRuleset</a>.
type RDFRulesetMap = RulesetMap RDFGraph

-- | The null RDF formula.
nullRDFFormula :: Formula RDFGraph

-- | Datatype for constructing a graph closure rule
data GraphClosure lb
GraphClosure :: ScopedName -> ArcSet lb -> ArcSet lb -> VarBindingModify lb lb -> GraphClosure lb

-- | Name of rule for proof display
[nameGraphRule] :: GraphClosure lb -> ScopedName

-- | Antecedent triples pattern (may include variable nodes)
[ruleAnt] :: GraphClosure lb -> ArcSet lb

-- | Consequent triples pattern (may include variable nodes)
[ruleCon] :: GraphClosure lb -> ArcSet lb

-- | Structure that defines additional constraints and/or variable bindings
--   based on other matched query variables. Matching the antecedents. Use
--   <a>varBindingId</a> if no additional variable constraints or bindings
--   are added beyond those arising from graph queries.
[ruleModify] :: GraphClosure lb -> VarBindingModify lb lb

-- | Define a value of type Rule based on an RDFClosure value.
makeGraphClosureRule :: GraphClosure RDFLabel -> Rule RDFGraph

-- | Helper function to parse a string containing Notation3 and return the
--   corresponding RDFGraph value.
makeRDFGraphFromN3Builder :: Builder -> RDFGraph

-- | Create an RDF formula.
makeRDFFormula :: Namespace -> LName -> Builder -> RDFFormula

-- | Constructs an RDF graph closure rule. That is, a rule that given some
--   set of antecedent statements returns new statements that may be added
--   to the graph.
makeRDFClosureRule :: ScopedName -> [RDFGraph] -> RDFGraph -> RDFVarBindingModify -> RDFRule

-- | Constructs an RDF graph closure rule. That is, a rule that given some
--   set of antecedent statements returns new statements that may be added
--   to the graph. This is the basis for implementation of most of the
--   inference rules given in the RDF formal semantics document.
makeN3ClosureRule :: Namespace -> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule

-- | Construct a simple RDF graph closure rule without additional node
--   allocations or variable binding constraints.
makeN3ClosureSimpleRule :: Namespace -> LName -> Builder -> Builder -> RDFRule

-- | Constructs an RDF graph closure rule that incorporates a variable
--   binding filter and a variable binding modifier.
makeN3ClosureModifyRule :: Namespace -> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFVarBindingModify -> RDFRule

-- | Construct an RDF graph closure rule with a bnode allocator.
--   
--   This function is rather like <a>makeN3ClosureModifyRule</a>, except
--   that the variable binding modifier is a function from the variables in
--   the variables and bnodes contained in the antecedent graph.
makeN3ClosureAllocatorRule :: Namespace -> LName -> Builder -> Builder -> RDFVarBindingModify -> ([RDFLabel] -> RDFVarBindingModify) -> RDFRule

-- | This function defines a variable binding modifier that allocates a new
--   blank node for each value bound to a query variable, and binds it to
--   another variable in each query binding.
--   
--   This provides a single binding for query variables that would
--   otherwise be unbound by a query. For example, consider the inference
--   pattern:
--   
--   <pre>
--   ?a hasUncle ?c =&gt; ?a hasFather ?b . ?b hasBrother ?c .
--   </pre>
--   
--   For a given <tt>?a</tt> and <tt>?c</tt>, there is insufficient
--   information here to instantiate a value for variable <tt>?b</tt>.
--   Using this function as part of a graph instance closure rule allows
--   forward chaining to allocate a single bnode for each occurrence of
--   <tt>?a</tt>, so that given:
--   
--   <pre>
--   Jimmy hasUncle Fred .
--   Jimmy hasUncle Bob .
--   </pre>
--   
--   leads to exactly one bnode inference of:
--   
--   <pre>
--   Jimmy hasFather _:f .
--   </pre>
--   
--   giving:
--   
--   <pre>
--   Jimmy hasFather _:f .
--   _:f   hasBrother Fred .
--   _:f   hasBrother Bob .
--   </pre>
--   
--   rather than:
--   
--   <pre>
--   Jimmy hasFather _:f1 .
--   _:f1  hasBrother Fred .
--   Jimmy hasFather _:f2 .
--   _:f2  hasBrother Bob .
--   </pre>
--   
--   This form of constrained allocation of bnodes is also required for
--   some of the inference patterns described by the RDF formal semantics,
--   particularly those where bnodes are substituted for URIs or literals.
makeNodeAllocTo :: RDFLabel -> RDFLabel -> [RDFLabel] -> RDFVarBindingModify

-- | Forward chaining function based on RDF graph closure description
--   
--   Note: antecedents here are presumed to share bnodes.
graphClosureFwdApply :: GraphClosure RDFLabel -> [RDFGraph] -> [RDFGraph]

-- | Backward chaining function based on RDF graph closure description
graphClosureBwdApply :: GraphClosure RDFLabel -> RDFGraph -> [[RDFGraph]]
instance Swish.GraphClass.Label lb => GHC.Classes.Eq (Swish.RDF.Ruleset.GraphClosure lb)
instance GHC.Show.Show (Swish.RDF.Ruleset.GraphClosure lb)


-- | This module implements an inference rule based on a restruction on
--   class membership of one or more values.
module Swish.RDF.ClassRestrictionRule

-- | Datatype for named class restriction
data ClassRestriction
ClassRestriction :: ScopedName -> ClassRestrictionFn -> ClassRestriction
[crName] :: ClassRestriction -> ScopedName
[crFunc] :: ClassRestriction -> ClassRestrictionFn

-- | Type of function that evaluates missing node values in a restriction
--   from those supplied.
type ClassRestrictionFn = [Maybe RDFLabel] -> Maybe [[RDFLabel]]

-- | Make a class restriction from a datatype relation.
--   
--   This lifts application of the datatype relation to operate on
--   <a>RDFLabel</a> values, which are presumed to contain appropriately
--   datatyped values.
makeDatatypeRestriction :: RDFDatatypeVal vt -> DatatypeRel vt -> ClassRestriction

-- | Make a class restriction function from a datatype relation function.
makeDatatypeRestrictionFn :: RDFDatatypeVal vt -> DatatypeRelFn vt -> ClassRestrictionFn

-- | Make a list of class restriction rules given a list of class
--   restriction values and a graph containing one or more class
--   restriction definitions.
makeRDFClassRestrictionRules :: [ClassRestriction] -> RDFGraph -> [RDFRule]

-- | Make restriction rules from the supplied datatype and graph.
makeRDFDatatypeRestrictionRules :: RDFDatatypeVal vt -> RDFGraph -> [RDFRule]

-- | The graph
--   
--   <pre>
--   _:a &lt;http://id.ninebynine.org/2003/rdfext/rdfd#false&gt; _:b .
--   </pre>
--   
--   Exported for testing.
falseGraph :: RDFGraph

-- | Exported for testing.
falseGraphStr :: Builder
instance GHC.Classes.Eq Swish.RDF.ClassRestrictionRule.ClassRestriction
instance GHC.Show.Show Swish.RDF.ClassRestrictionRule.ClassRestriction


-- | This module defines the structures used to represent and manipulate
--   RDF <tt>xsd:string</tt> datatyped literals.
module Swish.RDF.Datatype.XSD.String

-- | The RDFDatatype value for <tt>xsd:string</tt>.
rdfDatatypeXsdString :: RDFDatatype

-- | Define Datatype value for <tt>xsd:string</tt>.
rdfDatatypeValXsdString :: RDFDatatypeVal Text

-- | Type name for <tt>xsd:string</tt> datatype
typeNameXsdString :: ScopedName

-- | Namespace for <tt>xsd:string</tt> datatype functions
namespaceXsdString :: Namespace

-- | The axioms for <tt>xsd:string</tt>, which are
--   
--   <pre>
--   xsd:string a rdfs:Datatype .
--   </pre>
axiomsXsdString :: [RDFFormula]

-- | The rules for <tt>xsd:string</tt>.
rulesXsdString :: [RDFRule]


-- | This module defines the structures used to represent and manipulate
--   RDF <tt>xsd:integer</tt> datatyped literals.
module Swish.RDF.Datatype.XSD.Integer

-- | The RDFDatatype value for <tt>xsd:integer</tt>.
rdfDatatypeXsdInteger :: RDFDatatype

-- | Define Datatype value for <tt>xsd:integer</tt>.
--   
--   Members of this datatype are positive or negative integer values.
--   
--   The lexical form consists of an optional <tt>+</tt> or <tt>-</tt>
--   followed by a sequence of decimal digits.
--   
--   The canonical lexical form has leading zeros and <tt>+</tt> sign
--   removed.
rdfDatatypeValXsdInteger :: RDFDatatypeVal Integer

-- | Type name for <tt>xsd:integer</tt> datatype.
typeNameXsdInteger :: ScopedName

-- | Namespace for <tt>xsd:integer</tt> datatype functions.
namespaceXsdInteger :: Namespace

-- | The axioms for <tt>xsd:integer</tt>, which are
--   
--   <pre>
--   xsd:integer a rdfs:Datatype .
--   </pre>
axiomsXsdInteger :: [RDFFormula]

-- | The rules for <tt>xsd:integer</tt>.
rulesXsdInteger :: [RDFRule]


-- | This module defines the structures used to represent and manipulate
--   RDF <tt>xsd:decimal</tt> datatyped literals.
--   
--   Note that in versions <tt>0.6.4</tt> and <tt>0.6.5</tt>, this module
--   was a mixture of support for <tt>xsd:decimal</tt> and
--   <tt>xsd:double</tt>. In <tt>0.7.0</tt> the module has been changed to
--   <tt>xsd:decimal</tt>, but this may change.
module Swish.RDF.Datatype.XSD.Decimal

-- | The RDFDatatype value for <tt>xsd:decimal</tt>.
rdfDatatypeXsdDecimal :: RDFDatatype

-- | Define Datatype value for <tt>xsd:decimal</tt>.
--   
--   Members of this datatype decimal values.
--   
--   The lexical form consists of an optional <tt>+</tt> or <tt>-</tt>
--   followed by a sequence of decimal digits, an optional decimal point
--   and a sequence of decimal digits.
--   
--   The canonical lexical form has leading zeros and <tt>+</tt> sign
--   removed.
rdfDatatypeValXsdDecimal :: RDFDatatypeVal Double

-- | Type name for <tt>xsd:decimal</tt> datatype.
typeNameXsdDecimal :: ScopedName

-- | Namespace for <tt>xsd:decimal</tt> datatype functions.
namespaceXsdDecimal :: Namespace

-- | The axioms for <tt>xsd:decimal</tt>, which are
--   
--   <pre>
--   xsd:decimal a rdfs:Datatype .
--   </pre>
axiomsXsdDecimal :: [RDFFormula]

-- | The rules for <tt>xsd:decimal</tt>.
rulesXsdDecimal :: [RDFRule]


-- | This module collects references and provides access to all of the
--   datatypes built in to Swish.
module Swish.RDF.BuiltIn.Datatypes

-- | Al the data type declarations built into Swish.
allDatatypes :: [RDFDatatype]

-- | Look up a data type declaration.
findRDFDatatype :: ScopedName -> Maybe RDFDatatype


-- | This module instantiates the <a>Proof</a> framework for constructing
--   proofs over <a>RDFGraph</a> expressions. The intent is that this can
--   be used to test some correspondences between the RDF Model theory and
--   corresponding proof theory based on closure rules applied to the
--   graph, per <a>http://www.w3.org/TR/rdf-mt/</a>.
module Swish.RDF.Proof

-- | An RDF proof.
type RDFProof = Proof RDFGraph

-- | A step in an RDF proof.
type RDFProofStep = Step RDFGraph

-- | Make an RDF proof.
makeRDFProof :: [RDFRuleset] -> RDFFormula -> RDFFormula -> [RDFProofStep] -> RDFProof

-- | Make an RDF graph proof step.
makeRDFProofStep :: RDFRule -> [RDFFormula] -> RDFFormula -> RDFProofStep

-- | Make an inference rule dealing with RDF instance entailment; i.e.
--   entailments that are due to replacement of a URI or literal node with
--   a blank node.
--   
--   The part of this rule expected to be useful is <a>checkInference</a>.
--   The <a>fwdApply</a> and <a>bwdApply</a> functions defined here may
--   return rather large results if applied to graphs with many variables
--   or a large vocabulary, and are defined for experimentation.
--   
--   Forward and backward chaining is performed with respect to a specified
--   vocabulary. In the case of backward chaining, it would otherwise be
--   impossible to bound the options thus generated. In the case of forward
--   chaining, it is often not desirable to have the properties
--   generalized. If forward or backward backward chaining will not be
--   used, supply an empty vocabulary. Note: graph method <a>allNodes</a>
--   can be used to obtain a list of all the subjects and objects used in a
--   graph, not counting nested formulae; use a call of the form:
--   
--   <pre>
--   allNodes (not . labelIsVar) graph
--   </pre>
makeRdfInstanceEntailmentRule :: ScopedName -> [RDFLabel] -> RDFRule

-- | Make an inference rule dealing with RDF subgraph entailment. The part
--   of this rule expected to be useful is <a>checkInference</a>. The
--   <a>fwdApply</a> function defined here may return rather large results.
--   But in the name of completeness and experimentation with the
--   possibilities of lazy evaluation, it has been defined.
--   
--   Backward chaining is not performed, as there is no reasonable way to
--   choose a meaningful supergraph of that supplied.
makeRdfSubgraphEntailmentRule :: ScopedName -> RDFRule

-- | Make an inference rule dealing with RDF simple entailment. The part of
--   this rule expected to be useful is <a>checkInference</a>. The
--   <a>fwdApply</a> and <a>bwdApply</a> functions defined return null
--   results, indicating that they are not useful for the purposes of proof
--   discovery.
makeRdfSimpleEntailmentRule :: ScopedName -> RDFRule
instance (Swish.GraphClass.LDGraph lg lb, GHC.Classes.Eq (lg lb)) => Swish.Rule.Expression (lg lb)


-- | This module contains proof-context declarations based on the RDF,
--   RDFS, and RDF datatyping semantics specifications. These definitions
--   consist of namespaces (for identification in proofs), axioms and
--   inference rules.
module Swish.RDF.ProofContext

-- | Ruleset for RDF inference.
rulesetRDF :: RDFRuleset

-- | Ruleset for RDFS inference.
rulesetRDFS :: RDFRuleset

-- | Ruleset for RDFD (datatyping) inference.
rulesetRDFD :: RDFRuleset


-- | This module collects references and provides access to all of the
--   rulesets, variable binding modifiers and variable binding filters
--   built in to Swish.
module Swish.RDF.BuiltIn.Rules

-- | Find the named open variable binding modifier.
findRDFOpenVarBindingModifier :: ScopedName -> Maybe RDFOpenVarBindingModify

-- | A <tt>LookupMap</tt> of <a>allRulesets</a>.
rdfRulesetMap :: RDFRulesetMap

-- | All the rule sets known to Swish.
allRulesets :: [RDFRuleset]

-- | The data type rule sets known to Swish.
allDatatypeRulesets :: [RDFRuleset]


-- | This module collects references and provides access to all of the
--   datatypes, variable binding modifiers and variable binding filters
--   built in to Swish.
module Swish.RDF.BuiltIn

-- | Find the named open variable binding modifier.
findRDFOpenVarBindingModifier :: ScopedName -> Maybe RDFOpenVarBindingModify

-- | Look up a data type declaration.
findRDFDatatype :: ScopedName -> Maybe RDFDatatype

-- | A <tt>LookupMap</tt> of <a>allRulesets</a>.
rdfRulesetMap :: RDFRulesetMap

-- | All the rule sets known to Swish.
allRulesets :: [RDFRuleset]

-- | The data type rule sets known to Swish.
allDatatypeRulesets :: [RDFRuleset]


-- | Composed state and IO monad for Swish
module Swish.Monad

-- | The state monad used in executing Swish programs.
type SwishStateIO a = StateT SwishState IO a

-- | The State for a Swish "program".
data SwishState
SwishState :: SwishFormat -> Maybe QName -> RDFGraph -> NamedGraphMap -> RDFRuleMap -> RDFRulesetMap -> Maybe String -> Maybe String -> SwishStatus -> SwishState

-- | format to use for I/O
[format] :: SwishState -> SwishFormat

-- | base to use rather than file name
[base] :: SwishState -> Maybe QName

-- | current graph
[graph] :: SwishState -> RDFGraph

-- | script processor named graphs
[graphs] :: SwishState -> NamedGraphMap

-- | script processor named rules
[rules] :: SwishState -> RDFRuleMap

-- | script processor rulesets
[rulesets] :: SwishState -> RDFRulesetMap

-- | information message, or Nothing
[infomsg] :: SwishState -> Maybe String

-- | error message, or Nothing
[errormsg] :: SwishState -> Maybe String

-- | current status
[exitcode] :: SwishState -> SwishStatus

-- | Status of the processor
data SwishStatus

-- | successful run
SwishSuccess :: SwishStatus

-- | graphs do not compare
SwishGraphCompareError :: SwishStatus

-- | input data problem (ie format/syntax)
SwishDataInputError :: SwishStatus

-- | data access error
SwishDataAccessError :: SwishStatus

-- | command-line argument error
SwishArgumentError :: SwishStatus

-- | error executing a Swish script
SwishExecutionError :: SwishStatus

-- | The supported input and output formats.
data SwishFormat

-- | Turtle format
Turtle :: SwishFormat

-- | N3 format
N3 :: SwishFormat

-- | NTriples format
NT :: SwishFormat

-- | A LookupMap for the graphs dictionary.
type NamedGraphMap = Map ScopedName [RDFGraph]

-- | The default state for Swish: no loaded graphs or rules, and format set
--   to <a>N3</a>.
emptyState :: SwishState

-- | Change the format.
setFormat :: SwishFormat -> SwishState -> SwishState

-- | Change (or remove) the base URI.
setBase :: Maybe QName -> SwishState -> SwishState

-- | Change the current graph.
setGraph :: RDFGraph -> SwishState -> SwishState

-- | Modify the named graphs.
modGraphs :: (NamedGraphMap -> NamedGraphMap) -> SwishState -> SwishState

-- | Find a named graph.
findGraph :: ScopedName -> SwishState -> Maybe [RDFGraph]

-- | Find a formula. The search is first made in the named graphs and then,
--   if not found, the rulesets.
findFormula :: ScopedName -> SwishState -> Maybe RDFFormula

-- | Modify the named rules.
modRules :: (RDFRuleMap -> RDFRuleMap) -> SwishState -> SwishState

-- | Find a named rule.
findRule :: ScopedName -> SwishState -> Maybe RDFRule

-- | Modify the rule sets.
modRulesets :: (RDFRulesetMap -> RDFRulesetMap) -> SwishState -> SwishState

-- | Find a rule set.
findRuleset :: ScopedName -> SwishState -> Maybe RDFRuleset

-- | Find a modify rule.
findOpenVarModify :: ScopedName -> SwishState -> Maybe RDFOpenVarBindingModify

-- | Find a data type declaration.
findDatatype :: ScopedName -> SwishState -> Maybe RDFDatatype

-- | Set the information message.
setInfo :: String -> SwishState -> SwishState

-- | Clear the information message.
resetInfo :: SwishState -> SwishState

-- | Set the error message.
setError :: String -> SwishState -> SwishState

-- | Clear the error message.
resetError :: SwishState -> SwishState

-- | Set the status.
setStatus :: SwishStatus -> SwishState -> SwishState

-- | Report error and set exit status code
swishError :: String -> SwishStatus -> SwishStateIO ()

-- | Output the text to the standard error stream (a new line is added to
--   the output).
reportLine :: String -> SwishStateIO ()
instance GHC.Enum.Enum Swish.Monad.SwishStatus
instance GHC.Classes.Eq Swish.Monad.SwishStatus
instance GHC.Classes.Eq Swish.Monad.SwishFormat
instance GHC.Show.Show Swish.Monad.SwishFormat
instance GHC.Show.Show Swish.Monad.SwishStatus


-- | This Module implements a Turtle formatter for an <a>RDFGraph</a>
--   value.
--   
--   REFERENCES:
--   
--   <ul>
--   <li>"Turtle, Terse RDF Triple Language", W3C Working Draft 09 August
--   2011 (<a>http://www.w3.org/TR/2011/WD-turtle-20110809/</a>)
--   <a>http://www.w3.org/TR/turtle/</a></li>
--   </ul>
--   
--   NOTES:
--   
--   <ul>
--   <li>The formatter needs to be updated to the W3C Candidate
--   Recommendation (19 February 2013,
--   <a>http://www.w3.org/TR/2013/CR-turtle-20130219/</a>).</li>
--   <li>Should literal strings (<tt>Lit</tt>) be written out as
--   <tt>xsd:string</tt>, or should <tt>TypedLit</tt> strings with a type
--   of <tt>xsd:string</tt> be written out with no type? (e.g. see
--   <a>http://www.w3.org/TR/2011/WD-turtle-20110809/#terms</a>).</li>
--   </ul>
module Swish.RDF.Formatter.Turtle

-- | Node name generation state information that carries through and is
--   updated by nested formulae.
type NodeGenLookupMap = Map RDFLabel Word32

-- | Convert the graph to text.
formatGraphAsText :: RDFGraph -> Text

-- | Convert the graph to text.
formatGraphAsLazyText :: RDFGraph -> Text

-- | Convert the graph to a Builder.
formatGraphAsBuilder :: RDFGraph -> Builder

-- | Convert the graph to a builder using the given indentation text.
formatGraphIndent :: Builder -> Bool -> RDFGraph -> Builder

-- | Format graph and return additional information.
formatGraphDiag :: Builder -> Bool -> RDFGraph -> (Builder, NodeGenLookupMap, Word32, [String])


-- | This Module implements a Notation 3 formatter for an <a>RDFGraph</a>
--   value.
--   
--   REFERENCES:
--   
--   <ul>
--   <li>"Notation3 (N3): A readable RDF syntax", W3C Team Submission 14
--   January 2008,
--   <a>http://www.w3.org/TeamSubmission/2008/SUBM-n3-20080114/</a></li>
--   <li>Tim Berners-Lee's design issues series notes and description,
--   <a>http://www.w3.org/DesignIssues/Notation3.html</a></li>
--   <li>Notation 3 Primer by Sean Palmer,
--   <a>http://www.w3.org/2000/10/swap/Primer.html</a></li>
--   </ul>
--   
--   TODO:
--   
--   <ul>
--   <li>Initial prefix list to include nested formulae; then don't need to
--   update prefix list for these.</li>
--   <li>correct output of strings containing unsupported escape characters
--   (such as <tt>\q</tt>)</li>
--   <li>more flexible terminator generation for formatted formulae (for
--   inline blank nodes.)</li>
--   </ul>
module Swish.RDF.Formatter.N3

-- | Node name generation state information that carries through and is
--   updated by nested formulae.
type NodeGenLookupMap = Map RDFLabel Word32

-- | Convert the graph to text.
formatGraphAsText :: RDFGraph -> Text

-- | Convert the graph to text.
formatGraphAsLazyText :: RDFGraph -> Text

-- | Convert the graph to a Builder.
formatGraphAsBuilder :: RDFGraph -> Builder

-- | Convert the graph to a builder using the given indentation text.
formatGraphIndent :: Builder -> Bool -> RDFGraph -> Builder

-- | Format graph and return additional information
formatGraphDiag :: Builder -> Bool -> RDFGraph -> (Builder, NodeGenLookupMap, Word32, [String])


-- | This module defines a <a>ShowLines</a> class instance for
--   <a>RDFGraph</a>, to be used when displaying RDF Graph values as part
--   of a proof sequence, etc.
module Swish.RDF.GraphShowLines
instance Data.String.ShowLines.ShowLines Swish.RDF.Graph.RDFGraph


-- | This module implements the Swish script processor: it parses a script
--   from a supplied string, and returns a list of Swish state transformer
--   functions whose effect, when applied to a state value, is to implement
--   the supplied script.
module Swish.Script

-- | Parser for Swish script processor
parseScriptFromText :: Maybe QName -> Text -> Either String [SwishStateIO ()]


-- | This Module implements a NTriples formatter for a <a>RDFGraph</a>.
--   
--   REFERENCES:
--   
--   <ul>
--   <li>"RDF Test Cases", W3C Recommendation 10 February 2004,
--   <a>http://www.w3.org/TR/rdf-testcases/#ntriples</a></li>
--   </ul>
--   
--   NOTES:
--   
--   <ul>
--   <li>Update to the document "N-Triples. A line-based syntax for an RDF
--   graph" W3C Working Group Note 09 April 2013,
--   <a>http://www.w3.org/TR/2013/NOTE-n-triples-20130409/</a></li>
--   </ul>
module Swish.RDF.Formatter.NTriples

-- | Convert a RDF graph to NTriples format.
formatGraphAsText :: RDFGraph -> Text

-- | Convert a RDF graph to NTriples format.
formatGraphAsLazyText :: RDFGraph -> Text

-- | Convert a RDF graph to NTriples format.
formatGraphAsBuilder :: RDFGraph -> Builder


-- | Functions to deal with indivudual Swish command options.
module Swish.Commands

-- | Set the file format.
swishFormat :: SwishFormat -> SwishStateIO ()

-- | Set (or clear) the base URI.
swishBase :: Maybe QName -> SwishStateIO ()

-- | Read in a graph and make it the current graph.
swishInput :: Maybe String -> SwishStateIO ()

-- | Write out the current graph.
swishOutput :: Maybe String -> SwishStateIO ()

-- | Read in a graph and merge it with the current graph.
swishMerge :: Maybe String -> SwishStateIO ()

-- | Read in a graph and compare it with the current graph.
swishCompare :: Maybe String -> SwishStateIO ()

-- | Read in a graph and display the differences to the current graph to
--   standard output.
swishGraphDiff :: Maybe String -> SwishStateIO ()

-- | Read in a script and execute it.
swishScript :: Maybe String -> SwishStateIO ()


-- | Swish: Semantic Web Inference Scripting in Haskell
--   
--   This program is a simple skeleton for constructing Semantic Web [1]
--   inference tools in Haskell, using the RDF graph and several RDF
--   parsers (at present Notation 3 and NTriples).
--   
--   It might be viewed as a kind of embroyonic CWM [2] in Haskell, except
--   that the intent is that Haskell will be used as a primary language for
--   defining inferences. As such, Swish is an open-ended toolkit for
--   constructing new special-purpose Semantic Web applications rather than
--   a closed, self-contained general-purpose SW application. As such, it
--   is part of another experiment along the lines described in [3].
--   
--   The script format used by Swish is described in <a>Swish.Script</a>.
--   
--   Users wishing to process RDF data directly may prefer to look at the
--   following modules; <a>Swish.RDF</a>, <a>Swish.RDF.Parser.Turtle</a>,
--   <a>Swish.RDF.Parser.N3</a>, <a>Swish.RDF.Parser.NTriples</a>,
--   <a>Swish.RDF.Formatter.Turtle</a>, <a>Swish.RDF.Formatter.N3</a> and
--   <a>Swish.RDF.Formatter.NTriples</a>.
--   
--   <ol>
--   <li>Semantic web: <a>http://www.w3.org/2001/sw/</a></li>
--   <li>CWM: <a>http://www.w3.org/2000/10/swap/doc/cwm.html</a></li>
--   <li>Motivation:
--   <a>http://www.w3.org/2000/10/swap/doc/Motivation.html</a></li>
--   <li>Notation 3:
--   <a>http://www.w3.org/TeamSubmission/2008/SUBM-n3-20080114/</a></li>
--   <li>Turtle: <a>http://www.w3.org/TR/turtle/</a></li>
--   <li>RDF: <a>http://www.w3.org/RDF/</a></li>
--   </ol>
--   
--   Notes
--   
--   I anticipate that this module may be used as a starting point for
--   creating new programs rather then as a complete program in its own
--   right. The functionality built into this code is selected with a view
--   to testing the Haskell modules for handling RDF rather than for
--   performing any particular application processing (though development
--   as a tool with some broader utility is not ruled out).
--   
--   With the following in ghci:
--   
--   <pre>
--   &gt;&gt;&gt; :m + Swish
--   
--   &gt;&gt;&gt; :set prompt "swish&gt; "
--   </pre>
--   
--   then we can run a Swish script (format described in
--   <a>Swish.Script</a>) by saying:
--   
--   <pre>
--   &gt;&gt;&gt; runSwish "-s=script.ss"
--   ExitSuccess
--   </pre>
--   
--   or convert a file from Turtle to NTriples format with:
--   
--   <pre>
--   &gt;&gt;&gt; runSwish "-ttl -i=foo.ttl -nt -o=foo.nt"
--   ExitSuccess
--   </pre>
--   
--   You can also use <a>validateCommands</a> by giving it the individual
--   commands, such as
--   
--   <pre>
--   &gt;&gt;&gt; let Right cs = validateCommands ["-ttl", "-i=file1.ttl", "-c=file2.ttl"]
--   
--   &gt;&gt;&gt; cs
--   [SwishAction: -ttl,SwishAction: -i=file1.ttl,SwishAction: -c=file2.ttl]
--   
--   &gt;&gt;&gt; st &lt;- runSwishActions cs
--   
--   &gt;&gt;&gt; st
--   The graphs do not compare as equal.
--   </pre>
module Swish

-- | Status of the processor
data SwishStatus

-- | successful run
SwishSuccess :: SwishStatus

-- | graphs do not compare
SwishGraphCompareError :: SwishStatus

-- | input data problem (ie format/syntax)
SwishDataInputError :: SwishStatus

-- | data access error
SwishDataAccessError :: SwishStatus

-- | command-line argument error
SwishArgumentError :: SwishStatus

-- | error executing a Swish script
SwishExecutionError :: SwishStatus

-- | Represent a Swish action. At present there is no way to create these
--   actions other than <a>validateCommands</a>.
data SwishAction

-- | Parse and run the given string as if given at the command line. The
--   "quiet", "version" and "help" options are ignored.
runSwish :: String -> IO ExitCode

-- | Execute the given set of actions.
runSwishActions :: [SwishAction] -> IO SwishStatus

-- | Write out the help for Swish
displaySwishHelp :: IO ()

-- | Return any arguments that need processing immediately, namely the
--   "help", "quiet" and "version" options.
splitArguments :: [String] -> ([String], [String])

-- | Given a list of command-line arguments create the list of actions to
--   perform or a string and status value indicating an input error.
validateCommands :: [String] -> Either (String, SwishStatus) [SwishAction]
instance GHC.Show.Show Swish.SwishAction


-- | This module defines some commonly used vocabulary terms from the
--   Dublin Core vocabularies
--   (<a>http://dublincore.org/documents/dcmi-terms/</a>).
module Swish.RDF.Vocabulary.DublinCore

-- | Maps <tt>dcterms</tt> to <a>http://purl.org/dc/terms/</a>.
namespaceDCTERMS :: Namespace

-- | Maps <tt>dcelem</tt> to the legacy namespace
--   <a>http://purl.org/dc/elements/1.1/</a>.
namespaceDCELEM :: Namespace

-- | Maps <tt>dcam</tt> to <a>http://purl.org/dc/dcam/</a>.
namespaceDCAM :: Namespace

-- | Maps <tt>dctype</tt> to <a>http://purl.org/dc/dcmitype/</a>.
namespaceDCTYPE :: Namespace

-- | <tt>dcterms:Agent</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-Agent</a>.
dctAgent :: ScopedName

-- | <tt>dcterms:AgentClass</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-AgentClass</a>.
dctAgentClass :: ScopedName

-- | <tt>dcterms:BibliographicResource</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-BibliographicResource</a>.
dctBibliographicResource :: ScopedName

-- | <tt>dcterms:FileFormat</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-FileFormat</a>.
dctFileFormat :: ScopedName

-- | <tt>dcterms:Frequency</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-Frequency</a>.
dctFrequency :: ScopedName

-- | <tt>dcterms:Jurisdiction</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-Jurisdiction</a>.
dctJurisdiction :: ScopedName

-- | <tt>dcterms:LicenseDocument</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-LicenseDocument</a>.
dctLicenseDocument :: ScopedName

-- | <tt>dcterms:LinguisticSystem</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-LinguisticSystem</a>.
dctLinguisticSystem :: ScopedName

-- | <tt>dcterms:Location</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-Location</a>.
dctLocation :: ScopedName

-- | <tt>dcterms:LocationPeriodOrJurisdiction</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-LocationPeriodOrJurisdiction</a>.
dctLocationPeriodOrJurisdiction :: ScopedName

-- | <tt>dcterms:MediaType</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-MediaType</a>.
dctMediaType :: ScopedName

-- | <tt>dcterms:MediaTypeOrExtent</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-MediaTypeOrExtent</a>.
dctMediaTypeOrExtent :: ScopedName

-- | <tt>dcterms:MethodOfAccrual</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-MethodOfAccrual</a>.
dctMethodOfAccrual :: ScopedName

-- | <tt>dcterms:MethodOfInstruction</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-MethodOfInstruction</a>.
dctMethodOfInstruction :: ScopedName

-- | <tt>dcterms:PeriodOfTime</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-PeriodOfTime</a>.
dctPeriodOfTime :: ScopedName

-- | <tt>dcterms:PhysicalMedium</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-PhysicalMedium</a>.
dctPhysicalMedium :: ScopedName

-- | <tt>dcterms:PhysicalResource</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-PhysicalResource</a>.
dctPhysicalResource :: ScopedName

-- | <tt>dcterms:Policy</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-Policy</a>.
dctPolicy :: ScopedName

-- | <tt>dcterms:ProvenanceStatement</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-ProvenanceStatement</a>.
dctProvenanceStatement :: ScopedName

-- | <tt>dcterms:RightsStatement</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-RightsStatement</a>.
dctRightsStatement :: ScopedName

-- | <tt>dcterms:SizeOrDuration</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-SizeOrDuration</a>.
dctSizeOrDuration :: ScopedName

-- | <tt>dcterms:Standard</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#classes-Standard</a>.
dctStandard :: ScopedName

-- | <tt>dcterms:abstract</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-abstract</a>.
dctabstract :: ScopedName

-- | <tt>dcterms:accessRights</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-accessRights</a>.
dctaccessRights :: ScopedName

-- | <tt>dcterms:accrualMethod</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-accrualMethod</a>.
dctaccrualMethod :: ScopedName

-- | <tt>dcterms:accrualPeriodicity</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-accrualPeriodicity</a>.
dctaccrualPeriodicity :: ScopedName

-- | <tt>dcterms:accrualPolicy</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-accrualPolicy</a>.
dctaccrualPolicy :: ScopedName

-- | <tt>dcterms:alternative</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-alternative</a>.
dctalternative :: ScopedName

-- | <tt>dcterms:audience</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-audience</a>.
dctaudience :: ScopedName

-- | <tt>dcterms:available</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-available</a>.
dctavailable :: ScopedName

-- | <tt>dcterms:bibliographicCitation</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-bibliographicCitation</a>.
dctbibliographicCitation :: ScopedName

-- | <tt>dcterms:conformsTo</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-conformsTo</a>.
dctconformsTo :: ScopedName

-- | <tt>dcterms:contributor</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-contributor</a>.
dctcontributor :: ScopedName

-- | <tt>dcterms:coverage</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-coverage</a>.
dctcoverage :: ScopedName

-- | <tt>dcterms:created</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-created</a>.
dctcreated :: ScopedName

-- | <tt>dcterms:creator</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-creator</a>.
dctcreator :: ScopedName

-- | <tt>dcterms:date</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-date</a>.
dctdate :: ScopedName

-- | <tt>dcterms:dateAccepted</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-dateAccepted</a>.
dctdateAccepted :: ScopedName

-- | <tt>dcterms:dateCopyrighted</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-dateCopyrighted</a>.
dctdateCopyrighted :: ScopedName

-- | <tt>dcterms:dateSubmitted</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-dateSubmitted</a>.
dctdateSubmitted :: ScopedName

-- | <tt>dcterms:description</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-description</a>.
dctdescription :: ScopedName

-- | <tt>dcterms:educationLevel</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-educationLevel</a>.
dcteducationLevel :: ScopedName

-- | <tt>dcterms:extent</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-extent</a>.
dctextent :: ScopedName

-- | <tt>dcterms:format</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-format</a>.
dctformat :: ScopedName

-- | <tt>dcterms:hasFormat</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-hasFormat</a>.
dcthasFormat :: ScopedName

-- | <tt>dcterms:hasPart</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-hasPart</a>.
dcthasPart :: ScopedName

-- | <tt>dcterms:hasVersion</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-hasVersion</a>.
dcthasVersion :: ScopedName

-- | <tt>dcterms:identifier</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-identifier</a>.
dctidentifier :: ScopedName

-- | <tt>dcterms:instructionalMethod</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-instructionalMethod</a>.
dctinstructionalMethod :: ScopedName

-- | <tt>dcterms:isFormatOf</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-isFormatOf</a>.
dctisFormatOf :: ScopedName

-- | <tt>dcterms:isPartOf</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-isPartOf</a>.
dctisPartOf :: ScopedName

-- | <tt>dcterms:isReferencedBy</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-isReferencedBy</a>.
dctisReferencedBy :: ScopedName

-- | <tt>dcterms:isReplacedBy</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-isReplacedBy</a>.
dctisReplacedBy :: ScopedName

-- | <tt>dcterms:isRequiredBy</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-isRequiredBy</a>.
dctisRequiredBy :: ScopedName

-- | <tt>dcterms:issued</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-issued</a>.
dctissued :: ScopedName

-- | <tt>dcterms:isVersionOf</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-isVersionOf</a>.
dctisVersionOf :: ScopedName

-- | <tt>dcterms:language</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-language</a>.
dctlanguage :: ScopedName

-- | <tt>dcterms:license</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-license</a>.
dctlicense :: ScopedName

-- | <tt>dcterms:mediator</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-mediator</a>.
dctmediator :: ScopedName

-- | <tt>dcterms:medium</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-medium</a>.
dctmedium :: ScopedName

-- | <tt>dcterms:modified</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-modified</a>.
dctmodified :: ScopedName

-- | <tt>dcterms:provenance</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-provenance</a>.
dctprovenance :: ScopedName

-- | <tt>dcterms:publisher</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-publisher</a>.
dctpublisher :: ScopedName

-- | <tt>dcterms:references</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-references</a>.
dctreferences :: ScopedName

-- | <tt>dcterms:relation</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-relation</a>.
dctrelation :: ScopedName

-- | <tt>dcterms:replaces</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-replaces</a>.
dctreplaces :: ScopedName

-- | <tt>dcterms:requires</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-requires</a>.
dctrequires :: ScopedName

-- | <tt>dcterms:rights</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-rights</a>.
dctrights :: ScopedName

-- | <tt>dcterms:rightsHolder</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-rightsHolder</a>.
dctrightsHolder :: ScopedName

-- | <tt>dcterms:source</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-source</a>.
dctsource :: ScopedName

-- | <tt>dcterms:spatial</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-spatial</a>.
dctspatial :: ScopedName

-- | <tt>dcterms:subject</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-subject</a>.
dctsubject :: ScopedName

-- | <tt>dcterms:tableOfContents</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-tableOfContents</a>.
dcttableOfContents :: ScopedName

-- | <tt>dcterms:temporal</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-temporal</a>.
dcttemporal :: ScopedName

-- | <tt>dcterms:title</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-title</a>.
dcttitle :: ScopedName

-- | <tt>dcterms:type</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-type</a>.
dcttype :: ScopedName

-- | <tt>dcterms:valid</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#terms-valid</a>.
dctvalid :: ScopedName

-- | <tt>dcelem:contributor</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-contributor</a>.
dcelemcontributor :: ScopedName

-- | <tt>dcelem:coverage</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-coverage</a>.
dcelemcoverage :: ScopedName

-- | <tt>dcelem:creator</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-creator</a>.
dcelemcreator :: ScopedName

-- | <tt>dcelem:date</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-date</a>.
dcelemdate :: ScopedName

-- | <tt>dcelem:description</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-description</a>.
dcelemdescription :: ScopedName

-- | <tt>dcelem:format</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-format</a>.
dcelemformat :: ScopedName

-- | <tt>dcelem:identifier</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-identifier</a>.
dcelemidentifier :: ScopedName

-- | <tt>dcelem:language</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-language</a>.
dcelemlanguage :: ScopedName

-- | <tt>dcelem:publisher</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-publisher</a>.
dcelempublisher :: ScopedName

-- | <tt>dcelem:relation</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-relation</a>.
dcelemrelation :: ScopedName

-- | <tt>dcelem:rights</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-rights</a>.
dcelemrights :: ScopedName

-- | <tt>dcelem:source</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-source</a>.
dcelemsource :: ScopedName

-- | <tt>dcelem:subject</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-subject</a>.
dcelemsubject :: ScopedName

-- | <tt>dcelem:title</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-title</a>.
dcelemtitle :: ScopedName

-- | <tt>dcelem:type</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#elements-type</a>.
dcelemtype :: ScopedName

-- | <tt>dcterms:LCSH</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ves-LCSH</a>.
dctLCSH :: ScopedName

-- | <tt>dcterms:MESH</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ves-MESH</a>.
dctMESH :: ScopedName

-- | <tt>dcterms:DDC</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ves-DDC</a>.
dctDDC :: ScopedName

-- | <tt>dcterms:LCC</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ves-LCC</a>.
dctLCC :: ScopedName

-- | <tt>dcterms:UDC</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ves-UDC</a>.
dctUDC :: ScopedName

-- | <tt>dcterms:DCMIType</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ves-DCMIType</a>.
dctDCMIType :: ScopedName

-- | <tt>dcterms:IMT</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ves-IMT</a>.
dctIMT :: ScopedName

-- | <tt>dcterms:TGN</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ves-TGN</a>.
dctTGN :: ScopedName

-- | <tt>dcterms:NLM</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ves-NLM</a>.
dctNLM :: ScopedName

-- | <tt>dcterms:Box</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-Box</a>.
dctBox :: ScopedName

-- | <tt>dcterms:ISO3166</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-ISO3166</a>.
dctISO3166 :: ScopedName

-- | <tt>dcterms:ISO639-2</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-ISO639-2</a>.
dctISO639_2 :: ScopedName

-- | <tt>dcterms:ISO639-3</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-ISO639-3</a>.
dctISO639_3 :: ScopedName

-- | <tt>dcterms:Period</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-Period</a>.
dctPeriod :: ScopedName

-- | <tt>dcterms:Point</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-Point</a>.
dctPoint :: ScopedName

-- | <tt>dcterms:RFC1766</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-RFC1766</a>.
dctRFC1766 :: ScopedName

-- | <tt>dcterms:RFC3066</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-RFC3066</a>.
dctRFC3066 :: ScopedName

-- | <tt>dcterms:RFC4646</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-RFC4646</a>.
dctRFC4646 :: ScopedName

-- | <tt>dcterms:RFC5646</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-RFC5646</a>.
dctRFC5646 :: ScopedName

-- | <tt>dcterms:URI</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-URI</a>.
dctURI :: ScopedName

-- | <tt>dcterms:W3CDTF</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#ses-W3CDTF</a>.
dctW3CDTF :: ScopedName

-- | <tt>dctype:Collection</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-Collection</a>.
dctypeCollection :: ScopedName

-- | <tt>dctype:Dataset</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-Dataset</a>.
dctypeDataset :: ScopedName

-- | <tt>dctype:Event</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-Event</a>.
dctypeEvent :: ScopedName

-- | <tt>dctype:Image</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-Image</a>.
dctypeImage :: ScopedName

-- | <tt>dctype:InteractiveResource</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-InteractiveResource</a>.
dctypeInteractiveResource :: ScopedName

-- | <tt>dctype:Service</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-Service</a>.
dctypeService :: ScopedName

-- | <tt>dctype:Software</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-Software</a>.
dctypeSoftware :: ScopedName

-- | <tt>dctype:Sound</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-Sound</a>.
dctypeSound :: ScopedName

-- | <tt>dctype:Text</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-Text</a>.
dctypeText :: ScopedName

-- | <tt>dctype:PhysicalObject</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-PhysicalObject</a>.
dctypePhysicalObject :: ScopedName

-- | <tt>dctype:StillImage</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-StillImage</a>.
dctypeStillImage :: ScopedName

-- | <tt>dctype:MovingImage</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcmitype-MovingImage</a>.
dctypeMovingImage :: ScopedName

-- | <tt>dcam:memberOf</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcam-memberOf</a>.
dcammemberOf :: ScopedName

-- | <tt>dcam:memberOf</tt> from
--   <a>http://dublincore.org/documents/dcmi-terms/#dcam-memberOf</a>.
dcamVocabularyEncodingScheme :: ScopedName


-- | This module defines some commonly used vocabulary terms from the FOAF
--   vocabulary (<a>http://xmlns.com/foaf/spec/</a>).
--   
--   Note that unlike some of the existing vocabularies in Swish, the FOAF
--   one matches the case and spelling of the RDF terms; so we use
--   <a>foafbased_near</a> rather than <tt>foafBasedNear</tt>. This is
--   partly because some terms would end up with the same Haskell label if
--   a conversion to camel-case wer used.
module Swish.RDF.Vocabulary.FOAF

-- | Maps <tt>foaf</tt> to <a>http://xmlns.com/foaf/0.1/</a>.
namespaceFOAF :: Namespace

-- | <tt>foaf:Agent</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_Agent</a>.
foafAgent :: ScopedName

-- | <tt>foaf:Document</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_Document</a>.
foafDocument :: ScopedName

-- | <tt>foaf:Group</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_Group</a>.
foafGroup :: ScopedName

-- | <tt>foaf:Image</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_Image</a>.
foafImage :: ScopedName

-- | <tt>foaf:LabelProperty</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_LabelProperty</a>.
foafLabelProperty :: ScopedName

-- | <tt>foaf:OnlineAccount</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_OnlineAccount</a>.
foafOnlineAccount :: ScopedName

-- | <tt>foaf:OnlineChatAccount</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_OnlineChatAccount</a>.
foafOnlineChatAccount :: ScopedName

-- | <tt>foaf:OnlineEcommerceAccount</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_OnlineEcommerceAccount</a>.
foafOnlineEcommerceAccount :: ScopedName

-- | <tt>foaf:OnlineGamingAccount</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_OnlineGamingAccount</a>.
foafOnlineGamingAccount :: ScopedName

-- | <tt>foaf:Organization</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_Organization</a>.
foafOrganization :: ScopedName

-- | <tt>foaf:Person</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_Person</a>.
foafPerson :: ScopedName

-- | <tt>foaf:PersonalProfileDocument</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_PersonalProfileDocument</a>.
foafPersonalProfileDocument :: ScopedName

-- | <tt>foaf:Project</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_Project</a>.
foafProject :: ScopedName

-- | <tt>foaf:account</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_account</a>.
foafaccount :: ScopedName

-- | <tt>foaf:accountName</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_accountName</a>.
foafaccountName :: ScopedName

-- | <tt>foaf:accountServiceHomepage</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_accountServiceHomepage</a>.
foafaccountServiceHomepage :: ScopedName

-- | <tt>foaf:age</tt> from <a>http://xmlns.com/foaf/spec/#term_age</a>.
foafage :: ScopedName

-- | <tt>foaf:aimChatID</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_aimChatID</a>.
foafaimChatID :: ScopedName

-- | <tt>foaf:based_near</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_based_near</a>.
foafbased_near :: ScopedName

-- | <tt>foaf:birthday</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_birthday</a>.
foafbirthday :: ScopedName

-- | <tt>foaf:currentProject</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_currentProject</a>.
foafcurrentProject :: ScopedName

-- | <tt>foaf:depiction</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_depiction</a>.
foafdepiction :: ScopedName

-- | <tt>foaf:depicts</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_depicts</a>.
foafdepicts :: ScopedName

-- | <tt>foaf:dnaChecksum</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_dnaChecksum</a>.
foafdnaChecksum :: ScopedName

-- | <tt>foaf:familyName</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_familyName</a>.
foaffamilyName :: ScopedName

-- | <tt>foaf:family_name</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_family_name</a>.
foaffamily_name :: ScopedName

-- | <tt>foaf:firstName</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_firstName</a>.
foaffirstName :: ScopedName

-- | <tt>foaf:focus</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_focus</a>.
foaffocus :: ScopedName

-- | <tt>foaf:fundedBy</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_fundedBy</a>.
foaffundedBy :: ScopedName

-- | <tt>foaf:geekcode</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_geekcode</a>.
foafgeekcode :: ScopedName

-- | <tt>foaf:gender</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_gender</a>.
foafgender :: ScopedName

-- | <tt>foaf:givenName</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_givenName</a>.
foafgivenName :: ScopedName

-- | <tt>foaf:givenname</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_givenname</a>.
foafgivenname :: ScopedName

-- | <tt>foaf:holdsAccount</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_holdsAccount</a>.
foafholdsAccount :: ScopedName

-- | <tt>foaf:homepage</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_homepage</a>.
foafhomepage :: ScopedName

-- | <tt>foaf:icqChatID</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_icqChatID</a>.
foaficqChatID :: ScopedName

-- | <tt>foaf:img</tt> from <a>http://xmlns.com/foaf/spec/#term_img</a>.
foafimg :: ScopedName

-- | <tt>foaf:interest</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_interest</a>.
foafinterest :: ScopedName

-- | <tt>foaf:isPrimaryTopicOf</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_isPrimaryTopicOf</a>.
foafisPrimaryTopicOf :: ScopedName

-- | <tt>foaf:jabberID</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_jabberID</a>.
foafjabberID :: ScopedName

-- | <tt>foaf:knows</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_knows</a>.
foafknows :: ScopedName

-- | <tt>foaf:lastName</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_lastName</a>.
foaflastName :: ScopedName

-- | <tt>foaf:logo</tt> from <a>http://xmlns.com/foaf/spec/#term_logo</a>.
foaflogo :: ScopedName

-- | <tt>foaf:made</tt> from <a>http://xmlns.com/foaf/spec/#term_made</a>.
foafmade :: ScopedName

-- | <tt>foaf:maker</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_maker</a>.
foafmaker :: ScopedName

-- | <tt>foaf:mbox</tt> from <a>http://xmlns.com/foaf/spec/#term_mbox</a>.
foafmbox :: ScopedName

-- | <tt>foaf:mbox_sha1sum</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_mbox_sha1sum</a>.
foafmbox_sha1sum :: ScopedName

-- | <tt>foaf:member</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_member</a>.
foafmember :: ScopedName

-- | <tt>foaf:membershipClass</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_membershipClass</a>.
foafmembershipClass :: ScopedName

-- | <tt>foaf:msnChatID</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_msnChatID</a>.
foafmsnChatID :: ScopedName

-- | <tt>foaf:myersBriggs</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_myersBriggs</a>.
foafmyersBriggs :: ScopedName

-- | <tt>foaf:name</tt> from <a>http://xmlns.com/foaf/spec/#term_name</a>.
foafname :: ScopedName

-- | <tt>foaf:nick</tt> from <a>http://xmlns.com/foaf/spec/#term_nick</a>.
foafnick :: ScopedName

-- | <tt>foaf:openid</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_openid</a>.
foafopenid :: ScopedName

-- | <tt>foaf:page</tt> from <a>http://xmlns.com/foaf/spec/#term_page</a>.
foafpage :: ScopedName

-- | <tt>foaf:pastProject</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_pastProject</a>.
foafpastProject :: ScopedName

-- | <tt>foaf:phone</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_phone</a>.
foafphone :: ScopedName

-- | <tt>foaf:plan</tt> from <a>http://xmlns.com/foaf/spec/#term_plan</a>.
foafplan :: ScopedName

-- | <tt>foaf:primaryTopic</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_primaryTopic</a>.
foafprimaryTopic :: ScopedName

-- | <tt>foaf:publications</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_publications</a>.
foafpublications :: ScopedName

-- | <tt>foaf:schoolHomepage</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_schoolHomepage</a>.
foafschoolHomepage :: ScopedName

-- | <tt>foaf:sha1</tt> from <a>http://xmlns.com/foaf/spec/#term_sha1</a>.
foafsha1 :: ScopedName

-- | <tt>foaf:skypeID</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_skypeID</a>.
foafskypeID :: ScopedName

-- | <tt>foaf:status</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_status</a>.
foafstatus :: ScopedName

-- | <tt>foaf:surname</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_surname</a>.
foafsurname :: ScopedName

-- | <tt>foaf:theme</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_theme</a>.
foaftheme :: ScopedName

-- | <tt>foaf:thumbnail</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_thumbnail</a>.
foafthumbnail :: ScopedName

-- | <tt>foaf:tipjar</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_tipjar</a>.
foaftipjar :: ScopedName

-- | <tt>foaf:title</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_title</a>.
foaftitle :: ScopedName

-- | <tt>foaf:topic</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_topic</a>.
foaftopic :: ScopedName

-- | <tt>foaf:topic_interest</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_topic_interest</a>.
foaftopic_interest :: ScopedName

-- | <tt>foaf:weblog</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_weblog</a>.
foafweblog :: ScopedName

-- | <tt>foaf:workInfoHomepage</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_workInfoHomepage</a>.
foafworkInfoHomepage :: ScopedName

-- | <tt>foaf:workplaceHomepage</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_workplaceHomepage</a>.
foafworkplaceHomepage :: ScopedName

-- | <tt>foaf:yahooChatID</tt> from
--   <a>http://xmlns.com/foaf/spec/#term_yahooChatID</a>.
foafyahooChatID :: ScopedName


-- | This module defines some commonly used vocabulary terms from the Geo
--   vocabulary (<a>http://www.w3.org/2003/01/geo/</a>, WGS84 Geo
--   Positioning: an RDF vocabulary).
--   
--   Note that unlike some of the existing vocabularies in Swish, the Geo
--   one matches the case and spelling of the RDF terms; so we use
--   <a>geolat</a> rather than <tt>geoLat</tt>.
module Swish.RDF.Vocabulary.Geo

-- | Maps <tt>geo</tt> to <a>http://www.w3.org/2003/01/geo/wgs84_pos#</a>.
namespaceGEO :: Namespace

-- | <tt>geo:SpatialThing</tt>.
geoSpatialThing :: ScopedName

-- | <tt>geo:Point</tt>.
geoPoint :: ScopedName

-- | <tt>geo:location</tt>.
geolocation :: ScopedName

-- | <tt>geo:lat</tt>.
geolat :: ScopedName

-- | <tt>geo:long</tt>.
geolong :: ScopedName

-- | <tt>geo:lat_long</tt> (it is suggested that this not be used when
--   generating RDF statements).
geolat_long :: ScopedName


-- | This module defines some vocabulary terms from the Provenance Ontology
--   <a>http://www.w3.org/TR/prov-o/</a> by the W3C Provenance Working
--   Group (<a>http://www.w3.org/2011/prov/wiki/Main_Page/</a>). This is
--   <i>experimental</i> since the Ontology is still a Working Draft.
module Swish.RDF.Vocabulary.Provenance

-- | Maps <tt>prov</tt> to <a>http://www.w3.org/ns/prov-o/</a>.
namespacePROV :: Namespace

-- | <tt>prov:Activity</tt> from
--   <a>http://www.w3.org/TR/prov-o/#activity</a>.
provActivity :: ScopedName

-- | <tt>prov:Agent</tt> from <a>http://www.w3.org/TR/prov-o/#agent</a>.
provAgent :: ScopedName

-- | <tt>prov:Control</tt> from
--   <a>http://www.w3.org/TR/prov-o/#control</a>.
provControl :: ScopedName

-- | <tt>prov:Entity</tt> from <a>http://www.w3.org/TR/prov-o/#entity</a>.
provEntity :: ScopedName

-- | <tt>prov:Generation</tt> from
--   <a>http://www.w3.org/TR/prov-o/#generation</a>.
provGeneration :: ScopedName

-- | <tt>prov:Location</tt> from
--   <a>http://www.w3.org/TR/prov-o/#location</a>.
provLocation :: ScopedName

-- | <tt>prov:Participation</tt> from
--   <a>http://www.w3.org/TR/prov-o/#participation</a>.
provParticipation :: ScopedName

-- | <tt>prov:ProvenanceContainer</tt> from
--   <a>http://www.w3.org/TR/prov-o/#provenancecontainer</a>.
provProvenanceContainer :: ScopedName

-- | <tt>prov:QualifiedInvolvement</tt> from
--   <a>http://www.w3.org/TR/prov-o/#qualifiedinvolvement</a>.
provQualifiedInvolvement :: ScopedName

-- | <tt>prov:Recipe</tt> from <a>http://www.w3.org/TR/prov-o/#recipe</a>.
provRecipe :: ScopedName

-- | <tt>prov:Role</tt> from <a>http://www.w3.org/TR/prov-o/#role</a>.
provRole :: ScopedName

-- | <tt>prov:Usage</tt> from <a>http://www.w3.org/TR/prov-o/#usage</a>.
provUsage :: ScopedName

-- | <tt>prov:dependedOn</tt> from
--   <a>http://www.w3.org/TR/prov-o/#dependedon</a>.
provdependedOn :: ScopedName

-- | <tt>prov:endedAt</tt> from
--   <a>http://www.w3.org/TR/prov-o/#endedat</a>.
provendedAt :: ScopedName

-- | <tt>prov:hadLocation</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadlocation</a>.
provhadLocation :: ScopedName

-- | <tt>prov:hadOriginalSource</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadoriginalsource</a>.
provhadOriginalSource :: ScopedName

-- | <tt>prov:hadParticipant</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadparticipant</a>.
provhadParticipant :: ScopedName

-- | <tt>prov:hadQualifiedControl</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadqualifiedcontrol</a>.
provhadQualifiedControl :: ScopedName

-- | <tt>prov:hadQualifiedEntity</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadqualifiedentity</a>.
provhadQualifiedEntity :: ScopedName

-- | <tt>prov:hadQualifiedGeneration</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadqualifiedgeneration</a>.
provhadQualifiedGeneration :: ScopedName

-- | <tt>prov:hadQualifiedParticipation</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadqualifiedparticipation</a>.
provhadQualifiedParticipation :: ScopedName

-- | <tt>prov:hadQualifiedUsage</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadqualifiedusage</a>.
provhadQualifiedUsage :: ScopedName

-- | <tt>prov:hadRecipe</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadrecipe</a>.
provhadRecipe :: ScopedName

-- | <tt>prov:hadRole</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadrole</a>.
provhadRole :: ScopedName

-- | <tt>prov:hadTemporalValue</tt> from
--   <a>http://www.w3.org/TR/prov-o/#hadtemporalvalue</a>.
provhadTemporalValue :: ScopedName

-- | <tt>prov:startedAt</tt> from
--   <a>http://www.w3.org/TR/prov-o/#startedat</a>.
provstartedAt :: ScopedName

-- | <tt>prov:used</tt> from <a>http://www.w3.org/TR/prov-o/#used</a>.
provused :: ScopedName

-- | <tt>prov:wasAttributedTo</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wasattributedto</a>.
provwasAttributedTo :: ScopedName

-- | <tt>prov:wasComplementOf</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wascomplementof</a>.
provwasComplementOf :: ScopedName

-- | <tt>prov:wasControlledBy</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wascontrolledby</a>.
provwasControlledBy :: ScopedName

-- | <tt>prov:wasDerivedFrom</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wasderivedfrom</a>.
provwasDerivedFrom :: ScopedName

-- | <tt>prov:wasEventuallyDerivedFrom</tt> from
--   <a>http://www.w3.org/TR/prov-o/#waseventuallyderivedfrom</a>.
provwasEventuallyDerivedFrom :: ScopedName

-- | <tt>prov:wasGeneratedAt</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wasgeneratedat</a>.
provwasGeneratedAt :: ScopedName

-- | <tt>prov:wasGeneratedBy</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wasgeneratedby</a>.
provwasGeneratedBy :: ScopedName

-- | <tt>prov:wasInformedBy</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wasinformedby</a>.
provwasInformedBy :: ScopedName

-- | <tt>prov:wasQuoteOf</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wasquoteof</a>.
provwasQuoteOf :: ScopedName

-- | <tt>prov:wasRevisionOf</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wasrevisionof</a>.
provwasRevisionOf :: ScopedName

-- | <tt>prov:wasScheduledAfter</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wasscheduledafter</a>.
provwasScheduledAfter :: ScopedName

-- | <tt>prov:wasSummaryOf</tt> from
--   <a>http://www.w3.org/TR/prov-o/#wassummaryof</a>.
provwasSummaryOf :: ScopedName


-- | This module defines some commonly used vocabulary terms from the SIOC
--   project (<a>http://sioc-project.org/</a>).
module Swish.RDF.Vocabulary.SIOC

-- | Maps <tt>sioc</tt> to <a>http://rdfs.org/sioc/ns#</a>.
namespaceSIOC :: Namespace

-- | <tt>sioc:Community</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_Community</a>.
siocCommunity :: ScopedName

-- | <tt>sioc:Container</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_Container</a>.
siocContainer :: ScopedName

-- | <tt>sioc:Forum</tt> from <a>http://rdfs.org/sioc/spec/#term_Forum</a>.
siocForum :: ScopedName

-- | <tt>sioc:Item</tt> from <a>http://rdfs.org/sioc/spec/#term_Item</a>.
siocItem :: ScopedName

-- | <tt>sioc:Post</tt> from <a>http://rdfs.org/sioc/spec/#term_Post</a>.
siocPost :: ScopedName

-- | <tt>sioc:Role</tt> from <a>http://rdfs.org/sioc/spec/#term_Role</a>.
siocRole :: ScopedName

-- | <tt>sioc:Site</tt> from <a>http://rdfs.org/sioc/spec/#term_Site</a>.
siocSite :: ScopedName

-- | <tt>sioc:Space</tt> from <a>http://rdfs.org/sioc/spec/#term_Space</a>.
siocSpace :: ScopedName

-- | <tt>sioc:Thread</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_Thread</a>.
siocThread :: ScopedName

-- | <tt>sioc:UserAccount</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_UserAccount</a>.
siocUserAccount :: ScopedName

-- | <tt>sioc:Usergroup</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_Usergroup</a>.
siocUsergroup :: ScopedName

-- | <tt>sioc:about</tt> from <a>http://rdfs.org/sioc/spec/#term_about</a>.
siocabout :: ScopedName

-- | <tt>sioc:account_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_account_of</a>.
siocaccount_of :: ScopedName

-- | <tt>sioc:addressed_to</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_addressed_to</a>.
siocaddressed_to :: ScopedName

-- | <tt>sioc:administrator_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_administrator_of</a>.
siocadministrator_of :: ScopedName

-- | <tt>sioc:attachment</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_attachment</a>.
siocattachment :: ScopedName

-- | <tt>sioc:avatar</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_avatar</a>.
siocavatar :: ScopedName

-- | <tt>sioc:container_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_container_of</a>.
sioccontainer_of :: ScopedName

-- | <tt>sioc:content</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_content</a>.
sioccontent :: ScopedName

-- | <tt>sioc:creator_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_creator_of</a>.
sioccreator_of :: ScopedName

-- | <tt>sioc:earlier_version</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_earlier_version</a>.
siocearlier_version :: ScopedName

-- | <tt>sioc:email</tt> from <a>http://rdfs.org/sioc/spec/#term_email</a>.
siocemail :: ScopedName

-- | <tt>sioc:email_sha1</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_email_sha1</a>.
siocemail_sha1 :: ScopedName

-- | <tt>sioc:embeds_knowledge</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_embeds_knowledge</a>.
siocembeds_knowledge :: ScopedName

-- | <tt>sioc:feed</tt> from <a>http://rdfs.org/sioc/spec/#term_feed</a>.
siocfeed :: ScopedName

-- | <tt>sioc:follows</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_follows</a>.
siocfollows :: ScopedName

-- | <tt>sioc:function_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_function_of</a>.
siocfunction_of :: ScopedName

-- | <tt>sioc:has_administrator</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_administrator</a>.
siochas_administrator :: ScopedName

-- | <tt>sioc:has_container</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_container</a>.
siochas_container :: ScopedName

-- | <tt>sioc:has_creator</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_creator</a>.
siochas_creator :: ScopedName

-- | <tt>sioc:has_discussion</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_discussion</a>.
siochas_discussion :: ScopedName

-- | <tt>sioc:has_function</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_function</a>.
siochas_function :: ScopedName

-- | <tt>sioc:has_host</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_host</a>.
siochas_host :: ScopedName

-- | <tt>sioc:has_member</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_member</a>.
siochas_member :: ScopedName

-- | <tt>sioc:has_moderator</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_moderator</a>.
siochas_moderator :: ScopedName

-- | <tt>sioc:has_modifier</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_modifier</a>.
siochas_modifier :: ScopedName

-- | <tt>sioc:has_owner</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_owner</a>.
siochas_owner :: ScopedName

-- | <tt>sioc:has_parent</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_parent</a>.
siochas_parent :: ScopedName

-- | <tt>sioc:has_reply</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_reply</a>.
siochas_reply :: ScopedName

-- | <tt>sioc:has_scope</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_scope</a>.
siochas_scope :: ScopedName

-- | <tt>sioc:has_space</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_space</a>.
siochas_space :: ScopedName

-- | <tt>sioc:has_subscriber</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_subscriber</a>.
siochas_subscriber :: ScopedName

-- | <tt>sioc:has_usergroup</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_has_usergroup</a>.
siochas_usergroup :: ScopedName

-- | <tt>sioc:host_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_host_of</a>.
siochost_of :: ScopedName

-- | <tt>sioc:id</tt> from <a>http://rdfs.org/sioc/spec/#term_id</a>.
siocid :: ScopedName

-- | <tt>sioc:ip_address</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_ip_address</a>.
siocip_address :: ScopedName

-- | <tt>sioc:last_activity_date</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_last_activity_date</a>.
sioclast_activity_date :: ScopedName

-- | <tt>sioc:last_item_date</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_last_item_date</a>.
sioclast_item_date :: ScopedName

-- | <tt>sioc:last_reply_date</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_last_reply_date</a>.
sioclast_reply_date :: ScopedName

-- | <tt>sioc:later_version</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_later_version</a>.
sioclater_version :: ScopedName

-- | <tt>sioc:latest_version</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_latest_version</a>.
sioclatest_version :: ScopedName

-- | <tt>sioc:link</tt> from <a>http://rdfs.org/sioc/spec/#term_link</a>.
sioclink :: ScopedName

-- | <tt>sioc:links_to</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_links_to</a>.
sioclinks_to :: ScopedName

-- | <tt>sioc:member_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_member_of</a>.
siocmember_of :: ScopedName

-- | <tt>sioc:moderator_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_moderator_of</a>.
siocmoderator_of :: ScopedName

-- | <tt>sioc:modifier_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_modifier_of</a>.
siocmodifier_of :: ScopedName

-- | <tt>sioc:name</tt> from <a>http://rdfs.org/sioc/spec/#term_name</a>.
siocname :: ScopedName

-- | <tt>sioc:next_by_date</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_next_by_date</a>.
siocnext_by_date :: ScopedName

-- | <tt>sioc:next_version</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_next_version</a>.
siocnext_version :: ScopedName

-- | <tt>sioc:note</tt> from <a>http://rdfs.org/sioc/spec/#term_note</a>.
siocnote :: ScopedName

-- | <tt>sioc:num_authors</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_num_authors</a>.
siocnum_authors :: ScopedName

-- | <tt>sioc:num_items</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_num_items</a>.
siocnum_items :: ScopedName

-- | <tt>sioc:num_replies</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_num_replies</a>.
siocnum_replies :: ScopedName

-- | <tt>sioc:num_threads</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_num_threads</a>.
siocnum_threads :: ScopedName

-- | <tt>sioc:num_views</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_num_views</a>.
siocnum_views :: ScopedName

-- | <tt>sioc:owner_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_owner_of</a>.
siocowner_of :: ScopedName

-- | <tt>sioc:parent_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_parent_of</a>.
siocparent_of :: ScopedName

-- | <tt>sioc:previous_by_date</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_previous_by_date</a>.
siocprevious_by_date :: ScopedName

-- | <tt>sioc:previous_version</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_previous_version</a>.
siocprevious_version :: ScopedName

-- | <tt>sioc:related_to</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_related_to</a>.
siocrelated_to :: ScopedName

-- | <tt>sioc:reply_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_reply_of</a>.
siocreply_of :: ScopedName

-- | <tt>sioc:scope_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_scope_of</a>.
siocscope_of :: ScopedName

-- | <tt>sioc:sibling</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_sibling</a>.
siocsibling :: ScopedName

-- | <tt>sioc:space_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_space_of</a>.
siocspace_of :: ScopedName

-- | <tt>sioc:subscriber_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_subscriber_of</a>.
siocsubscriber_of :: ScopedName

-- | <tt>sioc:topic</tt> from <a>http://rdfs.org/sioc/spec/#term_topic</a>.
sioctopic :: ScopedName

-- | <tt>sioc:usergroup_of</tt> from
--   <a>http://rdfs.org/sioc/spec/#term_usergroup_of</a>.
siocusergroup_of :: ScopedName