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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>olap4j Specification</title>
<style type="text/css">
CODE {
font-family: 'courier new', monospace;
font-size: 80%;
font-weight: bold;
color: maroon;
}
A.javadoc {
font-family: 'courier new', monospace;
font-size: 80%;
font-weight: bold;
color: maroon;
text-decoration: underline;
}
A:hover.javadoc, A:active.javadoc {
color: black;
text-decoration: underline;
}
DIV.code {
font-family: 'courier new', monospace;
font-size: 80%;
font-weight: bold;
color: maroon;
background-color: #e0e0e0;
margin-left: 20;
margin-right: 20;
border-style: solid;
border: solid #000000 1px;
border-width: 1px;
padding: 4px;
}
DIV.note {
background-color: #e0e0e0;
margin-left: 20;
margin-right: 20;
border-style: solid;
border: solid #000000 1px;
border-width: 1px;
padding: 4px;
}
IMG.std {
border: solid #000000 1px;
border-color: #000000;
margin-left: 20;
margin-right: 20;
}
TABLE {
margin-left: 20;
margin-right: 20;
border: solid #000000 1px;
border-color:#888888;
border-collapse: collapse;
cellspacing:1;
cellpadding:1;
}
TABLE TH {
border: solid #000000 1px;
font-size:100%;
text-align:left;
vertical-align:top;
background-color:#d0d0d0;
}
TABLE TD {
border: solid #808080 1px;
font-size:100%;
vertical-align:top;
}
</style></head><body>
<h1>olap4j Specification</h1>
<p>Authors: Julian Hyde, Barry Klawans<br/>
Version: 1.0<br/>
History: see <a href="https://github.com/olap4j/olap4j/commits/master/doc/olap4j_fs.html">log</a><br/>
Last modified: April 9<sup>th</sup>, 2011.</p>
<hr noshade="noshade">
<h2><a name="Contents">Contents</a></h2>
<ol>
<li><a href="#Introduction">Introduction</a>
<ol>
<li><a href="#A_brief_history_of_OLAP_standards">A brief history
of OLAP standards</a></li>
<li><a href="#Overview_of_olap4j">Overview of olap4j</a></li>
<li><a href="#Relationship_to_other_standards">Relationship to
other standards</a>
<ol>
<li><a href="#olap4j_and_XMLA">olap4j and XML/A</a></li>
<li><a href="#olap4j_is_built_on_other_standards">olap4j is
built on other standards</a></li>
</ol>
</li>
<li><a href="#Benefits_of_a_standard_Java_API_for_OLAP">Benefits
of a standard Java API for OLAP</a></li>
<li><a href="#Architecture_of_olap4j">Architecture of olap4j</a></li>
<li><a href="#Compatibility">Compatibility</a></li>
<li><a href="#Compliance_levels">Compliance levels</a></li>
</ol>
</li>
<li><a href="#Components_of_the_API">Components of the API</a>
<ol>
<li><a href="#Driver_management">Driver management</a>
<ol>
<li><a href="#The_Driver_class">The Driver class</a></li>
<li><a href="#The_DriverManager_class">The DriverManager class</a></li>
<li><a href="#The_DataSource_interface">The DataSource
interface</a></li>
<li><a href="#The_OlapDataSource_interface">The
OlapDataSource interface</a></li>
<li><a href="#The_OlapException_class">The OlapException class</a></li>
</ol>
</li>
<li><a href="#Connections">Connections</a>
<ol>
<li><a href="#Connection_pooling">Connection pooling</a></li>
<li><a href="#OlapConnection">The OlapConnection interface</a></li>
<li><a href="#The_OlapWrapper_interface">The OlapWrapper
interface</a></li>
<li><a href="#The_OlapDatabaseMetaData_interface">The
OlapDatabaseMetaData interface</a></li>
</ol>
</li>
<li><a href="#Statements">Statements</a>
<ol>
<li><a href="#OlapStatement">The OlapStatement interface</a></li>
<li><a href="#PreparedOlapStatement">The
PreparedOlapStatement interface</a></li>
<li><a href="#OlapParameterMetaData">The
OlapParameterMetaData interface</a></li>
<li><a href="#CellSet">The CellSet interface</a></li>
<li><a href="#CellSetAxis">The CellSetAxis interface</a></li>
<li><a href="#The_Axis_enum">The Axis enum</a></li>
<li><a href="#The_CellSetAxisMetaData_interface">The
CellSetAxisMetaData interface</a></li>
<li><a href="#The_Position_interface">The Position interface</a></li>
<li><a href="#Cell">The Cell interface</a></li>
<li><a href="#The_CellSetMetaData_interface">The
CellSetMetaData interface</a></li>
</ol>
</li>
<li><a href="#MDX_object_model">MDX parse tree model</a>
<ol>
<li><a href="#The_ParseTreeWriter_class">The ParseTreeWriter
class</a></li>
</ol>
</li>
<li><a href="#MDX_parser">MDX parser</a></li>
<li><a href="#MDX_type_model">MDX type model</a></li>
<li><a href="#Metadata">Metadata</a>
<ol>
<li><a href="#Access_control">Access control</a></li>
<li><a href="#Metadata_objects">Metadata objects</a>
<ol>
<li><a href="#MetadataElement">The MetadataElement
interface</a></li>
<li><a href="#Database">The Database interface</a></li>
<li><a href="#Catalog">The Catalog interface</a></li>
<li><a href="#Schema">The Schema interface</a></li>
<li><a href="#Cube">The Cube interface</a></li>
<li><a href="#Dimension">The Dimension interface</a></li>
<li><a href="#Hierarchy">The Hierarchy interface</a></li>
<li><a href="#Level">The Level interface</a></li>
<li><a href="#Member">The Member interface</a></li>
<li><a href="#Measure">The Measure interface</a></li>
<li><a href="#Property">The Property interface</a></li>
<li><a href="#NamedSet">The NamedSet interface</a></li>
<li><a href="#Datatype">The Datatype enum</a></li>
</ol>
</li>
<li> <a href="#The_OlapDatabaseMetaData_interface_and_methods_which_return_schema_rowsets">The
OlapDatabaseMetaData interface, and schema result sets</a>
<ol>
<li><a href="#getDatabases">The getDatabases method</a></li>
<li><a href="#getDatabaseProperties">The
getDatabaseProperties method</a></li>
<li><a href="#getLiterals">The getLiterals method</a></li>
<li><a href="#getCubes">The getCubes method</a></li>
<li><a href="#getDimensions">The getDimensions method</a></li>
<li><a href="#getFunctions">The getFunctions method</a></li>
<li><a href="#getHierarchies">The getHierarchies method</a></li>
<li><a href="#getLevels">The getLevels method</a></li>
<li><a href="#getMeasures">The getMeasures method</a></li>
<li><a href="#getMembers">The getMembers method</a></li>
<li><a href="#getProperties">The getProperties method</a></li>
<li><a href="#getSets">The getSets method</a></li>
</ol>
</li>
<li><a href="#Other_methods">Other methods</a></li>
</ol>
</li>
<li><a href="#Transform">Transform</a>
<ol>
<li><a href="#Query_Model_Details">Query model details</a></li>
<li><a href="#Navigation_Actions">Navigation actions</a>
<ol>
<li><a href="#Slicing_navigations">Slicing navigations</a></li>
<li><a href="#Restructuring_navigations">Restructuring
navigations</a></li>
<li><a href="#Drilling_navigations">Drilling navigations</a></li>
<li><a href="#Scoping_navigations">Scoping navigations</a></li>
</ol>
</li>
<li><a href="#Open_Nav_Issues">Open issues</a></li>
</ol>
</li>
<li><a href="#Layout">Layout</a></li>
<li><a href="#Scenarios">Scenarios</a></li>
<li><a href="#Notifications">Notifications</a></li>
<li><a href="#Drill_through">Drill through</a></li>
</ol>
</li>
<li><a href="#Other_topics">Other topics</a>
<ol>
<li><a href="#Internationalization">Internationalization</a></li>
<li><a href="#Concurrency_and_thread-safety">Concurrency and
thread-safety</a></li>
<li><a href="#Canceling_statements">Canceling statements</a></li>
</ol>
</li>
<li><a href="#Other_components">Other components</a>
<ol>
<li><a href="#Test_suite">Test suite</a></li>
<li><a href="#XML/A_provider">XML/A provider</a></li>
</ol>
</li>
<li><a href="#Non-functionality">Non-functionality</a></li>
<li><a href="#Related_projects">Related projects</a>
<ol>
<li><a href="#Mondrian_provider">Mondrian provider</a></li>
<li><a href="#XMLA_provider_project">XML for Analysis provider</a></li>
<li><a href="#Other_data_sources">Other data sources</a></li>
</ol>
</li>
<li><a href="#Opportunities_for_specification">Appendix A.
Opportunities for specification</a></li>
<li><a href="#Feedback">Appendix B. Feedback</a></li>
<li><a href="#Open_issues">Appendix C. Open issues</a></li>
<li><a href="#Miscellaneous">Appendix D. Miscellaneous</a></li>
<li><a href="#References">Appendix E. References</a></li>
<li><a href="#Change_log">Appendix F. Change log</a></li>
</ol>
<h2>1. <a name="Introduction">Introduction</a></h2>
<p>olap4j is an open Java API for building OLAP applications.</p>
<p>In essence, olap4j is to multidimensional data what JDBC is for relational data.
olap4j has a similar programming model to JDBC, shares some of its core classes,
and has many of the same advantages. You can write an OLAP application in Java
for one
server (say Mondrian) and easily switch it to another (say Microsoft Analysis
Services, accessed via XML for Analysis).</p>
<p>However, creating a standard OLAP API for Java is a contentious issue. To
understand why, it helps to understand the history of OLAP standards.</p>
<h3>1.1. <a name="A_brief_history_of_OLAP_standards">A brief history of OLAP standards</a></h3>
<p>History is strewn with attempts to create a standard OLAP API. First, the OLAP council's
MDAPI (in two versions), then the JOLAP API emerged from Sun's Java Community
Process. These all failed, it seems, because at some point during the
committee stages, all of the OLAP server vendors concerned lost
interest in releasing an implementation of the standard. The standards were
large and complex, and no
user-interface provider stepped forward with a UI which worked with multiple
back-ends.</p>
<p>Meanwhile, Microsoft introduced OLE DB for OLAP (which works only between
Windows clients and servers), and then XML/A (XML for Analysis, a web-services
API). These standards were more successful, for a variety of reasons. First,
since the standards (OLE DB for OLAP in particular) were mainly driven by one
vendor, they were not a compromise attempting to encompass the functionality of
several products. Second, there was a ready reference implementation, and
Microsoft saw to it that there were sufficient OLAP clients to make these
standards viable forums for competition and innovation. Third, there was the MDX
query language. A query language is easier to explain than an API. It leaves
unsolved the problem of how to construct queries to answer business questions,
but application developers could solve that problem by embedding one of the
off-the-shelf OLAP clients.</p>
<p>The Open Source community has been developing a taste for OLAP. First there was Mondrian, an open-source OLAP
server; then there was JPivot, a client which first spoke to Mondrian, then also
to XML/A; then there were more OLAP clients, and applications which wanted to
use a particular client, but wanted to talk to a variety of servers; and
companies using a particular OLAP server that wanted to get at it from several
clients. It became clear the open-source OLAP tools needed a standard, and that
standard would probably be suitable for other Java-based OLAP tools.</p>
<h3>1.2. <a name="Overview_of_olap4j">Overview of olap4j</a></h3>
<p>An OLAP application interacts with an OLAP server by means of MDX statements
belonging to connections. The statements are defined in terms of metadata and
validated according to a type system, and some applications are built at a
higher level, manipulating MDX parse trees, and defining complex queries in
terms that a business user can understand. The olap4j API provides all of these
facilities.</p>
<p>At the lowest level, olap4j has a framework for registering <b>drivers</b>,
and managing the lifecycle of <b>connections and statements</b>. olap4j provides
this support by extending the JDBC framework.</p>
<p>A key decision in the design of an OLAP API is whether to include a <b>query
language</b>. Historically, it has been a contentious one. The previous
standards fell into two camps: MDAPI and JOLAP had an API for building queries,
while OLE DB for OLAP and XML/A had the MDX query language. The SQL query
language is an essential component of relational database APIs such as ODBC and
JDBC, and it makes similar sense to base an OLAP API on a query language such as
MDX. But OLAP applications also need to <b>build and transform queries</b> as
the end-user explores the data. So, olap4j embraces both approaches: you can
create a query by parsing an MDX statement, you can build a query by
manipulating an MDX parse tree, and an MDX parser library allows you to easily
convert an MDX string to and from a parse tree.</p>
<p><b>Metadata </b>is at the heart of olap4j. You can browse the cubes,
dimensions, hierarchies, members in an OLAP schema, and an MDX parse tree and
query result are tied back to the same metadata objects. There is also a <b>type
system </b>for describing expressions.</p>
<p>olap4j makes it possible to write an OLAP client without starting from scratch.
In addition to the MDX parser, and operations on the MDX parse tree, there is a
higher-level query model, which includes <b>operations to transform queries</b>
(also called 'navigations'), and facilities to layout multidimensional results as HTML tables.</p>
<p>There are experimental modules in olap4j for <b>scenarios</b> (also
called 'what-if' analysis, or 'writeback') and <b>notifications</b>,
pushed from the server to the client when the data set on the server
changes.</p>
<h3>1.3. <a name="Relationship_to_other_standards">Relationship to
other standards</a></h3>
<h4>1.3.1. <a name="olap4j_and_XMLA">olap4j and XML/A</a></h4>
<p>At this point, you may be saying: what about XML/A? XML/A was here first, is an
open standard, and is supported by a number of servers. Is olap4j an attempt to
replace XML/A? Isn't XML/A good enough for everyone?</p>
<p>olap4j certainly has some similarities with XML/A. Both APIs allow
an application to execute OLAP queries, and to browse the metadata of
an OLAP schema. But XML/A is a
low-level web-services API which leaves a lot of work to the
application writer.
(Witness the fact that the majority of successful XML/A applications
run only on
Windows, where the ADOMD.NET is a high-level interface to XML/A
servers.)
The APIs are mostly complementary, because olap4j can be easily
added to an XML/A back-end, and provides features which would be
difficult or
impossible to provide via a web-services API. These are functions for
parsing MDX, building and transforming MDX query models, and mapping
result sets into
graphical layouts such as pivot tables.</p>
<p>If a web-services based application needs these functions, it can use the
XML/A provider to connect to the underlying data source, execute queries, and
browse metadata, but can still use olap4j's features for MDX parsing, query
models and layout.</p>
<p>The metamodels of olap4j and XML/A are similar. Both contain
schemas, cubes, dimensions, et cetera. Where possible, olap4j uses the
same terminology for entity and attribute names. This simplifies the
job of creating an XML/A driver for olap4j, and also makes possible an
XML/A -to-olap4j bridge (a server that answers XML/A requests by
querying an underlying olap4j data source).</p>
<h4>1.3.2. <a name="olap4j_is_built_on_other_standards">olap4j is
built on other
standards</a></h4>
<p>Where possible, olap4j leverages existing standards. This has several
advantages. First, an end-user familiar with the existing standards can come up
to speed with olap4j quickly. For instance, creating a connection and executing
a statement should be straightforward to anyone familiar with JDBC connections,
statements and result sets work.</p>
<p>If an OLAP server implementor has already implemented a driver for one
standard, then it should be less work to implement an olap4j driver. This
clearly applies to the MDX language (borrowed from XML/A and OLE DB for OLAP).
Implementation schema result sets should be straightforward if the server
already supports XML/A schema rowsets.</p>
<p>If olap4j is sufficiently similar to an existing standard, tools designed for
use with that standard may be applicable to olap4j also. For instance, one goal
of olap4j is that people will be able to use connection-pooling libraries such
as <a href="http://jakarta.apache.org/commons/dbcp/">Jakarta Commons DBCP</a>,
<a href="http://sourceforge.net/projects/c3p0">C3P0</a>. (This presents some
challenges because olap4j extends some of the JDBC interfaces, but we hope to
solve them.)</p>
<p>Lastly, reusing an existing standard is less work for the authors of the new
standard!</p>
<p>Sometimes the standards conflict. ADOMD exposes its metadata through an
object model, whereas JDBC and XML/A expose metadata relationally, via what
XML/A calls rowsets and what we and JDBC call result sets. In this case, we
chose to do both, because of the diversity of needs of olap4j clients. Metadata
objects allow you to integrate query results with metadata using much fewer
code: positions can reference members, and you can navigate from a member to its
hierarchy, and so forth. Likewise, metadata objects can be used in building MDX
parse trees. But if a client tool wants to maintain its own metadata cache,
schema rowsets are more flexible and efficient.</p>
<h3>1.4. <a name="Benefits_of_a_standard_Java_API_for_OLAP">Benefits of a standard Java API for OLAP</a></h3>
<p>Once the olap4j standard is in place, we can expect that the familiar
benefits of an open standard will emerge: a larger variety of tools, better
tools, and more price/feature competition between OLAP servers. These benefits
follow because if a developer of OLAP tool can reach a larger audience, there is greater
incentive to build new tools.</p>
<p>Eventually there will be olap4j providers for most OLAP servers. The server
vendors will initially have little incentive to embrace a standard which will
introduce competition into their market, but eventually the wealth of tools will
compel them to write a provider; or, more likely, will tempt third-party or
open-source efforts to build providers for their servers.</p>
<h3>1.5. <a name="Architecture_of_olap4j">Architecture of olap4j</a></h3>
<p>The following diagram shows how olap4j fits into an enterprise architecture.</p>
<img class="std" alt="olap4j architecture" src="olap4j-arch.png"/>
<h3>1.6. <a name="Compatibility">Compatibility</a></h3>
<p>olap4j requires JDK 1.5 or higher, in particular because it uses the generics
and enum features introduced in JDK 1.5.0.</p>
<p>olap4j works best against JDK 1.6 or higher, because it makes use of the
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/Wrapper.html">java.sql.Wrapper</a>
interface. In earlier Java versions, the same functionality
is available by casting objects to the built-in
<a class="javadoc" href="api/org/olap4j/OlapWrapper.html">OlapWrapper</a> interface.</p>
<p>JDK 1.4 compatibility will be available on demand, using the
<a href="http://retroweaver.sourceforge.net/">Retroweaver</a> utility. This will
consist of a retrowoven JAR file, <code>olap4j-jdk1.4.jar</code> and
retroweaver's runtime library <code>retroweaver-rt-1.2.4.jar</code>. (See
<a href="#JDK">design note</a>.)</p>
<p>olap4j's JDBC support is consistent with JDBC version 3.0 (which was introduced in JDK 1.4 and
is also in JDK 1.5) and also with JDBC version 4.0 (introduced in JDK 1.6).</p>
<h3>1.7. <a name="Compliance_levels">Compliance levels</a></h3>
<p>There are two compliance levels to which a driver can support olap4j. olap4j
is a rich specification, and it takes a considerable effort to implement it
fully, but applications can still be built on a driver which only implements the
core parts of the specification. The lower level allows a vendor to a subset of
the specification without the significant investment of a fully-compliant
driver.</p>
<p>The compliance levels are as follows:</p>
<ul>
<li><b>olap4j Core Compliance</b>. To comply with the olap4j core
specification, it must implement all classes in the <code>org.olap4j</code>
package, with the exception of the <code>get<i>Xxxx</i>s()</code> methods in
<a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html">
OlapDatabaseMetaData</a> that return result sets, and all classes in the
<code>org.olap4j.metadata</code> package. The OLAP server must also
implement the fundamental features of the MDX language (see below).</li>
<li><b>olap4j Full Compliance</b>. To fully comply with the olap4j
specification, a driver must comply with the core requirements, plus
implement the
<a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html">
OlapDatabaseMetaData</a>.<code>get<i>Xxxx</i>s()</code> methods, plus
implements an MDX parser and validator (<code>org.olap4j.mdx.parser</code>
package).</li>
</ul>
<h4><a name="MDX_language_compliance">MDX language compliance</a></h4>
<p>All olap4j drivers must implement the fundamental features of the
MDX language, but olap4j compliance levels do not imply a particular
degree of support for the MDX language.</p>
<p>The fundamental features of MDX are:</p>
<ul>
<li>Queries of the form "SELECT ... FROM ... WHERE".</li>
<li>The set constructor operator { ... }.</li>
<li>Set functions CrossJoin(<Set>, <Set>), Filter(<Set>, <Condition>),
Order(<Set>, <Expression>), Hierarchize(<Set>).</li>
<li>Navigation operators <Member>.Children, <Level>.Members
<Hierarchy>.Members, <Member>.Parent, Level, Hierarchy, Dimension</li>
<li>Aggregation functions Aggregate</li>
<li>Basic arithmetic and logical operators</li>
</ul>
<p align="left">Of course, a provider may implement a larger subset of MDX, and
most do. A provider can describe its MDX compliance level by describing the
additional features it supports (e.g. WITH MEMBER, WITH SET, NON EMPTY, and
HAVING clauses in queries; virtual cubes; and calculated members and sets
defined against cubes) and additional functions and operators implemented.</p>
<h2>2. <a name="Components_of_the_API">Components of the API</a></h2>
<p>We now describe the olap4j API in more detail, by breaking it down into a set
of functional areas.</p>
<img class="std" alt="olap4j components" src="olap4j-comp.png" width="740" height="692">
<h3>2.1. <a name="Driver_management">Driver management</a></h3>
<p>olap4j shares JDBC's driver management facilities. This allows olap4j clients
to leverage the support for JDBC such as
connection pooling, driver registration.</p>
<p>Classes:</p>
<ul>
<li><a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/Driver.html">java.sql.Driver</a></li>
<li> <a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/DriverManager.html">java.sql.DriverManager</a></li>
<li> <a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/javax/sql/DataSource.html">javax.sql.DataSource</a></li>
</ul>
<h4>2.1.1. <a name="The_Driver_class">The Driver class</a></h4>
<p>Same functionality as JDBC.</p>
<p>Here is an example of registering an olap4j driver:</p>
<div class="code">Class.forName("mondrian.olap4j.MondrianOlap4jDriver");</div>
<p>Note that this is the same as you would write for any JDBC driver.
From JDBC 4.0 (JDK 1.6) onwards, compliant JDBC drivers register
themselves
automatically by creating an entry in their JAR file's
<code>META-INF/services/java.sql.Driver</code> file.
Compliant olap4j drivers register themselves in the same way.</p>
<h4>2.1.2. <a name="The_DriverManager_class">The DriverManager class</a></h4>
<p>Same functionality as JDBC.</p>
<h4>2.1.3. <a name="The_DataSource_interface">The DataSource interface</a></h4>
<p>Same functionality as JDBC.</p>
<p>See also: <a href="#Database">Database</a>.</p>
<h4>2.1.4. <a name="The_OlapDataSource_interface">The OlapDataSource
interface</a></h4>
<p>Extension to <code>DataSource</code> that returns <code>OlapConnection</code>
objects rather than mere <code>java.sql.Connection</code> objects.</p>
<h4>2.1.5. <a name="The_OlapException_class">The OlapException class</a></h4>
<p><a class="javadoc" href="api/org/olap4j/OlapException.html">OlapException</a>
(extends
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/SQLException.html">java.sql.SQLException</a>)
describes an error which occurred while accessing an OLAP server.</p>
<p>Since olap4j extends JDBC, it is natural that OlapException should
extend JDBC's
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/SQLException.html">SQLException</a>.
The implementation by an olap4j driver of a JDBC method which is declared to throw a SQLException may,
if the driver chooses, throw instead an OlapException.</p>
<p>OlapException provides some additional information to help an OLAP
client identify the location of the error. The <code>context</code> is
the Cell or Position object where the error occurred. The <code>region</code>
is an object representing the textual region in the MDX statement.</p>
<p>Methods:</p>
<ul>
<li><code>Region getRegion()</code></li>
<li><code>void setRegion(Region region)</code></li>
<li><code>Object getContext()</code></li>
<li><code>void setContext(Object context)</code></li>
</ul>
<h3>2.2. <a name="Connections">Connections</a></h3>
<p>olap4j's connection management component manages connections to the OLAP server,
statements.</p>
<p>Where possible, olap4j uses JDBC's session management facility. olap4j defines extensions to
JDBC interfaces Connection and Statement.</p>
<p>For example, the following code registers a driver, connects to Mondrian and
executes a statement:</p>
<div class="code">
import java.sql.*;<br/>
import org.olap4j.*;<br/>
<br/>
Class.forName("mondrian.olap4j.MondrianOlap4jDriver");<br/>
Connection connection =<br/>
DriverManager.getConnection(<br/>
"jdbc:mondrian:Jdbc=jdbc:odbc:MondrianFoodMart;"<br/>
+ "Catalog=/WEB-INF/queries/FoodMart.xml;"<br/>
+ "Role='California manager'");<br/>
OlapWrapper wrapper = (OlapWrapper) connection;<br/>
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);<br/>
OlapStatement statement = olapConnection.createStatement();<br/>
<br/>
CellSet cellSet =<br/>
statement.executeOlapQuery(<br/>
"SELECT {[Measures].[Unit
Sales]} ON COLUMNS,\n"<br/>
+ " {[Product].Members} ON
ROWS\n"<br/>
+ "FROM [Sales]");</div>
<p>Here's a piece of code to connect to Microsoft SQL Server Analysis
Services™ (MSAS) via XML/A. Note that except for the driver class and connect
string, the code is identical.</p>
<div class="code">
import java.sql.*;<br/>
import org.olap4j.*;<br/>
<br/>
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");<br/>
Connection connection =<br/>
DriverManager.getConnection(<br/>
"jdbc:xmla:Server=http://localhost/xmla/msxisapi.dll"<br/>
OlapWrapper wrapper = (OlapWrapper) connection;<br/>
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);<br/>
OlapStatement statement = connection.createStatement();<br/>
<br/>
CellSet cellSet =<br/>
statement.executeOlapQuery(<br/>
"SELECT {[Measures].[Unit
Sales]} ON COLUMNS,\n"<br/> + " {[Product].Members}
ON ROWS\n"<br/> + "FROM [Sales]");</div>
<p>In the above examples, a statement was created from a string. As we shall
see, a statement can also be created from an MDX parse tree.</p>
<h4>2.2.1. <a name="Connection_pooling">Connection pooling</a></h4>
<p>Look again at the code samples in the previous section. One would
expect that it would be safe to downcast the result of a factory
method to the desired result. For example, if you invoke an <code>OlapConnection</code>'s
<code>createStatement()</code> method, the result should be an <code>
OlapStatement</code>.</p>
<p>But if you you are using a connection-pooling
library (common examples of which include <a href="http://jakarta.apache.org/commons/dbcp/">Jakarta Commons DBCP</a>
and
<a href="http://sourceforge.net/projects/c3p0">C3P0</a>), this is not so. Every
connection-pooling library tracks connections by wrapping them in another class,
and this class will implement <code>java.sql.Connection</code> but not <code>
OlapConnection</code>. To access methods of the <code>OlapConnection</code>, the
client application must first strip away the wrapper object.</p>
<p>If you are using a connection-pooling library, olap4j provides the
<a class="javadoc" href="api/org/olap4j/OlapWrapper.html">OlapWrapper</a>
interface with the method method <code>unwrap(Class)</code> to access the object underneath
the wrapped
connection. For instance, if you were using DBCP, you could define and use a
pooling olap4j data source as follows:</p>
<div class="code">import java.sql.*;<br/>
import org.olap4j.*;<br/>
import org.apache.commons.dbcp.*;<br/>
<br/>
GenericObjectPool connectionPool =<br/>
new GenericObjectPool(null);<br/>
ConnectionFactory connectionFactory =<br/>
new DriverManagerConnectionFactory(<br/>
"jdbc:mondrian:Jdbc=jdbc:odbc:MondrianFoodMart;"<br/>
+ "Catalog=/WEB-INF/queries/FoodMart.xml;"<br/>
+ "Role='California manager'",<br/>
new Properties());<br/>
PoolableConnectionFactory poolableConnectionFactory =<br/>
new PoolableConnectionFactory(<br/>
connectionFactory, connectionPool,
null, null, false, true);<br/>
DataSource dataSource =<br/>
new PoolingDataSource(connectionPool);<br/>
<br/>
// and some time later...<br/>
<br/>
Connection connection = dataSource.getConnection();<br/>
OlapWrapper wrapper = (OlapWrapper) connection;<br/>
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);<br/>
OlapStatement statement = olapConnection.createStatement();</div>
<p>The <a class="javadoc" href="api/org/olap4j/OlapStatement.html">OlapStatement</a>,
<a class="javadoc" href="api/org/olap4j/PreparedOlapStatement.html">PreparedOlapStatement</a>,
and <a class="javadoc" href="api/org/olap4j/CellSet.html">CellSet</a>
interfaces also extend <code>OlapWrapper</code>, and can be accessed similarly.</p>
<p>If connection pooling is not being used, then the object returned by the
driver will be an <code>OlapConnection</code> and will therefore trivially
implement <code>OlapWrapper</code> (because the <code>OlapConnection</code>
interface extends <code>OlapWrapper</code>). If connection pooling is being
used, the code will work provided that the implementer of the connection pool
has ensured that the pooled connection object implements the <code>OlapWrapper</code>
interface. This is a minor change to the connection pool, and we hope that
popular connection pools will utilize this method in the near future.</p>
<p>If you are using JDBC 4.0 (which is part of JDK 1.6 and later), the
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/Connection.html">java.sql.Connection</a>
class implements the
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/Wrapper.html">java.sql.Wrapper</a>
interface introduced in JDBC 4.0, so the code can be simplified:</p>
<div class="code">Connection connection = DriverManager.getConnection();<br/>
OlapConnection olapConnection = connection.unwrap(OlapConnection.class);<br/>
OlapStatement statement = olapConnection.createStatement();</div>
<p>Note that the <code>OlapWrapper</code> interface is not needed. This code
will work with any JDBC 4.0-compliant connection pool.</p>
<p>Package name: <a class="javadoc" href="api/org/olap4j/package-summary.html">org.olap4j</a></p>
<h4>2.2.2. <a name="OlapConnection">The OlapConnection interface</a></h4>
<p>
<a class="javadoc" href="api/org/olap4j/OlapConnection.html">OlapConnection</a>
(extends
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/Connection.html">java.sql.Connection</a>)
is a
connection to an OLAP data source.</p>
<p>
Methods:</p>
<ul>
<li><code>String getDatabase()</code> // returns the name of the current database</li>
<li><code>void setDatabase(String databaseName)</code> // sets this connection's current database</li>
<li><code>Database getOlapDatabase()</code> // returns the current database</li>
<li><code>NamedList<Database> getOlapDatabases()</code> // returns a list of all databases</li>
<li><code>String getCatalog()</code> // returns the name of the current catalog (inherited from Connection)</li>
<li><code>void setCatalog(String catalogName)</code> // sets this connection's current catalog</li>
<li><code>Catalog getOlapCatalog()</code> // returns the current catalog object</li>
<li><code>NamedList<Catalog> getOlapCatalogs()</code> // returns a list of all catalogs</li>
<li><code>String getSchema()</code> // returns the name of the current schema</li>
<li><code>void setSchema(String schemaName)</code> // sets this connection's current schema</li>
<li><code>Schema getOlapSchema()</code> // returns the current schema object</li>
<li><code>NamedList<Schema> getOlapSchemas()</code> // returns a list of all schemas</li>
<li><code>OlapDatabaseMetaData getMetaData()</code> // returns an object that contains metadata about the database</li>
<li><code>Locale getLocale()</code> // returns this connection's locale</li>
<li><code>void setLocale(Locale locale)</code> // sets this connection's locale</li>
<li><code>void setRoleName(String roleName)</code> // sets the name of the role in which access-control context this connection will execute queries</li>
<li><code>String getRoleName()</code> // returns the name of the role in which access-control context this connection will execute queries</li>
<li><code>List<String> getAvailableRoleNames()</code> // returns a list of role names available in this connection</li>
<li><code>PreparedOlapStatement prepareOlapStatement(String mdx)</code> // prepares a statement</li>
<li><code>createStatement createStatement(String mdx)</code> // creates a statement (overrides Connection method)</li>
<li><code>Scenario createScenario()</code> // creates a scenario</li>
<li><code>void setScenario(Scenario scenario)</code> // sets the current scenario for this connection</li>
<li><code>Scenario getScenario()</code> // returns the current scenario for this connection</li>
<li><code>MdxParserFactory getParserFactory()</code> // returns a factory to create MDX parsers</li>
</ul>
<h4>2.2.3. <a name="The_OlapWrapper_interface">The OlapWrapper interface</a></h4>
<p>
<a class="javadoc" href="api/org/olap4j/OlapWrapper.html">OlapWrapper</a>
provides the ability to retrieve a delegate instance when the instance in
question is in fact a proxy class.</p>
<p>
<code>OlapWrapper</code> duplicates the functionality of the
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/Wrapper.html">java.sql.Wrapper</a>
interface (introduced in JDBC 4.0), making this functionality available
to olap4j clients running in a JDBC 3.0 environment. For code which
will run only on JDBC 4.0 and later, <code>Wrapper</code> can be used,
and <code>OlapWrapper</code> can be ignored.</p>
<p>Methods:</p>
<ul>
<li><code>boolean isWrapperFor(Class<?> iface)</code> //
returns true if this either implements the interface argument or is
directly or indirectly a wrapper for an object that does</li>
<li><code><T> T unwrap(Class<T>)</code> // returns an
object that implements the given interface</li>
</ul>
<h4>2.2.4. <a name="The_OlapDatabaseMetaData_interface">The OlapDatabaseMetaData interface</a></h4>
<p><a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html">
OlapDatabaseMetaData</a> (extends <a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html">
java.sql.DatabaseMetaData</a>) provides information about an OLAP
database.</p>
<p>Just as <a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html">
DatabaseMetaData</a> provides a method to query the each kind of
metadata element in a relational database (tables, columns, and so
forth), returning the rows as a
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html">ResultSet</a>,
<code>OlapDatabaseMetaData</code> provides methods for OLAP metadata
elements (cubes, dimensions, hierarchies, levels, members, measures).</p>
<p>These methods are described in the section "<a href="#The_OlapDatabaseMetaData_interface_and_methods_which_return_schema_rowsets">The
<code>OlapDatabaseMetaData</code> interface and methods which return
schema rowsets</a>".</p>
<h3>2.3. <a name="Statements">Statements</a></h3>
<h4>2.3.1. <a name="OlapStatement">The OlapStatement interface</a></h4>
<p><a class="javadoc" href="api/org/olap4j/OlapStatement.html">OlapStatement</a>
(extends
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/Statement.html">java.sql.Statement</a>)
is an object used to execute a static MDX statement and return the
result it
produces.</p>
<p>It has methods to execute an MDX query represented both as a string and as a
parse tree.</p>
<p>Methods:</p>
<ul>
<li><code>CellSet executeOlapQuery(String mdx)</code> // executes an MDX statement</li>
<li><code>CellSet executeOlapQuery(SelectNode selectNode)</code> // executes an MDX statement expressed as a parse tree</li>
<li><code>OlapConnection getConnection()</code> // returns the current connection (overrides Statement method)</li>
<li><code>addListener(Granularity, CellSetListener)</code> // adds a listener to be notified of events to CellSets created by this statement</li>
</ul>
<h4>2.3.2. <a name="PreparedOlapStatement">The PreparedOlapStatement interface</a></h4>
<p><a class="javadoc" href="api/org/olap4j/PreparedOlapStatement.html">PreparedOlapStatement</a>
(extends
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html">java.sql.PreparedStatement</a>)
represents a precompiled MDX statement.</p>
<p>An MDX statement is precompiled and stored in a <code>PreparedOlapStatement</code>
object. This object can then be used to efficiently execute this statement
multiple times.</p>
<p>The method
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html#getParameterMetaData%28%29">PreparedStatement.getParameterMetaData()</a>
returns a description of the
parameters, as in JDBC. The result is an OlapParameterMetaData.</p>
<p>To set values of parameters, use the <code>set<i>Type</i>(int, <i>type</i>)</code>
methods. If a parameter is a member, use the <code>setObject(int, Object)</code>
method; throws an exception if the object is not a member, or is a member of the
wrong hierarchy.</p>
<p>Unlike JDBC, it is not necessary to assign a value to every parameter. This
is because OLAP parameters have a default value. Parameters have their default
value until they are set, and then retain their new values for each subsequent
execution of this <code>PreparedOlapStatement</code>.</p>
<p>The
<a class="javadoc" href="api/org/olap4j/PreparedOlapStatement.html#getCube%28%29">getCube()</a>
method returns the cube (or virtual cube) the prepared statement
relates to.</p>
<p>Methods:</p>
<ul>
<li><code>CellSet executeQuery()</code></li>
<li><code>Cube getCube()</code></li>
<li><code>CellSetMetaData getMetaData()</code></li>
<li><code>OlapParameterMetaData getParameterMetaData()</code></li>
</ul>
<h4>2.3.3. <a name="OlapParameterMetaData">The OlapParameterMetaData interface</a></h4>
<p><a class="javadoc" href="api/org/olap4j/OlapParameterMetaData.html">OlapParameterMetaData</a>
(extends
<a class="javadoc"
href="http://download.oracle.com/javase/6/docs/api/java/sql/ParameterMetaData.html">java.sql.ParameterMetaData</a>)
describes parameters of a <code> PreparedOlapStatement</code>. Note that regular
JDBC parameters (bind variables) have ordinals but not names; olap4j parameters
have both ordinals and names.</p>
<p>Additional methods:</p>
<ul>
<li><code>String getParameterName(int param)</code> // returns the designated parameter's name</li>
<li><code>getParameterOlapType(int param)</code> // returns the designated parameter's OLAP type</li>
</ul>
<h4>2.3.4. <a name="CellSet">The CellSet interface</a></h4>
<p><a class="javadoc" href="api/org/olap4j/CellSet.html">CellSet</a>
(extends
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html">java.sql.ResultSet</a>)
is the result of executing an <a class="javadoc" href="api/org/olap4j/OlapStatement.html">OlapStatement</a>
or <a class="javadoc" href="api/org/olap4j/PreparedOlapStatement.html">PreparedOlapStatement</a>.</p>
<p>It extends <code>ResultSet</code>, but since most of these methods are concerned with rows
and columns, only a few of the base class's methods are applicable. The following methods
are applicable:</p>
<ul>
<li><a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#clearWarnings%28%29">clearWarnings()</a></li>
<li><a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#close%28%29">close()</a></li>
<li><a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#getConcurrency%28%29">getConcurrency()</a></li>
<li><a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#getStatement%28%29">getStatement()</a></li>
<li><a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#getType%28%29">getType()</a></li>
<li><a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#getWarnings%28%29">getWarnings()</a></li>
</ul>
<p>Additional methods to retrieve the axes of the multidimensional
result:</p>
<ul>
<li><code>List<CellSetAxis> getAxes()</code></li>
<li><code>CellSetAxis getFilterAxis()</code></li>
<li><code>Cell getCell(List<Integer> coordinates)</code></li>
</ul>
<p>An OlapStatement can have no more than one CellSet open. Closing an
OlapStatement, or preparing or executing a new query, implicitly closes
any previous CellSet.</p>
<h4>2.3.5. <a name="CellSetAxis">The CellSetAxis interface</a></h4>
<p>A <a class="javadoc" href="api/org/olap4j/CellSetAxis.html">CellSetAxis</a> is
an axis belonging to a <a class="javadoc" href="api/org/olap4j/CellSet.html">CellSet</a>.</p>
<p>A cell set has the same number of axes as the MDX statement which was
executed to produce it. For example, a typical cell set, resulting from an MDX
query with COLUMNS and ROWS expressions is two-dimensional, and therefore has
two axes.</p>
<p>Each axis is an ordered collection of members or tuples. Each member or tuple
on an axis is called a <a class="javadoc" href="api/org/olap4j/Position.html">Position</a>.</p>
<p>The positions on the cell set axis can be accessed sequentially or
random-access. Use the <code>List<Position> getPositions()</code> method to
return a list for random access, or the <code>Iterator<Position> iterate()</code>
method to obtain an iterator for sequential access.</p>
<p>Methods:</p>
<ul>
<li><code>Axis getOrdinal()</code></li>
<li><code>CellSet getCellSet()</code></li>
<li><code>CellSetAxisMetaData getAxisMetaData()</code></li>
<li><code>List<Position> getPositions()</code></li>
<li><code>int getPositionCount()</code></li>
<li><code>ListIterator<Position> iterate()</code></li>
</ul>
<h4>2.3.6. <a name="The_Axis_enum">The Axis enum</a></h4>
<p><a class="javadoc" href="api/org/olap4j/Axis.html">Axis</a> is an enumeration of axis types.</p>
<h4>2.3.7. <a name="The_CellSetAxisMetaData_interface">The CellSetAxisMetaData interface</a></h4>
<p>A <a class="javadoc" href="api/org/olap4j/CellSetAxisMetaData.html">
CellSetAxisMetaData</a> is
describes a <a class="javadoc" href="api/org/olap4j/CellSetAxis.html">
CellSetAxis</a>.</p>
<p>Methods:</p>
<ul>
<li><code>Axis getAxis()</code></li>
<li><code>List<Hierarchy> getHierarchies()</code></li>
<li><code>List<Property> getProperties()</code></li>
</ul>
<h4>2.3.8. <a name="The_Position_interface">The Position interface</a></h4>
<p><a class="javadoc" href="api/org/olap4j/Position.html">Position</a>
is a position on a <a class="javadoc" href="api/org/olap4j/CellSetAxis.html">
CellSetAxis</a>.</p>
<p>An axis has a particular dimensionality, that is, a set of one or more
dimensions which will appear on that axis, and every position on that axis will
have a member of each of those dimensions. For example, in the MDX query</p>
<div class="code">
SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} ON COLUMNS,<br/>
CrossJoin(<br/>
{[Gender].Members},<br/>
{[Product].[Food],
[Product].[Drink]}) ON ROWS<br/>
FROM [Sales]</div>
<p>the <code>COLUMNS</code> axis has dimensionality {<code>[Measures]</code>} and the <code>
ROWS</code>
axis has dimensionality {<code>[Gender]</code>, <code>[Product]</code>}. In the result
of this query,</p>
<blockquote>
<table border="1" id="table1" cellpadding="3" summary="Query output">
<tr>
<td bgcolor="#E0E0E0"><b><i>Gender</i></b></td>
<td bgcolor="#E0E0E0"><b><i>Product</i></b></td>
<td bgcolor="#E0E0E0"><b>Unit Sales</b></td>
<td bgcolor="#E0E0E0"><b>Store Sales</b></td>
</tr>
<tr>
<td bgcolor="#E0E0E0"><b>All Gender</b></td>
<td bgcolor="#E0E0E0"><b>Food</b></td>
<td align="right">191,940</td>
<td align="right">409,035.59</td>
</tr>
<tr>
<td bgcolor="#E0E0E0"><b>All Gender</b></td>
<td bgcolor="#E0E0E0"><b>Drink</b></td>
<td align="right">24,597</td>
<td align="right">48,836.21</td>
</tr>
<tr>
<td bgcolor="#E0E0E0"><b>F</b></td>
<td bgcolor="#E0E0E0"><b>Food</b></td>
<td align="right">94,814</td>
<td align="right">203,094.17</td>
</tr>
<tr>
<td bgcolor="#E0E0E0"><b>F</b></td>
<td bgcolor="#E0E0E0"><b>Drink</b></td>
<td align="right">12,202</td>
<td align="right">24,457.37</td>
</tr>
<tr>
<td bgcolor="#E0E0E0"><b>M</b></td>
<td bgcolor="#E0E0E0"><b>Food</b></td>
<td align="right">97,126</td>
<td align="right">205,941.42</td>
</tr>
<tr>
<td bgcolor="#E0E0E0"><b>M</b></td>
<td bgcolor="#E0E0E0"><b>Drink</b></td>
<td align="right">12,395</td>
<td align="right">24,378.84</td>
</tr>
</table>
</blockquote>
<p>each of the 5 positions on the <code>ROWS</code> axis has two members,
consistent with its dimensionality of 2. The <code>COLUMNS</code> axis has two
positions, each with one member.</p>
<p>Methods:</p>
<ul>
<li><code>List<Member> getMembers()</code></li>
<li><code>int getOrdinal()</code></li>
</ul>
<h4>2.3.9. <a name="Cell">The Cell interface</a></h4>
<p>A <a class="javadoc" href="api/org/olap4j/Cell.html">Cell</a> is
a cell returned from an <a class="javadoc" href="api/org/olap4j/CellSet.html">
CellSet</a>.</p>
<p>Methods:</p>
<ul>
<li><code>CellSet getCellSet()</code></li>
<li><code>int getOrdinal()</code></li>
<li><code>List<Integer> getCoordinateList()</code></li>
<li><code>Object getPropertyValue(Property)</code></li>
<li><code>boolean isError()</code></li>
<li><code>boolean isNull()</code></li>
<li><code>boolean isEmpty()</code></li>
<li><code>double getDoubleValue()</code></li>
<li><code>String getErrorText()</code></li>
<li><code>Object getValue()</code></li>
<li><code>String getFormattedValue()</code></li>
</ul>
<h4>2.3.10. <a name="The_CellSetMetaData_interface">The
CellSetMetaData interface</a></h4>
<p><a class="javadoc" href="api/org/olap4j/CellSetMetaData.html">CellSetMetaData</a>
(extends <a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSetMetaData.html">
java.sql.ResultSetMetaData</a>) describes a
<a class="javadoc" href="api/org/olap4j/CellSet.html">CellSet</a>.</p>
<p>Methods:</p>
<ul>
<li><code>NamedList<Property> getCellProperties()</code></li>
<li><code>Cube getCube()</code></li>
<li><code>NamedList<CellSetAxisMetaData> getAxesMetaData()</code></li>
<li><code>CellSetAxisMetaData getSlicerAxisMetaData()</code></li>
</ul>
<h3>2.4. <a name="MDX_object_model">MDX object model</a></h3>
<p>The MDX object model represents a parsed MDX statement.</p>
<p>An MDX object model can be created in three ways:</p>
<ul>
<li>The MDX parser parses an MDX string to create an MDX object model;</li>
<li>Client code programmatically builds a model by calling API methods;</li>
<li>Code in the transform package manipulates the model in response to
graphical operations.</li>
</ul>
<p>An MDX object model can exist in an <i>un-validated</i> and <i>validated</i>
state. In the un-validated state, identifiers and function calls exist as raw
strings, and no type information has been assigned. During validation,
identifiers are resolved to specific MDX objects (members, etc.), type
information is assigned, and if a function exists in several overloaded forms, a
specific instance is chosen based upon the types of its arguments.</p>
<p>Any MDX object model can be serialized to a string containing MDX text.</p>
<p>An MDX object model can be converted into a statement. For example,</p>
<div class="code">
import org.olap.*;<br/>
import org.olap4j.mdx.*;<br/>
<br/>
// Create a query model.<br/>
OlapConnection connection;<br/>
SelectNode query = new SelectNode();<br/>
query.setFrom(<br/>
new IdentifierNode(<br/>
new
IdentifierNode.NameSegment("Sales")));<br/>
query.getAxisList().add(<br/>
new AxisNode(<br/>
null,<br/>
false,<br/>
Axis.ROWS,<br/>
new ArrayList<IdentifierNode>(),<br/>
new CallNode(<br/>
null,<br/>
"{}",<br/>
Syntax.Braces,<br/>
new
IdentifierNode(<br/>
new IdentifierNode(IdentifierNode.ofNames("Measures").getSegmentList()),<br/>
new IdentifierNode(IdentifierNode.ofNames("Unit Sales").getSegmentList()))));<br/>
<br/>
// Create a statement based upon the object model.<br/>
OlapStatement stmt;<br/>
try {<br/>
stmt = connection.createStatement();<br/>
} catch (OlapException e) {<br/>
System.out.println("Validation failed: " + e);<br/>
return;<br/>
}<br/>
<br/>
// Execute the statement.<br/>
CellSet cset;<br/>
try {<br/>
cset = stmt.executeOlapQuery(query);<br/>
} catch (OlapException e) {<br/>
System.out.println("Execution failed: " + e);<br/>
}</div>
<p>Package name: <a class="javadoc" href="api/org/olap4j/mdx/package-summary.html">org.olap4j.mdx</a></p>
<p>Parse tree classes:</p>
<ul>
<li><a class="javadoc" href="api/org/olap4j/mdx/ParseTreeNode.html">ParseTreeNode</a> is a node in a parse tree representing a parsed
MDX statement.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/SelectNode.html">SelectNode</a>
represents a <code>SELECT</code> statement, including <code>FROM</code> and
<code>WHERE</code>
clauses if present.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/AxisNode.html">AxisNode</a>
represents an axis expression.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/CallNode.html">CallNode</a>
represents a call to a function or operator.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/IdentifierNode.html">IdentifierNode</a>
represents an identifier, such as <code>Sales</code> or <code>
[Measures].[Unit Sales]</code>.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/LiteralNode.html">LiteralNode</a>
represents a literal, such as <code>123</code> or <code>"Hello, world!"</code>.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/MemberNode.html">MemberNode</a>
represents a use of a member name in an expression.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/LevelNode.html">LevelNode</a>
represents a use of a level name in an expression.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/HierarchyNode.html">HierarchyNode</a>
represents a use of a hierarchy name in an expression.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/DimensionNode.html">DimensionNode</a>
represents a use of a dimension name in an expression.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/WithMemberNode.html">WithMemberNode</a>
represents a <code>WITH MEMBER</code> clause defining a calculated member.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/WithSetNode.html">WithSetNode</a>
represents a <code>WITH SET</code> clause defining a calculated set.</li>
<li><a class="javadoc" href="api/org/olap4j/mdx/PropertyValueNode.html">PropertyValueNode</a>
represents <i>property = value</i> pair as part of a the declaration of a
calculated member or set.</li>
</ul>
<p>Other classes:</p>
<ul>
<li>enum <a class="javadoc" href="api/org/olap4j/mdx/Syntax.html">Syntax</a>
describes the possible syntaxes for functions and operators (infix, prefix,
function call, and so forth)</li>
</ul>
<h4>2.4.1 <a name="The_ParseTreeWriter_class">The ParseTreeWriter class</a></h4>
<p><a class="javadoc" href="api/org/olap4j/mdx/ParseTreeWriter.html">
ParseTreeWriter</a> is used in conjunction with the
<a class="javadoc" href="api/org/olap4j/mdx/ParseTreeNode.html">
ParseTreeNode.unparse(ParseTreeWriter)</a> method to convert a parse tree into
MDX code.</p>
<h3>2.5. <a name="MDX_parser">MDX parser</a></h3>
<p>Package name: <a class="javadoc" href="api/org/olap4j/type/package-summary.html">org.olap4j.mdx.parser</a></p>
<p>Provides an MDX parser and validator.</p>
<p>Parser and validator are both allocated via a parser factory, which is
obtained from a connection:</p>
<div class="code">
OlapConnection connection;<br/>
MdxParserFactory parserFactory =<br/>
connection.getParserFactory();<br/>
MdxParser parser =<br/>
parserFactory.createMdxParser(connection);<br/>
SelectNode select =<br/>
parser.parseSelect("SELECT FROM [Sales]");<br/>
MdxValidator validator =<br/>
parserFactory.createMdxValidator(connection);<br/>
select = validator.validate(select);</div>
<p>Parser and validator are not thread-safe (they cannot be used by more than
one thread simultaneously) but they can be re-used for multiple statements.</p>
<p>One of the chief purposes of validation is to assign a type to every
expression within the parse tree. Before validation, any node's
<a class="javadoc" href="api/org/olap4j/mdx/ParseTreeNode.html#getType()">
ParseTreeNode.getType()</a> method may throw an exception, but after validation
the <code>getType()</code> method will return a type. Nodes which are not
expressions do not have types, and will always return <code>null</code>.</p>
<p>Classes:</p>
<ul>
<li><a class="javadoc" href="api/org/olap4j/mdx/parser/MdxParserFactory.html">MdxParserFactory</a></li>
<li><a class="javadoc" href="api/org/olap4j/mdx/parser/MdxParser.html">MdxParser</a></li>
<li><a class="javadoc" href="api/org/olap4j/mdx/parser/MdxValidator.html">MdxValidator</a></li>
</ul>
<h3 align="left">2.6. <a name="MDX_type_model">MDX type model</a></h3>
<p>Package name: <a class="javadoc" href="api/org/olap4j/type/package-summary.html">org.olap4j.type</a></p>
<p>Represents the MDX type system.</p>
<p>Here are some examples:</p>
<table summary="Type examples">
<tbody>
<tr>
<th>Expression</th>
<th>Type</th>
</tr>
<tr>
<td><code>1 + 2</code></td>
<td>Integer</td>
</tr>
<tr>
<td><code>[Store]</code></td>
<td>Dimension</td>
</tr>
<tr>
<td><code>[Store].[State]</code></td>
<td>Level<dimension=[Store], hierarchy=[Store]></td>
</tr>
<tr>
<td><code>[Store].[USA].[CA]</code></td>
<td>Member<dimension=[Store], hierarchy=[Store], level=[Store].[State],
member=[Store].[USA].[CA]></td>
</tr>
<tr>
<td><code>[Store].[USA].Children(2)</code></td>
<td>Member<dimension=[Store], hierarchy=[Store], level=[Store].[State]></td>
</tr>
</tbody>
</table>
<p>Since MDX is a late-binding language, some expressions will have unknown
types, or only partial type information. For example, the expression</p>
<div class="code">[Store].Levels("Sta" + "te")</div>
<p>will have type <code>Level<dimension=[Store], level=unknown></code>. The
validator knows that the <code><hierarchy>.Levels(<string expr>)</code> function
returns a level, but exactly which level is not known until the expression is
evaluated at runtime.</p>
<p><a class="javadoc" href="api/org/olap4j/type/Type.html">Type</a> is the base class for all types.</p>
<p>Scalar types:</p>
<ul>
<li><a class="javadoc" href="api/org/olap4j/type/ScalarType.html">ScalarType</a> represents the type of an expression which has a
simple value such as a number or a string.</li>
<li><a class="javadoc" href="api/org/olap4j/type/BooleanType.html">
BooleanType</a> (extends <a class="javadoc" href="api/org/olap4j/type/ScalarType.html">ScalarType</a>) represents an expression which can have values
TRUE and FALSE.</li>
<li><a class="javadoc" href="api/org/olap4j/type/NumericType.html">
NumericType</a> represents the type of a numeric expression.</li>
<li><a class="javadoc" href="api/org/olap4j/type/DecimalType.html">
DecimalType</a> (extends <code>NumericType</code>) represents a fixed-point numeric expression. It
is a subclass of <code>NumericType</code>, and has precision and scale. An
integer expression would have scale 0.</li>
<li><a class="javadoc" href="api/org/olap4j/type/StringType.html">StringType</a>
(extends <a class="javadoc" href="api/org/olap4j/type/ScalarType.html">ScalarType</a>)
represents the type of an expression which has a string value.</li>
<li><a class="javadoc" href="api/org/olap4j/type/SymbolType.html">SymbolType</a>
(extends <a class="javadoc" href="api/org/olap4j/type/ScalarType.html">ScalarType</a>)
represents the type of a symbol, or flag, argument to a built-in function.
For example, the <code>ASC</code>
keyword in the expression <code>Order(Gender.MEMBERS, Measures.[Unit Sales],
ASC)</code> is a symbol. Symbol types are rarely used except if you are
manipulating a parse tree.</li>
</ul>
<p>Metadata types:</p>
<ul>
<li><a class="javadoc" href="api/org/olap4j/type/CubeType.html">CubeType</a>
represents the type of an expression whose value is a cube.</li>
<li><a class="javadoc" href="api/org/olap4j/type/DimensionType.html">
DimensionType</a> represents the type of an expression whose
value is a dimension.</li>
<li><a class="javadoc" href="api/org/olap4j/type/HierarchyType.html">
HierarchyType</a> represents the type of an expression whose
value is a hierarchy.</li>
<li><a class="javadoc" href="api/org/olap4j/type/LevelType.html">LevelType</a>
represents the type of an expression whose value is a level.</li>
<li><a class="javadoc" href="api/org/olap4j/type/MemberType.html">MemberType</a>
represents the type of an expression whose value is a member.</li>
</ul>
<p>A metadata type may be constrained to a particular part of the schema. For
example, <code>LevelType(hierarchy=[Time])</code> indicates that the expression
must evaluate to one of the levels of the <code>[Time]</code> hierarchy, that
is, one of the values <code>[Time].[Year]</code>, <code>[Time].[Quarter]</code>,
or <code>[Time].[Month]</code>.</p>
<p>Composite types:</p>
<ul>
<li><a class="javadoc" href="api/org/olap4j/type/SetType.html">SetType</a> represents the type of an expression which is a
set. It has a component type, for example, the type of the expression <code>
{[Store].[USA].Children}</code> is <code>Set(Member(level=[Store].[Store
State])</code>.</li>
<li><a class="javadoc" href="api/org/olap4j/type/TupleType.html">TupleType</a> represents the type of an expression which
consists of an n-tuple of members. It has a set of component types, each of
which is a member type. For example, the type of the expression <code>
CrossJoin({[Gender].[F], [Gender].[M]}, [Store].Members)</code> is <code>
Set(Tuple(Member(level=[Gender].[Gender]), Member(hierarchy=[Store]))</code>.</li>
</ul>
<h3>2.7. <a name="Metadata">Metadata</a></h3>
<p>Package name: <a class="javadoc" href="api/org/olap4j/metadata/package-summary.html">org.olap4j.metadata</a></p>
<p>Metadata are the objects which describe the structure of an OLAP schema:
cubes, dimensions, members, properties and so forth.</p>
<p>olap4j exposes metadata in two very different ways:</p>
<ul>
<li>A <dfn>metadata object</dfn> is a Java object which represents a particular
metadata class. For example, <a class="javadoc" href="api/org/olap4j/metadata/Cube.html">
org.olap4j.metadata.Cube</a>.</li>
<li>A <dfn>schema result set</dfn> is a JDBC ResultSet which returns a record
for each instance of a particular metadata class. There is a method in
the <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html">
OlapDatabaseMetaData</a> interface to create a schema result set for each metadata class. Some
of these methods accept parameters to filter the rows returned. For example,
<a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getCubes%28java.lang.String,%20java.lang.String,%20java.lang.String%29">
OlapDatabaseMetaData.getCubes(String catalog, String schemaNamePattern,
String cubeNamePattern)</a>.</li>
</ul>
<h4>2.7.1. <a name="Access_control">Access control</a></h4>
<p>A user's view of metadata may be subject to access control. The precise rules
for access control depend on the provider, and this specification does not say
what those rules should be. But this specification requires that the API methods
must behave consistently with the server's access control policy.</p>
<p>For example, in mondrian, users belong to roles, and roles may be granted or
denied access to cubes, hierarchies, or members within hierarchies. Suppose that
user Fred belongs to the "Sales Manager" role, which does not have access to the
<code>[Nation]</code>
level of the <code>[Store]</code> hierarchy, and the current connection has
been opened in the "Sales Manager" role. Then the <code>Member.getParentMember()</code> method will return null if applied to
<code>[Store].[USA].[CA]</code>, because the 'real' parent member <code>[Store].[USA]</code>
is invisible to him; also, the <code>Hierarchy.getLevels()</code> and <code>
OlapDatabaseMetaData.getLevels()</code> methods will omit the Nation level from
the list of levels they return.</p>
<p>In olap4j, you can set a connection's role at connect time using the
<code>Role</code> connect string property, or you can call the
<code>OlapConnection.setRole(String roleName)</code> method at any point
during the lifecycle of the connection. Setting the role name to
<code>null</code> reverts to the default access-control context.</p>
<h4>2.7.2. <a name="Metadata_objects">Metadata objects</a></h4>
<p>The following diagram shows the metadata objects in an olap4j schema.</p>
<img class="std" alt="olap4j metdata objects" src="olap4j-metadata.png">
<p>In the diagram, each arrow represents a collection of objects in a
parent object; for example, a database is a collection of catalogs,
each catalog is a collection of schemas, each schema is a collection of
cubes, and so forth. Each object has a
corresponding class in the <a class="javadoc" href="api/org/olap4j/metadata/package-summary.html">org.olap4j.metadata</a>
package.</p>
<p>Most metadata objects extend the <a class="javadoc" href="api/org/olap4j/metadata/MetadataElement.html">
MetadataElement</a> interface, which gives them <code>name</code> and <code>
uniqueName</code> attributes, and localized <code>caption</code> and <code>
description</code>.</p>
<p>When the API returns a list of metadata elements whose names must be unique
(for example, the list of dimensions in a cube), the return type is the
<a class="javadoc" href="api/org/olap4j/metadata/NamedList.html">NamedList</a>
extension to
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/util/List.html">
java.util.List</a>.</p>
<p>Providers are at liberty to implement metadata objects using a cache, and
therefore over the course of time, different java objects may represent the same
underlying metadata object. Always use
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)">
equals()</a>, not the <code>==</code> operator, when comparing metadata objects,
and do not use
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/util/IdentityHashMap.html">
IdentityHashMap</a>.</p>
<h5>2.7.2.1. <a name="MetadataElement">The MetadataElement interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/MetadataElement.html">
MetadataElement</a> is an element which describes the structure of an OLAP
schema.</p>
<p>Subtypes are Cube, Dimension, Hierarchy, Level, Member, Property.
MetadataElement provides
name and unique-name properties (not localized), and localized caption and
description (see <a href="#Internationalization">Internationalization</a>).</p>
<p>Methods:</p>
<ul>
<li><code>String getName()</code> // name of this metadata element</li>
<li><code>String getUniqueName()</code> // unique name of this metadata element</li>
<li><code>String getCaption()</code> // localized caption of this metadata element</li>
<li><code>String getDescription()</code> // localized description of this metadata element</li>
</ul>
<h5>2.7.2.2. <a name="Database">The Database interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/Database.html">Database</a>
is the highest level element in the hierarchy of metadata objects. A
database contains one or more catalogs.</p>
<p>Some OLAP servers may only have one database. Mondrian is one such
OLAP server.</p>
<p>To obtain the collection of databases in the current server, call the
<code>OlapConnection.getOlapDatabases()</code> method.</p>
<p>Methods:</p>
<ul>
<li><code>OlapConnection getOlapConnection()</code> // returns the current connection</li>
<li><code>String getName()</code> // returns the name of this database</li>
<li><code>String getDescription()</code> // returns the description of this database</li>
<li><code>String getURL()</code> // returns the redirection URL, if this database is a proxy to another server</li>
<li><code>String getDataSourceInfo()</code> // returns provider-specific information</li>
<li><code>String getProviderName()</code> // returns the name of the underlying OLAP provider</li>
<li><code>List<ProviderType> getProviderTypes()</code> // returns the types of data that are supported by this provider</li>
<li><code>List<AuthenticationMode> getAuthenticationModes()</code> // returns the modes of authentication that are supported by this provider</li>
<li><code>NamedList<Catalog> getCatalogs()</code> // returns a list of catalogs in this database</li>
</ul>
<h5>2.7.2.3. <a name="Catalog">The Catalog interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/Catalog.html">Catalog</a>
is the second highest level element in the hierarchy of metadata objects. A
catalog belongs to a database and contains one or more schemas.</p>
<p>Some OLAP servers may only have one catalog. Mondrian is one such OLAP
server; its sole catalog is always called "LOCALDB".</p>
<p>To obtain the collection of catalogs in the current server, call the
<code>OlapConnection.getOlapCatalogs()</code> method.</p>
<p>Methods:</p>
<ul>
<li><code>String getName()</code> // returns the name of this catalog</li>
<li><code>NamedList<Schema> getSchemas()</code> // returns a list of schemas in this catalog</li>
<li><code>OlapDatabaseMetaData getMetaData()</code> // returns the metadata describing the OLAP server that this catalog belongs to</li>
<li><code>Database getDatabase()</code> // returns this catalog's parent database</li>
</ul>
<h5>2.7.2.4. <a name="Schema">The Schema interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/Schema.html">Schema</a> is
a collection of database objects that contain structural information, or
metadata, about a database.</p>
<p>It belongs to a catalog and contains a number of cubes and shared dimensions.</p>
<p>Methods:</p>
<ul>
<li><code>Catalog getCatalog()</code> // returns this schema's parent catalog</li>
<li><code>String getName()</code> // returns the name of this catalog</li>
<li><code>NamedList<Dimension> getSharedDimensions()</code></li>
<li><code>NamedList<Cube> getCubes()</code></li>
<li><code>Collection<Locale> getSupportedLocales()</code> (see <a href="#Internationalization">
Internationalization</a>)</li>
</ul>
<p>To obtain the collection of schemas in the current server, call the
<code>OlapConnection.getOlapSchemas()</code> method.</p>
<h5>2.7.2.5. <a name="Cube">The Cube interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/Cube.html">Cube</a> is the
central metadata object for representing multidimensional data.</p>
<p>It belongs to a schema, and is described by a list of dimensions and a list
of measures. It may also have a collection of named sets, each defined by a
formula.</p>
<p>Methods:</p>
<ul>
<li><code>NamedList<Dimension> getDimensions()</code></li>
<li><code>NamedList<Hierarchy> getHierarchies()</code></li>
<li><code>List<Measure> getMeasures()</code></li>
<li><code>NamedList<NamedSet> getSets()</code></li>
<li><code>Schema getSchema()</code></li>
<li><code>String getName()</code></li>
<li><code>List<Locale> getSupportedLocales()</code> (see <a href="#Internationalization">
Internationalization</a>)</li>
<li><code>Member lookupMember(List<IdentifierSegment> nameParts)</code></li>
<li><code>List<Member> lookupMembers(Set<TreeOp> treeOps, List<IdentifierSegment> nameParts)</code></li>
</ul>
<h5>2.7.2.6. <a name="Dimension">The Dimension interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/Dimension.html">Dimension</a>
(extends <a class="javadoc" href="api/org/olap4j/metadata/MetadataElement.html">
MetadataElement</a>) is an organized hierarchy of categories, known as levels,
that describes data in a cube.</p>
<p>Dimensions typically describe a similar set of members upon which the user
wants to base an analysis.</p>
<p>A dimension must have at least one hierarchy, and may have more than once,
but most have exactly one hierarchy.</p>
<ul>
<li><code>String getName()</code></li>
<li><code>NamedList<Hierarchy> getHierarchies()</code></li>
<li><code>Dimension.Type getDimensionType()</code></li>
</ul>
<h5>2.7.2.7. <a name="Hierarchy">The Hierarchy interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/Hierarchy.html">Hierarchy</a>
(extends <a class="javadoc" href="api/org/olap4j/metadata/MetadataElement.html">
MetadataElement</a>) is an organization of the set of members in a dimension and
their positions relative to one another.</p>
<p>A hierarchy is a collection of levels, each of which is a category of similar
members.</p>
<p>Methods:</p>
<ul>
<li><code>Dimension getDimension()</code></li>
<li><code>String getName()</code></li>
<li><code>NamedList<Level> getLevels()</code></li>
<li><code>boolean hasAll()</code></li>
<li><code>Member getDefaultMember()</code></li>
<li><code>NamedList<Member> getRootMembers()</code></li>
</ul>
<h5>2.7.2.8. <a name="Level">The Level interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/Level.html">Level</a>
(extends <a class="javadoc" href="api/org/olap4j/metadata/MetadataElement.html">
MetadataElement</a>) is a group of members in a hierarchy, all with the same
attributes and at the same depth in the hierarchy.</p>
<p>Methods:</p>
<ul>
<li><code>int getDepth()</code></li>
<li><code>Hierarchy getHierarchy()</code></li>
<li><code>Level.Type getLevelType()</code></li>
<li><code>NamedList<Property> getProperties()</code></li>
<li><code>List<Member> getMembers()</code></li>
<li><code>int getCardinality()</code></li>
</ul>
<h5>2.7.2.9. <a name="Member">The Member interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/Member.html">Member</a>
(extends <a class="javadoc" href="api/org/olap4j/metadata/MetadataElement.html">
MetadataElement</a>) is a data value in an OLAP dimension.</p>
<p>Methods:</p>
<ul>
<li><code>String getName()</code></li>
<li><code>NamedList<Member> getChildMembers()</code></li>
<li><code>Member getParentMember()</code></li>
<li><code>Level getLevel()</code></li>
<li><code>Hierarchy getHierarchy()</code></li>
<li><code>boolean isAll()</code></li>
<li><code>boolean isChildOrEqualTo(Member member)</code></li>
<li><code>boolean isCalculated()</code></li>
<li><code>boolean isCalculatedInQuery()</code></li>
<li><code>int solveOrder()</code></li>
<li><code>List<Member> getAncestorMembers()</code></li>
<li><code>Object getPropertyValue(Property property)</code></li>
<li><code>String getPropertyFormattedValue(Property property)</code></li>
<li><code>void setProperty(Property property, Object value)</code></li>
<li><code>NamedList<Property> getProperties()</code></li>
<li><code>int getOrdinal()</code></li>
<li><code>boolean isHidden()</code></li>
<li><code>Member getDataMember()</code></li>
<li><code>int getChildMemberCount()</code></li>
</ul>
<h5>2.7.2.10. <a name="Measure">The Measure interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/Measure.html">Measure</a> (extends
<a class="javadoc" href="api/org/olap4j/metadata/Member.html">Member</a>) is a
data value of primary interest to the user browsing the cube. It provides the
value of each cell, and is usually numeric.</p>
<p>Every measure is a member of a special dimension called "Measures".</p>
<p>Methods:</p>
<ul>
<li><code>boolean isVisible()</code></li>
<li><code>Aggregator getAggregator()</code></li>
<li><code>Datatype getDataType()</code></li>
</ul>
<h5>2.7.2.11. <a name="Property">The Property interface</a></h5>
<p><a class="javadoc" href="api/org/olap4j/metadata/Property.html">Property</a>
(extends <a class="javadoc" href="api/org/olap4j/metadata/MetadataElement.html">
MetadataElement</a>) is the definition of a property of a member or a cell.</p>
<p><code>Property</code> contains two enumerated types
<a class="javadoc" href="api/org/olap4j/metadata/Property.StandardMemberProperty.html">
StandardMemberProperty</a> and
<a class="javadoc" href="api/org/olap4j/metadata/Property.StandardCellProperty.html">
StandardCellProperty</a> whose values are the built-in properties of members and
cells. Because these types implement the Property interface, you can use them as
properties; for example:</p>
<div class="code">
Member member;<br/>
Object o =
member.getPropertyValue(<br/>
Property.StandardMemberProperty.CATALOG_NAME);</div>
<p>Members:</p>
<ul>
<li><code>Datatype getDatatype()</code></li>
<li><code>Set<TypeFlag> getType()</code></li>
<li><code>ContentType getContentType()</code></li>
<li><code>enum TypeFlag { MEMBER, CELL, SYSTEM, BLOB }</code></li>
<li><code>enum StandardMemberProperty implements Property { CATALOG_NAME, SCHEMA_NAME, CUBE_NAME, ...
}</code></li>
<li><code>enum StandardCellProperty implements Property { BACK_COLOR, CELL_EVALUATION_LIST, ... }</code></li>
<li><code>enum ContentType { REGULAR, ID, RELATION_TO_PARENT, ... }</code></li>
</ul>
<h5>2.7.2.12. <a name="NamedSet">The NamedSet interface</a></h5>
<p>A <a class="javadoc" href="api/org/olap4j/metadata/NamedSet.html">NamedSet</a>
(extends <a class="javadoc" href="api/org/olap4j/metadata/MetadataElement.html">
MetadataElement</a>) describes a set whose value is determined by an MDX
expression. It belongs to a cube.</p>
<p>Methods:</p>
<ul>
<li><code>Cube getCube()</code></li>
<li><code>Expression getExpression()</code></li>
</ul>
<h5>2.7.2.13. <a name="Datatype">The Datatype enum</a></h5>
<p>The <a class="javadoc" href="api/org/olap4j/metadata/Datatype.html">
Datatype</a> enum describes the type of property and measure values. Because
olap4j drivers need to interoperate with OLE DB for OLAP and XMLA systems,
Datatype values have the same ordinals as in the OLE DB specification, and we
show here the
name and description of the corresponding type in the OLE DB specification. The table shows
the analogous Java type, if there is one.</p>
<table summary="Datatype columns">
<tbody>
<tr>
<th>Datatype</th>
<th>Java type</th>
<th>OLE DB type</th>
<th>Description</th>
</tr>
<tr>
<td>INTEGER</td>
<td>int</td>
<td>DBTYPE_I4</td>
<td>A four-byte, signed integer: INTEGER</td>
</tr>
<tr>
<td>DOUBLE</td>
<td>double</td>
<td>DBTYPE_R8</td>
<td>A double-precision floating-point value: Double</td>
</tr>
<tr>
<td>CURRENCY</td>
<td> </td>
<td>DBTYPE_CY</td>
<td>A currency value: LARGE_INTEGER, Currency is a fixed-point number with four digits to the right of the decimal point. It is stored in an eight-byte signed integer, scaled by 10,000.</td>
</tr>
<tr>
<td>BOOLEAN</td>
<td>boolean</td>
<td>DBTYPE_BOOL</td>
<td>A Boolean value stored in the same way as in Automation: VARIANT_BOOL; 0 means false and ~0 (bitwise, the value is not 0; that is, all bits are set to 1) means true.</td>
</tr>
<tr>
<td>VARIANT</td>
<td>Object</td>
<td>DBTYPE_VARIANT</td>
<td>An Automation VARIANT</td>
</tr>
<tr>
<td>UNSIGNED_SHORT</td>
<td>-</td>
<td>DBTYPE_UI2</td>
<td>A two-byte, unsigned integer</td>
</tr>
<tr>
<td>UNSIGNED_INTEGER</td>
<td>-</td>
<td>DBTYPE_UI4</td>
<td>A four-byte, unsigned integer</td>
</tr>
<tr>
<td>LARGE_INTEGER</td>
<td>long</td>
<td>DBTYPE_I8</td>
<td>An eight-byte, signed integer: LARGE_INTEGER</td>
</tr>
<tr>
<td>STRING</td>
<td>String</td>
<td>DBTYPE_WSTR</td>
<td>A null-terminated Unicode character string: wchar_t[length]; If DBTYPE_WSTR is used by itself, the number of bytes allocated for the string, including the null-termination character, is specified by cbMaxLen in the DBBINDING structure. If DBTYPE_WSTR is combined with DBTYPE_BYREF, the number of bytes allocated for the string, including the null-termination character, is at least the length of the string plus two. In either case, the actual length of the string is determined from the bound length value. The maximum length of the string is the number of allocated bytes divided by sizeof(wchar_t) and truncated to the nearest integer.</td>
</tr>
</tbody>
</table>
<h4>2.7.3. <a name="The_OlapDatabaseMetaData_interface_and_methods_which_return_schema_rowsets">The
OlapDatabaseMetaData interface, and methods which return schema rowsets</a></h4>
<p><a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html">
OlapDatabaseMetaData</a> (extends
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html">java.sql.DatabaseMetaData</a>)
contains methods which return schema result sets.</p>
<p>Schema result sets are specified as in [<a href="#XMLA">XML for Analysis
specification</a>]. Here is a table of the XML/A methods and the
corresponding olap4j method and element type.</p>
<table summary="Schema result sets">
<tbody>
<tr>
<th>XML for Analysis schema rowset</th>
<th>Schema result set method</th>
<th>Metadata element</th>
</tr>
<tr>
<td>DBSCHEMA_CATALOGS</td>
<td> <a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getCatalogs%28%29">DatabaseMetaData.getCatalogs</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/Catalog.html">Catalog</a></td>
</tr>
<tr>
<td>not supported</td>
<td> <a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getSchemas%28%29">DatabaseMetaData.getSchemas</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/Schema.html">Schema</a></td>
</tr>
<tr>
<td>DBSCHEMA_COLUMNS</td>
<td>not supported</td>
<td>not supported</td>
</tr>
<tr>
<td>DBSCHEMA_PROVIDER_TYPES</td>
<td>not supported</td>
<td>not supported</td>
</tr>
<tr>
<td>DBSCHEMA_TABLES</td>
<td>not supported</td>
<td>not supported</td>
</tr>
<tr>
<td>DBSCHEMA_TABLES_INFO</td>
<td>not supported</td>
<td>not supported</td>
</tr>
<tr>
<td>DISCOVER_DATASOURCES</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getDatabases%28java.lang.String%29">OlapDatabaseMetaData.getDatabases</a></td>
<td><a class="javadoc" href="api/org/olap4j/metadata/Database.html">Database</a></td>
</tr>
<tr>
<td>DISCOVER_ENUMERATORS</td>
<td>not supported</td>
<td>not supported</td>
</tr>
<tr>
<td>DISCOVER_KEYWORDS</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getMdxKeywords%28%29">OlapDatabaseMetaData.getMdxKeywords</a></td>
<td> not supported</td>
</tr>
<tr>
<td>DISCOVER_LITERALS</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getLiterals%28%29">OlapDatabaseMetaData.getLiterals</a></td>
<td> not supported</td>
</tr>
<tr>
<td>DISCOVER_PROPERTIES</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getDatabaseProperties%28java.lang.String%29">OlapDatabaseMetaData.getDatabaseProperties</a></td>
<td> not supported</td>
</tr>
<tr>
<td>DISCOVER_SCHEMA_ROWSETS</td>
<td>not supported</td>
<td>not supported</td>
</tr>
<tr>
<td>MDSCHEMA_ACTIONS</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getActions%28%29">OlapDatabaseMetaData.getActions</a></td>
<td> not supported</td>
</tr>
<tr>
<td>MDSCHEMA_CUBES</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getCubes%28java.lang.String,%20java.lang.String,%20java.lang.String%29">OlapDatabaseMetaData.getCubes</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/Cube.html">Cube</a></td>
</tr>
<tr>
<td>MDSCHEMA_DIMENSIONS</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getDimensions%28%29">OlapDatabaseMetaData.getDimensions</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/Dimension.html">Dimension</a></td>
</tr>
<tr>
<td>MDSCHEMA_FUNCTIONS</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getFunctions%28%29">OlapDatabaseMetaData.getFunctions</a></td>
<td> not supported</td>
</tr>
<tr>
<td>MDSCHEMA_HIERARCHIES</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getHierarchies%28%29">OlapDatabaseMetaData.getHierarchies</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/Hierarchy.html">Hierarchy</a></td>
</tr>
<tr>
<td>MDSCHEMA_INPUT_DATASOURCES</td>
<td>not supported</td>
<td>not supported</td>
</tr>
<tr>
<td>MDSCHEMA_KPIS</td>
<td>not supported</td>
<td>not supported</td>
</tr>
<tr>
<td>MDSCHEMA_LEVELS</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getLevels%28%29">OlapDatabaseMetaData.getLevels</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/Level.html">Level</a></td>
</tr>
<tr>
<td>MDSCHEMA_MEASURES</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getMeasures%28%29">OlapDatabaseMetaData.getMeasures</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/Measure.html">Measure</a></td>
</tr>
<tr>
<td>MDSCHEMA_MEMBERS</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getMembers%28%29">OlapDatabaseMetaData.getMembers</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/Member.html">Member</a></td>
</tr>
<tr>
<td>MDSCHEMA_PROPERTIES</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getProperties%28%29">OlapDatabaseMetaData.getProperties</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/Property.html">Property</a></td>
</tr>
<tr>
<td>MDSCHEMA_SETS</td>
<td> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getSets%28%29">OlapDatabaseMetaData.getSets</a></td>
<td> <a class="javadoc" href="api/org/olap4j/metadata/NamedSet.html">NamedSet</a></td>
</tr>
</tbody>
</table>
<p>The rows returned in the result set returned from the metadata
methods are structured according to the result set column layouts
detailed in this
section.</p>
<p>All columns noted in the following result sets are required, and
they must be returned in the order shown. However, additional columns
(which
should be ignored by clients not expecting them) can be added at the
end, and
some columns can contain null data for info that does not apply.</p>
<p>The following sections describe the columns in each rowset. Each
section includes a table that provides the following information for
each
column.</p>
<table summary="Columns">
<tbody>
<tr>
<th nowrap="nowrap">Column heading</th>
<th>Contents</th>
</tr>
<tr>
<td>Column name</td>
<td>The name of the column in the output rowset.</td>
</tr>
<tr>
<td>Type</td>
<td>A description of the data type for the column, and whether
the column may be NULL.</td>
</tr>
<tr>
<td>Description</td>
<td>A brief description of the purpose of the column.</td>
</tr>
</tbody>
</table>
<h5>2.7.3.1. <a name="getDatabases">getDatabases</a></h5>
<p>Specified by the <code>DISCOVER_DATASOURCES</code> XML for Analysis
method.</p>
<p>Note that we use the name 'database' rather than 'data source'
because 'data source' has a well-established and entirely different
meaning (see <a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/javax/sql/DataSource.html">interface
javax.sql.DataSource</a>) in the JDBC specification.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getDatabases">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>DATA_SOURCE_NAME</td>
<td width="74">String</td>
<td>The name of the data source, such as <b> FoodMart 2000</b>.
Never null.</td>
</tr>
<tr>
<td>DATA_SOURCE_DESCRIPTION</td>
<td width="74">String</td>
<td>A description of the data source, as entered by the publisher.</td>
</tr>
<tr>
<td>URL</td>
<td width="74">String</td>
<td>The unique path that shows where to invoke the XML for
Analysis methods for that data source.</td>
</tr>
<tr>
<td>DATA_SOURCE_INFO</td>
<td width="74">String</td>
<td>
<p>A string containing any additional information required to
connect to the data source. This can include the Initial Catalog
property or other information for the provider.</p>
<p>Example: <code>"Provider=MSOLAP;Data Source=Local;"</code></p>
</td>
</tr>
<tr>
<td>PROVIDER_NAME</td>
<td width="74">String</td>
<td>
<p>The name of the provider behind the data source. </p>
<p>Example: <code>"MSDASQL"</code></p>
</td>
</tr>
<tr>
<td>PROVIDER_TYPE</td>
<td width="74">String</td>
<td>
<p>Comma-separated list of the types of data supported by the
provider. May include one or more of the following types. Example
follows this table.</p>
<ul>
<li><b>TDP</b>: tabular data provider.</li>
<li><b>MDP</b>: multidimensional data provider.</li>
<li><b>DMP</b>: data mining provider. A DMP provider implements
the OLE DB for Data Mining specification.</li>
</ul>
</td>
</tr>
<tr>
<td>AUTHENTICATION_MODE</td>
<td width="74">String</td>
<td> Specification of what type of security mode the data source
uses. Values can be one of the following, never null:
<ul>
<li><b>Unauthenticated</b>: no user ID or password needs to be
sent.</li>
<li><b>Authenticated</b>: User ID and Password must be included
in the information required for the connection.</li>
<li><b>Integrated</b>: the data source uses the underlying
security to determine authorization, such as Integrated Security
provided by Microsoft Internet Information Services (IIS).</li>
</ul>
</td>
</tr>
</tbody>
</table>
<h5>2.7.3.2. <a name="getDatabaseProperties">getDatabaseProperties</a></h5>
<p>Returns
information about the standard and provider-specific properties
supported by an
olap4j provider. Properties that are not supported by a provider are
not listed in the return result set.</p>
<p>Specified by the <code>DISCOVER_PROPERTIES</code> XML for Analysis
method, except that we rename the VALUE property to PROPERTY_VALUE
because "VALUE" is a SQL:2003 reserved word.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getDatabaseProperties">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>PROPERTY_NAME</td>
<td>String</td>
<td>The name of the property. Never null.</td>
</tr>
<tr>
<td>PROPERTY_DESCRIPTION</td>
<td>String</td>
<td>A localizable text description of the property.</td>
</tr>
<tr>
<td>PROPERTY_TYPE</td>
<td>String</td>
<td>The XML data type of the property.</td>
</tr>
<tr>
<td>PROPERTY_ACCESS_TYPE</td>
<td>String</td>
<td>Access for the property. The value can be Read, Write, or
ReadWrite. Never null.</td>
</tr>
<tr>
<td>IS_REQUIRED</td>
<td>boolean</td>
<td>True if a property is required, false if it is not required.</td>
</tr>
<tr>
<td>PROPERTY_VALUE</td>
<td>String</td>
<td>The current value of the property.
<p>This property is named VALUE in XMLA.</p>
</td>
</tr>
</tbody>
</table>
<h5>2.7.3.3 <a name="getLiterals">getLiterals</a></h5>
<p>Retrieves a list of information on supported literals, including
data types
and values.</p>
<p>Specified by the <code>DISCOVER_LITERALS</code> XML for Analysis
method.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getLiterals">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>LITERAL_NAME</td>
<td>String</td>
<td>
<p>The name of the literal described in the row. Never null.</p>
<p>Example: DBLITERAL_LIKE_PERCENT.</p>
</td>
</tr>
<tr>
<td>LITERAL_VALUE</td>
<td>String</td>
<td>
<p>Contains the actual literal value.</p>
<p>Example, if <code>LITERAL_NAME</code> is
DBLITERAL_LIKE_PERCENT and the percent character (%) is used to match
zero or more characters in a LIKE clause, this column's value would be
"%".</p>
</td>
</tr>
<tr>
<td>LITERAL_INVALID_CHARS</td>
<td>String</td>
<td>
<p>The characters, in the literal, that are not valid. </p>
<p>For example, if table names can contain anything other than a
numeric character, this string would be "0123456789".</p>
</td>
</tr>
<tr>
<td>LITERAL_INVALID_<br/>
STARTING_CHARS</td>
<td>String</td>
<td>The characters that are not valid as the first character of
the literal. If the literal can start with any valid character, this is
null.</td>
</tr>
<tr>
<td>LITERAL_MAX_LENGTH</td>
<td>int</td>
<td>The maximum number of characters in the literal. If there is
no maximum or the maximum is unknown, the value is -1.</td>
</tr>
</tbody>
</table>
<h5>2.7.3.4. <a name="getCubes">getCubes</a></h5>
<p>Describes the structure of cubes within a database.</p>
<p>Specified by the <code>MDSCHEMA_CUBES</code> XML for Analysis
method.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getCubes">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>CATALOG_NAME</td>
<td>String</td>
<td>The name of the database.</td>
</tr>
<tr>
<td>SCHEMA_NAME</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>CUBE_NAME</td>
<td>String</td>
<td>The name of the cube or dimension. Dimension names are
prefaced by a dollar sign ($) symbol.</td>
</tr>
<tr>
<td>CUBE_TYPE</td>
<td>String</td>
<td>The type of the cube. Valid values are:
<ul>
<li><b>CUBE</b></li>
<li><b>DIMENSION</b></li>
</ul>
</td>
</tr>
<tr>
<td>CUBE_GUID</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>CREATED_ON</td>
<td>Timestamp</td>
<td>Not supported.</td>
</tr>
<tr>
<td>LAST_SCHEMA_UPDATE</td>
<td>Timestamp</td>
<td>The time that the cube was last processed.</td>
</tr>
<tr>
<td>SCHEMA_UPDATED_BY</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>LAST_DATA_UPDATE</td>
<td>Timestamp</td>
<td>The time that the cube was last processed.</td>
</tr>
<tr>
<td>DATA_UPDATED_BY</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>String</td>
<td>A user-friendly description of the cube.</td>
</tr>
<tr>
<td>IS_DRILLTHROUGH_ENABLED</td>
<td>boolean</td>
<td>A Boolean that always returns true.</td>
</tr>
<tr>
<td>IS_LINKABLE</td>
<td>boolean</td>
<td>A Boolean that indicates whether a cube can be used in a
linked cube.</td>
</tr>
<tr>
<td>IS_WRITE_ENABLED</td>
<td>boolean</td>
<td>A Boolean that indicates whether a cube is write-enabled.</td>
</tr>
<tr>
<td>IS_SQL_ENABLED</td>
<td>boolean</td>
<td>A Boolean that indicates whether SQL can be used on the cube.</td>
</tr>
<tr>
<td>CUBE_CAPTION</td>
<td>String</td>
<td>The caption of the cube.</td>
</tr>
<tr>
<td>BASE_CUBE_NAME</td>
<td>String</td>
<td>The name of the source cube if this cube is a perspective
cube.</td>
</tr>
<tr>
<td>ANNOTATIONS</td>
<td>String</td>
<td>(Optional) A set of notes, in XML format.</td>
</tr>
</tbody>
</table>
<p>The rowset is sorted on <b>CATALOG_NAME</b>, <b>SCHEMA_NAME</b>, <b>CUBE_NAME</b>.</p>
<h5>2.7.3.5. <a name="getDimensions">getDimensions</a></h5>
<p>Retrieves a result set describing the shared and private dimensions
within a database.</p>
<p>Specified by the <code>MDSCHEMA_DIMENSIONS</code> XML for Analysis
method.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getDimensions">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>CATALOG_NAME</td>
<td>String</td>
<td>The name of the database.</td>
</tr>
<tr>
<td>SCHEMA_NAME</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>CUBE_NAME</td>
<td>String</td>
<td>The name of the cube.</td>
</tr>
<tr>
<td>DIMENSION_NAME</td>
<td>String</td>
<td>The name of the dimension. If a dimension is part of more
than one cube or measure group, then there is one row for each unique
combination of dimension, measure group, and cube.</td>
</tr>
<tr>
<td>DIMENSION_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the dimension.</td>
</tr>
<tr>
<td>DIMENSION_GUID</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>DIMENSION_CAPTION</td>
<td>String</td>
<td>The caption of the dimension. This should be used when
displaying the name of the dimension to the user, such as in the user
interface or reports.</td>
</tr>
<tr>
<td>DIMENSION_ORDINAL</td>
<td>int</td>
<td>The position of the dimension within the cube.</td>
</tr>
<tr>
<td>DIMENSION_TYPE</td>
<td>int</td>
<td>The type of the dimension. Valid values include the values of
the <code> xmlaOrdinal</code> attribute of the <a class="javadoc" href="api/org/olap4j/metadata/Dimension.Type.html">org.olap4j.Dimension.Type</a>
enum.</td>
</tr>
<tr>
<td>DIMENSION_CARDINALITY</td>
<td>int</td>
<td>The number of members in the key attribute.</td>
</tr>
<tr>
<td>DEFAULT_HIERARCHY</td>
<td>String</td>
<td>A hierarchy from the dimension. Preserved for backwards
compatibility.</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>String</td>
<td>A user-friendly description of the dimension.</td>
</tr>
<tr>
<td>IS_VIRTUAL</td>
<td>boolean</td>
<td>Always <code>false</code>.</td>
</tr>
<tr>
<td>IS_READWRITE</td>
<td>boolean</td>
<td>A Boolean that indicates whether the dimension is
write-enabled.
<p><code>true</code> if the dimension is write-enabled.</p>
</td>
</tr>
<tr>
<td>DIMENSION_UNIQUE_SETTINGS</td>
<td>int</td>
<td>A bitmap that specifies which columns contain unique values
if the dimension contains only members with unique names. The following
bit value constants are defined for this bitmap:
<ul>
<li><b>MDDIMENSIONS_MEMBER_KEY_UNIQUE (1)</b></li>
</ul>
</td>
</tr>
<tr>
<td>DIMENSION_MASTER_<br/>
UNIQUE_NAME</td>
<td>String</td>
<td>Always <code>null</code>.</td>
</tr>
<tr>
<td>DIMENSION_IS_VISIBLE</td>
<td>boolean</td>
<td>Always <code>true</code>.</td>
</tr>
</tbody>
</table>
<p>The result set is sorted on <b>CATALOG_NAME</b>, <b> SCHEMA_NAME</b>,
<b>CUBE_NAME</b>, <b>DIMENSION_NAME</b>.</p>
<h5>2.7.3.6. <a name="getFunctions">getFunctions</a></h5>
<p>Retrieves a result set describing the functions available to client
applications connected to the database.</p>
<p>Specified by the <code>MDSCHEMA_FUNCTIONS</code> XML for Analysis
method.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getFunctions">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>FUNCTION_NAME</td>
<td>String</td>
<td>The name of the function.</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>String</td>
<td>A description of the function.</td>
</tr>
<tr>
<td>PARAMETER_LIST</td>
<td>String</td>
<td>A comma delimited list of parameters formatted as in
Microsoft Visual Basic. For example, a parameter might be Name as
String.</td>
</tr>
<tr>
<td>RETURN_TYPE</td>
<td>int</td>
<td>The <b>VARTYPE</b> of the return data type of the function.</td>
</tr>
<tr>
<td>ORIGIN</td>
<td>int</td>
<td>The origin of the function:
<ul>
<li>1 for MDX functions.</li>
<li>2 for user-defined functions.</li>
</ul>
</td>
</tr>
<tr>
<td>INTERFACE_NAME</td>
<td>String</td>
<td>The name of the interface for user-defined functions
<p>The group name for Multidimensional Expressions (MDX)
functions.</p>
</td>
</tr>
<tr>
<td>LIBRARY_NAME</td>
<td>String</td>
<td>The name of the type library for user-defined functions. <code>null</code>
for MDX functions. </td>
</tr>
<tr>
<td>DLL_NAME</td>
<td>String</td>
<td>(Optional) The name of the assembly that implements the
user-defined function.
<p>Returns <code>null</code> for MDX functions.</p>
</td>
</tr>
<tr>
<td>HELP_FILE</td>
<td>String</td>
<td>(Optional) The name of the file that contains the help
documentation for the user-defined function.
<p>Returns <code>null</code> for MDX functions.</p>
</td>
</tr>
<tr>
<td>HELP_CONTEXT</td>
<td>int</td>
<td>(Optional) Returns the Help context ID for this function.</td>
</tr>
<tr>
<td>OBJECT</td>
<td>String</td>
<td>(Optional) The generic name of the object class to which a
property applies. For example, the rowset corresponding to the
<level_name>.Members function returns "<b>Level</b>".
<p>Returns <code>null</code> for user-defined functions, or
non-property MDX functions.</p>
</td>
</tr>
<tr>
<td>CAPTION</td>
<td>String</td>
<td>The display caption for the function.</td>
</tr>
</tbody>
</table>
<p>The rowset is sorted on <b>ORIGIN</b>, <b>INTERFACE_NAME</b>, <b>FUNCTION_NAME</b>.</p>
<h5>2.7.3.7. <a name="getHierarchies">getHierarchies</a></h5>
<p>Retrieves a result set describing each hierarchy within a particular
dimension.</p>
<p>Specified by the <code>MDSCHEMA_HIERARCHIES</code> XML for Analysis
method.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getHierarchies">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>CATALOG_NAME</td>
<td>String</td>
<td>The name of the catalog to which this hierarchy belongs. <code>null</code>
if the provider does not support catalogs.</td>
</tr>
<tr>
<td>SCHEMA_NAME</td>
<td>String</td>
<td>Not supported</td>
</tr>
<tr>
<td>CUBE_NAME</td>
<td>String</td>
<td>(Required) The name of the cube to which this hierarchy
belongs.</td>
</tr>
<tr>
<td>DIMENSION_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the dimension to which this hierarchy
belongs. For providers that generate unique names by qualification,
each component of this name is delimited.</td>
</tr>
<tr>
<td>HIERARCHY_NAME</td>
<td>String</td>
<td>The name of the hierarchy. Blank if there is only a single
hierarchy in the dimension. This will always have a value in Microsoft
SQL Server 2005 Analysis Services (SSAS).</td>
</tr>
<tr>
<td>HIERARCHY_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the hierarchy.</td>
</tr>
<tr>
<td>HIERARCHY_GUID</td>
<td>String</td>
<td>Not supported</td>
</tr>
<tr>
<td>HIERARCHY_CAPTION</td>
<td>String</td>
<td>A label or a caption associated with the hierarchy. Used
primarily for display purposes. If a caption does not exist, <b>HIERARCHY_NAME</b>
is returned. If the dimension either does not contain a hierarchy or
has just one hierarchy, this column will contain the name of the
dimension.</td>
</tr>
<tr>
<td>DIMENSION_TYPE</td>
<td>int</td>
<td>The type of the dimension. Valid values include the values of
the xmlaOrdinal attribute of .</td>
</tr>
<tr>
<td>HIERARCHY_CARDINALITY</td>
<td>int</td>
<td>The number of members in the hierarchy.</td>
</tr>
<tr>
<td>DEFAULT_MEMBER</td>
<td>String</td>
<td>The default member for this hierarchy. This is a unique name.
Every hierarchy must have a default member.</td>
</tr>
<tr>
<td>ALL_MEMBER</td>
<td>String</td>
<td>The member at the highest level of the rollup.</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>String</td>
<td>A human-readable description of the hierarchy. <code>null</code>
if no description exists.</td>
</tr>
<tr>
<td>STRUCTURE</td>
<td>int</td>
<td>The structure of the hierarchy. Valid values include the
following values:
<ul>
<li><b>MD_STRUCTURE_FULLYBALANCED</b> (<b>0</b>)</li>
<li><b>MD_STRUCTURE_RAGGEDBALANCED</b> (<b>1</b>)</li>
<li><b>MD_STRUCTURE_UNBALANCED</b> (<b>2</b>)</li>
<li><b>MD_STRUCTURE_NETWORK</b> (<b>3</b>)</li>
</ul>
</td>
</tr>
<tr>
<td>IS_VIRTUAL</td>
<td>boolean</td>
<td>Always returns <code>false</code>.</td>
</tr>
<tr>
<td>IS_READWRITE</td>
<td>boolean</td>
<td>A Boolean that indicates whether the Write Back to dimension
column is enabled.
<p>Returns <code>true</code> if the <b>Write Back to dimension</b>
column that represents this hierarchy is enabled.</p>
</td>
</tr>
<tr>
<td>DIMENSION_UNIQUE_SETTINGS</td>
<td>int</td>
<td>Always returns <b>MDDIMENSIONS_MEMBER_KEY_UNIQUE</b> (<b>1</b>).</td>
</tr>
<tr>
<td>DIMENSION_MASTER_<br/>
UNIQUE_NAME</td>
<td>String</td>
<td>Always returns <code>null</code>.</td>
</tr>
<tr>
<td>DIMENSION_IS_VISIBLE</td>
<td>boolean</td>
<td>Always returns <code>true</code>. If the dimension is not
visible, it will not appear in the schema rowset.</td>
</tr>
<tr>
<td>HIERARCHY_ORDINAL</td>
<td>int</td>
<td>The ordinal number of the hierarchy across all hierarchies of
the cube.</td>
</tr>
<tr>
<td>DIMENSION_IS_SHARED</td>
<td>boolean</td>
<td>Always returns <code>true</code>.</td>
</tr>
<tr>
<td>HIERARCHY_IS_VISIBLE</td>
<td>boolean</td>
<td>A Boolean that indicates whether the hieararchy is visible.
<p>Returns <code>true</code> if the hierarchy is visible;
otherwise, <code>false</code>.</p>
</td>
</tr>
<tr>
<td>HIERARCHY_ORIGIN</td>
<td>int</td>
<td>A bit mask that determines the source of the hierarchy:
<ul>
<li><b>MD_USER_DEFINED</b> identifies user defined hierarchies,
and has a value of <b> 0x0000001</b>.</li>
<li><b>MD_SYSTEM_ENABLED</b> identifies attribute hierarchies,
and has a value of <b> 0x0000002</b>.</li>
<li><b>MD_SYSTEM_INTERNAL</b> identifies attributes with no
attribute hierarchies, and has a value of<b> 0x0000004</b>.</li>
</ul>
<p>A parent/child attribute hierarchy is both <b> MD_USER_DEFINED</b>
and <b>MD_SYSTEM_ENABLED</b>.</p>
</td>
</tr>
<tr>
<td>HIERARCHY_DISPLAY_FOLDER</td>
<td>String</td>
<td>The path to be used when displaying the hierarchy in the user
interface. Folder names will be separated by a semicolon (;). Nested
folders are indicated by a backslash (\).</td>
</tr>
<tr>
<td>INSTANCE_SELECTION</td>
<td>int</td>
<td>A hint to the client application on how to show the
hierarchy. Valid values include the following values:
<ul>
<li><b>MD_INSTANCE_SELECTION_NONE</b></li>
<li><b>MD_INSTANCE_SELECTION_DROPDOWN</b></li>
<li><b>MD_INSTANCE_SELECTION_LIST</b></li>
<li><b>MD_INSTANCE_SELECTION_FILTEREDLIST</b></li>
<li><b>MD_INSTANCE_SELECTION_MANDATORYFILTER</b></li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>The rowset is sorted on <b>CATALOG_NAME</b>, <b> SCHEMA_NAME</b>, <b>CUBE_NAME</b>,
<b>DIMENSION_UNIQUE_NAME</b>, <b>HIERARCHY_NAME</b>.</p>
<h5>2.7.3.8. <a name="getLevels">getLevels</a></h5>
<p>Retrieves a result set describing each level within a particular
hierarchy.</p>
<p>Specified by the <code>MDSCHEMA_LEVELS</code> XML for Analysis
method.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getLevels">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>CATALOG_NAME</td>
<td>String</td>
<td>The name of the catalog to which this level belongs. <code>null</code>
if the provider does not support catalogs.</td>
</tr>
<tr>
<td>SCHEMA_NAME</td>
<td>String</td>
<td>The name of the schema to which this level belongs. <code>null</code>
if the provider does not support schemas.</td>
</tr>
<tr>
<td>CUBE_NAME</td>
<td>String</td>
<td>The name of the cube to which this level belongs.</td>
</tr>
<tr>
<td>DIMENSION_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the dimension to which this level belongs.
For providers that generate unique names by qualification, each
component of this name is delimited.</td>
</tr>
<tr>
<td>HIERARCHY_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the hierarchy. If the level belongs to
more than one hierarchy, there is one row for each hierarchy to which
it belongs. For providers that generate unique names by qualification,
each component of this name is delimited.</td>
</tr>
<tr>
<td>LEVEL_NAME</td>
<td>String</td>
<td>The name of the level.</td>
</tr>
<tr>
<td>LEVEL_UNIQUE_NAME</td>
<td>String</td>
<td>The properly escaped unique name of the level.</td>
</tr>
<tr>
<td>LEVEL_GUID</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>LEVEL_CAPTION</td>
<td>String</td>
<td>A label or caption associated with the hierarchy. Used
primarily for display purposes. If a caption does not exist, <b>LEVEL_NAME</b>
is returned. </td>
</tr>
<tr>
<td>LEVEL_NUMBER</td>
<td>int</td>
<td>The distance of the level from the root of the hierarchy.
Root level is zero (<b>0)</b>.</td>
</tr>
<tr>
<td>LEVEL_CARDINALITY</td>
<td>int</td>
<td>The number of members in the level.</td>
</tr>
<tr>
<td>LEVEL_TYPE</td>
<td>int</td>
<td>Type of the level. Values are as allowed by the <code>xmlaOrdinal</code>
field of the <a class="javadoc" href="api/org/olap4j/metadata/Level.Type.html">org.olap4j.Level.Type</a>
enum.</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>String</td>
<td>A human-readable description of the level. null if no
description exists.</td>
</tr>
<tr>
<td>CUSTOM_ROLLUP_SETTINGS</td>
<td>int</td>
<td>A bitmap that specifies the custom rollup options:
<ul>
<li><b>MDLEVELS_CUSTOM_ROLLUP_EXPRESSION</b> (<b>0x01</b>)
indicates an expression exists for this level. (Deprecated)</li>
<li><b>MDLEVELS_CUSTOM_ROLLUP_COLUMN</b> (<b>0x02</b>)
indicates that there is a custom rollup column for this level.</li>
<li><b>MDLEVELS_SKIPPED_LEVELS</b> (<b>0x04</b>) indicates that
there is a skipped level associated with members of this level.</li>
<li><b>MDLEVELS_CUSTOM_MEMBER_PROPERTIES</b> (<b>0x08</b>)
indicates that members of the level have custom member properties.</li>
<li><b>MDLEVELS_UNARY_OPERATOR</b> (<b>0x10</b>) indicates that
members on the level have unary operators.</li>
</ul>
</td>
</tr>
<tr>
<td>LEVEL_UNIQUE_SETTINGS</td>
<td>int</td>
<td>A bitmap that specifies which columns contain unique values,
if the level only has members with unique names or keys. The Msmd.h
file defines the following bit value constants for this bitmap:
<ul>
<li><b>MDDIMENSIONS_MEMBER_KEY_UNIQUE</b> (<b>1</b>)</li>
<li><b>MDDIMENSIONS_MEMBER_NAME_UNIQUE</b> (<b>2</b>)</li>
</ul>
<p>The key is always unique in Microsoft SQL Server 2005 Analysis
Services (SSAS). The name will be unique if the setting on the
attribute is <b> UniqueInDimension</b> or <b>UniqueInAttribute</b></p>
</td>
</tr>
<tr>
<td>LEVEL_IS_VISIBLE</td>
<td>boolean</td>
<td>A Boolean that indicates whether the level is visible.
<p>Always returns True. If the level is not visible, it will not
be included in the schema rowset.</p>
</td>
</tr>
<tr>
<td>LEVEL_ORDERING_PROPERTY</td>
<td>String</td>
<td>The ID of the attribute that the level is sorted on.</td>
</tr>
<tr>
<td>LEVEL_DBTYPE</td>
<td>int</td>
<td>The <b>DBTYPE</b> enumeration of the member key column that
is used for the level attribute.
<p>Null if concatenated keys are used as the member key column.</p>
</td>
</tr>
<tr>
<td>LEVEL_MASTER_<br/>
UNIQUE_NAME</td>
<td>String</td>
<td>Always returns null.</td>
</tr>
<tr>
<td>LEVEL_NAME_<br/>
SQL_COLUMN_NAME</td>
<td>String</td>
<td>The SQL representation of the level member names.</td>
</tr>
<tr>
<td>LEVEL_KEY_<br/>
SQL_COLUMN_NAME</td>
<td>String</td>
<td>The SQL representation of the level member key values.</td>
</tr>
<tr>
<td>LEVEL_UNIQUE_NAME_<br/>
SQL_COLUMN_NAME</td>
<td>String</td>
<td>The SQL representation of the member unique names.</td>
</tr>
<tr>
<td>LEVEL_ATTRIBUTE_<br/>
HIERARCHY_NAME</td>
<td>String</td>
<td>The name of the attribute hierarchy providing the source of
the level.</td>
</tr>
<tr>
<td>LEVEL_KEY_CARDINALITY</td>
<td>int</td>
<td>The number of columns in the level key.</td>
</tr>
<tr>
<td>LEVEL_ORIGIN</td>
<td>int</td>
<td>A bit map that defines how the level was sourced:
<ul>
<li><b>MD_ORIGIN_USER_DEFINED</b> identifies levels in a user
defined hierarchy.</li>
<li><b>MD_ORIGIN_ATTRIBUTE</b> identifies levels in an
attribute hierarchy.</li>
<li><b>MD_ORIGIN_KEY_ATTRIBUTE</b> identifies levels in a key
attribute hierarchy.</li>
<li><b>MD_ORIGIN_INTERNAL</b> identifies levels in attribute
hierarchies that are not enabled.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>The rowset is sorted on <b>CATALOG_NAME</b>, <b> SCHEMA_NAME</b>, <b>CUBE_NAME</b>,
<b>DIMENSION_UNIQUE_NAME</b>, <b>HIERARCHY_UNIQUE_NAME</b>, <b>LEVEL_NUMBER</b>.</p>
<h5>2.7.3.9. <a name="getMeasures">getMeasures</a></h5>
<p>Retrieves a result set describing each measure within a cube.</p>
<p>Specified by the <code>MDSCHEMA_MEASURES</code> XML for Analysis
method.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getMeasures">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>CATALOG_NAME</td>
<td>String</td>
<td>The name of the catalog to which this measure belongs. <code>null</code>
if the provider does not support catalogs.</td>
</tr>
<tr>
<td>SCHEMA_NAME</td>
<td>String</td>
<td>The name of the schema to which this measure belongs. <code>null</code>
if the provider does not support schemas.</td>
</tr>
<tr>
<td>CUBE_NAME</td>
<td>String</td>
<td>The name of the cube to which this measure belongs.</td>
</tr>
<tr>
<td>MEASURE_NAME</td>
<td>String</td>
<td>The name of the measure.</td>
</tr>
<tr>
<td>MEASURE_UNIQUE_NAME</td>
<td>String</td>
<td>The Unique name of the measure. For providers that generate
unique names by qualification, each component of this name is delimited.</td>
</tr>
<tr>
<td>MEASURE_CAPTION</td>
<td>String</td>
<td>A label or caption associated with the measure. Used
primarily for display purposes. If a caption does not exist, <b>MEASURE_NAME</b>
is returned.</td>
</tr>
<tr>
<td>MEASURE_GUID</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>MEASURE_AGGREGATOR</td>
<td>int</td>
<td>An enumeration that identifies how a measure was derived. Can
be one of the values allowed by the <code>xmlaOrdinal</code> field of
the <a class="javadoc" href="api/org/olap4j/metadata/Measure.Aggregator.html">org.olap4j.Measure.Aggregator</a>
enum.</td>
</tr>
<tr>
<td>DATA_TYPE</td>
<td>int</td>
<td>The data type of the measure.</td>
</tr>
<tr>
<td>NUMERIC_PRECISION</td>
<td>int</td>
<td>The maximum precision of the property if the measure object's
data type is exact numeric. <code>null</code> for all other property
types. </td>
</tr>
<tr>
<td>NUMERIC_SCALE</td>
<td>int</td>
<td>The number of digits to the right of the decimal point if the
measure object's type indicator is <b> DBTYPE_NUMERIC</b> or <b>DBTYPE_DECIMAL</b>.
Otherwise, this value is <code>null</code>. </td>
</tr>
<tr>
<td>MEASURE_UNITS</td>
<td>String</td>
<td>Not supported</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>String</td>
<td>A human-readable description of the measure. <b> null</b> if
no description exists.</td>
</tr>
<tr>
<td>EXPRESSION</td>
<td>String</td>
<td>An expression for the member.</td>
</tr>
<tr>
<td>MEASURE_IS_VISIBLE</td>
<td>boolean</td>
<td>A Boolean that always returns True. If the measure is not
visible, it will not be included in the schema rowset.</td>
</tr>
<tr>
<td>LEVELS_LIST</td>
<td>String</td>
<td>A string that always returns <code>null</code>.</td>
</tr>
<tr>
<td>MEASURE_NAME_<br/>
SQL_COLUMN_NAME</td>
<td>String</td>
<td>The name of the column in the SQL query that corresponds to
the measure's name.</td>
</tr>
<tr>
<td>MEASURE_UNQUALIFIED_<br/>
CAPTION</td>
<td>String</td>
<td>The name of the measure, not qualified with the measure group
name.</td>
</tr>
<tr>
<td>MEASUREGROUP_NAME</td>
<td>String</td>
<td>The name of the measure group to which the measure belongs.</td>
</tr>
<tr>
<td>MEASURE_DISPLAY_FOLDER</td>
<td>String</td>
<td>The path to be used when displaying the measure in the user
interface. Folder names will be separated by a semicolon. Nested
folders are indicated by a backslash (\).</td>
</tr>
<tr>
<td>DEFAULT_FORMAT_STRING</td>
<td>String</td>
<td>The default format string for the measure.</td>
</tr>
</tbody>
</table>
<p>The rowset is sorted on <b>CATALOG_NAME</b>, <b> SCHEMA_NAME</b>, <b>CUBE_NAME</b>,
<b>MEASURE_NAME</b>.</p>
<h5>2.7.3.10. <a name="getMembers">getMembers</a></h5>
<p>Retrieves a result set describing the members within a database.</p>
<p>Specified by the <code>MDSCHEMA_MEMBERS</code> XML for Analysis
method.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getMembers">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>CATALOG_NAME</td>
<td>String</td>
<td>The name of the database to which this member belongs.</td>
</tr>
<tr>
<td>SCHEMA_NAME</td>
<td>String</td>
<td>The name of the schema to which this member belongs.</td>
</tr>
<tr>
<td>CUBE_NAME</td>
<td>String</td>
<td>The name of the cube to which this member belongs.</td>
</tr>
<tr>
<td>DIMENSION_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the dimension to which this member belongs.</td>
</tr>
<tr>
<td>HIERARCHY_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the hierarchy to which this member belongs.</td>
</tr>
<tr>
<td>LEVEL_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the level to which this member belongs.</td>
</tr>
<tr>
<td>LEVEL_NUMBER</td>
<td>int</td>
<td>The distance of the member from the root of the hierarchy.
The root level is zero (0).</td>
</tr>
<tr>
<td>MEMBER_ORDINAL</td>
<td>int</td>
<td>(Deprecated) Always returns <b>0</b>. </td>
</tr>
<tr>
<td>MEMBER_NAME</td>
<td>String</td>
<td>The name of the member.</td>
</tr>
<tr>
<td>MEMBER_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the member.</td>
</tr>
<tr>
<td>MEMBER_TYPE</td>
<td>int</td>
<td>The type of the member, one of the values of the <code>ordinal</code>
field of the <a class="javadoc" href="api/org/olap4j/metadata/Member.Type.html">org.olap4j.Member.Type</a>
enum.
<p><b>FORMULA </b>takes precedence over <b>MEASURE</b>. For
example, if there is a formula (calculated) member on the Measures
dimension, it is listed as <b>FORMULA</b>. </p>
</td>
</tr>
<tr>
<td>MEMBER_GUID</td>
<td>String</td>
<td>The GUID of the member. <code>null</code> if no GUID exists.</td>
</tr>
<tr>
<td>MEMBER_CAPTION</td>
<td>String</td>
<td>A label or caption associated with the member. Used primarily
for display purposes. If a caption does not exist, <b>MEMBER_NAME</b>
is returned.</td>
</tr>
<tr>
<td>CHILDREN_CARDINALITY</td>
<td>int</td>
<td>The number of children that the member has. This can be an
estimate, so consumers should not rely on this to be the exact count.
Providers should return the best estimate possible.</td>
</tr>
<tr>
<td>PARENT_LEVEL</td>
<td>int</td>
<td>The distance of the member's parent from the root level of
the hierarchy. The root level is zero (0).</td>
</tr>
<tr>
<td>PARENT_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the member's parent. <code>null</code> is
returned for any members at the root level.</td>
</tr>
<tr>
<td>PARENT_COUNT</td>
<td>int</td>
<td>The number of parents that this member has.</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>String</td>
<td>Always returns <code>null</code>.</td>
</tr>
<tr>
<td>EXPRESSION</td>
<td>String</td>
<td>The expression for calculations, if the member is of type <b>MDMEMBER_TYPE_FORMULA</b>.</td>
</tr>
<tr>
<td>MEMBER_KEY</td>
<td>String</td>
<td>The value of the member's key column. Returns <b> null</b>
if the member has a composite key.</td>
</tr>
<tr>
<td>IS_PLACEHOLDERMEMBER</td>
<td>boolean</td>
<td>A Boolean that indicates whether a member is a placeholder
member for an empty position in a dimension hierarchy.
<p>It is valid only if the <b> MDX Compatibility</b> property
has been set to 1. </p>
</td>
</tr>
<tr>
<td>IS_DATAMEMBER</td>
<td>boolean</td>
<td>A Boolean that indicates whether the member is a data member.
<p>Returns True if the member is a data member.</p>
</td>
</tr>
<tr>
<td>Zero or more additional columns</td>
<td>int</td>
<td>No properties are returned if the members could be returned
from multiple levels. For example, if the Tree operator is <b>PARENT</b>
and <b>SELF</b> for a non-parent child hierarchy, no member properties
are returned.
<p>This applies to ragged hierarchies where tree operators could
return members from different levels (for example, if the prior level
contains holes and parent on members is requested).</p>
</td>
</tr>
</tbody>
</table>
<p>The rowset is sorted on <b>CATALOG_NAME</b>, <b> SCHEMA_NAME</b>, <b>CUBE_NAME</b>,
<b>DIMENSION_UNIQUE_NAME</b>, <b>HIERARCHY_UNIQUE_NAME</b>, <b>LEVEL_UNIQUE_NAME</b>,
<b> LEVEL_NUMBER</b>, <b>MEMBER_ORDINAL</b>.</p>
<h5>2.7.3.11. <a name="getProperties">getProperties</a></h5>
<p>Retrieves a list of descriptions of member and cell Properties.</p>
<p>Specified by the <code>MDSCHEMA_PROPERTIES</code> XML for Analysis
method.</p>
<p>The returned result set contains the following columns. </p>
<table summary="Columns returned from getProperties">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>CATALOG_NAME</td>
<td>String</td>
<td>The name of the database.</td>
</tr>
<tr>
<td>SCHEMA_NAME</td>
<td>String</td>
<td>The name of the schema to which this property belongs. <code>null</code>
if the provider does not support schemas.</td>
</tr>
<tr>
<td>CUBE_NAME</td>
<td>String</td>
<td>The name of the cube.</td>
</tr>
<tr>
<td>DIMENSION_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the dimension. For providers that generate
unique names by qualification, each component of this name is
delimited. </td>
</tr>
<tr>
<td>HIERARCHY_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the hierarchy. For providers that generate
unique names by qualification, each component of this name is
delimited. </td>
</tr>
<tr>
<td>LEVEL_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the level to which this property belongs.
If the provider does not support named levels, it should return the <b>
DIMENSION_UNIQUE_NAME</b> value for this field. For providers that
generate unique names by qualification, each component of this name is
delimited. </td>
</tr>
<tr>
<td>MEMBER_UNIQUE_NAME</td>
<td>String</td>
<td>The unique name of the member to which the property belongs.
Used for data stores that do not support named levels or have
properties on a member-by-member basis. If the property applies to all
members in a level, this column is <code>null</code>. For providers
that generate unique names by qualification, each component of this
name is delimited. </td>
</tr>
<tr>
<td>PROPERTY_TYPE</td>
<td>int</td>
<td>A bitmap that specifies the type of the property:
<ul>
<li><b>MDPROP_MEMBER</b> (<b>1</b>) identifies a property of a
member. This property can be used in the DIMENSION PROPERTIES clause of
the SELECT statement.</li>
<li><b>MDPROP_CELL</b> (<b>2</b>) identifies a property of a
cell. This property can be used in the CELL PROPERTIES clause that
occurs at the end of the SELECT statement. </li>
<li><b>MDPROP_SYSTEM</b> (<b>4</b>) identifies an internal
property.</li>
<li><b>MDPROP_BLOB</b> (<b>8</b>) identifies a property which
contains a binary large object (blob).</li>
</ul>
</td>
</tr>
<tr>
<td>PROPERTY_NAME</td>
<td>String</td>
<td>The name of the property. If the key for the property is the
same as the name for the property, <b>PROPERTY_NAME</b> will be blank.</td>
</tr>
<tr>
<td>PROPERTY_CAPTION</td>
<td>String</td>
<td>A label or caption associated with the property, used
primarily for display purposes. Returns <b> PROPERTY_NAME</b> if a
caption does not exist.</td>
</tr>
<tr>
<td>DATA_TYPE</td>
<td>int</td>
<td>The data type of the property.</td>
</tr>
<tr>
<td>CHARACTER_<br/>
MAXIMUM_LENGTH</td>
<td>int</td>
<td>The maximum possible length of the property, if it is a
character, binary, or bit type.
<p>Zero indicates there is no defined maximum length.</p>
<p>Returns <code>null</code> for all other data types.</p>
</td>
</tr>
<tr>
<td>CHARACTER_OCTET_LENGTH</td>
<td>int</td>
<td>The maximum possible length (in bytes) of the property, if it
is a character or binary type.
<p>Zero indicates there is no defined maximum length.</p>
<p>Returns <code>null</code> for all other data types.</p>
</td>
</tr>
<tr>
<td>NUMERIC_PRECISION</td>
<td>int</td>
<td>The maximum precision of the property, if it is a numeric
data type.
<p>Returns <code>null</code> for all other data types.</p>
</td>
</tr>
<tr>
<td>NUMERIC_SCALE</td>
<td>int</td>
<td>The number of digits to the right of the decimal point, if it
is a <b>DBTYPE_NUMERIC</b> or <b> DBTYPE_DECIMAL</b> type.
<p>Returns <code>null</code> for all other data types.</p>
</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>String</td>
<td>A human readable description of the property. <code>null</code>
if no description exists.</td>
</tr>
<tr>
<td>PROPERTY_CONTENT_TYPE</td>
<td>int</td>
<td>The type of the property. Can be one of the values of the <code>xmlaOrdinal</code>
field of the <a class="javadoc" href="api/org/olap4j/metadata/Property.ContentType.html">org.olap4j.Property.ContentType</a>
enum.</td>
</tr>
<tr>
<td>SQL_COLUMN_NAME</td>
<td>String</td>
<td>The name of the property used in SQL queries from the cube
dimension or database dimension.</td>
</tr>
<tr>
<td>LANGUAGE</td>
<td>int</td>
<td>The translation expressed as an <b>LCID</b>. Only valid for
property translations.</td>
</tr>
<tr>
<td>PROPERTY_ORIGIN</td>
<td>int</td>
<td>Identifies the type of hierarchy that the property applies
to:
<ul>
<li><b>MD_USER_DEFINED</b> (<b>1</b>) indicates the property is
on a user defined hierarchy</li>
<li><b>MD_SYSTEM_ENABLED</b> (<b>2</b>) indicates the property
is on an attribute hierarchy</li>
<li><b>MD_SYSTEM_DISABLED</b> (<b>4</b>) indicates the property
is on an attribute hierarchy that is not enabled.</li>
</ul>
</td>
</tr>
<tr>
<td>PROPERTY_ATTRIBUTE_<br/>
HIERARCHY_NAME</td>
<td>String</td>
<td>The name of the attribute hierarchy sourcing this property.</td>
</tr>
<tr>
<td>PROPERTY_CARDINALITY</td>
<td>String</td>
<td>The cardinality of the property. Possible values include the
following strings:
<ul>
<li><b>ONE</b></li>
<li><b>MANY</b></li>
</ul>
</td>
</tr>
<tr>
<td>MIME_TYPE</td>
<td>String</td>
<td>The mime type for binary large objects (BLOBs).</td>
</tr>
<tr>
<td>PROPERTY_IS_VISIBLE</td>
<td>boolean</td>
<td>A Boolean that indicates whether the property is visible.
<p><code>true</code> if the property is visible; otherwise, <code>false</code>.</p>
</td>
</tr>
</tbody>
</table>
<p>This schema rowset is not sorted.</p>
<h5>2.7.3.12. <a name="getSets">getSets</a></h5>
<p>Retrieves a result set describing any sets that are currently
defined in a
database, including session-scoped sets.</p>
<p>Specified by the <code>MDSCHEMA_SETS</code> XML for Analysis method.</p>
<p>The returned result set contains the following columns.</p>
<table summary="Columns returned from getSets">
<tbody>
<tr>
<th width="250">Column name</th>
<th width="100">Type</th>
<th>Description</th>
</tr>
<tr>
<td>CATALOG_NAME</td>
<td>String</td>
<td>The name of the database.</td>
</tr>
<tr>
<td>SCHEMA_NAME</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>CUBE_NAME</td>
<td>String</td>
<td>The name of the cube.</td>
</tr>
<tr>
<td>SET_NAME</td>
<td>String</td>
<td>The name of the set, as specified in the <b> CREATE SET</b>
statement.</td>
</tr>
<tr>
<td>SCOPE</td>
<td>int</td>
<td>The scope of the set:
<ul>
<li><b>MDSET_SCOPE_GLOBAL</b> (<b>1</b>)</li>
<li><b>MDSET_SCOPE_SESSION</b> (<b>2</b>)</li>
</ul>
</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>String</td>
<td>Not supported.</td>
</tr>
<tr>
<td>EXPRESSION</td>
<td>String</td>
<td>The expression for the set.</td>
</tr>
<tr>
<td>DIMENSIONS</td>
<td>String</td>
<td>A comma delimited list of hierarchies included in the set.</td>
</tr>
<tr>
<td>SET_CAPTION</td>
<td>String</td>
<td>A label or caption associated with the set. The label or
caption is used primarily for display purposes.</td>
</tr>
<tr>
<td>SET_DISPLAY_FOLDER</td>
<td>String</td>
<td>The path to be used by the user interface when displaying the
set. Folder names are separated by a backslash (<b>\</b>), folders are
separated by a semicolon (<b>;</b>).</td>
</tr>
</tbody>
</table>
<p>The rowset is sorted on <b>CATALOG_NAME</b>, <b> SCHEMA_NAME</b>, <b>CUBE_NAME</b>.</p>
<h4>2.7.4. <a name="Other_methods">Other methods</a></h4>
<table summary="Other methods in class OlapDatabaseMetaData">
<tbody>
<tr>
<th>Method</th>
<th>Description</th>
</tr>
<tr>
<td><code><a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getConnection%28%29">getConnection()</a></code></td>
<td>Returns the connection (overrides DatabaseMetaData method).</td>
</tr>
<tr>
<td><code> <a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html">getMdxKeywords()</a></code></td>
<td>Returns the keywords of this dialect of MDX, as a
comma-separated string.</td>
</tr><tr>
<td><code><a class="javadoc" href="api/org/olap4j/OlapDatabaseMetaData.html#getSupportedCellSetListenerGranularities%28%29">getSupportedCellSetListenerGranularities()</a></code></td><td>Returns the granularity of changes to cell sets that the database is capable of providing.</td></tr>
</tbody>
</table>
<h3>2.8. <a name="Transform">Transform</a></h3>
<p><span style="font-weight: bold;">NOTE</span>: As of olap4j 1.0, this package is experimental and is subject to change in future releases.</p>
<p>A transform is an operation which maps a query model to a new query
model. It
is usually triggered by a gesture within the user-interface. For
example,
clicking on the <i>Unit Sales</i> column transforms the query</p>
<div class="code"> SELECT {[Measures].[Store Sales], [Measures].[Unit
Sales]} ON COLUMNS,<br/>
{[Product].Members} ON ROWS<br/>
FROM [Sales]
</div>
<p>into one with sorting:</p>
<div class="code"> SELECT {[Measures].[Store Sales], [Measures].[Unit
Sales]} ON COLUMNS,<br/>
Order({[Product].Members}, [Measures].[Unit Sales], ASC) ON ROWS<br/>
FROM [Sales]
</div>
<p>Transformations can only modify a query within a cube - it cannot be
used to
change the cube that the query is against or to join two cubes.
Similarly, the
transform package only supports modifying a MDX query model. For
example, a
"drill" transform can not be used to produce a SQL query that returns
data
outside of the cube.</p>
<p>Package name: <a class="javadoc" href="api/org/olap4j/transform/package-summary.html">org.olap4j.transform</a></p>
<p>Classes: (incomplete)</p>
<ul>
<li>Tuple</li>
<li>Set</li>
<li>CalculatedMember</li>
<li>NamedSet</li>
<li>Axis</li>
<li>Slicer</li>
</ul>
<h4>2.8.1. <a name="Query_Model_Details">Query Model Details</a></h4>
<p><b>This section should probably be moved into Section 2.4.</b></p>
<p>The MDX query language uses a data model based on cubes, dimensions, tuples
and sets. The transformation package allows direct manipulation of a query
exploring a cube.</p>
<p>A tuple is a multidimensional member. It is a combination of members from one
or more dimensions, with the limitation that only one member can be used from each
dimension. A set is an ordered collection of tuples. An MDX query selects
zero or more axes using a data slicer. (The axes loosely correspond to the "SELECT"
clause in a SQL query, and the slicer to the "WHERE".)
</p>
<h4>2.8.2. <a name="Navigation_Actions">Navigation Actions</a></h4>
<p>The defined set of navigations can be divided into four categories: Slicing,
Restructuring, Drilling, Scoping.</p>
<h5>2.8.2.1. <a name="Slicing_navigations">Slicing Navigations</a></h5>
<dl>
<dt>setSlicer</dt><dd>Secifies the slicer to use, replacing any current one.</dd>
<dt>getSlicer</dt><dd>Retrieve the current slicer.</dd>
<dt>excludeEmpty</dt><dd>Removes empty slices from the results.</dd>
<dt>setLimit</dt><dd>Limits the results to the top/bottom n results
for a specified measure.</dd>
</dl>
<h5>2.8.2.2. <a name="Restructuring_navigations">Restructuring Navigations</a></h5>
<p>Restructuring navigations change the axes of the returned cube.</p>
<dl>
<dt>getAxis</dt>
<dt>setAxis</dt><dd>Specifies the Set to use for an Axis. Can be used to add or
replace a axis.</dd>
<dt>deleteAxis</dt><dd>Removes the specified Axis from the results.</dd>
<dt>addToAxis</dt><dd>Appends a new Tuple or Set to an Axis.</dd>
<dt>moveTuple</dt><dd>Moves a tuple from one Axis to another. If the tuple
is not contained in the first axis this method behaves like addToAxis on
the second axis.</dd>
<dt>reorderAxis</dt><dd>Reorders the tuples in the axis.</dd>
<dt>addTotal</dt><dd>Adds an aggregation (total, min, max, count, distinct)
to the specified member. More than one aggregation can be added to a single
member.</dd>
<dt>deleteTotal</dt><dd>Deletes an aggregation from the specified member.</dd>
</dl>
<h5>2.8.2.3. <a name="Drilling_navigations">Drilling Navigations</a></h5>
<p>Navigations that allow a user to move through the levels in a hierarchy. All
drill navigations operate on a single Axis.</p>
<dl>
<dt>drill</dt><dd>Moves the specified member up/down one level in the
hierarchy. All members of the hierarchy are replaced by this action.</dd>
</dl>
<h5>2.8.2.4. <a name="Scoping_navigations">Scoping Navigations</a></h5>
<p>Navigations that allow a user to expand/collapse sections of a result set.
All scoping navigations operate on single Axis.</p>
<dl>
<dt>expand</dt><dd>Expand the given measure to include both the current
level and all the members one level down
the hierarchy. Optionally expands a single measure or all measures at the
level.</dd>
<dt>collapse</dt><dd>Removes members at a given level of a hierarchy.
Optionally collapses a single measure or all measures at the level.</dd>
</dl>
<h5>2.8.2.5. <a name="Supporting_actions">Supporting Actions</a></h5>
<p>Axis Operations</p>
<ul>
<li>getSet</li>
<li>setSet</li>
<li>addToAxis</li>
<li>removeFromAxis</li>
</ul>
<p>Set Operations</p>
<ul>
<li>getTuple</li>
<li>setTuple</li>
<li>addToSet - includes Tuples, ranges of Tuples, functions, properties</li>
<li>removeFromSet</li>
</ul>
<p>Tuple Operations</p>
<ul>
<li>addMember</li>
<li>deleteMember</li>
<li>getMembers</li>
</ul>
<h4><a name="Open_Nav_Issues">Open Issues</a></h4>
<ul>
<li>Is this API at the right level, or is it too close to MDX?</li>
<li>Do we want to include support for adding highlighting conditions?</li>
<li>What about result formatting as part of the query?</li>
<li>Should common operators such as CrossJoin(), Order() and Filter()
be baked into the API as methods, or just treated as functions?</li>
<li>How should we handle functions that return or modify Sets? We want to
make it easy to wrap an entire axis in a function.</li>
<li>Should we limit the Slicer to a Tuple or allow a Set? I believe the MDX
spec allows a Set, but I don't know if anybody supports it.</li>
<li>I think we should add some explicit time based functions, since time
based analysis is so common, and so frequently done wrong. ie if the Axis
is using a time based dimension you can use "setCompareToPreviousTimePeriod()"
instead of having to add the previous time period as a member and calculate
the change.</li>
</ul>
<h3>2.9. <a name="Layout">Layout</a></h3>
<p><span style="font-weight: bold;">NOTE</span>: As of olap4j 1.0, this package
is experimental and is subject to change in future releases.</p>
<p>The layout package provides data models for graphical OLAP
applications. In
particular, the GridModel class provides, for OLAP data, what Swing's
<a class="javadoc" href="http://download.oracle.com/j2se/1.4.2/docs/api/javax/swing/table/TableModel.html">TableModel</a>
provides for SQL data.</p>
<p>Package name: <a class="javadoc" href="api/org/olap4j/layout/package-summary.html">org.olap4j.layout</a></p>
<p>Classes: TBD</p>
<h3>2.10. <a name="Scenarios"></a>Scenarios</h3>
<p><span style="font-weight: bold;">NOTE</span>: As of olap4j 1.0, this
functionality is experimental and is subject to change in future releases.</p>
<p>Scenarios allow an application to change values of cells. When the
value of a cell changes, values of related cells also change (parent
cells, child and descendant cells, and calculated cells).</p>
<p>Scenarios can therefore be used to perform 'what-if' analysis,
useful in budgeting or forecasting applications. This functionality is
commonly called 'write-back' (or sometimes 'writeback' or
'writethrough'; see for instance
<a href="http://en.wikipedia.org/wiki/Comparison_of_OLAP_Servers">the wikipedia
article "Comparison of OLAP Servers"</a>), but we avoid that term because this
specification does not stipulate that a provider implements scenarios by writing
the changed values to disk.</p>
<p>Each scenario has a different set of modifications. There is a base
scenario where the values are unchanged from the star schema; in this
scenario, cells cannot be modified.</p>
<p>A provider <span style="font-style: italic;">may</span> provide
a <code>[Scenario]</code> dimension for each cube for which scenarios are
enabled. This dimension contains a member for each scenario that is visible in
the current access-control context; the name of each member is the value
returned by the <code>getId()</code> method. The default member of the Scenario
dimension is the current scenario for the current connection (as set by
the <code>OlapConnection.setScenario()</code> method).</p>
<p>The Scenario dimension behaves in the way you would expect. For example, if a
query contains a slicer <code>WHERE [Scenario].[1]</code> then the cell values
returned by that query will reflect their values under that scenario. Also, you
can define cross-dimensional calculations, such as <code>WITH MEMBER [Gain] AS
([Time].[2011], [Scenario].[1] - [Scenario].[Default Scenario])</code>, to
compare values under two or more scenarios.</p>
<p>A particular provider <span style="font-style: italic;">may</span> provide a
means to save a scenario. (Say, to modify the fact table, or save the scenario
to disk in some other format.)</p>
<p>A particular provider <span style="font-style: italic;">may</span>
support access control to scenarios. (For example, a particular
scenario is invisible to role A, visible but read-only to role B, and
read-write to role C.)</p>
<p>Methods of the Scenario class:</p>
<ul>
<li><code>String getId()</code> // returns the unique identifier of this scenario</li>
</ul>
<p>Other methods relating to scenarios:</p>
<ul>
<li><code>Scenario OlapConnection.createScenario()</code> // creates a scenario</li>
<li><code>void OlapConnection.setScenario(Scenario)</code> // sets the current scenario for this connection</li>
<li><code>Scenario OlapConnection.getScenario()</code> // returns this connection's current scenario</li>
<li><code>void Cell.setValue(Object value, AllocationPolicy allocationPolicy, Object... allocationArgs)</code> // sets the value of a cell</li>
</ul>
<h3>2.11. <a name="Notifications"></a>Notifications</h3>
<p><span style="font-weight: bold;">NOTE</span>: As of olap4j 1.0,
this functionality is experimental and is subject to change in future
releases.</p>
<p>The <code>CellSetListener</code> interface allows an application to
receive events when the contents of a CellSet have changed.</p>
<p>The client can ask the server to provide the listener with a
specific granularity of events, but the server can decline to provide
that granularity.</p>
<p>Fine granularity deals with changes such as cell values changing
(and reports the before and after value, before and after formatted
value), positions being deleted, positions being changed.</p>
<p>When an atomic change happens on the server (say a cache flush, if
the server is mondrian) then an event will arrive on the client
containing all of those changes. Although
<code>CellSetListener.CellSetChange.getCellChanges()</code> and
<code>CellSetListener.CellSetChange.getAxisChanges()</code> return lists, the
client should assume that all of the events in these lists occur
simultaneously.</p>
<p>At any point, the server is free to throw up its hands and say
'there are too many changes' by sending null values
for <code>getCellChanges</code> or <code>getAxisChanges</code>. This
prevents situations where there are huge numbers of changes that might
overwhelm the server, the network link, or the client, such as might
happen if a large axis is re-sorted.</p>
<p>The client should always be ready for that to happen (even for
providers that claim to provide fine granularity events), and should
re-execute the query to get the cell set. In fact, we recommend that
clients re-execute the query to get a new cellset whenever they get an
event. Then the client can use the details in the event to highlight
cells that have changed.</p>
<p>Methods on interface CellSetListener:</p>
<ul>
<li><code>cellSetChanged(CellSetChange)</code> // invoked when a cell set has changed</li>
<li><code>cellSetClosed(CellSet)</code> // invoked when a cell set is closed</li>
<li><code>cellSetOpened(CellSet)</code> // invoked when a cell set is opened</li>
</ul>
<p>Methods on interface CellSetChange:</p>
<ul>
<li><code>CellSet getCellSet()</code> // returns the cell set affected by this change</li>
<li><code>List<CellChange> getCellChanges()</code> // returns a list of cells that have changed, or null if the server cannot provide detailed changes</li>
<li><code>List<AxisChange> getAxisChanges()</code> // returns a list of axis changes, or null if the server cannot provide detailed changes</li>
</ul>
<p>Methods on interface AxisChange:</p>
<ul>
<li><code>CellSetAxis getAxis()</code> // returns the axis affected by this change</li>
<li><code>Position getBeforePosition()</code> // returns the position before the change; null if the change created a new position</li>
<li><code>Position getAfterPosition()</code> // returns the position after the change; null if the change deleted a new position</li>
</ul>
<p>Methods on interface CellChange:</p>
<ul>
<li><code>Cell getBeforeCell()</code> // returns the cell before the change</li>
<li><code>Cell getAfterCell()</code> // returns the cell after the change</li>
</ul>
<p>Other methods:</p>
<ul>
<li><code>OlapDatabaseMetaData.getSupportedCellSetListenerGranularities()</code> // returns the granularity of changes to cell sets that the database is capable of providing</li>
<li><code>OlapStatement.addListener(Granularity, CellSetListener)</code> // adds a listener to be notified of events to CellSets created by this statement</li>
</ul>
<h4>Notes for implementors</h4>
<p>The purpose of registering a listener before creating a cell set is
to ensure that no events "leak out" between creating a cell set and
registering a listener, or while a statement is being re-executed to
produce a new cell set.</p>
<p>The <code>cellSetOpened(CellSet)</code>
and <code>cellSetClosed(CellSet)</code> methods are provided so that
the listener knows what is going on when a statement is
re-executed. In particular, suppose a statement receives an change
event decides to re-execute. The listener is attached to the
statement, so receives notifications about both old and new cell
sets. The driver implicitls closes the previous cell set and calls
cellSetClosed, then calls <code>cellSetOpened</code> with the new cell set.</p>
<p>If changes are occurring regularly on the server, there will soon
be a call to
<code>cellSetChanged(CellSetChange)</code>. It
is important to note that this event contains only changes that have
occurred since the new cell set was opened.</p>
<p>The granularity parameter is provided to
<code>OlapStatement.addListener(Granularity, CellSetListener)</code>
for the server's benefit. If granularity is
only <code>Granularity.COARSE</code>, the server may be able to store
less information in order to track the cell set.</p>
<h3>2.12. <a name="Drill_through"></a>Drill through</h3>
<p>olap4j provides two ways of drilling through to get the collection of
atomic rows underlying a given cell.</p>
<ul>
<li>The <code>Cell.drillThrough()</code> method drills through a given
cell in the cell set returned by a previously executed statement.</li>
<li>Execute the <code>DRILLTHROUGH</code> MDX statement using
the <code>OlapStatement.executeStatement(String sql)</code>
method.</li>
</ul>
<p>The <code>DRILLTHROUGH</code> statement is a more powerful
approach, because it offers options <code>MAXROWS</code> to limit the
number of rows returned, and <code>RETURN</code> to choose which
attributes and measures are projected, but not all OLAP servers
implement it.</p>
<p>Note that we call the <code>ResultSet
Statement.executeStatement(String sql)</code> method,
not <code>CellSet OlapStatement.executeOlapStatement(String
mdx)</code>, because the result of drillthrough is relational (rows
and columns), not a dimensional (axes and cells). A statement can be
created by calling <code>OlapConnection.createStatement()</code>; even
though this returns an <code>OlapStatement</code>, the OlapStatement
is required to implement applicable methods of
its <code>Statement</code> base class.</p>
<h2>3. <a name="Other_topics">Other topics</a></h2>
<p>In this section we discuss aspects of the design and usage of olap4j which
pervade all of the components.</p>
<h3>3.1. <a name="Internationalization">Internationalization</a></h3>
<p>Metadata elements in olap4j can be localized. Unlike the tables and
columns model of relational databases and JDBC, elements of an OLAP
data model appear on the screen of the end-user, and the user expects
these elements to appear in his or her own language.</p>
<p>A connection has a locale. For most drivers, this can be initialized
using a connection parameter called <code>Locale</code>. The locale
can be overridden by calling <code>OlapConnection.setLocale(Locale)</code>.</p>
<p>Metadata elements Cube, Dimension, Hierarchy, Level, Member and so
forth have methods <code>getCaption</code> and <code>getDescription</code>
(inherited from
<a class="javadoc" href="api/org/olap4j/metadata/MetadataElement.html">MetadataElement</a>).
The values returned from these methods depend on the locale of the connection.</p>
<p>Suppose one cube is available in English and French, and in French
and Spanish, and both are shown in same portal. Clients typically say
that seeing reports in a mixture of languages is confusing; the portal
would figure out the best common language, in this case French. The
<a class="javadoc" href="api/org/olap4j/metadata/Cube.html">Cube</a>
and <a class="javadoc" href="api/org/olap4j/metadata/Schema.html">Schema</a>
objects have <code>getSupportedLocales()</code> methods for this purpose.</p>
<h3>3.2. <a name="Concurrency_and_thread-safety">Concurrency and
thread-safety</a></h3>
<p>The JDBC 4.0 specification describes the thread-safety requirements
for drivers, and what modes of concurrency JDBC applications can assume
that their drivers will support. Since the olap4j specification is an
extension to the JDBC specification, an olap4j driver must comply with
the JDBC specification in this regard.</p>
<h3>3.3. <a name="Canceling_statements">Canceling statements</a></h3>
<p>The JDBC specification provides the
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/Statement.html#cancel%28%29">Statement.cancel()</a>
method, so that a statement which is executing in one thread may be
safely terminated by another thread; and
<a class="javadoc" href="http://download.oracle.com/javase/6/docs/api/java/sql/Statement.html#setQueryTimeout%28int%29">Statement.setQueryTimeout(int
seconds)</a>, to request that a statement aborts itself after executing
for a certain period of time.</p>
<h2>4. <a name="Other_components">Other components</a></h2>
<p>The API described above is a set of interfaces which must be implemented by
any compliant provider. The olap4j project also contains some components which
are not part of the API.</p>
<h3>4.1. <a name="Test_suite">Test suite</a></h3>
<p>The olap4j project contains a TCK (Test Compatibility Kit). The TCK is a suite
of tests which can be used to verify the compliance of an implementation of the
API.</p>
<h3>4.2. <a name="XMLA_provider">XML/A provider</a></h3>
<p>The XML/A provider is an implementation of the olap4j API which talks to a
generic XML/A provider.</p>
<p>Since there are many XML/A providers, and some of them require requests in a
particular format and/or produce idiosyncratic responses, the XML/A provider
will come in several flavors.</p>
<p>The XML/A provider is being developed in the same source-code repository as
olap4j, in a Java package <code>org.olap4j.driver.xmla</code>, but is not part
of the olap4j specification or release.</p>
<h2>5. <a name="Non-functionality">Non-functionality</a></h2>
<p>Here are some of the areas of functionality which will <i>not</i> be part of
olap4j:</p>
<ul>
<li>Schema reader parses an XML file to create a schema</li>
<li>Cache management functions </li>
<li>Ability to create/modify schema dynamically</li>
<li>Definitions of MDX functions (such as the number and types of parameters)</li>
<li>SPI to extend the system by creating user-defined functions and so forth</li>
<li>XML/A bridge (to make an olap4j data source appear as an XML/A server)</li>
<li>SchemaReader</li>
</ul>
<h2>6. <a name="Related_projects">Related projects</a></h2>
<h3>6.1. <a name="Mondrian_provider">Mondrian provider</a></h3>
<p>The Mondrian project contains an implementation of the olap4j
API based on
the Mondrian OLAP engine, namely the <a class="javadoc" href="http://mondrian.pentaho.com/api/mondrian/olap4j/MondrianOlap4jDriver.html">mondrian.olap4j.MondrianOlap4jDriver</a><a> driver. It is the reference implementation of olap4j.</a></p>
<h3>6.2. <a name="XMLA_provider_project">XML for Analysis provider</a></h3>
<p>We intend to create an a driver which implements the olap4j API on
top of any XML/A data source.</p>
<p>This code is currently being developed in the same source-code
repository as olap4j, but will be spun off as a separate project at some point.</p>
<h3>6.3. <a name="Other_data_sources">Other data sources</a></h3>
<p>In principle, providers could be created to other OLAP data
sources. This would be particularly straightforward for servers which
already have a native Java API.</p>
<h3>6.4 <a name="xmla4js"></a>xmla4js</h3>
<p><a href="http://code.google.com/p/xmla4js/">xmla4js</a> is a JavaScript front-end to XML/A.</p>
<h2>Appendix A. <a name="Opportunities_for_specification">Opportunities
for specification</a></h2>
<p>The following are features which have been suggested for inclusion
in the
olap4j specification, but which are not part of the current version.
They may be
included in future revisions of the specification.</p>
<h3>A.1. Date and Time types</h3>
<p>Include support for Date and Time values. The package <code>org.olap4j.type</code>
could have additional classes DateType and TimeType.</p>
<p>(Richard Emberson, 2006/8/14)</p>
<h3>A.2. Schema notification</h3>
<p>Add a mechanism for the client to detect that the schema has been modified
(for instance, that a cube has been added). Not necessarily to find out what
those changes are.</p>
<p>(Richard Emberson, 2006/8/15)</p>
<h2>Appendix B. <a name="Feedback">Feedback</a></h2>
<h3>Richard Emberson, email, 2006/8/15</h3>
<p>"One thing we found about XMLA was that our users wanted all roles to be
defined, stored, modified, and accessed though the same mechanism. With a large
application with many areas that can be permissioned, it is important that
olap4j let an application builder manage roles externally and apply them as part
of an individual's execution context."</p>
<h2>Appendix C. <a name="Open_issues">Open issues</a></h2>
<p>These issues will be voted upon at the next meeting. If they are accepted,
they will generally be put into the spec.</p>
<p>(No issues are currently open.)</p>
<h2>Appendix D. <a name="Miscellaneous">Miscellaneous</a></h2>
<h3>D.1. To be specified</h3><p>[2006/10/20#3. Need to allow clients to access the members on a
ResultAxis via a list (for convenience) and via an iterator. Iterators
need to be restartable, but not bidirectional. Need to know the size of
the axes, even if using the iterator interface.]</p>
<p>[2006/10/20#6. We discussed session support. It is necessary for
write-back. JDBC's 'stateful session' is difficult to implement over a
stateless protocol like HTTP. Michael suggested adding 'session name'
as a parameter to 'execute' methods. Julian disagreed. No conclusion
reached.]</p>
<p>[2006/10/20#7. We discussed the goals and intended audience of
olap4j. The audience spans from a beginner's audience (only 2 hours
experience with the API) who don't want to write a lot of code, to
writers of clients (2 yrs experience with the API) who want performance
and don't care how much code they need to write. Distributed clients
(e.g. olap4j provider for XMLA) have bandwidth constraints. Mobile
clients also have memory constraints.</p>
<p>ADOMD addressed beginners audience well, but used a lot of memory.
Challenge is to support an object model (hence easy programming model)
without increasing memory. No specific change to the specification, but
decided to add memory efficiency as a design goal.]</p>
<h3>D.2. Design notes</h3>
<h4><a name="JDK">JDK</a></h4>
<p>We are targeting JDK 1.5, and running retroweaver for
backward compatibility for JDK 1.4. See forum thread:
<a href="http://sourceforge.net/forum/forum.php?thread_id=1560764&forum_id=577988">
olap4j, JDK 1.5 and generics</a>.</p>
<p>We also support JDK 1.6, and with it JDBC 4.0. </p>
<h4>Result sets, random access, and memory usage</h4>
<p>Should result sets return their axes as cursors or collections? Cursors
require less memory, but collections provide an easier programming model.</p>
<p>Also on the subject of memory, how to represent the metadata? Schema result
sets require less memory, are more flexible, and have better defined semantics
in the presence of transactions and offline working; but an object model (Cube,
Dimension, Level) provides an easier programming model.</p>
<h4>Accessing cells</h4>
<p>It would be possible to access cells in a result set (a) by ordinal; (b) by
coordinates; (c) by the 'etchasketch' model determined by the position of the
iterator along each axis, as used by JOLAP. We decided to support (a) and (b)
but not (c). There are methods on CellSet to convert from ordinal to
coordinates and vice versa.</p>
<p>If there is a huge number of cells, the client has limited memory, and
bandwidth to the server is limited, random access to cells is costly. Michael
suggested that we add a method <code>List<Cell> getCells(int startOrdinal, int
endOrdinal)</code>, which matches XML/A behavior, but we declined to add it to the spec
for now. John drew the analogy of a modern file system, implementing a serial
access interface (streams) on top of random-access primitives. For now, we
support only random access, but suggest that the provider looks for patterns of
access.</p>
<h2>Appendix E. <a name="References">References</a></h2>
<p>1. <a name="XMLA">XMLA</a>: <a class="l" href="http://www.xmla.org/spec/1.1/xmla1.1.doc">XML for
Analysis Specification, version 1.1</a>.</p>
<h2>Appendix F. <a name="Change_log">Change log</a></h2>
<ul>
<li>Version 1.0.</li>
</ul>
<hr noshade="noshade">
</body></html>
|