index.html 604 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 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 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539
<?xml version="1.0" encoding="utf-8"?>
<!--{xml-fix} XSLT Processor: SAXON 9.1.0.2 from Saxonica SAXON SA 9.1.0.2--><!--This document was created at 20110311 1646-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN" xml:lang="EN">
<head>
<meta name="generator" content=
"HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" />
<title>XQuery and XPath Full Text 1.0</title>

<style type="text/css">
/*<![CDATA[*/
code           { font-family: monospace; }

div.constraint,
div.issue,
div.note,
div.notice     { margin-left: 2em; }

div.issue
p.title        { margin-left: -2em; }

ol.enumar      { list-style-type: decimal; }
ol.enumla      { list-style-type: lower-alpha; }
ol.enumlr      { list-style-type: lower-roman; }
ol.enumua      { list-style-type: upper-alpha; }
ol.enumur      { list-style-type: upper-roman; }

li p           { margin-top: 0.3em;
                 margin-bottom: 0.3em; }

sup small      { font-style: italic;
                 color: #8F8F8F;
               }
    
div.exampleInner pre { margin-left: 1em;
                       margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
                  margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
                   border-top-width: 4px;
                   border-top-style: double;
                   border-top-color: #d3d3d3;
                   border-bottom-width: 4px;
                   border-bottom-style: double;
                   border-bottom-color: #d3d3d3;
                   padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
                    margin: 4px}

div.issue { border-bottom-color: black;
            border-bottom-style: solid;
            border-bottom-width: 1pt;
            margin-bottom: 20pt;
}

th.issue-toc-head { border-bottom-color: black;
                    border-bottom-style: solid;
                    border-bottom-width: 1pt;
}

      
table.small    { font-size: x-small; }
    table.small                             { font-size: x-small; }
a.judgment:visited, a.judgment:link     { font-family: sans-serif;
                                          color: black; 
                                          text-decoration: none }
a.processing:visited, a.processing:link { color: black; 
                                                text-decoration: none }
a.env:visited, a.env:link               { color: black; 
                                          text-decoration: none }
/*]]>*/
</style>
<link rel="stylesheet" type="text/css" href=
"http://www.w3.org/StyleSheets/TR/W3C-REC.css" />
</head>
<body>
<div class="head">
<p><a href="http://www.w3.org/"><img src=
"http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width=
"72" /></a></p>
<h1><a name="title" id="title"></a>XQuery and XPath Full Text
1.0</h1>
<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Recommendation
17 March 2011</h2>
<dl>
<dt>This version:</dt>
<dd><a href=
"http://www.w3.org/TR/2011/REC-xpath-full-text-10-20110317/">http://www.w3.org/TR/2011/REC-xpath-full-text-10-20110317/</a></dd>
<dt>Latest version:</dt>
<dd><a href=
"http://www.w3.org/TR/xpath-full-text-10/">http://www.w3.org/TR/xpath-full-text-10/</a></dd>
<dt>Previous version:</dt>
<dd><a href=
"http://www.w3.org/TR/2011/PR-xpath-full-text-10-20110125/">http://www.w3.org/TR/2011/PR-xpath-full-text-10-20110125/</a></dd>
<dt>Editors:</dt>
<!--xmlspec, match="author"-->
<dd>Pat Case, Library of Congress</dd>
<!--xmlspec, match="author"-->
<dd>Michael Dyck, Invited Expert</dd>
<!--xmlspec, match="author"-->
<dd>Mary Holstege, Mark Logic Corporation</dd>
<!--xmlspec, match="author"-->
<dd>Sihem Amer-Yahia, AT&amp;T Labs - Research</dd>
<!--xmlspec, match="author"-->
<dd>Chavdar Botev, Invited Expert</dd>
<!--xmlspec, match="author"-->
<dd>Stephen Buxton, Mark Logic Corporation</dd>
<!--xmlspec, match="author"-->
<dd>Jochen Doerre, IBM</dd>
<!--xmlspec, match="author"-->
<dd>Jim Melton, Oracle</dd>
<!--xmlspec, match="author"-->
<dd>Michael Rys, Microsoft</dd>
<!--xmlspec, match="author"-->
<dd>Jayavel Shanmugasundaram, Invited Expert</dd>
</dl>
<p>Please refer to the <a href=
"http://www.w3.org/XML/2012/qt-errata/xpath-full-text-10-errata.html">
<strong>errata</strong></a> for this document, which may include
some normative corrections.</p>
<p>See also <a href=
"http://www.w3.org/2003/03/Translations/byTechnology?technology=xpath-full-text-10">
<strong>translations</strong></a>.</p>
<p>This document is also available in these non-normative formats:
<a href=
"http://www.w3.org/TR/2011/REC-xpath-full-text-10-20110317/xpath-full-text-10.xml">
XML</a> and&#160;<a href=
"http://www.w3.org/TR/2011/REC-xpath-full-text-10-20110317/Overview-diff.html">Changes
since Candidate Recommendation</a>.</p>
<p class="copyright"><a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>&#160;©&#160;2011&#160;<a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
(<a href="http://www.csail.mit.edu/"><acronym title=
"Massachusetts Institute of Technology">MIT</acronym></a>, <a href=
"http://www.ercim.eu/"><acronym title=
"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
W3C <a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a href=
"http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
</div>
<hr />
<div>
<h2><a name="abstract" id="abstract"></a>Abstract</h2>
<p>This document defines the syntax and formal semantics of XQuery
and XPath Full Text 1.0, which is a language that extends XQuery
1.0 <a href="#xquery">[XQuery 1.0: An XML Query Language (Second
Edition)]</a> and XPath 2.0 <a href="#xpath20">[XML Path Language
(XPath) 2.0 (Second Edition)]</a> with full-text search
capabilities.</p>
</div>
<div>
<h2><a name="status" id="status"></a>Status of this Document</h2>
<p><em>This section describes the status of this document at the
time of its publication. Other documents may supersede this
document. A list of current W3C publications and the latest
revision of this technical report can be found in the <a href=
"http://www.w3.org/TR/">W3C technical reports index</a> at
http://www.w3.org/TR/.</em></p>
<p>This is a <a href=
"http://www.w3.org/2005/10/Process-20051014/tr.html#RecsW3C">Recommendation</a>
of the W3C. It was jointly developed by the W3C <a href=
"http://www.w3.org/XML/Query/">XML Query Working Group</a> and the
W3C <a href="http://www.w3.org/Style/XSL/">XSL Working Group</a>,
each of which is part of the <a href=
"http://www.w3.org/XML/Activity">XML Activity</a>.</p>
<p>This document incorporates minor changes made against the
Proposed Recommendation of 25 January 2011. Changes to this
document since the Proposed Recommendation are detailed in <a href=
"#id-xqft-changelog"><b>J Change Log</b></a>. A Java applet that
parses XQuery and XPath Full Text 1.0 expressions is available at
<a href=
"http://www.w3.org/2010/02/qt-applets/xquery10-fulltext/">http://www.w3.org/2010/02/qt-applets/xquery10-fulltext/</a>.</p>
<p>A Test Suite has been created for this document. Implementors
are encouraged to run this test suite and report their results. The
Test Suite can be found at <a href=
"http://dev.w3.org/cvsweb/2007/xpath-full-text-10-test-suite/">http://dev.w3.org/cvsweb/2007/xpath-full-text-10-test-suite/</a>.
An implementation report is available at <a href=
"http://dev.w3.org/2007/xpath-full-text-10-test-suite/PublicPagesStagingArea/ReportedResults/XQFTTSReport.html">
http://dev.w3.org/2007/xpath-full-text-10-test-suite/PublicPagesStagingArea/ReportedResults/XQFTTSReport.html</a>.</p>
<p>No substantive changes have been made to this specification
since its publication as a Proposed Recommendation.</p>
<p>Please report errors in this document using W3C's <a href=
"http://www.w3.org/Bugs/Public/">public Bugzilla system</a>
(instructions can be found at <a href=
"http://www.w3.org/XML/2005/04/qt-bugzilla">http://www.w3.org/XML/2005/04/qt-bugzilla</a>).
If access to that system is not feasible, you may send your
comments to the W3C XSLT/XPath/XQuery public comments mailing list,
<a href=
"mailto:public-qt-comments@w3.org">public-qt-comments@w3.org</a>.
It will be very helpful if you include the string “[FT]” in the
subject line of your report, whether made in Bugzilla or in email.
Please use multiple Bugzilla entries (or, if necessary, multiple
email messages) if you have more than one comment to make. Archives
of the comments and responses are available at <a href=
"http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-comments/</a>.</p>
<p>This document has been reviewed by W3C Members, by software
developers, and by other W3C groups and interested parties, and is
endorsed by the Director as a W3C Recommendation. It is a stable
document and may be used as reference material or cited from
another document. W3C's role in making the Recommendation is to
draw attention to the specification and to promote its widespread
deployment. This enhances the functionality and interoperability of
the Web.</p>
<p>This document was produced by groups operating under the
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
February 2004 W3C Patent Policy</a>. W3C maintains a <a href=
"http://www.w3.org/2004/01/pp-impl/18797/status#disclosures">public
list of any patent disclosures</a> made in connection with the
deliverables of the XML Query Working Group and also maintains a
<a href=
"http://www.w3.org/2004/01/pp-impl/19552/status#disclosures">public
list of any patent disclosures</a> made in connection with the
deliverables of the XSL Working Group; those pages also include
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains
<a href=
"http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">
Essential Claim(s)</a> must disclose the information in accordance
with <a href=
"http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">
section 6 of the W3C Patent Policy</a>.</p>
</div>
<div class="toc">
<h2><a name="contents" id="contents"></a>Table of Contents</h2>
<p class="toc">1 <a href="#introduction">Introduction</a><br />
&#160;&#160;&#160;&#160;1.1 <a href="#tq-ftsearch-xml">Full-Text
Search and XML</a><br />
&#160;&#160;&#160;&#160;1.2 <a href=
"#tq-ft-organization">Organization of this document</a><br />
&#160;&#160;&#160;&#160;1.3 <a href="#tq-ft-namespaces">A word
about namespaces</a><br />
2 <a href="#tq-extensions">Full-Text Extensions to XQuery and
XPath</a><br />
&#160;&#160;&#160;&#160;2.1 <a href="#processing-model">Processing
Model</a><br />
&#160;&#160;&#160;&#160;2.2 <a href=
"#section-ftcontainsexpr">Full-Text Contains Expression</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2.2.1 <a href=
"#section-ftcontainsexpr-description">Description</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2.2.2 <a href=
"#section-ftcontainsexpr-examples">Examples</a><br />
&#160;&#160;&#160;&#160;2.3 <a href=
"#section-score-variables">Score Variables</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2.3.1 <a href=
"#section-using-weights">Using Weights Within a Scored
FTContainsExpr</a><br />
&#160;&#160;&#160;&#160;2.4 <a href=
"#section-extensions-static-context">Extensions to the Static
Context</a><br />
3 <a href="#ftselections">Full-Text Selections</a><br />
&#160;&#160;&#160;&#160;3.1 <a href="#ftprimary">Primary Full-Text
Selections</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.1.1 <a href=
"#ftweight">Weights</a><br />
&#160;&#160;&#160;&#160;3.2 <a href="#ftwords">Search Tokens and
Phrases</a><br />
&#160;&#160;&#160;&#160;3.3 <a href="#fttimes">Cardinality
Selection</a><br />
&#160;&#160;&#160;&#160;3.4 <a href="#ftmatchoptions">Match
Options</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.4.1 <a href=
"#ftlanguageoption">Language Option</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.4.2 <a href=
"#ftwildcardoption">Wildcard Option</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.4.3 <a href=
"#ftthesaurusoption">Thesaurus Option</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.4.4 <a href=
"#ftstemoption">Stemming Option</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.4.5 <a href=
"#ftcaseoption">Case Option</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.4.6 <a href=
"#ftdiacriticsoption">Diacritics Option</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.4.7 <a href=
"#ftstopwordoption">Stop Word Option</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.4.8 <a href=
"#ftextensionoption">Extension Option</a><br />
&#160;&#160;&#160;&#160;3.5 <a href="#logical_ftoperators">Logical
Full-Text Operators</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.5.1 <a href=
"#sec-ftor">Or-Selection</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.5.2 <a href=
"#sec-ftand">And-Selection</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.5.3 <a href=
"#sec-ftmildnot">Mild-Not Selection</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.5.4 <a href=
"#sec-ftnot">Not-Selection</a><br />
&#160;&#160;&#160;&#160;3.6 <a href="#ftposfilter">Positional
Filters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.6.1 <a href=
"#ftorder">Ordered Selection</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.6.2 <a href=
"#ftwindow">Window Selection</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.6.3 <a href=
"#ftdistance">Distance Selection</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.6.4 <a href=
"#ftscope">Scope Selection</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.6.5 <a href=
"#ftcontent">Anchoring Selection</a><br />
&#160;&#160;&#160;&#160;3.7 <a href="#ftignoreoption">Ignore
Option</a><br />
&#160;&#160;&#160;&#160;3.8 <a href=
"#id-extension-selections">Extension Selections</a><br />
4 <a href="#tq-semantics">Semantics</a><br />
&#160;&#160;&#160;&#160;4.1 <a href=
"#TokenizationSec">Tokenization</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.1.1 <a href=
"#tq-ft-Tokenization-examples">Examples</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.1.2 <a href=
"#TokenizationRepresentationsSec">Representations of Tokenized Text
and Matching</a><br />
&#160;&#160;&#160;&#160;4.2 <a href=
"#FTSelectionEvalSec">Evaluation of FTSelections</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.1 <a href=
"#AllMatchesSec">AllMatches</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.1.1
<a href="#tq-ft-formalmodel">Formal Model</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.1.2
<a href="#tq-ft-AllMatches-examples">Examples</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.1.3
<a href="#tq-ft-XML-representation">XML representation</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.2 <a href=
"#FTSelectionsXMLSec">XML Representation</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.3 <a href=
"#tq-ft-evaluate-function">The evaluate function</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.4 <a href=
"#tq-ft-fs-FTWords">FTWords</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5 <a href=
"#FTMatchOptionsSec">Match Options Semantics</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.1
<a href="#tq-ft-matchopt-types">Types</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.2
<a href="#tq-ft-matchopt-highlevel">High-Level Semantics</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.3
<a href="#options-sem-functions">Formal Semantics
Functions</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.4
<a href="#tq-ft-matchopt-FTCaseOption">FTCaseOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.5
<a href=
"#tq-ft-matchopt-FTDiacriticsOption">FTDiacriticsOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.6
<a href="#tq-ft-matchopt-FTStemOption">FTStemOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.7
<a href=
"#tq-ft-matchopt-FTThesaurusOption">FTThesaurusOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.8
<a href=
"#tq-ft-matchopt-FTStopWordOption">FTStopWordOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.9
<a href=
"#tq-ft-matchopt-FTLanguageOption">FTLanguageOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5.10
<a href=
"#tq-ft-matchopt-FTWildCardOption">FTWildCardOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6 <a href=
"#FTOperatorsSemanticsSec">Full-Text Operators Semantics</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.1
<a href="#tq-ft-fs-FTOr">FTOr</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.2
<a href="#tq-ft-fs-FTAnd">FTAnd</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.3
<a href="#tq-ft-fs-FTUnaryNot">FTUnaryNot</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.4
<a href="#tq-ft-fs-FTMildNot">FTMildNot</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.5
<a href="#tq-ft-fs-FTOrder">FTOrder</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.6
<a href="#tq-ft-fs-FTScope">FTScope</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.7
<a href="#tq-ft-fs-FTContent">FTContent</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.8
<a href="#tq-ft-fs-FTWindow">FTWindow</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.9
<a href="#tq-ft-fs-FTDistance">FTDistance</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6.10
<a href="#tq-ft-fs-FTTimes">FTTimes</a><br />
&#160;&#160;&#160;&#160;4.3 <a href=
"#FTContainsSec">FTContainsExpr</a><br />
&#160;&#160;&#160;&#160;4.4 <a href="#ScoreSec">Scoring</a><br />
&#160;&#160;&#160;&#160;4.5 <a href=
"#tq-ft-FTContainsExpr-example">Example</a><br />
5 <a href="#id-tq-conformance">Conformance</a><br />
&#160;&#160;&#160;&#160;5.1 <a href=
"#id-minimal-conformance">Minimal Conformance</a><br />
&#160;&#160;&#160;&#160;5.2 <a href=
"#id-conform-optional-features">Optional Features</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.1 <a href=
"#id-ftmildnot-option">FTMildNot Operator</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.2 <a href=
"#id-unary-not-option">FTUnaryNot Operator</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.3 <a href=
"#id-ftunit-option">FTUnit and FTBigUnit</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.4 <a href=
"#id-ftorder-option">FTOrder Operator</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.5 <a href=
"#id-ftscope-option">FTScope Operator</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.6 <a href=
"#id-ftwindow-option">FTWindow Operator</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.7 <a href=
"#id-ftdistance-option">FTDistance Operator</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.8 <a href=
"#id-fttimes-option">FTTimes Operator</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.9 <a href=
"#id-ftcontent-option">FTContent Operator</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.10 <a href=
"#id-ftcase-option">FTCaseOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.11 <a href=
"#id-ftstopword-option">FTStopWordOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.12 <a href=
"#id-ftlanguage-option">FTLanguageOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.13 <a href=
"#id-ftignore-option">FTIgnoreOption</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.14 <a href=
"#id-scoring-option">Scoring</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.15 <a href=
"#id-weights-conf">Weights</a><br />
6 <a href="#id-xqueryx-full-text-conformance">XQueryX
Conformance</a><br /></p>
<h3><a name="appendices" id="appendices"></a>Appendices</h3>
<p class="toc">A <a href="#id-grammar">EBNF for XQuery 1.0 Grammar
with Full Text extensions</a><br />
&#160;&#160;&#160;&#160;A.1 <a href="#grammar-terminals">Terminal
Symbols</a><br />
B <a href="#id-xpath-grammar">EBNF for XPath 2.0 Grammar with
Full-Text extensions</a><br />
&#160;&#160;&#160;&#160;B.1 <a href=
"#xpath-grammar-terminals">Terminal Symbols</a><br />
C <a href="#id-xqft-static-context-components">Static Context
Components</a><br />
D <a href="#id-errors">Error Conditions</a><br />
E <a href="#id-xqft-xqueryx">XML Syntax (XQueryX) for XQuery and
XPath Full Text 1.0</a><br />
&#160;&#160;&#160;&#160;E.1 <a href=
"#id-xqft-full-text-schema">XQueryX representation of XQuery and
XPath Full Text 1.0</a><br />
&#160;&#160;&#160;&#160;E.2 <a href=
"#id-xqft-full-text-stylesheet">XQueryX stylesheet for XQuery and
XPath Full Text 1.0</a><br />
&#160;&#160;&#160;&#160;E.3 <a href=
"#id-xqft-full-text-examples">XQueryX for XQuery and XPath Full
Text 1.0 example</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;E.3.1 <a href=
"#Example1">Example</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;E.3.1.1
<a href="#Example1-XQuery-Full-Text">XQuery solution in XQuery and
XPath Full Text 1.0 Use Cases:</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;E.3.1.2
<a href="#Example1-Full-Text-XQueryX">A Solution in Full Text
XQueryX:</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;E.3.1.3
<a href="#Example1-Full-Text-Transformation">Transformation of Full
Text XQueryX Solution into XQuery Full Text</a><br />
F <a href="#References">References</a><br />
&#160;&#160;&#160;&#160;F.1 <a href=
"#id-normative-references">Normative References</a><br />
&#160;&#160;&#160;&#160;F.2 <a href=
"#id-non-normative-references">Non-normative References</a><br />
G <a href="#ft-acknowledgements">Acknowledgements</a>
(Non-Normative)<br />
H <a href="#ft-glossary">Glossary</a> (Non-Normative)<br />
I <a href="#impl-def">Checklist of Implementation-Defined
Features</a> (Non-Normative)<br />
J <a href="#id-xqft-changelog">Change Log</a>
(Non-Normative)<br /></p>
</div>
<hr />
<div class="body">
<div class="div1">
<h2><a name="introduction" id="introduction"></a>1
Introduction</h2>
<p>This document defines the language and the formal semantics of
XQuery and XPath Full Text 1.0. This language is designed to meet
the requirements identified in W3C XQuery and XPath Full Text
Requirements <a href="#xpath-full-text-10-requirements">[XQuery and
XPath Full Text 1.0 Requirements]</a> and to support the queries in
the W3C XQuery and XPath Full Text Use Cases <a href=
"#xpath-full-text-10-use-cases">[XQuery and XPath Full Text 1.0 Use
Cases]</a>.</p>
<p>In this document, examples and material labeled as "Note" are
provided for explanatory purposes and are not normative.</p>
<p>XQuery and XPath Full Text 1.0 extends the syntax and semantics
of XQuery 1.0 and XPath 2.0.</p>
<p>Additionally, this document defines an XML syntax for XQuery and
XPath Full Text 1.0. The most recent versions of the two XQueryX
XML Schemas and the XQueryX XSLT stylesheet for XQuery and XPath
Full Text 1.0 are available at <a href=
"http://www.w3.org/2007/xpath-full-text/xpath-full-text-10-xqueryx.xsd">
http://www.w3.org/2007/xpath-full-text/xpath-full-text-10-xqueryx.xsd</a>,
<a href=
"http://www.w3.org/2007/xpath-full-text/xpath-full-text-10-xqueryx-ftmatchoption-extensions.xsd">
http://www.w3.org/2007/xpath-full-text/xpath-full-text-10-xqueryx-ftmatchoption-extensions.xsd</a>,
and <a href=
"http://www.w3.org/2007/xpath-full-text/xpath-full-text-10-xqueryx.xsl">
http://www.w3.org/2007/xpath-full-text/xpath-full-text-10-xqueryx.xsl</a>,
respectively.</p>
<div class="div2">
<h3><a name="tq-ftsearch-xml" id="tq-ftsearch-xml"></a>1.1
Full-Text Search and XML</h3>
<p>As XML becomes mainstream, users expect to be able to search
their XML documents. This requires a standard way to do full-text
search, as well as structured searches, against XML documents. A
similar requirement for full-text search led ISO to define the
SQL/MM-FT <a href="#sqlmm">[SQL/MM]</a> standard. SQL/MM-FT defines
extensions to SQL to express full-text searches providing
functionality similar to that defined in this full-text language
extension to XQuery 1.0 and XPath 2.0.</p>
<p>XML documents may contain highly structured data (fixed schemas,
known types such as numbers, dates), semi-structured data (flexible
schemas and types), markup data (text with embedded tags), and
unstructured data (untagged free-flowing text). Where a document
contains unstructured or semi-structured data, it is important to
be able to search using Information Retrieval techniques such as
scoring and weighting.</p>
<p>Full-text search is different from substring search in many
ways:</p>
<ol class="enumar">
<li>
<p>A full-text search searches for tokens and phrases rather than
substrings. A substring search for news items that contain the
string "lease" will return a news item that contains "Foobar
Corporation releases version 20.9 ...". A full-text search for the
token "lease" will not.</p>
</li>
<li>
<p>There is an expectation that a full-text search will support
language-based searches which substring search cannot. An example
of a language-based search is "find me all the news items that
contain a token with the same linguistic stem as 'mouse'" (finds
"mouse" and "mice"). Another example based on token proximity is
"find me all the news items that contain the tokens 'XML' and
'Query' allowing up to 3 intervening tokens".</p>
</li>
<li>
<p>Full-text search must address the vagaries and nuances of
language. Search results are often of varying usefulness. When you
search a web site for cameras that cost less than $100, this is an
exact search. There is a set of cameras that matches this search,
and a set that does not. Similarly, when you do a string search
across news items for "mouse", there is only 1 expected result set.
When you do a full-text search for all the news items that contain
the token "mouse", you probably expect to find news items
containing the token "mice", and possibly "rodents", or possibly
"computers". Not all results are equal. Some results are more
"mousey" than others. Because full-text search may be inexact, we
have the notion of score or relevance. We generally expect to see
the most relevant results at the top of the results list.</p>
</li>
</ol>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>As XQuery and XPath evolve, they may apply the notion of score
to querying structured data. For example, when making travel plans
or shopping for cameras, it is sometimes useful to get an ordered
list of near matches in addition to exact matches. If XQuery and
XPath define a generalized inexact match, we expect XQuery and
XPath to utilize the scoring framework provided by XQuery and XPath
Full Text 1.0.</p>
</div>
<p>[<a name="Full-TextQueriesDef" id="Full-TextQueriesDef" title=
"Full-TextQueries">Definition</a>: <b>Full-text queries</b> are
performed on tokens and phrases. Tokens and phrases are produced
via tokenization.] Informally, tokenization breaks a character
string into a sequence of tokens, units of punctuation, and
spaces.</p>
<p>Tokenization, in general terms, is the process of converting a
text string into smaller units that are used in query processing.
Those units, called tokens, are the most basic text units that a
full-text search can refer to. Full-text operators typically work
on sequences of tokens found in the target text of a search. These
tokens are characterized by integers that capture the relative
position(s) of the token inside the string, the relative
position(s) of the sentence containing the token, and the relative
position(s) of the paragraph containing the token. The positions
typically comprise a start and an end position.</p>
<p>Tokenization, including the definition of the term "tokens",
<a title="should" href="#should">SHOULD</a> be <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.
Implementations <a title="should" href="#should">SHOULD</a> expose
the rules and sample results of tokenization as much as possible to
enable users to predict and interpret the results of tokenization.
Tokenization operates on the string value of an item; for element
nodes this does not include the content of attribute nodes, but for
attribute nodes it does. Tokenization is defined more formally in
<a href="#TokenizationSec"><b>4.1 Tokenization</b></a>.</p>
<p>[<a name="TokenDef" id="TokenDef" title="Token">Definition</a>:
A <b>token</b> is a non-empty sequence of characters returned by a
tokenizer as a basic unit to be searched. Beyond that, tokens are
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.] [<a name=
"PhraseDef" id="PhraseDef" title="Phrase">Definition</a>: A
<b>phrase</b> is an ordered sequence of any number of tokens.
Beyond that, phrases are <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.]</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Consecutive tokens need not be separated by either punctuation
or space, and tokens may overlap.</p>
</div>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>In some natural languages, tokens and words can be used
interchangeably.</p>
</div>
<p>[<a name="SentenceDef" id="SentenceDef" title=
"Sentence">Definition</a>: A <b>sentence</b> is an ordered sequence
of any number of tokens. Beyond that, sentences are <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. A
tokenizer is not required to support sentences.]</p>
<p>[<a name="ParagraphDef" id="ParagraphDef" title=
"Paragraph">Definition</a>: A <b>paragraph</b> is an ordered
sequence of any number of tokens. Beyond that, paragraphs are
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. A
tokenizer is not required to support paragraphs.]</p>
<p>Some XML elements represent semantic markup, e.g.,
&lt;title&gt;. Others represent formatting markup, e.g., &lt;b&gt;
to indicate bold. Semantic markup serves well as token boundaries.
Some formatting markup serves well as token boundaries; for
example, paragraphs are most commonly delimited by formatting
markup. Other formatting markup may not serve well as token
boundaries. Implementations are free to provide <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> ways to
differentiate between the markup's effect on token boundaries
during tokenization. In the absence of an implementation-defined
way to differentiate, element markup (start tags, end tags, and
empty-element tags) creates token boundaries.</p>
<p>A sample tokenization is used for the examples in this document.
The results might be different for other tokenizations.</p>
<p>Tokenization enables functions and operators that operate on a
part or the root of the token (e.g., wildcards, stemming).</p>
<p>Tokenization enables functions and operators which work with the
relative positions of tokens (e.g., proximity operators).</p>
<p>This specification focuses on functionality that serves all
languages. It also selectively includes functionalities useful
within specific families of languages. For example, searching
within sentences and paragraphs is useful to many western languages
and to some non-western languages, so that functionality is
incorporated into this specification.</p>
<p>Certain aspects of language processing are described in this
specification as <b>implementation-defined</b> or
<b>implementation-dependent</b>.</p>
<ul>
<li>
<p>[<a name="dt-implementation-defined" id=
"dt-implementation-defined" title=
"implementation defined">Definition</a>:
<b>Implementation-defined</b> indicates an aspect that may differ
between implementations, but must be specified by the implementor
for each particular implementation.]</p>
</li>
<li>
<p>[<a name="dt-implementation-dependent" id=
"dt-implementation-dependent" title=
"implementation dependent">Definition</a>:
<b>Implementation-dependent</b> indicates an aspect that may differ
between implementations, is not specified by this or any W3C
specification, and is not required to be specified by the
implementor for any particular implementation.]</p>
</li>
</ul>
</div>
<div class="div2">
<h3><a name="tq-ft-organization" id="tq-ft-organization"></a>1.2
Organization of this document</h3>
<p>This document is organized as follows. We first present a
<a href="#tq-extensions">high level syntax</a> for the XQuery and
XPath Full Text 1.0 language along with some examples. Then, we
present the <a href="#ftselections">syntax and examples</a> of the
basic primitives in the XQuery and XPath Full Text 1.0 language.
This is followed by the <a href="#tq-semantics">semantics</a> of
the XQuery and XPath Full Text 1.0 language. The appendix contains
a section that provides an <a href="#id-xpath-grammar">EBNF for the
XPath 2.0 Grammar with Full-Text Extensions</a>, an <a href=
"#id-grammar">EBNF for XQuery 1.0 Grammar with Full-Text
Extensions</a>, <a href="#ft-acknowledgements">acknowledgements</a>
and a <a href="#ft-glossary">glossary</a>.</p>
</div>
<div class="div2">
<h3><a name="tq-ft-namespaces" id="tq-ft-namespaces"></a>1.3 A word
about namespaces</h3>
<p>Certain namespace prefixes are predeclared by XQuery 1.0 and, by
implication, by this specification, and bound to fixed namespace
URIs. These namespace prefixes are as follows:</p>
<ul>
<li>
<p><code>xml = http://www.w3.org/XML/1998/namespace</code></p>
</li>
<li>
<p><code>xs = http://www.w3.org/2001/XMLSchema</code></p>
</li>
<li>
<p><code>xsi = http://www.w3.org/2001/XMLSchema-instance</code></p>
</li>
<li>
<p><code>fn = http://www.w3.org/2005/xpath-functions</code></p>
</li>
<li>
<p><code>local =
http://www.w3.org/2005/xquery-local-functions</code></p>
</li>
</ul>
<p>In addition to the prefixes in the above list, this document
uses the prefix <code>err</code> to represent the namespace URI
<code>http://www.w3.org/2005/xqt-errors</code>, This namespace
prefix is not predeclared and its use in this document is not
normative. Error codes that are not defined in this document are
defined in other XQuery 1.0 and XPath 2.0 specifications,
particularly <a href="#xpath20">[XML Path Language (XPath) 2.0
(Second Edition)]</a> and <a href="#xpath-functions">[XQuery 1.0
and XPath 2.0 Functions and Operators (Second Edition)]</a>.</p>
<p>Finally, this document uses the prefix <code>fts</code> to
represent a namespace containing a number of functions used in this
document to describe the semantics of XQuery and XPath Full Text
functions. There is no requirement that these functions be
implemented, therefore no URI is associated with that prefix.</p>
</div>
</div>
<div class="div1">
<h2><a name="tq-extensions" id="tq-extensions"></a>2 Full-Text
Extensions to XQuery and XPath</h2>
<p>XQuery and XPath Full Text 1.0 extends the languages of XQuery
1.0 and XPath 2.0 in three ways. It:</p>
<ol class="enumar">
<li>
<p>Adds a new expression called FTContainsExpr;</p>
</li>
<li>
<p>Enhances the syntax of FLWOR expressions in XQuery 1.0 and
<code>for</code> expressions in XPath 2.0 with optional score
variables; and</p>
</li>
<li>
<p>Adds static context declarations for full-text match options to
the query prolog.</p>
</li>
</ol>
<p>Additionally, it extends the data model and processing models in
various ways.</p>
<div class="div2">
<h3><a name="processing-model" id="processing-model"></a>2.1
Processing Model</h3>
<p>A <a title="full-text contains expression" href=
"#dt-ftcontains">full-text contains expression</a> (<a href=
"#section-ftcontainsexpr"><b>2.2 Full-Text Contains
Expression</b></a>) is composed of several parts:</p>
<ol class="enumar">
<li>
<p>An XPath 2.0 or XQuery 1.0 expression (RangeExpr) that specifies
the sequence of items to be searched. [<a name="dt-search-context"
id="dt-search-context" title="search context">Definition</a>: Those
items are called the <b>search context</b>.]</p>
</li>
<li>
<p>The full-text selection to be applied (<a href=
"#ftselections"><b>3 Full-Text Selections</b></a>). <b>Full-text
selections</b> are, syntactically and semantically, fully
composable and contain:</p>
<ul>
<li>
<p>Required:</p>
<ul>
<li>
<p>Tokens and phrases for which a search is performed (<a href=
"#ftwords"><b>3.2 Search Tokens and Phrases</b></a>).</p>
</li>
</ul>
</li>
<li>
<p>Optional:</p>
<ul>
<li>
<p>Match options, such as indicators for case sensitivity and stop
words (<a href="#ftmatchoptions"><b>3.4 Match Options</b></a>);</p>
</li>
<li>
<p>Boolean full-text operators, that compose a full-text selection
from simpler full-text selections (<a href=
"#logical_ftoperators"><b>3.5 Logical Full-Text
Operators</b></a>);</p>
</li>
<li>
<p>Other full-text operators that are constraints on the positions
of matches, such as indicators for distance between tokens and for
the cardinality of matches (<a href="#ftposfilter"><b>3.6
Positional Filters</b></a> and <a href="#fttimes"><b>3.3
Cardinality Selection</b></a>); and</p>
</li>
<li>
<p>The weighting information. Each individual search term in a
full-text selection may be annotated with optional weight
information. This information may be used during the evaluation of
the full-text selections to calculate scoring, information that
quantifies the relevance of the result to the given search
criteria.</p>
</li>
</ul>
</li>
</ul>
</li>
<li>
<p>An optional XPath 2.0 or XQuery 1.0 expression (UnionExpr) that
specifies the set of nodes, descendents of the RangeExp, whose
contents must be ignored for the purpose of determining a match
during the search (<a href="#ftignoreoption"><b>3.7 Ignore
Option</b></a>).</p>
</li>
</ol>
<p>The results of the evaluation of the full-text selection
operators are instances of the AllMatches model, which complements
the XQuery Data Model (XDM) for processing full-text queries. An
AllMatches instance describes all possible solutions to the
full-text query for a given search context item. Each solution is
described by a Match instance. A Match instance contains the tokens
from the search context that must be included (described using
StringInclude instances which model the positive terms) and the
tokens from search context item that must be excluded (described
using StringExclude instances which model the negative terms). Each
negative or positive term is modeled as a tuple: the position of
the query token or phrase in the full-text selection, and a
TokenInfo structure that describes a set of tokens in the text
string which match the query token or phrase.</p>
<img src="images/ProcMod-XQueryFT.gif" alt=
"Processing Model Extensions" />
<p>Figure 1 provides a schematic overview of the XQuery and XPath
Full Text 1.0 processing steps that are discussed in detail below.
Some of these steps are completely outside the domain of XQuery; in
Figure 1, these are depicted outside the black line that represents
the boundaries of the language. The diagram only shows the central
pieces of the XQuery Processing Model (see <a href=
"http://www.w3.org/TR/xquery/#id-processing-model">Section 2.2
Processing Model</a><sup><small>XQ</small></sup>), however zooms in
on the Execution Engine where the processing of the full-text
extensions takes place. The full-text processing steps are labeled
as FTn within the diagram and are referenced within the text.</p>
<p>Like all XQuery expressions, an FTContainsExpr returns an XDM
Instance (see Fig. 1). With the exception of FTWords, which
consumes TokenInfos, all full-text selections are closed under the
AllMatches data model, i.e., their input and output are AllMatches
instances. Tokenization transforms an XDM instance into TokenInfos,
which ultimately get converted into AllMatches instances by the
evaluation of full-text selections. Thus, the evaluation of nested
full-text and XQuery expressions instances moves back and forth
between these two models.</p>
<p>The resulting AllMatches instance obtained by the evaluation of
an FTContainsExpr is converted into a Boolean value before being
returned to the enclosing XPath or XQuery operation as follows. If
at least one member of the disjunction contains only positive terms
then value returned is true. If all members of the disjunction
contain negative terms the result is false.</p>
<p>Weighting information, in an <a title="implementation dependent"
href="#dt-implementation-dependent">implementation-dependent</a>
fashion, may be used when calculating the scoring information
computed and made available by FTContainsExpr to the optional score
construct.</p>
<p>Given the components of a given full-text contains expression,
the evaluation algorithm will proceed according to the following
steps, also referenced in the processing model diagram as steps
FT<em>n</em> (see Fig. 1):</p>
<ol class="enumar">
<li>
<p>Evaluate the search context expression (resulting in the
sequence of search context items), the ignore option, if any
(resulting in the set of ignored nodes), and any other XQuery/XPath
exprssions nested within the full-text contains expression.
(FT1)</p>
</li>
<li>
<p>Tokenize the query string(s). (FT2.1)</p>
</li>
<li>
<p>For each search context item:</p>
<ol class="enumla">
<li>
<p>Delete the ignored nodes from the search context item.</p>
</li>
<li>
<p>Tokenize the result of the previous step. This produces a
sequence of tokens. (FT2.2) Note that implementations may (as an
optimization) perform tokenization as part of the External
Processing that is described in the XQuery Processing Model, when
an XML document is parsed into an Infoset/PSVI and ultimately into
a XQuery Data Model instance.</p>
</li>
<li>
<p>Evaluate the FTSelection against the tokens of the search
context. (FT3, FT4)</p>
</li>
</ol>
</li>
<li>
<p>Convert the topmost AllMatches instances into a Boolean value.
(FT5)</p>
<p>The additional scoring information (also part of FT5) that is
produced by the evaluation of the full-text contains expression is
<a title="implementation dependent" href=
"#dt-implementation-dependent">implementation-dependent</a> and is
not specified in this document. The scoring information is made
available at the same time the Boolean value is returned.</p>
</li>
</ol>
<p>(A more detailed version of the above procedure appears in
Section <a href="#FTContainsSec"><b>4.3
FTContainsExpr</b></a>.)</p>
<p>Section <a href="#ftselections"><b>3 Full-Text
Selections</b></a> describes the syntax and the informal semantics
of full-text operators. Their formal semantics as well as the
formal definition of the AllMatches data model are given in Section
<a href="#tq-semantics"><b>4 Semantics</b></a>.</p>
</div>
<div class="div2">
<h3><a name="section-ftcontainsexpr" id=
"section-ftcontainsexpr"></a>2.2 Full-Text Contains Expression</h3>
<p>[<a name="dt-ftcontains" id="dt-ftcontains" title=
"full-text contains expression">Definition</a>: A <b>full-text
contains expression</b> is a expression that evaluates a sequence
of items against a full-text selection. ]</p>
<p>As a syntactic construct, a full-text contains expression
(grammar symbol: <a href=
"#doc-xquery10-FTContainsExpr">FTContainsExpr</a>) behaves like a
comparison expression (see <a href=
"http://www.w3.org/TR/xquery/#id-general-comparisons">Section 3.5.2
General Comparisons</a><sup><small>XQ</small></sup>). This grammar
rule introduces <a href=
"#doc-xquery10-FTContainsExpr">FTContainsExpr</a>.</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="noid_d4e645.doc-xquery10-ComparisonExpr" id=
"noid_d4e645.doc-xquery10-ComparisonExpr"></a>[50]&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-ComparisonExpr">ComparisonExpr</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTContainsExpr">FTContainsExpr</a>
( (<a href="#prod-xquery10-ValueComp">ValueComp</a><br />
| <a href="#prod-xquery10-GeneralComp">GeneralComp</a><br />
| <a href="#prod-xquery10-NodeComp">NodeComp</a>) <a href=
"#doc-xquery10-FTContainsExpr">FTContainsExpr</a> )?</code></td>
</tr>
</tbody>
</table>
<p>A full-text contains expression may be used anywhere a
ComparisonExpr may be used. The <code>contains text</code> operator
has higher precedence than other comparison operators, so the
results of <code>contains text</code> expressions may be compared
without enclosing them in parentheses.</p>
<div class="div3">
<h4><a name="section-ftcontainsexpr-description" id=
"section-ftcontainsexpr-description"></a>2.2.1 Description</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTContainsExpr" id=
"doc-xquery10-FTContainsExpr"></a>[51]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTContainsExpr"></a><a href=
"#prod-xquery10-FTContainsExpr">FTContainsExpr</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-RangeExpr">RangeExpr</a> (
"contains" "text" <a href=
"#doc-xquery10-FTSelection">FTSelection</a> <a href=
"#doc-xquery10-FTIgnoreOption">FTIgnoreOption</a>? )?</code></td>
</tr>
</tbody>
</table>
<p>A full-text contains expression returns a Boolean value. It
returns true if there is some item returned by the RangeExpr that,
after <a href="#TokenizationSec">tokenization</a>, matches the
full-text selection <a href=
"#doc-xquery10-FTSelection">FTSelection</a>. Since tokenization
includes tokens derived only from the string values of items, a
full-text contains expression searches the text of element nodes
and of their descendant elements. The string value of other kinds
of nodes, such as attributes and comments, will not be included
unless the attribute or comment node itself is the target
(RangeExpr) of the full-text contains expression. See Section
<a href="#ftselections"><b>3 Full-Text Selections</b></a> for more
details. For the purpose of determining a match, certain
descendants of nodes (identified by <a href=
"#doc-xquery10-FTIgnoreOption">FTIgnoreOption</a>) in the RangeExpr
may be ignored, as specified in Section <a href=
"#ftignoreoption"><b>3.7 Ignore Option</b></a>.</p>
<p>An XQuery and XPath Full Text 1.0 processor <a title="should"
href="#should">SHOULD</a> try to use the information available in
xml:lang for processing of collations, as well as the various match
options defined in Section <a href="#ftmatchoptions"><b>3.4 Match
Options</b></a>.</p>
</div>
<div class="div3">
<h4><a name="section-ftcontainsexpr-examples" id=
"section-ftcontainsexpr-examples"></a>2.2.2 Examples</h4>
<p>The following example in XQuery 1.0 Full Text returns the author
of each book with a title containing a token with the same root as
<code>dog</code> and the token <code>cat</code>.</p>
<div class="xquery">
<div class="exampleInner">
<pre>
for $b in /books/book
where $b/title contains text ("dog" using stemming) ftand "cat" 
return $b/author
</pre></div>
</div>
<p>The same example in XPath 2.0 Full Text is written as:</p>
<div class="xpath">
<div class="exampleInner">
<pre>

/books/book[title contains text ("dog" using stemming) ftand "cat"]/author
</pre></div>
</div>
<p>In the next example a ComparisonExpr is combined with an
FTContainsExpr using the logical XQuery operator <code>and</code>.
The query selects books that have a price of less than 50 and a
title which contains a token with the same root as
<code>train</code>:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
/books/book[price &lt; 50 and title contains text ("train" using stemming)]
</pre></div>
</div>
<p>The following example shows the combination of two
<code>contains text</code> expressions the results of which are
compared using the not-equals operator. The query selects books
where either the title contains the token <code>dog</code> and the
token <code>cat</code> and the content does not contain a token
with the same root as <code>train</code>, or where the title fails
to have one of the matching tokens but the content does:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
/books/book[title contains text "dog" ftand "cat" ne
            content contains text ("train" using stemming)]
</pre></div>
</div>
</div>
</div>
<div class="div2">
<h3><a name="section-score-variables" id=
"section-score-variables"></a>2.3 Score Variables</h3>
<p>Besides specifying a match of a full-text query as a Boolean
condition, full-text query applications typically also have the
ability to associate scores with the results. [<a name="Score" id=
"Score" title="Score">Definition</a>: The <b>score</b> of a
full-text query result expresses its relevance to the search
conditions.]</p>
<p>XQuery and XPath Full Text 1.0 extends the languages of XQuery
1.0 and XPath 2.0 further by adding optional <code>score</code>
variables to the <code>for</code> and <code>let</code> clauses of
FLWOR expressions.</p>
<p>The production for the extended <code>for</code> clause in
XQuery 1.0 follows.</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-ForClause" id=
"doc-xquery10-ForClause"></a>[35]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-ForClause"></a><a href=
"#prod-xquery10-ForClause">ForClause</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"for" "$" <a href="#prod-xquery10-VarName">VarName</a>
<a href="#prod-xquery10-TypeDeclaration">TypeDeclaration</a>?
<a href="#prod-xquery10-PositionalVar">PositionalVar</a>? <a href=
"#doc-xquery10-FTScoreVar">FTScoreVar</a>? "in" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a> ("," "$" <a href=
"#prod-xquery10-VarName">VarName</a> <a href=
"#prod-xquery10-TypeDeclaration">TypeDeclaration</a>? <a href=
"#prod-xquery10-PositionalVar">PositionalVar</a>? <a href=
"#doc-xquery10-FTScoreVar">FTScoreVar</a>? "in" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTScoreVar" id=
"doc-xquery10-FTScoreVar"></a>[37]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTScoreVar"></a><a href=
"#prod-xquery10-FTScoreVar">FTScoreVar</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"score" "$" <a href=
"#prod-xquery10-VarName">VarName</a></code></td>
</tr>
</tbody>
</table>
<p>In XPath 2.0, the SimpleForClause is extended similarly.</p>
<p>When a <code>score</code> variable is present in a
<code>for</code> clause the evaluation of the expression following
the <code>in</code> keyword not only needs to determine the result
sequence of the expression, i.e., the sequence of items which are
iteratively bound to the <code>for</code> variable. It must also
determine in each iteration the relevance "score" value of the
current item and bind the <code>score</code> variable to that
value.</p>
<p>The scope of a score variable bound in a for or let clause
comprises all subexpressions of the containing FLWOR expression
that appear after the variable binding. The scope does not include
the expression to which the variable is bound. The for and let
clauses of a given FLWOR expression may bind the same score
variable name more than once. In this case, each new binding
occludes the previous one, which becomes inaccessible in the
remainder of the FLWOR expression.</p>
<p>The expanded QName of a score variable bound in a for clause
must be distinct from both the expanded QName of the variable with
which it is associated and the expanded QName of any positional
variable with which it is associated [<a href=
"http://www.w3.org/TR/xquery/#ERRXQST0089" title=
"err:XQST0089">err:XQST0089</a>]<sup><small>XQ</small></sup>.</p>
<p>The semantics of scoring and how it relates to second-order
functions is discussed in Section <a href="#ScoreSec"><b>4.4
Scoring</b></a>.</p>
<p>In the following example <code>book</code> elements are
determined that satisfy the condition <code>[content contains text
"web site" ftand "usability" and .//chapter/title contains text
"testing"]</code>. The scores assigned to the <code>book</code>
elements are returned.</p>
<div class="xquery">
<div class="exampleInner">
<pre>
for $b score $s 
    in /books/book[content contains text "web site" ftand "usability" 
                   and .//chapter/title contains text "testing"]
return $s
</pre></div>
</div>
<p>The example above is also a valid example of the XPath 2.0
extension.</p>
<p>Scores are typically used to order results, as in the following,
more complete example.</p>
<div class="xquery">
<div class="exampleInner">
<pre>
for $b score $s 
    in /books/book[content contains text "web site" ftand "usability"]
where $s &gt; 0.5
order by $s descending
return &lt;result&gt;  
          &lt;title&gt; {$b//title} &lt;/title&gt; 
          &lt;score&gt; {$s} &lt;/score&gt; 
       &lt;/result&gt;
</pre></div>
</div>
<p>Note that the score variable gets <em>one</em> score value for
each item in the value of the expression after the <code>in</code>
keyword, regardless of the number of FTContainsExprs in that
expression. In the following example, two separate full-text
contains expressions are used to select the matching paragraphs.
There is still just one score for each <code>para</code> returned.
The highest scoring paragraphs will be returned first:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
for $p score $s in 
  //book[title contains text "software"]/para[. contains text "usability"]
     order by $s descending
  return $p
</pre></div>
</div>
<p>The following more elaborate example uses multiple score
variables to return the matching paragraphs ordered so that those
from the highest scoring books precede those from the lowest
scoring books, where the highest scoring paragraphs of each book
are returned before the lower scoring paragraphs of that book:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
for $b score $score1 in //book[title contains text "software"]
    order by $score1 descending
return
    for $p score $score2 in $b/para[. contains text "usability"]
       order by $score2 descending
    return $p
</pre></div>
</div>
<p>The <code>score</code> variable is bound to a value which
reflects the relevance of the match criteria in the full-text
selections to the items returned by the respective RangeExprs. The
calculation of relevance is <a title="implementation dependent"
href="#dt-implementation-dependent">implementation-dependent</a>,
but score evaluation must follow these rules:</p>
<ol class="enumar">
<li>
<p>Score values are of type <code>xs:double</code> in the range [0,
1].</p>
</li>
<li>
<p>For score values greater than 0, a higher score must imply a
higher degree of relevance</p>
</li>
</ol>
<p>Similarly to their use in a <code>for</code> clause, score
variables may be specified in a <code>let</code> clause. A score
variable in a <code>let</code> clause is also bound to the score of
the expression evaluation, but in the <code>let</code> clause one
score is determined for the complete result.</p>
<p>The production for the extended <code>let</code> clause
follows.</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-LetClause" id=
"doc-xquery10-LetClause"></a>[38]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-LetClause"></a><a href=
"#prod-xquery10-LetClause">LetClause</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"let" (("$" <a href="#prod-xquery10-VarName">VarName</a>
<a href="#prod-xquery10-TypeDeclaration">TypeDeclaration</a>?) |
<a href="#doc-xquery10-FTScoreVar">FTScoreVar</a>) ":=" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a> ("," (("$" <a href=
"#prod-xquery10-VarName">VarName</a> <a href=
"#prod-xquery10-TypeDeclaration">TypeDeclaration</a>?) | <a href=
"#doc-xquery10-FTScoreVar">FTScoreVar</a>) ":=" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a>)*</code></td>
</tr>
</tbody>
</table>
<p>When using the score option in a <code>for</code> clause the
expression following the <code>in</code> keyword has the dual
purpose of filtering, i.e., driving the iteration, and determining
the scores. It is possible to separately specify expressions for
filtering and scoring by combining a simple <code>for</code> clause
with a <code>let</code> clause that uses scoring. The following is
an example of this.</p>
<div class="xquery">
<div class="exampleInner">
<pre>
for $b in /books/book[.//chapter/title contains text "testing"]
let score $s := $b/content contains text "web site" ftand "usability" 
order by $s descending
return &lt;result score="{$s}"&gt;{$b}&lt;/result&gt;
</pre></div>
</div>
<p>This example returns <code>book</code> elements with chapter
titles that contain "testing". Along with the <code>book</code>
elements scores are returned. These scores, however, reflect
whether the book content contains "web site" and "usability".</p>
<p>Note that it is not a requirement of the score of an
FTContainsExpr to be 0, if the expression evaluates to false, nor
to be non-zero, if the expression evaluates to true. Hence, in the
example above it is not possible to infer the Boolean value of the
FTContainsExpr in the <code>let</code> clause from the calculated
score of a returned <code>result</code> element. For instance, an
implementation may want to assign a non-zero score to a book that
contained "web site", but not "usability", as this may be
considered more relevant than a book that does not contain "web
site" or "usability".</p>
<p>The expression ExprSingle associated with the score variable is
passed to the scoring algorithm. The scoring algorithm calculates
the score value based on the passed expression (not on the value
returned by evaluating the expression). The set of expressions
supported by the scoring algorithm is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. If an
expression not supported by the scoring algorithm is passed to the
scoring algorithm, the result is implementation-defined.</p>
<p>The use of <code>score</code> variables introduces a
second-order aspect to the evaluation of expressions which cannot
be emulated by (first-order) XQuery functions. Consider the
following replacement of the clause <code>let score $s :=
FTContainsExpr</code></p>
<div class="exampleInner">
<pre>
let $s := score(FTContainsExpr)
</pre></div>
<p>where a function <code>score</code> is applied to some
FTContainsExpr. If the function <code>score</code> were
first-order, it would only be applied to the result of the
evaluation of its argument, which is one of the Boolean constants
<code>true</code> or <code>false</code>. Hence, there would be at
most two possible values such a <code>score</code> function would
be able to return and no further differentiation would be
possible.</p>
<div class="div3">
<h4><a name="section-using-weights" id=
"section-using-weights"></a>2.3.1 Using Weights Within a Scored
FTContainsExpr</h4>
<p>[<a name="WeightDeclarationsDef" id="WeightDeclarationsDef"
title="WeightDeclarations">Definition</a>: Scoring may be
influenced by adding <b>weight declarations</b> to search tokens,
phrases, and expressions.] Weight declarations are introduced
syntactically in the FTPrimaryWithOptions production, described in
Section <a href="#ftweight"><b>3.1.1 Weights</b></a>.</p>
<p>The weights assigned are not related to any absolute standard,
but typically have a relationship to other weights within the same
FTContains expression.</p>
<p>The effect of weights on the resulting score is <a title=
"implementation dependent" href=
"#dt-implementation-dependent">implementation-dependent</a>.
However, scoring algorithms <a title="must" href="#must">MUST</a>
conform to the constraint 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>that
when no explicit weight is specified, the default weight is
1.0.</span></p>
<p>The following example illustrates how different weights can be
used for different search terms.</p>
<div class="xquery">
<div class="exampleInner">
<pre>
for $b in /books/book
let score $s := $b/content contains text ("web site" weight {0.5})
                                ftand ("usability" weight {2})
return &lt;result score="{$s}"&gt;{$b}&lt;/result&gt;
</pre></div>
</div>
</div>
</div>
<div class="div2">
<h3><a name="section-extensions-static-context" id=
"section-extensions-static-context"></a>2.4 Extensions to the
Static Context</h3>
<p>The XQuery Static Context is extended with a component for each
full-text <a title="match option group" href=
"#dt-match-option-group">match option group</a>. The settings of
these components can be changed by using the following declaration
syntax in the Prolog.</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-Prolog" id=
"doc-xquery10-Prolog"></a>[6]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Prolog"></a><a href=
"#prod-xquery10-Prolog">Prolog</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>((<a href=
"#prod-xquery10-DefaultNamespaceDecl">DefaultNamespaceDecl</a> |
<a href="#prod-xquery10-Setter">Setter</a> | <a href=
"#prod-xquery10-NamespaceDecl">NamespaceDecl</a> | <a href=
"#prod-xquery10-Import">Import</a> | <a href=
"#doc-xquery10-FTOptionDecl">FTOptionDecl</a>) <a href=
"#prod-xquery10-Separator">Separator</a>)* ((<a href=
"#prod-xquery10-VarDecl">VarDecl</a> | <a href=
"#prod-xquery10-FunctionDecl">FunctionDecl</a> | <a href=
"#prod-xquery10-OptionDecl">OptionDecl</a>) <a href=
"#prod-xquery10-Separator">Separator</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTOptionDecl" id=
"doc-xquery10-FTOptionDecl"></a>[24]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTOptionDecl"></a><a href=
"#prod-xquery10-FTOptionDecl">FTOptionDecl</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "ft-option" <a href=
"#doc-xquery10-FTMatchOptions">FTMatchOptions</a></code></td>
</tr>
</tbody>
</table>
<p>Match options modify the match semantics of full-text
expressions. They are described in detail in Section <a href=
"#ftmatchoptions"><b>3.4 Match Options</b></a>. When a match option
is specified explicitly in a full-text expression, it overrides the
setting of the respective component in the static context.</p>
</div>
</div>
<div class="div1">
<h2><a name="ftselections" id="ftselections"></a>3 Full-Text
Selections</h2>
<p>This section describes the full-text selections which contain
the full-text operators in a <a title=
"full-text contains expression" href="#dt-ftcontains">full-text
contains expression</a> (<a href=
"#doc-xquery10-FTContainsExpr">FTContainsExpr</a>), as well as the
match options which modify the matching semantics of the full-text
selections. In the following, the syntax for each type of full-text
selection is given together with an informal statement of its
meaning.</p>
<p>[<a name="ftselection" id="ftselection" title=
"full-text selection">Definition</a>: A <b>full-text selection</b>
specifies the conditions of a full-text search. ]</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTSelection" id=
"doc-xquery10-FTSelection"></a>[144]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTSelection"></a><a href=
"#prod-xquery10-FTSelection">FTSelection</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTOr">FTOr</a> <a href=
"#doc-xquery10-FTPosFilter">FTPosFilter</a>*</code></td>
</tr>
</tbody>
</table>
<p>As shown in the grammar, a full-text selection consists of
search conditions possibly involving logical operators (<a href=
"#doc-xquery10-FTOr">FTOr</a>), followed by an arbitrary number of
positional filters (<a href=
"#doc-xquery10-FTPosFilter">FTPosFilter</a>).</p>
<p>The syntax and semantics of the individual full-text selection
operators follow.</p>
<p>This XML document is the source document for examples in this
section.</p>
<div class="exampleInner">
<pre>
&lt;books&gt;
  &lt;book number="1"&gt;
    &lt;title shortTitle="Improving Web Site Usability"&gt;Improving  
        the Usability of a Web Site Through Expert Reviews and
        Usability Testing&lt;/title&gt;
    &lt;author&gt;Millicent Marigold&lt;/author&gt;
    &lt;author&gt;Montana Marigold&lt;/author&gt;
    &lt;editor&gt;Véra Tudor-Medina&lt;/editor&gt;
    &lt;content&gt;
      &lt;p&gt;The usability of a Web site is how well the  
          site supports the users in achieving specified  
          goals. A Web site should facilitate learning,  
          and enable efficient and effective task  
          completion, while propagating few errors.
      &lt;/p&gt;
      &lt;note&gt;This book has been approved by the Web Site  
          Users Association.
      &lt;/note&gt;
    &lt;/content&gt;
  &lt;/book&gt;
&lt;/books&gt;
</pre></div>
<p>Tokenization is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. A sample
tokenization is used for the examples in this section. This sample
tokenization uses white space, punctuation and XML tags as
word-breakers
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>,
periods followed by a space as sentence boundaries,</span> and
<code>&lt;p&gt;</code> for paragraph boundaries. 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>The
first sentence and paragraph start at the beginning of the
document, and the last sentence and paragraph end at the end of the
document.</span> The results may be different for other
tokenizations.</p>
<p>The first five tokens in this example using the sample
tokenization would be "Improving", "the", "usability", "of", and
"a".</p>
<p>Unless stated otherwise, the results assume a case-insensitive
match.</p>
<div class="div2">
<h3><a name="ftprimary" id="ftprimary"></a>3.1 Primary Full-Text
Selections</h3>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTPrimary" id=
"doc-xquery10-FTPrimary"></a>[151]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTPrimary"></a><a href=
"#prod-xquery10-FTPrimary">FTPrimary</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#doc-xquery10-FTWords">FTWords</a> <a href=
"#doc-xquery10-FTTimes">FTTimes</a>?) | ("(" <a href=
"#doc-xquery10-FTSelection">FTSelection</a> ")") | <a href=
"#doc-xquery10-FTExtensionSelection">FTExtensionSelection</a></code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ftprimary" id="dt-ftprimary" title=
"primary full-text selection">Definition</a>: A <b>primary
full-text selection</b> is the basic form of a full-text selection.
It specifies tokens and phrases as search conditions (<a href=
"#doc-xquery10-FTWords">FTWords</a>), optionally followed by a
cardinality constraint (<a href=
"#doc-xquery10-FTTimes">FTTimes</a>). An <a href=
"#doc-xquery10-FTSelection">FTSelection</a> in parentheses and the
<a href=
"#doc-xquery10-FTExtensionSelection">FTExtensionSelection</a> are
also a primary full-text selections.]</p>
<div class="div3">
<h4><a name="ftweight" id="ftweight"></a>3.1.1 Weights</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="noid_d4e1070.doc-xquery10-FTPrimaryWithOptions" id=
"noid_d4e1070.doc-xquery10-FTPrimaryWithOptions"></a>[150]&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-FTPrimaryWithOptions">FTPrimaryWithOptions</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTPrimary">FTPrimary</a> <a href=
"#doc-xquery10-FTMatchOptions">FTMatchOptions</a>? <a href=
"#doc-xquery10-FTWeight">FTWeight</a>?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTWeight" id=
"doc-xquery10-FTWeight"></a>[145]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTWeight"></a><a href=
"#prod-xquery10-FTWeight">FTWeight</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"weight" "{" <a href="#prod-xquery10-Expr">Expr</a>
"}"</code></td>
</tr>
</tbody>
</table>
<p>As shown in the grammar, a full-text primary selection may be
optionally followed by match options (which are discussed in
<a href="#ftmatchoptions"><b>3.4 Match Options</b></a>) and by a
"weight" value that is specified using an expression enclosed in
braces. The Expr is evaluated as if it were an argument to a
function with an expected type <code>xs:double</code>. The weight
<a title="must" href="#must">MUST</a> have an absolute value
between 0.0 and 1000.0 inclusive. If the absolute value of the
weight is greater than 1000.0, an error is raised: [<a href=
"#ERRFTDY0016" title="err:FTDY0016">err:FTDY0016</a>].</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>As a consequence of the flexibility given to implementations
under <a href=
"http://www.w3.org/TR/xquery/#id-errors-and-opt">Section 2.3.4
Errors and Optimization</a><sup><small>XQ</small></sup>, it is
possible that evaluation of weight declarations in an
FTContainsExpr for which no scores are evaluated may be skipped by
the implementation and errors with them may go unreported.</p>
</div>
</div>
</div>
<div class="div2">
<h3><a name="ftwords" id="ftwords"></a>3.2 Search Tokens and
Phrases</h3>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTWords" id=
"doc-xquery10-FTWords"></a>[152]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTWords"></a><a href=
"#prod-xquery10-FTWords">FTWords</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTWordsValue">FTWordsValue</a>
<a href=
"#doc-xquery10-FTAnyallOption">FTAnyallOption</a>?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTWordsValue" id=
"doc-xquery10-FTWordsValue"></a>[153]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTWordsValue"></a><a href=
"#prod-xquery10-FTWordsValue">FTWordsValue</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-StringLiteral">StringLiteral</a>
| ("{" <a href="#prod-xquery10-Expr">Expr</a> "}")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTAnyallOption" id=
"doc-xquery10-FTAnyallOption"></a>[155]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTAnyallOption"></a><a href=
"#prod-xquery10-FTAnyallOption">FTAnyallOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("any" "word"?) | ("all" "words"?) | "phrase"</code></td>
</tr>
</tbody>
</table>
<p><a href="#doc-xquery10-FTWords">FTWords</a> finds matches that
contain the specified tokens and phrases.</p>
<p>FTWords consists of two parts: a mandatory <a href=
"#doc-xquery10-FTWordsValue">FTWordsValue</a> part and an optional
<a href="#doc-xquery10-FTAnyallOption">FTAnyallOption</a> part.
<a href="#doc-xquery10-FTWordsValue">FTWordsValue</a> specifies the
tokens and phrases that must be contained in the matches. <a href=
"#doc-xquery10-FTAnyallOption">FTAnyallOption</a> specifies how
containment is checked.</p>
<p>In general, the tokens and phrases in <a href=
"#doc-xquery10-FTWordsValue">FTWordsValue</a> are specified using a
nested XQuery expression. To simplify notation, the enclosing
braces may be omitted if <a href=
"#doc-xquery10-FTWordsValue">FTWordsValue</a> consists of a single 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>string</span>
literal.</p>
<p>The following rules specify how an <a href=
"#doc-xquery10-FTWordsValue">FTWordsValue</a> matches tokens and
phrases. First, the <a href=
"#doc-xquery10-FTWordsValue">FTWordsValue</a> is converted to a
sequence of strings as though it were an argument to a function
with the expected type of <code>xs:string*</code>. If the sequence
is empty, the FTWords yields no matches. Otherwise, each of those
strings is tokenized into a sequence of tokens as described in
<a href="#TokenizationSec">Section 4.1 Tokenization</a>. Then,
<a href="#doc-xquery10-FTAnyallOption">FTAnyallOption</a> is
checked.</p>
<p>If <a href="#doc-xquery10-FTAnyallOption">FTAnyallOption</a> is
"any", the sequence of tokens for each string is considered as a
phrase. If the sequence of tokens is empty, then the phrase
contributes nothing to the set of matches for the FTWords.
Otherwise, a match is found in the tokenized form of the text being
searched, whenever that form contains a subsequence of tokens that
corresponds to the sequence of query tokens in an
implementation-defined way and that subsequence of tokens covers
consecutive token positions in the tokenized text. If the value of
the FTWordsValue contains more than one string, the different
strings are considered to be alternatives, i.e., the search context
must contain at least one of the generated phrases. Each resulting
match will contain exactly one such phrase.</p>
<p>If <a href="#doc-xquery10-FTAnyallOption">FTAnyallOption</a> is
"all", the sequence of tokens for each string is considered as a
phrase. If any such sequence of tokens is empty, the FTWords yields
no matches. The resulting matches must contain all of the generated
phrases.</p>
<p>If <a href="#doc-xquery10-FTAnyallOption">FTAnyallOption</a> is
"phrase", the tokens from all the strings are concatenated in a
single sequence, which is considered as a phrase. If the sequence
of tokens is empty, the FTWords yields no matches. The resulting
matches must contain the generated phrase.</p>
<p>If <a href="#doc-xquery10-FTAnyallOption">FTAnyallOption</a> is
"any word", the tokens from all the strings are combined into a
single set. If the set is empty, the FTWords yields no matches. The
search context must contain at least one of the tokens in the set.
Each resulting match will contain exactly one such token.</p>
<p>If <a href="#doc-xquery10-FTAnyallOption">FTAnyallOption</a> is
"all words", the tokens from all the strings are combined into a
single set. If the set is empty, the FTWords yields no matches. The
resulting matches must contain all of the tokens in the set.</p>
<p>If the <a href="#doc-xquery10-FTWordsValue">FTWordsValue</a>
evaluates to a single string, the use of "any", "all", and "phrase"
in <a href="#doc-xquery10-FTAnyallOption">FTAnyallOption</a>
produces the same results.</p>
<p>If <a href="#doc-xquery10-FTAnyallOption">FTAnyallOption</a> is
omitted, "any" is the default.</p>
<p>The following expression returns the sample <code>book</code>
element, because its <code>title</code> element contains the token
"Expert":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[./title contains text "Expert"]
</pre></div>
</div>
<p>The following expression returns the sample <code>book</code>
element, because its <code>title</code> element contains the phrase
"Expert Reviews":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[./title contains text "Expert Reviews"]
</pre></div>
</div>
<p>The following expression returns the sample <code>book</code>
element, because its <code>title</code> element contains the two
tokens "Expert" and "Reviews":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[./title contains text {"Expert", "Reviews"} all]
</pre></div>
</div>
<p>The following expression returns false for our sample document,
because the <code>p</code> element doesn't contain the phrase "Web
Site Usability" although it contains all of the tokens in the
phrase:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book//p contains text "Web Site Usability"
</pre></div>
</div>
<p>The following expression returns book numbers of
<code>book</code> elements by "Marigold" with a title about "Web
Site Usability", sorting them in descending score order:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
for $book in /books/book[.//author contains text "Marigold"] 
let score $score := $book/title/@shortTitle contains text "Web Site Usability" 
where $score &gt; 0.8 
order by $score descending
return $book/@number
</pre></div>
</div>
</div>
<div class="div2">
<h3><a name="fttimes" id="fttimes"></a>3.3 Cardinality
Selection</h3>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTTimes" id=
"doc-xquery10-FTTimes"></a>[156]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTTimes"></a><a href=
"#prod-xquery10-FTTimes">FTTimes</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"occurs" <a href="#doc-xquery10-FTRange">FTRange</a>
"times"</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-cardinality-selection" id=
"dt-cardinality-selection" title=
"cardinality selection">Definition</a>: A <b>cardinality
selection</b> consist of an <a href=
"#doc-xquery10-FTWords">FTWords</a> followed by the <a href=
"#doc-xquery10-FTTimes">FTTimes</a> postfix operator.] A
cardinality selection selects matches for which the operand
<a href="#doc-xquery10-FTWords">FTWords</a> is matched a specified
number of times.</p>
<p>A cardinality selection limits the number of different matches
of <a href="#doc-xquery10-FTWords">FTWords</a> within the specified
range. The semantics of FTRange are described in <a href=
"#ftdistance"><b>3.6.3 Distance Selection</b></a>.</p>
<p>In the document fragment "very very big":</p>
<ol class="enumar">
<li>
<p>The <a href="#doc-xquery10-FTWords">FTWords</a> <code>"very
big"</code> has 1 match consisting of the second "very" and
"big".</p>
</li>
<li>
<p>The <a href="#doc-xquery10-FTWords">FTWords</a> <code>{"very",
"big"} all</code> has 2 matches; one consisting of the first "very"
and "big", and the other containing the second "very" and
"big".</p>
</li>
<li>
<p>The <a href="#doc-xquery10-FTWords">FTWords</a> <code>{"very",
"big"} any</code> has 3 matches.</p>
</li>
</ol>
<p>The following expression returns the example <code>book</code>
element's number, because the <code>book</code> element contains 2
or more occurrences of "usability":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[. contains text "usability" occurs at least 2 times]/@number
</pre></div>
</div>
<p>The following expression returns the empty sequence, because
there are 3 occurrences of <code>{"usability", "testing"}
any</code> in the designated <code>title</code>:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1" and title contains text {"usability", 
"testing"} any occurs at most 2 times] 
</pre></div>
</div>
</div>
<div class="div2">
<h3><a name="ftmatchoptions" id="ftmatchoptions"></a>3.4 Match
Options</h3>
<p>Full-text match options modify the matching behaviour of the
<a title="primary full-text selection" href="#dt-ftprimary">primary
full-text selection</a> to which they are applied.</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTPrimaryWithOptions" id=
"doc-xquery10-FTPrimaryWithOptions"></a>[150]&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-FTPrimaryWithOptions"></a><a href="#prod-xquery10-FTPrimaryWithOptions">FTPrimaryWithOptions</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTPrimary">FTPrimary</a> <a href=
"#doc-xquery10-FTMatchOptions">FTMatchOptions</a>? <a href=
"#doc-xquery10-FTWeight">FTWeight</a>?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTMatchOptions" id=
"doc-xquery10-FTMatchOptions"></a>[166]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTMatchOptions"></a><a href=
"#prod-xquery10-FTMatchOptions">FTMatchOptions</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("using" <a href=
"#doc-xquery10-FTMatchOption">FTMatchOption</a>)+</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTMatchOption" id=
"doc-xquery10-FTMatchOption"></a>[167]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTMatchOption"></a><a href=
"#prod-xquery10-FTMatchOption">FTMatchOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#doc-xquery10-FTLanguageOption">FTLanguageOption</a><br />
| <a href=
"#doc-xquery10-FTWildCardOption">FTWildCardOption</a><br />
| <a href=
"#doc-xquery10-FTThesaurusOption">FTThesaurusOption</a><br />
| <a href="#doc-xquery10-FTStemOption">FTStemOption</a><br />
| <a href="#doc-xquery10-FTCaseOption">FTCaseOption</a><br />
| <a href=
"#doc-xquery10-FTDiacriticsOption">FTDiacriticsOption</a><br />
| <a href=
"#doc-xquery10-FTStopWordOption">FTStopWordOption</a><br />
| <a href=
"#doc-xquery10-FTExtensionOption">FTExtensionOption</a></code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-match-options" id="dt-match-options" title=
"match option">Definition</a>: <b>Match options</b> modify the set
of tokens in the query, or how they are matched against tokens in
the text.]</p>
<p>[<a name="dt-match-option-group" id="dt-match-option-group"
title="match option group">Definition</a>: Each of the alternatives
of production <a href=
"#doc-xquery10-FTMatchOption">FTMatchOption</a> 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>other
than <a href=
"#doc-xquery10-FTExtensionOption">FTExtensionOption</a></span>
corresponds to one <b>match option group</b>. ] The match options
from any given group are mutually exclusive, i.e., only one of
these settings can be in effect, whereas match options of different
groups can be combined freely.</p>
<p>It is a static error [<a href="#ERRFTST0019" title=
"err:FTST0019">err:FTST0019</a>] if, within a single <a href=
"#doc-xquery10-FTMatchOptions">FTMatchOptions</a>, there is more
than one match option of any given <a title="match option group"
href="#dt-match-option-group">match option group</a>. For example,
if the <a href="#doc-xquery10-FTCaseOption">FTCaseOption</a>
"lowercase" is specified, then "uppercase" cannot also be specified
as part of the same <a href=
"#doc-xquery10-FTMatchOptions">FTMatchOptions</a>.</p>
<p>Although match options only take effect in the application of
<a href="#doc-xquery10-FTWords">FTWords</a>, the syntax also allows
to specify match options that modify the non-primitive full-text
selection <code>"(" FTSelection ")"</code>. Such a higher-level
match option provides a default for the respective match option
group for any embedded <a href=
"#doc-xquery10-FTPrimary">FTPrimary</a>, just as <a href=
"#doc-xquery10-FTOptionDecl">match option declarations</a> in the
<a href="#doc-xquery10-Prolog">Prolog</a> provide default match
options for the whole query.</p>
<p>Match options are propagated through the query via the static
context. For each of the seven match option groups, the static
context has a component that contains one option from that group.
The seven settings are initialized by the implementation in
accordance with the table in Appendix <a href=
"#id-xqft-static-context-components"><b>C Static Context
Components</b></a>, and are modified by any <a href=
"#doc-xquery10-FTOptionDecl">FTOptionDecl</a>s in the <a href=
"#doc-xquery10-Prolog">Prolog</a>. The resulting settings are then
propagated unchanged to every <a href=
"#doc-xquery10-FTContainsExpr">FTContainsExpr</a> in the module
(including those in <code>VarDecl</code>s and
<code>FunctionDecl</code>s, and including any that happen to be
nested within another <code>FTContainsExpr</code>). At any given
<code>FTContainsExpr</code>, the settings from the static context
are copied to the <code>FTContainsExpr</code>'s inner settings,
which are then propagated down the syntax tree. At each <a href=
"#doc-xquery10-FTPrimaryWithOptions">FTPrimaryWithOptions</a>, the
locally specified match options (if any) overwrite the
corresponding inner setting(s). At each <a href=
"#doc-xquery10-FTWords">FTWords</a>, the inner settings are used as
the effective match options for tokenizing the query strings and
matching them against the tokens in the text. (These inner settings
could be seen as a parallel set of components in the static
context, but Section <a href="#tq-semantics"><b>4 Semantics</b></a>
models them as structures that get passed as parameters to various
semantic functions.)</p>
<p>Thus, when a match option appears in an <a href=
"#doc-xquery10-FTSelection">FTSelection</a>, it applies to the
associated <a href="#doc-xquery10-FTPrimary">FTPrimary</a>, but not
to any <code>FTContainsExpr</code>s that happen to be embedded
within that <code>FTPrimary</code>. Instead, for a nested
<code>FTContainsExpr</code>, the default match options are those
declared in the <code>Prolog</code> or, if not declared in the
<code>Prolog</code>, then supplied by the implementation's initial
values.</p>
<p>An <a href="#doc-xquery10-FTMatchOption">FTMatchOption</a>
applies to the <a href="#doc-xquery10-FTPrimary">FTPrimary</a> that
immediately precedes it. That FTPrimary is either an <a href=
"#doc-xquery10-FTWords">FTWords</a> (possibly qualified by an
<a href="#doc-xquery10-FTTimes">FTTimes</a>), an <a href=
"#doc-xquery10-FTExtensionSelection">FTExtensionSelection</a>, or a
parenthesized <a href=
"#doc-xquery10-FTSelection">FTSelection</a>.</p>
<p>[<a name="dt-match-option-order" id="dt-match-option-order"
title="match option application order">Definition</a>: The order in
which effective match options for an <a href=
"#doc-xquery10-FTWords">FTWords</a> are applied is called the
<b>match option application order</b>.] This order is significant
because match options are not always commutative. For example,
synonym(stem(word)) is not always the same as
stem(synonym(word)).</p>
<p>The match option application order is subject to some
constraints:</p>
<ol class="enumar">
<li>
<p>The Language Option must be applied first</p>
</li>
<li>
<p>The Stemming Option must be applied before the Case Option and
the Diacritics Option</p>
</li>
</ol>
<p>Aside from these constraints, the full order of the application
of match options is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
<p>More information on their semantics is given in <a href=
"#FTMatchOptionsSec"><b>4.2.5 Match Options Semantics</b></a>.</p>
<p>If no match options declarations are present in the prolog and
the implementation does not define any overwriting of the static
context components for the match options, the query:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book/title contains text "usability" 
</pre></div>
</div>
<p>is, assuming "de" is the <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> default
language, equivalent to the query:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book/title contains text "usability" 
    using language "de"
    using no wildcards
    using no thesaurus
    using no stemming
    using case insensitive 
    using diacritics insensitive 
    using no stop words
</pre></div>
</div>
<p>We describe each match option group in more detail in the
following sections.</p>
<div class="div3">
<h4><a name="ftlanguageoption" id="ftlanguageoption"></a>3.4.1
Language Option</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTLanguageOption" id=
"doc-xquery10-FTLanguageOption"></a>[177]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTLanguageOption"></a><a href=
"#prod-xquery10-FTLanguageOption">FTLanguageOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"language" <a href=
"#prod-xquery10-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ftlanguageoption" id="dt-ftlanguageoption" title=
"language option">Definition</a>: A <b>language option</b> modifies
token matching by specifying the language of search tokens and
phrases.]</p>
<p>The StringLiteral following the keyword <code>language</code>
designates one language. It must be castable to
<code>xs:language</code>; otherwise, an error is raised: [<a href=
"http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
<p>The "language" option influences tokenization, stemming, and
stop words in an <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> way. The
"language" option <a title="may" href="#may">MAY</a> influence the
behavior of other match options in an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> way.</p>
<p>The set of standardized language identifiers is defined in
<a href="#BCP47">[BCP 47]</a>. The set of valid language
identifiers among the standardized set is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. An
implementation <a title="may" href="#may">MAY</a> choose to use
private extensions introduced by a singleton 'x' for additional
language identifiers, or other singletons for registered extensions
as described in sec. 2.2.6 of <a href="#BCP47">[BCP 47]</a>. It is
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> what
additional language identifiers, if any, are valid. If an invalid
language identifier is specified, then the behavior is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. If the
implementation chooses to raise an error in that case, it must
raise [<a href="#ERRFTST0009" title=
"err:FTST0009">err:FTST0009</a>].</p>
<p>The default language is specified in the static context.</p>
<p>When an XQuery and XPath Full Text processor evaluates text in a
document that is governed by an xml:lang attribute and the portion
of the full-text query doing that evaluation contains an
FTLanguageOption that specifies a different language from the
language specified by the governing xml:lang attribute, the
language-related behavior of that full-text query is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
<p>This is an example where the language option is used to select
the appropriate stop word list:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/content//p contains text "salon de thé"
using stop words default using language "fr"
</pre></div>
</div>
</div>
<div class="div3">
<h4><a name="ftwildcardoption" id="ftwildcardoption"></a>3.4.2
Wildcard Option</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTWildCardOption" id=
"doc-xquery10-FTWildCardOption"></a>[178]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTWildCardOption"></a><a href=
"#prod-xquery10-FTWildCardOption">FTWildCardOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"wildcards" | ("no" "wildcards")</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ftwildcardoption" id="dt-ftwildcardoption" title=
"wildcard option">Definition</a>: A <b>wildcard option</b> modifies
token and phrase matching by specifying whether or not wildcards
are recognized in query strings.]</p>
<p>When the "wildcards" option is used, wildcard syntax may be
included within query strings. A wildcard consists of an indicator
(a period or full stop, "."), optionally followed by a qualifier.
Each wildcard in a query token will match zero or more characters
within a token in the text being searched, as described below. The
number of characters that can be matched depends on the qualifier.
The forms of wildcard syntax specified by this document are:</p>
<ol class="enumar">
<li>
<p>A single period, without any qualifiers: Matches a single
arbitrary character.</p>
</li>
<li>
<p>A period immediately followed by a single question mark, "?":
Matches either no characters or one character.</p>
</li>
<li>
<p>A period immediately followed by a single asterisk, "*": Matches
zero or more characters.</p>
</li>
<li>
<p>A period immediately followed by a single plus sign, "+":
Matches one or more characters.</p>
</li>
<li>
<p>A period immediately followed by a sequence of characters that
matches the regular expression <code>{[0-9]+,[0-9]+}</code>:
Matches a number of characters, where the number is no less than
the number represented by the series of digits before the comma,
and no greater than the number represented by the series of digits
following the comma.</p>
<p>If a period in the query string is immediately followed by a
left curly brace, but the subsequent characters do not conform to
the given regular expression, then an error is raised: [<a href=
"#ERRFTDY0020" title="err:FTDY0020">err:FTDY0020</a>].</p>
</li>
</ol>
<p>A question mark, asterisk, plus sign, or left curly brace that
is not immediately preceded by a period is not treated as a
qualifier. For example, using the sample tokenization and
"wildcards", the query string "wil+" does not match the search text
"will" or "willlllll", but only matches the search text "wil". (The
sample tokenization treats the plus sign as punctuation.)</p>
<p>When "wildcards" is used, any character in a query string can be
"escaped" by immediately preceding it with a backslash, "\". That
is, a backslash immediately followed by any character represents
that character literally, preventing any special interpretation
that the "wildcards" option might otherwise attach to it. In
particular:</p>
<ol class="enumar">
<li>
<p>Escaping a period prevents its interpretation as a wildcard.</p>
</li>
<li>
<p>Escaping a question mark, asterisk, plus sign, or left curly
brace ensures that it is not interpreted as a qualifier.</p>
</li>
<li>
<p>An escaped backslash ("\\") represents a literal backslash.</p>
</li>
<li>
<p>If a query string is terminated by an unescaped backslash, an
error is raised: [<a href="#ERRFTDY0020" title=
"err:FTDY0020">err:FTDY0020</a>].</p>
</li>
</ol>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>A query string of the form <code>"abc\"xyz"</code> does
<em>not</em> represent the three characters "abc" followed by a
literal double-quote followed by the three characters "xyz".
Instead, this is a malformed StringLiteral, and the processor will
report a syntax error [<a href=
"http://www.w3.org/TR/xpath20/#ERRXPST0003" title=
"err:XPST0003">err:XPST0003</a>]<sup><small>XP</small></sup>.</p>
</div>
<p>When the "no wildcards" option is used, no wildcards are
recognized in query strings. Periods, question marks, asterisks,
plus signs, left curly braces, and backslashes are always
recognized as ordinary text characters.</p>
<p>The default is "no wildcards".</p>
<p>The following expression returns true, because the
<code>p</code> element contains "well":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/p contains text "w.ll" using wildcards
</pre></div>
</div>
<p>The following expression returns true, because the
<code>title</code> element contains "site":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/title contains text ".?site" using wildcards
</pre></div>
</div>
<p>The following expression returns true, because the
<code>title</code> element contains "improving":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/title contains text "improv.*" using wildcards
</pre></div>
</div>
<p>The following expression raises error [<a href="#ERRFTDY0020"
title="err:FTDY0020">err:FTDY0020</a>], because the query string
uses incorrect syntax:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/p contains text "wi.{5,7]" using wildcards
</pre></div>
</div>
<p>The following expression returns true, because the title
contains "site":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/title contains text "\s\i\t\e" using wildcards
</pre></div>
</div>
<p>The following expression returns true, because the title
contains "Usability":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/title contains text "Usab.+\\" using wildcards
</pre></div>
</div>
<p>(Note that "\\" represents a literal backslash, which the sample
tokenization treats as punctuation.)</p>
<p>The following expression raises error [<a href="#ERRFTDY0020"
title="err:FTDY0020">err:FTDY0020</a>], because the query string
ends with an unescaped backslash:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/p contains text "will\" using wildcards
</pre></div>
</div>
<p>The following expression returns false, because the
<code>p</code> element does not contain the phrase "w ll":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/p contains text "w.ll" using no wildcards
</pre></div>
</div>
<p>(Note that, without wildcards, the sample tokenization will
treat the period in "w.ll" as punctuation, thus producing "w" and
"ll" as separate tokens.)</p>
</div>
<div class="div3">
<h4><a name="ftthesaurusoption" id="ftthesaurusoption"></a>3.4.3
Thesaurus Option</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTThesaurusOption" id=
"doc-xquery10-FTThesaurusOption"></a>[171]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTThesaurusOption"></a><a href=
"#prod-xquery10-FTThesaurusOption">FTThesaurusOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("thesaurus" (<a href=
"#doc-xquery10-FTThesaurusID">FTThesaurusID</a> | "default"))<br />
| ("thesaurus" "(" (<a href=
"#doc-xquery10-FTThesaurusID">FTThesaurusID</a> | "default") (","
<a href="#doc-xquery10-FTThesaurusID">FTThesaurusID</a>)*
")")<br />
| ("no" "thesaurus")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTThesaurusID" id=
"doc-xquery10-FTThesaurusID"></a>[172]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTThesaurusID"></a><a href=
"#prod-xquery10-FTThesaurusID">FTThesaurusID</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"at" <a href="#doc-xquery10-URILiteral">URILiteral</a>
("relationship" <a href=
"#prod-xquery10-StringLiteral">StringLiteral</a>)? (<a href=
"#doc-xquery10-FTLiteralRange">FTLiteralRange</a>
"levels")?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-URILiteral" id=
"doc-xquery10-URILiteral"></a>[143]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-URILiteral"></a><a href=
"#prod-xquery10-URILiteral">URILiteral</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTLiteralRange" id=
"doc-xquery10-FTLiteralRange"></a>[173]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTLiteralRange"></a><a href=
"#prod-xquery10-FTLiteralRange">FTLiteralRange</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("exactly" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a>)<br />
| ("at" "least" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a>)<br />
| ("at" "most" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a>)<br />
| ("from" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a> "to" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a>)</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ftthesaurusoption" id="dt-ftthesaurusoption" title=
"thesaurus option">Definition</a>: A <b>thesaurus option</b>
modifies token and phrase matching by specifying whether a
thesaurus is used or not.] If thesauri are used, the thesaurus
option specifies information to locate the thesauri either by
default or through a URI reference. It also states the relationship
to be applied and how many levels within the thesaurus to be
traversed.</p>
<p>If the thesaurus option specifies a thesaurus with a relative
URI, that relative URI is resolved to an absolute URI using the
base URI in the static context and that absolute URI is used to
identify the thesaurus.</p>
<p>If the URI specifies a thesaurus that is not found in the
statically known thesauri, an error is raised [<a href=
"#ERRFTST0018" title="err:FTST0018">err:FTST0018</a>].</p>
<p>Thesauri add related tokens and phrases to the query or change
query tokens. Thus, the user may narrow, broaden, or otherwise
modify the query using synonyms, hypernyms (more generic terms),
etc. The search is performed as though the user has specified all
related query tokens and phrases in a disjunction (FTOr).</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>A thesaurus may be standards-based or locally-defined. It may be
a traditional thesaurus, or a taxonomy, soundex, ontology, or topic
map. How the thesaurus is represented is <a title=
"implementation dependent" href=
"#dt-implementation-dependent">implementation-dependent</a>.</p>
</div>
<p>
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>An
FTThesaurusID may optionally contain a StringLiteral to
specify</span> the relationship sought between tokens and phrases
written in the query and terms in the thesaurus. Relationships
include, but are not limited to, the relationships and their
abbreviations presented in <a href="#iso-2788">[ISO 2788]</a> and
their equivalents in other languages. The set of relationships
supported by an implementation is <a title="implementation defined"
href="#dt-implementation-defined">implementation-defined</a>, but
implementations <a title="should" href="#should">SHOULD</a> support
the relationships defined in <a href="#iso-2788">[ISO 2788]</a>.
The following list of terms have the meanings defined in <a href=
"#iso-2788">[ISO 2788]</a>. If a query specifies thesaurus
relationships not supported by the thesaurus, or does not specify a
relationship, the behavior is <a title="implementation defined"
href="#dt-implementation-defined">implementation-defined</a>.</p>
<ol class="enumar">
<li>
<p><em>equivalence relationships (synonyms):</em> PREFERRED TERM
(USE), NONPREFERRED USED FOR TERM (UF);</p>
</li>
<li>
<p><em>hierarchical relationships:</em> BROADER TERM (BT), NARROWER
TERM (NT), BROADER TERM GENERIC (BTG), NARROWER TERM GENERIC (NTG),
BROADER TERM PARTITIVE (BTP), NARROWER TERM PARTITIVE (NTP), TOP
Terms (TT); and</p>
</li>
<li>
<p><em>associative relationships:</em> RELATED TERM (RT).</p>
</li>
</ol>
<p>
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>An
FTThesaurusID may also optionally include an FTLiteralRange to
specify the number of levels to be queried in hierarchical
relationships.</span> 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>An
FTLiteralRange is a constrained form of <a href=
"#doc-xquery10-FTRange">FTRange</a>, and specifies a (possibly
empty) range of integer values according to the same
rules.</span></p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>For historical reasons, an implementation <a title="may" href=
"#may">MAY</a> allow an FTLiteralRange to have subexpressions more
general than IntegerLiterals, and <a title="may" href=
"#may">MAY</a> even allow its subexpressions to be dynamically
evaluated.</p>
</div>
<p>
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>The
effect of specifying a particular range of levels in an
FTThesaurusID is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. This
includes cases involving empty ranges, negative levels, or</span>
levels not supported by the thesaurus.</p>
<p>If no levels are specified, the default is to query all levels
in hierarchical relationships 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>or
to query an <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> number of
levels in hierarchical relationships</span>.</p>
<p>The "thesaurus" option specifies that string matches include
tokens that can be found in one of the specified thesauri. When
"default" is used in place of a FTThesaurusID, the thesauri
specified in the static context are used, which are either given by
the prolog declaration for the thesaurus option, or, if no such
declaration exists a system-defined default thesaurus with a
system-defined relationship. The default thesaurus may be used in
combination with other explicitly specified thesauri.</p>
<p>The "no thesaurus" option specifies that no thesaurus will be
used.</p>
<p>The default is "no thesaurus".</p>
<p>The following expression returns true, because it finds a
<code>content</code> element containing "task" which the thesaurus
identified as a synonym for "duty":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
.//book/content contains text "duty" using
thesaurus at "http://bstore1.example.com/UsabilityThesaurus.xml"
relationship "UF"
</pre></div>
</div>
<p>The following expression returns a <code>book</code> element,
because it finds a <code>content</code> element containing "users",
which is a narrower term of "people":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
doc("http://bstore1.example.com/full-text.xml")
/books/book[./content contains text "people" using
thesaurus at "http://bstore1.example.com/UsabilityThesaurus.xml"
relationship "NT" at most 2 levels]
</pre></div>
</div>
<p>Assuming the thesaurus available at URL
"http://bstore1.example.com/UsabilitySoundex.xml" contains soundex
capabilities, the following query returns a <code>book</code>
element containing "Marigold" which sounds like "Merrygould":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
doc("http://bstore1.example.com/full-text.xml")
/books/book[. contains text "Merrygould" using thesaurus at
"http://bstore1.example.com/UsabilitySoundex.xml" relationship
"sounds like"]
</pre></div>
</div>
</div>
<div class="div3">
<h4><a name="ftstemoption" id="ftstemoption"></a>3.4.4 Stemming
Option</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTStemOption" id=
"doc-xquery10-FTStemOption"></a>[170]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTStemOption"></a><a href=
"#prod-xquery10-FTStemOption">FTStemOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"stemming" | ("no" "stemming")</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ftstemoption" id="dt-ftstemoption" title=
"stemming option">Definition</a>: A <b>stemming option</b> modifies
token and phrase matching by specifying whether stemming is applied
or not. ]</p>
<p>The "stemming" option specifies that matches may contain tokens
that have the same stem as the tokens and phrases written in the
query. It is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> what a stem
of a token is.</p>
<p>The "no stemming" option specifies that the tokens and phrases
are not stemmed.</p>
<p>It is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> whether the
stemming is based on an algorithm, dictionary, or mixed
approach.</p>
<p>The default is "no stemming".</p>
<p>The following expression returns true, because the
<code>title</code> of the specified <code>book</code> contains
"improving" which has the same stem as "improve":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book[@number="1"]/title contains text "improve" using stemming 
</pre></div>
</div>
</div>
<div class="div3">
<h4><a name="ftcaseoption" id="ftcaseoption"></a>3.4.5 Case
Option</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTCaseOption" id=
"doc-xquery10-FTCaseOption"></a>[168]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTCaseOption"></a><a href=
"#prod-xquery10-FTCaseOption">FTCaseOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("case" "insensitive")<br />
| ("case" "sensitive")<br />
| "lowercase"<br />
| "uppercase"</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ftcaseoption" id="dt-ftcaseoption" title=
"case option">Definition</a>: A <b>case option</b> modifies the
matching of tokens and phrases by specifying how uppercase and
lowercase characters are considered.]</p>
<p>There are four possible character case options:</p>
<ol class="enumar">
<li>
<p>Using the option "case insensitive", tokens and phrases are
matched, regardless of the case of characters of the query tokens
and phrases.</p>
</li>
<li>
<p>Using the option "case sensitive", tokens and phrases are
matched, if and only if the case of their characters is the same as
written in the query.</p>
</li>
<li>
<p>Using the option "lowercase", tokens and phrases are matched, if
and only if they match the query without regard to character case,
but contain only lowercase characters.</p>
</li>
<li>
<p>Using the option "uppercase", tokens and phrases are matched, if
and only if they match the query without regard to character case,
but contain only uppercase characters.</p>
</li>
</ol>
<p>The default is "case insensitive".</p>
<p>The effect of the case options is also influenced by the query's
default collation (see <a href=
"http://www.w3.org/TR/xquery/#static_context">Section 2.1.1 Static
Context</a><sup><small>XQ</small></sup> and <a href=
"http://www.w3.org/TR/xquery/#id-default-collation-declaration">Section
4.4 Default Collation Declaration</a><sup><small>XQ</small></sup>).
The following table summarizes how these interact.</p>
<table border="1" summary="Case Matrix">
<caption>Case Matrix</caption>
<thead>
<tr>
<th colspan="1">Case option \ Default collation</th>
<th colspan="1">UCC (Unicode Codepoint Collation)</th>
<th colspan="1">CCS (some generic case-sensitive collation)</th>
<th colspan="1">CCI (some generic case-insensitive collation)</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="1">case insensitive</th>
<td>compare as if both lower</td>
<td>case-insensitive variant of CCS if it exists, else error</td>
<td>CCI</td>
</tr>
<tr>
<th colspan="1">case sensitive</th>
<td>UCC</td>
<td>CCS</td>
<td>case-sensitive variant of CCI if it exists, else error</td>
</tr>
<tr>
<th colspan="1">lowercase</th>
<td>compare using UCC after applying fn:lower-case() to the query
string</td>
<td>compare using CCS after applying fn:lower-case() to the query
string</td>
<td>CCI</td>
</tr>
<tr>
<th colspan="1">uppercase</th>
<td>compare using UCC after applying fn:upper-case() to the query
string</td>
<td>compare using CCS after applying fn:upper-case() to the query
string</td>
<td>CCI</td>
</tr>
</tbody>
</table>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>In this table, "else error" means "Otherwise, an error is
raised: [<a href=
"http://www.w3.org/TR/xpath-functions/#ERRFOCH0002" title=
"err:FOCH0002">err:FOCH0002</a>]<sup><small>FO</small></sup>". The
phrase "if it exists" is used, because the case-sensitive collation
CCS does not always have a case-insensitive variant (and, even if
one exists, it may not be possible to determine it
algorithmically), and because the case-insensitive collation CCI
does not always have a case-sensitive variant (and, even if one
exists, it may not be possible to determine it
algorithmically).</p>
</div>
<p>The following expression returns false, because the
<code>title</code> element doesn't contain "usability" in
lower-case characters:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/title contains text "Usability" using lowercase 
</pre></div>
</div>
<p>The following expression returns true, because the character
case is not considered:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/title contains text "usability" using case insensitive
</pre></div>
</div>
</div>
<div class="div3">
<h4><a name="ftdiacriticsoption" id="ftdiacriticsoption"></a>3.4.6
Diacritics Option</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTDiacriticsOption" id=
"doc-xquery10-FTDiacriticsOption"></a>[169]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTDiacriticsOption"></a><a href=
"#prod-xquery10-FTDiacriticsOption">FTDiacriticsOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("diacritics" "insensitive")<br />
| ("diacritics" "sensitive")</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ftdiacriticsoption" id="dt-ftdiacriticsoption"
title="diacritics option">Definition</a>: A <b>diacritics
option</b> modifies token and phrase matching by specifying how
diacritics are considered. ]</p>
<p>There are two possible diacritics options:</p>
<ol class="enumar">
<li>
<p>The option "diacritics" "insensitive" matches tokens and phrases
with and without diacritics. Whether diacritics are written in the
query or not is not considered.</p>
</li>
<li>
<p>The option "diacritics" "sensitive" matches tokens and phrases
only if they contain the diacritics as they are written in the
query.</p>
</li>
</ol>
<p>The default is "diacritics insensitive".</p>
<p>The effect of the diacritics options is also influenced by the
query's default collation (see <a href=
"http://www.w3.org/TR/xquery/#static_context">Section 2.1.1 Static
Context</a><sup><small>XQ</small></sup> and <a href=
"http://www.w3.org/TR/xquery/#id-default-collation-declaration">Section
4.4 Default Collation Declaration</a><sup><small>XQ</small></sup>).
The following table summarizes how these interact.</p>
<table border="1" summary="Diacritics Matrix">
<caption>Diacritics Matrix</caption>
<thead>
<tr>
<th colspan="1">Diacritics option \ Default collation</th>
<th colspan="1">UCC (Unicode Codepoint Collation)</th>
<th colspan="1">CDS (some generic diacritics-sensitive
collation)</th>
<th colspan="1">CDI (some generic diacritics-insensitive
collation)</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="1">diacritics insensitive</th>
<td>UCC comparison, but without considering diacritics</td>
<td>diacritics-insensitive variant of CDS if it exists, else
error</td>
<td>CDI</td>
</tr>
<tr>
<th colspan="1">diacritics sensitive</th>
<td>UCC</td>
<td>CDS</td>
<td>diacritics-sensitive variant of CDI if it exists, else
error</td>
</tr>
</tbody>
</table>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>In this table, "else error" means "Otherwise, an error is
raised: [<a href=
"http://www.w3.org/TR/xpath-functions/#ERRFOCH0002" title=
"err:FOCH0002">err:FOCH0002</a>]<sup><small>FO</small></sup>". The
phrase "if it exists" is used, because the diacritics-sensitive
collation CDS does not always have a diacritics-insensitive variant
(and, even if one exists, it may not be possible to determine it
algorithmically), and because the diacritics-insensitive collation
CDI does not always have a diacritics-sensitive variant (and, even
if one exists, it may not be possible to determine it
algorithmically).</p>
</div>
<p>The following expression returns true, because the token "Véra"
in the <code>editor</code> element is matched, as the acute accent
is not considered in the comparison:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]//editor contains text "Vera" using diacritics insensitive
</pre></div>
</div>
<p>This returns false, because the <code>editor</code> element does
not contain the token "Vera" in this exact form, i.e. without any
diacritics:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/editors contains text "Vera" using diacritics sensitive
</pre></div>
</div>
</div>
<div class="div3">
<h4><a name="ftstopwordoption" id="ftstopwordoption"></a>3.4.7 Stop
Word Option</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTStopWordOption" id=
"doc-xquery10-FTStopWordOption"></a>[174]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTStopWordOption"></a><a href=
"#prod-xquery10-FTStopWordOption">FTStopWordOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("stop" "words" <a href=
"#doc-xquery10-FTStopWords">FTStopWords</a> <a href=
"#doc-xquery10-FTStopWordsInclExcl">FTStopWordsInclExcl</a>*)<br />
| ("stop" "words" "default" <a href=
"#doc-xquery10-FTStopWordsInclExcl">FTStopWordsInclExcl</a>*)<br />
| ("no" "stop" "words")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTStopWords" id=
"doc-xquery10-FTStopWords"></a>[175]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTStopWords"></a><a href=
"#prod-xquery10-FTStopWords">FTStopWords</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("at" <a href=
"#doc-xquery10-URILiteral">URILiteral</a>)<br />
| ("(" <a href="#prod-xquery10-StringLiteral">StringLiteral</a>
("," <a href="#prod-xquery10-StringLiteral">StringLiteral</a>)*
")")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTStopWordsInclExcl" id=
"doc-xquery10-FTStopWordsInclExcl"></a>[176]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTStopWordsInclExcl"></a><a href=
"#prod-xquery10-FTStopWordsInclExcl">FTStopWordsInclExcl</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("union" | "except") <a href=
"#doc-xquery10-FTStopWords">FTStopWords</a></code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ftstopwordoption" id="dt-ftstopwordoption" title=
"stop word option">Definition</a>: A <b>stop word option</b>
controls matching of 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>tokens</span>
by specifying whether stop words are used or not. Stop words are
tokens in the query that match any token in the text being
searched. ] 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>More
precisely, a stop word option defines a collection of stop words
according to the rules below. Then, in every FTWords to which the
stop word option applies, each query token is checked: if it
appears (using an <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> comparison)
in the specified collection of stop words, it is considered a stop
word.</span></p>
<p>Normally a stop word matches exactly one token, but there may be
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> conditions,
under which a stop word may match a different number of tokens.</p>
<p>Tokens matched by stop words retain their position numbers and
are counted by <a href="#doc-xquery10-FTDistance">FTDistance</a>
and <a href="#doc-xquery10-FTWindow">FTWindow</a> filters.</p>
<p><a href="#doc-xquery10-FTStopWords">FTStopWords</a> specifies
the list of stop words either explicitly as a comma-separated list
of string literals, or by the keyword <code>at</code> followed by a
literal URI. If the URI specifies a list of stop words that is not
found in the statically known stop word lists, an error is raised
[<a href="#ERRFTST0008" title="err:FTST0008">err:FTST0008</a>].
Whether the stop word list is resolved from the statically known
stop word lists or given explicitly, no tokenization is performed
on the stop words: they are used as they occur in the list.</p>
<p>If the stop words option specifies a stop word list with a
relative URI, that relative URI is resolved to an absolute URI
using the base URI in the static context and that absolute URI is
used to identify the stop word list.</p>
<p>Multiple stop word lists may be combined using "union" or
"except". The keywords "union" and "except" are applied from left
to right. If "union" is specified, every string occurring in the
lists specified by the left-hand side or the right-hand side is a
stop word. If "except" is specified, only strings occurring in the
list specified by the left-hand side but not in the list specified
by the right-hand side are stop words.</p>
<p>The 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>"stop
words default"</span> option specifies that an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> collection
of stop words is used.</p>
<p>The "no stop words" option specifies that no stop words are
used. This is equivalent to specifying an empty list of stop
words.</p>
<p>The default is "no stop words".</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Some implementations may apply stop word lists during indexing
and be unable to comply with query-time requests to not apply those
stop words. An implementation may still support stop-word options
(and therefore not raise [<a href="#ERRFTST0006" title=
"err:FTST0006">err:FTST0006</a>]) by applying any additional stop
words specified in the query. Pre-application of irrevocable stop
word lists falls under implementation-defined tokenization behavior
in this case, and a query that specifies "no stop words" may still
have some words ignored.</p>
</div>
<p>The following expression returns true, because the document
contains the phrase "propagating few errors":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book[@number="1"]//p contains text "propagating of errors"
using stop words ("a", "the", "of") 
</pre></div>
</div>
<p>Note the asymmetry in the stop word semantics: the property of
being a stop word is only relevant to query terms, not to document
terms. Hence, it is irrelevant for the above-mentioned match
whether "few" is a stop word or not, and on the other hand we do
not want the query above to match "propagating" followed by 2 stop
words, or even a sequence of 3 stop words in the document.</p>
<p>The following expression returns false. In this case specifying
"few" as a stop word has no effect, since "few" does not appear in
the query. Although the words "propagating" and "errors" appear in
the text being searched, the phrase "propagating errors" cannot be
matched, since that phrase does not occur.</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book[@number="1"]//p contains text "propagating errors" 
using stop words ("few")
</pre></div>
</div>
<p>The following expression returns false, because "of" is not in
the <code>p</code> element between "propagating" and "errors":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book[@number="1"]//p contains text "propagating of errors" 
using no stop words
</pre></div>
</div>
<p>The following expression uses the stop words list specified at
the URL. Assuming that the specified stop word list contains the
word "then", this query is reduced to a query on the phrase
"planning X conducting", allowing any token as a substitute for X.
It returns a <code>book</code> element, because its
<code>content</code> element contains "planning then conducting".
It would also return the <code>book</code> if the phrases "planning
and conducting" and "planning before conducting" had been in its
<code>content</code>:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
doc("http://bstore1.example.com/full-text.xml")
/books/book[.//content contains text "planning then 
conducting" using stop words at 
"http://bstore1.example.com/StopWordList.xml"]
</pre></div>
</div>
<p>The following expression returns <code>book</code>s containing
"planning then conducting", but not does not return
<code>book</code>s containing "planning and conducting", since it
is exempting "then" from being a stop word:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
doc("http://bstore1.example.com/full-text.xml")
/books/book[.//content contains text "planning then conducting"
using stop words at "http://bstore1.example.com/StopWordList.xml"
except ("the", "then")]
</pre></div>
</div>
</div>
<div class="div3">
<h4><a name="ftextensionoption" id="ftextensionoption"></a>3.4.8
Extension Option</h4>
<p>[<a name="dt-ftextensionoption" id="dt-ftextensionoption" title=
"extension option">Definition</a>: An <b>extension option</b> is a
match option that acts in an <a title="implementation defined"
href="#dt-implementation-defined">implementation-defined</a> way.
]</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTExtensionOption" id=
"doc-xquery10-FTExtensionOption"></a>[179]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTExtensionOption"></a><a href=
"#prod-xquery10-FTExtensionOption">FTExtensionOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"option" <a href="#prod-xquery10-QName">QName</a>
<a href="#prod-xquery10-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
</table>
<p>An extension option consists of an identifying QName and a
StringLiteral. Typically, a particular option will be recognized by
some implementations and not by others. The syntax is designed so
that option declarations can be successfully parsed by all
implementations.</p>
<p>The QName of an extension option must resolve to a namespace URI
and local name, using the statically known namespaces.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>There is no default namespace for options.</p>
</div>
<p>Each implementation recognizes an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> set of
namespace URIs used to denote extension options.</p>
<p>If the namespace part of the QName is not a namespace recognized
by the implementation as one used to denote extension option, then
the extension option is ignored.</p>
<p>Otherwise, the effect of the extension option, including its
error behavior, is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. For
example, if the local part of the QName is not recognized, or if
the StringLiteral does not conform to the rules defined by the
implementation for the particular extension option, the
implementation may choose whether to report an error, ignore the
extension option, or take some other action.</p>
<p>Implementations may impose rules on where particular extension
options may appear relative to other match options, and the
interpretation of an option declaration may depend on its
position.</p>
<p>An extension option must not be used to change the syntax
accepted by the processor, or to suppress the detection of static
errors. However, it may be used without restriction to modify the
set of tokens in the query or how they are matched against tokens
in the text being searched. An extension option has the same scope
as other match options.</p>
<p>The following examples illustrate several possible uses for
extension options:</p>
<p>This extension option is set as part of the static context of
all full-text expressions in the module and might be used to ensure
that queries are insensitive to Arabic short-vowels.</p>
<div class="exampleInner">
<pre>
declare namespace exq = "http://example.org/XQueryImplementation";

declare ft-option using option exq:diacritics "short-vowel insensitive";
</pre></div>
<p>This extension option applies only to the matching in the
full-text selection in which it is found and might be used to
specify how compound words should be matched.</p>
<div class="xquery">
<div class="exampleInner">
<pre>
declare namespace exq = "http://example.org/XQueryImplementation";

//para[. contains text
         ("Kinder" ftand "Platz" distance exactly 1 words)
         using stemming
         using option exq:compounds "distance=1" ]
</pre></div>
</div>
</div>
</div>
<div class="div2">
<h3><a name="logical_ftoperators" id="logical_ftoperators"></a>3.5
Logical Full-Text Operators</h3>
<p>Full-text selections can be combined with the logical
connectives <code>ftor</code> (full-text or), <code>ftand</code>
(full-text and), <code>not in</code> (mild not), and
<code>ftnot</code> (unary full-text not).</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTOr" id=
"doc-xquery10-FTOr"></a>[146]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTOr"></a><a href=
"#prod-xquery10-FTOr">FTOr</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTAnd">FTAnd</a> ( "ftor" <a href=
"#doc-xquery10-FTAnd">FTAnd</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTAnd" id=
"doc-xquery10-FTAnd"></a>[147]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTAnd"></a><a href=
"#prod-xquery10-FTAnd">FTAnd</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTMildNot">FTMildNot</a> ( "ftand"
<a href="#doc-xquery10-FTMildNot">FTMildNot</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTMildNot" id=
"doc-xquery10-FTMildNot"></a>[148]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTMildNot"></a><a href=
"#prod-xquery10-FTMildNot">FTMildNot</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTUnaryNot">FTUnaryNot</a> ( "not"
"in" <a href="#doc-xquery10-FTUnaryNot">FTUnaryNot</a>
)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTUnaryNot" id=
"doc-xquery10-FTUnaryNot"></a>[149]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTUnaryNot"></a><a href=
"#prod-xquery10-FTUnaryNot">FTUnaryNot</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("ftnot")? <a href=
"#doc-xquery10-FTPrimaryWithOptions">FTPrimaryWithOptions</a></code></td>
</tr>
</tbody>
</table>
<div class="div3">
<h4><a name="sec-ftor" id="sec-ftor"></a>3.5.1 Or-Selection</h4>
<p>[<a name="dt-or-selection" id="dt-or-selection" title=
"or-selection">Definition</a>: An <b>or-selection</b> combines two
full-text selections using the <code>ftor</code> operator.]</p>
<p>An or-selection finds all matches that satisfy at least one of
the operand full-text selections.</p>
<p>The following expression returns the <code>book</code> element
written by "Millicent":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[.//author contains text "Millicent" ftor "Voltaire"]
</pre></div>
</div>
</div>
<div class="div3">
<h4><a name="sec-ftand" id="sec-ftand"></a>3.5.2 And-Selection</h4>
<p>[<a name="dt-and-selection" id="dt-and-selection" title=
"and-selection">Definition</a>: An <b>and-selection</b> combines
two full-text selections using the <code>ftand</code>
operator.]</p>
<p>An and-selection finds matches that satisfy all of the operand
full-text selections simultaneously. A match of an and-selection is
formed by combining matches for each of the operand full-text
selections as described in <a href="#tq-ft-fs-FTAnd"><b>4.2.6.2
FTAnd</b></a>.</p>
<p>For example, <code>"usability" ftand "testing"</code> will find
two matches in <code>//book[@number="1"]/title</code>: each of the
two matches for the FTWords selection <code>"usability"</code> (the
two occurrences of "usability" in the string value of the title
element) is combined with the single match for the FTWords
<code>"testing"</code> (only one occurrence of "testing" in the
title). Since the above and-selection has at least one match, the
following expression will return "true".</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"]/title contains text ("usability" ftand "testing")
</pre></div>
</div>
<p>The following expression returns false, because "Millicent" and
"Montana" are not contained by the same <code>author</code> element
in any <code>book</code> element:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book/author contains text "Millicent" ftand "Montana"
</pre></div>
</div>
<p>No <code>author</code> element in any <code>book</code> element
contains both "Millicent" and "Montana". Therefore, for any such
<code>author</code> element, there are either one match for the
FTWords <code>"Millicent"</code> and zero matches for the FTWords
<code>"Montana"</code>, or vice versa, or no matches for both of
them. In any of these cases, the and-selection will have zero
matches.</p>
</div>
<div class="div3">
<h4><a name="sec-ftmildnot" id="sec-ftmildnot"></a>3.5.3 Mild-Not
Selection</h4>
<p>[<a name="dt-mild-not-selection" id="dt-mild-not-selection"
title="mild-not selection">Definition</a>: A <b>mild-not
selection</b> combines two full-text selections using the <code>not
in</code> operator.]</p>
<p>The <code>not in</code> operator is a milder form of the
operator combination <code>ftand ftnot</code>. The selection
<code>A not in B</code> matches a token sequence that matches
<code>A</code>, but not when it is a part of a match of
<code>B</code>. In contrast, <code>A ftand ftnot B</code> only
finds matches when the token sequence contains <code>A</code> and
does not contain <code>B</code>.</p>
<p>As an example, consider a search for <code>"Mexico" not in "New
Mexico"</code>. This may return, among others, a document which is
all about "Mexico" but mentions at the end that "New Mexico was
named after Mexico". The occurrence of "Mexico" in "New Mexico" is
not considered, but other occurrences of "Mexico" are matched. Note
that this document would not be matched by the full-text selection
<code>"Mexico" ftand ftnot "New Mexico"</code>.</p>
<p>A match to a mild-not selection must contain at least one token
that satisfies the first condition and does not satisfy the second
condition. If it contains a token that satisfies both the first and
the second condition, the token is not considered as a match.</p>
<p>The following expression returns true, because "usability"
appears in the <code>title</code> and the <code>p</code> elements
and the token within the phrase "Usability Testing" in the
<code>title</code> element is not considered:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book contains text "usability" not in "usability testing"
</pre></div>
</div>
<p>If either operand of a mild-not selection yields an
<b>AllMatches</b> that contains a <b>Match</b> that contains a
<b>StringExclude</b>, then a dynamic error [<a href="#ERRFTDY0017"
title="err:FTDY0017">err:FTDY0017</a>] is raised.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>This situation can arise if the operand contains a not-selection
or a cardinality constraint (<a href=
"#doc-xquery10-FTTimes">FTTimes</a>) involving
<code>exactly</code>, <code>at most</code>, or <code>from ...
to</code>.</p>
</div>
</div>
<div class="div3">
<h4><a name="sec-ftnot" id="sec-ftnot"></a>3.5.4 Not-Selection</h4>
<p>[<a name="dt-unary-not-selection" id="dt-unary-not-selection"
title="not-selection">Definition</a>: A <b>not-selection</b> is a
full-text selection starting with the prefix operator
<code>ftnot</code>.]</p>
<p>A not-selection selects matches that do not satisfy the operand
full-text selection. Details about how such matches are constructed
are given in <a href="#tq-ft-fs-FTUnaryNot"><b>4.2.6.3
FTUnaryNot</b></a>.</p>
<p>The following expression returns the empty sequence, because all
<code>book</code> elements contain "usability":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[. contains text ftnot "usability"]
</pre></div>
</div>
<p>The following expression returns true, because <code>book</code>
elements contain "improving" and "usability" but not "improving
usability":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book contains text "improving" ftand
"usability" ftand ftnot "improving usability"
</pre></div>
</div>
<p>The following expression returns <code>book</code> elements
containing "web site usability" but not "usability testing":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[title/@shortTitle contains text "web site usability" ftand 
ftnot "usability testing"]
</pre></div>
</div>
</div>
</div>
<div class="div2">
<h3><a name="ftposfilter" id="ftposfilter"></a>3.6 Positional
Filters</h3>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTPosFilter" id=
"doc-xquery10-FTPosFilter"></a>[158]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTPosFilter"></a><a href=
"#prod-xquery10-FTPosFilter">FTPosFilter</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTOrder">FTOrder</a> | <a href=
"#doc-xquery10-FTWindow">FTWindow</a> | <a href=
"#doc-xquery10-FTDistance">FTDistance</a> | <a href=
"#doc-xquery10-FTScope">FTScope</a> | <a href=
"#doc-xquery10-FTContent">FTContent</a></code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ftposfilter" id="dt-ftposfilter" title=
"positional filter">Definition</a>: <b>Positional filters</b> are
postfix operators that serve to filter matches based on various
constraints on their positional information.]</p>
<p>Recall that the grammar rule for <a href=
"#doc-xquery10-FTSelection">FTSelection</a> allows an arbitrary
number of positional filters to follow an <a href=
"#doc-xquery10-FTOr">FTOr</a>. 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>In
a group of multiple adjacent positional filters, <a href=
"#doc-xquery10-FTOrder">FTOrder</a> filters are applied first, and
then the other positional filters are applied from left to right,
skipping the <a href="#doc-xquery10-FTOrder">FTOrder</a> filters.
That is, the first filter is applied to the</span> result of the
<a href="#doc-xquery10-FTOr">FTOr</a>, the second is applied to the
result of that first application, and so on.</p>
<p>An <a href="#doc-xquery10-FTOr">FTOr</a> consists of one or more
<a href="#doc-xquery10-FTAnd">FTAnd</a>s (separated by
<code>ftor</code>), each of which could be an <a href=
"#doc-xquery10-FTPosFilter">FTPosFilter</a> applied to an embedded
FTOr, enclosed in parentheses.</p>
<div class="div3">
<h4><a name="ftorder" id="ftorder"></a>3.6.1 Ordered Selection</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTOrder" id=
"doc-xquery10-FTOrder"></a>[159]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTOrder"></a><a href=
"#prod-xquery10-FTOrder">FTOrder</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"ordered"</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-ordered-selection" id="dt-ordered-selection" title=
"ordered selection">Definition</a>: An <b>ordered selection</b>
consists of a full-text selection followed by the postfix operator
"ordered".] An ordered selection constrains the order of tokens and
phrases to be the same as the order in which they are written in
the operand selection.</p>
<p>The default is unordered. Unordered is in effect when ordered is
not specified in the query. Unordered cannot be written explicitly
in the query.</p>
<p>An ordered selection selects matches which satisfy the operand
full-text selection and which also satisfy the following
constraint: the order that the matching tokens or phrases have in
the text being searched is the same order that the corresponding
query tokens or phrases have in the operand selection. In both
cases, the ordering is determined from the minimum start positions
of the constituent tokens.</p>
<p>The following expression returns true, because titles of
<code>book</code> elements contain "web site" and "usability" in
the order in which they are written in the query, i.e., "web site"
must precede "usability":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book/title contains text ("web site" ftand "usability") ordered
</pre></div>
</div>
<p>The following expression returns false, because although
"Montana" and "Millicent" both appear in the <code>book</code>
element, they do not appear in the order they are written in the
query:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[@number="1"] contains text ("Montana" ftand "Millicent") ordered
</pre></div>
</div>
</div>
<div class="div3">
<h4><a name="ftwindow" id="ftwindow"></a>3.6.2 Window
Selection</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTWindow" id=
"doc-xquery10-FTWindow"></a>[160]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTWindow"></a><a href=
"#prod-xquery10-FTWindow">FTWindow</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"window" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a> <a href=
"#doc-xquery10-FTUnit">FTUnit</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTUnit" id=
"doc-xquery10-FTUnit"></a>[162]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTUnit"></a><a href=
"#prod-xquery10-FTUnit">FTUnit</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"words" | "sentences" | "paragraphs"</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-window-selection" id="dt-window-selection" title=
"window selection">Definition</a>: A <b>window selection</b>
consists of a full-text selection followed by one of the (complex)
postfix operators derived from <a href=
"#doc-xquery10-FTWindow">FTWindow</a>.] A window selection selects
matches which satisfy the operand full-text selection and for which
the matched tokens and phrases, more precisely the individual
StringIncludes of that match, are found within a number of <a href=
"#doc-xquery10-FTUnit">FTUnit</a>s (words, sentences, and
paragraphs). The number of <a href=
"#doc-xquery10-FTUnit">FTUnit</a>s is specified by an AdditiveExpr
that is converted as though it were an argument to a function with
the expected type of <code>xs:integer</code>.</p>
<p>A window selection may cross element boundaries. The size of the
window is not affected by the presence or absence of element
boundaries. Stop words are included in the computation of the
window size whether they are ignored by the query or not.</p>
<p>A window selection examines the matches generated by the
preceding portion of the <a href=
"#doc-xquery10-FTSelection">FTSelection</a>, and selects those for
which the matched tokens and phrases (more precisely, the
individual StringIncludes of that match) are all found within a
window whose size is a specified number of FTUnits (words,
sentences, or paragraphs); for each such window, the window
selection then generates a match containing the merge of those
StringIncludes, plus any StringExcludes that fall within the
window.</p>
<p>The following expression returns true, because "web", "site",
and "usability" are within a window of 5 tokens in the
<code>title</code> element:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book/title contains text "web" ftand "site"
ftand "usability" window 5 words
</pre></div>
</div>
<p>The following expression returns true, because "web" and "site"
in the order they are written in the query and either "usability"
or "testing" are within a window of at most 10 tokens:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book contains text ("web" ftand "site" ordered)
ftand ("usability" ftor "testing") window 10 words
</pre></div>
</div>
<p>The following expression returns false, because the instances of
"web site" and "usability" in the <code>title</code> element are
not within a window of 3. The phrase "Web Site Usability" in the
attribute does not apply because the attribute is not part of the
string value of the node. A similar query with a window of 5 would
return true.</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book//title contains text "web site" ftand
"usability" window 3 words
</pre></div>
</div>
<p>The following expression returns the sample <code>book</code>
element, because its <code>number</code> attribute is 1 and it
contains a window of 2 words which contains an occurrence of
"efficient" but not an occurrence of "and". There is just one such
matching window in the sample text and it contains "enable
efficient".</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book[@number="1" and . contains text "efficient" 
ftand ftnot "and" window 2 words]
</pre></div>
</div>
<p>The following expression returns the empty sequence, because in
the selected <code>book</code> element, there is no occurrence of
"efficient" within a window of 3 tokens which would not also
contain an occurrence of "and":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book[@number="1" and . contains text "efficient" 
ftand ftnot "and" window 3 words]
</pre></div>
</div>
<p>In order to allow meaningful results for nested positional
filters, e.g., a window selection embedded inside a distance
selection, the resulting matches for window selections are formed
from the input matches that satisfy the window constraint as
follows. All StringIncludes of such a match are coerced into a
single StringInclude that spans all token positions from the
smallest to the largest position of any input StringIncludes. This
is explained in more detail in Section <a href=
"#ftdistance"><b>3.6.3 Distance Selection</b></a>.</p>
</div>
<div class="div3">
<h4><a name="ftdistance" id="ftdistance"></a>3.6.3 Distance
Selection</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTDistance" id=
"doc-xquery10-FTDistance"></a>[161]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTDistance"></a><a href=
"#prod-xquery10-FTDistance">FTDistance</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"distance" <a href="#doc-xquery10-FTRange">FTRange</a>
<a href="#doc-xquery10-FTUnit">FTUnit</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTRange" id=
"doc-xquery10-FTRange"></a>[157]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTRange"></a><a href=
"#prod-xquery10-FTRange">FTRange</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("exactly" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a>)<br />
| ("at" "least" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a>)<br />
| ("at" "most" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a>)<br />
| ("from" <a href="#prod-xquery10-AdditiveExpr">AdditiveExpr</a>
"to" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a>)</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-distance-selection" id="dt-distance-selection"
title="distance selection">Definition</a>: A <b>distance
selection</b> consists of a full-text selection followed by one of
the (complex) postfix operators derived from <a href=
"#doc-xquery10-FTDistance">FTDistance</a>.]</p>
<p>A distance selection selects matches which satisfy the operand
full-text selection and for which the matched tokens and phrases
satisfy the specified distance conditions.</p>
<p>Distances in the search context are measured in units of tokens,
sentences, or paragraphs. Roughly speaking, the distance between
two matches is the number of intervening units, so a distance of
zero tokens (sentences, paragraphs) means no intervening tokens
(sentences, paragraphs). More precisely, given two matches, we
first determine their order by sorting on starting position and if
necessary on ending position. Let M1 be the "earlier" and M2 be the
"later". (If there are overlapping tokens involved, the
designations "earlier" and "later" may not be intuitively obvious.)
Then the distance between the two is M2's starting position minus
M1's ending position, minus 1.</p>
<p>When computing distances in the search context, a distance
selection may cross element boundaries; they affect the distance
computed only to the extent that they affect the tokenization of
the search context. Stop words are counted in those computations
whether they are ignored or not.</p>
<p>When a distance selection applies a distance condition to more
than two matches, the distance condition is required to hold on
each successive pair of matches.</p>
<p>An <a href="#doc-xquery10-FTDistance">FTDistance</a> expresses a
distance condition in terms of an <a href=
"#doc-xquery10-FTUnit">FTUnit</a> and an <a href=
"#doc-xquery10-FTRange">FTRange</a>. An <a href=
"#doc-xquery10-FTUnit">FTUnit</a> can be <code>words</code>,
<code>sentences</code>, or <code>paragraphs</code>, where
<code>words</code> refers to a distance measured in tokens.</p>
<p>An <a href="#doc-xquery10-FTRange">FTRange</a> specifies a range
of integer values by providing a minimum and/or maximum value for
some integer quantity. (Here, where the FTRange appears in an
FTDistance, that quantity is a distance. When it appears in an
FTTimes, the quantity is a number of occurrences.) Each one of the
AdditiveExpr specified in an <a href=
"#doc-xquery10-FTRange">FTRange</a> is converted as though it were
an argument to a function with the expected parameter type of
<code>xs:integer</code>.</p>
<p>Let the value of the first (or only) operand be M. If "from" is
specified, let the value of the second operand be N.</p>
<p>If "exactly" is specified, then the range is the closed interval
[M, M]. If "at least" is specified, then the range is the
half-closed interval [M, unbounded). If "at most" is specified,
then the range is the half-closed interval (unbounded, M]. If
"from-to" is specified, then the range is the closed interval [M,
N]. Note: If M is greater than N, the range is empty.</p>
<p>Here are some examples of <a href=
"#doc-xquery10-FTRange">FTRange</a>s:</p>
<ol class="enumar">
<li>
<p>'exactly 0' specifies the range [0, 0].</p>
</li>
<li>
<p>'at least 1' specifies the range [1,unbounded).</p>
</li>
<li>
<p>'at most 1' specifies the range (unbounded, 1].</p>
</li>
<li>
<p>'from 5 to 10' specifies the range [5, 10].</p>
</li>
</ol>
<p>The following expression returns false, because "completion" and
"errors" are less than 11 tokens apart:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book contains text ("completion" ftand "errors" 
distance at least 11 words)
</pre></div>
</div>
<p>The following expression returns true:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book contains text "web" ftand "site" ftand
"usability" distance at most 2 words
</pre></div>
</div>
<p>The search context contains two occurrences of the phrase "the
usability of a web site" (once in the &lt;title&gt; and once in the
&lt;content&gt;). In this phrase, the tokens "usability" and "web"
have a distance of 2 words, and the tokens "web" and "site" have a
distance of 0 words, both of which satisfy the constraint
<code>distance at most 2 words</code>. (The tokens "usability" and
"site" have a distance of 3 words, but this does not cause the
distance filter to fail, because these are not successive matches.)
Thus, the full-text selection yields two matches, and the whole
expression yields true. (The phrase "Improving Web Site Usability"
would also satisfy the given full-text selection, but in the sample
document it occurs in an attribute value, and so does not
contribute to the string value or the tokenization of the book
element.)</p>
<p>The following expression returns the empty sequence, because
between any token "usability" and the token in any occurrence of
the phrase "web site" that is the nearest to the token "usability"
there is always more than one intervening token:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book[.//p contains text "web site"
ftand "usability" distance at most 1 words] 
</pre></div>
</div>
<p>The following expression returns the <code>book</code> title,
because for the occurrences of the tokens "web" and "users" in the
<code>note</code> element only one intervening token appears:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book[. contains text "web"
ftand "users" distance at most 1 words]/title 
</pre></div>
</div>
<p>In order to allow meaningful results for nested positional
filters, e.g., a distance selection embedded inside another
distance selection, the resulting matches for distance selections
are formed from the input matches that satisfy the distance
constraint as follows. All StringIncludes of such a match are
coerced into a single StringInclude that spans all token positions
from the smallest to the largest position of any input
StringIncludes. Thus, a distance selection that embeds a window or
a distance selection takes the result of the embedded selection as
a single unit.</p>
<p>The following gives an example of nested distance
selections:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books/book contains text ((("richard" ftand "nixon") distance at most 2 words) 
                   ftand 
                   (("george" ftand "bush") distance at most 2 words) 
                  distance at least 20 words)
</pre></div>
</div>
<p>This expression allows to find <code>book</code> elements that
contain, for instance, "Richard M. Nixon" and "George W. Bush" at
least 20 words apart. The matches for the inner distance selections
are treated as single units (represented by StringIncludes) by the
outer distance selection. Suppose such phrases are present in the
search context, then the outer distance selection enforces a
constraint on the number of intervening tokens ("at least 20")
between the last token of "Richard M. Nixon" and the first token of
"George W. Bush".</p>
</div>
<div class="div3">
<h4><a name="ftscope" id="ftscope"></a>3.6.4 Scope Selection</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTScope" id=
"doc-xquery10-FTScope"></a>[163]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTScope"></a><a href=
"#prod-xquery10-FTScope">FTScope</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("same" | "different") <a href=
"#doc-xquery10-FTBigUnit">FTBigUnit</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTBigUnit" id=
"doc-xquery10-FTBigUnit"></a>[164]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTBigUnit"></a><a href=
"#prod-xquery10-FTBigUnit">FTBigUnit</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"sentence" | "paragraph"</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-scope-selection" id="dt-scope-selection" title=
"scope selection">Definition</a>: A <b>scope selection</b> consists
of a full-text selection followed by one of the (complex) postfix
operators derived from <a href=
"#doc-xquery10-FTScope">FTScope</a>.]</p>
<p>A scope selection selects matches which satisfy the operand
full-text selection and for which the matched tokens and phrases
are contained in the same scope or in different scopes.</p>
<p>Possible scopes are sentences and paragraphs.</p>
<p>By default, there are no restrictions on the scope of the
matches.</p>
<p>The following expression returns false, because the tokens
"usability" and "Marigold" are not contained within the same
sentence:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book contains text "usability" ftand "Marigold" same sentence
</pre></div>
</div>
<p>The following expression returns true, because the tokens
"usability" and "Marigold" are contained within different
sentences:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book contains text "usability" ftand "Marigold" different sentence
</pre></div>
</div>
<p>The following expression returns a <code>book</code> element,
because it contains "usability" and "testing" in the same
paragraph:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[. contains text "usability" ftand "testing" same paragraph] 
</pre></div>
</div>
<p>The following expression returns a <code>book</code> element,
because "site" and "errors" appear in the same sentence:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
//book[. contains text "site" ftand "errors" same sentence] 
</pre></div>
</div>
<p>It is possible that both "same sentence" and "different
sentence" conditions are simultaneously safisfied for several
tokens and/or phrases within the same document fragment. This can
be observed if there are occurrences of the tokens and/or phrases
both within the same sentence and within difference sentences. For
example, consider the following document fragment.</p>
<div class="exampleInner">
<pre>
&lt;introduction&gt;
... The usability of a Web site is how well the site supports the user in
achieving specified goals. ... Expert reviews and usability testing are methods of
identifying problems in layout, terminology, and navigation. ...
&lt;/introduction&gt;
</pre></div>
<p>This sample will satisfy both conditions <code>("usability"
ftand "reviews") different sentence</code> and <code>("usability"
ftand "reviews") same sentence</code>. The tokens "usability" and
"reviews" occur both in different sentences (the first and second
shown sentences) and in the same sentence (the second shown
sentences.)</p>
<p>The above observation also holds for the "same paragraph" and
"different paragraph" conditions.</p>
</div>
<div class="div3">
<h4><a name="ftcontent" id="ftcontent"></a>3.6.5 Anchoring
Selection</h4>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTContent" id=
"doc-xquery10-FTContent"></a>[165]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTContent"></a><a href=
"#prod-xquery10-FTContent">FTContent</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("at" "start") | ("at" "end") | ("entire"
"content")</code></td>
</tr>
</tbody>
</table>
<p>[<a name="dt-anchoring-selection" id="dt-anchoring-selection"
title="anchoring selection">Definition</a>: An <b>anchoring
selection</b> consists of a full-text selection followed by one of
the postfix operators "at start", "at end", or "entire
content".]</p>
<p>An anchoring selection selects matches which satisfy the operand
full-text selection and for which the matched tokens and phrases
are the first, last, or all tokens in the tokenized form of the
items being searched.</p>
<ul>
<li>
<p>Using the "at start" operator, tokens or phrases are matched, if
they cover the first token position in the tokenized string value
of the item being searched.</p>
</li>
<li>
<p>Using the "at end" operator, tokens or phrases are matched, if
they cover the last token position in the tokenized string value of
the item being searched.</p>
</li>
<li>
<p>Using the "entire content" operator, tokens or phrases are
matched, if they cover all token positions of the tokenized string
value of the item being searched.</p>
</li>
</ul>
<p>The following expression returns each <code>title</code> element
starting with the phrase "improving the usability of a web
site":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books//title[. contains text "improving the usability
of a web site" at start]
</pre></div>
</div>
<p>The following expression returns the <code>p</code> element of
the sample, because it ends with the phrase "propagating few
errors":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books//p[. contains text "propagat.*" using wildcards ftand "few
errors" distance at most 2 words at end]
</pre></div>
</div>
<p>Since the distance operator doesn't imply an ordering, the last
example would also yield a match if the <code>p</code> element
ended with, say, "few errors are propagated".</p>
<p>The following expression returns each <code>note</code> element
whose entire content is "this book has been approved by the web
site users association":</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books//note[. contains text "this book has been
approved by the web site users association" entire content]
</pre></div>
</div>
<p>The following example returns true because both the
<code>content</code> and the <code>note</code> elements match:</p>
<div class="xpath">
<div class="exampleInner">
<pre>
/books//* contains text "Association" at end
</pre></div>
</div>
</div>
</div>
<div class="div2">
<h3><a name="ftignoreoption" id="ftignoreoption"></a>3.7 Ignore
Option</h3>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTIgnoreOption" id=
"doc-xquery10-FTIgnoreOption"></a>[180]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTIgnoreOption"></a><a href=
"#prod-xquery10-FTIgnoreOption">FTIgnoreOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"without" "content" <a href=
"#prod-xquery10-UnionExpr">UnionExpr</a></code></td>
</tr>
</tbody>
</table>
<p>The <b>ignore option</b> specifies a set of nodes whose contents
are ignored. It is applicable only to a top-level <a href=
"#doc-xquery10-FTSelection">FTSelection</a> (see <a href=
"#doc-xquery10-FTContainsExpr">FTContainsExpr</a>). [<a name=
"IgnoredNodesDef" id="IgnoredNodesDef" title=
"IgnoredNodes">Definition</a>: <b>Ignored nodes</b> are the set of
nodes whose content are ignored.] Ignored nodes are identified by
the XQuery expression UnionExpr. The value of the UnionExpr must be
a sequence of zero or more nodes; otherwise a type error is raised
[<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
<p>Let <code>I1, I2, ..., In</code> be the sequence of items of the
search context and let <code>N1, N2, ..., Nk</code> be the sequence
of nodes that UnionExpr evaluates to. For each <code>Ij
(j=1..n)</code> a copy is made that omits each node <code>Ni
(i=1..k)</code>. Those copies form the new search context. If
UnionExpr evaluates to an empty sequence no nodes are omitted.</p>
<p>In the following fragment, if <code>$x//annotation</code> is
ignored, "Web Usability" will be found 2 times: once in the
<code>title</code> element and once in the <code>editor</code>
element. The 2 occurrences in the 2 <code>annotation</code>
elements are ignored. On the other hand, "expert" will not be
found, as it appears only in an <code>annotation</code>
element.</p>
<div class="exampleInner">
<pre>
let $x := &lt;book&gt;
   &lt;title&gt;Web Usability and Practice&lt;/title&gt;
   &lt;author&gt;Montana &lt;annotation&gt; this author is
       an expert in Web Usability&lt;/annotation&gt; Marigold
   &lt;/author&gt;
   &lt;editor&gt;Véra Tudor-Medina on Web &lt;annotation&gt; best
       editor on Web Usability&lt;/annotation&gt; Usability
   &lt;/editor&gt;
 &lt;/book&gt;
 
</pre></div>
<p>By default, no element content is ignored.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Nodes <a title="may" href="#may">MAY</a> be ignored during
indexing and during query processing. The ignore option applies
only to query processing. Whether and how indexing ignores nodes is
out of scope for this specification.</p>
</div>
</div>
<div class="div2">
<h3><a name="id-extension-selections" id=
"id-extension-selections"></a>3.8 Extension Selections</h3>
<p>[<a name="dt-extension-selection" id="dt-extension-selection"
title="extension selection">Definition</a>: An <b>extension
selection</b> is a full-text selection whose semantics are
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.]
Typically, a particular extension will be recognized by some
implementations and not by others. The syntax is designed so that
extension selections can be successfully parsed by all
implementations, and so that fallback behavior can be defined for
implementations that do not recognize a particular extension.</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-FTExtensionSelection" id=
"doc-xquery10-FTExtensionSelection"></a>[154]&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-FTExtensionSelection"></a><a href="#prod-xquery10-FTExtensionSelection">FTExtensionSelection</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-Pragma">Pragma</a>+ "{" <a href=
"#doc-xquery10-FTSelection">FTSelection</a>? "}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-Pragma" id=
"doc-xquery10-Pragma"></a>[69]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Pragma"></a><a href=
"#prod-xquery10-Pragma">Pragma</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"(#" <a href="#prod-xquery10-S">S</a>? <a href=
"#prod-xquery10-QName">QName</a> (<a href="#prod-xquery10-S">S</a>
<a href="#doc-xquery10-PragmaContents">PragmaContents</a>)?
"#)"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="doc-xquery10-PragmaContents" id=
"doc-xquery10-PragmaContents"></a>[70]&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-PragmaContents"></a><a href=
"#prod-xquery10-PragmaContents">PragmaContents</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-Char">Char</a>* - (Char* '#)'
Char*))</code></td>
</tr>
</tbody>
</table>
<p>An extension selection consists of one or more pragmas followed
by a full-text selection enclosed in curly braces. See <a href=
"http://www.w3.org/TR/xquery/#id-extension-expressions">Section
3.14 Extension Expressions</a><sup><small>XQ</small></sup> for
information on pragmas in general. A pragma is denoted by the
delimiters <code>(#</code> and <code>#)</code>, and consists of an
identifying QName followed by <a title="implementation defined"
href="#dt-implementation-defined">implementation-defined</a>
content. The content of a pragma may consist of any string of
characters that does not contain the ending delimiter
<code>#)</code>. The QName of a pragma must resolve to a namespace
URI and local name, using the statically known namespaces.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Since there is no default namespace for pragmas, a pragma QName
must include a namespace prefix.</p>
</div>
<p>Each implementation recognizes an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> set of
namespace URIs used to denote pragmas.</p>
<p>If the namespace part of a pragma QName is not recognized by the
implementation as a pragma namespace, then the pragma is ignored.
If all the pragmas in an <a href=
"#doc-xquery10-FTExtensionSelection">FTExtensionSelection</a> are
ignored, then full-text extension selection is just the full-text
selection enclosed in curly braces; if this full-text selection is
absent, then a static error is raised [<a href=
"http://www.w3.org/TR/xquery/#ERRXQST0079" title=
"err:XQST0079">err:XQST0079</a>]<sup><small>XQ</small></sup>.</p>
<p>If an implementation recognizes the namespace of one or more
pragmas in an <a href=
"#doc-xquery10-FTExtensionSelection">FTExtensionSelection</a>, then
the value of the <a href=
"#doc-xquery10-FTExtensionSelection">FTExtensionSelection</a>,
including its error behavior, is <a title="implementation defined"
href="#dt-implementation-defined">implementation-defined</a>. For
example, an implementation that recognizes the namespace of a
pragma QName, but does not recognize the local part of the QName,
might choose either to raise an error or to ignore the pragma.</p>
<p>It is a static error [<a href=
"http://www.w3.org/TR/xquery/#ERRXQST0013" title=
"err:XQST0013">err:XQST0013</a>]<sup><small>XQ</small></sup> if an
implementation recognizes a pragma but determines that its content
is invalid.</p>
<p>If an implementation recognizes a pragma, it must report any
static errors in the following full-text selection even if it will
not apply that selection.</p>
<p>The following examples illustrate three ways in which extension
selections might be used.</p>
<p>A pragma can be used to furnish a hint for how to evaluate the
following full-text selection, without actually changing the
result. For example:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
declare namespace exq = "http://example.org/XQueryImplementation";

/books/book/author[name contains text (# exq:use-index #) {'Berners-Lee'}]
</pre></div>
</div>
<p>An implementation that recognizes the <code>exq:use-index</code>
pragma might use an index to evaluate the full-text selection that
follows. An implementation that does not recognize this pragma
would evaluate the full-text selection in its normal way.</p>
<p>A pragma might be used to modify the semantics of the following
full-text selection in ways that would not (in the absence of the
pragma) be conformant with this specification. For example, a
pragma might be used to change distance counting so that adjacent
words are at a distance of 1 (otherwise they would be at a distance
of 0):</p>
<div class="xquery">
<div class="exampleInner">
<pre>
declare namespace exq = "http://example.org/XQueryImplementation";

/books/book[.//p contains text (# exq:distance #) { "web site"
ftand "usability" distance at most 1 words }]
</pre></div>
</div>
<p>Such changes to the language semantics must be scoped to the
expression contained within the curly braces following the
pragma.</p>
<p>A pragma might contain syntactic constructs that are evaluated
in place of the following full-text selection. In this case, the
following selection itself (if it is present) provides a fallback
for use by implementations that do not recognize the pragma. For
example:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
declare namespace exq = "http://example.org/XQueryImplementation";

//city[. contains text (# exq:classifier with class 'Animals' #) 
       {"animal" using thesaurus at "http://example.org/thesaurus.xml" 
        relationship "RT"}]
</pre></div>
</div>
<p>Here an implementation that recognizes the pragma will return
the result of evaluating the proprietary syntax <code>with class
'animals'</code>, while an implementation that does not recognize
the pragma will instead return the result of the thesaurus option.
If no fallback expression is required, or if none is feasible, then
the expression between the curly braces may be omitted, in which
case implementations that do not recognize the pragma will raise a
static error.</p>
</div>
</div>
<div class="div1">
<h2><a name="tq-semantics" id="tq-semantics"></a>4 Semantics</h2>
<p>This section describes the formal semantics of XQuery and XPath
Full Text 1.0. The figure below shows how XQuery and XPath Full
Text 1.0 integrates with XQuery 1.0 and XPath 2.0.</p>
<p>The following diagram represents the interaction of XQuery and
XPath Full Text 1.0 with the rest of XQuery 1.0 and XPath 2.0. It
illustrates how full-text expressions can be nested within XQuery
1.0 and XPath 2.0 expressions and vice versa.</p>
<img src="images/XQueryFullTextInteraction.jpg" alt=
"XQuery and Full Text Interaction diagram" />
<ul>
<li>
<p>Step 1 represents the composability of XQuery 1.0 and XPath 2.0
expressions and the fact that such expressions evaluate to a
sequence of XDM items. This process is outside the scope of this
document and will not be discussed further.</p>
</li>
<li>
<p>Step 2 shows how XQuery 1.0 and XPath 2.0 expressions can be
nested within full-text expressions. If an XQuery 1.0 and XPath 2.0
expression is nested on the left-hand side of an <b>FTContains</b>
expression or within <b>FTWords</b>, the sequence of XDM items that
result from evaluation of that XQuery 1.0 or XPath 2.0 expression
are converted to their tokenized form, as described in <a href=
"#TokenizationSec">Tokenization</a>. If the XQuery 1.0 and XPath
2.0 expression is nested within another type of <b>FTSelection</b>,
the items in its result sequence are converted to atomic values, as
discussed in <a href="#ftselections">FTSelections</a>.</p>
</li>
<li>
<p>Step 3 represents the composability of <b>FTSelection</b>s. Each
<b>FTSelection</b> operates on zero or more <b>AllMatches</b> and
returns an <b>AllMatches</b>. The process is described in the
<a href="#FTSelectionEvalSec">Evaluation of FTSelections</a>
section.</p>
</li>
<li>
<p>Step 4 shows how XQuery and XPath Full Text 1.0 and scoring
expressions can be nested into XQuery 1.0 and XPath 2.0
expressions. The sections <a href="#FTContainsSec"><b>4.3
FTContainsExpr</b></a> and <a href="#ScoreSec"><b>4.4
Scoring</b></a> describe how this is achieved.</p>
</li>
</ul>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>In the list above and throughout the rest of this section, bold
typeface has been used to distinguish the concepts that are part of
the <a href="#AllMatchesSec">AllMatches</a> model.</p>
</div>
<p>The functions and schemas defined in this section are considered
to be within the fts: namespace (as discussed in section <a href=
"#tq-ft-namespaces"><b>1.3 A word about namespaces</b></a>). These
functions and schemas are used only for describing the semantics.
There is no requirement that an implementation of this
specification must use the functions, schemas, or algorithms
described in this section of this specification. The only
requirement is that implementations must achieve the same results
that an implementation that does use these functions, schemas, and
algorithms would achieve.</p>
<p>Note that by using XQuery 1.0 and XPath 2.0 to specify the
formal semantics, we avoid the need to introduce new formalism. We
simply reuse the formal semantics of XQuery 1.0 and XPath 2.0.</p>
<div class="xquery">
<div class="div2">
<h3><a name="TokenizationSec" id="TokenizationSec"></a>4.1
Tokenization</h3>
<p>[<a name="TokenizationDef" id="TokenizationDef" title=
"Tokenization">Definition</a>: Formally, <b>tokenization</b> is the
process of converting an XDM item to a collections of tokens,
taking any structural information of the item into account to
identify token, sentence, and paragraph boundaries. Each token is
assigned a starting and ending position.]</p>
<p>Tokenization, including the definition of the term "token",
<a title="should" href="#should">SHOULD</a> be <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.
Implementations <a title="should" href="#should">SHOULD</a> expose
the rules and sample results of tokenization as much as possible to
enable users to predict and interprete the results of tokenization.
Tokenization <a title="must" href="#must">MUST</a> conform to these
constraints:</p>
<ol class="enumar">
<li>
<p>Each token <a title="must" href="#must">MUST</a> consist of one
or more characters.</p>
</li>
<li>
<p>Tokenization of an item <a title="must" href="#must">MUST</a>
include only tokens derived from the string value of that item. The
string value is defined in <a href="#xpath-datamodel">[XQuery 1.0
and XPath 2.0 Data Model (XDM) (Second Edition)]</a> in <a href=
"http://www.w3.org/TR/xpath-datamodel/#StringValue">Section 2.6.5
String Values</a><sup><small>DM</small></sup>; for element nodes it
does not include the contents of attributes, but for attribute
nodes it does.</p>
</li>
<li>
<p>The tokenizer <a title="should" href="#should">SHOULD</a>, when
tokenizing two equal items, identify the same tokens in each. The
cases where it does not are <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>The starting and ending position of a token <a title="must"
href="#must">MUST</a> be integers, and the starting position
<a title="must" href="#must">MUST</a> be less than or equal to the
ending position.</p>
</li>
<li>
<p>In the tokenization of an item, consider the range of token
positions from the smallest starting position to the largest ending
position; every token position in that range must be covered by
some token in the tokenization. That is, for every token position
<code>P</code>, there must exist some token <code>T</code> such
that <code>T's starting position &lt;= P &lt;= T's ending
position</code>.</p>
</li>
<li>
<p>The tokenizer <a title="must" href="#must">MUST</a> preserve the
containment hierarchy (paragraphs contain sentences contain tokens)
by adhering to the following constraints:</p>
<ol class="enumla">
<li>
<p>Each token is contained in at most one sentence and at most one
paragraph. (In particular, this means that no tokens of any
sentence are contained in any other sentence, and no tokens of any
paragraph are contained in any other paragraph.)</p>
</li>
<li>
<p>All tokens of a sentence are contained in at most one
paragraph.</p>
</li>
<li>
<p>The range of token positions from the smallest starting position
to the largest ending position in a sentence does not overlap with
the token position range from any other sentence.</p>
</li>
<li>
<p>The range of token positions from the smallest starting position
to the largest ending position in a paragraph does not overlap with
the token position range from any other paragraph.</p>
</li>
</ol>
</li>
</ol>
<p>Useful information for tokenizer implementors may be found in
<a href="#UAX29">[UAX29]</a>.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Usually, the starting and ending positions of a token are the
same. For some languages, some tokenizers may identify overlapping
tokens. For example, the German word
"Donaudampfschifffahrtskapitaensmuetze" might be tokenized into the
following tokens: "Donaudampfschifffahrtskapitaensmuetze", "Donau",
"dampf", "schiff", "dampfschiff", "kapitaen", "muetze",
"kapitaensmuetze", "schifffahrt", "dampfschifffahrt", and perhaps
others. In the face of overlapping tokens, it is
implementation-dependent what positions a tokenizer assigns to each
such token. For example, a tokenizer might assign the same position
value to each of the tokens
"Donaudampfschifffahrtskapitaensmuetze", "Donau", "dampf",
"schiff", "dampfshiff", etc. In that case, the distance between
each (overlapping) token assigned the same position is -1.
Tokenizers might retain additional information about those
overlapping tokens that allows the full-text implementation to
distinguish among them.</p>
<p>Consider the sentence "Ich sehe den Dampfschifffahrtskapitän auf
dem Fluß." If an implementation tokenizes
"Dampfschifffahrtskapitän" as overlapping tokens at the same
position, then the implementation could still determine that the
query "'Schifffahrt Dampf' window 0 words ordered" fails to match
the sentence because phrase matching is implementation-defined and
may make use of additional implementation-dependent token
information.</p>
<p>Even more complex situations can arise. Consider, for example,
the German sentence "Er stellte sie vor." A sophisticated tokenizer
might construct the token "vorstellen" covering positions 2 through
4, which overlaps the token "sie" at position 3. For the purposes
of distance calculations, tokens are considered in the order of
their starting positions, so the distance between "vorstellen" and
"sie" would be 3-4-1=-2. (See <code>fts:wordDistance</code>,
below.)</p>
</div>
<div class="xquery">
<div class="div3">
<h4><a name="tq-ft-Tokenization-examples" id=
"tq-ft-Tokenization-examples"></a>4.1.1 Examples</h4>
<p>For example, the following example must return false, because
the 'secret' only occurs within an attribute and a comment, neither
of which contributes characters to the string value of the 'p'
element node:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
&lt;p kind='secret'&gt;Sensitive material &lt;!-- secret --&gt;&lt;/p&gt; contains text 'secret'

</pre></div>
</div>
<p>The following document may lead to overlapping tokens to account
for the ambiguity caused by the hyphen:</p>
<div class="exampleInner">
<pre>
&lt;p&gt;I will re-
sign tommorow.&lt;/p&gt;

</pre></div>
<p>The following document fragment is the source document for
examples in this section. A sample tokenization is used for the
examples in this section. The results might be different for other
tokenizations.</p>
<p>Unless stated otherwise, the results assume a case-insensitive
match.</p>
<div class="exampleInner">
<pre>
&lt;offers&gt;
    &lt;offer id="1000" price="10000"&gt;
        Ford Mustang 2000, 65K, excellent condition, runs 
        great, AC, CC, power all
    &lt;/offer&gt;
    &lt;offer id="1001" price="8000"&gt;
        Honda Accord 1999, 78K, A/C, cruise control, runs 
        and looks great, excellent condition
    &lt;/offer&gt;
    &lt;offer id="1005" price="5500"&gt;
        Ford Mustang, 1995, 150K highway mileage, no rust, 
        excellent condition
    &lt;/offer&gt;
&lt;/offers&gt;
        
</pre></div>
<p>In this sample tokenization, tokens are delimited by punctuation
and whitespace symbols.</p>
<ul>
<li>
<p>The token "Ford" is at relative position 1.</p>
</li>
<li>
<p>The token "Mustang" is at relative position 2.</p>
</li>
<li>
<p>The token "2000" is at relative position 3.</p>
</li>
<li>
<p>Relative position numbers are assigned sequentially through the
end of the document.</p>
</li>
</ul>
<p>Hence in this example each token occupies exactly one position,
and no overlapping of tokens occurs. The relative positions of
tokens are shown below in parentheses.</p>
<div class="exampleInner"><a name="SampleTokenizedDoc" id=
"SampleTokenizedDoc"></a>
<pre>
&lt;offers&gt;
    &lt;offer id="1000" price="10000"&gt;
        Ford(1) Mustang(2) 2000(3), 65K(4), excellent(5)
        condition(6), runs(7) great(8), AC(9), CC(10), 
        power(11) all(12)
    &lt;/offer&gt;
    &lt;offer id="1001" price="8000"&gt;
        Honda(13) Accord(14) 1999(15), 78K(16), A(17)/C(18),
        cruise(19) control(20), runs(21) and(22) looks(23)
        great(24), excellent(25) condition(26)
    &lt;/offer&gt;
    &lt;offer id="1005" price="5500"&gt;
        Ford(27) Mustang(28), 1995(29), 150K(30) highway(31)
        mileage(32), little(33)  rust(34), excellent(35) 
        condition(36)
    &lt;/offer&gt;
&lt;/offers&gt;
        
</pre></div>
<p>The relative positions of paragraphs are determined similarly.
In this sample tokenization, the paragraph delimiters are start
tags and end tags.</p>
<ul>
<li>
<p>The tokens in the first 'offer' element are assigned relative
paragraph number 1.</p>
</li>
<li>
<p>The tokens from the next 'offer' element are assigned relative
paragraph number 2.</p>
</li>
<li>
<p>Relative paragraph numbers are assigned sequentially through the
end of the document.</p>
</li>
</ul>
<p>The relative positions of sentences are determined similarly
using sentence delimiters.</p>
<p>Implementations may provide for the means to ignore or side-step
certain structural elements when performing tokenization. In the
following example, the implementation has decided to ignore the
markup for <code>&lt;bold&gt;</code> and prune out the entire
subtree headed by <code>&lt;deleted&gt;</code>.</p>
<div class="exampleInner">
<pre>
&lt;para&gt;&lt;deleted&gt;This sentence was deleted.&lt;/deleted&gt;
This &lt;bold&gt;entire paragraph&lt;/bold&gt; is one sentence
as far as the tokenizer is concerned.
&lt;/para&gt;
</pre></div>
<p>Using the same notation as before, this sample tokenization is
shown below. All the tokens marked with a token position also have
the same sentence and paragraph relative positions. Note that there
are no tokens marked for the ignored subtree.</p>
<div class="exampleInner">
<pre>
&lt;para&gt;&lt;deleted&gt;This sentence was deleted.&lt;/deleted&gt;
This(1) &lt;bold&gt;entire(2) paragraph(3)&lt;/bold&gt; is(4) one(5) sentence(6)
as(7) far(8) as(9) the(10) tokenizer(11) is(12) concerned(13).
&lt;/para&gt;
</pre></div>
</div>
</div>
<div class="xquery">
<div class="div3">
<h4><a name="TokenizationRepresentationsSec" id=
"TokenizationRepresentationsSec"></a>4.1.2 Representations of
Tokenized Text and Matching</h4>
<p>[<a name="QueryItemDef" id="QueryItemDef" title=
"QueryItem">Definition</a>: A <b>QueryItem</b> is a sequence of
<b>QueryTokenInfo</b>s representing the collection of tokens
derived from tokenizing one query string. ]</p>
<p>[<a name="QueryTokenInfoDef" id="QueryTokenInfoDef" title=
"QueryTokenInfo">Definition</a>: A <b>QueryTokenInfo</b> is the
identity of a token inside a query string. ] Each
<b>QueryTokenInfo</b> is associated with a 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>position</span>
that captures the relative position of the query string in the
query.</p>
<p>[<a name="TokenInfoDef" id="TokenInfoDef" title=
"TokenInfo">Definition</a>: A <b>TokenInfo</b> represents a
contiguous collection of tokens from an XML document. ] Each
<b>TokenInfo</b> is associated with:</p>
<ul>
<li>
<p><code>startPos</code>: the smallest starting position of a token
in the sequence</p>
</li>
<li>
<p><code>endPos</code>: the largest ending position of any token of
the sequence</p>
</li>
<li>
<p><code>startSent</code>: the relative position of the sentence
containing the token with the smallest starting position or zero if
the tokenizer does not report sentences</p>
</li>
<li>
<p><code>endSent</code>: the relative position of the sentence
containing the token with the largest ending position or zero if
the tokenizer does not report sentences</p>
</li>
<li>
<p><code>startPara</code>: the relative position of the paragraph
containing the token with the smallest starting position or zero if
the tokenizer does not report paragraphs</p>
</li>
<li>
<p><code>endPara</code>: the relative position of the paragraph
containing the token with the largest ending position or zero if
the tokenizer does not report paragraphs</p>
</li>
</ul>
<p>The following matching function is the central <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> primitive
performing the full-text retrieval.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:matchTokenInfos (
      $searchContext as item(),
      $matchOptions as element(fts:matchOptions),
      $stopWords as xs:string*,
      $queryTokens as element(fts:queryToken)* )
   as element(fts:tokenInfo)*  external;
            
</pre></div>
</div>
<p>The above function returns the <b>TokenInfo</b>s in items in
<code>$searchContext</code> that match the query string represented
by the sequence <code>$queryTokens</code>, when using the match
options in <code>$matchOptions</code> and stop words in
<code>$stopWords</code>. If <code>$queryTokens</code> is a sequence
of more than one query token, each returned <b>TokenInfo</b> must
represent a phrase matching that sequence.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>While this matching function assumes a tokenized representation
of the query strings, it does not assume a tokenized representation
of the input items in <code>$searchContext</code>, i.e. the texts
being searched. Hence, the tokenization of the search context is
implicit in this function and coupled to the retrieval of matches.
Of course, this does not imply that tokenization of the search
context cannot be done a priori. The tokenization of each item in
<code>$searchContext</code> does not necessarily take into account
the match options in <code>$matchOptions</code> or the query tokens
in <code>$queryTokens</code>. This allows implementations to
tokenize and index input data without the knowledge of particular
match options used in full-text queries.</p>
</div>
</div>
</div>
</div>
</div>
<div class="xquery">
<div class="div2">
<h3><a name="FTSelectionEvalSec" id="FTSelectionEvalSec"></a>4.2
Evaluation of FTSelections</h3>
<p>The XQuery 1.0 and XPath 2.0 Data Model is inadequate to support
fully composable <b>FTSelection</b>s. Full-text operations, such as
<b>FTSelection</b>s, operate on linguistic units, such as positions
of tokens, and which are not captured in the XQuery 1.0 and XPath
2.0 Data Model (XDM).</p>
<p>XQuery and XPath Full Text adds relative token, sentence, and
paragraph position numbers via <b>AllMatches</b>. <b>AllMatches</b>
make <b>FTSelection</b>s fully composable.</p>
<div class="xquery">
<div class="div3">
<h4><a name="AllMatchesSec" id="AllMatchesSec"></a>4.2.1
AllMatches</h4>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-formalmodel" id="tq-ft-formalmodel"></a>4.2.1.1
Formal Model</h5>
<p>[<a name="AllMatchesDef" id="AllMatchesDef" title=
"AllMatches">Definition</a>: An <b>AllMatches</b> describes the
possible results of an <b>FTSelection</b>.] The UML Static Class
diagram of <b>AllMatches</b> is shown on the diagram given
below.</p>
<img src="images/AllMatchesClassDiagram.png" alt=
"AllMatches class diagram" />
<p>The <b>AllMatches</b> object contains zero or more
<b>Match</b>es.</p>
<p>[<a name="MatchDef" id="MatchDef" title="Match">Definition</a>:
Each <b>Match</b> describes one result to the <b>FTSelection</b>.]
The result is described in terms of zero or more
<b>StringInclude</b>s and zero or more <b>StringExclude</b>s.</p>
<p>[<a name="StringMatchDef" id="StringMatchDef" title=
"StringMatch">Definition</a>: A <b>StringMatch</b> is a possible
match of a sequence of query tokens with a corresponding sequence
of tokens in a document. A StringMatch may be a
<b>StringInclude</b> or <b>StringExclude</b>.] The <b>queryPos</b>
attribute specifies the position of the query token in the query.
This attribute is needed for <b>FTOrder</b>s. The matched document
token sequence is described in the <b>TokenInfo</b> associated with
the <b>StringMatch</b>.</p>
<p>[<a name="StringIncludeDef" id="StringIncludeDef" title=
"StringInclude">Definition</a>: A <b>StringInclude</b> is a
<b>StringMatch</b> that describes a <b>TokenInfo</b> that must be
contained in the document.]</p>
<p>[<a name="StringExcludeDef" id="StringExcludeDef" title=
"StringExclude">Definition</a>: A <b>StringExclude</b> is a
<b>StringMatch</b> that describes a <b>TokenInfo</b> that must not
be contained in the document.]</p>
<p>Intuitively, <b>AllMatches</b> specifies the <b>TokenInfo</b>s
that a search context item contains and does not contain to satisfy
an <b>FTSelection</b>.</p>
<p>The <b>AllMatches</b> structure resembles the Disjunctive Normal
Form (DNF) in propositional and first-order logic. The
<b>AllMatches</b> is a disjunction of <b>Match</b>es. Each
<b>Match</b> is a conjunction of <b>StringInclude</b>s, and
<b>StringExclude</b>s.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-AllMatches-examples" id=
"tq-ft-AllMatches-examples"></a>4.2.1.2 Examples</h5>
<p>Since in most of the examples below the tokens span only a
single position, we characterize the <b>TokenInfo</b> instance by
simply giving this position, written as "Pos:X". This should be
read as the value for both, the <code>startPos</code> and the
<code>endPos</code> attribute. Furthermore, for expository reasons,
we include in each <b>StringMatch</b> example an attribute "query
string", set to the original query string, in order to facilitate
the association from which query string that match came from.</p>
<p>The simplest example of an <b>FTSelection</b> is an
<b>FTWords</b> such as <code>"Mustang"</code>. The
<b>AllMatches</b> corresponding to this <b>FTWords</b> is given
below.</p>
<img src="images/SampleAllMatches1.jpg" alt="Sample AllMatches" />
<p>As shown, the <b>AllMatches</b> consists of two <b>Match</b>es.
Each <b>Match</b> represents one possible result of the
<b>FTWords</b> <code>"Mustang"</code>. The result represented by
the first <b>Match</b>, represented as a <b>StringInclude</b>,
contains the token "Mustang" at position 2. The result described by
the second <b>Match</b> contains the token "Mustang" at position
28.</p>
<p>A more complex example of an <b>FTSelection</b> is an
<b>FTWords</b> such as <code>"Ford Mustang"</code>. The
<b>AllMatches</b> for this <b>FTWords</b> is given below.</p>
<img src="images/SampleAllMatches2.jpg" alt="Sample AllMatches" />
<p>There are two possible results for this <b>FTWords</b>, and
these are represented by the two <b>Match</b>es. Each of the
<b>Match</b>es requires two tokens to be matched. The first
<b>Match</b> is obtained by matching "Ford" at position 1 and
matching "Mustang" at position 2. Similarly, the second
<b>Match</b> is obtained by matching "Ford" at position 27 and
"Mustang" at position 28.</p>
<p>An even more complex example of an <b>FTSelection</b> is an
<b>FTSelection</b> such as <code>"Mustang" ftand ftnot
"rust"</code> that searches for "Mustang" but not "rust". The
<b>AllMatches</b> for this <b>FTSelection</b> is given below.</p>
<img src="images/SampleAllMatches3.jpg" alt="Sample AllMatches" />
<p>This example introduces <b>StringExclude</b>.
<b>StringExclude</b> corresponds to negation in DNF (Disjunctive
Normal Form). It specifies that the result described by the
corresponding <b>Match</b> must not match the token at the
specified position. In this example, the first <b>Match</b>
specifies that "Mustang" is matched at position 2, and that the
token "rust" at position 34 is not matched.</p>
</div>
</div>
<div class="div4">
<h5><a name="tq-ft-XML-representation" id=
"tq-ft-XML-representation"></a>4.2.1.3 XML representation</h5>
<p><b>AllMatches</b> has a well-defined hierarchical structure.
Therefore, the <b>AllMatches</b> can be easily modeled in XML. This
XML representation and those which follow formally describe the
semantics of <b>FTSelection</b>s. For example, the XML
representation of <b>AllMatches</b> formally specifies how an
<b>FTSelection</b> operates on zero or more <b>AllMatches</b> to
produce a resulting <b>AllMatches</b>.</p>
<p>The XML schema for representing <b>AllMatches</b> is given
below.</p>
<div class="semfunc-file-allmatches-xsd">
<div class="exampleInner">
<pre>
&lt;xs:schema 
     xmlns:xs="http://www.w3.org/2001/XMLSchema" 
     xmlns:fts="http://www.w3.org/2007/xpath-full-text"
     targetNamespace="http://www.w3.org/2007/xpath-full-text"
     elementFormDefault="qualified" 
     attributeFormDefault="unqualified"&gt;

  &lt;xs:complexType name="allMatches"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element ref="fts:match" 
                  minOccurs="0" 
                  maxOccurs="unbounded"/&gt;
    &lt;/xs:sequence&gt;
    &lt;xs:attribute name="stokenNum" type="xs:integer" use="required" /&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="allMatches" type="fts:allMatches"/&gt;

  &lt;xs:complexType name="match"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element ref="fts:stringInclude" 
                  minOccurs="0" 
                  maxOccurs="unbounded"/&gt;
      &lt;xs:element ref="fts:stringExclude" 
                  minOccurs="0" 
                  maxOccurs="unbounded"/&gt;
   &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:element name="stringInclude" 
              type="fts:stringMatch" /&gt;

  &lt;xs:element name="stringExclude" 
              type="fts:stringMatch" /&gt;

  &lt;xs:element name="match" type="fts:match"/&gt;

  &lt;xs:complexType name="stringMatch"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element ref="fts:tokenInfo"/&gt;
    &lt;/xs:sequence&gt;
    &lt;xs:attribute name="queryPos" 
                  type="xs:integer" 
                  use="required"/&gt;
    &lt;xs:attribute name="isContiguous" 
                  type="xs:boolean" 
                  use="required"/&gt;  
  &lt;/xs:complexType&gt;

  &lt;xs:complexType name="tokenInfo"&gt;
    &lt;xs:attribute name="startPos" 
                  type="xs:integer" 
                  use="required"/&gt;
    &lt;xs:attribute name="endPos" 
                  type="xs:integer" 
                  use="required"/&gt;
    &lt;xs:attribute name="startSent" 
                  type="xs:integer" 
                  use="required"/&gt;
    &lt;xs:attribute name="endSent" 
                  type="xs:integer" 
                  use="required"/&gt;
    &lt;xs:attribute name="startPara" 
                  type="xs:integer" 
                  use="required"/&gt;
    &lt;xs:attribute name="endPara" 
                  type="xs:integer" 
                  use="required"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="tokenInfo" type="fts:tokenInfo"/&gt;

  &lt;xs:complexType name="queryItem"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element ref="fts:queryToken" 
                  minOccurs="0" 
                  maxOccurs="unbounded"/&gt;
   &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:complexType name="queryTokenInfo"&gt;
    &lt;xs:attribute name="word" 
                  type="xs:string" 
                  use="required"/&gt;
    &lt;xs:attribute name="queryPos" 
                  type="xs:integer" 
                  use="required"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="queryToken" type="fts:queryTokenInfo"/&gt;
&lt;/xs:schema&gt;
                
</pre></div>
</div>
<p>The <code>stokenNum</code> attribute in <b>AllMatches</b> is
related to the representation of the semantics as XQuery functions.
Therefore, it is not considered part of the <b>AllMatches</b>
model. The <code>stokenNum</code> attribute stores the number of
query tokens used when evaluating the <b>AllMatches</b>. This value
is used to compute the correct value for the <code>queryPos</code>
attribute in new <b>StringMatch</b>es.</p>
</div>
</div>
</div>
<div class="xquery">
<div class="div3">
<h4><a name="FTSelectionsXMLSec" id="FTSelectionsXMLSec"></a>4.2.2
XML Representation</h4>
<p><b>FTSelection</b>s are fully composable and may be nested
arbitrarily under other <b>FTSelection</b>s. Each
<b>FTSelection</b> may be associated with match options (such as
stemming and stop words) and score weights. Since score weights are
solely interpreted by the formal semantics scoring function, they
do not influence the semantics of <b>FTSelection</b>s. Therefore,
score weights are not considered in the formal semantics.</p>
<p>The XML structures defined by the following schema represent
<b>FTSelection</b>s within the semantic functions of section
<a href="#tq-semantics"><b>4 Semantics</b></a>. This representation
is used for definitional purposes only and should not be confused
with the XML representation for queries in Appendix <a href=
"#id-xqft-xqueryx"><b>E XML Syntax (XQueryX) for XQuery and XPath
Full Text 1.0</b></a>. Every <b>FTSelection</b> is represented as
an XML element. Every nested <b>FTSelection</b> is represented as a
nested descendant element. For binary <b>FTSelection</b>s, e.g.,
<b>FTAnd</b>, the nested <b>FTSelection</b>s are represented in
<code>&lt;left&gt;</code> and <code>&lt;right&gt;</code> descendant
elements. For unary <b>FTSelection</b>s, a
<code>&lt;selection&gt;</code> descendant element is used.
Additional characteristics of <b>FTSelection</b>s, e.g., the
distance unit for <b>FTDistance</b>, are stored in attributes.</p>
<div class="semfunc-file-ftselection-xsd">
<div class="exampleInner">
<pre>
&lt;xs:schema
     xmlns:xs="http://www.w3.org/2001/XMLSchema" 
     xmlns:fts="http://www.w3.org/2007/xpath-full-text"
     targetNamespace="http://www.w3.org/2007/xpath-full-text"
     elementFormDefault="qualified" 
     attributeFormDefault="unqualified"&gt;
           
  &lt;xs:include schemaLocation="AllMatches.xsd" /&gt;
  &lt;xs:include schemaLocation="MatchOptions.xsd" /&gt;

  &lt;xs:complexType name="ftSelection"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:choice&gt;
        &lt;xs:element name="ftWords" type="fts:ftWords"/&gt;
        &lt;xs:element name="ftAnd" type="fts:ftAnd"/&gt;
        &lt;xs:element name="ftOr" type="fts:ftOr"/&gt;
        &lt;xs:element name="ftUnaryNot" type="fts:ftUnaryNot"/&gt;
        &lt;xs:element name="ftMildNot" type="fts:ftMildNot"/&gt;
        &lt;xs:element name="ftOrder" type="fts:ftOrder"/&gt;
        &lt;xs:element name="ftScope" type="fts:ftScope"/&gt;
        &lt;xs:element name="ftContent" type="fts:ftContent"/&gt;
        &lt;xs:element name="ftDistance" type="fts:ftDistance"/&gt;
        &lt;xs:element name="ftWindow" type="fts:ftWindow"/&gt;
        &lt;xs:element name="ftTimes" type="fts:ftTimes"/&gt;
      &lt;/xs:choice&gt;
      &lt;xs:element ref="fts:matchOptions" 
                  minOccurs="0"/&gt;
      &lt;xs:element name="weight" 
                  type="xs:double" 
                  minOccurs="0"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="selection" type="fts:ftSelection"/&gt;

  &lt;xs:complexType name="ftWords"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element ref="fts:queryItem" 
                  minOccurs="0" 
                  maxOccurs="unbounded"/&gt;
    &lt;/xs:sequence&gt;
    &lt;xs:attribute name="type" 
                  type="fts:ftWordsType" 
                  use="required"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="queryItem" type="fts:queryItem"/&gt;
  
  &lt;xs:complexType name="ftAnd"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="left" type="fts:ftSelection"/&gt;
      &lt;xs:element name="right" type="fts:ftSelection"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ftOr"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="left" type="fts:ftSelection"/&gt;
      &lt;xs:element name="right" type="fts:ftSelection"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ftUnaryNot"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="selection" type="fts:ftSelection"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ftMildNot"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="left" type="fts:ftSelection"/&gt;
      &lt;xs:element name="right" type="fts:ftSelection"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ftOrder"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="selection" type="fts:ftSelection"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ftScope"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="selection" type="fts:ftSelection"/&gt;
    &lt;/xs:sequence&gt;
    &lt;xs:attribute name="type" 
                  type="fts:scopeType" 
                  use="required"/&gt;
    &lt;xs:attribute name="scope" 
                  type="fts:scopeSelector" 
                  use="required"/&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ftContent"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="selection" type="fts:ftSelection"/&gt;
    &lt;/xs:sequence&gt;
    &lt;xs:attribute name="type" 
                  type="fts:contentMatchType" 
                  use="required"/&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ftDistance"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="range" type="fts:ftRangeSpec"/&gt;
      &lt;xs:element name="selection" type="fts:ftSelection"/&gt;
    &lt;/xs:sequence&gt;
    &lt;xs:attribute name="type" 
                  type="fts:distanceType" 
                  use="required"/&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ftWindow"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="selection" type="fts:ftSelection"/&gt;
    &lt;/xs:sequence&gt;
    &lt;xs:attribute name="size" 
                  type="xs:integer" 
                  use="required"/&gt;
    &lt;xs:attribute name="type" 
                  type="fts:distanceType" 
                  use="required"/&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ftTimes"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="range" type="fts:ftRangeSpec"/&gt;
      &lt;xs:element name="selection" type="fts:ftWords"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
    
  &lt;xs:simpleType name="ftWordsType"&gt;
    &lt;xs:restriction base="xs:string"&gt;
      &lt;xs:enumeration value="any"/&gt;
      &lt;xs:enumeration value="all"/&gt;
      &lt;xs:enumeration value="phrase"/&gt;
      &lt;xs:enumeration value="any word"/&gt;
      &lt;xs:enumeration value="all word"/&gt;
    &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  
  &lt;xs:simpleType name="scopeType"&gt;
    &lt;xs:restriction base="xs:string"&gt;
      &lt;xs:enumeration value="same"/&gt;
      &lt;xs:enumeration value="different"/&gt;
    &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  
  &lt;xs:simpleType name="scopeSelector"&gt;
    &lt;xs:restriction base="xs:string"&gt;
      &lt;xs:enumeration value="paragraph"/&gt;
      &lt;xs:enumeration value="sentence"/&gt;
    &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  
  &lt;xs:simpleType name="distanceType"&gt;
    &lt;xs:restriction base="xs:string"&gt;
      &lt;xs:enumeration value="paragraph"/&gt;
      &lt;xs:enumeration value="sentence"/&gt;
      &lt;xs:enumeration value="word"/&gt;
    &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  
  &lt;xs:simpleType name="contentMatchType"&gt;
    &lt;xs:restriction base="xs:string"&gt;
      &lt;xs:enumeration value="at start"/&gt;
      &lt;xs:enumeration value="at end"/&gt;
      &lt;xs:enumeration value="entire content"/&gt;
    &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
&lt;/xs:schema&gt;
            
</pre></div>
</div>
</div>
</div>
<div class="xquery">
<div class="div3">
<h4><a name="tq-ft-evaluate-function" id=
"tq-ft-evaluate-function"></a>4.2.3 The <code>evaluate</code>
function</h4>
<p>The semantics for the evaluation of <b>FTSelection</b>s is
defined using the <code>fts:evaluate</code> function. The function
takes three parameters: (1) an <b>FTSelection</b>, 2) a search
context item, and 3) the default set of match options that apply to
the evaluation of the <b>FTSelection</b>.</p>
<p>The <code>fts:evaluate</code> function returns the
<b>AllMatches</b> that is the result of evaluating the
<b>FTSelection</b>. When <code>fts:evaluate</code> is applied to
some <b>FTSelection</b> X, it calls the function
<code>fts:ApplyX</code> to build the resulting <b>AllMatches</b>.
If X is applied on nested <b>FTSelection</b>s, the
<code>fts:evaluate</code> function is recursively called on these
nested <b>FTSelection</b>s and the returned <b>AllMatches</b> are
used in the evaluation of <code>fts:ApplyX</code>.</p>
<p>The semantics for the <code>fts:evaluate</code> function is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:evaluate (
      $ftSelection as element(*, fts:ftSelection), 
      $searchContext as item(),
      $matchOptions as element(fts:matchOptions),
      $queryTokenNum as xs:integer )
   as element(fts:allMatches)
{
   if (fn:count($ftSelection/fts:matchOptions) &gt; 0) then 
      (: First we deal with all match options that the    :)
      (: FTSelection might bear: we add the match options :)
      (: to the current match options structure, and      :)
      (: pass the new structure to the recursive call.    :)
      let $newFTSelection := 
         &lt;fts:selection&gt;{$ftSelection/*
                           [fn:not(self::fts:matchOptions)]}&lt;/fts:selection&gt;
      return fts:evaluate($newFTSelection, 
                          $searchContext, 
                          fts:replaceMatchOptions($matchOptions, 
                                              $ftSelection/fts:matchOptions),
                          $queryTokenNum)
   else if (fn:count($ftSelection/fts:weight) &gt; 0) then
      (: Weight has no bearing on semantics -- just :)
      (: call "evaluate" on nested FTSelection     :)
      let $newFTSelection := $ftSelection/*[fn:not(self::fts:weight)]
      return fts:evaluate($newFTSelection, 
                          $searchContext, 
                          $matchOptions,
                          $queryTokenNum)
   else
      typeswitch ($ftSelection/*[1]) 
         case $nftSelection as element(fts:ftWords) return
            (: Apply the FTWords in the search context :)
            fts:ApplyFTWords($searchContext,
                             $matchOptions,
                             $nftSelection/@type,
                             $nftSelection/fts:queryItem,
                             $queryTokenNum + 1)
         case $nftSelection as element(fts:ftAnd) return
            let $left := fts:evaluate($nftSelection/fts:left,
                                     $searchContext,
                                     $matchOptions,
                                     $queryTokenNum)
            let $newQueryTokenNum := $left/@stokenNum
            let $right := fts:evaluate($nftSelection/fts:right,
                                      $searchContext,
                                      $matchOptions,
                                      $newQueryTokenNum)
            return fts:ApplyFTAnd($left, $right)
         case $nftSelection as element(fts:ftOr) return
            let $left := fts:evaluate($nftSelection/fts:left,
                                     $searchContext,
                                     $matchOptions,
                                     $queryTokenNum)
            let $newQueryTokenNum := $left/@stokenNum
            let $right := fts:evaluate($nftSelection/fts:right,
                                      $searchContext,
                                      $matchOptions,
                                      $newQueryTokenNum)
            return fts:ApplyFTOr($left, $right)
         case $nftSelection as element(fts:ftUnaryNot) return
            let $nested := fts:evaluate($nftSelection/fts:selection,
                                        $searchContext,
                                        $matchOptions,
                                        $queryTokenNum)
            return fts:ApplyFTUnaryNot($nested)
         case $nftSelection as element(fts:ftMildNot) return
            let $left := fts:evaluate($nftSelection/fts:left,
                                     $searchContext,
                                     $matchOptions,
                                     $queryTokenNum)
            let $newQueryTokenNum := $left/@stokenNum
            let $right := fts:evaluate($nftSelection/fts:right,
                                      $searchContext,
                                      $matchOptions,
                                      $newQueryTokenNum)
            return fts:ApplyFTMildNot($left, $right)
         case $nftSelection as element(fts:ftOrder) return
            let $nested := fts:evaluate($nftSelection/fts:selection,
                                        $searchContext,
                                        $matchOptions,
                                        $queryTokenNum)
            return fts:ApplyFTOrder($nested)
         case $nftSelection as element(fts:ftScope) return
            let $nested := fts:evaluate($nftSelection/fts:selection,
                                        $searchContext,
                                        $matchOptions,
                                        $queryTokenNum)
            return fts:ApplyFTScope($nftSelection/@type, 
                                    $nftSelection/@scope,
                                    $nested)
         case $nftSelection as element(fts:ftContent) return
            let $nested := fts:evaluate($nftSelection/fts:selection,
                                        $searchContext,
                                        $matchOptions,
                                        $queryTokenNum)
            return fts:ApplyFTContent($searchContext,
                                      $nftSelection/@type, 
                                      $nested)
         case $nftSelection as element(fts:ftDistance) return
            let $nested := fts:evaluate($nftSelection/fts:selection,
                                        $searchContext,
                                        $matchOptions,
                                        $queryTokenNum)
            return fts:ApplyFTDistance($nftSelection/@type,
                                       $nftSelection/fts:range,
                                       $nested)
         case $nftSelection as element(fts:ftWindow) return
            let $nested := fts:evaluate($nftSelection/fts:selection,
                                        $searchContext,
                                        $matchOptions,
                                        $queryTokenNum)
            return fts:ApplyFTWindow($nftSelection/@type,
                                     $nftSelection/@size,
                                     $nested)
         case $nftSelection as element(fts:ftTimes) return
            let $nested := fts:evaluate($nftSelection/fts:selection,
                                        $searchContext,
                                        $matchOptions,
                                        $queryTokenNum)
            return fts:ApplyFTTimes($nftSelection/fts:range,
                                    $nested)
         default return &lt;fts:allMatches stokenNum="0" /&gt;
};
            
</pre></div>
</div>
<p>For concreteness, assume that the <b>FTSelection</b> was invoked
inside an <code>contains text</code> expression such as
<code>searchContext contains text ftSelection</code>. In order to
determine the <b>AllMatches</b> result of <code>ftSelection</code>,
the <code>fts:evaluate</code> function is invoked as follows:
<code>fts:evaluate($ftSelection, $searchContext, $matchOptions,
0)</code>, where <code>$ftSelection</code> is the XML
representation of the <code>ftSelection</code> and
<code>$searchContext</code> is bound to the result of the
evaluation of the XQuery expression <code>searchContext</code>.</p>
<p>Initially, the <code>$queryTokensNum</code> is 0, i.e., no query
tokens have been processed.</p>
<p>The variable <code>$matchOptions</code> is bound to the list of
match options as defined in the static context (see Appendix
<a href="#id-xqft-static-context-components"><b>C Static Context
Components</b></a>). Match options embedded in
<code>$ftSelection</code> modify the match options collection as
evaluation proceeds.</p>
<p>Given the invocation of: <code>fts:evaluate($ftSelection,
$searchContext, $matchOptions)</code>, evaluation proceeds as
follows. First, <code>$ftSelection</code> is checked to see whether
1) it contains a match option, 2) it contains a weight
specification, 3) it is an <b>FTWords</b>, or 4) none of the above
hold.</p>
<ol class="enumar">
<li>
<p>If <code>$ftSelection</code> contains one or more match options,
these are combined with the inherited match options via a call to
<code>fts:replaceMatchOptions</code> (see <a href=
"#FTMatchOptionsSec"><b>4.2.5 Match Options Semantics</b></a>). The
<code>evaluate</code> function is then invoked on the nested
<b>FTSelection</b> with the new set of match options, and the
result of that call is returned.</p>
</li>
<li>
<p>If <code>$ftSelection</code> contains a weight specification,
then the specification is ignored because it does not alter the
semantics. The <code>evaluate</code> function is recursively called
on the nested <b>FTSelection</b> and the resulting
<b>AllMatches</b> is returned.</p>
</li>
<li>
<p>If <code>$ftSelection</code> is an <b>FTWords</b>, then it does
not have any nested <b>FTSelection</b>s. Consequently, this is the
base of the recursive call, and the <b>AllMatches</b> result of the
<b>FTWords</b> is computed and returned. The <b>AllMatches</b> is
computed by invoking the <code>ApplyFTWords</code> function with
the current search context and other necessary information.</p>
</li>
<li>
<p>If <code>$ftSelection</code> contains neither a match option nor
a weight specification and is not an <b>FTWords</b>, the
<b>FTSelection</b> performs a full-text operation, such as
<code>ftand</code>, <code>ftor</code>, <code>window</code>. These
operations are fully-compositional and may be invoked on nested
<b>FTSelection</b>s. Consequently, evaluation proceeds as
follows.</p>
<ul>
<li>
<p>First, the <code>evaluate</code> function is recursively invoked
on each nested <b>FTSelection</b>. The result of evaluating each
nested <b>FTSelection</b> is an <b>AllMatches</b>.</p>
</li>
<li>
<p>The <b>AllMatches</b> are transformed into the resulting
<b>AllMatches</b> by applying the full-text operation corresponding
to <code>FTSelection1</code> which is generically named
<code>applyX</code> for some type of <b>FTSelection</b> X in the
code.</p>
</li>
</ul>
<p>For example, let <code>FTSelection1</code> be <code>FTSelection2
ftand FTSelection3</code> . Here <code>FTSelection2</code> and
<code>FTSelection3</code> may themselves be arbitrarily nested
<b>FTSelection</b>s. Thus, <code>evaluate</code> is invoked on
<code>FTSelection2</code> and <code>FTSelection3</code>, and the
resulting <b>AllMatches</b> are transformed to the final
<b>AllMatches</b> using the <code>ApplyFTAnd</code> function
corresponding to <code>ftand</code> .</p>
</li>
</ol>
<p>The semantics of the <code>ApplyX</code> function for each
<b>FTSelection</b> kind X is given below.</p>
</div>
</div>
<div class="xquery">
<div class="div3">
<h4><a name="tq-ft-fs-FTWords" id="tq-ft-fs-FTWords"></a>4.2.4
FTWords</h4>
<p>An <b>FTWords</b> that consists of a single query string
consisting of a sequence of token to be matched as a phrase is
evaluated by the <code>applyQueryTokensAsPhrase</code> function.
Its parameters are 1) the search context, 2) the list of match
options, 3) the query string to be matched as a sequence of
<code>fts:queryToken</code> items, and 4) the position where the
latter query string occurs in the query.</p>
<div class="semfunc-file-ftssimple-xquery">
<div class="exampleInner">
<pre>
(: simplified version not dealing with special match options :)
declare function fts:applyQueryTokensAsPhrase (
      $searchContext as item(),
      $matchOptions as element(fts:matchOptions),
      $queryTokens as element(fts:queryToken)*,
      $queryPos as xs:integer )
   as element(fts:allMatches)
{
   &lt;fts:allMatches stokenNum="{$queryPos}"&gt; 
   {
      for $tokenInfo in
         fts:matchTokenInfos( 
            $searchContext,
            $matchOptions,
            (),
            $queryTokens )
      return  
         &lt;fts:match&gt;  
            &lt;fts:stringInclude queryPos="{$queryPos}" isContiguous="true"&gt; 
            {$tokenInfo}
            &lt;/fts:stringInclude&gt; 
         &lt;/fts:match&gt;
   } 
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>If after the application of all the match options, the sequence
of query tokens returned for an <b>FTWords</b> is empty, an empty
<b>AllMatches</b> is returned.</p>
<p>The <b>AllMatches</b> corresponding to an <b>FTWords</b> is a
set of <b>Match</b>es. Each of the <b>Match</b>es is associated
with a starting and an ending position indicating where the
corresponding query tokens were found. For example, the
<b>AllMatches</b> result for the <b>FTWords</b> "Mustang" is given
below. To simplify the presentation in the figures we write
<code>Pos: N</code>, if the attributes <code>startPos</code> and
<code>endPos</code> are the same with <code>N</code> being that
position.</p>
<img src="images/FTWordEx.jpg" alt="FTWords example" />
<p>There are five variations of <b>FTWords</b> depending on how the
tokens and phrases in the nested XQuery 1.0 and XPath 2.0
expression are matched.</p>
<ul>
<li>
<p>When <code>any word</code> is specified, at least one token in
the tokenization of the nested expression must be matched.</p>
</li>
<li>
<p>When <code>all word</code> is specified, all tokens in the
tokenization of the nested expression must be matched.</p>
</li>
<li>
<p>When <code>phrase</code> is specified, all tokens in the
tokenization of the nested expression must be matched as a
phrase.</p>
</li>
<li>
<p>When <code>any</code> is specified, at least one string atomic
value in the nested expression must be matched as a phrase.</p>
</li>
<li>
<p>When <code>all</code> is specified, all string atomic values in
the nested expression must be matched as a phrase.</p>
</li>
</ul>
<p>The semantics for <b>FTWords</b> when <code>any word</code> is
specified is given below. Since <b>FTWords</b> does not have nested
<b>FTSelection</b>s, the <code>ApplyFTWords</code> function does
not take <b>AllMatches</b> parameters corresponding to nested
<b>FTSelection</b> results.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:MakeDisjunction (
      $curRes as element(fts:allMatches),
      $rest as element(fts:allMatches)* ) 
   as element(fts:allMatches) 
{
   if (fn:count($rest) = 0)
   then $curRes
   else 
      let $firstAllMatches := $rest[1]
      let $restAllMatches := fn:subsequence($rest, 2)
      let $newCurRes := fts:ApplyFTOr($curRes, 
                                      $firstAllMatches)
      return fts:MakeDisjunction($newCurRes, 
                                 $restAllMatches)
};

declare function fts:ApplyFTWordsAnyWord (
      $searchContext as item(), 
      $matchOptions as element(fts:matchOptions), 
      $queryItems as element(fts:queryItem)*,
      $queryPos as xs:integer ) 
   as element(fts:allMatches) 
{
   (: Tokenization of query string has already occurred. :)
   (: Get sequence of QueryTokens over all query items. :)
   let $queryTokens := $queryItems/fts:queryToken
   return
      if (fn:count($queryTokens) eq 0) 
      then &lt;fts:allMatches stokenNum="0" /&gt;
      else
         let $allAllMatches := 
            for $queryToken at $pos in $queryTokens
            return fts:applyQueryTokensAsPhrase($searchContext,
                                                 $matchOptions,
                                                 $queryToken,
                                                 $queryPos + $pos - 1)
         let $firstAllMatches := $allAllMatches[1]
         let $restAllMatches := fn:subsequence($allAllMatches, 2)
         return fts:MakeDisjunction($firstAllMatches, $restAllMatches)
};
</pre></div>
</div>
<p>The tokenized query strings are passed to ApplyFTWordsAnyWord as
a sequence of <code>fts:queryItem</code>, each containing the
tokens of a single query string. A single flattened sequence of all
tokens (of type <code>fts:queryToken</code>) over all query items
is constructed. For each of these, the result of <b>FTWords</b> is
computed using <code>applyQueryTokensAsPhrase</code>. Finally, the
disjunction of all resulting <b>AllMatches</b> is computed.</p>
<p>The semantics for <b>FTWords</b> when <code>all word</code> is
specified is similar to the above, however composes a conjunction.
It is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:MakeConjunction ( 
      $curRes as element(fts:allMatches),
      $rest as element(fts:allMatches)* ) 
   as element(fts:allMatches)
{
   if (fn:count($rest) = 0)
   then $curRes
   else 
      let $firstAllMatches := $rest[1]
      let $restAllMatches := fn:subsequence($rest, 2)
      let $newCurRes := fts:ApplyFTAnd($curRes, 
                                       $firstAllMatches)
      return fts:MakeConjunction($newCurRes, 
                                 $restAllMatches)
};

declare function fts:ApplyFTWordsAllWord (
      $searchContext as item(), 
      $matchOptions as element(fts:matchOptions), 
      $queryItems as element(fts:queryItem)*,
      $queryPos as xs:integer ) 
   as element(fts:allMatches) 
{
   (: Tokenization of query strings has already occurred. :)
   (: Get sequence of QueryTokens over all query items :)
   let $queryTokens := $queryItems/fts:queryToken
   return
      if (fn:count($queryTokens) eq 0) 
      then &lt;fts:allMatches stokenNum="0" /&gt;
      else
         let $allAllMatches := 
            for $queryToken at $pos in $queryTokens
            return fts:applyQueryTokensAsPhrase($searchContext,
                                                 $matchOptions,
                                                 $queryToken,
                                                 $queryPos + $pos - 1)
            let $firstAllMatches := $allAllMatches[1]
            let $restAllMatches := fn:subsequence($allAllMatches, 2)
            return fts:MakeConjunction($firstAllMatches, $restAllMatches)
};
</pre></div>
</div>
<p>The semantics for <b>FTWords</b> if <code>phrase</code> is
specified is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWordsPhrase (
      $searchContext as item(), 
      $matchOptions as element(fts:matchOptions), 
      $queryItems as element(fts:queryItem)*,
      $queryPos as xs:integer ) 
   as element(fts:allMatches) 
{
   (: Get sequence of QueryTokenInfos over all query items :)
   let $queryTokens := $queryItems/fts:queryToken
   return
      if (fn:count($queryTokens) eq 0) 
      then &lt;fts:allMatches stokenNum="0" /&gt;
      else
         fts:applyQueryTokensAsPhrase($searchContext,
                                       $matchOptions,
                                       $queryTokens,
                                       $queryPos)
};
</pre></div>
</div>
<p>The <code>ApplyFTWordsPhrase</code> function also flattens the
sequence of query items to a sequence of query tokens, but then
calls <code>applyQueryTokensAsPhrase</code> on that entire
sequence, instead of calling it on each query token individually.
Hence, the sequence of all query tokens is matched as a single
phrase and the computed <b>TokenInfo</b>s are returned.</p>
<p>The semantics for <b>FTWords</b> when <code>any</code> is
specified is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWordsAny (
      $searchContext as item(), 
      $matchOptions as element(fts:matchOptions), 
      $queryItems as element(fts:queryItem)*,
      $queryPos as xs:integer ) 
   as element(fts:allMatches) 
{
   if (fn:count($queryItems) eq 0) 
   then &lt;fts:allMatches stokenNum="0" /&gt;
   else 
      let $firstQueryItem := $queryItems[1]
      let $restQueryItem := fn:subsequence($queryItems, 2)
      let $firstAllMatches := 
         fts:ApplyFTWordsPhrase($searchContext,
                                $matchOptions,
                                $firstQueryItem,
                                $queryPos)
      let $newQueryPos := 
         if ($firstAllMatches//@queryPos) 
         then fn:max($firstAllMatches//@queryPos) + 1
         else $queryPos
      let $restAllMatches :=
         fts:ApplyFTWordsAny($searchContext,
                             $matchOptions,
                             $restQueryItem,
                             $newQueryPos)
      return fts:ApplyFTOr($firstAllMatches, $restAllMatches)
};
</pre></div>
</div>
<p>The <b>FTWords</b> with <code>any</code> specified forms the
disjunction of the <b>AllMatches</b> that are the result of the
matching of each query item as a phrase.</p>
<p>The semantics for <b>FTWords</b> when <code>all</code> is
specified is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWordsAll (
      $searchContext as item(), 
      $matchOptions as element(fts:matchOptions), 
      $queryItems as element(fts:queryItem)*,
      $queryPos as xs:integer ) 
   as element(fts:allMatches) 
{
   if (fn:count($queryItems) = 0) 
   then &lt;fts:allMatches stokenNum="0" /&gt;
   else 
      let $firstQueryItem := $queryItems[1]
      let $restQueryItem := fn:subsequence($queryItems, 2)
      let $firstAllMatches := 
         fts:ApplyFTWordsPhrase($searchContext,
                                $matchOptions,
                                $firstQueryItem,
                                $queryPos)
      return
         if ($restQueryItem) then
            let $newQueryPos := 
               if ($firstAllMatches//@queryPos) 
               then fn:max($firstAllMatches//@queryPos) + 1
               else $queryPos
            let $restAllMatches :=
               fts:ApplyFTWordsAll($searchContext,
                                   $matchOptions,
                                   $restQueryItem,
                                   $newQueryPos)
            return 
               fts:ApplyFTAnd($firstAllMatches, $restAllMatches)
         else $firstAllMatches
};
</pre></div>
</div>
<p>The difference between <code>all</code> and <code>any</code> is
the use of conjunction instead of disjunction.</p>
<p>The <code>ApplyFTWords</code> function combines all of these
functions.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWords ( 
      $searchContext as item(),
      $matchOptions as element(fts:matchOptions),
      $type as fts:ftWordsType,
      $queryItems as element(fts:queryItem)*, 
      $queryPos as xs:integer )
   as element(fts:allMatches) 
{
   if ($type eq "any word")
   then fts:ApplyFTWordsAnyWord($searchContext,
                                $matchOptions,
                                $queryItems,
                                $queryPos)
   else if ($type eq "all word")
   then fts:ApplyFTWordsAllWord($searchContext,
                                $matchOptions,
                                $queryItems,
                                $queryPos)
   else if ($type eq "phrase")
   then fts:ApplyFTWordsPhrase($searchContext,
                               $matchOptions,
                               $queryItems,
                               $queryPos)
   else if ($type eq "any")
   then fts:ApplyFTWordsAny($searchContext,
                            $matchOptions,
                            $queryItems,
                            $queryPos)
   else fts:ApplyFTWordsAll($searchContext,
                            $matchOptions,
                            $queryItems,
                            $queryPos)
};
                
</pre></div>
</div>
</div>
</div>
<div class="xquery">
<div class="div3">
<h4><a name="FTMatchOptionsSec" id="FTMatchOptionsSec"></a>4.2.5
Match Options Semantics</h4>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-matchopt-types" id=
"tq-ft-matchopt-types"></a>4.2.5.1 Types</h5>
<p>XQuery 1.0 functions are used to define the semantics of
<b>FTMatchOption</b>s. These functions operate on an XML
representation of the <b>FTMatchOption</b>s. The representation
closely follows the <a href="#ftmatchoptions">syntax</a>. Each
<b>FTMatchOption</b> is represented by an XML element. Additional
characteristics of the match option are represented as attributes.
The schema is given below.</p>
<div class="exampleInner">
<pre>
&lt;xs:schema 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:fts="http://www.w3.org/2007/xpath-full-text"
    targetNamespace="http://www.w3.org/2007/xpath-full-text"
    elementFormDefault="qualified" 
    attributeFormDefault="unqualified"&gt;

  &lt;xs:complexType name="ftMatchOptions"&gt;
    &lt;xs:sequence&gt;
       &lt;xs:element ref="fts:thesaurus" minOccurs="0" maxOccurs="1"/&gt;
       &lt;xs:element ref="fts:stopwords" minOccurs="0" maxOccurs="1"/&gt;
       &lt;xs:element ref="fts:case" minOccurs="0" maxOccurs="1"/&gt;
       &lt;xs:element ref="fts:diacritics" minOccurs="0" maxOccurs="1"/&gt;
       &lt;xs:element ref="fts:stem" minOccurs="0" maxOccurs="1"/&gt;
       &lt;xs:element ref="fts:wildcard" minOccurs="0" maxOccurs="1"/&gt;
       &lt;xs:element ref="fts:language" minOccurs="0" maxOccurs="1"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="matchOptions" type="fts:ftMatchOptions"/&gt;

  &lt;xs:element name="case" type="fts:ftCaseOption" /&gt;
  &lt;xs:element name="diacritics" type="fts:ftDiacriticsOption" /&gt;
  &lt;xs:element name="thesaurus" type="fts:ftThesaurusOption" /&gt;
  &lt;xs:element name="stem" type="fts:ftStemOption" /&gt;
  &lt;xs:element name="wildcard" type="fts:ftWildCardOption" /&gt;
  &lt;xs:element name="language" type="fts:ftLanguageOption" /&gt;
  &lt;xs:element name="stopwords" type="fts:ftStopWordOption" /&gt; 

 &lt;xs:complexType name="ftCaseOption"&gt;
   &lt;xs:sequence&gt;
     &lt;xs:element name="value"&gt;
       &lt;xs:simpleType&gt;
         &lt;xs:restriction base="xs:string"&gt;
           &lt;xs:enumeration value="case insensitive"/&gt;
           &lt;xs:enumeration value="case sensitive"/&gt;
           &lt;xs:enumeration value="lowercase"/&gt;
           &lt;xs:enumeration value="uppercase"/&gt;
         &lt;/xs:restriction&gt;
       &lt;/xs:simpleType&gt;
     &lt;/xs:element&gt;
   &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:complexType name="ftDiacriticsOption"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="value"&gt;
        &lt;xs:simpleType&gt;
          &lt;xs:restriction base="xs:string"&gt;
            &lt;xs:enumeration value="diacritics insensitive"/&gt;
            &lt;xs:enumeration value="diacritics sensitive"/&gt;
          &lt;/xs:restriction&gt;
        &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
       
  &lt;xs:complexType name="ftThesaurusOption"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="thesaurusName" type="xs:string" 
                  minOccurs="0" maxOccurs="1"/&gt;
      &lt;xs:element name="relationship" type="xs:string" 
                  minOccurs="0" maxOccurs="1"/&gt;
      &lt;xs:element name="range" type="fts:ftRangeSpec" 
                  minOccurs="0" maxOccurs="1"/&gt;
    &lt;/xs:sequence&gt;
    &lt;xs:attribute name="thesaurusIndicator"&gt;
      &lt;xs:simpleType&gt;
        &lt;xs:restriction base="xs:string"&gt;
          &lt;xs:enumeration value="using"/&gt;
          &lt;xs:enumeration value="no"/&gt;
        &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
    &lt;/xs:attribute&gt;
  &lt;/xs:complexType&gt;
 
  &lt;xs:complexType name="ftRangeSpec"&gt;
    &lt;xs:attribute name="type" 
                  type="fts:rangeSpecType" 
                  use="required"/&gt;
    &lt;xs:attribute name="m" 
                  type="xs:integer"/&gt;
    &lt;xs:attribute name="n" 
                  type="xs:integer" 
                  use="required"/&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:simpleType name="rangeSpecType"&gt;
    &lt;xs:restriction base="xs:string"&gt;
      &lt;xs:enumeration value="exactly"/&gt;
      &lt;xs:enumeration value="at least"/&gt;
      &lt;xs:enumeration value="at most"/&gt;
      &lt;xs:enumeration value="from to"/&gt;
    &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  
  &lt;xs:complexType name="ftStemOption"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="value"&gt;
        &lt;xs:simpleType&gt;
          &lt;xs:restriction base="xs:string"&gt;
            &lt;xs:enumeration value="stemming"/&gt;
            &lt;xs:enumeration value="no stemming"/&gt;
          &lt;/xs:restriction&gt;
        &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
 
  &lt;xs:complexType name="ftWildCardOption"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="value"&gt;
        &lt;xs:simpleType&gt;
          &lt;xs:restriction base="xs:string"&gt;
            &lt;xs:enumeration value="wildcards"/&gt;
            &lt;xs:enumeration value="no wildcards"/&gt;
          &lt;/xs:restriction&gt;
        &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
 
  &lt;xs:complexType name="ftLanguageOption"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="value" type="xs:string"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:complexType name="ftStopWordOption"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:choice&gt;
        &lt;xs:element name="default-stopwords"&gt;
            &lt;xs:complexType /&gt;
        &lt;/xs:element&gt;
        &lt;xs:element name="stopword" type="xs:string" /&gt;
        &lt;xs:element name="uri" type="xs:anyURI" /&gt;
      &lt;/xs:choice&gt;
      &lt;xs:element name="oper" minOccurs="0" maxOccurs="unbounded"&gt;
        &lt;xs:complexType&gt;
          &lt;xs:choice&gt;
            &lt;xs:element name="stopword" type="xs:string" /&gt;
            &lt;xs:element name="uri" type="xs:anyURI" /&gt;
          &lt;/xs:choice&gt;
          &lt;xs:attribute name="type"&gt;
            &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                &lt;xs:enumeration value="union"/&gt;
                &lt;xs:enumeration value="except"/&gt;
              &lt;/xs:restriction&gt;
            &lt;/xs:simpleType&gt;
          &lt;/xs:attribute&gt;
        &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
 
&lt;/xs:schema&gt;            
</pre></div>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-matchopt-highlevel" id=
"tq-ft-matchopt-highlevel"></a>4.2.5.2 High-Level Semantics</h5>
<p>The previous section described FTSelections without giving any
details about how <b>FTMatchOption</b>s need to be interpreted. All
processing of <b>FTMatchOption</b>s was delegated to the function
<code>matchTokenInfos</code>, which is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. In this
section, further details on the semantics of <b>FTMatchOption</b>s
are given.</p>
<p>The extension is achieved by modifying an existing function and
adding functions that are specific to the
<b>FTMatchOption</b>s.</p>
<p><em>Modifications in the semantics of existing
functions</em></p>
<p>The semantics of most of the <b>FTSelection</b>s remains
unmodified. The modifications are to the method for matching a
sequence of query tokens.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:applyQueryTokensAsPhrase (
      $searchContext as item(),
      $matchOptions as element(fts:matchOptions),
      $queryTokens as element(fts:queryToken)*,
      $queryPos as xs:integer )
   as element(fts:allMatches)
{
   let $thesaurusOption := $matchOptions/fts:thesaurus[1]
   return 
      if ($thesaurusOption and 
          $thesaurusOption/@thesaurusIndicator eq "using") then
         let $noThesaurusOptions := 
            &lt;fts:matchOptions&gt;{
               $matchOptions/*[fn:not(self::fts:thesaurus)]
            }&lt;/fts:matchOptions&gt;
         let $lookupRes := fts:applyThesaurusOption($thesaurusOption,
                                                    $noThesaurusOptions,
                                                    $queryTokens)            
         return fts:ApplyFTWordsAny($searchContext,
                                    $noThesaurusOptions,
                                    $lookupRes,
                                    $queryPos)
      else
         (: from here on we have a single sequence of query tokens :)
         (: which is to be matched a phrase; no alternatives anymore :)
         &lt;fts:allMatches stokenNum="{$queryPos}"&gt; 
         {
            for $pos in
               fts:matchTokenInfos( 
                  $searchContext,
                  $matchOptions,
                  fts:applyStopWordOption($matchOptions/fts:stopwords),
                  $queryTokens )
            return  
               &lt;fts:match&gt;  
                  &lt;fts:stringInclude queryPos="{$queryPos}" isContiguous="true"&gt; 
                  {$pos}
                  &lt;/fts:stringInclude&gt; 
               &lt;/fts:match&gt;
         } 
         &lt;/fts:allMatches&gt; 
};
</pre></div>
</div>
<p>Two <b>FTMatchOption</b>s need to be processed differently than
the rest of the <b>FTMatchOption</b>s as shown in the function
above.</p>
<ul>
<li>
<p>Unlike all other <b>FTMatchOption</b>s the semantics of the
<b>FTThesaurusOption</b> cannot be formulated as an operation on
individual query tokens, because a thesaurus lookup may return
alternative query items for a whole phrase, i.e., a sequence of
query tokens. Since the result of a thesaurus lookup is a sequence
of alternatives, there must be a higher level of processing. The
above call to <code>applyThesaurusOption</code> returns for the
given sequence of query tokens (representing a phrase) all
thesaurus expansions for the selected thesaurus, relationship and
level range as a sequence of query items. The alternative
expansions are evaluated as a disjunction using the
<code>fts:ApplyFTWordsAny</code>. The matching of the alternatives
is performed with <b>FTThesaurusOption</b> turned off to avoid
double expansions, i.e., expansion of an already expanded
token.</p>
</li>
<li>
<p>For the semantics of the <b>FTStopWordOption</b> the list of
stop words needs to be computed as demanded by the special syntax
for stop word lists involving the operators "union" and
"except".</p>
</li>
</ul>
<p><em>Semantics of new <b>FTMatchOption</b>s functions</em></p>
<p>The expansion of <b>FTSelection</b>s also includes adding
additional functions that are specific to the
<b>FTMatchOption</b>s.</p>
<p>The <code>evaluate</code> function above handles match options
occurring in the query structure by using a call to the function
<code>replaceMatchOptions</code> which is defined below. The latter
function replaces match options from the list given by the first
argument with match options of the same group in the list given by
the second argument, if any. If an option is present in the second
list but not in the first list, the option is included to the
resulting list too. Intuitively, the
<code>replaceMatchOptions</code> computes the effective match
options for a given <b>FTSelection</b>. The function uses the
options specified specifically for the current <b>FTSelection</b> (
<code>$ftSelection/fts:matchOptions</code> to override any options
of the same group declared up the query tree
(<code>$matchOptions</code>).</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:replaceMatchOptions (
      $matchOptions as element(fts:matchOptions),
      $newMatchOptions as element(fts:matchOptions) )
   as element(fts:matchOptions)
{
   &lt;fts:matchOptions&gt;
   {
      (if ($newMatchOptions/fts:thesaurus) then $newMatchOptions/fts:thesaurus
       else $matchOptions/fts:thesaurus),
      (if ($newMatchOptions/fts:stopwords) then $newMatchOptions/fts:stopwords
       else $matchOptions/fts:stopwords),
      (if ($newMatchOptions/fts:case) then $newMatchOptions/fts:case
       else $matchOptions/fts:case),
      (if ($newMatchOptions/fts:diacritics) then $newMatchOptions/fts:diacritics
       else $matchOptions/fts:diacritics),
      (if ($newMatchOptions/fts:stem) then $newMatchOptions/fts:stem
       else $matchOptions/fts:stem),
      (if ($newMatchOptions/fts:wildcard) then $newMatchOptions/fts:wildcard
       else $matchOptions/fts:wildcard),
      (if ($newMatchOptions/fts:language) then $newMatchOptions/fts:language
       else $matchOptions/fts:language)
   }
   &lt;/fts:matchOptions&gt;
};

</pre></div>
</div>
<p>This function determines how match options of the same group
overwrite each other, so that only one option of the same group
remains.</p>
<p>The details of the semantics of the remaining
<b>FTMatchOption</b>s are determined by the <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> function
<code>matchTokenInfos</code>.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="options-sem-functions" id=
"options-sem-functions"></a>4.2.5.3 Formal Semantics Functions</h5>
<p><b>FTMatchOption</b> functions which are necessary to support
match option processing are given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:resolveStopWordsUri ( $uri as xs:string? ) 
   as xs:string* external;

declare function fts:lookupThesaurus (
      $tokens as element(fts:queryToken)*,
      $thesaurusName as xs:string?, 
      $relationship as xs:string?,
      $range as element(fts:range)?,
      $noThesaurusOptions as element(fts:matchOptions) ) 
   as element(fts:queryItem)* external;
</pre></div>
</div>
<p>The function <code>resolveStopWordsUri</code> is used to resolve
any URI to a sequence of strings to be used as stop words.</p>
<p>The function <code>lookupThesaurus</code> finds all expansions
related to <code>$tokens</code> in the thesaurus
<code>$thesaurusName</code> using the relationship
<code>$relationship</code> within the optional number of levels
<code>$range</code>. If <code>$tokens</code> consists of more than
one query token, it is regarded as a phrase. 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>The
current match options other than the thesaurus option are also
passed to the function, via <code>$noThesaurusOptions</code>,
allowing the implementation to apply any of those match options
(whichever it deems relevant) to the input or output of the actual
thesaurus lookup.</span></p>
<p>The thesaurus function returns a sequence of expansion
alternatives. Each alternative is regarded as a new search phrase
and is represented as a query item. Alternatives are treated as
though they are connected with a disjunction (<b>FTOr</b>).</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-matchopt-FTCaseOption" id=
"tq-ft-matchopt-FTCaseOption"></a>4.2.5.4 FTCaseOption</h5>
<p><b>FTMatchOption</b>s of type <b>FTCaseOption</b> are passed in
the <code>$matchOptions</code> parameter to
<code>matchTokenInfos</code>. If the <b>FTCaseOption</b> is
"lowercase" the returned <b>TokenInfo</b>s must span only tokens
that are all lowercase. If the <b>FTCaseOption</b> is "uppercase"
the returned <b>TokenInfo</b>s must span only tokens that are all
uppercase. If the <b>FTCaseOption</b> is "case insensitive" the
function must return all <b>TokenInfo</b>s matching the query
tokens when disregarding character case. If the <b>FTCaseOption</b>
is "case sensitive" the function must return all <b>TokenInfo</b>s
that also accord with the query tokens in character case.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-matchopt-FTDiacriticsOption" id=
"tq-ft-matchopt-FTDiacriticsOption"></a>4.2.5.5
FTDiacriticsOption</h5>
<p><b>FTMatchOption</b>s of type <b>FTDiacriticsOption</b> are
passed in the <code>$matchOptions</code> parameter to
<code>matchTokenInfos</code>. If the <b>FTDiacriticsOption</b> is
"diacritics insensitive" the function must return all
<b>TokenInfo</b>s matching the query tokens when disregarding
diacritical marks. If the <b>FTDiacriticsOption</b> is "diacritics
sensitive" the function must return all <b>TokenInfo</b>s that also
accord with the query tokens in diacritical marks.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-matchopt-FTStemOption" id=
"tq-ft-matchopt-FTStemOption"></a>4.2.5.6 FTStemOption</h5>
<p><b>FTMatchOption</b>s of type <b>FTStemOption</b> are passed in
the <code>$matchOptions</code> parameter to
<code>matchTokenInfos</code>. It is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> what the
effect of the option "stemming" is on matching tokens, however, it
is expected that this option allows to match linguistic variants of
the query tokens. If the <b>FTStemOption</b> is "no stemming" the
returned <b>TokenInfo</b>s must span exact matches (i.e. not
including linguistic variations) of the query tokens.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-matchopt-FTThesaurusOption" id=
"tq-ft-matchopt-FTThesaurusOption"></a>4.2.5.7
FTThesaurusOption</h5>
<p>The semantics for the <b>FTThesaurusOption</b> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:applyThesaurusOption (
      $matchOption as element(fts:thesaurus),
      $noThesaurusOptions as element(fts:matchOptions),
      $queryTokens as element(fts:queryToken)* )
   as element(fts:queryItem)*
{
   if ($matchOption/@thesaurusIndicator = "using") then
      fts:lookupThesaurus( $queryTokens,
                           $matchOption/fts:thesaurusName,
                           $matchOption/fts:relationship,
                           $matchOption/fts:range,
                           $noThesaurusOptions )
   else if ($matchOption/@thesaurusIndicator = "no") then
      &lt;fts:queryItem&gt;
      {$queryTokens}
      &lt;/fts:queryItem&gt;
   else ()
};
</pre></div>
</div>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-matchopt-FTStopWordOption" id=
"tq-ft-matchopt-FTStopWordOption"></a>4.2.5.8 FTStopWordOption</h5>
<p>Stop words interact with <b>FTDistance</b> and <b>FTWindow</b>.
The semantics for the <b>FTStopWordOption</b> is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:applyStopWordOption (
      $stopWordOption as element(fts:stopwords)? )
   as xs:string*
{
   if ($stopWordOption) then
      let $swords := 
         typeswitch ($stopWordOption/*[1])
            case $e as element(fts:stopword) 
               return $e/text()
            case $e as element(fts:uri) 
               return fts:resolveStopWordsUri($e/text())
            case element(fts:default-stopwords)
               return fts:resolveStopWordsUri(())
            default return ()
      return fts:calcStopWords( $swords, $stopWordOption/fts:oper )
   else ()
};
declare function fts:calcStopWords ( 
      $stopWords as xs:string*,
      $opers as element(fts:oper)* )
   as xs:string*
{
   if ( fn:empty($opers) ) then $stopWords
   else
      let $swords := 
         typeswitch ($opers[1]/*[1])
            case $e as element(fts:stopword) 
               return $e/text()
            case $e as element(fts:uri) 
               return fts:resolveStopWordsUri($e/text())
            default return ()
      return
         if ($opers[1]/@type eq "union") then
            fts:calcStopWords( ($stopWords, $swords), 
                               $opers[fn:position() gt 2] )
         else (: "except" :)
            fts:calcStopWords( $stopWords[fn:not(.)=$swords],
                               $opers[fn:position() gt 2] )
};
            
</pre></div>
</div>
<p>Given the applicable setting of the Stop Word Option, the
function <code>fts:applyStopWordOption</code> calls
<code>fts:calcStopWords</code> to compute the set of stop words,
and returns that set as an instance of <code>xs:string*</code>.
This then is passed to <code>fts:matchTokenInfos</code>, which uses
it to affect the matching of tokens. The
<code>fts:calcStopWords</code> function uses the function
<code>fts:resolveStopWordsUri</code> to resolve any URI to a
sequence of strings.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-matchopt-FTLanguageOption" id=
"tq-ft-matchopt-FTLanguageOption"></a>4.2.5.9 FTLanguageOption</h5>
<p>The <b>FTLanguageOption</b> is not associated with a semantics
function. It is just a parameter to other semantics functions.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-matchopt-FTWildCardOption" id=
"tq-ft-matchopt-FTWildCardOption"></a>4.2.5.10
FTWildCardOption</h5>
<p><b>FTMatchOption</b>s of type <b>FTWildCardOption</b> are passed
in the <code>$matchOptions</code> parameter to
<code>matchTokenInfos</code>. If the <b>FTWildCardOption</b> is
"wildcards" the function must return all <b>TokenInfo</b>s in the
search context that span tokens, such that those tokens are
wildcard expansions of the corresponding query token. The wildcard
expansions are described in <a href="#ftwildcardoption">Section
3.2.7 FTWildCardOption</a>. If the <b>FTWildCardOption</b> is "no
wildcards" all query tokens must be matched literally.</p>
</div>
</div>
</div>
</div>
<div class="xquery">
<div class="div3">
<h4><a name="FTOperatorsSemanticsSec" id=
"FTOperatorsSemanticsSec"></a>4.2.6 Full-Text Operators
Semantics</h4>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTOr" id="tq-ft-fs-FTOr"></a>4.2.6.1
FTOr</h5>
<p>The parameters of the <code>ApplyFTOr</code> function are the
two <b>AllMatches</b> parameters corresponding to the results of
the two nested <b>FTSelection</b>s. The semantics is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTOr (
      $allMatches1 as element(fts:allMatches),
      $allMatches2 as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{fn:max(($allMatches1/@stokenNum, 
                                       $allMatches2/@stokenNum))}"&gt;
   {$allMatches1/fts:match,$allMatches2/fts:match}
   &lt;/fts:allMatches&gt;
};
            
</pre></div>
</div>
<p>The <code>ApplyFTOr</code> function creates a new
<b>AllMatches</b> in which <b>Match</b>es are the union of those
found in the input <b>AllMatches</b>. Each <b>Match</b> represents
one possible result of the corresponding <b>FTSelection</b>. Thus,
a <b>Match</b> from either of the <b>AllMatches</b> is a
result.</p>
<p>For example, consider the <b>FTSelection</b> <code>"Mustang"
ftor "Honda"</code>. The <b>AllMatches</b> corresponding to
"Mustang" and "Honda" are given below.</p>
<img src="images/FTOrEx1.jpg" alt="FTOr input AllMatches 1" />
<p><img src="images/FTOrEx2.jpg" alt=
"FTOr input AllMatches 2" /></p>
<p>The <b>AllMatches</b> produced by <code>ApplyFTOr</code> is
given below.</p>
<img src="images/FTOrEx3.jpg" alt="FTOr result AllMatches" /></div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTAnd" id="tq-ft-fs-FTAnd"></a>4.2.6.2
FTAnd</h5>
<p>The parameters of the <code>ApplyFTAnd</code> function are the
two <b>AllMatches</b> corresponding to the results of the two
nested <b>FTSelection</b>s. The semantics is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTAnd (
      $allMatches1 as element(fts:allMatches),
      $allMatches2 as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{fn:max(($allMatches1/@stokenNum, 
                                       $allMatches2/@stokenNum))}" &gt;
   {
      for $sm1 in $allMatches1/fts:match
      for $sm2 in $allMatches2/fts:match
      return &lt;fts:match&gt;
             {$sm1/*, $sm2/*}
             &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
            
</pre></div>
</div>
<p>The result of the conjunction is a new <b>AllMatches</b> that
contains the "Cartesian product" of the matches of the
participating <b>FTSelection</b>s. Every resulting <b>Match</b> is
formed by the combination of the <b>StringInclude</b> components
and <b>StringExclude</b> from the <b>AllMatches</b> of the nested
<b>FTSelection</b> . Thus every match contains the positions to
satisfy a <b>Match</b> from both original <b>FTSelection</b>s and
excludes the positions that violate the same <b>Match</b>es.</p>
<p>For example, consider the <b>FTSelection</b> <code>"Mustang"
ftand "rust"</code>. The source <b>AllMatches</b> are give
below.</p>
<img src="images/FTAndEx1.jpg" alt="FTAnd input AllMatches 1" />
<p><img src="images/FTAndEx2.jpg" alt=
"FTAnd input AllMatches 2" /></p>
<p>The <b>AllMatches</b> produced by <code>ApplyFTAnd</code> is
given below.</p>
<img src="images/FTAndEx3.jpg" alt=
"FTAnd result AllMatches" /></div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTUnaryNot" id=
"tq-ft-fs-FTUnaryNot"></a>4.2.6.3 FTUnaryNot</h5>
<p>The <code>ApplyFTUnaryNot</code> function has one
<b>AllMatches</b> parameter corresponding to the result of the
nested <b>FTSelection</b> to be negated. The semantics is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:InvertStringMatch ( $strm as element(*,fts:stringMatch) ) 
   as element(*,fts:stringMatch)
{
   if ($strm instance of element(fts:stringExclude)) then
      &lt;fts:stringInclude queryPos="{$strm/@queryPos}" isContiguous="{$strm/@isContiguous}"&gt;
      {$strm/fts:tokenInfo}
      &lt;/fts:stringInclude&gt;
   else
      &lt;fts:stringExclude queryPos="{$strm/@queryPos}" isContiguous="{$strm/@isContiguous}"&gt;
      {$strm/fts:tokenInfo}
      &lt;/fts:stringExclude&gt;
};

declare function fts:UnaryNotHelper ( $matches as element(fts:match)* )
   as element(fts:match)*
{
   if (fn:empty($matches))
   then &lt;fts:match/&gt;
   else
      for $sm in $matches[1]/*
      for $rest in fts:UnaryNotHelper( fn:subsequence($matches, 2) )
      return 
         &lt;fts:match&gt;
         {
            fts:InvertStringMatch($sm),
            $rest/*
         }
         &lt;/fts:match&gt;
};

declare function fts:ApplyFTUnaryNot (
      $allMatches as element(fts:allMatches) )
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      fts:UnaryNotHelper($allMatches/fts:match)
   }
   &lt;/fts:allMatches&gt;
};
            
</pre></div>
</div>
<p>The generation of the resulting <b>AllMatches</b> of an
<b>FTUnaryNot</b> resembles the transformation of a negation of
prepositional formula in DNF back to DNF. The negation of
<b>AllMatches</b> requires the inversion of all the
<b>StringMatch</b>es within the <b>AllMatches</b>.</p>
<p>In the <code>InvertStringMatch</code> function above, this
inversion occurs as follows.</p>
<ol class="enumar">
<li>
<p>The function <code>fts:invertStringMatch</code> inverts a
<b>StringInclude</b> into a <b>StringExclude</b> and vice
versa.</p>
</li>
<li>
<p>The function <code>fts:UnaryNotHelper</code> transforms the
source <b>Match</b>es into the resulting <b>Match</b>es by forming
the combinations of the inversions of a <b>StringInclude</b> or
<b>StringExclude</b> component over the source <b>Match</b>es into
new <b>Match</b>es.</p>
</li>
</ol>
<p>For example, consider the <b>FTSelection</b> <code>ftnot
("Mustang" ftor "Honda")</code>. The source <b>AllMatches</b> is
given below:</p>
<img src="images/FTNegationEx1.jpg" alt=
"FTUnaryNot input AllMatches" />
<p>The <b>FTUnaryNot</b> transforms the <b>StringInclude</b>s to
<b>StringExclude</b>s as illustrated below.</p>
<img src="images/FTNegationEx2.jpg" alt=
"FTUnaryNot result AllMatches" /></div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTMildNot" id=
"tq-ft-fs-FTMildNot"></a>4.2.6.4 FTMildNot</h5>
<p>The parameters of the <code>ApplyFTMildNot</code> function are
the two <b>AllMatches</b> parameters corresponding to the results
of the two nested <b>FTSelection</b>s. The semantics is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:CoveredIncludePositions (
       $match as element(fts:match) )
    as xs:integer*
{
    for $strInclude in $match/fts:stringInclude
    return $strInclude/fts:tokenInfo/@startPos
           to $strInclude/fts:tokenInfo/@endPos
};

declare function fts:ApplyFTMildNot (
       $allMatches1 as element(fts:allMatches),
       $allMatches2 as element(fts:allMatches) )
    as element(fts:allMatches)
{
    if (fn:count($allMatches1//fts:stringExclude) gt 0) then
       fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'FTDY0017'), 
                "Invalid expression on the left-hand side of a not-in")
    else if (fn:count($allMatches2//fts:stringExclude) gt 0) then
       fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'FTDY0017'), 
                "Invalid expression on the right-hand side of a not-in")
    else if (fn:count($allMatches2//fts:stringInclude) eq 0) then
       $allMatches1
    else
       &lt;fts:allMatches stokenNum="{$allMatches1/@stokenNum}"&gt;
       {
          $allMatches1/fts:match[
             every $matches2 in $allMatches2/fts:match
             satisfies
                let $posSet1 := fts:CoveredIncludePositions(.)
                let $posSet2 := fts:CoveredIncludePositions($matches2)
                   return some $pos in $posSet1 satisfies fn:not($pos = $posSet2)
          ]
       }
       &lt;/fts:allMatches&gt;
};
            
</pre></div>
</div>
<p>The resulting <b>AllMatches</b> contains <b>Match</b>es of the
first operand that do not mention in their <b>StringInclude</b>
components positions in a <b>StringInclude</b> component in the
<b>AllMatches</b> of the second operand.</p>
<p>For example, consider the <b>FTSelection</b> <code>("Ford" not
in "Ford Mustang")</code>. The source <b>AllMatches</b> for the
left-hand side argument is given below.</p>
<img src="images/FTMildNegationEx1.jpg" alt=
"FTMildNot input AllMatches 1" />
<p>The source <b>AllMatches</b> for the right-hand side argument is
given below.</p>
<img src="images/FTMildNegationEx2.jpg" alt=
"FTMildNot input AllMatches 2" />
<p>The <b>FTMildNot</b> will transform these to an empty
<b>AllMatches</b> because both position 1 and position 27 from the
first <b>AllMatches</b> contain only <b>TokenInfo</b>s from
<b>StringInclude</b> components of the second
<b>AllMatches</b>.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTOrder" id="tq-ft-fs-FTOrder"></a>4.2.6.5
FTOrder</h5>
<p>The <code>ApplyFTOrder</code> function has one <b>AllMatches</b>
parameter corresponding to the result of the nested
<b>FTSelection</b>s. The semantics is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTOrder (
      $allMatches as element(fts:allMatches) )
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      where every $stringInclude1 in $match/fts:stringInclude,
                  $stringInclude2 in $match/fts:stringInclude
            satisfies (($stringInclude1/fts:tokenInfo/@startPos &lt;= 
                        $stringInclude2/fts:tokenInfo/@startPos)
                       and
                       ($stringInclude1/@queryPos &lt;= 
                        $stringInclude2/@queryPos))
                      or
                       (($stringInclude1/fts:tokenInfo/@startPos&gt;= 
                         $stringInclude2/fts:tokenInfo/@startPos)
                        and
                        ($stringInclude1/@queryPos &gt;= 
                         $stringInclude2/@queryPos))
      return 
         &lt;fts:match&gt;
         {
            $match/fts:stringInclude,
            for $stringExcl in $match/fts:stringExclude
            where every $stringIncl in $match/fts:stringInclude
                  satisfies (($stringExcl/fts:tokenInfo/@startPos &lt;= 
                              $stringIncl/fts:tokenInfo/@startPos)
                             and
                              ($stringExcl/@queryPos &lt;= 
                               $stringIncl/@queryPos))
                            or
                             (($stringExcl/fts:tokenInfo/@startPos &gt;= 
                               $stringIncl/fts:tokenInfo/@startPos)
                              and
                              ($stringExcl/@queryPos &gt;= 
                               $stringIncl/@queryPos))
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }         
   &lt;/fts:allMatches&gt;
};
            
</pre></div>
</div>
<p>The resulting <b>AllMatches</b> contains the <b>Match</b>es for
which the starting positions in the <b>StringInclude</b> elements
are in the order of the query positions of their query strings.
<b>StringExclude</b>s that preserve the order (with respect to
their starting positions) are also retained.</p>
<p>For example, consider the <b>FTSelection</b> <code>("great"
ftand "condition") ordered</code>. The source <b>AllMatches</b> is
given below.</p>
<img src="images/FTOrderEx1.jpg" alt=
"FTOrder input AllMatches" /><img src="images/FTOrderEx2.jpg" alt=
"FTOrder input AllMatches" /><img src="images/FTOrderEx3.jpg" alt=
"FTOrder input AllMatches" />
<p>The <b>AllMatches</b> for <b>FTOrder</b> are given below.</p>
<img src="images/FTOrderEx4.jpg" alt=
"FTOrder result AllMatches" /><img src="images/FTOrderEx5.jpg" alt=
"FTOrder result AllMatches" /></div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTScope" id="tq-ft-fs-FTScope"></a>4.2.6.6
FTScope</h5>
<p>The parameters of the <code>ApplyFTScope</code> function are 1)
the type of the scope (same or different), 2) the linguistic unit
(sentence or paragraph), and 2) one <b>AllMatches</b> parameter
corresponding to the result of the nested <b>FTSelection</b>s. The
function definitions depend on the type of the scope (paragraph,
sentence) and the scope predicate (same, different).</p>
<p>The semantics of <code>same sentence</code> is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTScopeSameSentence (
      $allMatches as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      where every $stringInclude1 in $match/fts:stringInclude,
                  $stringInclude2 in $match/fts:stringInclude 
            satisfies $stringInclude1/fts:tokenInfo/@startSent = 
                      $stringInclude2/fts:tokenInfo/@startSent
                  and $stringInclude1/fts:tokenInfo/@startSent = 
                      $stringInclude1/fts:tokenInfo/@endSent
                  and $stringInclude2/fts:tokenInfo/@startSent = 
                      $stringInclude2/fts:tokenInfo/@endSent
                  and $stringInclude1/fts:tokenInfo/@startSent &gt; 0
                  and $stringInclude2/fts:tokenInfo/@startSent &gt; 0
      return 
        &lt;fts:match&gt;
        {
           $match/fts:stringInclude,
           for $stringExcl in $match/fts:stringExclude
           where
              $stringExcl/fts:tokenInfo/@startSent = 0
              or
              ($stringExcl/fts:tokenInfo/@startSent = 
               $stringExcl/fts:tokenInfo/@endSent
               and 
                  (every $stringIncl in $match/fts:stringInclude
                   satisfies $stringIncl/fts:tokenInfo/@startSent = 
                             $stringExcl/fts:tokenInfo/@startSent) )
           return $stringExcl
        }
        &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>An <b>AllMatches</b> returned by the scope <code>same
sentence</code> contains those <b>Match</b>es whose
<b>StringInclude</b>s span only a single sentence and all span the
same sentence. In these <b>Match</b>es only those
<b>StringExclude</b>s are retained that also only span a single
sentence, which is, in case there are <b>StringInclude</b>s in that
<b>Match</b>, the same as the one spanned by the
<b>StringInclude</b>s.</p>
<p>The semantics of <code>different sentence</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTScopeDifferentSentence (
      $allMatches as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      where
         count($match/fts:stringInclude) &gt; 1
         and
         (
            every $stringInclude1 in $match/fts:stringInclude,
                  $stringInclude2 in $match/fts:stringInclude  
            satisfies
               $stringInclude1 is $stringInclude2
               or
               (
                     ( $stringInclude1/fts:tokenInfo/@startSent !=  
                       $stringInclude2/fts:tokenInfo/@startSent 
                    or $stringInclude1/fts:tokenInfo/@startSent !=  
                       $stringInclude1/fts:tokenInfo/@endSent 
                    or $stringInclude2/fts:tokenInfo/@startSent !=  
                       $stringInclude2/fts:tokenInfo/@endSent ) 
                   and $stringInclude1/fts:tokenInfo/@startSent &gt; 0 
                   and $stringInclude2/fts:tokenInfo/@endSent &gt; 0
               )
         )
      return 
         &lt;fts:match&gt;
         {
            $match/fts:stringInclude,
            for $stringExcl in $match/fts:stringExclude
            where every $stringIncl in $match/fts:stringInclude
                  satisfies ($stringIncl/fts:tokenInfo/@startSent !=  
                             $stringExcl/fts:tokenInfo/@startSent 
                          or $stringIncl/fts:tokenInfo/@startSent !=  
                             $stringIncl/fts:tokenInfo/@endSent 
                          or $stringExcl/fts:tokenInfo/@startSent !=  
                             $stringExcl/fts:tokenInfo/@endSent ) 
                         and $stringIncl/fts:tokenInfo/@startSent &gt; 0 
                         and $stringExcl/fts:tokenInfo/@endSent &gt; 0
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>An <b>AllMatches</b> returned by the scope <code>different
sentence</code> contains those <b>Match</b>es that have at least
two StringIncludes, no two of which begin and end all in the same
sentence. In these <b>Match</b>es only those <b>StringExclude</b>s
are retained that do not conflict with any of the
<b>StringInclude</b>s.</p>
<p>The semantics of <code>same paragraph</code> is analogous to
<code>same sentence</code> and is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTScopeSameParagraph (
      $allMatches as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      where every $stringInclude1 in $match/fts:stringInclude,
                  $stringInclude2 in $match/fts:stringInclude  
            satisfies $stringInclude1/fts:tokenInfo/@startPara = 
                      $stringInclude2/fts:tokenInfo/@startPara
                  and $stringInclude1/fts:tokenInfo/@startPara = 
                      $stringInclude1/fts:tokenInfo/@endPara
                  and $stringInclude2/fts:tokenInfo/@startPara = 
                      $stringInclude2/fts:tokenInfo/@endPara
                  and $stringInclude1/fts:tokenInfo/@startPara &gt; 0
                  and $stringInclude2/fts:tokenInfo/@endPara &gt; 0
      return 
         &lt;fts:match&gt;
         {
            $match/fts:stringInclude,
            for $stringExcl in $match/fts:stringExclude
            where 
               $stringExcl/fts:tokenInfo/@startPara = 0
               or
               ($stringExcl/fts:tokenInfo/@startPara = 
                $stringExcl/fts:tokenInfo/@endPara
                and
                   (every $stringIncl in $match/fts:stringInclude
                    satisfies $stringIncl/fts:tokenInfo/@startPara = 
                              $stringExcl/fts:tokenInfo/@startPara) )
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>different paragraph</code> is analogous
to <code>different sentence</code> and is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTScopeDifferentParagraph (
      $allMatches as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      where
         count($match/fts:stringInclude) &gt; 1
         and
         (
            every $stringInclude1 in $match/fts:stringInclude,
                  $stringInclude2 in $match/fts:stringInclude  
            satisfies
               $stringInclude1 is $stringInclude2
               or
               (
                     ( $stringInclude1/fts:tokenInfo/@startPara !=  
                       $stringInclude2/fts:tokenInfo/@startPara 
                    or $stringInclude1/fts:tokenInfo/@startPara !=  
                       $stringInclude1/fts:tokenInfo/@endPara 
                    or $stringInclude2/fts:tokenInfo/@startPara !=  
                       $stringInclude2/fts:tokenInfo/@endPara ) 
                   and $stringInclude1/fts:tokenInfo/@startPara &gt; 0 
                   and $stringInclude2/fts:tokenInfo/@endPara &gt; 0
               )
         )
      return 
         &lt;fts:match&gt;
         {
            $match/fts:stringInclude,
            for $stringExcl in $match/fts:stringExclude
            where every $stringIncl in $match/fts:stringInclude
                  satisfies ($stringIncl/fts:tokenInfo/@startPara !=  
                             $stringExcl/fts:tokenInfo/@startPara 
                          or $stringIncl/fts:tokenInfo/@startPara !=  
                             $stringIncl/fts:tokenInfo/@endPara 
                          or $stringExcl/fts:tokenInfo/@startPara !=  
                             $stringExcl/fts:tokenInfo/@endPara ) 
                         and $stringIncl/fts:tokenInfo/@startPara &gt; 0 
                         and $stringExcl/fts:tokenInfo/@endPara &gt; 0
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics for the general case is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTScope (
      $type as fts:scopeType,
      $selector as fts:scopeSelector, 
      $allMatches as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   if ($type eq "same" and $selector eq "sentence")
   then fts:ApplyFTScopeSameSentence($allMatches)
   else if ($type eq "different" and $selector eq "sentence")
      then fts:ApplyFTScopeDifferentSentence($allMatches)
   else if ($type eq "same" and $selector eq "paragraph")
      then fts:ApplyFTScopeSameParagraph($allMatches)
   else fts:ApplyFTScopeDifferentParagraph($allMatches)
};
</pre></div>
</div>
<p>For example, consider the <b>FTSelection</b> <code>("Mustang"
ftand "Honda") same paragraph</code>. The source <b>AllMatches</b>
is given below.</p>
<img src="images/FTScopeEx.jpg" alt="FTScope input AllMatches" />
<p>The <b>FTScope</b> returns an empty <b>AllMatches</b> because
neither <b>Match</b> contains <b>TokenInfo</b>s from a single
sentence.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTContent" id=
"tq-ft-fs-FTContent"></a>4.2.6.7 FTContent</h5>
<p>The parameters of the <code>ApplyFTContent</code> function are
1) the search context, 2) the type of the content match (<code>at
start</code>, <code>at end</code>, or <code>entire content</code>),
and 3) one <b>AllMatches</b> parameter corresponding to the result
of the nested <b>FTSelection</b>s.</p>
<p>The evaluation of <code>ApplyFTContent</code> depends on the
type of the content match:</p>
<ul>
<li>
<p><code>entire content</code> retains those <b>Match</b>es such
that for every token position in the search context, some
<b>StringInclude</b> in the <b>Match</b> covers that token
position.</p>
</li>
<li>
<p><code>at start</code> retains those <b>Match</b>es that contain
a <b>StringInclude</b> that covers the lowest token position in the
search context.</p>
</li>
<li>
<p><code>at end</code> retains those <b>Match</b>es that contain a
<b>StringInclude</b> that covers the highest token position in the
search context.</p>
</li>
</ul>
<p>The semantics is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTContent (
      $searchContext as item(),
      $type as fts:contentMatchType,
      $allMatches as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      $allMatches/fts:match[
         let $start_pos := fts:getLowestTokenPosition($searchContext),
             $end_pos   := fts:getHighestTokenPosition($searchContext),
             $match     := .
         return
            if ($type eq "entire content") then
               every $pos in $start_pos to $end_pos
               satisfies
                  some $si in $match/fts:stringInclude[data(@isContiguous)]
                  satisfies
                     fts:TokenInfoCoversTokenPosition($si/fts:tokenInfo, $pos)
            else
               let $pos :=
                  if ($type eq "at start") then
                     $start_pos
                  else (: $type eq "at end" :)
                     $end_pos
               return
                  some $ti in $match/fts:stringInclude/fts:tokenInfo
                  satisfies
                     fts:TokenInfoCoversTokenPosition($ti, $pos)
      ]
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p><code>ApplyFTContent</code> depends on the helper function
<code>fts:TokenInfoCoversTokenPosition</code>, which ascertains
whether the given <code>$tokenInfo</code> covers a particular
<code>$tokenPosition</code>.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:TokenInfoCoversTokenPosition(
      $tokenInfo as element(fts:tokenInfo),
      $tokenPosition as xs:integer )
   as xs:boolean
{
   ($tokenPosition &gt;= $tokenInfo/@startPos)
   and
   ($tokenPosition &lt;= $tokenInfo/@endPos)
};
</pre></div>
</div>
<p><code>ApplyFTContent</code> also depends on two functions whose
definitions are <a title="implementation dependent" href=
"#dt-implementation-dependent">implementation-dependent</a>:
<code>getLowestTokenPosition</code> and
<code>getHighestTokenPosition</code> return (respectively) the
first and last token positions of the item
<code>$searchContext</code>.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:getLowestTokenPosition(
      $searchContext as item() )
   as xs:integer
   external;

declare function fts:getHighestTokenPosition(
      $searchContext as item() )
   as xs:integer
   external;
</pre></div>
</div>
<p>Note that the way <code>@isContiguous</code> is calculated in
<code>joinIncludes</code> and used in <code>ApplyFTContent</code>
can lead to counter-intuitive results. For example, consider the
following query:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
"one two three four"
contains text
   ("one" ftand "three" window 3 words)
   ftand
   ("two" ftand "four" window 3 words)
   entire content
</pre></div>
</div>
<p>Even though the four query tokens <em>do</em> cover all of the
search context's token positions, the query yields false, because
the <b>Match</b> that <code>ApplyFTContent</code> receives as input
has two <b>StringInclude</b>s, each of which is non-contiguous.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTWindow" id="tq-ft-fs-FTWindow"></a>4.2.6.8
FTWindow</h5>
<p>Before we define the semantics functions of the <b>FTWindow</b>
and <b>FTDistance</b> operations, we introduce the auxiliary
function <code>joinIncludes</code> that will be used in their
definitions. <code>joinIncludes</code> takes a sequence of
<b>StringInclude</b>s of a <b>Match</b> and transforms it into
either the empty sequence, in case the input sequence was empty, or
otherwise a single <b>StringInclude</b> representing the span from
the first position of the match to the last. For the purpose of
being able to evaluate an "entire content" operator further up in
the tree, we pre-evaluate whether all possible positions between
first and last are covered in the input <b>StringInclude</b>s and
store that boolean in the attribute "isContiguous".</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:joinIncludes(
      $strIncls as element(fts:stringInclude)* )
   as element(fts:stringInclude)?
{
   if (fn:empty($strIncls))
   then 
      $strIncls
   else
      let $posSet := fts:CoveredIncludePositions(&lt;fts:match&gt;$strIncls&lt;/fts:match&gt;),
         $minPos := fn:min($strIncls/fts:tokenInfo/@startPos),
         $maxPos := fn:max($strIncls/fts:tokenInfo/@endPos),
         $isContiguous := 
            ( every $pos in $minPos to $maxPos
              satisfies ($pos = $posSet) )
            and
            ( every $strIncl in $strIncls
              satisfies $strIncl/@isContiguous )
      return
         &lt;fts:stringInclude 
            queryPos="{$strIncls[1]/@queryPos}"
            isContiguous="{$isContiguous}"&gt;
            &lt;fts:tokenInfo
               startPos ="{$minPos}"
               endPos   ="{$maxPos}"
               startSent="{fn:min($strIncls/fts:tokenInfo/@startSent)}"
               endSent  ="{fn:max($strIncls/fts:tokenInfo/@endSent)}"
               startPara="{fn:min($strIncls/fts:tokenInfo/@startPara)}"
               endPara  ="{fn:max($strIncls/fts:tokenInfo/@endPara)}"/&gt;
         &lt;/fts:stringInclude&gt;
};
</pre></div>
</div>
<p>The parameters of the <code>ApplyFTWindow</code> function are 1)
the unit of type <code>fts:distanceType</code>, 2) a size, and 3)
one <b>AllMatches</b> parameter corresponding to the result of the
nested <b>FTSelection</b>s. For each unit type a function is
defined as follows.</p>
<p>The semantics of <code>window N words</code> is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWordWindow (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $minpos := fn:min($match/fts:stringInclude/fts:tokenInfo/@startPos),
          $maxpos := fn:max($match/fts:stringInclude/fts:tokenInfo/@endPos)
      for $windowStartPos in ($maxpos - $n + 1 to $minpos)
      let $windowEndPos := $windowStartPos + $n - 1
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExclude in $match/fts:stringExclude
            where $stringExclude/fts:tokenInfo/@startPos &gt;=
                  $windowStartPos
              and $stringExclude/fts:tokenInfo/@endPos &lt;=
                  $windowEndPos
            return $stringExclude
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>window N sentences</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTSentenceWindow (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $minpos := fn:min($match/fts:stringInclude/fts:tokenInfo/@startSent),
          $maxpos := fn:max($match/fts:stringInclude/fts:tokenInfo/@endSent)
      for $windowStartPos in ($maxpos - $n + 1 to $minpos)
      let $windowEndPos := $windowStartPos + $n - 1
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExclude in $match/fts:stringExclude
            where $stringExclude/fts:tokenInfo/@startSent &gt;=
                  $windowStartPos
              and $stringExclude/fts:tokenInfo/@endSent &lt;=
                  $windowEndPos
            return $stringExclude
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>window N paragraphs</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTParagraphWindow (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches)
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $minpos := fn:min($match/fts:stringInclude/fts:tokenInfo/@startPara),
          $maxpos := fn:max($match/fts:stringInclude/fts:tokenInfo/@endPara)
      for $windowStartPos in ($maxpos - $n + 1 to $minpos)
      let $windowEndPos := $windowStartPos + $n - 1
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExclude in $match/fts:stringExclude
            where $stringExclude/fts:tokenInfo/@startPara &gt;=
                  $windowStartPos
              and $stringExclude/fts:tokenInfo/@endPara &lt;=
                  $windowEndPos
            return $stringExclude
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The resulting <b>AllMatches</b> contains <b>Match</b>es of the
operand that satisfy the condition that there exists a sequence of
the specified number of consecutive (token, sentence, or paragraph)
positions, such that all <b>StringInclude</b>s are within that
window, and the <b>StringExclude</b>s retained are also within that
window. For each <b>Match</b> that satisfies the window condition
the <b>StringInclude</b>s are joined into a single
<b>StringInclude</b>. This enables further window or distance
operations to be applied to the result in a way that that result is
taken as a single entity.</p>
<p>The semantics for the general function is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWindow (
      $type as fts:distanceType,
      $size as xs:integer,
      $allMatches as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   if ($type eq "word") then
      fts:ApplyFTWordWindow($allMatches, $size)
   else if ($type eq "sentence") then 
      fts:ApplyFTSentenceWindow($allMatches, $size)
   else
      fts:ApplyFTParagraphWindow($allMatches, $size)
};
</pre></div>
</div>
<p>For example, consider the <b>FTWindow</b> selection <code>("Ford
Mustang" ftand "excellent") window 10 words</code>. The
<b>Match</b>es of the source <b>AllMatches</b> for <code>("Ford
Mustang" ftand "excellent")</code> are given below.</p>
<img src="images/FTWindowEx1.jpg" alt="FTWindow AllMatches" />
<p><img src="images/FTWindowEx2.jpg" alt=
"FTWindow AllMatches" /></p>
<img src="images/FTWindowEx3.jpg" alt="FTWindow AllMatches" />
<p><img src="images/FTWindowEx4.jpg" alt=
"FTWindow AllMatches" /></p>
<img src="images/FTWindowEx5.jpg" alt="FTWindow AllMatches" />
<p><img src="images/FTWindowEx6.jpg" alt=
"FTWindow AllMatches" /></p>
<p>The result for the <b>FTWindow</b> selection consists of only
the first, the fifth, and the sixth <b>Match</b>es because their
respective window sizes are 5, 4, and 9.</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTDistance" id=
"tq-ft-fs-FTDistance"></a>4.2.6.9 FTDistance</h5>
<p>The parameters of the <code>ApplyFTDistance</code> function are
1) one <b>AllMatches</b> parameter corresponding to the result of
the nested <b>FTSelection</b>s, 2) the unit of the distance
(tokens, sentences, paragraphs), and 3) the range specified. The
resulting <b>AllMatches</b> contains <b>Match</b>es of the operand
that satisfy the condition that the distance for every pair of
consecutive <b>StringInclude</b>s is within the specified interval,
where the distance is measured (in tokens, sentences, or
paragraphs) from the end of the preceding <b>StringInclude</b> to
the start of the next.</p>
<p>An invocation of the <code>ApplyFTDistance</code> function will
call one of twelve helper functions, each of which handles a
particular unit of distance and type of range.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTDistance (
      $type as fts:distanceType,
      $range as element(fts:range),
      $allMatches as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   if ($type eq "word") then
      if ($range/@type eq "exactly") then
         fts:ApplyFTWordDistanceExactly($allMatches, $range/@n)
      else if ($range/@type eq "at least") then 
         fts:ApplyFTWordDistanceAtLeast($allMatches, $range/@n)
      else if ($range/@type eq "at most") then
         fts:ApplyFTWordDistanceAtMost( $allMatches, $range/@n)
      else
         fts:ApplyFTWordDistanceFromTo( $allMatches, $range/@m, $range/@n)
   else if ($type eq "sentence") then
      if ($range/@type eq "exactly") then
         fts:ApplyFTSentenceDistanceExactly($allMatches, $range/@n)
      else if ($range/@type eq "at least") then
         fts:ApplyFTSentenceDistanceAtLeast($allMatches, $range/@n)
      else if ($range/@type eq "at most") then
         fts:ApplyFTSentenceDistanceAtMost( $allMatches, $range/@n)
      else
         fts:ApplyFTSentenceDistanceFromTo( $allMatches, $range/@m, $range/@n)
   else
      if ($range/@type eq "exactly") then
         fts:ApplyFTParagraphDistanceExactly($allMatches, $range/@n)
      else if ($range/@type eq "at least") then
         fts:ApplyFTParagraphDistanceAtLeast($allMatches, $range/@n)
      else if ($range/@type eq "at most") then
         fts:ApplyFTParagraphDistanceAtMost( $allMatches, $range/@n)
      else
         fts:ApplyFTParagraphDistanceFromTo( $allMatches, $range/@m, $range/@n)
};
</pre></div>
</div>
<p><em>Word Distance</em></p>
<p>The semantics of case <code>word distance exactly N</code> is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWordDistanceExactly(
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startPos ascending,
                              $si/fts:tokenInfo/@endPos ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $idx in 1 to fn:count($sorted) - 1
            satisfies fts:wordDistance(
                         $sorted[$idx]/fts:tokenInfo,
                         $sorted[$idx+1]/fts:tokenInfo
                      ) = $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:wordDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) = $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>word distance at least N</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWordDistanceAtLeast (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startPos ascending,
                              $si/fts:tokenInfo/@endPos ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:wordDistance(
                         $sorted[$index]/fts:tokenInfo,
                         $sorted[$index+1]/fts:tokenInfo
                      ) &gt;= $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:wordDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &gt;= $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }           
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>word distance at most N</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWordDistanceAtMost (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startPos ascending,
                              $si/fts:tokenInfo/@endPos ascending
                     return $si
      where
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:wordDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &lt;= $n 
      return 
        &lt;fts:match&gt;
        {
           fts:joinIncludes($match/fts:stringInclude),
           for $stringExcl in $match/fts:stringExclude
           where some $stringIncl in $match/fts:stringInclude
                 satisfies fts:wordDistance(
                               $stringIncl/fts:tokenInfo,
                               $stringExcl/fts:tokenInfo
                           ) &lt;= $n
           return $stringExcl
        }
        &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>word distance from M to N</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTWordDistanceFromTo (
      $allMatches as element(fts:allMatches),
      $m as xs:integer,
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startPos ascending,
                              $si/fts:tokenInfo/@endPos ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:wordDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &gt;= $m 
                      and
                      fts:wordDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &lt;= $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:wordDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &gt;= $m
                            and
                            fts:wordDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &lt;= $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The preceding four helper functions all rely on
<code>fts:wordDistance</code>, which returns the number of token
positions that occur between two <b>TokenInfo</b>s. For example,
two tokens with consecutive positions have a distance of 0 tokens,
and two overlapping tokens have a distance of -1 tokens.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:wordDistance (
      $tokenInfo1 as element(fts:tokenInfo),
      $tokenInfo2 as element(fts:tokenInfo) )
   as xs:integer
{
   (: Ensure tokens are in order :)
   let $sorted :=
      for $ti in ($tokenInfo1, $tokenInfo2)
      order by $ti/@startPos ascending, $ti/@endPos ascending
      return $ti
   return
      (: -1 because we count starting at 0 :)
      $sorted[2]/@startPos - $sorted[1]/@endPos - 1
};
            
</pre></div>
</div>
<p><em>Sentence Distance</em></p>
<p>The semantics of <code>sentence distance exactly N</code> is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTSentenceDistanceExactly (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startSent ascending,
                              $si/fts:tokenInfo/@endSent ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:sentenceDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) = $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:sentenceDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) = $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }           
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>sentence distance at least N</code> is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTSentenceDistanceAtLeast (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                    order by $si/fts:tokenInfo/@startSent ascending,
                             $si/fts:tokenInfo/@endSent ascending
                    return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:sentenceDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &gt;= $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:sentenceDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &gt;= $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }           
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>sentence distance at most N</code> is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTSentenceDistanceAtMost (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startSent ascending,
                              $si/fts:tokenInfo/@endSent ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:sentenceDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &lt;= $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:sentenceDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &lt;= $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }           
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>sentence distance from M to N</code> is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTSentenceDistanceFromTo (
      $allMatches as element(fts:allMatches),
      $m as xs:integer,
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startSent ascending,
                              $si/fts:tokenInfo/@endSent ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:sentenceDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &gt;= $m 
                      and
                      fts:sentenceDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &lt;= $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:sentenceDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &gt;= $m
                            and
                            fts:sentenceDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &lt;= $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The preceding four helper functions all rely on
<code>fts:sentenceDistance</code>, which returns the number of
sentences between two <b>TokenInfo</b>s.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:sentenceDistance (
      $tokenInfo1 as element(fts:tokenInfo),
      $tokenInfo2 as element(fts:tokenInfo) )
   as xs:integer
{
   (: Ensure tokens are in order :)
   let $sorted :=
      for $ti in ($tokenInfo1, $tokenInfo2)
      order by $ti/@startPos ascending, $ti/@endPos ascending
      return $ti
   return
      (: -1 because we count starting at 0 :)
      $sorted[2]/@startSent - $sorted[1]/@endSent - 1
};
            
</pre></div>
</div>
<p><em>Paragraph Distance</em></p>
<p>The semantics of <code>paragraph distance exactly N</code> is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTParagraphDistanceExactly (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startPara ascending,
                              $si/fts:tokenInfo/@endPara ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:paraDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) = $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:paraDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) = $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }           
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>paragraph distance at least N</code> is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTParagraphDistanceAtLeast (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startPara ascending,
                              $si/fts:tokenInfo/@endPara ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:paraDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &gt;= $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:paraDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &gt;= $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }           
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>paragraph distance at most N</code> is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTParagraphDistanceAtMost (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startPara ascending,
                              $si/fts:tokenInfo/@endPara ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:paraDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &lt;= $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:paraDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &lt;= $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }           
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>paragraph distance from M to N</code> is
given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTParagraphDistanceFromTo (
      $allMatches as element(fts:allMatches),
      $m as xs:integer,
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt;
   {
      for $match in $allMatches/fts:match
      let $sorted := for $si in $match/fts:stringInclude          
                     order by $si/fts:tokenInfo/@startPara ascending,
                              $si/fts:tokenInfo/@endPara ascending
                     return $si
      where 
         if (fn:count($sorted) le 1) then fn:true() else
            every $index in (1 to fn:count($sorted) - 1)
            satisfies fts:paraDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &gt;= $m 
                      and
                      fts:paraDistance(
                          $sorted[$index]/fts:tokenInfo,
                          $sorted[$index+1]/fts:tokenInfo
                      ) &lt;= $n 
      return 
         &lt;fts:match&gt;
         {
            fts:joinIncludes($match/fts:stringInclude),
            for $stringExcl in $match/fts:stringExclude
            where some $stringIncl in $match/fts:stringInclude
                  satisfies fts:paraDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &gt;= $m
                            and
                            fts:paraDistance(
                                $stringIncl/fts:tokenInfo,
                                $stringExcl/fts:tokenInfo
                            ) &lt;= $n
            return $stringExcl
         }
         &lt;/fts:match&gt;
   }
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The preceding four helper functions all rely on
<code>fts:paraDistance</code>, which returns the number of
paragraphs between two <b>TokenInfo</b>s.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:paraDistance (
      $tokenInfo1 as element(fts:tokenInfo),
      $tokenInfo2 as element(fts:tokenInfo) )
   as xs:integer
{
   (: Ensure tokens are in order :)
   let $sorted :=
      for $ti in ($tokenInfo1, $tokenInfo2)
      order by $ti/@startPos ascending, $ti/@endPos ascending
      return $ti
   return
      (: -1 because we count starting at 0 :)
      $sorted[2]/@startPara - $sorted[1]/@endPara - 1
};
            
</pre></div>
</div>
<p>For example, consider the <b>FTDistance</b> selection
<code>("Ford Mustang" ftand "excellent") distance at most 3
words</code>. The <b>Match</b>es of the source <b>AllMatches</b>
for <code>("Ford Mustang" ftand "excellent")</code> are given
below.</p>
<img src="images/FTDistanceEx1.jpg" alt=
"FTDistance input AllMatches" />
<p><img src="images/FTDistanceEx2.jpg" alt=
"FTDistance input AllMatches" /></p>
<img src="images/FTDistanceEx3.jpg" alt=
"FTDistance input AllMatches" />
<p><img src="images/FTDistanceEx4.jpg" alt=
"FTDistance input AllMatches" /></p>
<img src="images/FTDistanceEx5.jpg" alt=
"FTDistance input AllMatches" />
<p><img src="images/FTDistanceEx6.jpg" alt=
"FTDistance input AllMatches" /></p>
<p>The result for the <b>FTDistance</b> selection consists of only
the first <b>Match</b> (with positions 1, 2, and 5) and the fifth
<b>Match</b> (with positions 25, 27, and 28), because only for
these <b>Match</b>es the word distance between consecutive
<b>TokenInfo</b>s is always less than or equal to 3. For the first
<b>Match</b>, the word distance between the two <b>TokenInfo</b>s
is 2 (<code>startPos</code> 5 - <code>endPos</code> 2 - 1), and for
the fifth <b>Match</b>, it's 1 (<code>startPos</code> 27 -
<code>endPos</code> 25 - 1).</p>
</div>
</div>
<div class="xquery">
<div class="div4">
<h5><a name="tq-ft-fs-FTTimes" id="tq-ft-fs-FTTimes"></a>4.2.6.10
FTTimes</h5>
<p>The parameters of the <code>ApplyFTTimes</code> function are 1)
an <b>FTRange</b> specification, and 2) a parameter corresponding
to the result of the nested <b>FTWords</b>.</p>
<p>The function definitions depend on the range specification
<b>FTRange</b> to limit the number of occurrences.</p>
<p>The general semantics is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:FormCombinations (
      $sms as element(fts:match)*, 
      $k as xs:integer ) 
   as element(fts:match)*
(:
   Find all combinations of exactly $k elements from $sms, and
   for each such combination, construct a match whose children are
   copies of all the children of all the elements in the combination.
   Return the sequence of all such matches.
:)
{
   if ($k eq 0) then &lt;fts:match/&gt;
   else if (fn:count($sms) lt $k) then ()
   else if (fn:count($sms) eq $k) then &lt;fts:match&gt;{$sms/*}&lt;/fts:match&gt;
   else
      let $first := $sms[1],
          $rest  := fn:subsequence($sms, 2)
      return (
         (: all the combinations that don't involve $first :)
         fts:FormCombinations($rest, $k),

         (: and all the combinations that do involve $first :)
         for $combination in fts:FormCombinations($rest, $k - 1)
         return
            &lt;fts:match&gt;
            {
               $first/*,
               $combination/*
            }
            &lt;/fts:match&gt;
      )
};

declare function fts:FormCombinationsAtLeast (
      $sms as element(fts:match)*,
      $times as xs:integer)
   as element(fts:match)*
(:
   Find all combinations of $times or more elements from $sms, and
   for each such combination, construct a match whose children are
   copies of all the children of all the elements in the combination.
   Return the sequence of all such matches.
:)
{
   for $k in $times to fn:count($sms)
   return fts:FormCombinations($sms, $k)
};

declare function fts:FormRange (
      $sms as element(fts:match)*, 
      $l as xs:integer, 
      $u as xs:integer, 
      $stokenNum as xs:integer ) 
   as element(fts:allMatches)
{
   if ($l &gt; $u) then &lt;fts:allMatches stokenNum="0" /&gt;
   else 
      let $am1 := &lt;fts:allMatches stokenNum="{$stokenNum}"&gt;
                     {fts:FormCombinationsAtLeast($sms, $l)}
                  &lt;/fts:allMatches&gt;
      let $am2 := &lt;fts:allMatches stokenNum="{$stokenNum}"&gt;
                     {fts:FormCombinationsAtLeast($sms, $u+1)}
                  &lt;/fts:allMatches&gt;
      return fts:ApplyFTAnd($am1,
                            fts:ApplyFTUnaryNot($am2))
};
            
</pre></div>
</div>
<p>The semantics of <code>occurs exactly N times</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTTimesExactly (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   fts:FormRange($allMatches/fts:match, $n, $n, $allMatches/@stokenNum)      
};
</pre></div>
</div>
<p>The semantics of <code>occurs at least N times</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTTimesAtLeast (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   &lt;fts:allMatches stokenNum="{$allMatches/@stokenNum}"&gt; 
   {fts:FormCombinationsAtLeast($allMatches/fts:match, $n)} 
   &lt;/fts:allMatches&gt;
};
</pre></div>
</div>
<p>The semantics of <code>occurs at most N times</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTTimesAtMost (
      $allMatches as element(fts:allMatches),
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   fts:FormRange($allMatches/fts:match, 0, $n, $allMatches/@stokenNum)
};
</pre></div>
</div>
<p>The semantics of <code>occurs from M to N times</code> is given
below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTTimesFromTo (
      $allMatches as element(fts:allMatches),
      $m as xs:integer,
      $n as xs:integer ) 
   as element(fts:allMatches) 
{
   fts:FormRange($allMatches/fts:match, $m, $n, $allMatches/@stokenNum)  
};
</pre></div>
</div>
<p>The way to ensure that there are at least <b>N</b> different
matches of an <b>FTSelection</b> is to ensure that at least
<b>N</b> of its <b>Match</b>es occur simultaneously. This is
similar to forming their conjunction by combining <b>N</b> or more
distinct <b>Match</b>es into one simple match. Therefore, the
<b>AllMatches</b> for the selection condition specifying the range
qualifier <code>at least N</code> contains the possible
combinations of <b>N</b> or more simple matches of the operand.
This operation is performed in the function
<code>fts:FormCombinationsAtLeast</code>.</p>
<p>The range [L, U] is represented by the condition <code>at least
L and not at least U+1</code>. This transformation is performed in
the function <code>fts:FormRange</code>.</p>
<p>The semantics for the general case is given below.</p>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:ApplyFTTimes (
      $range as element(fts:range),
      $allMatches as element(fts:allMatches) ) 
   as element(fts:allMatches) 
{
   if (fn:count($allMatches//fts:stringExclude) gt 0) then
      fn:error(fn:QName('http://www.w3.org/2005/xqt-errors',
                        'XPST0003'))
   else if ($range/@type eq "exactly") then
      fts:ApplyFTTimesExactly($allMatches, $range/@n)
   else if ($range/@type eq "at least") then 
      fts:ApplyFTTimesAtLeast($allMatches, $range/@n)
   else if ($range/@type eq "at most") then
      fts:ApplyFTTimesAtMost($allMatches, $range/@n)
   else fts:ApplyFTTimesFromTo($allMatches, 
                               $range/@m, 
                               $range/@n)
};
</pre></div>
</div>
<p>The above function performs a sanity check to ensure that the
nested <b>AllMatches</b> is a result of the evaluation of
<b>FTWords</b> as defined in the grammar rule for <a href=
"#doc-xquery10-FTPrimary">FTPrimary</a> . Otherwise, an error
[<a href="http://www.w3.org/TR/xpath20/#ERRXPST0003" title=
"err:XPST0003">err:XPST0003</a>]<sup><small>XP</small></sup> is
raised.</p>
<p>For example, consider the <b>FTTimes</b> selection
<code>"Mustang" occurs at least 2 times</code>. The source
<b>AllMatches</b> of the <b>FTWords</b> selection
<code>"Mustang"</code> is given below.</p>
<img src="images/FTTimesEx1.jpg" alt="FTTimes input AllMatches" />
<p>The result consists of the pairs of the <b>Match</b>es.</p>
<img src="images/FTTimesEx2.jpg" alt=
"FTTimes result AllMatches" /></div>
</div>
</div>
</div>
</div>
</div>
<div class="xquery">
<div class="div2">
<h3><a name="FTContainsSec" id="FTContainsSec"></a>4.3
FTContainsExpr</h3>
<p>Consider an <b>FTContainsExpr</b> expression of the form
<code>SearchContext contains text FTSelection</code>, where
<code>SearchContext</code> is an XQuery 1.0 expression that returns
a sequence of items. The <b>FTContainsExpr</b> returns true if and
only if one of those items satisfies the
<code>FTSelection</code>.</p>
<p>If the <b>FTContainsExpr</b> is of the form <code>SearchContext
contains text FTSelection without content IgnoreExpr</code> for
some XQuery 1.0 expression <code>IgnoreExpr</code>, then any nodes
returned by <code>IgnoreExpr</code> are (notionally) pruned from
each search context item before attempting to satisfy the
<code>FTSelection</code>.</p>
<p>More formally, evaluation of an <b>FTContainsExpr</b> proceeds
according to the following steps. Where appropriate, the
explanation includes references to arcs labelled "FTn" in the
processing model diagram (Figure 1) in <a href=
"#processing-model"><b>2.1 Processing Model</b></a>.</p>
<ol class="enumar">
<li>
<p>For each XQuery/XPath expression nested within the
FTContainsExpr, evaluate it with respect to the same dynamic
context as the FTContainsExpr (FT1). Specifically:</p>
<ol class="enumla">
<li>
<p>Evaluate the search context expression
(<code>SearchContext</code>), resulting in the sequence of search
context items.</p>
</li>
<li>
<p>Evaluate the ignore option (<code>IgnoreExpr</code>) if any,
resulting in the set of ignored nodes.</p>
</li>
<li>
<p>At each FTWordsValue, evaluate the literal/expression and
convert the result to <code>xs:string*</code>.</p>
</li>
<li>
<p>At each weight specification, evaluate the expression and
convert the result to <code>xs:double</code>.</p>
</li>
<li>
<p>At each FTWindow and FTRange, evaluate the AdditiveExpr(s) and
convert each to <code>xs:integer</code>.</p>
</li>
</ol>
</li>
<li>
<p>Using the settings of the match option components in the
FTContainsExpr's static context, construct an
<code>element(fts:matchOptions)</code> structure.</p>
</li>
<li>
<p>Based on the parse-tree of the FTContainsExpr's FTSelection and
the results of steps 1c-1e, construct an
<code>element(*,fts:ftSelection)</code> structure. We refer to this
as the "operator tree" below. In this process:</p>
<ol class="enumla">
<li>
<p>Construct the operator tree from the top down, propagating
FTMatchOptions down to FTWordsValues.</p>
</li>
<li>
<p>Tokenize the query string(s) obtained at 1c. (FT2.1)</p>
</li>
</ol>
</li>
<li>
<p>Call the function <code>fts:FTContainsExpr</code> (see
declaration below), passing the following arguments to its
parameters:</p>
<ul>
<li>
<p><code>$searchContextItems</code>: The sequence of items returned
by <code>SearchContext</code>, calculated in step 1a.</p>
</li>
<li>
<p><code>$ignoreNodes</code>: The sequence of items returned by
<code>IgnoreExpr</code> (in 1b), if that expression is present, or
the empty sequence otherwise.</p>
</li>
<li>
<p><code>$ftSelection</code>: The XML node representation of
<code>FTSelection</code> (constructed in step 2).</p>
</li>
<li>
<p><code>$defOptions</code>: The XML representation of the match
options in the FTContainsExpr's static context (constructed in step
3).</p>
</li>
</ul>
<p>Within the function, for each search context item:</p>
<ol class="enumla">
<li>
<p>Delete the ignored nodes from the search context item.
[<code>fts:FTContainsExpr</code> calls
<code>fts:reconstruct</code>.]</p>
</li>
<li>
<p>Traverse the operator tree from the top down, propagating
FTMatchOptions down to FTWordsValues. [<code>fts:evaluate</code>
calls itself and <code>fts:replaceMatchOptions</code>.]</p>
</li>
<li>
<p>At each FTWordsValue, using the prevailing FTMatchOptions:</p>
<ol class="enumlr">
<li>
<p>Tokenize the search context obtained at 4a. (FT2.2) (Whether
this pays any attention to FTMatchOptions is up to the
implementation.) [This happens within
<code>fts:matchTokenInfos</code>.]</p>
</li>
<li>
<p>Match the search context tokens and the query tokens, yielding
an <code>element(fts:tokenInfo)*</code> structure. [This happens
within <code>fts:matchTokenInfos</code>.]</p>
</li>
<li>
<p>Convert that into an <code>element(fts:allMatches)</code>. (FT3)
[This happens in <code>fts:applyQueryTokensAsPhrase</code>.]</p>
</li>
</ol>
</li>
<li>
<p>Traverse the operator tree from the bottom up. At each point,
the <b>AllMatches</b> instances produced by subtrees are taken as
input, and a new <b>AllMatches</b> instance is obtained as output.
(FT4) [This is most of the section 4 code.]</p>
</li>
<li>
<p>If the topmost <b>AllMatches</b> instance contains a
<b>Match</b> with no <b>StringExclude</b>s, then the search context
item satisfies the full-text condition given by the
<b>FTSelection</b>, and the call to <code>fts:FTContainsExpr</code>
returns <code>true</code>. [This is handled by the QuantifiedExpr
in <code>fts:FTContainsExpr</code>.]</p>
</li>
</ol>
<p>[Note that the section 4 code doesn't implement 4b-4d as three
sequential steps. Instead, they are different aspects of a single
traversal of the operator tree.]</p>
<p>If none of the topmost <b>AllMatches</b> provides a successful
match, then <code>fts:FTContainsExpr</code> returns
<code>false</code>.</p>
</li>
<li>
<p>The boolean value returned by the call to
<code>fts:FTContainsExpr</code> is the value of the FTContainsExpr.
(FT5)</p>
</li>
</ol>
<div class="semfunc-file-fts-xquery">
<div class="exampleInner">
<pre>
declare function fts:FTContainsExpr (
      $searchContextItems as item()*,
      $ignoreNodes as node()*,
      $ftSelection as element(*,fts:ftSelection),
      $defOptions as element(fts:matchOptions) )
   as xs:boolean 
{ 
   some $searchContext in $searchContextItems
   satisfies 
      let $newSearchContext := fts:reconstruct( $searchContext, $ignoreNodes )
      return
         if (fn:empty($newSearchContext)) then fn:false()
         else
            let $allMatches := fts:evaluate($ftSelection,
                                            $newSearchContext,
                                            $defOptions,
                                            0)
            return 
               some $match in $allMatches/fts:match
               satisfies 
                  fn:count($match/fts:stringExclude) eq 0
};

declare function fts:reconstruct (
      $n as item(),
      $ignore as node()* )
   as item()?
{
   typeswitch ($n)
     case node() return
        if (some $i in $ignore satisfies $n is $i) then ()
        else if ($n instance of element()) then
           let $nodeName := fn:node-name($n)
           let $nodeContent := for $nn in $n/node()
                               return fts:reconstruct($nn,$ignore)
           return element {$nodeName} {$nodeContent}
        else if ($n instance of document-node()) then
           document {
              for $nn in $n/node()
              return fts:reconstruct($nn, $ignore)
           }
        else $n
     default return $n
};
            
</pre></div>
</div>
</div>
</div>
<div class="xquery">
<div class="div2">
<h3><a name="ScoreSec" id="ScoreSec"></a>4.4 Scoring</h3>
<p>This section addresses the semantics of scoring variables in
XQuery 1.0 <code>for</code> and <code>let</code> clauses and XPath
2.0 <code>for</code> expressions.</p>
<p>Scoring variables associate a numeric score with the result of
the evaluation of XQuery 1.0 and XPath 2.0 expressions. This
numeric score tries to estimate the value of a result item to the
user information need expressed using the XQuery 1.0 and XPath 2.0
expression. The numeric score is computed using an <a title=
"implementation dependent" href=
"#dt-implementation-dependent">implementation-dependent</a>
<em>scoring algorithm</em>.</p>
<p>There are numerous scoring algorithms used in practice. Most of
the scoring algorithms take as inputs a query and a set of results
to the query. In computing the score, these algorithms rely on the
structure of the query to estimate the relevance of the
results.</p>
<p>In the context of defining the semantics of XQuery and XPath
Full Text, passing the structure of the query poses a problem. The
query may contain XQuery 1.0 and XPath 2.0 expressions and XQuery
and XPath Full Text 1.0 expressions in particular. The semantics of
XQuery 1.0 and XPath 2.0 expressions is defined using (among other
things) functions that take as arguments sequences of items and
return sequences of items. They are not aware of what expression
produced a particular sequence, i.e., they are not aware of the
expression structure.</p>
<p>To define the semantics of scoring in XQuery and XPath Full Text
1.0 using XQuery 1.0, expressions that produce the query result (or
the functions that implement the expressions) must be passed as
arguments. In other words, second-order functions are necessary.
Currently XQuery 1.0 and XPath 2.0 do not provide such
functions.</p>
<p>Nevertheless, in the interest of the exposition, assume that
such second-order functions are present. In particular, that there
are two semantic second-order function <code>fts:score</code> and
<code>fts:scoreSequence</code> that take one argument (an
expression) and return the score value of this expression,
respectively a sequence of score values, one for each item to which
the expression evaluates. The scores must satisfy <a href=
"#section-score-variables">scoring properties</a>.</p>
<p>A <code>for</code> clause containing a score variable</p>
<div class="exampleInner">
<pre>
for $result score $score in Expr
...
</pre></div>
<p>is evaluated as though it is replaced by the following the set
of clauses.</p>
<div class="exampleInner">
<pre>
let $scoreSeq := fts:scoreSequence(Expr)
for $result at $i in Expr
let $score := $scoreSeq[$i]
...
</pre></div>
<p>Here, <code>$scoreSeq</code> and <code>$i</code> are new
variables, not appearing elsewhere, and
<code>fts:scoreSequence</code> is the second-order function.</p>
<p>Similarly, a <code>let</code> clause containing a score
variable</p>
<div class="exampleInner">
<pre>
let score $score := Expr
...
</pre></div>
<p>is evaluated as though it is replaced by the following
clause.</p>
<div class="exampleInner">
<pre>
let $score := fts:score(Expr)
...
</pre></div>
</div>
</div>
<div class="xquery">
<div class="div2">
<h3><a name="tq-ft-FTContainsExpr-example" id=
"tq-ft-FTContainsExpr-example"></a>4.5 Example</h3>
<p>This section presents a more complex example for the evaluation
of <b>FTContainsExpr</b>. This example uses the same sample
document fragment and assigns it <code>$doc</code>. Consider the
following <b>FTContainsExpr</b>.</p>
<div class="xpath">
<div class="exampleInner">
<pre>
    $doc contains text (
        (
            "Mustang"
            ftand
            ({("great", "excellent")} any word occurs at least 2 times)
            window 11 words
        )
        ftand
        ftnot "rust"
    ) same paragraph
</pre></div>
</div>
<p>Begin by evaluating the <b>FTSelection</b> to
<b>AllMatches</b>.</p>
<div class="exampleInner">
<pre>
    (
        (
            "Mustang"
            ftand
            ({("great", "excellent")} any word occurs at least 2 times)
            window 11 words
        )
        ftand
        ftnot "rust"
    ) same paragraph
</pre></div>
<p>Step 1: Evaluate the <b>FTWords</b> <code>"Mustang"</code>.</p>
<img src="images/CompleteExample01.jpg" alt="Example, step 1" />
<p>Step 2: Evaluate the <b>FTWords</b> <code>{"great", "excellent"}
any word</code>.</p>
<p>Step 2.1: Match the token "great"</p>
<img src="images/CompleteExample02.jpg" alt="Example, step 2" />
<p>Step 2.2 Match the token "excellent"</p>
<img src="images/CompleteExample03.jpg" alt="Example, step 3" />
<p>Step 2.3 - Combine the above <b>AllMatches</b> as if <b>FTOr</b>
is used, i.e., by forming a union of the <b>Match</b>es.</p>
<img src="images/CompleteExample04.jpg" alt="Example, step 4" />
<p>Step 3 - Apply the <b>FTTimes</b> <code>{("great", "excellent")}
any word occurs at least 2 times</code> forming two pairs of
<b>Match</b>es.</p>
<img src="images/CompleteExample05_1.jpg" alt=
"Example, step 5.1" />
<p><img src="images/CompleteExample05_1_2.jpg" alt=
"Example, step 5.1" /></p>
<img src="images/CompleteExample05_2.jpg" alt=
"Example, step 5.2" />
<p>Step 4 - Apply the <b>FTAnd</b> <code>"Mustang" ftand
({("great", "excellent")} any word occurs at least 2 times)</code>
forming all possible pairs of <b>StringMatch</b>es.</p>
<img src="images/CompleteExample06_1.jpg" alt=
"Example, step 6.1" />
<p><img src="images/CompleteExample06_1_2.jpg" alt=
"Example, step 6.1" /></p>
<img src="images/CompleteExample06_2.jpg" alt=
"Example, step 6.2" />
<p><img src="images/CompleteExample06_2_2.jpg" alt=
"Example, step 6.2" /></p>
<img src="images/CompleteExample06_3.jpg" alt=
"Example, step 6.3" />
<p><img src="images/CompleteExample06_3_2.jpg" alt=
"Example, step 6.3" /></p>
<img src="images/CompleteExample06_4.jpg" alt=
"Example, step 6.4" />
<p><img src="images/CompleteExample06_4_2.jpg" alt=
"Example, step 6.4" /></p>
<img src="images/CompleteExample06_5.jpg" alt=
"Example, step 6.5" />
<p><img src="images/CompleteExample06_5_2.jpg" alt=
"Example, step 6.5" /></p>
<p>Step 5 - Apply the <b>FTWindow</b> <code>( "Mustang" ftand
({("great", "excellent")} any word occurs at least 2 times) window
11 words )</code> , filtering out <b>Match</b>es for which the
window is not less than or equal to 11 tokens.</p>
<img src="images/CompleteExample07_1.jpg" alt=
"Example, step 7.1" />
<p><img src="images/CompleteExample07_2.jpg" alt=
"Example, step 7.2" /></p>
<img src="images/CompleteExample07_2_2.jpg" alt=
"Example, step 7.2" />
<p>Step 6 - Evaluate <b>FTWords</b> <code>"rust"</code>.</p>
<img src="images/CompleteExample08.jpg" alt="Example, step 8" />
<p>Step 7 - Apply the <b>FTUnaryNot</b> <code>ftnot "rust"</code>,
transforming the <code>StringInclude</code> into a
<code>StringExclude</code>.</p>
<img src="images/CompleteExample09.jpg" alt="Example, step 9" />
<p>Step 8 - Apply the <b>FTAnd</b> <code>( ( "Mustang" ftand
({("great", "excellent")} any word occurs at least 2 times) window
11 words ) ftand ftnot "rust" )</code> , forming all possible
combintations of three <b>StringMatch</b>es from the first
<b>AllMatches</b> and one <b>StringMatch</b> from the second
<b>AllMatches</b>.</p>
<img src="images/CompleteExample10_1.jpg" alt=
"Example, step 10.1" />
<p><img src="images/CompleteExample10_2.jpg" alt=
"Example, step 10.2" /></p>
<img src="images/CompleteExample10_3.jpg" alt=
"Example, step 10.3" />
<p>Step 9: Apply the <b>FTScope</b>, filtering out <b>Match</b>es
whose <b>TokenInfo</b>s are not within the same paragraph (assuming
the <code>&lt;offer&gt;</code> elements determine paragraph
boundaries).</p>
<img src="images/CompleteExample11.jpg" alt="Example, step 11" />
<p>The resulting <b>AllMatches</b> contains a <b>Match</b> that
does not contain a <b>StringExclude</b>. Therefore, the sample
<b>FTContainsExpr</b> returns <code>true</code>.</p>
</div>
</div>
</div>
<div class="div1">
<h2><a name="id-tq-conformance" id="id-tq-conformance"></a>5
Conformance</h2>
<p>This section defines the conformance criteria for a XQuery and
XPath Full Text 1.0 processor.</p>
<p>In this section, the following terms are used to indicate the
requirement levels defined in <a href="#RFC2119">[RFC 2119]</a>.
[<a name="must" id="must" title="must">Definition</a>: <b>MUST</b>
means that the item is an absolute requirement of the
specification.] [<a name="may" id="may" title="may">Definition</a>:
<b>MAY</b> means that an item is truly optional.] [<a name="should"
id="should" title="should">Definition</a>: <b>SHOULD</b> means that
there may exist valid reasons in particular circumstances to ignore
a particular item, but the full implications must be understood and
carefully weighed before choosing a different course.]</p>
<p>An XQuery and XPath Full Text 1.0 processor that claims to
conform to this specification <a title="must" href="#must">MUST</a>
include a claim of Minimal Conformance as defined in <a href=
"#id-minimal-conformance"><b>5.1 Minimal Conformance</b></a>. In
addition to a claim of Minimal Conformance, it <a title="may" href=
"#may">MAY</a> claim conformance to one or more optional features
defined in <a href="#id-conform-optional-features"><b>5.2 Optional
Features</b></a></p>
<div class="div2">
<h3><a name="id-minimal-conformance" id=
"id-minimal-conformance"></a>5.1 Minimal Conformance</h3>
<p>Minimal Conformance to this specification <a title="must" href=
"#must">MUST</a> include all of the following items:</p>
<ol class="enumar">
<li>
<p>Minimal support for XQuery 1.0 <a href="#xquery">[XQuery 1.0: An
XML Query Language (Second Edition)]</a> or XPath 2.0 <a href=
"#xpath20">[XML Path Language (XPath) 2.0 (Second Edition)]</a>.
The optional features of XQuery 1.0 <a href="#xquery">[XQuery 1.0:
An XML Query Language (Second Edition)]</a> or XPath 2.0 <a href=
"#xpath20">[XML Path Language (XPath) 2.0 (Second Edition)]</a>
<a title="may" href="#may">MAY</a> be supported.</p>
</li>
<li>
<p>Support for everything specified in this document except those
operators and match options specified in <a href=
"#id-conform-optional-features"><b>5.2 Optional Features</b></a> to
be optional. If an implementation does not provide a given optional
operator or match option, it <a title="must" href="#must">MUST</a>
implement any requirements specified in <a href=
"#id-conform-optional-features"><b>5.2 Optional Features</b></a>
for implementations that do not provide that operator or match
option.</p>
</li>
<li>
<p>A definition of every item specified to be <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> in <a href=
"#impl-def"><b>I Checklist of Implementation-Defined
Features</b></a>.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Implementations are not required to define items specified to be
<a title="implementation dependent" href=
"#dt-implementation-dependent">implementation-dependent</a></p>
</div>
</li>
</ol>
</div>
<div class="div2">
<h3><a name="id-conform-optional-features" id=
"id-conform-optional-features"></a>5.2 Optional Features</h3>
<div class="div3">
<h4><a name="id-ftmildnot-option" id=
"id-ftmildnot-option"></a>5.2.1 FTMildNot Operator</h4>
<p>It is optional whether the implementation supports the
FTMildNot. If it does not support FTMildNot and encounters one in a
full-text query, then it <a title="must" href="#must">MUST</a>
raise an error [<a href="#ERRFTST0001" title=
"err:FTST0001">err:FTST0001</a>].</p>
</div>
<div class="div3">
<h4><a name="id-unary-not-option" id=
"id-unary-not-option"></a>5.2.2 FTUnaryNot Operator</h4>
<p>The unrestricted form of negation in FTUnaryNot, that can negate
every kind of FTSelection, is optional. Implementations may choose
to support the negation operation in a restricted form, enforcing
one or both of the following restrictions.</p>
<ul>
<li>
<p>[<a name="id-Negation-Restriction-1" id=
"id-Negation-Restriction-1" title=
"Negation Restriction 1">Definition</a>: <b>Negation Restriction
1.</b> An <a href="#doc-xquery10-FTUnaryNot">FTUnaryNot</a>
expression may only appear as a direct right operand of an "ftand"
(<a href="#doc-xquery10-FTAnd">FTAnd</a>) operation.]</p>
</li>
<li>
<p>[<a name="id-Negation-Restriction-2" id=
"id-Negation-Restriction-2" title=
"Negation Restriction 2">Definition</a>: <b>Negation Restriction
2.</b> An <a href="#doc-xquery10-FTUnaryNot">FTUnaryNot</a>
expression may not appear as a descendant of an <a href=
"#doc-xquery10-FTOr">FTOr</a> that is modified by an <a href=
"#doc-xquery10-FTPosFilter">FTPosFilter</a>. (An FTOr is modified
by an FTPosFilter, if it is derived using the production for
<a href="#doc-xquery10-FTSelection">FTSelection</a> together with
that FTPosFilter.)]</p>
</li>
</ul>
<p>Consider the following example FTSelections.</p>
<div class="exampleInner">
<pre>
1. ftnot "web"

2. "web" ftand ( ftnot "information" ftor "retrieval" )

3. "web" ftand ftnot("information" ftand "retrieval")

4. "web" ftand ftnot("information" ftand "retrieval" window 5 words)

5. "web" ftand ("information" ftand ftnot "retrieval" window 5 words)
</pre></div>
<p>The first two FTSelections both violate restriction 1, while the
third and the fourth are conform with both restrictions. The fifth
one violates restriction 2, while obeying restriction 1. Note that
in the last example the FTSelection to which the window operation
is applied is <code>"information" ftand ftnot "retrieval"</code>,
which contains an FTUnaryNot expression.</p>
<p>If the implementation does enforce one or both of these
restrictions on FTUnaryNot and encounters a full-text query that
does not obey the restriction then it <a title="must" href=
"#must">MUST</a> raise an error [<a href="#ERRFTST0002" title=
"err:FTST0002">err:FTST0002</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftunit-option" id="id-ftunit-option"></a>5.2.3
FTUnit and FTBigUnit</h4>
<p>Support for the "sentences" alternative of <a href=
"#doc-xquery10-FTUnit">FTUnit</a> and the "sentence" alternative of
<a href="#doc-xquery10-FTBigUnit">FTBigUnit</a> is optional.
Similarly, support for the "paragraphs" alternative of FTUnit and
the "paragraph" alternative of FTBigUnit is optional. If an
implementation does not support one or more choices of FTUnit or
FTBigUnit and encounters an unsupported FTUnit or FTBigUnit in a
full-text query, then it <a title="must" href="#must">MUST</a>
raise an error [<a href="#ERRFTST0003" title=
"err:FTST0003">err:FTST0003</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftorder-option" id="id-ftorder-option"></a>5.2.4
FTOrder Operator</h4>
<p>The unrestricted form of the FTOrder postfix operator, that can
be applied to any kind of FTSelection, is optional. Implementations
may choose to enforce the following restriction on the use of
FTOrder.</p>
<p>[<a name="id-Order-Operator-Restriction" id=
"id-Order-Operator-Restriction" title=
"Order Operator Restriction">Definition</a>: <b>Order Operator
Restriction.</b> FTOrder may only appear directly succeeding an
FTWindow or an FTDistance operator.]</p>
<p>If the implementation does enforce this restriction and
encounters a full-text query that does not obey the restriction
then it <a title="must" href="#must">MUST</a> raise an error
[<a href="#ERRFTST0010" title="err:FTST0010">err:FTST0010</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftscope-option" id="id-ftscope-option"></a>5.2.5
FTScope Operator</h4>
<p>It is optional whether the implementation supports the FTScope
operator. If it does not support FTScope and encounters one in a
full-text query, then it <a title="must" href="#must">MUST</a>
raise an error [<a href="#ERRFTST0004" title=
"err:FTST0004">err:FTST0004</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftwindow-option" id="id-ftwindow-option"></a>5.2.6
FTWindow Operator</h4>
<p>The unrestricted form of the FTWindow postfix operator, that can
be applied to any kind of FTSelection, is optional. Implementations
may choose to enforce the following restriction on the use of
FTWindow.</p>
<p>[<a name="id-Window-Operator-Restriction" id=
"id-Window-Operator-Restriction" title=
"Window Operator Restriction">Definition</a>: <b>Window Operator
Restriction.</b> FTWindow can only be applied to an FTOr that is
either a single FTWords or a combination of FTWords involving only
the operators ftand and ftor.]</p>
<p>If the implementation does enforce this restriction and
encounters a full-text query that does not obey the restriction
then it <a title="must" href="#must">MUST</a> raise an error
[<a href="#ERRFTST0011" title="err:FTST0011">err:FTST0011</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftdistance-option" id=
"id-ftdistance-option"></a>5.2.7 FTDistance Operator</h4>
<p>The unrestricted form of the FTDistance postfix operator, that
can be applied to any kind of FTSelection, is optional.
Implementations may choose to enforce the following restriction on
the use of FTDistance.</p>
<p>[<a name="id-Distance-Operator-Restriction" id=
"id-Distance-Operator-Restriction" title=
"Distance Operator Restriction">Definition</a>: <b>Distance
Operator Restriction.</b> FTDistance can only be applied to an FTOr
that is either a single FTWords or a combination of FTWords
involving only the operators ftand and ftor.]</p>
<p>If the implementation does enforce this restriction and
encounters a full-text query that does not obey the restriction
then it <a title="must" href="#must">MUST</a> raise an error
[<a href="#ERRFTST0011" title="err:FTST0011">err:FTST0011</a>].</p>
</div>
<div class="div3">
<h4><a name="id-fttimes-option" id="id-fttimes-option"></a>5.2.8
FTTimes Operator</h4>
<p>It is optional whether the implementation supports the FTTimes
operator. If it does not support FTTimes and encounters one in a
full-text query, then it <a title="must" href="#must">MUST</a>
raise an error [<a href="#ERRFTST0005" title=
"err:FTST0005">err:FTST0005</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftcontent-option" id=
"id-ftcontent-option"></a>5.2.9 FTContent Operator</h4>
<p>It is optional whether the implementation supports the FTContent
operator. If it does not support FTContent and encounters one in a
full-text query, then it <a title="must" href="#must">MUST</a>
raise an error [<a href="#ERRFTST0012" title=
"err:FTST0012">err:FTST0012</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftcase-option" id="id-ftcase-option"></a>5.2.10
FTCaseOption</h4>
<p>It is optional whether the implementation supports the
"lowercase" and "uppercase" choices for the FTCaseOption. If it
does not support these choices for the FTCaseOption and encounters
an unsupported choice in a full-text query, then it <a title="must"
href="#must">MUST</a> raise an error [<a href="#ERRFTST0015" title=
"err:FTST0015">err:FTST0015</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftstopword-option" id=
"id-ftstopword-option"></a>5.2.11 FTStopWordOption</h4>
<p>It is optional whether the implementation supports the
FTStopWordOption. If it does not support FTStopWordOption and
encounters one in a full-text query, then it <a title="must" href=
"#must">MUST</a> raise an error [<a href="#ERRFTST0006" title=
"err:FTST0006">err:FTST0006</a>].</p>
<p>It is optional whether the implementation supports the
FTStopWordOption in the body of the query. If it supports
FTStopWordOption in the prolog, but not in the body of a query, and
encounters one in the body of a query it <a title="must" href=
"#must">MUST</a> raise an error [<a href="#ERRFTST0006" title=
"err:FTST0006">err:FTST0006</a>].</p>
<p>It is optional whether the implementation supports the
StringLiteral alternative of <a href=
"#doc-xquery10-FTStopWords">FTStopWords</a> in the
FTStopWordOption. If it does not support the StringLiteral
alternative of FTStopWords and encounters such an alternative in a
full-text query, then it <a title="must" href="#must">MUST</a>
raise an error [<a href="#ERRFTST0006" title=
"err:FTST0006">err:FTST0006</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftlanguage-option" id=
"id-ftlanguage-option"></a>5.2.12 FTLanguageOption</h4>
<p>It is optional whether the implementation supports the
unrestricted form of FTLanguageOption. Implementations may choose
to enforce the following restriction on the use of
FTLanguageOption.</p>
<p>[<a name="id-Single-Language-Restriction" id=
"id-Single-Language-Restriction" title=
"Single Language Restriction">Definition</a>: <b>Single Language
Restriction.</b> If a full-text query contains more than one
FTLanguageOption in its body and the prolog, then the languages
specified must be the same.]</p>
<p>If the implementation does enforce this restriction and
encounters a full-text query that does not obey the restriction
then it <a title="must" href="#must">MUST</a> raise an error
[<a href="#ERRFTST0013" title="err:FTST0013">err:FTST0013</a>].</p>
</div>
<div class="div3">
<h4><a name="id-ftignore-option" id="id-ftignore-option"></a>5.2.13
FTIgnoreOption</h4>
<p>The implementation may constrain the set of ignored nodes. If
the operand of <a href=
"#doc-xquery10-FTIgnoreOption">FTIgnoreOption</a> violates the
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> restriction
on that operand, it <a title="must" href="#must">MUST</a> raise an
error [<a href="#ERRFTST0007" title=
"err:FTST0007">err:FTST0007</a>].</p>
</div>
<div class="div3">
<h4><a name="id-scoring-option" id="id-scoring-option"></a>5.2.14
Scoring</h4>
<p>The implementation may restrict the allowable expressions used
to compute scores. The restrictions are <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
<p>If the implementation does enforce such restrictions and
encounters a full-text query that does not obey the restriction
then it <a title="must" href="#must">MUST</a> raise an error
[<a href="#ERRFTST0014" title="err:FTST0014">err:FTST0014</a>].</p>
</div>
<div class="div3">
<h4><a name="id-weights-conf" id="id-weights-conf"></a>5.2.15
Weights</h4>
<p>An implementation may constrain the range of valid weights to
non-negative values. If an implementation does enforce this
restriction and encounters a full-text query that uses a negative
weight, it <a title="must" href="#must">MUST</a> raise an error
[<a href="#ERRFTDY0016" title="err:FTDY0016">err:FTDY0016</a>].</p>
</div>
</div>
</div>
<div class="div1">
<h2><a name="id-xqueryx-full-text-conformance" id=
"id-xqueryx-full-text-conformance"></a>6 XQueryX Conformance</h2>
<p>This section defines the conformance criteria for an XQueryX
processor that includes the Full Text capability.</p>
<p>In this section, the terms <a title="must" href=
"#must">MUST</a>, <a title="may" href="#may">MAY</a>, and <a title=
"should" href="#should">SHOULD</a> are used as defined in <a href=
"#id-tq-conformance"><b>5 Conformance</b></a>.</p>
<p>An XQueryX processor that claims to conform to this
specification <a title="must" href="#must">MUST</a> implement the
XQueryX syntax as defined in <a href="#id-xqft-xqueryx"><b>E XML
Syntax (XQueryX) for XQuery and XPath Full Text 1.0</b></a> and
include a claim of Minimal Conformance as defined in <a href=
"#id-minimal-conformance"><b>5.1 Minimal Conformance</b></a>. In
addition to a claim of Minimal Conformance, it <a title="may" href=
"#may">MAY</a> claim conformance to one or more optional features
defined in <a href="#id-conform-optional-features"><b>5.2 Optional
Features</b></a>.</p>
</div>
</div>
<div class="back">
<div class="div1">
<h2><a name="id-grammar" id="id-grammar"></a>A EBNF for XQuery 1.0
Grammar with Full Text extensions</h2>
<p>The EBNF in this document and in this section is aligned with
the current XML Query 1.0 grammar (see <a href=
"http://www.w3.org/TR/2010/REC-xquery-20101214/">http://www.w3.org/TR/2010/REC-xquery-20101214/</a>).</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Module" id=
"prod-xquery10-Module"></a>[1]&#160;&#160;&#160;</td>
<td><code>Module</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-VersionDecl">VersionDecl</a>?
(<a href="#prod-xquery10-LibraryModule">LibraryModule</a> |
<a href="#prod-xquery10-MainModule">MainModule</a>)</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-VersionDecl" id=
"prod-xquery10-VersionDecl"></a>[2]&#160;&#160;&#160;</td>
<td><code>VersionDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"xquery" "version" <a href=
"#prod-xquery10-StringLiteral">StringLiteral</a> ("encoding"
<a href="#prod-xquery10-StringLiteral">StringLiteral</a>)? <a href=
"#prod-xquery10-Separator">Separator</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-MainModule" id=
"prod-xquery10-MainModule"></a>[3]&#160;&#160;&#160;</td>
<td><code>MainModule</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Prolog">Prolog</a> <a href=
"#prod-xquery10-QueryBody">QueryBody</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-LibraryModule" id=
"prod-xquery10-LibraryModule"></a>[4]&#160;&#160;&#160;</td>
<td><code>LibraryModule</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-ModuleDecl">ModuleDecl</a>
<a href="#prod-xquery10-Prolog">Prolog</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ModuleDecl" id=
"prod-xquery10-ModuleDecl"></a>[5]&#160;&#160;&#160;</td>
<td><code>ModuleDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"module" "namespace" <a href=
"#prod-xquery10-NCName">NCName</a> "=" <a href=
"#prod-xquery10-URILiteral">URILiteral</a> <a href=
"#prod-xquery10-Separator">Separator</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Prolog" id=
"prod-xquery10-Prolog"></a>[6]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-Prolog"></a><a href=
"#doc-xquery10-Prolog">Prolog</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>((<a href=
"#prod-xquery10-DefaultNamespaceDecl">DefaultNamespaceDecl</a> |
<a href="#prod-xquery10-Setter">Setter</a> | <a href=
"#prod-xquery10-NamespaceDecl">NamespaceDecl</a> | <a href=
"#prod-xquery10-Import">Import</a> | <a href=
"#prod-xquery10-FTOptionDecl">FTOptionDecl</a>) <a href=
"#prod-xquery10-Separator">Separator</a>)* ((<a href=
"#prod-xquery10-VarDecl">VarDecl</a> | <a href=
"#prod-xquery10-FunctionDecl">FunctionDecl</a> | <a href=
"#prod-xquery10-OptionDecl">OptionDecl</a>) <a href=
"#prod-xquery10-Separator">Separator</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Separator" id=
"prod-xquery10-Separator"></a>[7]&#160;&#160;&#160;</td>
<td><code>Separator</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>";"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Setter" id=
"prod-xquery10-Setter"></a>[8]&#160;&#160;&#160;</td>
<td><code>Setter</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-BoundarySpaceDecl">BoundarySpaceDecl</a> | <a href=
"#prod-xquery10-DefaultCollationDecl">DefaultCollationDecl</a> |
<a href="#prod-xquery10-BaseURIDecl">BaseURIDecl</a> | <a href=
"#prod-xquery10-ConstructionDecl">ConstructionDecl</a> | <a href=
"#prod-xquery10-OrderingModeDecl">OrderingModeDecl</a> | <a href=
"#prod-xquery10-EmptyOrderDecl">EmptyOrderDecl</a> | <a href=
"#prod-xquery10-CopyNamespacesDecl">CopyNamespacesDecl</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-BoundarySpaceDecl" id=
"prod-xquery10-BoundarySpaceDecl"></a>[9]&#160;&#160;&#160;</td>
<td><code>BoundarySpaceDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "boundary-space" ("preserve" |
"strip")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DefaultCollationDecl" id=
"prod-xquery10-DefaultCollationDecl"></a>[10]&#160;&#160;&#160;</td>
<td><code>DefaultCollationDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "default" "collation" <a href=
"#prod-xquery10-URILiteral">URILiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-BaseURIDecl" id=
"prod-xquery10-BaseURIDecl"></a>[11]&#160;&#160;&#160;</td>
<td><code>BaseURIDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "base-uri" <a href=
"#prod-xquery10-URILiteral">URILiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ConstructionDecl" id=
"prod-xquery10-ConstructionDecl"></a>[12]&#160;&#160;&#160;</td>
<td><code>ConstructionDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "construction" ("strip" |
"preserve")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-OrderingModeDecl" id=
"prod-xquery10-OrderingModeDecl"></a>[13]&#160;&#160;&#160;</td>
<td><code>OrderingModeDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "ordering" ("ordered" |
"unordered")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-EmptyOrderDecl" id=
"prod-xquery10-EmptyOrderDecl"></a>[14]&#160;&#160;&#160;</td>
<td><code>EmptyOrderDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "default" "order" "empty" ("greatest" |
"least")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CopyNamespacesDecl" id=
"prod-xquery10-CopyNamespacesDecl"></a>[15]&#160;&#160;&#160;</td>
<td><code>CopyNamespacesDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "copy-namespaces" <a href=
"#prod-xquery10-PreserveMode">PreserveMode</a> "," <a href=
"#prod-xquery10-InheritMode">InheritMode</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-PreserveMode" id=
"prod-xquery10-PreserveMode"></a>[16]&#160;&#160;&#160;</td>
<td><code>PreserveMode</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"preserve" | "no-preserve"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-InheritMode" id=
"prod-xquery10-InheritMode"></a>[17]&#160;&#160;&#160;</td>
<td><code>InheritMode</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"inherit" | "no-inherit"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Import" id=
"prod-xquery10-Import"></a>[18]&#160;&#160;&#160;</td>
<td><code>Import</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-SchemaImport">SchemaImport</a> |
<a href="#prod-xquery10-ModuleImport">ModuleImport</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-SchemaImport" id=
"prod-xquery10-SchemaImport"></a>[19]&#160;&#160;&#160;</td>
<td><code>SchemaImport</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"import" "schema" <a href=
"#prod-xquery10-SchemaPrefix">SchemaPrefix</a>? <a href=
"#prod-xquery10-URILiteral">URILiteral</a> ("at" <a href=
"#prod-xquery10-URILiteral">URILiteral</a> ("," <a href=
"#prod-xquery10-URILiteral">URILiteral</a>)*)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-SchemaPrefix" id=
"prod-xquery10-SchemaPrefix"></a>[20]&#160;&#160;&#160;</td>
<td><code>SchemaPrefix</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("namespace" <a href="#prod-xquery10-NCName">NCName</a>
"=") | ("default" "element" "namespace")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ModuleImport" id=
"prod-xquery10-ModuleImport"></a>[21]&#160;&#160;&#160;</td>
<td><code>ModuleImport</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"import" "module" ("namespace" <a href=
"#prod-xquery10-NCName">NCName</a> "=")? <a href=
"#prod-xquery10-URILiteral">URILiteral</a> ("at" <a href=
"#prod-xquery10-URILiteral">URILiteral</a> ("," <a href=
"#prod-xquery10-URILiteral">URILiteral</a>)*)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-NamespaceDecl" id=
"prod-xquery10-NamespaceDecl"></a>[22]&#160;&#160;&#160;</td>
<td><code>NamespaceDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "namespace" <a href=
"#prod-xquery10-NCName">NCName</a> "=" <a href=
"#prod-xquery10-URILiteral">URILiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DefaultNamespaceDecl" id=
"prod-xquery10-DefaultNamespaceDecl"></a>[23]&#160;&#160;&#160;</td>
<td><code>DefaultNamespaceDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "default" ("element" | "function") "namespace"
<a href="#prod-xquery10-URILiteral">URILiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTOptionDecl" id=
"prod-xquery10-FTOptionDecl"></a>[24]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTOptionDecl"></a><a href=
"#doc-xquery10-FTOptionDecl">FTOptionDecl</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "ft-option" <a href=
"#prod-xquery10-FTMatchOptions">FTMatchOptions</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-VarDecl" id=
"prod-xquery10-VarDecl"></a>[25]&#160;&#160;&#160;</td>
<td><code>VarDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "variable" "$" <a href=
"#prod-xquery10-QName">QName</a> <a href=
"#prod-xquery10-TypeDeclaration">TypeDeclaration</a>? ((":="
<a href="#prod-xquery10-ExprSingle">ExprSingle</a>) |
"external")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FunctionDecl" id=
"prod-xquery10-FunctionDecl"></a>[26]&#160;&#160;&#160;</td>
<td><code>FunctionDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "function" <a href=
"#prod-xquery10-QName">QName</a> "(" <a href=
"#prod-xquery10-ParamList">ParamList</a>? ")" ("as" <a href=
"#prod-xquery10-SequenceType">SequenceType</a>)? (<a href=
"#prod-xquery10-EnclosedExpr">EnclosedExpr</a> |
"external")</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-reserved-function-names">xgc:
reserved-function-names</a><sup><small>XQ</small></sup></span>
*/</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ParamList" id=
"prod-xquery10-ParamList"></a>[27]&#160;&#160;&#160;</td>
<td><code>ParamList</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Param">Param</a> ("," <a href=
"#prod-xquery10-Param">Param</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Param" id=
"prod-xquery10-Param"></a>[28]&#160;&#160;&#160;</td>
<td><code>Param</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"$" <a href="#prod-xquery10-QName">QName</a> <a href=
"#prod-xquery10-TypeDeclaration">TypeDeclaration</a>?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-EnclosedExpr" id=
"prod-xquery10-EnclosedExpr"></a>[29]&#160;&#160;&#160;</td>
<td><code>EnclosedExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"{" <a href="#prod-xquery10-Expr">Expr</a>
"}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-OptionDecl" id=
"prod-xquery10-OptionDecl"></a>[30]&#160;&#160;&#160;</td>
<td><code>OptionDecl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"declare" "option" <a href=
"#prod-xquery10-QName">QName</a> <a href=
"#prod-xquery10-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-QueryBody" id=
"prod-xquery10-QueryBody"></a>[31]&#160;&#160;&#160;</td>
<td><code>QueryBody</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Expr">Expr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Expr" id=
"prod-xquery10-Expr"></a>[32]&#160;&#160;&#160;</td>
<td><code>Expr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-ExprSingle">ExprSingle</a> (","
<a href="#prod-xquery10-ExprSingle">ExprSingle</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ExprSingle" id=
"prod-xquery10-ExprSingle"></a>[33]&#160;&#160;&#160;</td>
<td><code>ExprSingle</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FLWORExpr">FLWORExpr</a><br />
| <a href="#prod-xquery10-QuantifiedExpr">QuantifiedExpr</a><br />
| <a href="#prod-xquery10-TypeswitchExpr">TypeswitchExpr</a><br />
| <a href="#prod-xquery10-IfExpr">IfExpr</a><br />
| <a href="#prod-xquery10-OrExpr">OrExpr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FLWORExpr" id=
"prod-xquery10-FLWORExpr"></a>[34]&#160;&#160;&#160;</td>
<td><code>FLWORExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-ForClause">ForClause</a> |
<a href="#prod-xquery10-LetClause">LetClause</a>)+ <a href=
"#prod-xquery10-WhereClause">WhereClause</a>? <a href=
"#prod-xquery10-OrderByClause">OrderByClause</a>? "return" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ForClause" id=
"prod-xquery10-ForClause"></a>[35]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-ForClause"></a><a href=
"#doc-xquery10-ForClause">ForClause</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"for" "$" <a href="#prod-xquery10-VarName">VarName</a>
<a href="#prod-xquery10-TypeDeclaration">TypeDeclaration</a>?
<a href="#prod-xquery10-PositionalVar">PositionalVar</a>? <a href=
"#prod-xquery10-FTScoreVar">FTScoreVar</a>? "in" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a> ("," "$" <a href=
"#prod-xquery10-VarName">VarName</a> <a href=
"#prod-xquery10-TypeDeclaration">TypeDeclaration</a>? <a href=
"#prod-xquery10-PositionalVar">PositionalVar</a>? <a href=
"#prod-xquery10-FTScoreVar">FTScoreVar</a>? "in" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-PositionalVar" id=
"prod-xquery10-PositionalVar"></a>[36]&#160;&#160;&#160;</td>
<td><code>PositionalVar</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"at" "$" <a href=
"#prod-xquery10-VarName">VarName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTScoreVar" id=
"prod-xquery10-FTScoreVar"></a>[37]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTScoreVar"></a><a href=
"#doc-xquery10-FTScoreVar">FTScoreVar</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"score" "$" <a href=
"#prod-xquery10-VarName">VarName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-LetClause" id=
"prod-xquery10-LetClause"></a>[38]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-LetClause"></a><a href=
"#doc-xquery10-LetClause">LetClause</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"let" (("$" <a href="#prod-xquery10-VarName">VarName</a>
<a href="#prod-xquery10-TypeDeclaration">TypeDeclaration</a>?) |
<a href="#prod-xquery10-FTScoreVar">FTScoreVar</a>) ":=" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a> ("," (("$" <a href=
"#prod-xquery10-VarName">VarName</a> <a href=
"#prod-xquery10-TypeDeclaration">TypeDeclaration</a>?) | <a href=
"#prod-xquery10-FTScoreVar">FTScoreVar</a>) ":=" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-WhereClause" id=
"prod-xquery10-WhereClause"></a>[39]&#160;&#160;&#160;</td>
<td><code>WhereClause</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"where" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-OrderByClause" id=
"prod-xquery10-OrderByClause"></a>[40]&#160;&#160;&#160;</td>
<td><code>OrderByClause</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(("order" "by") | ("stable" "order" "by")) <a href=
"#prod-xquery10-OrderSpecList">OrderSpecList</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-OrderSpecList" id=
"prod-xquery10-OrderSpecList"></a>[41]&#160;&#160;&#160;</td>
<td><code>OrderSpecList</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-OrderSpec">OrderSpec</a> (","
<a href="#prod-xquery10-OrderSpec">OrderSpec</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-OrderSpec" id=
"prod-xquery10-OrderSpec"></a>[42]&#160;&#160;&#160;</td>
<td><code>OrderSpec</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-ExprSingle">ExprSingle</a>
<a href=
"#prod-xquery10-OrderModifier">OrderModifier</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-OrderModifier" id=
"prod-xquery10-OrderModifier"></a>[43]&#160;&#160;&#160;</td>
<td><code>OrderModifier</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("ascending" | "descending")? ("empty" ("greatest" |
"least"))? ("collation" <a href=
"#prod-xquery10-URILiteral">URILiteral</a>)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-QuantifiedExpr" id=
"prod-xquery10-QuantifiedExpr"></a>[44]&#160;&#160;&#160;</td>
<td><code>QuantifiedExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("some" | "every") "$" <a href=
"#prod-xquery10-VarName">VarName</a> <a href=
"#prod-xquery10-TypeDeclaration">TypeDeclaration</a>? "in" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a> ("," "$" <a href=
"#prod-xquery10-VarName">VarName</a> <a href=
"#prod-xquery10-TypeDeclaration">TypeDeclaration</a>? "in" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a>)* "satisfies" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-TypeswitchExpr" id=
"prod-xquery10-TypeswitchExpr"></a>[45]&#160;&#160;&#160;</td>
<td><code>TypeswitchExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"typeswitch" "(" <a href="#prod-xquery10-Expr">Expr</a>
")" <a href="#prod-xquery10-CaseClause">CaseClause</a>+ "default"
("$" <a href="#prod-xquery10-VarName">VarName</a>)? "return"
<a href="#prod-xquery10-ExprSingle">ExprSingle</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CaseClause" id=
"prod-xquery10-CaseClause"></a>[46]&#160;&#160;&#160;</td>
<td><code>CaseClause</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"case" ("$" <a href="#prod-xquery10-VarName">VarName</a>
"as")? <a href="#prod-xquery10-SequenceType">SequenceType</a>
"return" <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-IfExpr" id=
"prod-xquery10-IfExpr"></a>[47]&#160;&#160;&#160;</td>
<td><code>IfExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"if" "(" <a href="#prod-xquery10-Expr">Expr</a> ")"
"then" <a href="#prod-xquery10-ExprSingle">ExprSingle</a> "else"
<a href="#prod-xquery10-ExprSingle">ExprSingle</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-OrExpr" id=
"prod-xquery10-OrExpr"></a>[48]&#160;&#160;&#160;</td>
<td><code>OrExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-AndExpr">AndExpr</a> ( "or"
<a href="#prod-xquery10-AndExpr">AndExpr</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AndExpr" id=
"prod-xquery10-AndExpr"></a>[49]&#160;&#160;&#160;</td>
<td><code>AndExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-ComparisonExpr">ComparisonExpr</a> ( "and" <a href=
"#prod-xquery10-ComparisonExpr">ComparisonExpr</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ComparisonExpr" id=
"prod-xquery10-ComparisonExpr"></a>[50]&#160;&#160;&#160;</td>
<td><code>ComparisonExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-FTContainsExpr">FTContainsExpr</a> ( (<a href=
"#prod-xquery10-ValueComp">ValueComp</a><br />
| <a href="#prod-xquery10-GeneralComp">GeneralComp</a><br />
| <a href="#prod-xquery10-NodeComp">NodeComp</a>) <a href=
"#prod-xquery10-FTContainsExpr">FTContainsExpr</a> )?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTContainsExpr" id=
"prod-xquery10-FTContainsExpr"></a>[51]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTContainsExpr"></a><a href=
"#doc-xquery10-FTContainsExpr">FTContainsExpr</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-RangeExpr">RangeExpr</a> (
"contains" "text" <a href=
"#prod-xquery10-FTSelection">FTSelection</a> <a href=
"#prod-xquery10-FTIgnoreOption">FTIgnoreOption</a>? )?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-RangeExpr" id=
"prod-xquery10-RangeExpr"></a>[52]&#160;&#160;&#160;</td>
<td><code>RangeExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-AdditiveExpr">AdditiveExpr</a> (
"to" <a href="#prod-xquery10-AdditiveExpr">AdditiveExpr</a>
)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AdditiveExpr" id=
"prod-xquery10-AdditiveExpr"></a>[53]&#160;&#160;&#160;</td>
<td><code>AdditiveExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-MultiplicativeExpr">MultiplicativeExpr</a> ( ("+" |
"-") <a href=
"#prod-xquery10-MultiplicativeExpr">MultiplicativeExpr</a>
)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-MultiplicativeExpr" id=
"prod-xquery10-MultiplicativeExpr"></a>[54]&#160;&#160;&#160;</td>
<td><code>MultiplicativeExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-UnionExpr">UnionExpr</a> ( ("*" |
"div" | "idiv" | "mod") <a href=
"#prod-xquery10-UnionExpr">UnionExpr</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-UnionExpr" id=
"prod-xquery10-UnionExpr"></a>[55]&#160;&#160;&#160;</td>
<td><code>UnionExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-IntersectExceptExpr">IntersectExceptExpr</a> (
("union" | "|") <a href=
"#prod-xquery10-IntersectExceptExpr">IntersectExceptExpr</a>
)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-IntersectExceptExpr" id=
"prod-xquery10-IntersectExceptExpr"></a>[56]&#160;&#160;&#160;</td>
<td><code>IntersectExceptExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-InstanceofExpr">InstanceofExpr</a> ( ("intersect" |
"except") <a href=
"#prod-xquery10-InstanceofExpr">InstanceofExpr</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-InstanceofExpr" id=
"prod-xquery10-InstanceofExpr"></a>[57]&#160;&#160;&#160;</td>
<td><code>InstanceofExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-TreatExpr">TreatExpr</a> (
"instance" "of" <a href=
"#prod-xquery10-SequenceType">SequenceType</a> )?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-TreatExpr" id=
"prod-xquery10-TreatExpr"></a>[58]&#160;&#160;&#160;</td>
<td><code>TreatExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-CastableExpr">CastableExpr</a> (
"treat" "as" <a href="#prod-xquery10-SequenceType">SequenceType</a>
)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CastableExpr" id=
"prod-xquery10-CastableExpr"></a>[59]&#160;&#160;&#160;</td>
<td><code>CastableExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-CastExpr">CastExpr</a> (
"castable" "as" <a href="#prod-xquery10-SingleType">SingleType</a>
)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CastExpr" id=
"prod-xquery10-CastExpr"></a>[60]&#160;&#160;&#160;</td>
<td><code>CastExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-UnaryExpr">UnaryExpr</a> ( "cast"
"as" <a href="#prod-xquery10-SingleType">SingleType</a>
)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-UnaryExpr" id=
"prod-xquery10-UnaryExpr"></a>[61]&#160;&#160;&#160;</td>
<td><code>UnaryExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("-" | "+")* <a href=
"#prod-xquery10-ValueExpr">ValueExpr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ValueExpr" id=
"prod-xquery10-ValueExpr"></a>[62]&#160;&#160;&#160;</td>
<td><code>ValueExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-ValidateExpr">ValidateExpr</a> |
<a href="#prod-xquery10-PathExpr">PathExpr</a> | <a href=
"#prod-xquery10-ExtensionExpr">ExtensionExpr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-GeneralComp" id=
"prod-xquery10-GeneralComp"></a>[63]&#160;&#160;&#160;</td>
<td><code>GeneralComp</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"=" | "!=" | "&lt;" | "&lt;=" | "&gt;" |
"&gt;="</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ValueComp" id=
"prod-xquery10-ValueComp"></a>[64]&#160;&#160;&#160;</td>
<td><code>ValueComp</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"eq" | "ne" | "lt" | "le" | "gt" | "ge"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-NodeComp" id=
"prod-xquery10-NodeComp"></a>[65]&#160;&#160;&#160;</td>
<td><code>NodeComp</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"is" | "&lt;&lt;" | "&gt;&gt;"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ValidateExpr" id=
"prod-xquery10-ValidateExpr"></a>[66]&#160;&#160;&#160;</td>
<td><code>ValidateExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"validate" <a href=
"#prod-xquery10-ValidationMode">ValidationMode</a>? "{" <a href=
"#prod-xquery10-Expr">Expr</a> "}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ValidationMode" id=
"prod-xquery10-ValidationMode"></a>[67]&#160;&#160;&#160;</td>
<td><code>ValidationMode</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"lax" | "strict"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ExtensionExpr" id=
"prod-xquery10-ExtensionExpr"></a>[68]&#160;&#160;&#160;</td>
<td><code>ExtensionExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Pragma">Pragma</a>+ "{" <a href=
"#prod-xquery10-Expr">Expr</a>? "}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Pragma" id=
"prod-xquery10-Pragma"></a>[69]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-Pragma"></a><a href=
"#doc-xquery10-Pragma">Pragma</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"(#" <a href="#prod-xquery10-S">S</a>? <a href=
"#prod-xquery10-QName">QName</a> (<a href="#prod-xquery10-S">S</a>
<a href="#prod-xquery10-PragmaContents">PragmaContents</a>)?
"#)"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-PragmaContents" id=
"prod-xquery10-PragmaContents"></a>[70]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-PragmaContents"></a><a href=
"#doc-xquery10-PragmaContents">PragmaContents</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-Char">Char</a>* - (Char* '#)'
Char*))</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-PathExpr" id=
"prod-xquery10-PathExpr"></a>[71]&#160;&#160;&#160;</td>
<td><code>PathExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("/" <a href=
"#prod-xquery10-RelativePathExpr">RelativePathExpr</a>?)<br />
| ("//" <a href=
"#prod-xquery10-RelativePathExpr">RelativePathExpr</a>)<br />
| <a href=
"#prod-xquery10-RelativePathExpr">RelativePathExpr</a></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-leading-lone-slash">xgc:
leading-lone-slash</a><sup><small>XQ</small></sup></span>
*/</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-RelativePathExpr" id=
"prod-xquery10-RelativePathExpr"></a>[72]&#160;&#160;&#160;</td>
<td><code>RelativePathExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-StepExpr">StepExpr</a> (("/" |
"//") <a href="#prod-xquery10-StepExpr">StepExpr</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-StepExpr" id=
"prod-xquery10-StepExpr"></a>[73]&#160;&#160;&#160;</td>
<td><code>StepExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FilterExpr">FilterExpr</a> |
<a href="#prod-xquery10-AxisStep">AxisStep</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AxisStep" id=
"prod-xquery10-AxisStep"></a>[74]&#160;&#160;&#160;</td>
<td><code>AxisStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-ReverseStep">ReverseStep</a> |
<a href="#prod-xquery10-ForwardStep">ForwardStep</a>) <a href=
"#prod-xquery10-PredicateList">PredicateList</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ForwardStep" id=
"prod-xquery10-ForwardStep"></a>[75]&#160;&#160;&#160;</td>
<td><code>ForwardStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-ForwardAxis">ForwardAxis</a>
<a href="#prod-xquery10-NodeTest">NodeTest</a>) | <a href=
"#prod-xquery10-AbbrevForwardStep">AbbrevForwardStep</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ForwardAxis" id=
"prod-xquery10-ForwardAxis"></a>[76]&#160;&#160;&#160;</td>
<td><code>ForwardAxis</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("child" "::")<br />
| ("descendant" "::")<br />
| ("attribute" "::")<br />
| ("self" "::")<br />
| ("descendant-or-self" "::")<br />
| ("following-sibling" "::")<br />
| ("following" "::")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AbbrevForwardStep" id=
"prod-xquery10-AbbrevForwardStep"></a>[77]&#160;&#160;&#160;</td>
<td><code>AbbrevForwardStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"@"? <a href=
"#prod-xquery10-NodeTest">NodeTest</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ReverseStep" id=
"prod-xquery10-ReverseStep"></a>[78]&#160;&#160;&#160;</td>
<td><code>ReverseStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-ReverseAxis">ReverseAxis</a>
<a href="#prod-xquery10-NodeTest">NodeTest</a>) | <a href=
"#prod-xquery10-AbbrevReverseStep">AbbrevReverseStep</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ReverseAxis" id=
"prod-xquery10-ReverseAxis"></a>[79]&#160;&#160;&#160;</td>
<td><code>ReverseAxis</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("parent" "::")<br />
| ("ancestor" "::")<br />
| ("preceding-sibling" "::")<br />
| ("preceding" "::")<br />
| ("ancestor-or-self" "::")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AbbrevReverseStep" id=
"prod-xquery10-AbbrevReverseStep"></a>[80]&#160;&#160;&#160;</td>
<td><code>AbbrevReverseStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>".."</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-NodeTest" id=
"prod-xquery10-NodeTest"></a>[81]&#160;&#160;&#160;</td>
<td><code>NodeTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-KindTest">KindTest</a> | <a href=
"#prod-xquery10-NameTest">NameTest</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-NameTest" id=
"prod-xquery10-NameTest"></a>[82]&#160;&#160;&#160;</td>
<td><code>NameTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-QName">QName</a> | <a href=
"#prod-xquery10-Wildcard">Wildcard</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Wildcard" id=
"prod-xquery10-Wildcard"></a>[83]&#160;&#160;&#160;</td>
<td><code>Wildcard</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"*"<br />
| (<a href="#prod-xquery10-NCName">NCName</a> ":" "*")<br />
| ("*" ":" <a href="#prod-xquery10-NCName">NCName</a>)</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FilterExpr" id=
"prod-xquery10-FilterExpr"></a>[84]&#160;&#160;&#160;</td>
<td><code>FilterExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-PrimaryExpr">PrimaryExpr</a>
<a href=
"#prod-xquery10-PredicateList">PredicateList</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-PredicateList" id=
"prod-xquery10-PredicateList"></a>[85]&#160;&#160;&#160;</td>
<td><code>PredicateList</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-Predicate">Predicate</a>*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Predicate" id=
"prod-xquery10-Predicate"></a>[86]&#160;&#160;&#160;</td>
<td><code>Predicate</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"[" <a href="#prod-xquery10-Expr">Expr</a>
"]"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-PrimaryExpr" id=
"prod-xquery10-PrimaryExpr"></a>[87]&#160;&#160;&#160;</td>
<td><code>PrimaryExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Literal">Literal</a><br />
| <a href="#prod-xquery10-VarRef">VarRef</a><br />
| <a href=
"#prod-xquery10-ParenthesizedExpr">ParenthesizedExpr</a><br />
| <a href=
"#prod-xquery10-ContextItemExpr">ContextItemExpr</a><br />
| <a href="#prod-xquery10-FunctionCall">FunctionCall</a><br />
| <a href="#prod-xquery10-OrderedExpr">OrderedExpr</a><br />
| <a href="#prod-xquery10-UnorderedExpr">UnorderedExpr</a><br />
| <a href="#prod-xquery10-Constructor">Constructor</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Literal" id=
"prod-xquery10-Literal"></a>[88]&#160;&#160;&#160;</td>
<td><code>Literal</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-NumericLiteral">NumericLiteral</a> | <a href=
"#prod-xquery10-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-NumericLiteral" id=
"prod-xquery10-NumericLiteral"></a>[89]&#160;&#160;&#160;</td>
<td><code>NumericLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a> | <a href=
"#prod-xquery10-DecimalLiteral">DecimalLiteral</a> | <a href=
"#prod-xquery10-DoubleLiteral">DoubleLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-VarRef" id=
"prod-xquery10-VarRef"></a>[90]&#160;&#160;&#160;</td>
<td><code>VarRef</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"$" <a href=
"#prod-xquery10-VarName">VarName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-VarName" id=
"prod-xquery10-VarName"></a>[91]&#160;&#160;&#160;</td>
<td><code>VarName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ParenthesizedExpr" id=
"prod-xquery10-ParenthesizedExpr"></a>[92]&#160;&#160;&#160;</td>
<td><code>ParenthesizedExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"(" <a href="#prod-xquery10-Expr">Expr</a>?
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ContextItemExpr" id=
"prod-xquery10-ContextItemExpr"></a>[93]&#160;&#160;&#160;</td>
<td><code>ContextItemExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"."</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-OrderedExpr" id=
"prod-xquery10-OrderedExpr"></a>[94]&#160;&#160;&#160;</td>
<td><code>OrderedExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"ordered" "{" <a href="#prod-xquery10-Expr">Expr</a>
"}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-UnorderedExpr" id=
"prod-xquery10-UnorderedExpr"></a>[95]&#160;&#160;&#160;</td>
<td><code>UnorderedExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"unordered" "{" <a href="#prod-xquery10-Expr">Expr</a>
"}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FunctionCall" id=
"prod-xquery10-FunctionCall"></a>[96]&#160;&#160;&#160;</td>
<td><code>FunctionCall</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-QName">QName</a> "(" (<a href=
"#prod-xquery10-ExprSingle">ExprSingle</a> ("," <a href=
"#prod-xquery10-ExprSingle">ExprSingle</a>)*)? ")"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-reserved-function-names">xgc:
reserved-function-names</a><sup><small>XQ</small></sup></span>
*/</i></td>
</tr>
<tr valign="baseline">
<td></td>
<td></td>
<td></td>
<td></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#parse-note-parens">gn:
parens</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Constructor" id=
"prod-xquery10-Constructor"></a>[97]&#160;&#160;&#160;</td>
<td><code>Constructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-DirectConstructor">DirectConstructor</a><br />
| <a href=
"#prod-xquery10-ComputedConstructor">ComputedConstructor</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DirectConstructor" id=
"prod-xquery10-DirectConstructor"></a>[98]&#160;&#160;&#160;</td>
<td><code>DirectConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-DirElemConstructor">DirElemConstructor</a><br />
| <a href=
"#prod-xquery10-DirCommentConstructor">DirCommentConstructor</a><br />

| <a href=
"#prod-xquery10-DirPIConstructor">DirPIConstructor</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DirElemConstructor" id=
"prod-xquery10-DirElemConstructor"></a>[99]&#160;&#160;&#160;</td>
<td><code>DirElemConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"&lt;" <a href="#prod-xquery10-QName">QName</a> <a href=
"#prod-xquery10-DirAttributeList">DirAttributeList</a> ("/&gt;" |
("&gt;" <a href="#prod-xquery10-DirElemContent">DirElemContent</a>*
"&lt;/" <a href="#prod-xquery10-QName">QName</a> <a href=
"#prod-xquery10-S">S</a>? "&gt;"))</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DirAttributeList" id=
"prod-xquery10-DirAttributeList"></a>[100]&#160;&#160;&#160;</td>
<td><code>DirAttributeList</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-S">S</a> (<a href=
"#prod-xquery10-QName">QName</a> <a href="#prod-xquery10-S">S</a>?
"=" <a href="#prod-xquery10-S">S</a>? <a href=
"#prod-xquery10-DirAttributeValue">DirAttributeValue</a>)?)*</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DirAttributeValue" id=
"prod-xquery10-DirAttributeValue"></a>[101]&#160;&#160;&#160;</td>
<td><code>DirAttributeValue</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>('"' (<a href="#prod-xquery10-EscapeQuot">EscapeQuot</a>
| <a href=
"#prod-xquery10-QuotAttrValueContent">QuotAttrValueContent</a>)*
'"')<br />
| ("'" (<a href="#prod-xquery10-EscapeApos">EscapeApos</a> |
<a href=
"#prod-xquery10-AposAttrValueContent">AposAttrValueContent</a>)*
"'")</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-QuotAttrValueContent" id=
"prod-xquery10-QuotAttrValueContent"></a>[102]&#160;&#160;&#160;</td>
<td><code>QuotAttrValueContent</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-QuotAttrContentChar">QuotAttrContentChar</a><br />
| <a href=
"#prod-xquery10-CommonContent">CommonContent</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AposAttrValueContent" id=
"prod-xquery10-AposAttrValueContent"></a>[103]&#160;&#160;&#160;</td>
<td><code>AposAttrValueContent</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-AposAttrContentChar">AposAttrContentChar</a><br />
| <a href=
"#prod-xquery10-CommonContent">CommonContent</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DirElemContent" id=
"prod-xquery10-DirElemContent"></a>[104]&#160;&#160;&#160;</td>
<td><code>DirElemContent</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-DirectConstructor">DirectConstructor</a><br />
| <a href="#prod-xquery10-CDataSection">CDataSection</a><br />
| <a href="#prod-xquery10-CommonContent">CommonContent</a><br />
| <a href=
"#prod-xquery10-ElementContentChar">ElementContentChar</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CommonContent" id=
"prod-xquery10-CommonContent"></a>[105]&#160;&#160;&#160;</td>
<td><code>CommonContent</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-PredefinedEntityRef">PredefinedEntityRef</a> |
<a href="#prod-xquery10-CharRef">CharRef</a> | "{{" | "}}" |
<a href="#prod-xquery10-EnclosedExpr">EnclosedExpr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DirCommentConstructor" id=
"prod-xquery10-DirCommentConstructor"></a>[106]&#160;&#160;&#160;</td>
<td><code>DirCommentConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"&lt;!--" <a href=
"#prod-xquery10-DirCommentContents">DirCommentContents</a>
"--&gt;"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DirCommentContents" id=
"prod-xquery10-DirCommentContents"></a>[107]&#160;&#160;&#160;</td>
<td><code>DirCommentContents</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>((<a href="#prod-xquery10-Char">Char</a> - '-') | ('-'
(<a href="#prod-xquery10-Char">Char</a> - '-')))*</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DirPIConstructor" id=
"prod-xquery10-DirPIConstructor"></a>[108]&#160;&#160;&#160;</td>
<td><code>DirPIConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"&lt;?" <a href="#prod-xquery10-PITarget">PITarget</a>
(<a href="#prod-xquery10-S">S</a> <a href=
"#prod-xquery10-DirPIContents">DirPIContents</a>)?
"?&gt;"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DirPIContents" id=
"prod-xquery10-DirPIContents"></a>[109]&#160;&#160;&#160;</td>
<td><code>DirPIContents</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-Char">Char</a>* - (Char* '?&gt;'
Char*))</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CDataSection" id=
"prod-xquery10-CDataSection"></a>[110]&#160;&#160;&#160;</td>
<td><code>CDataSection</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"&lt;![CDATA[" <a href=
"#prod-xquery10-CDataSectionContents">CDataSectionContents</a>
"]]&gt;"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CDataSectionContents" id=
"prod-xquery10-CDataSectionContents"></a>[111]&#160;&#160;&#160;</td>
<td><code>CDataSectionContents</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-Char">Char</a>* - (Char*
']]&gt;' Char*))</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ComputedConstructor" id=
"prod-xquery10-ComputedConstructor"></a>[112]&#160;&#160;&#160;</td>
<td><code>ComputedConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-CompDocConstructor">CompDocConstructor</a><br />
| <a href=
"#prod-xquery10-CompElemConstructor">CompElemConstructor</a><br />
| <a href=
"#prod-xquery10-CompAttrConstructor">CompAttrConstructor</a><br />
| <a href=
"#prod-xquery10-CompTextConstructor">CompTextConstructor</a><br />
| <a href=
"#prod-xquery10-CompCommentConstructor">CompCommentConstructor</a><br />

| <a href=
"#prod-xquery10-CompPIConstructor">CompPIConstructor</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CompDocConstructor" id=
"prod-xquery10-CompDocConstructor"></a>[113]&#160;&#160;&#160;</td>
<td><code>CompDocConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"document" "{" <a href="#prod-xquery10-Expr">Expr</a>
"}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CompElemConstructor" id=
"prod-xquery10-CompElemConstructor"></a>[114]&#160;&#160;&#160;</td>
<td><code>CompElemConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"element" (<a href="#prod-xquery10-QName">QName</a> |
("{" <a href="#prod-xquery10-Expr">Expr</a> "}")) "{" <a href=
"#prod-xquery10-ContentExpr">ContentExpr</a>? "}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ContentExpr" id=
"prod-xquery10-ContentExpr"></a>[115]&#160;&#160;&#160;</td>
<td><code>ContentExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Expr">Expr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CompAttrConstructor" id=
"prod-xquery10-CompAttrConstructor"></a>[116]&#160;&#160;&#160;</td>
<td><code>CompAttrConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"attribute" (<a href="#prod-xquery10-QName">QName</a> |
("{" <a href="#prod-xquery10-Expr">Expr</a> "}")) "{" <a href=
"#prod-xquery10-Expr">Expr</a>? "}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CompTextConstructor" id=
"prod-xquery10-CompTextConstructor"></a>[117]&#160;&#160;&#160;</td>
<td><code>CompTextConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"text" "{" <a href="#prod-xquery10-Expr">Expr</a>
"}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CompCommentConstructor" id=
"prod-xquery10-CompCommentConstructor"></a>[118]&#160;&#160;&#160;</td>
<td><code>CompCommentConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"comment" "{" <a href="#prod-xquery10-Expr">Expr</a>
"}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CompPIConstructor" id=
"prod-xquery10-CompPIConstructor"></a>[119]&#160;&#160;&#160;</td>
<td><code>CompPIConstructor</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"processing-instruction" (<a href=
"#prod-xquery10-NCName">NCName</a> | ("{" <a href=
"#prod-xquery10-Expr">Expr</a> "}")) "{" <a href=
"#prod-xquery10-Expr">Expr</a>? "}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-SingleType" id=
"prod-xquery10-SingleType"></a>[120]&#160;&#160;&#160;</td>
<td><code>SingleType</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-AtomicType">AtomicType</a>
"?"?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-TypeDeclaration" id=
"prod-xquery10-TypeDeclaration"></a>[121]&#160;&#160;&#160;</td>
<td><code>TypeDeclaration</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"as" <a href=
"#prod-xquery10-SequenceType">SequenceType</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-SequenceType" id=
"prod-xquery10-SequenceType"></a>[122]&#160;&#160;&#160;</td>
<td><code>SequenceType</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("empty-sequence" "(" ")")<br />
| (<a href="#prod-xquery10-ItemType">ItemType</a> <a href=
"#prod-xquery10-OccurrenceIndicator">OccurrenceIndicator</a>?)</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-OccurrenceIndicator" id=
"prod-xquery10-OccurrenceIndicator"></a>[123]&#160;&#160;&#160;</td>
<td><code>OccurrenceIndicator</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"?" | "*" | "+"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-occurrence-indicators">xgc:
occurrence-indicators</a><sup><small>XQ</small></sup></span>
*/</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ItemType" id=
"prod-xquery10-ItemType"></a>[124]&#160;&#160;&#160;</td>
<td><code>ItemType</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-KindTest">KindTest</a> | ("item"
"(" ")") | <a href=
"#prod-xquery10-AtomicType">AtomicType</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AtomicType" id=
"prod-xquery10-AtomicType"></a>[125]&#160;&#160;&#160;</td>
<td><code>AtomicType</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-KindTest" id=
"prod-xquery10-KindTest"></a>[126]&#160;&#160;&#160;</td>
<td><code>KindTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-DocumentTest">DocumentTest</a><br />
| <a href="#prod-xquery10-ElementTest">ElementTest</a><br />
| <a href="#prod-xquery10-AttributeTest">AttributeTest</a><br />
| <a href=
"#prod-xquery10-SchemaElementTest">SchemaElementTest</a><br />
| <a href=
"#prod-xquery10-SchemaAttributeTest">SchemaAttributeTest</a><br />
| <a href="#prod-xquery10-PITest">PITest</a><br />
| <a href="#prod-xquery10-CommentTest">CommentTest</a><br />
| <a href="#prod-xquery10-TextTest">TextTest</a><br />
| <a href="#prod-xquery10-AnyKindTest">AnyKindTest</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AnyKindTest" id=
"prod-xquery10-AnyKindTest"></a>[127]&#160;&#160;&#160;</td>
<td><code>AnyKindTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"node" "(" ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DocumentTest" id=
"prod-xquery10-DocumentTest"></a>[128]&#160;&#160;&#160;</td>
<td><code>DocumentTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"document-node" "(" (<a href=
"#prod-xquery10-ElementTest">ElementTest</a> | <a href=
"#prod-xquery10-SchemaElementTest">SchemaElementTest</a>)?
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-TextTest" id=
"prod-xquery10-TextTest"></a>[129]&#160;&#160;&#160;</td>
<td><code>TextTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"text" "(" ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CommentTest" id=
"prod-xquery10-CommentTest"></a>[130]&#160;&#160;&#160;</td>
<td><code>CommentTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"comment" "(" ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-PITest" id=
"prod-xquery10-PITest"></a>[131]&#160;&#160;&#160;</td>
<td><code>PITest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"processing-instruction" "(" (<a href=
"#prod-xquery10-NCName">NCName</a> | <a href=
"#prod-xquery10-StringLiteral">StringLiteral</a>)? ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AttributeTest" id=
"prod-xquery10-AttributeTest"></a>[132]&#160;&#160;&#160;</td>
<td><code>AttributeTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"attribute" "(" (<a href=
"#prod-xquery10-AttribNameOrWildcard">AttribNameOrWildcard</a> (","
<a href="#prod-xquery10-TypeName">TypeName</a>)?)? ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AttribNameOrWildcard" id=
"prod-xquery10-AttribNameOrWildcard"></a>[133]&#160;&#160;&#160;</td>
<td><code>AttribNameOrWildcard</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-AttributeName">AttributeName</a>
| "*"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-SchemaAttributeTest" id=
"prod-xquery10-SchemaAttributeTest"></a>[134]&#160;&#160;&#160;</td>
<td><code>SchemaAttributeTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"schema-attribute" "(" <a href=
"#prod-xquery10-AttributeDeclaration">AttributeDeclaration</a>
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AttributeDeclaration" id=
"prod-xquery10-AttributeDeclaration"></a>[135]&#160;&#160;&#160;</td>
<td><code>AttributeDeclaration</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-AttributeName">AttributeName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ElementTest" id=
"prod-xquery10-ElementTest"></a>[136]&#160;&#160;&#160;</td>
<td><code>ElementTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"element" "(" (<a href=
"#prod-xquery10-ElementNameOrWildcard">ElementNameOrWildcard</a>
("," <a href="#prod-xquery10-TypeName">TypeName</a> "?"?)?)?
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ElementNameOrWildcard" id=
"prod-xquery10-ElementNameOrWildcard"></a>[137]&#160;&#160;&#160;</td>
<td><code>ElementNameOrWildcard</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-ElementName">ElementName</a> |
"*"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-SchemaElementTest" id=
"prod-xquery10-SchemaElementTest"></a>[138]&#160;&#160;&#160;</td>
<td><code>SchemaElementTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"schema-element" "(" <a href=
"#prod-xquery10-ElementDeclaration">ElementDeclaration</a>
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ElementDeclaration" id=
"prod-xquery10-ElementDeclaration"></a>[139]&#160;&#160;&#160;</td>
<td><code>ElementDeclaration</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-ElementName">ElementName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AttributeName" id=
"prod-xquery10-AttributeName"></a>[140]&#160;&#160;&#160;</td>
<td><code>AttributeName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ElementName" id=
"prod-xquery10-ElementName"></a>[141]&#160;&#160;&#160;</td>
<td><code>ElementName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-TypeName" id=
"prod-xquery10-TypeName"></a>[142]&#160;&#160;&#160;</td>
<td><code>TypeName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-URILiteral" id=
"prod-xquery10-URILiteral"></a>[143]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-URILiteral"></a><a href=
"#doc-xquery10-URILiteral">URILiteral</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTSelection" id=
"prod-xquery10-FTSelection"></a>[144]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTSelection"></a><a href=
"#doc-xquery10-FTSelection">FTSelection</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTOr">FTOr</a> <a href=
"#prod-xquery10-FTPosFilter">FTPosFilter</a>*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTWeight" id=
"prod-xquery10-FTWeight"></a>[145]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTWeight"></a><a href=
"#doc-xquery10-FTWeight">FTWeight</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"weight" "{" <a href="#prod-xquery10-Expr">Expr</a>
"}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTOr" id=
"prod-xquery10-FTOr"></a>[146]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTOr"></a><a href=
"#doc-xquery10-FTOr">FTOr</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTAnd">FTAnd</a> ( "ftor"
<a href="#prod-xquery10-FTAnd">FTAnd</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTAnd" id=
"prod-xquery10-FTAnd"></a>[147]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTAnd"></a><a href=
"#doc-xquery10-FTAnd">FTAnd</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTMildNot">FTMildNot</a> (
"ftand" <a href="#prod-xquery10-FTMildNot">FTMildNot</a>
)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTMildNot" id=
"prod-xquery10-FTMildNot"></a>[148]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTMildNot"></a><a href=
"#doc-xquery10-FTMildNot">FTMildNot</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTUnaryNot">FTUnaryNot</a> (
"not" "in" <a href="#prod-xquery10-FTUnaryNot">FTUnaryNot</a>
)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTUnaryNot" id=
"prod-xquery10-FTUnaryNot"></a>[149]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTUnaryNot"></a><a href=
"#doc-xquery10-FTUnaryNot">FTUnaryNot</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("ftnot")? <a href=
"#prod-xquery10-FTPrimaryWithOptions">FTPrimaryWithOptions</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTPrimaryWithOptions" id=
"prod-xquery10-FTPrimaryWithOptions"></a>[150]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTPrimaryWithOptions"></a><a href=
"#doc-xquery10-FTPrimaryWithOptions">FTPrimaryWithOptions</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTPrimary">FTPrimary</a> <a href=
"#prod-xquery10-FTMatchOptions">FTMatchOptions</a>? <a href=
"#prod-xquery10-FTWeight">FTWeight</a>?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTPrimary" id=
"prod-xquery10-FTPrimary"></a>[151]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTPrimary"></a><a href=
"#doc-xquery10-FTPrimary">FTPrimary</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-FTWords">FTWords</a> <a href=
"#prod-xquery10-FTTimes">FTTimes</a>?) | ("(" <a href=
"#prod-xquery10-FTSelection">FTSelection</a> ")") | <a href=
"#prod-xquery10-FTExtensionSelection">FTExtensionSelection</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTWords" id=
"prod-xquery10-FTWords"></a>[152]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTWords"></a><a href=
"#doc-xquery10-FTWords">FTWords</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTWordsValue">FTWordsValue</a>
<a href=
"#prod-xquery10-FTAnyallOption">FTAnyallOption</a>?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTWordsValue" id=
"prod-xquery10-FTWordsValue"></a>[153]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTWordsValue"></a><a href=
"#doc-xquery10-FTWordsValue">FTWordsValue</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-StringLiteral">StringLiteral</a>
| ("{" <a href="#prod-xquery10-Expr">Expr</a> "}")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTExtensionSelection" id=
"prod-xquery10-FTExtensionSelection"></a>[154]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTExtensionSelection"></a><a href=
"#doc-xquery10-FTExtensionSelection">FTExtensionSelection</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Pragma">Pragma</a>+ "{" <a href=
"#prod-xquery10-FTSelection">FTSelection</a>? "}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTAnyallOption" id=
"prod-xquery10-FTAnyallOption"></a>[155]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTAnyallOption"></a><a href=
"#doc-xquery10-FTAnyallOption">FTAnyallOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("any" "word"?) | ("all" "words"?) | "phrase"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTTimes" id=
"prod-xquery10-FTTimes"></a>[156]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTTimes"></a><a href=
"#doc-xquery10-FTTimes">FTTimes</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"occurs" <a href="#prod-xquery10-FTRange">FTRange</a>
"times"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTRange" id=
"prod-xquery10-FTRange"></a>[157]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTRange"></a><a href=
"#doc-xquery10-FTRange">FTRange</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("exactly" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a>)<br />
| ("at" "least" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a>)<br />
| ("at" "most" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a>)<br />
| ("from" <a href="#prod-xquery10-AdditiveExpr">AdditiveExpr</a>
"to" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a>)</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTPosFilter" id=
"prod-xquery10-FTPosFilter"></a>[158]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTPosFilter"></a><a href=
"#doc-xquery10-FTPosFilter">FTPosFilter</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-FTOrder">FTOrder</a> | <a href=
"#prod-xquery10-FTWindow">FTWindow</a> | <a href=
"#prod-xquery10-FTDistance">FTDistance</a> | <a href=
"#prod-xquery10-FTScope">FTScope</a> | <a href=
"#prod-xquery10-FTContent">FTContent</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTOrder" id=
"prod-xquery10-FTOrder"></a>[159]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTOrder"></a><a href=
"#doc-xquery10-FTOrder">FTOrder</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"ordered"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTWindow" id=
"prod-xquery10-FTWindow"></a>[160]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTWindow"></a><a href=
"#doc-xquery10-FTWindow">FTWindow</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"window" <a href=
"#prod-xquery10-AdditiveExpr">AdditiveExpr</a> <a href=
"#prod-xquery10-FTUnit">FTUnit</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTDistance" id=
"prod-xquery10-FTDistance"></a>[161]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTDistance"></a><a href=
"#doc-xquery10-FTDistance">FTDistance</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"distance" <a href="#prod-xquery10-FTRange">FTRange</a>
<a href="#prod-xquery10-FTUnit">FTUnit</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTUnit" id=
"prod-xquery10-FTUnit"></a>[162]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTUnit"></a><a href=
"#doc-xquery10-FTUnit">FTUnit</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"words" | "sentences" | "paragraphs"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTScope" id=
"prod-xquery10-FTScope"></a>[163]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTScope"></a><a href=
"#doc-xquery10-FTScope">FTScope</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("same" | "different") <a href=
"#prod-xquery10-FTBigUnit">FTBigUnit</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTBigUnit" id=
"prod-xquery10-FTBigUnit"></a>[164]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTBigUnit"></a><a href=
"#doc-xquery10-FTBigUnit">FTBigUnit</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"sentence" | "paragraph"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTContent" id=
"prod-xquery10-FTContent"></a>[165]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTContent"></a><a href=
"#doc-xquery10-FTContent">FTContent</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("at" "start") | ("at" "end") | ("entire"
"content")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTMatchOptions" id=
"prod-xquery10-FTMatchOptions"></a>[166]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTMatchOptions"></a><a href=
"#doc-xquery10-FTMatchOptions">FTMatchOptions</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("using" <a href=
"#prod-xquery10-FTMatchOption">FTMatchOption</a>)+</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTMatchOption" id=
"prod-xquery10-FTMatchOption"></a>[167]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTMatchOption"></a><a href=
"#doc-xquery10-FTMatchOption">FTMatchOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xquery10-FTLanguageOption">FTLanguageOption</a><br />
| <a href=
"#prod-xquery10-FTWildCardOption">FTWildCardOption</a><br />
| <a href=
"#prod-xquery10-FTThesaurusOption">FTThesaurusOption</a><br />
| <a href="#prod-xquery10-FTStemOption">FTStemOption</a><br />
| <a href="#prod-xquery10-FTCaseOption">FTCaseOption</a><br />
| <a href=
"#prod-xquery10-FTDiacriticsOption">FTDiacriticsOption</a><br />
| <a href=
"#prod-xquery10-FTStopWordOption">FTStopWordOption</a><br />
| <a href=
"#prod-xquery10-FTExtensionOption">FTExtensionOption</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTCaseOption" id=
"prod-xquery10-FTCaseOption"></a>[168]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTCaseOption"></a><a href=
"#doc-xquery10-FTCaseOption">FTCaseOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("case" "insensitive")<br />
| ("case" "sensitive")<br />
| "lowercase"<br />
| "uppercase"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTDiacriticsOption" id=
"prod-xquery10-FTDiacriticsOption"></a>[169]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTDiacriticsOption"></a><a href=
"#doc-xquery10-FTDiacriticsOption">FTDiacriticsOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("diacritics" "insensitive")<br />
| ("diacritics" "sensitive")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTStemOption" id=
"prod-xquery10-FTStemOption"></a>[170]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTStemOption"></a><a href=
"#doc-xquery10-FTStemOption">FTStemOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"stemming" | ("no" "stemming")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTThesaurusOption" id=
"prod-xquery10-FTThesaurusOption"></a>[171]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTThesaurusOption"></a><a href=
"#doc-xquery10-FTThesaurusOption">FTThesaurusOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("thesaurus" (<a href=
"#prod-xquery10-FTThesaurusID">FTThesaurusID</a> |
"default"))<br />
| ("thesaurus" "(" (<a href=
"#prod-xquery10-FTThesaurusID">FTThesaurusID</a> | "default") (","
<a href="#prod-xquery10-FTThesaurusID">FTThesaurusID</a>)*
")")<br />
| ("no" "thesaurus")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTThesaurusID" id=
"prod-xquery10-FTThesaurusID"></a>[172]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTThesaurusID"></a><a href=
"#doc-xquery10-FTThesaurusID">FTThesaurusID</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"at" <a href="#prod-xquery10-URILiteral">URILiteral</a>
("relationship" <a href=
"#prod-xquery10-StringLiteral">StringLiteral</a>)? (<a href=
"#prod-xquery10-FTLiteralRange">FTLiteralRange</a>
"levels")?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTLiteralRange" id=
"prod-xquery10-FTLiteralRange"></a>[173]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTLiteralRange"></a><a href=
"#doc-xquery10-FTLiteralRange">FTLiteralRange</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("exactly" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a>)<br />
| ("at" "least" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a>)<br />
| ("at" "most" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a>)<br />
| ("from" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a> "to" <a href=
"#prod-xquery10-IntegerLiteral">IntegerLiteral</a>)</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTStopWordOption" id=
"prod-xquery10-FTStopWordOption"></a>[174]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTStopWordOption"></a><a href=
"#doc-xquery10-FTStopWordOption">FTStopWordOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("stop" "words" <a href=
"#prod-xquery10-FTStopWords">FTStopWords</a> <a href=
"#prod-xquery10-FTStopWordsInclExcl">FTStopWordsInclExcl</a>*)<br />

| ("stop" "words" "default" <a href=
"#prod-xquery10-FTStopWordsInclExcl">FTStopWordsInclExcl</a>*)<br />

| ("no" "stop" "words")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTStopWords" id=
"prod-xquery10-FTStopWords"></a>[175]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTStopWords"></a><a href=
"#doc-xquery10-FTStopWords">FTStopWords</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("at" <a href=
"#prod-xquery10-URILiteral">URILiteral</a>)<br />
| ("(" <a href="#prod-xquery10-StringLiteral">StringLiteral</a>
("," <a href="#prod-xquery10-StringLiteral">StringLiteral</a>)*
")")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTStopWordsInclExcl" id=
"prod-xquery10-FTStopWordsInclExcl"></a>[176]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTStopWordsInclExcl"></a><a href=
"#doc-xquery10-FTStopWordsInclExcl">FTStopWordsInclExcl</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("union" | "except") <a href=
"#prod-xquery10-FTStopWords">FTStopWords</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTLanguageOption" id=
"prod-xquery10-FTLanguageOption"></a>[177]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTLanguageOption"></a><a href=
"#doc-xquery10-FTLanguageOption">FTLanguageOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"language" <a href=
"#prod-xquery10-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTWildCardOption" id=
"prod-xquery10-FTWildCardOption"></a>[178]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTWildCardOption"></a><a href=
"#doc-xquery10-FTWildCardOption">FTWildCardOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"wildcards" | ("no" "wildcards")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTExtensionOption" id=
"prod-xquery10-FTExtensionOption"></a>[179]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTExtensionOption"></a><a href=
"#doc-xquery10-FTExtensionOption">FTExtensionOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"option" <a href="#prod-xquery10-QName">QName</a>
<a href="#prod-xquery10-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-FTIgnoreOption" id=
"prod-xquery10-FTIgnoreOption"></a>[180]&#160;&#160;&#160;</td>
<td><code><a href="#doc-xquery10-FTIgnoreOption"></a><a href=
"#doc-xquery10-FTIgnoreOption">FTIgnoreOption</a></code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"without" "content" <a href=
"#prod-xquery10-UnionExpr">UnionExpr</a></code></td>
</tr>
</tbody>
</table>
<div class="div2">
<h3><a name="grammar-terminals" id="grammar-terminals"></a>A.1
Terminal Symbols</h3>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-IntegerLiteral" id=
"prod-xquery10-IntegerLiteral"></a>[181]&#160;&#160;&#160;</td>
<td><code>IntegerLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xquery10-Digits">Digits</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DecimalLiteral" id=
"prod-xquery10-DecimalLiteral"></a>[182]&#160;&#160;&#160;</td>
<td><code>DecimalLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("." <a href="#prod-xquery10-Digits">Digits</a>) |
(<a href="#prod-xquery10-Digits">Digits</a> "." [0-9]*)</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-DoubleLiteral" id=
"prod-xquery10-DoubleLiteral"></a>[183]&#160;&#160;&#160;</td>
<td><code>DoubleLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(("." <a href="#prod-xquery10-Digits">Digits</a>) |
(<a href="#prod-xquery10-Digits">Digits</a> ("." [0-9]*)?)) [eE]
[+-]? <a href="#prod-xquery10-Digits">Digits</a></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-StringLiteral" id=
"prod-xquery10-StringLiteral"></a>[184]&#160;&#160;&#160;</td>
<td><code>StringLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>('"' (<a href=
"#prod-xquery10-PredefinedEntityRef">PredefinedEntityRef</a> |
<a href="#prod-xquery10-CharRef">CharRef</a> | <a href=
"#prod-xquery10-EscapeQuot">EscapeQuot</a> | [^"&amp;])* '"') |
("'" (<a href=
"#prod-xquery10-PredefinedEntityRef">PredefinedEntityRef</a> |
<a href="#prod-xquery10-CharRef">CharRef</a> | <a href=
"#prod-xquery10-EscapeApos">EscapeApos</a> | [^'&amp;])*
"'")</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-PredefinedEntityRef" id=
"prod-xquery10-PredefinedEntityRef"></a>[185]&#160;&#160;&#160;</td>
<td><code>PredefinedEntityRef</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"&amp;" ("lt" | "gt" | "amp" | "quot" | "apos")
";"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-EscapeQuot" id=
"prod-xquery10-EscapeQuot"></a>[186]&#160;&#160;&#160;</td>
<td><code>EscapeQuot</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>'""'</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-EscapeApos" id=
"prod-xquery10-EscapeApos"></a>[187]&#160;&#160;&#160;</td>
<td><code>EscapeApos</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"''"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-ElementContentChar" id=
"prod-xquery10-ElementContentChar"></a>[188]&#160;&#160;&#160;</td>
<td><code>ElementContentChar</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-Char">Char</a> -
[{}&lt;&amp;])</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-QuotAttrContentChar" id=
"prod-xquery10-QuotAttrContentChar"></a>[189]&#160;&#160;&#160;</td>
<td><code>QuotAttrContentChar</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-Char">Char</a> -
["{}&lt;&amp;])</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-AposAttrContentChar" id=
"prod-xquery10-AposAttrContentChar"></a>[190]&#160;&#160;&#160;</td>
<td><code>AposAttrContentChar</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-Char">Char</a> -
['{}&lt;&amp;])</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Comment" id=
"prod-xquery10-Comment"></a>[191]&#160;&#160;&#160;</td>
<td><code>Comment</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"(:" (<a href=
"#prod-xquery10-CommentContents">CommentContents</a> | <a href=
"#prod-xquery10-Comment">Comment</a>)* ":)"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xquery/#ws-explicit">ws:
explicit</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
<tr valign="baseline">
<td></td>
<td></td>
<td></td>
<td></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-comments">gn:
comments</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-PITarget" id=
"prod-xquery10-PITarget"></a>[192]&#160;&#160;&#160;</td>
<td><code>PITarget</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml/#NT-PITarget">[http://www.w3.org/TR/REC-xml#NT-PITarget]</a><sup><small>XML</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CharRef" id=
"prod-xquery10-CharRef"></a>[193]&#160;&#160;&#160;</td>
<td><code>CharRef</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml/#NT-CharRef">[http://www.w3.org/TR/REC-xml#NT-CharRef]</a><sup><small>XML</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-QName" id=
"prod-xquery10-QName"></a>[194]&#160;&#160;&#160;</td>
<td><code>QName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml-names/#NT-QName">[http://www.w3.org/TR/REC-xml-names/#NT-QName]</a><sup><small>Names</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-NCName" id=
"prod-xquery10-NCName"></a>[195]&#160;&#160;&#160;</td>
<td><code>NCName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml-names/#NT-NCName">[http://www.w3.org/TR/REC-xml-names/#NT-NCName]</a><sup><small>Names</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-S" id=
"prod-xquery10-S"></a>[196]&#160;&#160;&#160;</td>
<td><code>S</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml/#NT-S">[http://www.w3.org/TR/REC-xml#NT-S]</a><sup><small>XML</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Char" id=
"prod-xquery10-Char"></a>[197]&#160;&#160;&#160;</td>
<td><code>Char</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml/#NT-Char">[http://www.w3.org/TR/REC-xml#NT-Char]</a><sup><small>XML</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xquery/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XQ</small></sup></span> */</i></td>
</tr>
</tbody>
</table>
<p>The following symbols are used only in the definition of
terminal symbols; they are not terminal symbols in the grammar of
<a href="#id-grammar"><b>A EBNF for XQuery 1.0 Grammar with Full
Text extensions</b></a>.</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-Digits" id=
"prod-xquery10-Digits"></a>[198]&#160;&#160;&#160;</td>
<td><code>Digits</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>[0-9]+</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xquery10-CommentContents" id=
"prod-xquery10-CommentContents"></a>[199]&#160;&#160;&#160;</td>
<td><code>CommentContents</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xquery10-Char">Char</a>+ - (Char* ('(:' |
':)') Char*))</code></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="div1">
<h2><a name="id-xpath-grammar" id="id-xpath-grammar"></a>B EBNF for
XPath 2.0 Grammar with Full-Text extensions</h2>
<p>The EBNF in this document and in this section is aligned with
the current XPath 2.0 grammar (see <a href=
"http://www.w3.org/TR/2010/REC-xpath20-20101214/">http://www.w3.org/TR/2010/REC-xpath20-20101214/</a>).</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-XPath" id=
"prod-xpath20-XPath"></a>[1]&#160;&#160;&#160;</td>
<td><code>XPath</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-Expr">Expr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-Expr" id=
"prod-xpath20-Expr"></a>[2]&#160;&#160;&#160;</td>
<td><code>Expr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-ExprSingle">ExprSingle</a> (","
<a href="#prod-xpath20-ExprSingle">ExprSingle</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ExprSingle" id=
"prod-xpath20-ExprSingle"></a>[3]&#160;&#160;&#160;</td>
<td><code>ExprSingle</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-ForExpr">ForExpr</a><br />
| <a href="#prod-xpath20-QuantifiedExpr">QuantifiedExpr</a><br />
| <a href="#prod-xpath20-IfExpr">IfExpr</a><br />
| <a href="#prod-xpath20-OrExpr">OrExpr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ForExpr" id=
"prod-xpath20-ForExpr"></a>[4]&#160;&#160;&#160;</td>
<td><code>ForExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xpath20-SimpleForClause">SimpleForClause</a> "return"
<a href="#prod-xpath20-ExprSingle">ExprSingle</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-SimpleForClause" id=
"prod-xpath20-SimpleForClause"></a>[5]&#160;&#160;&#160;</td>
<td><code>SimpleForClause</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"for" "$" <a href="#prod-xpath20-VarName">VarName</a>
<a href="#prod-xpath20-FTScoreVar">FTScoreVar</a>? "in" <a href=
"#prod-xpath20-ExprSingle">ExprSingle</a> ("," "$" <a href=
"#prod-xpath20-VarName">VarName</a> <a href=
"#prod-xpath20-FTScoreVar">FTScoreVar</a>? "in" <a href=
"#prod-xpath20-ExprSingle">ExprSingle</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTScoreVar" id=
"prod-xpath20-FTScoreVar"></a>[6]&#160;&#160;&#160;</td>
<td><code>FTScoreVar</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"score" "$" <a href=
"#prod-xpath20-VarName">VarName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-QuantifiedExpr" id=
"prod-xpath20-QuantifiedExpr"></a>[7]&#160;&#160;&#160;</td>
<td><code>QuantifiedExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("some" | "every") "$" <a href=
"#prod-xpath20-VarName">VarName</a> "in" <a href=
"#prod-xpath20-ExprSingle">ExprSingle</a> ("," "$" <a href=
"#prod-xpath20-VarName">VarName</a> "in" <a href=
"#prod-xpath20-ExprSingle">ExprSingle</a>)* "satisfies" <a href=
"#prod-xpath20-ExprSingle">ExprSingle</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-IfExpr" id=
"prod-xpath20-IfExpr"></a>[8]&#160;&#160;&#160;</td>
<td><code>IfExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"if" "(" <a href="#prod-xpath20-Expr">Expr</a> ")" "then"
<a href="#prod-xpath20-ExprSingle">ExprSingle</a> "else" <a href=
"#prod-xpath20-ExprSingle">ExprSingle</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-OrExpr" id=
"prod-xpath20-OrExpr"></a>[9]&#160;&#160;&#160;</td>
<td><code>OrExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-AndExpr">AndExpr</a> ( "or"
<a href="#prod-xpath20-AndExpr">AndExpr</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AndExpr" id=
"prod-xpath20-AndExpr"></a>[10]&#160;&#160;&#160;</td>
<td><code>AndExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-ComparisonExpr">ComparisonExpr</a>
( "and" <a href="#prod-xpath20-ComparisonExpr">ComparisonExpr</a>
)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ComparisonExpr" id=
"prod-xpath20-ComparisonExpr"></a>[11]&#160;&#160;&#160;</td>
<td><code>ComparisonExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-FTContainsExpr">FTContainsExpr</a>
( (<a href="#prod-xpath20-ValueComp">ValueComp</a><br />
| <a href="#prod-xpath20-GeneralComp">GeneralComp</a><br />
| <a href="#prod-xpath20-NodeComp">NodeComp</a>) <a href=
"#prod-xpath20-FTContainsExpr">FTContainsExpr</a> )?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTContainsExpr" id=
"prod-xpath20-FTContainsExpr"></a>[12]&#160;&#160;&#160;</td>
<td><code>FTContainsExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-RangeExpr">RangeExpr</a> (
"contains" "text" <a href=
"#prod-xpath20-FTSelection">FTSelection</a> <a href=
"#prod-xpath20-FTIgnoreOption">FTIgnoreOption</a>? )?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-RangeExpr" id=
"prod-xpath20-RangeExpr"></a>[13]&#160;&#160;&#160;</td>
<td><code>RangeExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-AdditiveExpr">AdditiveExpr</a> (
"to" <a href="#prod-xpath20-AdditiveExpr">AdditiveExpr</a>
)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AdditiveExpr" id=
"prod-xpath20-AdditiveExpr"></a>[14]&#160;&#160;&#160;</td>
<td><code>AdditiveExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xpath20-MultiplicativeExpr">MultiplicativeExpr</a> ( ("+" |
"-") <a href=
"#prod-xpath20-MultiplicativeExpr">MultiplicativeExpr</a>
)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-MultiplicativeExpr" id=
"prod-xpath20-MultiplicativeExpr"></a>[15]&#160;&#160;&#160;</td>
<td><code>MultiplicativeExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-UnionExpr">UnionExpr</a> ( ("*" |
"div" | "idiv" | "mod") <a href=
"#prod-xpath20-UnionExpr">UnionExpr</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-UnionExpr" id=
"prod-xpath20-UnionExpr"></a>[16]&#160;&#160;&#160;</td>
<td><code>UnionExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xpath20-IntersectExceptExpr">IntersectExceptExpr</a> (
("union" | "|") <a href=
"#prod-xpath20-IntersectExceptExpr">IntersectExceptExpr</a>
)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-IntersectExceptExpr" id=
"prod-xpath20-IntersectExceptExpr"></a>[17]&#160;&#160;&#160;</td>
<td><code>IntersectExceptExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-InstanceofExpr">InstanceofExpr</a>
( ("intersect" | "except") <a href=
"#prod-xpath20-InstanceofExpr">InstanceofExpr</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-InstanceofExpr" id=
"prod-xpath20-InstanceofExpr"></a>[18]&#160;&#160;&#160;</td>
<td><code>InstanceofExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-TreatExpr">TreatExpr</a> (
"instance" "of" <a href=
"#prod-xpath20-SequenceType">SequenceType</a> )?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-TreatExpr" id=
"prod-xpath20-TreatExpr"></a>[19]&#160;&#160;&#160;</td>
<td><code>TreatExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-CastableExpr">CastableExpr</a> (
"treat" "as" <a href="#prod-xpath20-SequenceType">SequenceType</a>
)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-CastableExpr" id=
"prod-xpath20-CastableExpr"></a>[20]&#160;&#160;&#160;</td>
<td><code>CastableExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-CastExpr">CastExpr</a> (
"castable" "as" <a href="#prod-xpath20-SingleType">SingleType</a>
)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-CastExpr" id=
"prod-xpath20-CastExpr"></a>[21]&#160;&#160;&#160;</td>
<td><code>CastExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-UnaryExpr">UnaryExpr</a> ( "cast"
"as" <a href="#prod-xpath20-SingleType">SingleType</a>
)?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-UnaryExpr" id=
"prod-xpath20-UnaryExpr"></a>[22]&#160;&#160;&#160;</td>
<td><code>UnaryExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("-" | "+")* <a href=
"#prod-xpath20-ValueExpr">ValueExpr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ValueExpr" id=
"prod-xpath20-ValueExpr"></a>[23]&#160;&#160;&#160;</td>
<td><code>ValueExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-PathExpr">PathExpr</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-GeneralComp" id=
"prod-xpath20-GeneralComp"></a>[24]&#160;&#160;&#160;</td>
<td><code>GeneralComp</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"=" | "!=" | "&lt;" | "&lt;=" | "&gt;" |
"&gt;="</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ValueComp" id=
"prod-xpath20-ValueComp"></a>[25]&#160;&#160;&#160;</td>
<td><code>ValueComp</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"eq" | "ne" | "lt" | "le" | "gt" | "ge"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-NodeComp" id=
"prod-xpath20-NodeComp"></a>[26]&#160;&#160;&#160;</td>
<td><code>NodeComp</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"is" | "&lt;&lt;" | "&gt;&gt;"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-Pragma" id=
"prod-xpath20-Pragma"></a>[27]&#160;&#160;&#160;</td>
<td><code>Pragma</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"(#" <a href="#prod-xpath20-S">S</a>? <a href=
"#prod-xpath20-QName">QName</a> (<a href="#prod-xpath20-S">S</a>
<a href="#prod-xpath20-PragmaContents">PragmaContents</a>)?
"#)"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xpath20/#ws-explicit">ws:
explicit</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-PragmaContents" id=
"prod-xpath20-PragmaContents"></a>[28]&#160;&#160;&#160;</td>
<td><code>PragmaContents</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xpath20-Char">Char</a>* - (Char* '#)'
Char*))</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-PathExpr" id=
"prod-xpath20-PathExpr"></a>[29]&#160;&#160;&#160;</td>
<td><code>PathExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("/" <a href=
"#prod-xpath20-RelativePathExpr">RelativePathExpr</a>?)<br />
| ("//" <a href=
"#prod-xpath20-RelativePathExpr">RelativePathExpr</a>)<br />
| <a href=
"#prod-xpath20-RelativePathExpr">RelativePathExpr</a></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xpath20/#parse-note-leading-lone-slash">xgc:
leading-lone-slash</a><sup><small>XP</small></sup></span>
*/</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-RelativePathExpr" id=
"prod-xpath20-RelativePathExpr"></a>[30]&#160;&#160;&#160;</td>
<td><code>RelativePathExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-StepExpr">StepExpr</a> (("/" |
"//") <a href="#prod-xpath20-StepExpr">StepExpr</a>)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-StepExpr" id=
"prod-xpath20-StepExpr"></a>[31]&#160;&#160;&#160;</td>
<td><code>StepExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-FilterExpr">FilterExpr</a> |
<a href="#prod-xpath20-AxisStep">AxisStep</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AxisStep" id=
"prod-xpath20-AxisStep"></a>[32]&#160;&#160;&#160;</td>
<td><code>AxisStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xpath20-ReverseStep">ReverseStep</a> |
<a href="#prod-xpath20-ForwardStep">ForwardStep</a>) <a href=
"#prod-xpath20-PredicateList">PredicateList</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ForwardStep" id=
"prod-xpath20-ForwardStep"></a>[33]&#160;&#160;&#160;</td>
<td><code>ForwardStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xpath20-ForwardAxis">ForwardAxis</a>
<a href="#prod-xpath20-NodeTest">NodeTest</a>) | <a href=
"#prod-xpath20-AbbrevForwardStep">AbbrevForwardStep</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ForwardAxis" id=
"prod-xpath20-ForwardAxis"></a>[34]&#160;&#160;&#160;</td>
<td><code>ForwardAxis</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("child" "::")<br />
| ("descendant" "::")<br />
| ("attribute" "::")<br />
| ("self" "::")<br />
| ("descendant-or-self" "::")<br />
| ("following-sibling" "::")<br />
| ("following" "::")<br />
| ("namespace" "::")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AbbrevForwardStep" id=
"prod-xpath20-AbbrevForwardStep"></a>[35]&#160;&#160;&#160;</td>
<td><code>AbbrevForwardStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"@"? <a href=
"#prod-xpath20-NodeTest">NodeTest</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ReverseStep" id=
"prod-xpath20-ReverseStep"></a>[36]&#160;&#160;&#160;</td>
<td><code>ReverseStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xpath20-ReverseAxis">ReverseAxis</a>
<a href="#prod-xpath20-NodeTest">NodeTest</a>) | <a href=
"#prod-xpath20-AbbrevReverseStep">AbbrevReverseStep</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ReverseAxis" id=
"prod-xpath20-ReverseAxis"></a>[37]&#160;&#160;&#160;</td>
<td><code>ReverseAxis</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("parent" "::")<br />
| ("ancestor" "::")<br />
| ("preceding-sibling" "::")<br />
| ("preceding" "::")<br />
| ("ancestor-or-self" "::")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AbbrevReverseStep" id=
"prod-xpath20-AbbrevReverseStep"></a>[38]&#160;&#160;&#160;</td>
<td><code>AbbrevReverseStep</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>".."</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-NodeTest" id=
"prod-xpath20-NodeTest"></a>[39]&#160;&#160;&#160;</td>
<td><code>NodeTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-KindTest">KindTest</a> | <a href=
"#prod-xpath20-NameTest">NameTest</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-NameTest" id=
"prod-xpath20-NameTest"></a>[40]&#160;&#160;&#160;</td>
<td><code>NameTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-QName">QName</a> | <a href=
"#prod-xpath20-Wildcard">Wildcard</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-Wildcard" id=
"prod-xpath20-Wildcard"></a>[41]&#160;&#160;&#160;</td>
<td><code>Wildcard</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"*"<br />
| (<a href="#prod-xpath20-NCName">NCName</a> ":" "*")<br />
| ("*" ":" <a href="#prod-xpath20-NCName">NCName</a>)</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xpath20/#ws-explicit">ws:
explicit</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FilterExpr" id=
"prod-xpath20-FilterExpr"></a>[42]&#160;&#160;&#160;</td>
<td><code>FilterExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-PrimaryExpr">PrimaryExpr</a>
<a href="#prod-xpath20-PredicateList">PredicateList</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-PredicateList" id=
"prod-xpath20-PredicateList"></a>[43]&#160;&#160;&#160;</td>
<td><code>PredicateList</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xpath20-Predicate">Predicate</a>*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-Predicate" id=
"prod-xpath20-Predicate"></a>[44]&#160;&#160;&#160;</td>
<td><code>Predicate</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"[" <a href="#prod-xpath20-Expr">Expr</a> "]"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-PrimaryExpr" id=
"prod-xpath20-PrimaryExpr"></a>[45]&#160;&#160;&#160;</td>
<td><code>PrimaryExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-Literal">Literal</a><br />
| <a href="#prod-xpath20-VarRef">VarRef</a><br />
| <a href=
"#prod-xpath20-ParenthesizedExpr">ParenthesizedExpr</a><br />
| <a href="#prod-xpath20-ContextItemExpr">ContextItemExpr</a><br />
| <a href="#prod-xpath20-FunctionCall">FunctionCall</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-Literal" id=
"prod-xpath20-Literal"></a>[46]&#160;&#160;&#160;</td>
<td><code>Literal</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-NumericLiteral">NumericLiteral</a>
| <a href=
"#prod-xpath20-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-NumericLiteral" id=
"prod-xpath20-NumericLiteral"></a>[47]&#160;&#160;&#160;</td>
<td><code>NumericLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-IntegerLiteral">IntegerLiteral</a>
| <a href="#prod-xpath20-DecimalLiteral">DecimalLiteral</a> |
<a href="#prod-xpath20-DoubleLiteral">DoubleLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-VarRef" id=
"prod-xpath20-VarRef"></a>[48]&#160;&#160;&#160;</td>
<td><code>VarRef</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"$" <a href=
"#prod-xpath20-VarName">VarName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-VarName" id=
"prod-xpath20-VarName"></a>[49]&#160;&#160;&#160;</td>
<td><code>VarName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ParenthesizedExpr" id=
"prod-xpath20-ParenthesizedExpr"></a>[50]&#160;&#160;&#160;</td>
<td><code>ParenthesizedExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"(" <a href="#prod-xpath20-Expr">Expr</a>?
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ContextItemExpr" id=
"prod-xpath20-ContextItemExpr"></a>[51]&#160;&#160;&#160;</td>
<td><code>ContextItemExpr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"."</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FunctionCall" id=
"prod-xpath20-FunctionCall"></a>[52]&#160;&#160;&#160;</td>
<td><code>FunctionCall</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-QName">QName</a> "(" (<a href=
"#prod-xpath20-ExprSingle">ExprSingle</a> ("," <a href=
"#prod-xpath20-ExprSingle">ExprSingle</a>)*)? ")"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xpath20/#parse-note-reserved-function-names">xgc:
reserved-function-names</a><sup><small>XP</small></sup></span>
*/</i></td>
</tr>
<tr valign="baseline">
<td></td>
<td></td>
<td></td>
<td></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xpath20/#parse-note-parens">gn:
parens</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-SingleType" id=
"prod-xpath20-SingleType"></a>[53]&#160;&#160;&#160;</td>
<td><code>SingleType</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-AtomicType">AtomicType</a>
"?"?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-SequenceType" id=
"prod-xpath20-SequenceType"></a>[54]&#160;&#160;&#160;</td>
<td><code>SequenceType</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("empty-sequence" "(" ")")<br />
| (<a href="#prod-xpath20-ItemType">ItemType</a> <a href=
"#prod-xpath20-OccurrenceIndicator">OccurrenceIndicator</a>?)</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-OccurrenceIndicator" id=
"prod-xpath20-OccurrenceIndicator"></a>[55]&#160;&#160;&#160;</td>
<td><code>OccurrenceIndicator</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"?" | "*" | "+"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xpath20/#parse-note-occurrence-indicators">xgc:
occurrence-indicators</a><sup><small>XP</small></sup></span>
*/</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ItemType" id=
"prod-xpath20-ItemType"></a>[56]&#160;&#160;&#160;</td>
<td><code>ItemType</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-KindTest">KindTest</a> | ("item"
"(" ")") | <a href=
"#prod-xpath20-AtomicType">AtomicType</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AtomicType" id=
"prod-xpath20-AtomicType"></a>[57]&#160;&#160;&#160;</td>
<td><code>AtomicType</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-KindTest" id=
"prod-xpath20-KindTest"></a>[58]&#160;&#160;&#160;</td>
<td><code>KindTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xpath20-DocumentTest">DocumentTest</a><br />
| <a href="#prod-xpath20-ElementTest">ElementTest</a><br />
| <a href="#prod-xpath20-AttributeTest">AttributeTest</a><br />
| <a href=
"#prod-xpath20-SchemaElementTest">SchemaElementTest</a><br />
| <a href=
"#prod-xpath20-SchemaAttributeTest">SchemaAttributeTest</a><br />
| <a href="#prod-xpath20-PITest">PITest</a><br />
| <a href="#prod-xpath20-CommentTest">CommentTest</a><br />
| <a href="#prod-xpath20-TextTest">TextTest</a><br />
| <a href="#prod-xpath20-AnyKindTest">AnyKindTest</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AnyKindTest" id=
"prod-xpath20-AnyKindTest"></a>[59]&#160;&#160;&#160;</td>
<td><code>AnyKindTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"node" "(" ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-DocumentTest" id=
"prod-xpath20-DocumentTest"></a>[60]&#160;&#160;&#160;</td>
<td><code>DocumentTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"document-node" "(" (<a href=
"#prod-xpath20-ElementTest">ElementTest</a> | <a href=
"#prod-xpath20-SchemaElementTest">SchemaElementTest</a>)?
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-TextTest" id=
"prod-xpath20-TextTest"></a>[61]&#160;&#160;&#160;</td>
<td><code>TextTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"text" "(" ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-CommentTest" id=
"prod-xpath20-CommentTest"></a>[62]&#160;&#160;&#160;</td>
<td><code>CommentTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"comment" "(" ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-PITest" id=
"prod-xpath20-PITest"></a>[63]&#160;&#160;&#160;</td>
<td><code>PITest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"processing-instruction" "(" (<a href=
"#prod-xpath20-NCName">NCName</a> | <a href=
"#prod-xpath20-StringLiteral">StringLiteral</a>)? ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AttributeTest" id=
"prod-xpath20-AttributeTest"></a>[64]&#160;&#160;&#160;</td>
<td><code>AttributeTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"attribute" "(" (<a href=
"#prod-xpath20-AttribNameOrWildcard">AttribNameOrWildcard</a> (","
<a href="#prod-xpath20-TypeName">TypeName</a>)?)? ")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AttribNameOrWildcard" id=
"prod-xpath20-AttribNameOrWildcard"></a>[65]&#160;&#160;&#160;</td>
<td><code>AttribNameOrWildcard</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-AttributeName">AttributeName</a> |
"*"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-SchemaAttributeTest" id=
"prod-xpath20-SchemaAttributeTest"></a>[66]&#160;&#160;&#160;</td>
<td><code>SchemaAttributeTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"schema-attribute" "(" <a href=
"#prod-xpath20-AttributeDeclaration">AttributeDeclaration</a>
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AttributeDeclaration" id=
"prod-xpath20-AttributeDeclaration"></a>[67]&#160;&#160;&#160;</td>
<td><code>AttributeDeclaration</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xpath20-AttributeName">AttributeName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ElementTest" id=
"prod-xpath20-ElementTest"></a>[68]&#160;&#160;&#160;</td>
<td><code>ElementTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"element" "(" (<a href=
"#prod-xpath20-ElementNameOrWildcard">ElementNameOrWildcard</a>
("," <a href="#prod-xpath20-TypeName">TypeName</a> "?"?)?)?
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ElementNameOrWildcard" id=
"prod-xpath20-ElementNameOrWildcard"></a>[69]&#160;&#160;&#160;</td>
<td><code>ElementNameOrWildcard</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-ElementName">ElementName</a> |
"*"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-SchemaElementTest" id=
"prod-xpath20-SchemaElementTest"></a>[70]&#160;&#160;&#160;</td>
<td><code>SchemaElementTest</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"schema-element" "(" <a href=
"#prod-xpath20-ElementDeclaration">ElementDeclaration</a>
")"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ElementDeclaration" id=
"prod-xpath20-ElementDeclaration"></a>[71]&#160;&#160;&#160;</td>
<td><code>ElementDeclaration</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xpath20-ElementName">ElementName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-AttributeName" id=
"prod-xpath20-AttributeName"></a>[72]&#160;&#160;&#160;</td>
<td><code>AttributeName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-ElementName" id=
"prod-xpath20-ElementName"></a>[73]&#160;&#160;&#160;</td>
<td><code>ElementName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-TypeName" id=
"prod-xpath20-TypeName"></a>[74]&#160;&#160;&#160;</td>
<td><code>TypeName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-QName">QName</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-URILiteral" id=
"prod-xpath20-URILiteral"></a>[75]&#160;&#160;&#160;</td>
<td><code>URILiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xpath20-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTSelection" id=
"prod-xpath20-FTSelection"></a>[76]&#160;&#160;&#160;</td>
<td><code>FTSelection</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-FTOr">FTOr</a> <a href=
"#prod-xpath20-FTPosFilter">FTPosFilter</a>*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTWeight" id=
"prod-xpath20-FTWeight"></a>[77]&#160;&#160;&#160;</td>
<td><code>FTWeight</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"weight" "{" <a href="#prod-xpath20-Expr">Expr</a>
"}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTOr" id=
"prod-xpath20-FTOr"></a>[78]&#160;&#160;&#160;</td>
<td><code>FTOr</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-FTAnd">FTAnd</a> ( "ftor" <a href=
"#prod-xpath20-FTAnd">FTAnd</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTAnd" id=
"prod-xpath20-FTAnd"></a>[79]&#160;&#160;&#160;</td>
<td><code>FTAnd</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-FTMildNot">FTMildNot</a> ( "ftand"
<a href="#prod-xpath20-FTMildNot">FTMildNot</a> )*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTMildNot" id=
"prod-xpath20-FTMildNot"></a>[80]&#160;&#160;&#160;</td>
<td><code>FTMildNot</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-FTUnaryNot">FTUnaryNot</a> ( "not"
"in" <a href="#prod-xpath20-FTUnaryNot">FTUnaryNot</a>
)*</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTUnaryNot" id=
"prod-xpath20-FTUnaryNot"></a>[81]&#160;&#160;&#160;</td>
<td><code>FTUnaryNot</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("ftnot")? <a href=
"#prod-xpath20-FTPrimaryWithOptions">FTPrimaryWithOptions</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTPrimaryWithOptions" id=
"prod-xpath20-FTPrimaryWithOptions"></a>[82]&#160;&#160;&#160;</td>
<td><code>FTPrimaryWithOptions</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-FTPrimary">FTPrimary</a> <a href=
"#prod-xpath20-FTMatchOptions">FTMatchOptions</a>? <a href=
"#prod-xpath20-FTWeight">FTWeight</a>?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTPrimary" id=
"prod-xpath20-FTPrimary"></a>[83]&#160;&#160;&#160;</td>
<td><code>FTPrimary</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xpath20-FTWords">FTWords</a> <a href=
"#prod-xpath20-FTTimes">FTTimes</a>?) | ("(" <a href=
"#prod-xpath20-FTSelection">FTSelection</a> ")") | <a href=
"#prod-xpath20-FTExtensionSelection">FTExtensionSelection</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTWords" id=
"prod-xpath20-FTWords"></a>[84]&#160;&#160;&#160;</td>
<td><code>FTWords</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-FTWordsValue">FTWordsValue</a>
<a href=
"#prod-xpath20-FTAnyallOption">FTAnyallOption</a>?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTWordsValue" id=
"prod-xpath20-FTWordsValue"></a>[85]&#160;&#160;&#160;</td>
<td><code>FTWordsValue</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-StringLiteral">StringLiteral</a> |
("{" <a href="#prod-xpath20-Expr">Expr</a> "}")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTExtensionSelection" id=
"prod-xpath20-FTExtensionSelection"></a>[86]&#160;&#160;&#160;</td>
<td><code>FTExtensionSelection</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-Pragma">Pragma</a>+ "{" <a href=
"#prod-xpath20-FTSelection">FTSelection</a>? "}"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTAnyallOption" id=
"prod-xpath20-FTAnyallOption"></a>[87]&#160;&#160;&#160;</td>
<td><code>FTAnyallOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("any" "word"?) | ("all" "words"?) | "phrase"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTTimes" id=
"prod-xpath20-FTTimes"></a>[88]&#160;&#160;&#160;</td>
<td><code>FTTimes</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"occurs" <a href="#prod-xpath20-FTRange">FTRange</a>
"times"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTRange" id=
"prod-xpath20-FTRange"></a>[89]&#160;&#160;&#160;</td>
<td><code>FTRange</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("exactly" <a href=
"#prod-xpath20-AdditiveExpr">AdditiveExpr</a>)<br />
| ("at" "least" <a href=
"#prod-xpath20-AdditiveExpr">AdditiveExpr</a>)<br />
| ("at" "most" <a href=
"#prod-xpath20-AdditiveExpr">AdditiveExpr</a>)<br />
| ("from" <a href="#prod-xpath20-AdditiveExpr">AdditiveExpr</a>
"to" <a href=
"#prod-xpath20-AdditiveExpr">AdditiveExpr</a>)</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTPosFilter" id=
"prod-xpath20-FTPosFilter"></a>[90]&#160;&#160;&#160;</td>
<td><code>FTPosFilter</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-FTOrder">FTOrder</a> | <a href=
"#prod-xpath20-FTWindow">FTWindow</a> | <a href=
"#prod-xpath20-FTDistance">FTDistance</a> | <a href=
"#prod-xpath20-FTScope">FTScope</a> | <a href=
"#prod-xpath20-FTContent">FTContent</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTOrder" id=
"prod-xpath20-FTOrder"></a>[91]&#160;&#160;&#160;</td>
<td><code>FTOrder</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"ordered"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTWindow" id=
"prod-xpath20-FTWindow"></a>[92]&#160;&#160;&#160;</td>
<td><code>FTWindow</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"window" <a href=
"#prod-xpath20-AdditiveExpr">AdditiveExpr</a> <a href=
"#prod-xpath20-FTUnit">FTUnit</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTDistance" id=
"prod-xpath20-FTDistance"></a>[93]&#160;&#160;&#160;</td>
<td><code>FTDistance</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"distance" <a href="#prod-xpath20-FTRange">FTRange</a>
<a href="#prod-xpath20-FTUnit">FTUnit</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTUnit" id=
"prod-xpath20-FTUnit"></a>[94]&#160;&#160;&#160;</td>
<td><code>FTUnit</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"words" | "sentences" | "paragraphs"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTScope" id=
"prod-xpath20-FTScope"></a>[95]&#160;&#160;&#160;</td>
<td><code>FTScope</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("same" | "different") <a href=
"#prod-xpath20-FTBigUnit">FTBigUnit</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTBigUnit" id=
"prod-xpath20-FTBigUnit"></a>[96]&#160;&#160;&#160;</td>
<td><code>FTBigUnit</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"sentence" | "paragraph"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTContent" id=
"prod-xpath20-FTContent"></a>[97]&#160;&#160;&#160;</td>
<td><code>FTContent</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("at" "start") | ("at" "end") | ("entire"
"content")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTMatchOptions" id=
"prod-xpath20-FTMatchOptions"></a>[98]&#160;&#160;&#160;</td>
<td><code>FTMatchOptions</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("using" <a href=
"#prod-xpath20-FTMatchOption">FTMatchOption</a>)+</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTMatchOption" id=
"prod-xpath20-FTMatchOption"></a>[99]&#160;&#160;&#160;</td>
<td><code>FTMatchOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"#prod-xpath20-FTLanguageOption">FTLanguageOption</a><br />
| <a href=
"#prod-xpath20-FTWildCardOption">FTWildCardOption</a><br />
| <a href=
"#prod-xpath20-FTThesaurusOption">FTThesaurusOption</a><br />
| <a href="#prod-xpath20-FTStemOption">FTStemOption</a><br />
| <a href="#prod-xpath20-FTCaseOption">FTCaseOption</a><br />
| <a href=
"#prod-xpath20-FTDiacriticsOption">FTDiacriticsOption</a><br />
| <a href=
"#prod-xpath20-FTStopWordOption">FTStopWordOption</a><br />
| <a href=
"#prod-xpath20-FTExtensionOption">FTExtensionOption</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTCaseOption" id=
"prod-xpath20-FTCaseOption"></a>[100]&#160;&#160;&#160;</td>
<td><code>FTCaseOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("case" "insensitive")<br />
| ("case" "sensitive")<br />
| "lowercase"<br />
| "uppercase"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTDiacriticsOption" id=
"prod-xpath20-FTDiacriticsOption"></a>[101]&#160;&#160;&#160;</td>
<td><code>FTDiacriticsOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("diacritics" "insensitive")<br />
| ("diacritics" "sensitive")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTStemOption" id=
"prod-xpath20-FTStemOption"></a>[102]&#160;&#160;&#160;</td>
<td><code>FTStemOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"stemming" | ("no" "stemming")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTThesaurusOption" id=
"prod-xpath20-FTThesaurusOption"></a>[103]&#160;&#160;&#160;</td>
<td><code>FTThesaurusOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("thesaurus" (<a href=
"#prod-xpath20-FTThesaurusID">FTThesaurusID</a> | "default"))<br />
| ("thesaurus" "(" (<a href=
"#prod-xpath20-FTThesaurusID">FTThesaurusID</a> | "default") (","
<a href="#prod-xpath20-FTThesaurusID">FTThesaurusID</a>)*
")")<br />
| ("no" "thesaurus")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTThesaurusID" id=
"prod-xpath20-FTThesaurusID"></a>[104]&#160;&#160;&#160;</td>
<td><code>FTThesaurusID</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"at" <a href="#prod-xpath20-URILiteral">URILiteral</a>
("relationship" <a href=
"#prod-xpath20-StringLiteral">StringLiteral</a>)? (<a href=
"#prod-xpath20-FTLiteralRange">FTLiteralRange</a>
"levels")?</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTLiteralRange" id=
"prod-xpath20-FTLiteralRange"></a>[105]&#160;&#160;&#160;</td>
<td><code>FTLiteralRange</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("exactly" <a href=
"#prod-xpath20-IntegerLiteral">IntegerLiteral</a>)<br />
| ("at" "least" <a href=
"#prod-xpath20-IntegerLiteral">IntegerLiteral</a>)<br />
| ("at" "most" <a href=
"#prod-xpath20-IntegerLiteral">IntegerLiteral</a>)<br />
| ("from" <a href="#prod-xpath20-IntegerLiteral">IntegerLiteral</a>
"to" <a href=
"#prod-xpath20-IntegerLiteral">IntegerLiteral</a>)</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTStopWordOption" id=
"prod-xpath20-FTStopWordOption"></a>[106]&#160;&#160;&#160;</td>
<td><code>FTStopWordOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("stop" "words" <a href=
"#prod-xpath20-FTStopWords">FTStopWords</a> <a href=
"#prod-xpath20-FTStopWordsInclExcl">FTStopWordsInclExcl</a>*)<br />
| ("stop" "words" "default" <a href=
"#prod-xpath20-FTStopWordsInclExcl">FTStopWordsInclExcl</a>*)<br />
| ("no" "stop" "words")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTStopWords" id=
"prod-xpath20-FTStopWords"></a>[107]&#160;&#160;&#160;</td>
<td><code>FTStopWords</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("at" <a href=
"#prod-xpath20-URILiteral">URILiteral</a>)<br />
| ("(" <a href="#prod-xpath20-StringLiteral">StringLiteral</a> (","
<a href="#prod-xpath20-StringLiteral">StringLiteral</a>)*
")")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTStopWordsInclExcl" id=
"prod-xpath20-FTStopWordsInclExcl"></a>[108]&#160;&#160;&#160;</td>
<td><code>FTStopWordsInclExcl</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("union" | "except") <a href=
"#prod-xpath20-FTStopWords">FTStopWords</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTLanguageOption" id=
"prod-xpath20-FTLanguageOption"></a>[109]&#160;&#160;&#160;</td>
<td><code>FTLanguageOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"language" <a href=
"#prod-xpath20-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTWildCardOption" id=
"prod-xpath20-FTWildCardOption"></a>[110]&#160;&#160;&#160;</td>
<td><code>FTWildCardOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"wildcards" | ("no" "wildcards")</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTExtensionOption" id=
"prod-xpath20-FTExtensionOption"></a>[111]&#160;&#160;&#160;</td>
<td><code>FTExtensionOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"option" <a href="#prod-xpath20-QName">QName</a> <a href=
"#prod-xpath20-StringLiteral">StringLiteral</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-FTIgnoreOption" id=
"prod-xpath20-FTIgnoreOption"></a>[112]&#160;&#160;&#160;</td>
<td><code>FTIgnoreOption</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"without" "content" <a href=
"#prod-xpath20-UnionExpr">UnionExpr</a></code></td>
</tr>
</tbody>
</table>
<div class="div2">
<h3><a name="xpath-grammar-terminals" id=
"xpath-grammar-terminals"></a>B.1 Terminal Symbols</h3>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-IntegerLiteral" id=
"prod-xpath20-IntegerLiteral"></a>[113]&#160;&#160;&#160;</td>
<td><code>IntegerLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href="#prod-xpath20-Digits">Digits</a></code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-DecimalLiteral" id=
"prod-xpath20-DecimalLiteral"></a>[114]&#160;&#160;&#160;</td>
<td><code>DecimalLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>("." <a href="#prod-xpath20-Digits">Digits</a>) |
(<a href="#prod-xpath20-Digits">Digits</a> "." [0-9]*)</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xpath20/#ws-explicit">ws:
explicit</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-DoubleLiteral" id=
"prod-xpath20-DoubleLiteral"></a>[115]&#160;&#160;&#160;</td>
<td><code>DoubleLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(("." <a href="#prod-xpath20-Digits">Digits</a>) |
(<a href="#prod-xpath20-Digits">Digits</a> ("." [0-9]*)?)) [eE]
[+-]? <a href="#prod-xpath20-Digits">Digits</a></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xpath20/#ws-explicit">ws:
explicit</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-StringLiteral" id=
"prod-xpath20-StringLiteral"></a>[116]&#160;&#160;&#160;</td>
<td><code>StringLiteral</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>('"' (<a href="#prod-xpath20-EscapeQuot">EscapeQuot</a> |
[^"])* '"') | ("'" (<a href=
"#prod-xpath20-EscapeApos">EscapeApos</a> | [^'])* "'")</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xpath20/#ws-explicit">ws:
explicit</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-EscapeQuot" id=
"prod-xpath20-EscapeQuot"></a>[117]&#160;&#160;&#160;</td>
<td><code>EscapeQuot</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>'""'</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-EscapeApos" id=
"prod-xpath20-EscapeApos"></a>[118]&#160;&#160;&#160;</td>
<td><code>EscapeApos</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"''"</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-Comment" id=
"prod-xpath20-Comment"></a>[119]&#160;&#160;&#160;</td>
<td><code>Comment</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>"(:" (<a href=
"#prod-xpath20-CommentContents">CommentContents</a> | <a href=
"#prod-xpath20-Comment">Comment</a>)* ":)"</code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href="http://www.w3.org/TR/xpath20/#ws-explicit">ws:
explicit</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
<tr valign="baseline">
<td></td>
<td></td>
<td></td>
<td></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xpath20/#parse-note-comments">gn:
comments</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-QName" id=
"prod-xpath20-QName"></a>[120]&#160;&#160;&#160;</td>
<td><code>QName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml-names/#NT-QName">[http://www.w3.org/TR/REC-xml-names/#NT-QName]</a><sup><small>Names</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xpath20/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-NCName" id=
"prod-xpath20-NCName"></a>[121]&#160;&#160;&#160;</td>
<td><code>NCName</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml-names/#NT-NCName">[http://www.w3.org/TR/REC-xml-names/#NT-NCName]</a><sup><small>Names</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xpath20/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-S" id=
"prod-xpath20-S"></a>[122]&#160;&#160;&#160;</td>
<td><code>S</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml/#NT-S">[http://www.w3.org/TR/REC-xml#NT-S]</a><sup><small>XML</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xpath20/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-Char" id=
"prod-xpath20-Char"></a>[123]&#160;&#160;&#160;</td>
<td><code>Char</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code><a href=
"http://www.w3.org/TR/REC-xml/#NT-Char">[http://www.w3.org/TR/REC-xml#NT-Char]</a><sup><small>XML</small></sup></code></td>
<td><i>/* 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
<span><a href=
"http://www.w3.org/TR/xpath20/#parse-note-xml-version">xgc:
xml-version</a><sup><small>XP</small></sup></span> */</i></td>
</tr>
</tbody>
</table>
<p>The following symbols are used only in the definition of
terminal symbols; they are not terminal symbols in the grammar of
<a href="#id-xpath-grammar"><b>B EBNF for XPath 2.0 Grammar with
Full-Text extensions</b></a>.</p>
<table class="scrap" summary="Scrap">
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-Digits" id=
"prod-xpath20-Digits"></a>[124]&#160;&#160;&#160;</td>
<td><code>Digits</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>[0-9]+</code></td>
</tr>
</tbody>
<tbody>
<tr valign="baseline">
<td><a name="prod-xpath20-CommentContents" id=
"prod-xpath20-CommentContents"></a>[125]&#160;&#160;&#160;</td>
<td><code>CommentContents</code></td>
<td>&#160;&#160;&#160;::=&#160;&#160;&#160;</td>
<td><code>(<a href="#prod-xpath20-Char">Char</a>+ - (Char* ('(:' |
':)') Char*))</code></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="div1">
<h2><a name="id-xqft-static-context-components" id=
"id-xqft-static-context-components"></a>C Static Context
Components</h2>
<p>The following table describes the full-text components of the
<b>static context</b> (as defined in <a href=
"http://www.w3.org/TR/xquery/#static_context">Section 2.1.1 Static
Context</a><sup><small>XQ</small></sup>). The following aspects of
each component are described:</p>
<ul>
<li>
<p><em>Default initial value:</em> This is the initial value of the
component if it is not overridden or augmented by the
implementation or by a query.</p>
</li>
<li>
<p><em>Can be overwritten or augmented by implementation:</em>
Indicates whether an XQuery implementation is allowed to replace
the default initial value of the component by a different,
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> value
and/or to augment the default initial value by additional <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> values.</p>
</li>
<li>
<p><em>Can be overwritten or augmented by a query:</em> Indicates
whether a query is allowed to replace and/or augment the initial
value provided by default or by the implementation. If so,
indicates how this is accomplished (for example, by a declaration
in the <b>prolog</b>; as defined in <a href=
"http://www.w3.org/TR/xquery/#id-query-prolog">Section 4 Modules
and Prologs</a><sup><small>XQ</small></sup>).</p>
</li>
<li>
<p><em>Scope:</em> Indicates where the component is applicable.
"Global" indicates that the component applies globally, throughout
all the modules used in a query. "Module" indicates that the
component applies throughout a <b>module</b> (as defined in
<a href="http://www.w3.org/TR/xquery/#id-query-prolog">Section 4
Modules and Prologs</a><sup><small>XQ</small></sup>). "Lexical"
indicates that the component applies within the expression in which
it is defined (equivalent to "module", if the component is declared
in a prolog.)</p>
</li>
<li>
<p><em>Consistency Rules:</em> Indicates rules that must be
observed in assigning values to the component.</p>
</li>
</ul>
<div class="small">
<table width="100%" border="1" summary="Static Context" class=
"small">
<caption>Static Context Components</caption>
<tbody>
<tr>
<th colspan="1">Component</th>
<th colspan="1">Default initial value</th>
<th colspan="1">Can be overwritten or augmented by
implementation?</th>
<th colspan="1">Can be overwritten or augmented by a query?</th>
<th colspan="1">Scope</th>
<th colspan="1">Consistency rules</th>
</tr>
<tr>
<td><a href="#ftcaseoption">FTCaseOption</a></td>
<td><code>case insensitive</code></td>
<td>overwriteable</td>
<td>overwriteable by prolog</td>
<td>lexical</td>
<td>Value must be <code>case insensitive</code>, <code>case
sensitive</code>, <code>lowercase</code>, or
<code>uppercase</code>.</td>
</tr>
<tr>
<td><a href="#ftdiacriticsoption">FTDiacriticsOption</a></td>
<td><code>diacritics insensitive</code></td>
<td>overwriteable</td>
<td>overwriteable by prolog</td>
<td>lexical</td>
<td>Value must be <code>diacritics insensitive</code> or
<code>diacritics sensitive</code>.</td>
</tr>
<tr>
<td><a href="#ftstemoption">FTStemOption</a></td>
<td><code>no stemming</code></td>
<td>overwriteable</td>
<td>overwriteable by prolog</td>
<td>lexical</td>
<td>Value must be <code>stemming</code> or <code>no
stemming</code>.</td>
</tr>
<tr>
<td><a href="#ftthesaurusoption">FTThesaurusOption</a></td>
<td><code>no thesaurus</code></td>
<td>overwriteable</td>
<td>overwriteable by prolog (refer to default to augment)</td>
<td>lexical</td>
<td>Each URI in the value must be found in the statically known
thesauri.</td>
</tr>
<tr>
<td>Statically known thesauri</td>
<td>none</td>
<td>augmentable</td>
<td>cannot be augmented or overwritten by prolog</td>
<td>module</td>
<td>Each URI uniquely identifies a thesaurus list.</td>
</tr>
<tr>
<td><a href="#ftstopwordoption">FTStopWordOption</a></td>
<td><code>no stop words</code></td>
<td>overwriteable</td>
<td>overwriteable by prolog (refer to default to augment)</td>
<td>lexical</td>
<td>Each URI in the value must be found in the statically known
stop word lists.</td>
</tr>
<tr>
<td>Statically known stop word lists</td>
<td>none</td>
<td>augmentable</td>
<td>cannot be augmented or overwritten by prolog</td>
<td>module</td>
<td>Each URI uniquely identifies a stop word list.</td>
</tr>
<tr>
<td><a href="#ftlanguageoption">FTLanguageOption</a></td>
<td><a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a></td>
<td>overwriteable</td>
<td>overwriteable by prolog</td>
<td>lexical</td>
<td>Value must be castable to <code>xs:language</code>.</td>
</tr>
<tr>
<td>Statically known languages</td>
<td>none</td>
<td>augmentable</td>
<td>cannot be augmented or overwritten by prolog</td>
<td>module</td>
<td>Each string uniquely identifies a language.</td>
</tr>
<tr>
<td><a href="#ftwildcardoption">FTWildCardOption</a></td>
<td><code>no wildcards</code></td>
<td>no</td>
<td>overwriteable by prolog</td>
<td>lexical</td>
<td>Value must be <code>wildcards</code> or <code>no
wildcards</code>.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="div1">
<h2><a name="id-errors" id="id-errors"></a>D Error Conditions</h2>
<dl>
<dt><a name="ERRFTST0001" id="ERRFTST0001"></a>err:FTST0001</dt>
<dd>
<p>An implementation that does not support the FTMildNot operator
must raise a static error if a full-text query contains a mild
not.</p>
</dd>
<dt><a name="ERRFTST0002" id="ERRFTST0002"></a>err:FTST0002</dt>
<dd>
<p>An implementation that enforces one of the restrictions on
FTUnaryNot must raise a static error if a full-text query does not
obey the restriction.</p>
</dd>
<dt><a name="ERRFTST0003" id="ERRFTST0003"></a>err:FTST0003</dt>
<dd>
<p>An implementation that does not support one or more of the
choices on FTUnit and FTBigUnit must raise a static error if a
full-text query contains one of those choices.</p>
</dd>
<dt><a name="ERRFTST0004" id="ERRFTST0004"></a>err:FTST0004</dt>
<dd>
<p>An implementation that does not support the FTScope operator
must raise a static error if a full-text query contains a
scope.</p>
</dd>
<dt><a name="ERRFTST0005" id="ERRFTST0005"></a>err:FTST0005</dt>
<dd>
<p>An implementation that does not support the FTTimes operator
must raise a static error if a full-text query contains a
times.</p>
</dd>
<dt><a name="ERRFTST0006" id="ERRFTST0006"></a>err:FTST0006</dt>
<dd>
<p>An implementation that restricts the use of FTStopWordOption
must raise a static error if a full-text query contains a stop word
option that does not meet the restriction.</p>
</dd>
<dt><a name="ERRFTST0007" id="ERRFTST0007"></a>err:FTST0007</dt>
<dd>
<p>An implementation that restricts the use of FTIgnoreOption must
raise a static error if a full-text query contains an ignore option
that does not meet the restriction.</p>
</dd>
<dt><a name="ERRFTST0008" id="ERRFTST0008"></a>err:FTST0008</dt>
<dd>
<p>It is a static error if, during the static analysis phase, the
query is found to contain a stop word option that refers to a stop
word list that is not found in the statically known stop word
lists.</p>
</dd>
<dt><a name="ERRFTST0009" id="ERRFTST0009"></a>err:FTST0009</dt>
<dd>
<p>It may be a static error if, during the static analysis phase,
the query is found to contain a language identifier in a language
option that the implementation does not support. The implementation
may choose not to raise this error and instead provide some other
implementation-defined behavior.</p>
</dd>
<dt><a name="ERRFTST0010" id="ERRFTST0010"></a>err:FTST0010</dt>
<dd>
<p>It is a static error if, during the static analysis phase, an
expression is found to use an FTOrder operator that does not appear
directly succeeding an FTWindow or an FTDistance operator and the
implementation enforces this restriction.</p>
</dd>
<dt><a name="ERRFTST0011" id="ERRFTST0011"></a>err:FTST0011</dt>
<dd>
<p>An implementation may restrict the use of FTWindow and
FTDistance to an FTOr that is either a single FTWords or a
combination of FTWords involving only the operators 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>ftand
and ftor</span>. If it a static error if, during the static
analysis phase, an expression is found that violates this
restriction and the implementation enforces this restriction.</p>
</dd>
<dt><a name="ERRFTST0012" id="ERRFTST0012"></a>err:FTST0012</dt>
<dd>
<p>An implementation that does not support the FTContent operator
must raise a static error if a full-text query contains one.</p>
</dd>
<dt><a name="ERRFTST0013" id="ERRFTST0013"></a>err:FTST0013</dt>
<dd>
<p>It is a static error if, during the static analysis phase, an
implementation that restricts the use of FTLanguageOption to a
single language, encounters more than one distinct language
option.</p>
</dd>
<dt><a name="ERRFTST0014" id="ERRFTST0014"></a>err:FTST0014</dt>
<dd>
<p>An implementation may constrain the form of the expression used
to compute scores. It is a static error if, during the static
analysis phase, such an implementation encounters a scoring
expression that does not meet the restriction.</p>
</dd>
<dt><a name="ERRFTST0015" id="ERRFTST0015"></a>err:FTST0015</dt>
<dd>
<p>It is a static error if, during the static analysis phase, an
implementation that restricts the choices of FTCaseOption
encounters the "lowercase" or "uppercase" option.</p>
</dd>
<dt><a name="ERRFTDY0016" id="ERRFTDY0016"></a>err:FTDY0016</dt>
<dd>
<p>It is a dynamic error if a weight value is not within the
required range of values; it is also a dynamic error if an
implementation that does not support negative weights encounters a
negative weight value.</p>
</dd>
<dt><a name="ERRFTDY0017" id="ERRFTDY0017"></a>err:FTDY0017</dt>
<dd>
<p>It is a dynamic error if an implementation encounters a mild not
selection, one of whose operands evaluates to an <b>AllMatches</b>
that contains a <b>StringExclude</b></p>
</dd>
<dt><a name="ERRFTST0018" id="ERRFTST0018"></a>err:FTST0018</dt>
<dd>
<p>It is a static error if, during the static analysis phase, the
query is found to contain a thesaurus option that refers to a
thesaurus that is not found in the statically known thesauri.</p>
</dd>
<dt><a name="ERRFTST0019" id="ERRFTST0019"></a>err:FTST0019</dt>
<dd>
<p>It is a static error if, within a single <a href=
"#doc-xquery10-FTMatchOptions">FTMatchOptions</a>, there is more
than one match option of any given <a title="match option group"
href="#dt-match-option-group">match option group</a>.</p>
</dd>
<dt><a name="ERRFTDY0020" id="ERRFTDY0020"></a>err:FTDY0020</dt>
<dd>
<p>It is a dynamic error if, when "wildcards" is in effect, a query
string violates wildcard syntax.</p>
</dd>
<dt><a name="ERRFOCH0002" id="ERRFOCH0002"></a>err:FOCH0002</dt>
<dd>
<p>It is a dynamic error if, in a function invocation, the argument
corresponding to the specified function's collation parameter does
not identify a supported collation.</p>
</dd>
<dt><a name="ERRXPST0003" id="ERRXPST0003"></a>err:XPST0003</dt>
<dd>
<p>It is a static error if an expression is not a valid instance of
the grammar defined in <a href="#id-grammar"><b>A EBNF for XQuery
1.0 Grammar with Full Text extensions</b></a> or of the grammar
defined in <a href="#id-xpath-grammar"><b>B EBNF for XPath 2.0
Grammar with Full-Text extensions</b></a>.</p>
</dd>
<dt><a name="ERRXPTY0004" id="ERRXPTY0004"></a>err:XPTY0004</dt>
<dd>
<p>It is a type error if, during the static analysis phase, an
expression is found to have a static type that is not appropriate
for the context in which the expression occurs, or during the
dynamic evaluation phase, the dynamic type of a value does not
match a required type as specified by the matching rules in
<a href="http://www.w3.org/TR/xpath20/#id-sequencetype-matching">Section
2.5.4 SequenceType Matching</a><sup><small>XP</small></sup>.</p>
</dd>
<dt><a name="ERRXQST0013" id="ERRXQST0013"></a>err:XQST0013</dt>
<dd>
<p>It is a static error if an implementation recognizes a pragma
but determines that its content is invalid.</p>
</dd>
<dt><a name="ERRXQST0079" id="ERRXQST0079"></a>err:XQST0079</dt>
<dd>
<p>It is a static error if an extension expression contains neither
a pragma that is recognized by the implementation nor an expression
enclosed in curly braces.</p>
</dd>
</dl>
</div>
<div class="div1">
<h2><a name="id-xqft-xqueryx" id="id-xqft-xqueryx"></a>E XML Syntax
(XQueryX) for XQuery and XPath Full Text 1.0</h2>
<p><a href="#xqueryx">[XML Syntax for XQuery 1.0 (XQueryX) (Second
Edition)]</a> defines an XML representation of <a href=
"#xquery">[XQuery 1.0: An XML Query Language (Second Edition)]</a>.
<a href="#xpath-full-text-10-requirements">[XQuery and XPath Full
Text 1.0 Requirements]</a>, section 5.4, XML Syntax, states "XQuery
and XPath Full Text MAY have more than one syntax binding. One
query language syntax MUST be expressed in XML in a way that
reflects the underlying structure of the query. See XML Query
Requirements." This appendix specifies XML Schemas that together
define the XML representation of XQuery and XPath Full Text 1.0 by
representing the abstract syntax found in <a href=
"#id-grammar"><b>A EBNF for XQuery 1.0 Grammar with Full Text
extensions</b></a>. Because XQuery and XPath Full Text 1.0
integrates seamlessly with XQuery 1.0, it follows that the XML
Syntax for XQuery and XPath Full Text 1.0 must integrate well with
the XML Syntax for XQuery 1.0.</p>
<p>The XML Schema specified in this appendix accomplishes
integration by importing the XML Schema defined for XQueryX in
<a href="http://www.w3.org/TR/xqueryx/#Schema">Section 4 An XML
Schema for the XQuery XML Syntax</a><sup><small>XQX</small></sup>,
incorporating all of its type and element definitions. It then
extends that schema by adding definitions of new types and elements
in a namespace belonging to the full-text specification.</p>
<p>The semantics of a Full Text XQueryX document are determined by
the semantics of the XQuery Full Text expression that results from
transforming the XQueryX document into XQuery Full Text syntax
using the XSLT stylesheet that appears in section <a href=
"#id-xqft-full-text-stylesheet"><b>E.2 XQueryX stylesheet for
XQuery and XPath Full Text 1.0</b></a>. The "correctness" of that
transformation is determined by asking the following the question:
Can some Full Text XQueryX processor QX process some Full Text
XQueryX document D1 to produce results R1, after which the
stylesheet is used to translate D1 into an XQuery Full Text
expression E1 that, when processed by some XQuery Full Text
processor Q, produces results R2 that are equivalent (under some
meaningful definition of "equivalent") to results R1?</p>
<div class="div2">
<h3><a name="id-xqft-full-text-schema" id=
"id-xqft-full-text-schema"></a>E.1 XQueryX representation of XQuery
and XPath Full Text 1.0</h3>
<p>The XML Schema that defines the complex types and elements for
XQueryX in support of XQuery and XPath Full Text 1.0, including the
ftContainsExpr, incorporates a second XML Schema that defines types
and elements to support the ftMatchOption. Both XML Schemas are
defined in this section.</p>
<div class="exampleInner">
<pre>

&lt;xsd:schema
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:xqx="http://www.w3.org/2005/XQueryX"
     xmlns:xqxft="http://www.w3.org/2007/xpath-full-text"
     targetNamespace="http://www.w3.org/2007/xpath-full-text"
     elementFormDefault="qualified"
     attributeFormDefault="unqualified"&gt;

&lt;!-- Initial creation                            2006-08-17: Jim Melton    --&gt;
&lt;!-- Added ftOptionDecl, ftScoreVariableBinding  2006-08-21: Jim Melton    --&gt;
&lt;!-- First version believed complete             2006-08-29: Jim Melton    --&gt;
&lt;!-- Cleaned up naming                           2007-04-27: Mary Holstege --&gt;
&lt;!-- Revised to align with updated syntax        2008-01-14: Jim Melton    --&gt;
&lt;!-- Moved ftOptionDecl: prolog part two to one  2008-01-24: Jim Melton    --&gt;
&lt;!-- Revised position of "weight" in grammar     2008-11-12: Jim Melton    --&gt;

  &lt;xsd:import namespace="http://www.w3.org/2005/XQueryX"
              schemaLocation="http://www.w3.org/2005/XQueryX/xqueryx.xsd"/&gt;

  &lt;xsd:include schemaLocation="./xpath-full-text-10-xqueryx-ftmatchoption-extensions.xsd"/&gt;

  &lt;xsd:element name="ftOptionDecl" substitutionGroup="xqx:prologPartOneItem"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence minOccurs="1" maxOccurs="unbounded"&gt;
        &lt;xsd:element ref="xqxft:ftMatchOption"/&gt;
      &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;


  &lt;!-- Create a new substitution group for full-text expressions           --&gt;
  &lt;xsd:complexType name="ftExpr"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqx:expr"/&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftExpr" type="xqxft:ftExpr" abstract="true" substitutionGroup="xqx:expr"/&gt;


  &lt;!-- Represents an untyped variable for the "score" clause               --&gt;
  &lt;xsd:element name="ftScoreVariableBinding" type="xqx:QName"
               substitutionGroup="xqx:forLetClauseItemExtensions"/&gt;



  &lt;!-- FTContains ("contains text")                                        --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTContainsExpr ::=                                                --&gt;
  &lt;!--     RangeExpr ( "contains" "text" FTSelection FTIgnoreOption? )?    --&gt;
  &lt;xsd:complexType name="ftContainsExpr"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftExpr"&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="ftRangeExpr"
                       type="xqx:exprWrapper" /&gt;
          &lt;xsd:sequence minOccurs="0" maxOccurs="1"&gt;
            &lt;xsd:element name="ftSelectionExpr"
                         type="xqxft:ftSelectionWrapper" /&gt;
            &lt;xsd:element name="ftIgnoreOption"
                         type="xqxft:ftIgnoreOption"
                         minOccurs="0" maxOccurs="1" /&gt;
          &lt;/xsd:sequence&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftContainsExpr" type="xqxft:ftContainsExpr" substitutionGroup="xqxft:ftExpr" /&gt;


  &lt;!-- FTProximity                                                         --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTPosFilter ::=                                                   --&gt;
  &lt;!--     FTOrder | FTWindow | FTDistance | FTScope | FTContent           --&gt;
  &lt;xsd:complexType name="ftProximity" /&gt;

  &lt;xsd:element name="ftProximity" type="xqxft:ftProximity" abstract="true"/&gt;


  &lt;!-- some simple type definitions                                        --&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTUnit ::= "words" | "sentences" | "paragraphs"                   --&gt;
  &lt;xsd:simpleType name="ftUnit"&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
      &lt;xsd:enumeration value="paragraph"/&gt;
      &lt;xsd:enumeration value="sentence"/&gt;
      &lt;xsd:enumeration value="word"/&gt;
    &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTBigUnit ::= "sentence" | "paragraph"                            --&gt;
  &lt;xsd:simpleType name="ftBigUnit"&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
      &lt;xsd:enumeration value="paragraph"/&gt;
      &lt;xsd:enumeration value="sentence"/&gt;
    &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTContent ::= ("at" "start") | ("at" "end") | ("entire" "content")--&gt;
  &lt;xsd:simpleType name="contentLocation"&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
      &lt;xsd:enumeration value="at start"/&gt;
      &lt;xsd:enumeration value="at end"/&gt;
      &lt;xsd:enumeration value="entire content"/&gt;
    &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTScope ::= ("same" | "different") FTBigUnit                      --&gt;
  &lt;xsd:simpleType name="ftScopeType"&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
      &lt;xsd:enumeration value="same"/&gt;
      &lt;xsd:enumeration value="different"/&gt;
    &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;


  &lt;!-- range-related definitions                                           --&gt;
  &lt;xsd:complexType name="unaryRange"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="value" type="xqx:exprWrapper" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:complexType name="binaryRange"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="lower" type="xqx:exprWrapper" /&gt;
      &lt;xsd:element name="upper" type="xqx:exprWrapper" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:complexType name="unaryLiteralRange"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="value" type="xsd:integer" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:complexType name="binaryLiteralRange"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="lower" type="xsd:integer" /&gt;
      &lt;xsd:element name="upper" type="xsd:integer" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTRange ::= ("exactly" AdditiveExpr)                              --&gt;
  &lt;!--             | ("at" "least" AdditiveExpr)                           --&gt;
  &lt;!--             | ("at" "most" AdditiveExpr)                            --&gt;
  &lt;!--             | ("from" AdditiveExpr "to" AdditiveExpr)               --&gt;
  &lt;xsd:complexType name="ftRange"&gt;
    &lt;xsd:choice&gt;
      &lt;xsd:element name="atLeastRange" type="xqxft:unaryRange" /&gt;
      &lt;xsd:element name="atMostRange" type="xqxft:unaryRange" /&gt;
      &lt;xsd:element name="exactlyRange" type="xqxft:unaryRange" /&gt;
      &lt;xsd:element name="fromToRange" type="xqxft:binaryRange" /&gt;
    &lt;/xsd:choice&gt;
  &lt;/xsd:complexType&gt;


  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTLiteralRange ::= ("exactly" IntegerLiteral)                     --&gt;
  &lt;!--                    | ("at" "least" IntegerLiteral)                  --&gt;
  &lt;!--                    | ("at" "most" IntegerLiteral)                   --&gt;
  &lt;!--                    | ("from" IntegerLiteral "to" IntegerLiteral)    --&gt;
  &lt;xsd:complexType name="ftLiteralRange"&gt;
    &lt;xsd:choice&gt;
      &lt;xsd:element name="atLeastLiteralRange" type="xqxft:unaryLiteralRange" /&gt;
      &lt;xsd:element name="atMostLiteralRange" type="xqxft:unaryLiteralRange" /&gt;
      &lt;xsd:element name="exactlyLiteralRange" type="xqxft:unaryLiteralRange" /&gt;
      &lt;xsd:element name="fromToLiteralRange" type="xqxft:binaryLiteralRange" /&gt;
    &lt;/xsd:choice&gt;
  &lt;/xsd:complexType&gt;


  &lt;!-- ftPosFilter alternative: ordered                                    --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTOrder ::= "ordered"                                             --&gt;
  &lt;xsd:complexType name="ftOrdered"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftProximity"&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftOrdered" type="xqxft:ftOrdered" substitutionGroup="xqxft:ftProximity"/&gt;


  &lt;!-- ftPosFilter alternative: window                                     --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTWindow ::= "window" AdditiveExpr FTUnit                         --&gt;
  &lt;xsd:complexType name="ftWindow"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftProximity"&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="value" type="xqx:exprWrapper" /&gt;
          &lt;xsd:element name="unit" type="xqxft:ftUnit" /&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftWindow" type="xqxft:ftWindow" substitutionGroup="xqxft:ftProximity"/&gt;


  &lt;!-- ftPosFilter alternative: distance                                   --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTDistance ::= "distance" FTRange FTUnit                          --&gt;
  &lt;xsd:complexType name="ftDistance"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftProximity"&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="ftRange" type="xqxft:ftRange" /&gt;
          &lt;xsd:element name="unit" type="xqxft:ftUnit" /&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftDistance" type="xqxft:ftDistance" substitutionGroup="xqxft:ftProximity"/&gt;

  &lt;!-- ftPosFilter alternative: scope                                      --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;xsd:complexType name="ftScope"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftProximity"&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="type" type="xqxft:ftScopeType" /&gt;
          &lt;xsd:element name="unit" type="xqxft:ftBigUnit" /&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftScope" type="xqxft:ftScope" substitutionGroup="xqxft:ftProximity"/&gt;

  &lt;!-- ftPosFilter alternative: FTContent                                  --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;xsd:complexType name="ftContent"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftProximity"&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="location" type="xqxft:contentLocation" /&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftContent" type="xqxft:ftContent" substitutionGroup="xqxft:ftProximity"/&gt;


  &lt;!-- ftPosFilter                                                         --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTPosFilter ::=                                                   --&gt;
  &lt;!--     FTOrder | FTWindow | FTDistance | FTScope | FTContent           --&gt;
  &lt;xsd:complexType name="ftPosFilter"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftExpr"&gt;
        &lt;xsd:sequence minOccurs="0" maxOccurs="unbounded"&gt;
          &lt;xsd:element ref="xqxft:ftProximity" /&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;


  &lt;!-- FTSelection                                                         --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTSelection ::= FTOr FTPosFilter*                                 --&gt;
  &lt;xsd:complexType name="ftSelection" &gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftExpr"&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="ftSelectionSource" type="xqx:exprWrapper"/&gt;
          &lt;xsd:element name="ftPosFilter"
                       type="xqxft:ftPosFilter"
                       minOccurs="0" maxOccurs="1" /&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftSelection" type="xqxft:ftSelection" substitutionGroup="xqxft:ftExpr" /&gt;


  &lt;xsd:complexType name="ftSelectionWrapper"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element ref="xqxft:ftSelection"/&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;


  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTIgnoreOption ::= "without" "content" UnionExpr                  --&gt;
  &lt;xsd:complexType name="ftIgnoreOption"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element ref="xqx:expr"/&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;


  &lt;!-- Full-Text logical operators                                         --&gt;
  &lt;xsd:element name="ftLogicalOp" type="xqx:binaryOperatorExpr" abstract="true"
               substitutionGroup="xqx:operatorExpr"/&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTOr ::= FTAnd ( "ftor" FTAnd )*                                  --&gt;
  &lt;xsd:element name="ftOr" type="xqx:binaryOperatorExpr"
               substitutionGroup="xqxft:ftLogicalOp"/&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTAnd ::= FTMildNot ( "ftand" FTMildNot )*                        --&gt;
  &lt;xsd:element name="ftAnd" type="xqx:binaryOperatorExpr"
               substitutionGroup="xqxft:ftLogicalOp"/&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--       FTMildNot ::= FTUnaryNot ( "not" "in" FTUnaryNot )*              --&gt;
  &lt;xsd:element name="ftMildNot" type="xqx:binaryOperatorExpr"
               substitutionGroup="xqxft:ftLogicalOp"/&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;xsd:element name="ftLogicalNot" type="xqx:unaryOperatorExpr" abstract="true"
               substitutionGroup="xqx:operatorExpr"/&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTUnaryNot ::= ("ftnot")? FTPrimaryWithOptions                    --&gt;
  &lt;xsd:element name="ftUnaryNot" type="xqx:unaryOperatorExpr"
               substitutionGroup="xqxft:ftLogicalNot"/&gt;


  &lt;!-- Definitions associated with FTWords                                 --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTTimes ::= "occurs" FTRange "times"                              --&gt;
  &lt;xsd:complexType name="ftTimes"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="ftRange" type="xqxft:ftRange"/&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--  FTAnyallOption ::= ("any" "word"?) | ("all" "words"?) | "phrase"   --&gt;
  &lt;xsd:simpleType name="ftAnyAllOption"&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
      &lt;xsd:enumeration value="any"/&gt;
      &lt;xsd:enumeration value="all"/&gt;
      &lt;xsd:enumeration value="any word"/&gt;
      &lt;xsd:enumeration value="all words"/&gt;
      &lt;xsd:enumeration value="phrase"/&gt;
    &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTWordsValue ::= StringLiteral | ("{" Expr "}")                         --&gt;
  &lt;xsd:complexType name="ftWordsAlternatives"&gt;
    &lt;xsd:choice&gt;
      &lt;xsd:element name="ftWordsLiteral" type="xqx:exprWrapper"/&gt;
      &lt;xsd:element name="ftWordsExpression" type="xqx:exprWrapper"/&gt;
    &lt;/xsd:choice&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTWords ::= FTWordsValue FTAnyallOption?                          --&gt;
  &lt;xsd:complexType name="ftWords"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="ftWordsValue" type="xqxft:ftWordsAlternatives" /&gt;
      &lt;xsd:element name="ftAnyAllOption" type="xqxft:ftAnyAllOption"
                   minOccurs="0" maxOccurs="1" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--  ... FTWordsValue FTAnyallOption?                                   --&gt;
  &lt;xsd:group name="ftWordsWithTimes"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="ftWords" type="xqxft:ftWords" /&gt;
      &lt;xsd:element name="ftTimes" type="xqxft:ftTimes" minOccurs="0" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:group&gt;


  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTExtensionSelection ::= Pragma+ "{" FTSelection? "}"             --&gt;
  &lt;xsd:complexType name="ftExtensionSelection"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="pragma" type="xqx:pragma"
                   minOccurs="1" maxOccurs="unbounded"/&gt;
      &lt;xsd:element name="ftSelection" type="xqxft:ftSelection"
                   minOccurs="0" maxOccurs="1"/&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTPrimary ::= (FTWords FTTimes?)                                  --&gt;
  &lt;!--               | ("(" FTSelection ")")                               --&gt;
  &lt;!--               | FTExtensionSelection                                --&gt;
  &lt;xsd:complexType name="ftPrimary"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftExpr" &gt;
        &lt;xsd:choice&gt;
          &lt;xsd:element name="parenthesized" type="xqx:exprWrapper"/&gt;
          &lt;xsd:group ref="xqxft:ftWordsWithTimes" /&gt;
          &lt;xsd:element name="ftExtensionSelection" type="xqxft:ftExtensionSelection"/&gt;
        &lt;/xsd:choice&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTPrimaryWithOptions ::= FTPrimary FTMatchOptions? FTWeight?      --&gt;
  &lt;xsd:complexType name="ftPrimaryWithOptions"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftExpr"&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="ftPrimary" type="xqxft:ftPrimary"/&gt;
          &lt;xsd:element ref="xqxft:ftMatchOptions"
                       minOccurs="0" maxOccurs="1"/&gt;
          &lt;xsd:element name="weight"
                       type="xqx:exprWrapper"
                       minOccurs="0" maxOccurs="1" /&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftPrimaryWithOptions" type="xqxft:ftPrimaryWithOptions"
               substitutionGroup="xqxft:ftExpr"/&gt;

&lt;/xsd:schema&gt;


</pre></div>
<div class="exampleInner">
<pre>

&lt;xsd:schema
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     xmlns:xqx="http://www.w3.org/2005/XQueryX"
     xmlns:xqxft="http://www.w3.org/2007/xpath-full-text"
     targetNamespace="http://www.w3.org/2007/xpath-full-text"
     elementFormDefault="qualified" 
     attributeFormDefault="unqualified"&gt;

&lt;!-- Initial creation                         2006-08-17: Jim Melton       --&gt;
&lt;!-- First version believed complete          2006-08-29: Jim Melton       --&gt;
&lt;!-- Cleaned up naming                        2007-04-27: Mary Holstege    --&gt;     
&lt;!-- Revised to align with updated syntax     2008-01-14: Jim Melton       --&gt;
&lt;!-- Comments added to clarify each element   2008-11-12: Jim Melton       --&gt;
&lt;!-- Add element decl for ftMatchOptions      2009-07-06: Michael Dyck     --&gt;
&lt;!-- Fixed FTThesaurus for ftLiteralRange     2011-03-08: Jim Melton       --&gt;

  &lt;xsd:import namespace="http://www.w3.org/2005/XQueryX"
              schemaLocation="http://www.w3.org/2005/XQueryX/xqueryx.xsd"/&gt;

  &lt;!-- FTMatchOption                                                       --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTMatchOption ::= FTLanguageOption                                --&gt;
  &lt;!--                   | FTWildCardOption                                --&gt;
  &lt;!--                   | FTThesaurusOption                               --&gt;
  &lt;!--                   | FTStemOption                                    --&gt;
  &lt;!--                   | FTCaseOption                                    --&gt;
  &lt;!--                   | FTDiacriticsOption                              --&gt;
  &lt;!--                   | FTStopWordOption                                --&gt;
  &lt;!--                   | FTExtensionOption                               --&gt;
  &lt;xsd:complexType name="ftMatchOption" /&gt;

  &lt;xsd:element name="ftMatchOption" type="xqxft:ftMatchOption"
               abstract="true" /&gt;
  

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTMatchOptions ::= ( "using" FTMatchOption )+                     --&gt;
  &lt;xsd:complexType name="ftMatchOptions"&gt;
    &lt;xsd:sequence minOccurs="1" maxOccurs="unbounded"&gt;
      &lt;xsd:element ref="xqxft:ftMatchOption"/&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftMatchOptions" type="xqxft:ftMatchOptions"/&gt;
  

  &lt;!-- ftMatchOption alternative: case                                     --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTCaseOption ::= ("case" "insensitive")                           --&gt;
  &lt;!--                  | ("case" "sensitive")                             --&gt;
  &lt;!--                  | "lowercase"                                      --&gt;
  &lt;!--                  | "uppercase"                                      --&gt;
  &lt;xsd:complexType name="ftCaseOption"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftMatchOption" &gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="value"&gt;
            &lt;xsd:simpleType&gt;
              &lt;xsd:restriction base="xsd:string"&gt;
                &lt;xsd:enumeration value="lowercase"/&gt;
                &lt;xsd:enumeration value="uppercase"/&gt;
                &lt;xsd:enumeration value="case sensitive"/&gt;
                &lt;xsd:enumeration value="case insensitive"/&gt;
              &lt;/xsd:restriction&gt;
            &lt;/xsd:simpleType&gt;
          &lt;/xsd:element&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="case" type="xqxft:ftCaseOption"
               substitutionGroup="xqxft:ftMatchOption" /&gt;


  &lt;!-- ftMatchOption alternative: diacritics                               --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTDiacriticsOption ::= ("diacritics" "insensitive")               --&gt;
  &lt;!--                        | ("diacritics" "sensitive")                 --&gt;
  &lt;xsd:complexType name="ftDiacriticsOption"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftMatchOption" &gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="value"&gt;
            &lt;xsd:simpleType&gt;
              &lt;xsd:restriction base="xsd:string"&gt;
                &lt;xsd:enumeration value="diacritics sensitive"/&gt;
                &lt;xsd:enumeration value="diacritics insensitive"/&gt;
              &lt;/xsd:restriction&gt;
            &lt;/xsd:simpleType&gt;
          &lt;/xsd:element&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;
  
  &lt;xsd:element name="diacritics" type="xqxft:ftDiacriticsOption"
               substitutionGroup="xqxft:ftMatchOption" /&gt;


  &lt;!-- ftMatchOption alternative: stemming                                 --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTStemOption ::= ("stemming") | ("no" "stemming")                 --&gt;
  &lt;xsd:complexType name="ftStemOption"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftMatchOption" &gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="value"&gt;
            &lt;xsd:simpleType&gt;
              &lt;xsd:restriction base="xsd:string"&gt;
                &lt;xsd:enumeration value="stemming" /&gt; 
                &lt;xsd:enumeration value="no stemming" /&gt; 
              &lt;/xsd:restriction&gt;
            &lt;/xsd:simpleType&gt;
          &lt;/xsd:element&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;
  
  &lt;xsd:element name="stem" type="xqxft:ftStemOption"
               substitutionGroup="xqxft:ftMatchOption" /&gt;


  &lt;!-- ftMatchOption alternative: thesaurus                                --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTThesaurusID ::= "at" URILiteral ("relationship" StringLiteral)? --&gt;
  &lt;!--                     (FTLiteralRange "levels")?                      --&gt;
  &lt;xsd:complexType name="ftThesaurusID"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="at" type="xsd:anyURI" /&gt;
      &lt;xsd:element name="relationship" type="xsd:string" minOccurs="0" /&gt;
      &lt;xsd:element name="levels" type="xqxft:ftLiteralRange" minOccurs="0" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   ... (FTThesaurusID | "default")                                   --&gt;
  &lt;!--   ... "(" (FTThesaurusID | "default") ("," FTThesaurusID)* ")")     --&gt;
  &lt;xsd:complexType name="thesaurusSpecSequence"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:choice&gt;
        &lt;xsd:element name="default" /&gt;
        &lt;xsd:element name="thesaurusID"
                     type="xqxft:ftThesaurusID" /&gt;
      &lt;/xsd:choice&gt;
      &lt;xsd:element name="thesaurusID" type="xqxft:ftThesaurusID"
                   minOccurs="0" maxOccurs="unbounded" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTThesaurusOption ::=                                             --&gt;
  &lt;!--       ("thesaurus" (FTThesaurusID | "default"))                     --&gt;
  &lt;!--     | ("thesaurus"                                                  --&gt;
  &lt;!--          "(" (FTThesaurusID | "default") ("," FTThesaurusID)* ")")  --&gt;
  &lt;!--     | ("no" "thesaurus")                                            --&gt;
  &lt;xsd:complexType name="ftThesaurusOption"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftMatchOption" &gt;
        &lt;xsd:choice&gt;
          &lt;xsd:element name="noThesauri" /&gt;
          &lt;xsd:element name="thesauri" type="xqxft:thesaurusSpecSequence" /&gt;
        &lt;/xsd:choice&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="thesaurus" type="xqxft:ftThesaurusOption"
               substitutionGroup="xqxft:ftMatchOption" /&gt;


  &lt;!-- ftMatchOption alternative: stopwords                                --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--     FTStopWords ::= ("at" URILiteral)                               --&gt;
  &lt;!--   | ("(" StringLiteral ("," StringLiteral)* ")")                    --&gt;
  &lt;xsd:complexType name="ftStopWords"&gt;
    &lt;xsd:choice&gt;
      &lt;xsd:element name="ref" type="xsd:anyURI" /&gt;
      &lt;xsd:element name="list"&gt;
        &lt;xsd:complexType&gt;
          &lt;xsd:sequence&gt;
            &lt;xsd:element ref="xqx:stringConstantExpr"
                         minOccurs="1" maxOccurs="unbounded" /&gt;
          &lt;/xsd:sequence&gt;
        &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
    &lt;/xsd:choice&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftStopWords" type="xqxft:ftStopWords" /&gt;


  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   ... "stop" "words" FTStopWords ...                                --&gt;
  &lt;!--   ... "stop" "words" "default" ...                                  --&gt;
  &lt;xsd:group name="baseStopWords"&gt;
    &lt;xsd:choice&gt;
      &lt;xsd:element name="default" /&gt;
      &lt;xsd:element ref="xqxft:ftStopWords" /&gt;
    &lt;/xsd:choice&gt;
  &lt;/xsd:group&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTStopWordsInclExcl ::= ("union" | "except") FTStopWords          --&gt;
  &lt;xsd:complexType name="ftStopWordsInclExcl"&gt;
    &lt;xsd:choice&gt;
      &lt;xsd:element name="union" type="xqxft:ftStopWords" /&gt;
      &lt;xsd:element name="except" type="xqxft:ftStopWords" /&gt;
    &lt;/xsd:choice&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   ... ("using" "stop" "words" FTStopWords FTStopWordsInclExcl*) ... --&gt;
  &lt;!--   ... ("using" "default" "stop" "words" FTStopWordsInclExcl*) ...   --&gt;
  &lt;xsd:complexType name="stopWordsSpecSequence"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:group ref="xqxft:baseStopWords" /&gt;
      &lt;xsd:element name="ftStopWordsInclExcl"
                   type="xqxft:ftStopWordsInclExcl"
                   minOccurs="0" maxOccurs="unbounded" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;

  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTStopWordOption ::=                                              --&gt;
  &lt;!--       ("stop" "words" FTStopWords FTStopWordsInclExcl*)             --&gt;
  &lt;!--     | ("stop" "words" "default" FTStopWordsInclExcl*)               --&gt;
  &lt;!--     | ("no" "stop" "words")                                         --&gt;
  &lt;xsd:complexType name="ftStopWordOption"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftMatchOption" &gt;
        &lt;xsd:choice&gt;
          &lt;xsd:element name="noStopwords" /&gt;
          &lt;xsd:element name="stopwords" type="xqxft:stopWordsSpecSequence" /&gt;
        &lt;/xsd:choice&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="stopword" type="xqxft:ftStopWordOption"
               substitutionGroup="xqxft:ftMatchOption" /&gt;


  &lt;!-- ftMatchOption alternative: language                                 --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTLanguageOption ::= "language" StringLiteral                     --&gt;
  &lt;xsd:complexType name="ftLanguageOption"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftMatchOption" &gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="value" type="xsd:string" /&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="language" type="xqxft:ftLanguageOption"
               substitutionGroup="xqxft:ftMatchOption" /&gt;


  &lt;!-- ftMatchOption alternative: wildcards                                --&gt;
  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTWildCardOption ::= ("wildcards")                                --&gt;
  &lt;!--                      | ("no" "wildcards")                           --&gt;
  &lt;xsd:complexType name="ftWildCardOption"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftMatchOption"&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="value"&gt;
            &lt;xsd:simpleType&gt;
              &lt;xsd:restriction base="xsd:string"&gt;
                &lt;xsd:enumeration value="wildcards" /&gt; 
                &lt;xsd:enumeration value="no wildcards" /&gt;
              &lt;/xsd:restriction&gt;
            &lt;/xsd:simpleType&gt;
          &lt;/xsd:element&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="wildcard" type="xqxft:ftWildCardOption"
               substitutionGroup="xqxft:ftMatchOption" /&gt;


  &lt;!-- Represents the following grammar productions:                       --&gt;
  &lt;!--   FTExtensionOption ::= "option" QName StringLiteral                --&gt;
  &lt;xsd:complexType name="ftExtensionOption"&gt;
    &lt;xsd:complexContent&gt;
      &lt;xsd:extension base="xqxft:ftMatchOption"&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="ftExtensionName" type="xqx:QName"/&gt;
          &lt;xsd:element name="ftExtensionValue" type="xsd:string"/&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:extension&gt;
    &lt;/xsd:complexContent&gt;
  &lt;/xsd:complexType&gt;

  &lt;xsd:element name="ftExtensionOption" type="xqxft:ftExtensionOption"
               substitutionGroup="xqxft:ftMatchOption" /&gt;

&lt;/xsd:schema&gt;


</pre></div>
</div>
<div class="div2">
<h3><a name="id-xqft-full-text-stylesheet" id=
"id-xqft-full-text-stylesheet"></a>E.2 XQueryX stylesheet for
XQuery and XPath Full Text 1.0</h3>
<p>The XSLT stylesheet that defines the semantics of XQueryX in
support of XQuery and XPath Full Text 1.0 integrates seamlessly
with the XQueryX XSLT stylesheet defined in <a href=
"http://www.w3.org/TR/xqueryx/#Stylesheet">Section B Transforming
XQueryX to XQuery</a><sup><small>XQX</small></sup> by importing the
XQueryX XSLT stylesheet. It provides additional templates that
define the semantics of the XQueryX representation of XQuery and
XPath Full Text 1.0 by transforming that XQueryX representation
into the human readable syntax of XQuery and XPath Full Text
1.0.</p>
<div class="exampleInner">
<pre>

&lt;?xml version='1.0'?&gt;
&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xqxft="http://www.w3.org/2007/xpath-full-text"
                xmlns:xqx="http://www.w3.org/2005/XQueryX"&gt;

&lt;!-- Initial creation                            2006-08-17: Jim Melton   --&gt;
&lt;!-- Added ftOptionDecl, ftScoreVariableBinding  2006-08-21: Jim Melton   --&gt;
&lt;!-- First version believed complete             2006-08-29: Jim Melton   --&gt;
&lt;!-- Revised to align with 2008-01-24 draft      2008-02-08: Jim Melton   --&gt;
&lt;!-- Revised position of "weight" in grammar     2008-11-12: Jim Melton   --&gt;
&lt;!-- Various bug fixes                           2009-07-14: Michael Dyck --&gt;
&lt;!-- ftcontains =&gt; "contains text", Bug 7247     2009-09-17: Jim Melton   --&gt;
&lt;!-- with =&gt; using, stop words default, Bug 7271 2009-09-17: Jim Melton   --&gt;
&lt;!-- {} around weight values, around empty
     selection after pragmas                     2010-09-07: Jim Melton   --&gt;

&lt;xsl:import href="http://www.w3.org/2005/XQueryX/xqueryx.xsl"/&gt;


&lt;!-- ftOptionDecl --&gt;
&lt;xsl:template match="xqxft:ftOptionDecl"&gt;
  &lt;xsl:text&gt;declare ft-option &lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;!-- ftScoreVariableBinding --&gt;
&lt;xsl:template match="xqxft:ftScoreVariableBinding"&gt;
  &lt;xsl:text&gt; score &lt;/xsl:text&gt;
  &lt;xsl:value-of select="$DOLLAR"/&gt;
  &lt;xsl:if test="@xqx:prefix"&gt;
    &lt;xsl:value-of select="@xqx:prefix"/&gt;
    &lt;xsl:value-of select="$COLON"/&gt;
  &lt;/xsl:if&gt;
  &lt;xsl:value-of select="."/&gt;
&lt;/xsl:template&gt;


&lt;!-- ftcontains --&gt;
&lt;xsl:template match="xqxft:ftContainsExpr"&gt;
  &lt;xsl:apply-templates select="xqxft:ftRangeExpr"/&gt;
  &lt;xsl:text&gt; contains text &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:ftSelectionExpr"/&gt;
  &lt;xsl:apply-templates select="xqxft:ftIgnoreOption"/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:value"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftRangeExpr"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftLiteralRangeExpr"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftSelectionExpr"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftIgnoreOption"&gt;
  &lt;xsl:text&gt;without content &lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftSelection"&gt;
  &lt;xsl:apply-templates select="xqxft:ftSelectionSource"/&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
  &lt;xsl:text&gt;    &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:ftPosFilter"/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftSelectionSource"&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftPosFilter"&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
  &lt;xsl:text&gt;      &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;!-- FTProximity alternative: ordered --&gt;
&lt;xsl:template match="xqxft:ftOrdered"&gt;
  &lt;xsl:text&gt;ordered &lt;/xsl:text&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;

&lt;!-- FTProximity alternative: window --&gt;
&lt;xsl:template match="xqxft:ftWindow"&gt;
  &lt;xsl:text&gt;window &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:value"/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
  &lt;xsl:value-of select="xqxft:unit"/&gt;
  &lt;xsl:text&gt;s&lt;/xsl:text&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;

&lt;!-- FTProximity alternative: distance --&gt;
&lt;xsl:template match="xqxft:ftDistance"&gt;
  &lt;xsl:text&gt;distance &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:ftRange"/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
  &lt;xsl:value-of select="xqxft:unit"/&gt;
  &lt;xsl:text&gt;s&lt;/xsl:text&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;

&lt;!-- FTProximity alternative: scope --&gt;
&lt;xsl:template match="xqxft:ftScope"&gt;
  &lt;xsl:value-of select="xqxft:type"/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
  &lt;xsl:value-of select="xqxft:unit"/&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;

&lt;!-- FTProximity alternative: content --&gt;
&lt;xsl:template match="xqxft:ftContent"&gt;
  &lt;xsl:value-of select="xqxft:location"/&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:exactlyRange | xqxft:exactlyLiteralRange"&gt;
  &lt;xsl:text&gt;exactly &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:value"/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:atLeastRange | xqxft:atLeastLiteralRange"&gt;
  &lt;xsl:text&gt;at least &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:value"/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:atMostRange | xqxft:atMostLiteralRange"&gt;
  &lt;xsl:text&gt;at most &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:value"/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:fromToRange | xqxft:fromToLiteralRange"&gt;
  &lt;xsl:text&gt;from &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:lower"/&gt;
  &lt;xsl:text&gt; to &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:upper"/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:lower"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:upper"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;!-- ftMatchOption alternative: case --&gt;
&lt;xsl:template match="xqxft:case"&gt;
  &lt;xsl:text&gt; using &lt;/xsl:text&gt;
  &lt;xsl:value-of select="xqxft:value"/&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;


&lt;!-- ftMatchOption alternative: diacritics --&gt;
&lt;xsl:template match="xqxft:diacritics"&gt;
  &lt;xsl:text&gt; using &lt;/xsl:text&gt;
  &lt;xsl:value-of select="xqxft:value"/&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;


&lt;!-- ftMatchOption alternative: stemming --&gt;
&lt;xsl:template match="xqxft:stem"&gt;
  &lt;xsl:text&gt; using &lt;/xsl:text&gt;
  &lt;xsl:value-of select="xqxft:value"/&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;


&lt;!-- ftMatchOption alternative: thesaurus --&gt;
&lt;xsl:template match="xqxft:thesaurus"&gt;
  &lt;xsl:text&gt; using &lt;/xsl:text&gt;
  &lt;xsl:choose&gt;
    &lt;xsl:when test="xqxft:noThesauri"&gt;
      &lt;xsl:text&gt;no thesaurus &lt;/xsl:text&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;
      &lt;xsl:apply-templates/&gt;
    &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:thesauri"&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
  &lt;xsl:text&gt;thesaurus &lt;/xsl:text&gt;
  &lt;xsl:choose&gt;
    &lt;xsl:when test="child::*[2]"&gt;
      &lt;xsl:call-template name="parenthesizedList"/&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;
      &lt;xsl:apply-templates/&gt;
    &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:default"&gt;
  &lt;xsl:text&gt;default &lt;/xsl:text&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:thesaurusID"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:at"&gt;
  &lt;xsl:text&gt;at "&lt;/xsl:text&gt;
  &lt;xsl:value-of select="."/&gt;
  &lt;xsl:text&gt;" &lt;/xsl:text&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:relationship"&gt;
  &lt;xsl:text&gt;relationship "&lt;/xsl:text&gt;
  &lt;xsl:value-of select="."/&gt;
  &lt;xsl:text&gt;" &lt;/xsl:text&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:levels"&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:text&gt; levels &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;!-- ftMatchOption alternative: stopword --&gt;
&lt;xsl:template match="xqxft:stopword"&gt;
  &lt;xsl:text&gt;using &lt;/xsl:text&gt;
  &lt;xsl:choose&gt;
    &lt;xsl:when test="xqxft:noStopwords"&gt;
      &lt;xsl:text&gt;no stop words &lt;/xsl:text&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;
      &lt;xsl:apply-templates/&gt;
    &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt; 
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:stopwords"&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
  &lt;xsl:choose&gt;
    &lt;xsl:when test="xqxft:default"&gt;
      &lt;xsl:text&gt;stop words default &lt;/xsl:text&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;
      &lt;xsl:text&gt;stop words &lt;/xsl:text&gt;
      &lt;xsl:apply-templates select="xqxft:ftStopWords"/&gt;
    &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  &lt;xsl:apply-templates select="xqxft:ftStopWordsInclExcl"/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:ftStopWords"&gt;
  &lt;xsl:call-template name="ftStopWords_type"/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template name="ftStopWords_type"&gt;
  &lt;xsl:choose&gt;
    &lt;xsl:when test="xqxft:ref"&gt;
      &lt;xsl:text&gt;at "&lt;/xsl:text&gt;
      &lt;xsl:value-of select="xqxft:ref"/&gt;
      &lt;xsl:text&gt;" &lt;/xsl:text&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;
      &lt;xsl:apply-templates/&gt;
    &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:list"&gt;
  &lt;xsl:call-template name="parenthesizedList"/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:FTStopWordsInclExcl"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:union"&gt;
  &lt;xsl:text&gt;union &lt;/xsl:text&gt;
  &lt;xsl:call-template name="ftStopWords_type"/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="xqxft:except"&gt;
  &lt;xsl:text&gt;except &lt;/xsl:text&gt;
  &lt;xsl:call-template name="ftStopWords_type"/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:language"&gt;
  &lt;xsl:text&gt;using language "&lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:text&gt;"&lt;/xsl:text&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:wildcard"&gt;
  &lt;xsl:text&gt;using &lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:value-of select="$NEWLINE"/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftAnd"&gt;
  &lt;xsl:apply-templates select="xqx:firstOperand"/&gt;
  &lt;xsl:text&gt; ftand &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqx:secondOperand"/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftOr"&gt;
  &lt;xsl:apply-templates select="xqx:firstOperand"/&gt;
  &lt;xsl:text&gt; ftor &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqx:secondOperand"/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftMildNot"&gt;
  &lt;xsl:apply-templates select="xqx:firstOperand"/&gt;
  &lt;xsl:text&gt; not in &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqx:secondOperand"/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftUnaryNot"&gt;
  &lt;xsl:text&gt;ftnot &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqx:operand"/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftPrimaryWithOptions"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftPrimary"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:parenthesized"&gt;
  &lt;xsl:text&gt;( &lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:text&gt; ) &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftWords"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftWordsValue"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftWordsLiteral"&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftWordsExpression"&gt;
  &lt;xsl:text&gt; { &lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:text&gt; } &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftAnyAllOption"&gt;
  &lt;xsl:value-of select="."/&gt;
  &lt;xsl:text&gt; &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftTimes"&gt;
  &lt;xsl:text&gt;occurs &lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:text&gt; times &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftExtensionSelection"&gt;
  &lt;xsl:apply-templates select="xqxft:pragma"/&gt;
  &lt;xsl:text&gt; { &lt;/xsl:text&gt;
  &lt;xsl:apply-templates select="xqxft:ftSelection"/&gt;
  &lt;xsl:text&gt; } &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:pragma"&gt;
  &lt;xsl:value-of select="$PRAGMA_BEGIN"/&gt;
  &lt;xsl:apply-templates select="xqx:pragmaName"/&gt;
  &lt;xsl:value-of select="$SPACE"/&gt;
  &lt;xsl:value-of select="xqx:pragmaContents"/&gt;
  &lt;xsl:value-of select="$PRAGMA_END"/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftExtensionOption"&gt;
  &lt;xsl:text&gt;using option &lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftExtensionName"&gt;
  &lt;xsl:if test="@xqx:prefix"&gt;
    &lt;xsl:value-of select="@xqx:prefix"/&gt;
    &lt;xsl:value-of select="$COLON"/&gt;
  &lt;/xsl:if&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:ftExtensionValue"&gt;
  &lt;xsl:text&gt; "&lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:text&gt;"&lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;xsl:template match="xqxft:weight"&gt;
  &lt;xsl:text&gt; weight { &lt;/xsl:text&gt;
  &lt;xsl:apply-templates/&gt;
  &lt;xsl:text&gt; } &lt;/xsl:text&gt;
&lt;/xsl:template&gt;


&lt;/xsl:stylesheet&gt;


</pre></div>
</div>
<div class="div2">
<h3><a name="id-xqft-full-text-examples" id=
"id-xqft-full-text-examples"></a>E.3 XQueryX for XQuery and XPath
Full Text 1.0 example</h3>
<p>The following example is based on the data and queries of one of
the use cases in <a href="#xpath-full-text-10-use-cases">[XQuery
and XPath Full Text 1.0 Use Cases]</a>. In this example, we show
the English description of the query, the XQuery Full Text solution
given in <a href="#xpath-full-text-10-use-cases">[XQuery and XPath
Full Text 1.0 Use Cases]</a>, a Full Text XQueryX solution, and the
XQuery Full Text query that results from applying the Full Text
XQueryX-to-XQuery Full Text transformation defined by the
stylesheet in <a href="#id-xqft-full-text-stylesheet"><b>E.2
XQueryX stylesheet for XQuery and XPath Full Text 1.0</b></a> to
the Full Text XQueryX solution. The latter XQuery Full Text
expression is presented only as a sanity-check — the intent of the
stylesheet is not to create the identical XQuery Full Text
expression given in <a href="#xpath-full-text-10-use-cases">[XQuery
and XPath Full Text 1.0 Use Cases]</a>, but to produce <em>a</em>
valid XQuery Full Text expression with the same semantics.</p>
<p>Comparison of the results of the Full Text XQueryX-to-XQuery
Full Text transformation given in this document with the XQuery
Full Text solutions in the <a href=
"#xpath-full-text-10-use-cases">[XQuery and XPath Full Text 1.0 Use
Cases]</a> may be helpful in evaluating the correctness of the Full
Text XQueryX solution in the example.</p>
<p>The XQuery Full Text Use Cases solution given for the example is
provided only to assist readers of this document in understanding
the Full Text XQueryX solution. There is no intent to imply that
this document specifies a "compilation" or "transformation" of
XQuery Full Text syntax into Full Text XQueryX syntax.</p>
<p>In the following example, note that path expressions are
expanded to show their structure. Also, note that the prefix syntax
for binary operators like "and" makes the precedence explicit. In
general, humans find it easier to read an XML representation that
does not expand path expressions, but it is less convenient for
programmatic representation and manipulation. XQueryX is designed
as a language that is convenient for production and modification by
software, and not as a convenient syntax for humans to read and
write.</p>
<p>Finally, please note that white space, including new lines, have
been added to some of the Full Text XQueryX documents and XQuery
Full Text expressions for readability. That additional white space
is not necessarily produced by the Full Text XQueryX-to-XQuery Full
Text transformation.</p>
<div class="div3">
<h4><a name="Example1" id="Example1"></a>E.3.1 Example</h4>
<p>Here is Q4 from the <a href=
"#xpath-full-text-10-use-cases">[XQuery and XPath Full Text 1.0 Use
Cases]</a>, use case SCORE: Find all books with parts about
"usability testing".</p>
<div class="div4">
<h5><a name="Example1-XQuery-Full-Text" id=
"Example1-XQuery-Full-Text"></a>E.3.1.1 XQuery solution in XQuery
and XPath Full Text 1.0 Use Cases:</h5>
<div class="xquery">
<div class="exampleInner">
<pre>
declare function local:filter ( $nodes 
   as node()*, $exclude as element()* ) as node()*
   {
      for $node in $nodes except $exclude
      return
         typeswitch ($node)
            case $e as element()
               return 
                 element {node-name($e)}
                   {
                       $e/@*,
                      filter( $e/node() except $exclude, 
                      $exclude )
                   }
            default 
               return $node
   };

for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $irrelevantParts := 
   for $part in $book//part
   let score $score := $part contains text "usability test.*" 
      using wildcards
   where $score &lt; 0.5
   return $part
where count($irrelevantParts) &lt; count($book//part)
return filter($book, $irrelevantParts)
</pre></div>
</div>
</div>
<div class="div4">
<h5><a name="Example1-Full-Text-XQueryX" id=
"Example1-Full-Text-XQueryX"></a>E.3.1.2 A Solution in Full Text
XQueryX:</h5>
<div class="exampleInner">
<pre>
&lt;?xml version="1.0"?&gt;
&lt;xqx:module xmlns:xqxft="http://www.w3.org/2007/xpath-full-text"
            xmlns:xqx="http://www.w3.org/2005/XQueryX"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.w3.org/2007/xpath-full-text
                                http://www.w3.org/2007/xpath-full-text/xpath-full-text-10-xqueryx.xsd
                                http://www.w3.org/2005/XQueryX
                                http://www.w3.org/2005/XQueryX/xqueryx.xsd"&gt;

  &lt;xqx:mainModule&gt;
    &lt;xqx:prolog&gt;
      &lt;xqx:functionDecl&gt;
        &lt;xqx:functionName xqx:prefix="local"&gt;filter&lt;/xqx:functionName&gt;
        &lt;xqx:paramList&gt;
          &lt;xqx:param&gt;
            &lt;xqx:varName&gt;nodes&lt;/xqx:varName&gt;
            &lt;xqx:typeDeclaration&gt;
              &lt;xqx:anyKindTest/&gt;&lt;xqx:occurrenceIndicator&gt;*&lt;/xqx:occurrenceIndicator&gt;
            &lt;/xqx:typeDeclaration&gt;
          &lt;/xqx:param&gt;
          &lt;xqx:param&gt;
            &lt;xqx:varName&gt;exclude&lt;/xqx:varName&gt;
            &lt;xqx:typeDeclaration&gt;
              &lt;xqx:elementTest/&gt;&lt;xqx:occurrenceIndicator&gt;*&lt;/xqx:occurrenceIndicator&gt;
            &lt;/xqx:typeDeclaration&gt;
          &lt;/xqx:param&gt;
        &lt;/xqx:paramList&gt;
        &lt;xqx:typeDeclaration&gt;
          &lt;xqx:anyKindTest/&gt;
        &lt;/xqx:typeDeclaration&gt;
        &lt;xqx:functionBody&gt;
          &lt;xqx:flworExpr&gt;
            &lt;xqx:forClause&gt;
              &lt;xqx:forClauseItem&gt;
                &lt;xqx:typedVariableBinding&gt;
                  &lt;xqx:varName&gt;node&lt;/xqx:varName&gt;
                &lt;/xqx:typedVariableBinding&gt;
                &lt;xqx:forExpr&gt;
                  &lt;xqx:exceptOp&gt;
                    &lt;xqx:firstOperand&gt;
                      &lt;xqx:varRef&gt;
                        &lt;xqx:name&gt;nodes&lt;/xqx:name&gt;
                      &lt;/xqx:varRef&gt;
                    &lt;/xqx:firstOperand&gt;
                    &lt;xqx:secondOperand&gt;
                      &lt;xqx:varRef&gt;
                        &lt;xqx:name&gt;exclude&lt;/xqx:name&gt;
                      &lt;/xqx:varRef&gt;
                    &lt;/xqx:secondOperand&gt;
                  &lt;/xqx:exceptOp&gt;
                &lt;/xqx:forExpr&gt;
              &lt;/xqx:forClauseItem&gt;
            &lt;/xqx:forClause&gt;
            &lt;xqx:returnClause&gt;
              &lt;xqx:typeswitchExpr&gt;
                &lt;xqx:argExpr&gt;
                  &lt;xqx:varRef&gt;
                    &lt;xqx:name&gt;node&lt;/xqx:name&gt;
                  &lt;/xqx:varRef&gt;
                &lt;/xqx:argExpr&gt;
                &lt;xqx:typeswitchExprCaseClause&gt;
                  &lt;xqx:variableBinding&gt;e&lt;/xqx:variableBinding&gt;
                  &lt;xqx:sequenceType&gt;
                    &lt;xqx:elementTest/&gt;
                  &lt;/xqx:sequenceType&gt;
                  &lt;xqx:resultExpr&gt;
                    &lt;xqx:computedElementConstructor&gt;
                      &lt;xqx:tagNameExpr&gt;
                        &lt;xqx:functionCallExpr&gt;
                          &lt;xqx:functionName xqx:prefix="fn"&gt;node-name&lt;/xqx:functionName&gt;
                          &lt;xqx:arguments&gt;
                            &lt;xqx:varRef&gt;
                              &lt;xqx:name&gt;e&lt;/xqx:name&gt;
                            &lt;/xqx:varRef&gt;
                          &lt;/xqx:arguments&gt;
                        &lt;/xqx:functionCallExpr&gt;
                      &lt;/xqx:tagNameExpr&gt;
                      &lt;xqx:contentExpr&gt;
                        &lt;xqx:sequenceExpr&gt;
                          &lt;xqx:pathExpr&gt;
                            &lt;xqx:stepExpr&gt;
                              &lt;xqx:filterExpr&gt;
                                &lt;xqx:varRef&gt;
                                  &lt;xqx:name&gt;e&lt;/xqx:name&gt;
                                &lt;/xqx:varRef&gt;
                              &lt;/xqx:filterExpr&gt;
                            &lt;/xqx:stepExpr&gt;
                            &lt;xqx:stepExpr&gt;
                              &lt;xqx:xpathAxis&gt;child&lt;/xqx:xpathAxis&gt;
                              &lt;xqx:attributeTest&gt;
                                &lt;xqx:attributeName&gt;
                                  &lt;xqx:star/&gt;
                                &lt;/xqx:attributeName&gt;
                              &lt;/xqx:attributeTest&gt;
                            &lt;/xqx:stepExpr&gt;
                          &lt;/xqx:pathExpr&gt;
                          &lt;xqx:functionCallExpr&gt;
                            &lt;xqx:functionName xqx:prefix="fn"&gt;filter&lt;/xqx:functionName&gt;
                            &lt;xqx:arguments&gt;
                              &lt;xqx:exceptOp&gt;
                                &lt;xqx:firstOperand&gt;
                                  &lt;xqx:pathExpr&gt;
                                    &lt;xqx:stepExpr&gt;
                                      &lt;xqx:filterExpr&gt;
                                        &lt;xqx:varRef&gt;
                                          &lt;xqx:name&gt;e&lt;/xqx:name&gt;
                                        &lt;/xqx:varRef&gt;
                                      &lt;/xqx:filterExpr&gt;
                                    &lt;/xqx:stepExpr&gt;
                                    &lt;xqx:stepExpr&gt;
                                      &lt;xqx:xpathAxis&gt;child&lt;/xqx:xpathAxis&gt;
                                      &lt;xqx:anyKindTest/&gt;
                                    &lt;/xqx:stepExpr&gt;
                                  &lt;/xqx:pathExpr&gt;
                                &lt;/xqx:firstOperand&gt;
                                &lt;xqx:secondOperand&gt;
                                  &lt;xqx:varRef&gt;
                                    &lt;xqx:name&gt;exclude&lt;/xqx:name&gt;
                                  &lt;/xqx:varRef&gt;
                                &lt;/xqx:secondOperand&gt;
                              &lt;/xqx:exceptOp&gt;
                              &lt;xqx:varRef&gt;
                                &lt;xqx:name&gt;exclude&lt;/xqx:name&gt;
                              &lt;/xqx:varRef&gt;
                            &lt;/xqx:arguments&gt;
                          &lt;/xqx:functionCallExpr&gt;
                        &lt;/xqx:sequenceExpr&gt;
                      &lt;/xqx:contentExpr&gt;
                    &lt;/xqx:computedElementConstructor&gt;
                  &lt;/xqx:resultExpr&gt;
                &lt;/xqx:typeswitchExprCaseClause&gt;
                &lt;xqx:typeswitchExprDefaultClause&gt;
                  &lt;xqx:resultExpr&gt;
                    &lt;xqx:varRef&gt;
                      &lt;xqx:name&gt;node&lt;/xqx:name&gt;
                    &lt;/xqx:varRef&gt;
                  &lt;/xqx:resultExpr&gt;
                &lt;/xqx:typeswitchExprDefaultClause&gt;
              &lt;/xqx:typeswitchExpr&gt;
            &lt;/xqx:returnClause&gt;
          &lt;/xqx:flworExpr&gt;
        &lt;/xqx:functionBody&gt;
      &lt;/xqx:functionDecl&gt;
    &lt;/xqx:prolog&gt;
    &lt;xqx:queryBody&gt;
      &lt;xqx:flworExpr&gt;
        &lt;xqx:forClause&gt;
          &lt;xqx:forClauseItem&gt;
            &lt;xqx:typedVariableBinding&gt;
              &lt;xqx:varName&gt;book&lt;/xqx:varName&gt;
            &lt;/xqx:typedVariableBinding&gt;
            &lt;xqx:forExpr&gt;
              &lt;xqx:pathExpr&gt;
                &lt;xqx:stepExpr&gt;
                  &lt;xqx:filterExpr&gt;
                    &lt;xqx:functionCallExpr&gt;
                      &lt;xqx:functionName xqx:prefix="fn"&gt;doc&lt;/xqx:functionName&gt;
                      &lt;xqx:arguments&gt;
                        &lt;xqx:stringConstantExpr&gt;
                          &lt;xqx:value&gt;http://bstore1.example.com/full-text.xml&lt;/xqx:value&gt;
                        &lt;/xqx:stringConstantExpr&gt;
                      &lt;/xqx:arguments&gt;
                    &lt;/xqx:functionCallExpr&gt;
                  &lt;/xqx:filterExpr&gt;
                &lt;/xqx:stepExpr&gt;
                &lt;xqx:stepExpr&gt;
                  &lt;xqx:xpathAxis&gt;child&lt;/xqx:xpathAxis&gt;
                  &lt;xqx:nameTest&gt;books&lt;/xqx:nameTest&gt;
                &lt;/xqx:stepExpr&gt;
                &lt;xqx:stepExpr&gt;
                  &lt;xqx:xpathAxis&gt;child&lt;/xqx:xpathAxis&gt;
                  &lt;xqx:nameTest&gt;book&lt;/xqx:nameTest&gt;
                &lt;/xqx:stepExpr&gt;
              &lt;/xqx:pathExpr&gt;
            &lt;/xqx:forExpr&gt;
          &lt;/xqx:forClauseItem&gt;
        &lt;/xqx:forClause&gt;
        &lt;xqx:letClause&gt;
          &lt;xqx:letClauseItem&gt;
            &lt;xqx:typedVariableBinding&gt;
              &lt;xqx:varName&gt;irrelevantParts&lt;/xqx:varName&gt;
            &lt;/xqx:typedVariableBinding&gt;
            &lt;xqx:letExpr&gt;
              &lt;xqx:flworExpr&gt;
                &lt;xqx:forClause&gt;
                  &lt;xqx:forClauseItem&gt;
                    &lt;xqx:typedVariableBinding&gt;
                      &lt;xqx:varName&gt;part&lt;/xqx:varName&gt;
                    &lt;/xqx:typedVariableBinding&gt;
                    &lt;xqx:forExpr&gt;
                      &lt;xqx:pathExpr&gt;
                        &lt;xqx:stepExpr&gt;
                          &lt;xqx:filterExpr&gt;
                            &lt;xqx:varRef&gt;
                              &lt;xqx:name&gt;book&lt;/xqx:name&gt;
                            &lt;/xqx:varRef&gt;
                          &lt;/xqx:filterExpr&gt;
                        &lt;/xqx:stepExpr&gt;
                        &lt;xqx:stepExpr&gt;
                          &lt;xqx:xpathAxis&gt;descendant-or-self&lt;/xqx:xpathAxis&gt;
                          &lt;xqx:nameTest&gt;part&lt;/xqx:nameTest&gt;
                        &lt;/xqx:stepExpr&gt;
                      &lt;/xqx:pathExpr&gt;
                    &lt;/xqx:forExpr&gt;
                  &lt;/xqx:forClauseItem&gt;
                &lt;/xqx:forClause&gt;
                &lt;xqx:letClause&gt;
                  &lt;xqx:letClauseItem&gt;
                    &lt;xqxft:ftScoreVariableBinding&gt;score&lt;/xqxft:ftScoreVariableBinding&gt;
                    &lt;xqx:letExpr&gt;
                      &lt;xqxft:ftContainsExpr&gt;
                        &lt;xqxft:ftRangeExpr&gt;
                          &lt;xqx:varRef&gt;
                            &lt;xqx:name&gt;part&lt;/xqx:name&gt;
                          &lt;/xqx:varRef&gt;
                        &lt;/xqxft:ftRangeExpr&gt;
                        &lt;xqxft:ftSelectionExpr&gt;
                          &lt;xqxft:ftSelection&gt;
                            &lt;xqxft:ftSelectionSource&gt;
                              &lt;xqxft:ftPrimaryWithOptions&gt;
                                &lt;xqxft:ftPrimary&gt;
                                  &lt;xqxft:ftWords&gt;
                                    &lt;xqxft:ftWordsValue&gt;
                                      &lt;xqxft:ftWordsLiteral&gt;
                                        &lt;xqx:stringConstantExpr&gt;
                                          &lt;xqx:value&gt;usability test.*&lt;/xqx:value&gt;
                                        &lt;/xqx:stringConstantExpr&gt;
                                     &lt;/xqxft:ftWordsLiteral&gt;
                                    &lt;/xqxft:ftWordsValue&gt;
                                  &lt;/xqxft:ftWords&gt;
                                &lt;/xqxft:ftPrimary&gt;
                                &lt;xqxft:wildcard&gt;
                                  &lt;xqxft:value&gt;using wildcards&lt;/xqxft:value&gt;
                                &lt;/xqxft:wildcard&gt;
                              &lt;/xqxft:ftPrimaryWithOptions&gt;
                            &lt;/xqxft:ftSelectionSource&gt;
                          &lt;/xqxft:ftSelection&gt;
                        &lt;/xqxft:ftSelectionExpr&gt;
                      &lt;/xqxft:ftContainsExpr&gt;
                    &lt;/xqx:letExpr&gt;
                  &lt;/xqx:letClauseItem&gt;
                &lt;/xqx:letClause&gt;
                &lt;xqx:whereClause&gt;
                  &lt;xqx:lessThanOp&gt;
                    &lt;xqx:firstOperand&gt;
                      &lt;xqx:varRef&gt;
                        &lt;xqx:name&gt;score&lt;/xqx:name&gt;
                      &lt;/xqx:varRef&gt;
                    &lt;/xqx:firstOperand&gt;
                    &lt;xqx:secondOperand&gt;
                      &lt;xqx:decimalConstantExpr&gt;
                        &lt;xqx:value&gt;0.5&lt;/xqx:value&gt;
                      &lt;/xqx:decimalConstantExpr&gt;
                    &lt;/xqx:secondOperand&gt;
                  &lt;/xqx:lessThanOp&gt;
                &lt;/xqx:whereClause&gt;
                &lt;xqx:returnClause&gt;
                  &lt;xqx:varRef&gt;
                    &lt;xqx:name&gt;part&lt;/xqx:name&gt;
                  &lt;/xqx:varRef&gt;
                &lt;/xqx:returnClause&gt;
              &lt;/xqx:flworExpr&gt;
            &lt;/xqx:letExpr&gt;
          &lt;/xqx:letClauseItem&gt;
        &lt;/xqx:letClause&gt;
        &lt;xqx:whereClause&gt;
          &lt;xqx:lessThanOp&gt;
          &lt;xqx:firstOperand&gt;
            &lt;xqx:functionCallExpr&gt;
              &lt;xqx:functionName xqx:prefix="fn"&gt;count&lt;/xqx:functionName&gt;
              &lt;xqx:arguments&gt;
                &lt;xqx:varRef&gt;
                  &lt;xqx:name&gt;irrelevantParts&lt;/xqx:name&gt;
                &lt;/xqx:varRef&gt;
              &lt;/xqx:arguments&gt;
            &lt;/xqx:functionCallExpr&gt;
          &lt;/xqx:firstOperand&gt;
          &lt;xqx:secondOperand&gt;
            &lt;xqx:functionCallExpr&gt;
              &lt;xqx:functionName xqx:prefix="fn"&gt;count&lt;/xqx:functionName&gt;
              &lt;xqx:arguments&gt;
                &lt;xqx:pathExpr&gt;
                  &lt;xqx:stepExpr&gt;
                    &lt;xqx:filterExpr&gt;
                      &lt;xqx:varRef&gt;
                        &lt;xqx:name&gt;book&lt;/xqx:name&gt;
                      &lt;/xqx:varRef&gt;
                    &lt;/xqx:filterExpr&gt;
                  &lt;/xqx:stepExpr&gt;
                  &lt;xqx:stepExpr&gt;
                    &lt;xqx:xpathAxis&gt;descendant-or-self&lt;/xqx:xpathAxis&gt;
                    &lt;xqx:nameTest&gt;part&lt;/xqx:nameTest&gt;
                  &lt;/xqx:stepExpr&gt;
                &lt;/xqx:pathExpr&gt;
              &lt;/xqx:arguments&gt;
            &lt;/xqx:functionCallExpr&gt;
          &lt;/xqx:secondOperand&gt;
          &lt;/xqx:lessThanOp&gt;
        &lt;/xqx:whereClause&gt;
        &lt;xqx:returnClause&gt;
          &lt;xqx:functionCallExpr&gt;
            &lt;xqx:functionName xqx:prefix="local"&gt;filter&lt;/xqx:functionName&gt;
            &lt;xqx:arguments&gt;
              &lt;xqx:varRef&gt;
                &lt;xqx:name&gt;book&lt;/xqx:name&gt;
              &lt;/xqx:varRef&gt;
              &lt;xqx:varRef&gt;
                &lt;xqx:name&gt;irrelevantParts&lt;/xqx:name&gt;
              &lt;/xqx:varRef&gt;
            &lt;/xqx:arguments&gt;
          &lt;/xqx:functionCallExpr&gt;
        &lt;/xqx:returnClause&gt;
      &lt;/xqx:flworExpr&gt;
    &lt;/xqx:queryBody&gt;
  &lt;/xqx:mainModule&gt;
&lt;/xqx:module&gt;
</pre></div>
</div>
<div class="div4">
<h5><a name="Example1-Full-Text-Transformation" id=
"Example1-Full-Text-Transformation"></a>E.3.1.3 Transformation of
Full Text XQueryX Solution into XQuery Full Text</h5>
<p>Application of the stylesheet in <a href=
"#id-xqft-full-text-stylesheet"><b>E.2 XQueryX stylesheet for
XQuery and XPath Full Text 1.0</b></a> to the Full Text XQueryX
solution results in:</p>
<div class="xquery">
<div class="exampleInner">
<pre>
declare function local:filter($nodes as node()*, $exclude as element()*) as node()
{
( for $node in ($nodes except $exclude)
  return ( typeswitch($node)
             case $e as element()
               return element {fn:node-name($e)}
                  {( $e/child::attribute(*),
                     fn:filter( ($e/child::node() except $exclude), $exclude ) )}
             default return $node )
)
};

( for $book
    in fn:doc("http://bstore1.example.com/full-text.xml")/child::books/child::book
  let $irrelevantParts:=
  ( for $part in $book/descendant-or-self::part
    let score $score := $part contains text "usability test.*"
        using wildcards
    where ($score &lt; 0.5)
    return $part
)
  where (fn:count($irrelevantParts) &lt; fn:count($book/descendant-or-self::part))
  return local:filter($book, $irrelevantParts)
)
</pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="div1">
<h2><a name="References" id="References"></a>F References</h2>
<div class="div2">
<h3><a name="id-normative-references" id=
"id-normative-references"></a>F.1 Normative References</h3>
<dl>
<dt class="label"><span><a name="xquery" id="xquery"></a>XQuery
1.0: An XML Query Language (Second Edition)</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xquery/"><cite>XQuery 1.0: An
XML Query Language (Second Edition)</cite></a>, Don Chamberlin,
Anders Berglund, Scott Boag, <em>et. al.</em>, Editors. World Wide
Web Consortium, 14 December 2010. This version is
http://www.w3.org/TR/2010/REC-xquery-20101214/. The <a href=
"http://www.w3.org/TR/xquery/">latest version</a> is available at
http://www.w3.org/TR/xquery/.</div>
</dd>
<dt class="label"><span><a name="xpath20" id="xpath20"></a>XML Path
Language (XPath) 2.0 (Second Edition)</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xpath20/"><cite>XML Path
Language (XPath) 2.0 (Second Edition)</cite></a>, Don Chamberlin,
Anders Berglund, Scott Boag, <em>et. al.</em>, Editors. World Wide
Web Consortium, 14 December 2010. This version is
http://www.w3.org/TR/2010/REC-xpath20-20101214/. The <a href=
"http://www.w3.org/TR/xpath20/">latest version</a> is available at
http://www.w3.org/TR/xpath20/.</div>
</dd>
<dt class="label"><span><a name="xpath-functions" id=
"xpath-functions"></a>XQuery 1.0 and XPath 2.0 Functions and
Operators (Second Edition)</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xpath-functions/"><cite>XQuery
1.0 and XPath 2.0 Functions and Operators (Second
Edition)</cite></a>, Ashok Malhotra, Jim Melton, and Norman Walsh,
Editors. World Wide Web Consortium, 14 December 2010. This version
is http://www.w3.org/TR/2010/REC-xpath-functions-20101214/. The
<a href="http://www.w3.org/TR/xpath-functions/">latest version</a>
is available at http://www.w3.org/TR/xpath-functions/.</div>
</dd>
<dt class="label"><span><a name="xpath-datamodel" id=
"xpath-datamodel"></a>XQuery 1.0 and XPath 2.0 Data Model (XDM)
(Second Edition)</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xpath-datamodel/"><cite>XQuery
1.0 and XPath 2.0 Data Model (XDM) (Second Edition)</cite></a>,
Norman Walsh, Mary Fernández, Ashok Malhotra, <em>et. al.</em>,
Editors. World Wide Web Consortium, 14 December 2010. This version
is http://www.w3.org/TR/2010/REC-xpath-datamodel-20101214/. The
<a href="http://www.w3.org/TR/xpath-datamodel/">latest version</a>
is available at http://www.w3.org/TR/xpath-datamodel/.</div>
</dd>
<dt class="label"><span><a name="xqueryx" id="xqueryx"></a>XML
Syntax for XQuery 1.0 (XQueryX) (Second Edition)</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xqueryx/"><cite>XML Syntax for
XQuery 1.0 (XQueryX) (Second Edition)</cite></a>, Jim Melton and
Subramanian Muralidhar, Editors. World Wide Web Consortium, 14
December 2010. This version is
http://www.w3.org/TR/2010/REC-xqueryx-20101214/. The <a href=
"http://www.w3.org/TR/xqueryx/">latest version</a> is available at
http://www.w3.org/TR/xqueryx/.</div>
</dd>
<dt class="label"><span><a name="xpath-full-text-10-requirements"
id="xpath-full-text-10-requirements"></a>XQuery and XPath Full Text
1.0 Requirements</span></dt>
<dd>
<div><a href=
"http://www.w3.org/TR/xpath-full-text-10-requirements/"><cite>XQuery
and XPath Full Text 1.0 Requirements</cite></a>, Stephen Buxton,
Pat Case, and Michael Rys, Editors. World Wide Web Consortium,
25&#160;January&#160;2011. This version is
http://www.w3.org/TR/2011/NOTE-xpath-full-text-10-requirements-20110125/.
The <a href=
"http://www.w3.org/TR/xpath-full-text-10-requirements/">latest
version</a> is available at
http://www.w3.org/TR/xpath-full-text-10-requirements/.</div>
</dd>
<dt class="label"><span><a name="xpath-full-text-10-use-cases" id=
"xpath-full-text-10-use-cases"></a>XQuery and XPath Full Text 1.0
Use Cases</span></dt>
<dd>
<div><a href=
"http://www.w3.org/TR/xpath-full-text-10-use-cases/"><cite>XQuery
and XPath Full Text 1.0 Use Cases</cite></a>, Sihem Amer-Yahia and
Pat Case, Editors. World Wide Web Consortium, 25 January 2011. This
version is
http://www.w3.org/TR/2011/NOTE-xpath-full-text-10-use-cases-20110125/.
The <a href=
"http://www.w3.org/TR/xpath-full-text-10-use-cases/">latest
version</a> is available at
http://www.w3.org/TR/xpath-full-text-10-use-cases/.</div>
</dd>
<dt class="label"><span><a name="BCP47" id="BCP47"></a>BCP
47</span></dt>
<dd>
<div>A. Phillips and M. Davis. <em>Tags for Identifying
Languages.</em> IETF BCP 47. See <a href=
"http://tools.ietf.org/html/bcp47">http://tools.ietf.org/html/bcp47</a>.
This reference leads to <a href="#RFC4646">[RFC 4646]</a> and
<a href="#RFC4647">[RFC 4647]</a> and replaces <a href=
"#RFC3066">[RFC 3066]</a>.</div>
</dd>
<dt class="label"><span><a name="RFC2119" id="RFC2119"></a>RFC
2119</span></dt>
<dd>
<div>S. Bradner. <em>Key Words for use in RFCs to Indicate
Requirement Levels.</em> IETF RFC 2119. See <a href=
"http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>.</div>
</dd>
<dt class="label"><span><a name="RFC3066" id="RFC3066"></a>RFC
3066</span></dt>
<dd>
<div>H. Alvestrand. <em>Tags for the Identification of
Languages.</em> IETF RFC 3066. See <a href=
"http://www.ietf.org/rfc/rfc3066.txt">http://www.ietf.org/rfc/rfc3066.txt</a>.</div>
</dd>
<dt class="label"><span><a name="RFC4646" id="RFC4646"></a>RFC
4646</span></dt>
<dd>
<div>A. Phillips and M. Davis. <em>Tags for Identifying
Languages.</em> IETF RFC 4646. See <a href=
"http://www.ietf.org/rfc/rfc4646.txt">http://www.ietf.org/rfc/rfc4646.txt</a>.</div>
</dd>
<dt class="label"><span><a name="RFC4647" id="RFC4647"></a>RFC
4647</span></dt>
<dd>
<div>A. Phillips and M. Davis. <em>Matching of Language Tags.</em>
IETF RFC 4647. See <a href=
"http://www.ietf.org/rfc/rfc4647.txt">http://www.ietf.org/rfc/rfc4647.txt</a>.</div>
</dd>
</dl>
</div>
<div class="div2">
<h3><a name="id-non-normative-references" id=
"id-non-normative-references"></a>F.2 Non-normative References</h3>
<dl>
<dt class="label"><span><a name="iso-2788" id="iso-2788"></a>ISO
2788</span></dt>
<dd>
<div>Documentation Guidelines for the Establishment and Development
of Monolingual Thesauri, Geneva: International Organization for
Standardization, 2nd edition, 1986.</div>
</dd>
<dt class="label"><span><a name="sqlmm" id=
"sqlmm"></a>SQL/MM</span></dt>
<dd>
<div>ISO/IEC 13249-2 Information technology --- Database languages
--- SQL Multimedia and Application Packages --- Part 2: Full-Text.
Geneva: International Organization for Standardization, 2nd
edition, 2003.</div>
</dd>
<dt class="label"><span><a name="UAX29" id=
"UAX29"></a>UAX29</span></dt>
<dd>
<div>M. Davis. <em>Unicode Standard Annex #29 Text Boundaries,
revision 11, 2006.</em> See <a href=
"http://www.unicode.org/reports/tr29/">http://www.unicode.org/reports/tr29/</a></div>
</dd>
</dl>
</div>
</div>
<div class="div1">
<h2><a name="ft-acknowledgements" id="ft-acknowledgements"></a>G
Acknowledgements (Non-Normative)</h2>
<p>We would like to thank the members of the XQuery and XPath
Full-Text group for their fruitful discussions.</p>
<p>We would like to thank the following people for their
contributions on earlier drafts of this document.</p>
<ul>
<li>
<p>Andrew Cencini, Microsoft - acencini@microsoft.com</p>
</li>
<li>
<p>Andrew Eisenberg, IBM - andrew.eisenberg@us.ibm.com</p>
</li>
<li>
<p>Nimish Khanolkar, Microsoft - nimishk@exchange.microsoft.com</p>
</li>
<li>
<p>Ashok Malhotra, Oracle - ashok.malhotra@oracle.com</p>
</li>
<li>
<p>Tapas Nayak, Microsoft - tapasnay@exchange.microsoft.com</p>
</li>
<li>
<p>Roland Seiffert, IBM - seiffert@de.ibm.com</p>
</li>
</ul>
</div>
<div class="div1">
<h2><a name="ft-glossary" id="ft-glossary"></a>H Glossary
(Non-Normative)</h2>
<dl>
<dt><a name="GLAllMatchesDef" id=
"GLAllMatchesDef"></a>AllMatches</dt>
<dd>
<p>An <b>AllMatches</b> describes the possible results of an
<b>FTSelection</b>.</p>
</dd>
<dt><a name="GLid-Distance-Operator-Restriction" id=
"GLid-Distance-Operator-Restriction"></a>Distance Operator
Restriction</dt>
<dd>
<p><b>Distance Operator Restriction.</b> FTDistance can only be
applied to an FTOr that is either a single FTWords or a combination
of FTWords involving only the operators ftand and ftor.</p>
</dd>
<dt><a name="GLFull-TextQueriesDef" id=
"GLFull-TextQueriesDef"></a>Full-TextQueries</dt>
<dd>
<p><b>Full-text queries</b> are performed on tokens and phrases.
Tokens and phrases are produced via tokenization.</p>
</dd>
<dt><a name="GLIgnoredNodesDef" id=
"GLIgnoredNodesDef"></a>IgnoredNodes</dt>
<dd>
<p><b>Ignored nodes</b> are the set of nodes whose content are
ignored.</p>
</dd>
<dt><a name="GLMatchDef" id="GLMatchDef"></a>Match</dt>
<dd>
<p>Each <b>Match</b> describes one result to the
<b>FTSelection</b>.</p>
</dd>
<dt><a name="GLid-Negation-Restriction-1" id=
"GLid-Negation-Restriction-1"></a>Negation Restriction 1</dt>
<dd>
<p><b>Negation Restriction 1.</b> An <a href=
"#doc-xquery10-FTUnaryNot">FTUnaryNot</a> expression may only
appear as a direct right operand of an "ftand" (<a href=
"#doc-xquery10-FTAnd">FTAnd</a>) operation.</p>
</dd>
<dt><a name="GLid-Negation-Restriction-2" id=
"GLid-Negation-Restriction-2"></a>Negation Restriction 2</dt>
<dd>
<p><b>Negation Restriction 2.</b> An <a href=
"#doc-xquery10-FTUnaryNot">FTUnaryNot</a> expression may not appear
as a descendant of an <a href="#doc-xquery10-FTOr">FTOr</a> that is
modified by an <a href="#doc-xquery10-FTPosFilter">FTPosFilter</a>.
(An FTOr is modified by an FTPosFilter, if it is derived using the
production for <a href="#doc-xquery10-FTSelection">FTSelection</a>
together with that FTPosFilter.)</p>
</dd>
<dt><a name="GLid-Order-Operator-Restriction" id=
"GLid-Order-Operator-Restriction"></a>Order Operator
Restriction</dt>
<dd>
<p><b>Order Operator Restriction.</b> FTOrder may only appear
directly succeeding an FTWindow or an FTDistance operator.</p>
</dd>
<dt><a name="GLParagraphDef" id="GLParagraphDef"></a>Paragraph</dt>
<dd>
<p>A <b>paragraph</b> is an ordered sequence of any number of
tokens. Beyond that, paragraphs are <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. A
tokenizer is not required to support paragraphs.</p>
</dd>
<dt><a name="GLPhraseDef" id="GLPhraseDef"></a>Phrase</dt>
<dd>
<p>A <b>phrase</b> is an ordered sequence of any number of tokens.
Beyond that, phrases are <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</dd>
<dt><a name="GLQueryItemDef" id="GLQueryItemDef"></a>QueryItem</dt>
<dd>
<p>A <b>QueryItem</b> is a sequence of <b>QueryTokenInfo</b>s
representing the collection of tokens derived from tokenizing one
query string.</p>
</dd>
<dt><a name="GLQueryTokenInfoDef" id=
"GLQueryTokenInfoDef"></a>QueryTokenInfo</dt>
<dd>
<p>A <b>QueryTokenInfo</b> is the identity of a token inside a
query string.</p>
</dd>
<dt><a name="GLScore" id="GLScore"></a>Score</dt>
<dd>
<p>The <b>score</b> of a full-text query result expresses its
relevance to the search conditions.</p>
</dd>
<dt><a name="GLSentenceDef" id="GLSentenceDef"></a>Sentence</dt>
<dd>
<p>A <b>sentence</b> is an ordered sequence of any number of
tokens. Beyond that, sentences are <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. A
tokenizer is not required to support sentences.</p>
</dd>
<dt><a name="GLid-Single-Language-Restriction" id=
"GLid-Single-Language-Restriction"></a>Single Language
Restriction</dt>
<dd>
<p><b>Single Language Restriction.</b> If a full-text query
contains more than one FTLanguageOption in its body and the prolog,
then the languages specified must be the same.</p>
</dd>
<dt><a name="GLStringExcludeDef" id=
"GLStringExcludeDef"></a>StringExclude</dt>
<dd>
<p>A <b>StringExclude</b> is a <b>StringMatch</b> that describes a
<b>TokenInfo</b> that must not be contained in the document.</p>
</dd>
<dt><a name="GLStringIncludeDef" id=
"GLStringIncludeDef"></a>StringInclude</dt>
<dd>
<p>A <b>StringInclude</b> is a <b>StringMatch</b> that describes a
<b>TokenInfo</b> that must be contained in the document.</p>
</dd>
<dt><a name="GLStringMatchDef" id=
"GLStringMatchDef"></a>StringMatch</dt>
<dd>
<p>A <b>StringMatch</b> is a possible match of a sequence of query
tokens with a corresponding sequence of tokens in a document. A
StringMatch may be a <b>StringInclude</b> or
<b>StringExclude</b>.</p>
</dd>
<dt><a name="GLTokenDef" id="GLTokenDef"></a>Token</dt>
<dd>
<p>A <b>token</b> is a non-empty sequence of characters returned by
a tokenizer as a basic unit to be searched. Beyond that, tokens are
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</dd>
<dt><a name="GLTokenInfoDef" id="GLTokenInfoDef"></a>TokenInfo</dt>
<dd>
<p>A <b>TokenInfo</b> represents a contiguous collection of tokens
from an XML document.</p>
</dd>
<dt><a name="GLTokenizationDef" id=
"GLTokenizationDef"></a>Tokenization</dt>
<dd>
<p>Formally, <b>tokenization</b> is the process of converting an
XDM item to a collections of tokens, taking any structural
information of the item into account to identify token, sentence,
and paragraph boundaries. Each token is assigned a starting and
ending position.</p>
</dd>
<dt><a name="GLWeightDeclarationsDef" id=
"GLWeightDeclarationsDef"></a>WeightDeclarations</dt>
<dd>
<p>Scoring may be influenced by adding <b>weight declarations</b>
to search tokens, phrases, and expressions.</p>
</dd>
<dt><a name="GLid-Window-Operator-Restriction" id=
"GLid-Window-Operator-Restriction"></a>Window Operator
Restriction</dt>
<dd>
<p><b>Window Operator Restriction.</b> FTWindow can only be applied
to an FTOr that is either a single FTWords or a combination of
FTWords involving only the operators ftand and ftor.</p>
</dd>
<dt><a name="GLdt-anchoring-selection" id=
"GLdt-anchoring-selection"></a>anchoring selection</dt>
<dd>
<p>An <b>anchoring selection</b> consists of a full-text selection
followed by one of the postfix operators "at start", "at end", or
"entire content".</p>
</dd>
<dt><a name="GLdt-and-selection" id=
"GLdt-and-selection"></a>and-selection</dt>
<dd>
<p>An <b>and-selection</b> combines two full-text selections using
the <code>ftand</code> operator.</p>
</dd>
<dt><a name="GLdt-cardinality-selection" id=
"GLdt-cardinality-selection"></a>cardinality selection</dt>
<dd>
<p>A <b>cardinality selection</b> consist of an <a href=
"#doc-xquery10-FTWords">FTWords</a> followed by the <a href=
"#doc-xquery10-FTTimes">FTTimes</a> postfix operator.</p>
</dd>
<dt><a name="GLdt-ftcaseoption" id="GLdt-ftcaseoption"></a>case
option</dt>
<dd>
<p>A <b>case option</b> modifies the matching of tokens and phrases
by specifying how uppercase and lowercase characters are
considered.</p>
</dd>
<dt><a name="GLdt-ftdiacriticsoption" id=
"GLdt-ftdiacriticsoption"></a>diacritics option</dt>
<dd>
<p>A <b>diacritics option</b> modifies token and phrase matching by
specifying how diacritics are considered.</p>
</dd>
<dt><a name="GLdt-distance-selection" id=
"GLdt-distance-selection"></a>distance selection</dt>
<dd>
<p>A <b>distance selection</b> consists of a full-text selection
followed by one of the (complex) postfix operators derived from
<a href="#doc-xquery10-FTDistance">FTDistance</a>.</p>
</dd>
<dt><a name="GLdt-ftextensionoption" id=
"GLdt-ftextensionoption"></a>extension option</dt>
<dd>
<p>An <b>extension option</b> is a match option that acts in an
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> way.</p>
</dd>
<dt><a name="GLdt-extension-selection" id=
"GLdt-extension-selection"></a>extension selection</dt>
<dd>
<p>An <b>extension selection</b> is a full-text selection whose
semantics are <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</dd>
<dt><a name="GLdt-ftcontains" id="GLdt-ftcontains"></a>full-text
contains expression</dt>
<dd>
<p>A <b>full-text contains expression</b> is a expression that
evaluates a sequence of items against a full-text selection.</p>
</dd>
<dt><a name="GLftselection" id="GLftselection"></a>full-text
selection</dt>
<dd>
<p>A <b>full-text selection</b> specifies the conditions of a
full-text search.</p>
</dd>
<dt><a name="GLdt-implementation-dependent" id=
"GLdt-implementation-dependent"></a>implementation dependent</dt>
<dd>
<p><b>Implementation-dependent</b> indicates an aspect that may
differ between implementations, is not specified by this or any W3C
specification, and is not required to be specified by the
implementor for any particular implementation.</p>
</dd>
<dt><a name="GLdt-implementation-defined" id=
"GLdt-implementation-defined"></a>implementation defined</dt>
<dd>
<p><b>Implementation-defined</b> indicates an aspect that may
differ between implementations, but must be specified by the
implementor for each particular implementation.</p>
</dd>
<dt><a name="GLdt-ftlanguageoption" id=
"GLdt-ftlanguageoption"></a>language option</dt>
<dd>
<p>A <b>language option</b> modifies token matching by specifying
the language of search tokens and phrases.</p>
</dd>
<dt><a name="GLdt-match-options" id="GLdt-match-options"></a>match
option</dt>
<dd>
<p><b>Match options</b> modify the set of tokens in the query, or
how they are matched against tokens in the text.</p>
</dd>
<dt><a name="GLdt-match-option-order" id=
"GLdt-match-option-order"></a>match option application order</dt>
<dd>
<p>The order in which effective match options for an <a href=
"#doc-xquery10-FTWords">FTWords</a> are applied is called the
<b>match option application order</b>.</p>
</dd>
<dt><a name="GLdt-match-option-group" id=
"GLdt-match-option-group"></a>match option group</dt>
<dd>
<p>Each of the alternatives of production <a href=
"#doc-xquery10-FTMatchOption">FTMatchOption</a> 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>other
than <a href=
"#doc-xquery10-FTExtensionOption">FTExtensionOption</a></span>
corresponds to one <b>match option group</b>.</p>
</dd>
<dt><a name="GLmay" id="GLmay"></a>may</dt>
<dd>
<p><b>MAY</b> means that an item is truly optional.</p>
</dd>
<dt><a name="GLdt-mild-not-selection" id=
"GLdt-mild-not-selection"></a>mild-not selection</dt>
<dd>
<p>A <b>mild-not selection</b> combines two full-text selections
using the <code>not in</code> operator.</p>
</dd>
<dt><a name="GLmust" id="GLmust"></a>must</dt>
<dd>
<p><b>MUST</b> means that the item is an absolute requirement of
the specification.</p>
</dd>
<dt><a name="GLdt-unary-not-selection" id=
"GLdt-unary-not-selection"></a>not-selection</dt>
<dd>
<p>A <b>not-selection</b> is a full-text selection starting with
the prefix operator <code>ftnot</code>.</p>
</dd>
<dt><a name="GLdt-or-selection" id=
"GLdt-or-selection"></a>or-selection</dt>
<dd>
<p>An <b>or-selection</b> combines two full-text selections using
the <code>ftor</code> operator.</p>
</dd>
<dt><a name="GLdt-ordered-selection" id=
"GLdt-ordered-selection"></a>ordered selection</dt>
<dd>
<p>An <b>ordered selection</b> consists of a full-text selection
followed by the postfix operator "ordered".</p>
</dd>
<dt><a name="GLdt-ftposfilter" id="GLdt-ftposfilter"></a>positional
filter</dt>
<dd>
<p><b>Positional filters</b> are postfix operators that serve to
filter matches based on various constraints on their positional
information.</p>
</dd>
<dt><a name="GLdt-ftprimary" id="GLdt-ftprimary"></a>primary
full-text selection</dt>
<dd>
<p>A <b>primary full-text selection</b> is the basic form of a
full-text selection. It specifies tokens and phrases as search
conditions (<a href="#doc-xquery10-FTWords">FTWords</a>),
optionally followed by a cardinality constraint (<a href=
"#doc-xquery10-FTTimes">FTTimes</a>). An <a href=
"#doc-xquery10-FTSelection">FTSelection</a> in parentheses and the
<a href=
"#doc-xquery10-FTExtensionSelection">FTExtensionSelection</a> are
also a primary full-text selections.</p>
</dd>
<dt><a name="GLdt-scope-selection" id=
"GLdt-scope-selection"></a>scope selection</dt>
<dd>
<p>A <b>scope selection</b> consists of a full-text selection
followed by one of the (complex) postfix operators derived from
<a href="#doc-xquery10-FTScope">FTScope</a>.</p>
</dd>
<dt><a name="GLdt-search-context" id=
"GLdt-search-context"></a>search context</dt>
<dd>
<p>Those items are called the <b>search context</b>.</p>
</dd>
<dt><a name="GLshould" id="GLshould"></a>should</dt>
<dd>
<p><b>SHOULD</b> means that there may exist valid reasons in
particular circumstances to ignore a particular item, but the full
implications must be understood and carefully weighed before
choosing a different course.</p>
</dd>
<dt><a name="GLdt-ftstemoption" id="GLdt-ftstemoption"></a>stemming
option</dt>
<dd>
<p>A <b>stemming option</b> modifies token and phrase matching by
specifying whether stemming is applied or not.</p>
</dd>
<dt><a name="GLdt-ftstopwordoption" id=
"GLdt-ftstopwordoption"></a>stop word option</dt>
<dd>
<p>A <b>stop word option</b> controls matching of 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>tokens</span>
by specifying whether stop words are used or not. Stop words are
tokens in the query that match any token in the text being
searched.</p>
</dd>
<dt><a name="GLdt-ftthesaurusoption" id=
"GLdt-ftthesaurusoption"></a>thesaurus option</dt>
<dd>
<p>A <b>thesaurus option</b> modifies token and phrase matching by
specifying whether a thesaurus is used or not.</p>
</dd>
<dt><a name="GLdt-ftwildcardoption" id=
"GLdt-ftwildcardoption"></a>wildcard option</dt>
<dd>
<p>A <b>wildcard option</b> modifies token and phrase matching by
specifying whether or not wildcards are recognized in query
strings.</p>
</dd>
<dt><a name="GLdt-window-selection" id=
"GLdt-window-selection"></a>window selection</dt>
<dd>
<p>A <b>window selection</b> consists of a full-text selection
followed by one of the (complex) postfix operators derived from
<a href="#doc-xquery10-FTWindow">FTWindow</a>.</p>
</dd>
</dl>
</div>
<div class="div1">
<h2><a name="impl-def" id="impl-def"></a>I Checklist of
Implementation-Defined Features (Non-Normative)</h2>
<p>This appendix provides a summary of features defined in this
specification whose effect is explicitly <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. The
conformance rules require vendors to provide documentation that
explains how these choices have been exercised.</p>
<ol class="enumar">
<li>
<p>Tokenization, including the definition of the term "tokens",
<a title="should" href="#should">SHOULD</a> be <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.
Implementations <a title="should" href="#should">SHOULD</a> expose
the rules and sample results of tokenization as much as possible to
enable users to predict and interpret the results of
tokenization.</p>
</li>
<li>
<p>A phrase is an ordered sequence of any number of tokens. Beyond
that, phrases are <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>A sentence is an ordered sequence of any number of tokens.
Beyond that, sentences are <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>A
tokenizer</span> is not required to support sentences.</p>
</li>
<li>
<p>A paragraph is an ordered sequence of any number of tokens.
Beyond that, paragraphs are <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>A
tokenizer</span> is not required to support paragraphs.</p>
</li>
<li>
<p>Implementations are free to provide <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> ways to
differentiate between markup's effect on token boundaries during
tokenization.</p>
</li>
<li>
<p>The set of expressions (of form ExprSingle) that can be assigned
to a score variable in a let-clause is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>. 
<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0--><span>If
an expression not supported by the scoring algorithm is passed to
the scoring algorithm, the result is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</span></p>
</li>
<li>
<p>When a sequence of query tokens is considered as a phrase, it
matches a sequence of tokens in the tokenized form of the text
being searched only if the two sequences correspond in an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> way.</p>
</li>
<li>
<p>The <a title="match option application order" href=
"#dt-match-option-order">match option application order</a>,
subject to the stated constraints, is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>The "language" option influences tokenization, stemming, and
stop words in an <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> way. It
<a title="may" href="#may">MAY</a> influence the behavior of other
match options in an <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> way.</p>
</li>
<li>
<p>The set of valid language identifiers is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>If an invalid language identifier is specified, then the
behavior is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>When a processor evaluates text in a document that is governed
by an xml:lang attribute and the portion of the full-text query
doing that evaluation contains an FTLanguageOption that specifies a
different language from the language specified by the governing
xml:lang attribute, the language-related behavior of that full-text
query is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>It is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> which
thesaurus relationships an implementation supports.</p>
</li>
<li>
<p>If a query specifies thesaurus relationships not supported by
the thesaurus, or does not specify a relationship, the behavior is
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>The effect of specifying a particular range of levels in an
FTThesaurusID is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>If a query does not specify the number of levels, and the
implementation does not follow the default of querying all levels
of hierarchical relationships, then the number of levels of
hierarchical relationships queries is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>It is <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> what a stem
of a token is, and whether stemming is based on an algorithm,
dictionary, or mixed approach.</p>
</li>
<li>
<p>An <a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> comparison
is used to determine whether a query token appears in the
collection of stop words defined by the applicable stop word
option.</p>
</li>
<li>
<p>Normally a stop word matches exactly one token, but there may be
<a title="implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> conditions,
under which a stop word may match a different number of tokens.</p>
</li>
<li>
<p>The "stop words default" option specifies that an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> collection
of stop words is used.</p>
</li>
<li>
<p>An implementation recognizes an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> set of
namespace URIs used to denote extension options. The effect of
each, including its error behavior, is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>An implementation recognizes an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> set of
namespace URIs used to denote extension selection pragmas. The
effect of each, including its error behavior, is <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>The conditions under which tokenization of two equal items
produces different tokens is <a title="implementation defined"
href="#dt-implementation-defined">implementation-defined</a>.</p>
</li>
<li>
<p>An implementation may impose an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> restriction
on the operand of FTIgnoreOption.</p>
</li>
<li>
<p>For certain full-text components of the static context (see
<a href="#id-xqft-static-context-components"><b>C Static Context
Components</b></a>), the default initial value of the component can
be overwritten or augmented with an <a title=
"implementation defined" href=
"#dt-implementation-defined">implementation-defined</a> value or
values.</p>
</li>
</ol>
</div>
<div class="div1">
<h2><a name="id-xqft-changelog" id="id-xqft-changelog"></a>J Change
Log (Non-Normative)</h2>
<table border="1" summary="Change Log Table">
<tbody>
<tr>
<td>Michael Dyck</td>
<td>2008-08-19</td>
<td>3.6.3 Distance Selection</td>
<td>Change the prose around example 2 to agree with the meeting 170
decision re distance filter applied to n&gt;2 matches.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2008-08-26</td>
<td>Sections <a href="#section-using-weights"><b>2.3.1 Using
Weights Within a Scored FTContainsExpr</b></a>, <a href=
"#ftselections"><b>3 Full-Text Selections</b></a>, and <a href=
"#id-errors"><b>D Error Conditions</b></a></td>
<td>Ensure that all description of weights, valid values, and
errors related to invalid values are captured in one place, and
generalize the description of the error raised for invalid values.
Resolves bug 5812.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2008-08-26</td>
<td>Section <a href="#id-extension-selections"><b>3.8 Extension
Selections</b></a></td>
<td>Correct syntax of the second and third examples. Resolves bug
5879.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2008-08-26</td>
<td>Section <a href="#sec-ftnot"><b>3.5.4
Not-Selection</b></a></td>
<td>Rewrite the second example to correspond to the search document
content. Resolves bug 5884.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2008-08-26</td>
<td>Section <a href="#sec-ftnot"><b>3.5.4
Not-Selection</b></a></td>
<td>Rewrite the third example to correspond to the search document
structure. Resolves bug 5885.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2008-10-30</td>
<td>Miscellaneous</td>
<td>Add text to clarify status of attribute searches (bug 5975) and
of scope and constraints on score variables (bug 6094).</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2008-10-30</td>
<td>Full-Text Selections</td>
<td>Change scope of weight variables to FTPrimary rather than
FTSelection to resolve bug 6178.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2008-11-07</td>
<td>2.3.1 Using Weights Within a Scored FTContainsExpr</td>
<td>Collateral changes due to Bug 6178's relocation of FTWeight
within grammar.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2008-11-07</td>
<td>3.4 Match Options, 3.6 Positional Filters</td>
<td>Add text intended to clarify scope of options/filters. [Bug
5977]</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2008-11-12</td>
<td>Appendix <a href="#id-xqft-xqueryx"><b>E XML Syntax (XQueryX)
for XQuery and XPath Full Text 1.0</b></a></td>
<td>Revise Schema and stylesheet to reflect change in position of
"weight" in the grammar.</td>
</tr>
<tr>
<td>Pat Case</td>
<td>2008-11-23</td>
<td>Removed count &gt; 0 from examples</td>
<td>Removed count &gt; 0 from examples in 3.4.3 Thesaurus Option
and 3.4.7 Stop Word Option.</td>
</tr>
<tr>
<td>Pat Case</td>
<td>2008-11-23</td>
<td>Corrected FTLanguage example</td>
<td>Corrected the FTLanguage example in Section 3.4.1 to search in
content//p and to search for "salon de thé".</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-01-08</td>
<td>4.2.7.9 FTDistance</td>
<td>Rewrite the very last sentence. [Bug 6303]</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-01-08</td>
<td>Grammar, Full-Text Selections</td>
<td>Get rid of "multiple-match-options" as an extra-grammatical
constraint, and instead make it a conventional static error
(FTST0019).</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2009-01-28</td>
<td>Section <a href="#introduction"><b>1 Introduction</b></a></td>
<td>Inserted paragraph stating that Notes are not normative.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2009-01-28</td>
<td>Appendix <a href="#id-errors"><b>D Error
Conditions</b></a></td>
<td>Added entries and descriptions for errors XPST0003, XQST0013,
and XQST0079.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2009-02-19</td>
<td>Window Selection <a href="#ftwindow"><b>3.6.2 Window
Selection</b></a></td>
<td>Provided corrected commentary on windowing example; clarified
non-applicability of contents of attribute in this example.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2009-02-19</td>
<td>FTUnit and FTBigUnit <a href="#id-ftunit-option"><b>5.2.3
FTUnit and FTBigUnit</b></a></td>
<td>Clarified that we did not mean for 'word' and 'words' to be
optional units.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2009-02-19</td>
<td>Thesaurus Option <a href="#ftthesaurusoption"><b>3.4.3
Thesaurus Option</b></a> and Error Conditions <a href=
"#id-errors"><b>D Error Conditions</b></a></td>
<td>Added error FTST0018 for missing thesauri.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-02-26</td>
<td>4.2.7.7 FTContent</td>
<td>Rewrite fts:ApplyFTContent() to fix 'entire content'. In the
process, introduce fts:TokenInfoCoversTokenPosition(),
fts:getLowestTokenPosition(), &amp; fts:getHighestTokenPosition()
and drop fts:isStartToken() &amp; fts:isEndToken()</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-02-26</td>
<td>4.2.7.7 FTContent</td>
<td>Add example of counter-intuitive behaviour due to
@isContiguous=false.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-03-16</td>
<td>4.2.7.9 FTDistance</td>
<td>Rearrange the section to bring together the parts about
fts:ApplyFTDistance.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-03-16</td>
<td>4.2.4 Formal semantics functions &amp; 4.2.7.9 FTDistance</td>
<td>Dissolve 4.2.4 and integrate its content into 4.2.7.9 (now
4.2.6.9).</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-03-17</td>
<td>4.2.6.8 FTWindow</td>
<td>Fix two typos in fts:joinIncludes(). (Bug 6386)</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-03-17</td>
<td>fts:evaluate, fts:FormRange, fts:UnaryNotHelper,
fts:calcStopWords</td>
<td>Fix some typos that would give static errors or type errors if
you tried to treat these functions as actual XQuery code.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2009-03-19</td>
<td>fts:ApplyFTScopeDifferentSentence,
fts:ApplyFTScopeDifferentParagraph</td>
<td>Fix code to properly handle the case where there is a single
string include.</td>
</tr>
<tr>
<td>Pat Case</td>
<td>2009-03-28</td>
<td>Changed FTStopword examples 1 and 3</td>
<td>Removed the stemming match option and changed the operand
propagation to propagating in FTStopword examples 1 and 3.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-04-14</td>
<td>3.4.1 Language Option</td>
<td>Fix typo in example query.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2009-04-30</td>
<td>E.3.1.2 A Solution in Full Text XQueryX</td>
<td>Fix element names in example. (Bug 6840)</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-06-06</td>
<td>3.2 Search Tokens and Phrases</td>
<td>Add wording to handle cases involving empty sequences of items
or tokens. (Bug 6813)</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-06-08</td>
<td>4.2.4 FTWords</td>
<td>Fix error in fts:ApplyFTWordsAnyWord().</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-07-05</td>
<td>3.4.2 Wildcard Option, Appendix D Errors</td>
<td>Wording changes, add more examples. Add error FTDY0020.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-07-06</td>
<td>3.4.2 Wildcard Option</td>
<td>Delete Note re wildcards and token boundaries.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-07-06</td>
<td>E.1 XQueryX representation of XQuery and XPath Full Text
1.0</td>
<td>Add element declaration for ftMatchOptions.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-07-14</td>
<td>E.2 XQueryX stylesheet for XQuery and XPath Full Text 1.0</td>
<td>Bug fixes.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2009-09-03</td>
<td>Various</td>
<td>Modify match option syntax to avoid conflicts with XQuery and
XQuery Update Facility: change "with" to "using" and "without" to
"using no", plus adding "using" before other options for
consistency. Change 'ftcontains' to 'contains text'. Bugzilla bugs
7247 and 7271.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2009-09-18</td>
<td>E.1 XQueryX representation of XQuery and XPath Full Text
1.0</td>
<td>Fixed grammar within a comment re: Bugzilla Bug 7247. Fixed
grammar within comments re: Bugzilla Bug 7271; also fixed
enumeration values and element content names for complex types
ftStemOption, ftThesaurusOption, ftStopwordOption, and
ftWildCardOption re: Bugzilla Bug 7271.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2009-09-18</td>
<td>E.2 XQueryX stylesheet for XQuery and XPath Full Text 1.0</td>
<td>Fixed templates' generated output re: Bugzilla Bug 7247 and
Bugzilla Bug 7271.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2009-09-18</td>
<td>E.3 XQueryX for XQuery and XPath Full Text 1.0 example</td>
<td>Fixed "original" XQuery, the XQueryX code, and the XQuery
resulting from transforming the XQueryC code re: Bugzilla Bug 7247
and Bugzilla Bug 7271.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-10-10</td>
<td>Sections 3.4.* and Appendix A</td>
<td>Change match option syntax to resolve bug 7271.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-10-10</td>
<td>Section 2.2.1 and Appendix A</td>
<td>Change FTContainsExpr syntax to resolve bug 7247.</td>
</tr>
<tr>
<td>Pat Case</td>
<td>2009-11-10</td>
<td>Section 4.2.5.1 Types</td>
<td>Corrected an error in the FTMatchOptions schema for
FTDiacriticsOption changing case insensitive to diacritics
insensitive and changing case sensitive to diacritics
sensitive</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2009-11-25</td>
<td>Section 2.3.1 and 3.1.1, Appendix A and B</td>
<td>Change syntax of FTWeight: replace RangeExpr with "{" Expr "}".
Change examples and prose accordingly.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2009-12-10</td>
<td>Appendix D, Section 4.2.5</td>
<td>Change semantics schema and functions to replace
"with/without".</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2010-01-25</td>
<td>Section 3.5.3 Mild-Not Selection</td>
<td>Clarify that FTDY0017 is a dynamic error, and not statically
detectable.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2010-05-25</td>
<td>Sections 3.4.3 Thesaurus Option and 3.4.7 Stop Word Option</td>
<td>Resolve [9677] by making it clear the relative URIs for
thesauri and stop word lists should be resolved against the base
URI in the static context.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2010-05-25</td>
<td>Appendix D Error Conditions</td>
<td>Resolve [9681] by replacing the obsolete operators &amp;&amp;
and || by ftand and ftor, respectively.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2010-07-11</td>
<td>Sections 3.4.7 Stop Word Option and 4.2.5.8
FTStopWordOption</td>
<td>Replace wording that said that stop words are "removed from the
search" or "removed from the set of query tokens".</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2010-07-11</td>
<td>Sections 3.4.7 Stop Word Option and I Checklist of
Implementation-Defined Features (Non-Normative)</td>
<td>Change two occurrences of "default stop words" to "stop words
default". (Leftovers from 2009-10-10.)</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2010-07-13</td>
<td>Sections 3.4.7 Stop Word Option and I Checklist of
Implementation-Defined Features (Non-Normative)</td>
<td>Add wording to state that an implementation-defined comparison
is used to determine whether a query token appears in a collection
of stop words.</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2010-09-06</td>
<td>4.2.6.6 FTScope</td>
<td>Fix the 'where' conditions in
fts:ApplyFTScopeDifferentSentence() and
fts:ApplyFTScopeDifferentParagraph(). And tweak the prose following
the former. (See Bugzilla Bug 9448.)</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2010-09-07</td>
<td>E.2 XQueryX stylesheet for XQuery and XPath Full Text 1.0</td>
<td>Fixed two templates (weights and extensions).</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2010-09-13</td>
<td>Section 3.2 (Search Tokens and Phrases), Appendix A (EBNF for
XQuery 1.0 Grammar with Full-Text extensions), and Appendix B (EBNF
for XPath 2.0 Grammar with Full-Text extensions)</td>
<td>In the production for FTWordsValue, change "Literal" to
"StringLiteral"</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2010-09-16</td>
<td>Appendix I (Checklist of Implementation-Defined Features)</td>
<td>Make the list more consistent with the statements of
implementation-defined features in the body of the document.
(Delete 2 items, add 3, reword several, reorder several.)</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2010-11-29</td>
<td>Section 4.2.5.{2,3,7}</td>
<td>Pass $noThesaurusOptions down to fts:lookupThesaurus(). (See
Bugzilla bug 11209.)</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2010-11-29</td>
<td>Section 4.2.5.{1,3,7}</td>
<td>Eliminate the now-redundant $thesaurusLanguage parameter from
fts:lookupThesaurus(), and the now-unnecessary (and not
syntactically justified) "language" attribute from complexType
ftThesaurusOption. (Clean-up after previous change.)</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2010-12-06</td>
<td>Section 3.6</td>
<td>Require FTOrder positional filters to be applied before other
positional filters.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2011-01-04</td>
<td>Sections 2.3.1 and 3.1.1.</td>
<td>In resolution of bug 11582, clarify that the second
"constraint" on scoring algorithms is actually just a specific
consequence of the rules for errors and optimization.</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2011-01-04</td>
<td>Section 3.4.3</td>
<td>In resolution of bug 11444, change the default from "all
levels" to "all levels or to an implementation-defined number of
levels."</td>
</tr>
<tr>
<td>Michael Dyck</td>
<td>2011-02-28</td>
<td>Section 3.4.3 and Appendix I.</td>
<td>Introduce FTLiteralRange for FTThesaurusID. Clarify
implementation-definedness of levels. (See bugs 11821 and
12036.)</td>
</tr>
<tr>
<td>Mary Holstege</td>
<td>2011-03-01</td>
<td>Section 3</td>
<td>Resolve bug 12057 by clarifying what the sample tokenization is
for the examples in the specification.</td>
</tr>
<tr>
<td>Jim Melton</td>
<td>2011-03-08</td>
<td>Appendix E</td>
<td>Updated Full Text XQueryX schemas and stylesheet for bugs 11821
and 12036</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>