From: Lars H. <lh...@us...> - 2005-03-08 12:34:14
|
Update of /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/backends In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17903/src/org/tmapiutils/query/tolog/test/backends Modified Files: BasicTests.java QueryTestBase.java Log Message: Shift to Apache License 2.0 More TMAPI compatible, some classes already compile. ;) Deleted CVS log from files Index: QueryTestBase.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/backends/QueryTestBase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QueryTestBase.java 6 Mar 2005 21:11:34 -0000 1.2 --- QueryTestBase.java 8 Mar 2005 12:33:59 -0000 1.3 *************** *** 1,11 **** /* ! Copyright (c) 2000-2004 The TM4J Project. All rights reserved. ! ! The license for this source code can be found in the file ! LICENSE.TXT with this distribution or at http://tm4j.org/LICENSE.txt ! */ ! /* ! *$Header$ */ package org.tmapiutils.query.tolog.test.backends; --- 1,19 ---- /* ! * Copyright 2005 TMAPI Utils / Kal Ahmed, Lars Heuer ! * Copyright (c) 2000-2004 The TM4J Project. All rights reserved. ! * ! * Licensed under the Apache License, Version 2.0 (the "License"); ! * you may not use this file except in compliance with the License. ! * You may obtain a copy of the License at ! * ! * http://www.apache.org/licenses/LICENSE-2.0 ! * ! * Unless required by applicable law or agreed to in writing, software ! * distributed under the License is distributed on an "AS IS" BASIS, ! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ! * See the License for the specific language governing permissions and ! * limitations under the License. */ + package org.tmapiutils.query.tolog.test.backends; *************** *** 26,43 **** /** ! * @author Kal ! * ! * Describe QueryTestBase here. */ ! public class QueryTestBase extends ConfigurableBackendTest { private HashMap m_maps; ! public QueryTestBase(String name) { super(name); m_maps = new HashMap(); } ! ! public TopicMap getTopicMap(String tmKey) throws Exception { TopicMap ret = (TopicMap) m_maps.get(tmKey); --- 34,51 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ ! public class QueryTestBase extends ConfigurableBackendTest { private HashMap m_maps; ! public QueryTestBase(String name) { super(name); m_maps = new HashMap(); } ! ! public TopicMap getTopicMap(String tmKey) throws Exception { TopicMap ret = (TopicMap) m_maps.get(tmKey); *************** *** 48,52 **** return ret; } ! protected void doQueryWithModule(TopicMap tm, File moduleFile, String modulePrefix, String queryString, String[][] expectedResults) throws Exception { QueryEvaluator qe = QueryEvaluatorFactory.newQueryEvaluator(tm); --- 56,60 ---- return ret; } ! protected void doQueryWithModule(TopicMap tm, File moduleFile, String modulePrefix, String queryString, String[][] expectedResults) throws Exception { QueryEvaluator qe = QueryEvaluatorFactory.newQueryEvaluator(tm); *************** *** 55,59 **** validateResultsSet(rs, expectedResults); } ! protected void doQuery(TopicMap tm, String queryString, String[][] expectedResults) throws Exception { QueryEvaluator qe = QueryEvaluatorFactory.newQueryEvaluator(tm); --- 63,67 ---- validateResultsSet(rs, expectedResults); } ! protected void doQuery(TopicMap tm, String queryString, String[][] expectedResults) throws Exception { QueryEvaluator qe = QueryEvaluatorFactory.newQueryEvaluator(tm); *************** *** 61,65 **** validateResultsSet(rs, expectedResults); } ! protected void doQuery(TopicMap tm, String [] rules, String queryString, String [][] expectedResults) throws Exception { QueryEvaluator qe = QueryEvaluatorFactory.newQueryEvaluator(tm); --- 69,73 ---- validateResultsSet(rs, expectedResults); } ! protected void doQuery(TopicMap tm, String [] rules, String queryString, String [][] expectedResults) throws Exception { QueryEvaluator qe = QueryEvaluatorFactory.newQueryEvaluator(tm); *************** *** 70,74 **** validateResultsSet(rs, expectedResults); } ! protected void validateResultsSet(TologResultsSet rs, String[][] expectedResults) throws Exception { assertEquals("Results set size is wrong.", expectedResults.length, rs.getNumRows()); --- 78,82 ---- validateResultsSet(rs, expectedResults); } ! protected void validateResultsSet(TologResultsSet rs, String[][] expectedResults) throws Exception { assertEquals("Results set size is wrong.", expectedResults.length, rs.getNumRows()); *************** *** 79,83 **** } } ! public String dumpResultsSet(TologResultsSet rs) { StringBuffer ret = new StringBuffer(); --- 87,91 ---- } } ! public String dumpResultsSet(TologResultsSet rs) { StringBuffer ret = new StringBuffer(); *************** *** 88,92 **** return ret.toString(); } ! /** * @param list --- 96,100 ---- return ret.toString(); } ! /** * @param list *************** *** 116,120 **** return false; } ! protected boolean validateRow(List row, String [] expected) throws Exception { if (row.size() != expected.length) return false; --- 124,128 ---- return false; } ! protected boolean validateRow(List row, String [] expected) throws Exception { if (row.size() != expected.length) return false; *************** *** 164,195 **** } - /* - * $Log$ - * Revision 1.2 2005/03/06 21:11:34 lheuer - * More TM4J -> TMAPI translations - * - * Revision 1.1 2005/03/06 17:34:39 lheuer - * Initial tolog import - * - * Revision 1.8 2004/07/21 08:45:35 kal_ahmed - * Fixed bugs in reifies predicate. - * - * Revision 1.7 2004/07/19 14:52:41 kal_ahmed - * More fixes to processing of recursive rules. ClauseList now aborts when the input parameter list becomes empty. - * - * Revision 1.6 2004/07/16 13:51:52 kal_ahmed - * Fixes for tolog engine handling of rules and rule-recursion. - * - * Revision 1.5 2004/06/21 18:42:28 kal_ahmed - * Improved exception propagation. - * - * Revision 1.4 2004/06/20 14:12:31 kal_ahmed - * Copied TologRsultsSet interface and TologFragmentBuilder implementation from org.tm4j.tolog to this package. - * - * Revision 1.3 2004/06/15 20:00:35 kal_ahmed - * Added a few more tests over the block-world topic map. - * - * Revision 1.2 2004/06/15 19:44:48 kal_ahmed - * Resynced expected results with actual topic map. - * - */ \ No newline at end of file --- 172,173 ---- Index: BasicTests.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/backends/BasicTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicTests.java 6 Mar 2005 17:34:39 -0000 1.1 --- BasicTests.java 8 Mar 2005 12:33:59 -0000 1.2 *************** *** 1,11 **** /* ! Copyright (c) 2000-2004 The TM4J Project. All rights reserved. ! ! The license for this source code can be found in the file ! LICENSE.TXT with this distribution or at http://tm4j.org/LICENSE.txt ! */ ! /* ! *$Header$ */ package org.tmapiutils.query.tolog.test.backends; --- 1,19 ---- /* ! * Copyright 2005 TMAPI Utils / Kal Ahmed, Lars Heuer ! * Copyright (c) 2000-2004 The TM4J Project. All rights reserved. ! * ! * Licensed under the Apache License, Version 2.0 (the "License"); ! * you may not use this file except in compliance with the License. ! * You may obtain a copy of the License at ! * ! * http://www.apache.org/licenses/LICENSE-2.0 ! * ! * Unless required by applicable law or agreed to in writing, software ! * distributed under the License is distributed on an "AS IS" BASIS, ! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ! * See the License for the specific language governing permissions and ! * limitations under the License. */ + package org.tmapiutils.query.tolog.test.backends; *************** *** 16,24 **** /** ! * @author Kal ! * ! * Describe BasicTests here. */ ! public class BasicTests extends QueryTestBase { --- 24,32 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ ! public class BasicTests extends QueryTestBase { *************** *** 30,34 **** } ! public void testOneDynamicAssociation() throws Exception { TopicMap tm = getTopicMap("tolog.blocks"); --- 38,42 ---- } ! public void testOneDynamicAssociation() throws Exception { TopicMap tm = getTopicMap("tolog.blocks"); *************** *** 39,43 **** }); } ! public void testOpenDynamicAssociation() throws Exception { --- 47,51 ---- }); } ! public void testOpenDynamicAssociation() throws Exception { *************** *** 50,54 **** new String [] { "yellowblock", "redblock"}}); } ! public void testTwoDynamicAssociationsAND() throws Exception { --- 58,62 ---- new String [] { "yellowblock", "redblock"}}); } ! public void testTwoDynamicAssociationsAND() throws Exception { *************** *** 60,64 **** }); } ! public void testTwoDynamicAssociationsOR() throws Exception { --- 68,72 ---- }); } ! public void testTwoDynamicAssociationsOR() throws Exception { *************** *** 71,75 **** }); } ! public void testInstanceOf() throws Exception { --- 79,83 ---- }); } ! public void testInstanceOf() throws Exception { *************** *** 89,93 **** new String [] {"blueblock"}}); } ! public void testNamesToValues() throws Exception { doQuery( --- 97,101 ---- new String [] {"blueblock"}}); } ! public void testNamesToValues() throws Exception { doQuery( *************** *** 100,104 **** new String [] {"yellowblock", "Yellow Block"}}); } ! public void testNamesAndOcurrencesToValues() throws Exception { doQuery( --- 108,112 ---- new String [] {"yellowblock", "Yellow Block"}}); } ! public void testNamesAndOcurrencesToValues() throws Exception { doQuery( *************** *** 110,116 **** new String [] {"redblock", "Red Block", "10"}, new String [] {"yellowblock", "Yellow Block", "15"}}); ! } ! public void testDynamicAssociationWithVariableType() throws Exception { doQuery( --- 118,124 ---- new String [] {"redblock", "Red Block", "10"}, new String [] {"yellowblock", "Yellow Block", "15"}}); ! } ! public void testDynamicAssociationWithVariableType() throws Exception { doQuery( *************** *** 124,128 **** }); } ! private static final String [] auto_rules = new String [] { "matches-facet($FACET, $FV, $INST) :- " + --- 132,136 ---- }); } ! private static final String [] auto_rules = new String [] { "matches-facet($FACET, $FV, $INST) :- " + *************** *** 135,139 **** " matches-facet($FACET, $X, $INST)" + "}.", ! "subfacet-of($SUBFV, $SUPERFV, $FACET) :- " + " facet-has-hierarchy-type($FACET : facet, $ASSOC : facet-hierarchy-type)," + --- 143,147 ---- " matches-facet($FACET, $X, $INST)" + "}.", ! "subfacet-of($SUBFV, $SUPERFV, $FACET) :- " + " facet-has-hierarchy-type($FACET : facet, $ASSOC : facet-hierarchy-type)," + *************** *** 145,154 **** " subfacet-of($X, $SUPERFV, $FACET)" + " }.", ! "direct-subfacet-of($SUBFV, $SUPERFV, $FACET) :- " + " facet-has-hierarchy-type($FACET:facet, $ASSOC:facet-hierarchy-type)," + " direct-instance-of($SUPER, superordinate-role)," + " direct-instance-of($SUB, subordinate-role)," + ! " $ASSOC($SUBFV:$SUB, $SUPERFV:$SUPER).", }; --- 153,162 ---- " subfacet-of($X, $SUPERFV, $FACET)" + " }.", ! "direct-subfacet-of($SUBFV, $SUPERFV, $FACET) :- " + " facet-has-hierarchy-type($FACET:facet, $ASSOC:facet-hierarchy-type)," + " direct-instance-of($SUPER, superordinate-role)," + " direct-instance-of($SUB, subordinate-role)," + ! " $ASSOC($SUBFV:$SUB, $SUPERFV:$SUPER).", }; *************** *** 198,202 **** rs = qe.execute("select $AUTO from matches-facet(body-type, all-body-types, $AUTO), matches-facet(engine-type, all-engine-types, $AUTO), matches-facet(engine-size, all-engine-sizes, $AUTO) ?"); assertEquals(7, rs.getNumRows()); ! this.validateResultsSet(rs, new String[][] { new String [] {"clio1_2"}, --- 206,210 ---- rs = qe.execute("select $AUTO from matches-facet(body-type, all-body-types, $AUTO), matches-facet(engine-type, all-engine-types, $AUTO), matches-facet(engine-size, all-engine-sizes, $AUTO) ?"); assertEquals(7, rs.getNumRows()); ! this.validateResultsSet(rs, new String[][] { new String [] {"clio1_2"}, *************** *** 215,219 **** "direct-subfacet-of($SUBFV, $SUPERFV, $FACET) :- " + "facet-has-hierarchy-type($FACET:facet, $ASSOC:facet-hierarchy-type)," + ! "$ASSOC($SUBFV:$SUB, $SUPERFV:$SUPER)," + "direct-instance-of($SUPER, superordinate-role)," + "direct-instance-of($SUB, subordinate-role)."); --- 223,227 ---- "direct-subfacet-of($SUBFV, $SUPERFV, $FACET) :- " + "facet-has-hierarchy-type($FACET:facet, $ASSOC:facet-hierarchy-type)," + ! "$ASSOC($SUBFV:$SUB, $SUPERFV:$SUPER)," + "direct-instance-of($SUPER, superordinate-role)," + "direct-instance-of($SUB, subordinate-role)."); *************** *** 231,235 **** assertEquals(0, rs.getNumRows()); } ! public void testReifiesPredicate() throws Exception { TopicMap tm = getTopicMap("tolog.reification"); --- 239,243 ---- assertEquals(0, rs.getNumRows()); } ! public void testReifiesPredicate() throws Exception { TopicMap tm = getTopicMap("tolog.reification"); *************** *** 256,281 **** } - /* - * $Log$ - * Revision 1.1 2005/03/06 17:34:39 lheuer - * Initial tolog import - * - * Revision 1.8 2004/07/21 08:45:35 kal_ahmed - * Fixed bugs in reifies predicate. - * - * Revision 1.7 2004/07/19 16:02:43 kal_ahmed - * Fixed tests to properly initialize input variable set. - * - * Revision 1.6 2004/07/19 14:52:40 kal_ahmed - * More fixes to processing of recursive rules. ClauseList now aborts when the input parameter list becomes empty. - * - * Revision 1.5 2004/07/16 13:51:37 kal_ahmed - * Fixes for tolog engine handling of rules and rule-recursion. - * - * Revision 1.4 2004/07/14 21:42:25 kal_ahmed - * Parser now supports a variable for the association type in a dynamic association predicate. - * - * Revision 1.3 2004/06/15 20:00:35 kal_ahmed - * Added a few more tests over the block-world topic map. - * - */ \ No newline at end of file --- 264,265 ---- |