Project

General

Profile

« Previous | Next » 

Revision 3879

Added by Jing Tao almost 16 years ago

Check into cvs head. Modify some query string.

View differences:

test/edu/ucsb/nceas/metacattest/QuerySpecificationTest.java
53 53
    private static String selectionQuery = "SELECT docid,docname,doctype,date_created, date_updated, rev " +
54 54
    		"FROM xml_documents WHERE docid IN (((((SELECT DISTINCT docid FROM xml_nodes " +
55 55
    		"WHERE UPPER(nodedata) LIKE '%JONES%' ) ))))";
56
    private static String extendedQuery = "select xml_nodes.docid, 'dataset/title' as path, xml_nodes.nodedata, xml_nodes.parentnodeid from xml_nodes, xml_documents where parentnodeid IN (SELECT nodeid FROM xml_nodes WHERE nodename LIKE 'title' AND parentnodeid IN (SELECT nodeid FROM xml_nodes WHERE nodename LIKE 'dataset' ) )  AND xml_nodes.docid in " +
56
    /*private static String extendedQuery = "select xml_nodes.docid, 'dataset/title' as path, xml_nodes.nodedata, xml_nodes.parentnodeid from xml_nodes, xml_documents where parentnodeid IN (SELECT nodeid FROM xml_nodes WHERE nodename LIKE 'title' AND parentnodeid IN (SELECT nodeid FROM xml_nodes WHERE nodename LIKE 'dataset' ) )  AND xml_nodes.docid in " +
57 57
    		"('obfs.45337', 'obfs.45338', 'obfs.45346') AND xml_nodes.nodetype = 'TEXT' AND " +
58 58
    		"xml_nodes.rootnodeid = xml_documents.rootnodeid UNION select xml_nodes.docid, 'originator/individualName/surName' as " +
59 59
    		"path, xml_nodes.nodedata, xml_nodes.parentnodeid from xml_nodes, xml_documents where parentnodeid IN " +
......
84 84
    		"parentnodeid IN (SELECT nodeid FROM xml_nodes WHERE nodename LIKE 'dataset' AND parentnodeid " +
85 85
    		"IN (SELECT nodeid FROM xml_nodes WHERE nodename LIKE 'eml' AND parentnodeid = rootnodeid ) ) ) )  " +
86 86
    		"AND xml_nodes.docid in ('obfs.45337', 'obfs.45338', 'obfs.45346') AND xml_nodes.nodetype = 'TEXT' " +
87
    		"AND xml_nodes.rootnodeid = xml_documents.rootnodeid";
87
    		"AND xml_nodes.rootnodeid = xml_documents.rootnodeid";*/
88
    private static String extendedQuery ="select xml_nodes.docid, xml_index.path, xml_nodes.nodedata,  xml_nodes.parentnodeid, xml_nodes.nodetype FROM xml_index, xml_nodes WHERE"+
89
                                    " ( (xml_index.nodeid=xml_nodes.parentnodeid AND xml_index.path IN ('dataset/title', 'originator/individualName/surName' , 'keyword' ) AND xml_nodes.nodetype = 'TEXT') "+
90
                                    "OR  (xml_index.nodeid=xml_nodes.nodeid AND ( xml_index.path IN ( '/eml/@packageId', '/eml/dataset/access/@authSystem' , '/eml/dataset/access/@order' ) AND xml_nodes.nodetype = 'ATTRIBUTE'))) "+
91
                                    "AND xml_nodes.docid in ('obfs.45337', 'obfs.45338', 'obfs.45346')";
88 92
    
89 93
    /* Initialize Options*/
90 94
    static
......
164 168
    public void testPrintExtendedSQL()
165 169
    {
166 170
        try {
167
            System.out.println("---- EXT SQL ------------------");
171
            System.out.println("---- orginal EXT SQL  ------------------\n"+extendedQuery);
168 172
            QuerySpecification qspec = new QuerySpecification(xml, 
169 173
                    MetaCatUtil.getOption("saxparser"), 
170 174
                    MetaCatUtil.getOption("accNumberSeparator"));
171 175
            String query = 
172 176
                    qspec.printExtendedSQL(
173
                            "'obfs.45337', 'obfs.45338', 'obfs.45346'", false);
177
                            "'obfs.45337', 'obfs.45338', 'obfs.45346'", true);
178
            System.out.println("---- builded EXT SQL ------------------ \n"+query);
174 179
            assertTrue(extendedQuery.equals(query));
175 180
        } catch (IOException e) {
176 181
            fail(e.getMessage());
test/edu/ucsb/nceas/metacattest/QueryResultBuilderTest.java
77 77
    {
78 78
        TestSuite suite = new TestSuite();
79 79
        suite.addTest(new QueryResultBuilderTest("initialize"));
80
        suite.addTest(new QueryResultBuilderTest("testBuildRecords"));
80
        //suite.addTest(new QueryResultBuilderTest("testBuildRecords"));
81 81
        return suite;
82 82
    }
83 83
   

Also available in: Unified diff