Update of /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17903/src/org/tmapiutils/query/tolog/test Modified Files: AndClauseTest.java AssociationPredicateTest.java BackendTests.java ImportTest.java Increment.java MemoryQueryEvaluatorImplTest.java NotClauseTest.java OrClauseTest.java ProjectionTest.java RuleTest.java SortingTest.java TologParserTest.java TologParserTestBase.java VariableSetTest.java Log Message: Shift to Apache License 2.0 More TMAPI compatible, some classes already compile. ;) Deleted CVS log from files Index: AssociationPredicateTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/AssociationPredicateTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AssociationPredicateTest.java 6 Mar 2005 21:11:33 -0000 1.2 --- AssociationPredicateTest.java 8 Mar 2005 12:33:58 -0000 1.3 *************** *** 1,12 **** /* ! 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; --- 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; *************** *** 33,38 **** /** ! * ! * @author Kal Ahmed (ka...@te...) */ public class AssociationPredicateTest extends TestCase { --- 40,46 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class AssociationPredicateTest extends TestCase { *************** *** 76,80 **** } ! public void testMultipleMatch() throws Exception { --- 84,88 ---- } ! public void testMultipleMatch() throws Exception { *************** *** 106,110 **** } } ! public void testRoleMatch() throws Exception { ClauseList c = new ClauseList(); --- 114,118 ---- } } ! public void testRoleMatch() throws Exception { ClauseList c = new ClauseList(); *************** *** 137,141 **** } } ! /* (non-Javadoc) * @see junit.framework.TestCase#setUp() --- 145,149 ---- } } ! /* (non-Javadoc) * @see junit.framework.TestCase#setUp() *************** *** 153,182 **** } - - /* - * $Log$ - * Revision 1.2 2005/03/06 21:11:33 lheuer - * More TM4J -> TMAPI translations - * - * Revision 1.1 2005/03/06 17:34:06 lheuer - * Initial tolog import - * - * Revision 1.6 2004/07/19 16:02:42 kal_ahmed - * Fixed tests to properly initialize input variable set. - * - * Revision 1.5 2004/06/14 20:10:33 kal_ahmed - * Updated test code to work with new Predicate and Clause interfaces. - * - * Revision 1.4 2004/06/09 20:20:31 kal_ahmed - * Major reworking of the predicate interfaces and internal implementation of VariableSet to reduce the use of HashMaps. - * - * Revision 1.3 2004/06/03 20:04:56 kal_ahmed - * Completed initial package restructuring. - * - * Revision 1.2 2004/06/03 19:55:17 kal_ahmed - * Created utils package to hold common utility classes for Tolog implementations. - * - * Revision 1.1 2004/05/30 22:08:25 kal_ahmed - * Initial version of tolog 1.0 engine - * - */ \ No newline at end of file --- 161,162 ---- Index: ImportTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/ImportTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ImportTest.java 6 Mar 2005 17:34:06 -0000 1.1 --- ImportTest.java 8 Mar 2005 12:33:58 -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; --- 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; *************** *** 19,30 **** /** ! * @author Kal ! * ! * Describe ImportTest here. */ ! public class ImportTest extends TologParserTestBase { File m_modulesDir; ! /** * @param arg0 --- 27,38 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ ! public class ImportTest extends TologParserTestBase { File m_modulesDir; ! /** * @param arg0 *************** *** 40,44 **** assertTrue("Cannot locate module to be referenced at " + refModule.getAbsolutePath(), refModule.exists()); ! String rootModule = "import \"" + refModule.toURL().toString() + "\" as test"; TologParser p = new TologParser(new TologLexer(new StringReader(rootModule))); --- 48,52 ---- assertTrue("Cannot locate module to be referenced at " + refModule.getAbsolutePath(), refModule.exists()); ! String rootModule = "import \"" + refModule.toURL().toString() + "\" as test"; TologParser p = new TologParser(new TologLexer(new StringReader(rootModule))); *************** *** 51,60 **** assertNotNull(r); } ! public void testNestedImport() throws Exception { File refModule = new File(m_modulesDir, "nested-module-parent.tl"); assertTrue("Cannot locate module to be referenced at " + refModule.getAbsolutePath(), refModule.exists()); ! String rootModule = "import \"" + refModule.toURL().toString() + "\" as test"; TologParser p = new TologParser(new TologLexer(new StringReader(rootModule))); --- 59,68 ---- assertNotNull(r); } ! public void testNestedImport() throws Exception { File refModule = new File(m_modulesDir, "nested-module-parent.tl"); assertTrue("Cannot locate module to be referenced at " + refModule.getAbsolutePath(), refModule.exists()); ! String rootModule = "import \"" + refModule.toURL().toString() + "\" as test"; TologParser p = new TologParser(new TologLexer(new StringReader(rootModule))); *************** *** 65,82 **** assertEquals(1, rules.size()); TologRule r = (TologRule)rules.get("test:crosscontinent"); ! assertNotNull(r); } ! } ! /* ! * $Log$ ! * Revision 1.1 2005/03/06 17:34:06 lheuer ! * Initial tolog import ! * ! * Revision 1.4 2004/06/13 17:18:00 kal_ahmed ! * Added registration of builtin predicates. Fixed rule expansion code to handle player/role pairs correctly. ! * ! * Revision 1.3 2004/06/09 21:12:19 kal_ahmed ! * Added standard source file header and footer. ! * ! */ \ No newline at end of file --- 73,79 ---- assertEquals(1, rules.size()); TologRule r = (TologRule)rules.get("test:crosscontinent"); ! assertNotNull(r); } ! } ! Index: RuleTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/RuleTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RuleTest.java 6 Mar 2005 17:34:06 -0000 1.1 --- RuleTest.java 8 Mar 2005 12:33:58 -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; --- 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; *************** *** 25,31 **** /** ! * @author Kal ! * ! * Describe RuleTest here. */ public class RuleTest extends TestCase { --- 33,39 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class RuleTest extends TestCase { *************** *** 43,48 **** junit.textui.TestRunner.run(RuleTest.class); } ! ! public void testRule() throws Exception { TologRule r = new TologRuleImpl(); --- 51,56 ---- junit.textui.TestRunner.run(RuleTest.class); } ! ! public void testRule() throws Exception { TologRule r = new TologRuleImpl(); *************** *** 63,72 **** i2Params.add(new Variable("B")); i2.setParameters(i2Params); ! ruleBody.addPredicate(i1); ruleBody.addPredicate(i2); ! r.setRuleBody(ruleBody); ! ClauseList cl = new ClauseList(); Predicate p = r.newInstance(); --- 71,80 ---- i2Params.add(new Variable("B")); i2.setParameters(i2Params); ! ruleBody.addPredicate(i1); ruleBody.addPredicate(i2); ! r.setRuleBody(ruleBody); ! ClauseList cl = new ClauseList(); Predicate p = r.newInstance(); *************** *** 76,80 **** p.setParameters(pParams); cl.addPredicate(p); ! VariableSet vsIn = new VariableSet(); vsIn.addColumn(new Variable("X")); --- 84,88 ---- p.setParameters(pParams); cl.addPredicate(p); ! VariableSet vsIn = new VariableSet(); vsIn.addColumn(new Variable("X")); *************** *** 90,109 **** } ! /* ! * $Log$ ! * Revision 1.1 2005/03/06 17:34:06 lheuer ! * Initial tolog import ! * ! * Revision 1.8 2004/07/19 16:02:42 kal_ahmed ! * Fixed tests to properly initialize input variable set. ! * ! * Revision 1.7 2004/06/16 21:21:44 kal_ahmed ! * Tolog queries may now contain replaceable references specified in an Object array parameter to the QueryEvaluator at evaluation time. ! * ! * Revision 1.6 2004/06/14 20:10:33 kal_ahmed ! * Updated test code to work with new Predicate and Clause interfaces. ! * ! * Revision 1.5 2004/06/09 21:12:19 kal_ahmed ! * Added standard source file header and footer. ! * ! */ \ No newline at end of file --- 98,100 ---- } ! Index: SortingTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/SortingTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SortingTest.java 6 Mar 2005 21:11:34 -0000 1.2 --- SortingTest.java 8 Mar 2005 12:33:58 -0000 1.3 *************** *** 1,12 **** /* ! 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; --- 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; *************** *** 27,32 **** /** ! * ! * @author Kal Ahmed (ka...@te...) */ public class SortingTest extends TestCase { --- 34,40 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class SortingTest extends TestCase { *************** *** 34,38 **** private TopicMapProvider m_provider; private IDGenerator m_idgen; ! /** * Constructor for SortingTest. --- 42,46 ---- private TopicMapProvider m_provider; private IDGenerator m_idgen; ! /** * Constructor for SortingTest. *************** *** 54,58 **** cols.add(new Variable("A")); cols.add(new Variable("B")); ! ArrayList rows = new ArrayList(); --- 62,66 ---- cols.add(new Variable("A")); cols.add(new Variable("B")); ! ArrayList rows = new ArrayList(); *************** *** 71,85 **** row3.add(new Integer(1)); rows.add(row3); ! Sorting sorting = new Sorting(); sorting.addSort(new Variable("A")); sorting.addSort(new Variable("B")); sorting.sort(cols, rows); ! assertEquals(row3, rows.get(0)); assertEquals(row2, rows.get(1)); assertEquals(row1, rows.get(2)); } ! public void testSortTopics() throws Exception { TopicMap tm = newTopicMap(); --- 79,93 ---- row3.add(new Integer(1)); rows.add(row3); ! Sorting sorting = new Sorting(); sorting.addSort(new Variable("A")); sorting.addSort(new Variable("B")); sorting.sort(cols, rows); ! assertEquals(row3, rows.get(0)); assertEquals(row2, rows.get(1)); assertEquals(row1, rows.get(2)); } ! public void testSortTopics() throws Exception { TopicMap tm = newTopicMap(); *************** *** 87,116 **** Topic t2 = tm.createTopic("t2"); Topic t3 = tm.createTopic("t3"); ! ArrayList cols = new ArrayList(); cols.add(new Variable("A")); ArrayList rows = new ArrayList(); ! ArrayList row1 = new ArrayList(); row1.add(t3); rows.add(row1); ! ArrayList row2 = new ArrayList(); row2.add(t1); rows.add(row2); ! ! ArrayList row3 = new ArrayList(); row3.add(t2); rows.add(row3); ! Sorting sorting = new Sorting(); sorting.addSort(new Variable("A")); sorting.sort(cols, rows); sorting.setSortAscending(true); ! assertEquals(row2, rows.get(0)); assertEquals(row3, rows.get(1)); assertEquals(row1, rows.get(2)); ! sorting.setSortAscending(false); sorting.sort(cols, rows); --- 95,124 ---- Topic t2 = tm.createTopic("t2"); Topic t3 = tm.createTopic("t3"); ! ArrayList cols = new ArrayList(); cols.add(new Variable("A")); ArrayList rows = new ArrayList(); ! ArrayList row1 = new ArrayList(); row1.add(t3); rows.add(row1); ! ArrayList row2 = new ArrayList(); row2.add(t1); rows.add(row2); ! ! ArrayList row3 = new ArrayList(); row3.add(t2); rows.add(row3); ! Sorting sorting = new Sorting(); sorting.addSort(new Variable("A")); sorting.sort(cols, rows); sorting.setSortAscending(true); ! assertEquals(row2, rows.get(0)); assertEquals(row3, rows.get(1)); assertEquals(row1, rows.get(2)); ! sorting.setSortAscending(false); sorting.sort(cols, rows); *************** *** 120,124 **** } ! public void testSortNames() throws Exception { TopicMap tm = newTopicMap(); --- 128,132 ---- } ! public void testSortNames() throws Exception { TopicMap tm = newTopicMap(); *************** *** 129,160 **** Topic t3 = tm.createTopic("t3"); TopicName bn3 = t3.createName("bn3", "Topic A"); ! ArrayList cols = new ArrayList(); cols.add(new Variable("A")); ArrayList rows = new ArrayList(); ! ArrayList row1 = new ArrayList(); row1.add(bn3); rows.add(row1); ! ArrayList row2 = new ArrayList(); row2.add(bn1); rows.add(row2); ! ! ArrayList row3 = new ArrayList(); row3.add(bn2); rows.add(row3); ! Sorting sorting = new Sorting(); sorting.addSort(new Variable("A")); sorting.sort(cols, rows); ! assertEquals(row1, rows.get(0)); assertEquals(row3, rows.get(1)); assertEquals(row2, rows.get(2)); ! ! } ! private TopicMap newTopicMap() throws Exception { Locator loc = m_provider.getLocatorFactory().createLocator("URI", "http://www.tm4j.org/tests/" + m_idgen.getObjectId()); --- 137,168 ---- Topic t3 = tm.createTopic("t3"); TopicName bn3 = t3.createName("bn3", "Topic A"); ! ArrayList cols = new ArrayList(); cols.add(new Variable("A")); ArrayList rows = new ArrayList(); ! ArrayList row1 = new ArrayList(); row1.add(bn3); rows.add(row1); ! ArrayList row2 = new ArrayList(); row2.add(bn1); rows.add(row2); ! ! ArrayList row3 = new ArrayList(); row3.add(bn2); rows.add(row3); ! Sorting sorting = new Sorting(); sorting.addSort(new Variable("A")); sorting.sort(cols, rows); ! assertEquals(row1, rows.get(0)); assertEquals(row3, rows.get(1)); assertEquals(row2, rows.get(2)); ! ! } ! private TopicMap newTopicMap() throws Exception { Locator loc = m_provider.getLocatorFactory().createLocator("URI", "http://www.tm4j.org/tests/" + m_idgen.getObjectId()); *************** *** 163,180 **** } - - /* - * $Log$ - * Revision 1.2 2005/03/06 21:11:34 lheuer - * More TM4J -> TMAPI translations - * - * Revision 1.1 2005/03/06 17:34:06 lheuer - * Initial tolog import - * - * Revision 1.2 2004/06/03 20:04:56 kal_ahmed - * Completed initial package restructuring. - * - * Revision 1.1 2004/05/30 22:08:25 kal_ahmed - * Initial version of tolog 1.0 engine - * - */ \ No newline at end of file --- 171,172 ---- Index: ProjectionTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/ProjectionTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProjectionTest.java 6 Mar 2005 21:11:34 -0000 1.2 --- ProjectionTest.java 8 Mar 2005 12:33:58 -0000 1.3 *************** *** 1,12 **** /* ! 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; --- 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; *************** *** 116,148 **** } - - /* - * $Log$ - * Revision 1.2 2005/03/06 21:11:34 lheuer - * More TM4J -> TMAPI translations - * - * Revision 1.1 2005/03/06 17:34:06 lheuer - * Initial tolog import - * - * Revision 1.7 2004/07/19 16:02:42 kal_ahmed - * Fixed tests to properly initialize input variable set. - * - * Revision 1.6 2004/06/14 20:10:33 kal_ahmed - * Updated test code to work with new Predicate and Clause interfaces. - * - * Revision 1.5 2004/06/09 20:20:31 kal_ahmed - * Major reworking of the predicate interfaces and internal implementation of VariableSet to reduce the use of HashMaps. - * - * Revision 1.4 2004/06/07 20:32:11 kal_ahmed - * Completed work on projection and sorting. Performed a bit more code reorganisation. Added DirectInstanceOfPredicate. - * - * Revision 1.3 2004/06/03 20:04:56 kal_ahmed - * Completed initial package restructuring. - * - * Revision 1.2 2004/06/03 19:55:17 kal_ahmed - * Created utils package to hold common utility classes for Tolog implementations. - * - * Revision 1.1 2004/05/30 22:08:25 kal_ahmed - * Initial version of tolog 1.0 engine - * - */ \ No newline at end of file --- 123,124 ---- Index: OrClauseTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/OrClauseTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OrClauseTest.java 6 Mar 2005 17:34:06 -0000 1.1 --- OrClauseTest.java 8 Mar 2005 12:33:58 -0000 1.2 *************** *** 1,12 **** /* ! 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; --- 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; *************** *** 24,29 **** /** ! * ! * @author Kal Ahmed (ka...@te...) */ public class OrClauseTest extends TestCase { --- 31,37 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class OrClauseTest extends TestCase { *************** *** 49,53 **** p1.setParameters(params1); ac1.addPredicate(p1); ! ClauseList ac2 = new ClauseList(); Predicate p2 = new Increment(); --- 57,61 ---- p1.setParameters(params1); ac1.addPredicate(p1); ! ClauseList ac2 = new ClauseList(); Predicate p2 = new Increment(); *************** *** 57,70 **** p2.setParameters(params2); ac2.addPredicate(p2); ! OrClause oc = new OrClause(); oc.add(ac1); oc.add(ac2); ! VariableSet in = new VariableSet(); in.addColumn(new Variable("A")); in.addRow(in.getColumns()); VariableSet ret = oc.execute(in, new TologContext()); ! assertEquals(2, ret.size()); List row = ret.getRow(0); --- 65,78 ---- p2.setParameters(params2); ac2.addPredicate(p2); ! OrClause oc = new OrClause(); oc.add(ac1); oc.add(ac2); ! VariableSet in = new VariableSet(); in.addColumn(new Variable("A")); in.addRow(in.getColumns()); VariableSet ret = oc.execute(in, new TologContext()); ! assertEquals(2, ret.size()); List row = ret.getRow(0); *************** *** 72,76 **** assertEquals(1, row.size()); assertEquals(new Integer(2), (Integer)row.get(0)); ! row = ret.getRow(1); assertNotNull(row); --- 80,84 ---- assertEquals(1, row.size()); assertEquals(new Integer(2), (Integer)row.get(0)); ! row = ret.getRow(1); assertNotNull(row); *************** *** 80,106 **** } - - /* - * $Log$ - * Revision 1.1 2005/03/06 17:34:06 lheuer - * Initial tolog import - * - * Revision 1.6 2004/07/19 16:02:42 kal_ahmed - * Fixed tests to properly initialize input variable set. - * - * Revision 1.5 2004/06/14 20:10:33 kal_ahmed - * Updated test code to work with new Predicate and Clause interfaces. - * - * Revision 1.4 2004/06/09 20:20:31 kal_ahmed - * Major reworking of the predicate interfaces and internal implementation of VariableSet to reduce the use of HashMaps. - * - * Revision 1.3 2004/06/03 20:04:56 kal_ahmed - * Completed initial package restructuring. - * - * Revision 1.2 2004/06/03 19:55:17 kal_ahmed - * Created utils package to hold common utility classes for Tolog implementations. - * - * Revision 1.1 2004/05/30 22:08:25 kal_ahmed - * Initial version of tolog 1.0 engine - * - */ \ No newline at end of file --- 88,89 ---- Index: NotClauseTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/NotClauseTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NotClauseTest.java 6 Mar 2005 17:34:06 -0000 1.1 --- NotClauseTest.java 8 Mar 2005 12:33:58 -0000 1.2 *************** *** 1,12 **** /* ! 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; --- 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; *************** *** 24,29 **** /** ! * ! * @author Kal Ahmed (ka...@te...) */ public class NotClauseTest extends TestCase { --- 31,37 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class NotClauseTest extends TestCase { *************** *** 50,57 **** p1.setParameters(params1); ac1.addPredicate(p1); ! NotClause nc = new NotClause(); nc.setTest(ac1); ! VariableSet in = new VariableSet(); in.addColumn(new Variable("A")); --- 58,65 ---- p1.setParameters(params1); ac1.addPredicate(p1); ! NotClause nc = new NotClause(); nc.setTest(ac1); ! VariableSet in = new VariableSet(); in.addColumn(new Variable("A")); *************** *** 59,63 **** in.addRow(new Object[] { new Integer(1), new Integer(2)}); in.addRow(new Object[] { new Integer(1), new Integer(3)}); ! VariableSet ret = nc.execute(in, new TologContext()); --- 67,71 ---- in.addRow(new Object[] { new Integer(1), new Integer(2)}); in.addRow(new Object[] { new Integer(1), new Integer(3)}); ! VariableSet ret = nc.execute(in, new TologContext()); *************** *** 69,92 **** } - - /* - * $Log$ - * Revision 1.1 2005/03/06 17:34:06 lheuer - * Initial tolog import - * - * Revision 1.5 2004/06/14 20:10:33 kal_ahmed - * Updated test code to work with new Predicate and Clause interfaces. - * - * Revision 1.4 2004/06/09 20:20:31 kal_ahmed - * Major reworking of the predicate interfaces and internal implementation of VariableSet to reduce the use of HashMaps. - * - * Revision 1.3 2004/06/03 20:04:56 kal_ahmed - * Completed initial package restructuring. - * - * Revision 1.2 2004/06/03 19:55:17 kal_ahmed - * Created utils package to hold common utility classes for Tolog implementations. - * - * Revision 1.1 2004/05/30 22:08:25 kal_ahmed - * Initial version of tolog 1.0 engine - * - */ \ No newline at end of file --- 77,78 ---- Index: Increment.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/Increment.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Increment.java 6 Mar 2005 17:34:06 -0000 1.1 --- Increment.java 8 Mar 2005 12:33:58 -0000 1.2 *************** *** 1,12 **** /* ! 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; --- 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; *************** *** 22,27 **** /** ! * ! * @author Kal Ahmed (ka...@te...) */ public class Increment extends PredicateBase { --- 29,35 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class Increment extends PredicateBase { *************** *** 31,35 **** new ParameterInfo(true, Integer.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.Predicate#matches(java.util.Map) --- 39,43 ---- new ParameterInfo(true, Integer.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.Predicate#matches(java.util.Map) *************** *** 59,63 **** return ret; } ! private VariableSet createVariableSet() { VariableSet ret = new VariableSet(); --- 67,71 ---- return ret; } ! private VariableSet createVariableSet() { VariableSet ret = new VariableSet(); *************** *** 92,121 **** // No-op for this predicate } - - } - /* - * $Log$ - * Revision 1.1 2005/03/06 17:34:06 lheuer - * Initial tolog import - * - * Revision 1.6 2004/06/09 22:15:09 kal_ahmed - * Fixed parser to disallow player:role pairs in predicates other than dynamic association predicates. Fixed initialisation of extension predicates. Added DirectInstanceOfPredicate extension to in-memory query evaluator. - * - * Revision 1.5 2004/06/09 20:20:31 kal_ahmed - * Major reworking of the predicate interfaces and internal implementation of VariableSet to reduce the use of HashMaps. - * - * Revision 1.4 2004/06/07 20:31:59 kal_ahmed - * Completed work on projection and sorting. Performed a bit more code reorganisation. Added DirectInstanceOfPredicate. - * - * Revision 1.3 2004/06/03 20:04:56 kal_ahmed - * Completed initial package restructuring. - * - * Revision 1.2 2004/06/03 19:55:17 kal_ahmed - * Created utils package to hold common utility classes for Tolog implementations. - * - * Revision 1.1 2004/05/30 22:08:25 kal_ahmed - * Initial version of tolog 1.0 engine - * - */ \ No newline at end of file --- 100,104 ---- // No-op for this predicate } + } Index: VariableSetTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/VariableSetTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VariableSetTest.java 6 Mar 2005 17:34:06 -0000 1.1 --- VariableSetTest.java 8 Mar 2005 12:33:58 -0000 1.2 *************** *** 1,12 **** /* ! 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; --- 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; *************** *** 19,24 **** /** ! * ! * @author Kal Ahmed (ka...@te...) */ public class VariableSetTest extends TestCase { --- 26,32 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class VariableSetTest extends TestCase { *************** *** 41,45 **** base.addColumn(new Variable("B")); base.addColumn(new Variable("C")); ! VariableSet results = new VariableSet(); results.addColumn(new Variable("A")); --- 49,53 ---- base.addColumn(new Variable("B")); base.addColumn(new Variable("C")); ! VariableSet results = new VariableSet(); results.addColumn(new Variable("A")); *************** *** 47,53 **** results.addRow(new Object[] { "A1", "B1" }); results.addRow(new Object[] { "A2", "B2" }); ! base.addMatchResults(base.getColumns(), results); ! assertEquals(2, base.getRows().size()); List row1 = base.getRow(0); --- 55,61 ---- results.addRow(new Object[] { "A1", "B1" }); results.addRow(new Object[] { "A2", "B2" }); ! base.addMatchResults(base.getColumns(), results); ! assertEquals(2, base.getRows().size()); List row1 = base.getRow(0); *************** *** 65,71 **** vs.addColumn(b); vs.addColumn(c); ! vs.addRow(new Object[] {"A1", "B1", "C1"}); ! List l = vs.project(new Variable[] {a, b}, null); assertEquals(1, l.size()); --- 73,79 ---- vs.addColumn(b); vs.addColumn(c); ! vs.addRow(new Object[] {"A1", "B1", "C1"}); ! List l = vs.project(new Variable[] {a, b}, null); assertEquals(1, l.size()); *************** *** 74,78 **** assertEquals("A1", row.get(0)); assertEquals("B1", row.get(1)); ! l = vs.project(new Variable[] {a}, c); assertEquals(1, l.size()); --- 82,86 ---- assertEquals("A1", row.get(0)); assertEquals("B1", row.get(1)); ! l = vs.project(new Variable[] {a}, c); assertEquals(1, l.size()); *************** *** 81,85 **** assertEquals("A1", row.get(0)); assertEquals(new Integer(1), row.get(1)); ! vs.addRow(new Object[] { "A1", "B2", "C1" }); --- 89,93 ---- assertEquals("A1", row.get(0)); assertEquals(new Integer(1), row.get(1)); ! vs.addRow(new Object[] { "A1", "B2", "C1" }); *************** *** 90,94 **** assertEquals("A1", row.get(0)); assertEquals(new Integer(2), row.get(1)); ! } --- 98,102 ---- assertEquals("A1", row.get(0)); assertEquals(new Integer(2), row.get(1)); ! } *************** *** 98,107 **** vs1.addColumn(new Variable("B")); vs1.addRow(new Object[] {"A1", "B1"}); ! VariableSet vs2 = new VariableSet(); vs2.addColumn(new Variable("B")); vs2.addColumn(new Variable("C")); vs2.addRow(new Object[] {"B2", "C2"}); ! vs1.add(vs2); assertEquals(3, vs1.getColumns().size()); --- 106,115 ---- vs1.addColumn(new Variable("B")); vs1.addRow(new Object[] {"A1", "B1"}); ! VariableSet vs2 = new VariableSet(); vs2.addColumn(new Variable("B")); vs2.addColumn(new Variable("C")); vs2.addRow(new Object[] {"B2", "C2"}); ! vs1.add(vs2); assertEquals(3, vs1.getColumns().size()); *************** *** 120,137 **** } - - /* - * $Log$ - * Revision 1.1 2005/03/06 17:34:06 lheuer - * Initial tolog import - * - * Revision 1.3 2004/06/09 20:20:31 kal_ahmed - * Major reworking of the predicate interfaces and internal implementation of VariableSet to reduce the use of HashMaps. - * - * Revision 1.2 2004/06/03 19:55:17 kal_ahmed - * Created utils package to hold common utility classes for Tolog implementations. - * - * Revision 1.1 2004/05/30 22:08:26 kal_ahmed - * Initial version of tolog 1.0 engine - * - */ \ No newline at end of file --- 128,129 ---- Index: MemoryQueryEvaluatorImplTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/MemoryQueryEvaluatorImplTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MemoryQueryEvaluatorImplTest.java 6 Mar 2005 21:11:34 -0000 1.2 --- MemoryQueryEvaluatorImplTest.java 8 Mar 2005 12:33:58 -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; --- 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; *************** *** 32,38 **** /** ! * @author Kal ! * ! * Describe MemoryQueryEvaluatorImplTest here. */ public class MemoryQueryEvaluatorImplTest extends TestCase { --- 40,46 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class MemoryQueryEvaluatorImplTest extends TestCase { *************** *** 41,49 **** private TopicMapProvider m_provider; private TestQuery[] TEST_QUERIES = new TestQuery[] { ! new TestQuery("blocks1", "blocks.ltm", "select * from restson($A:upper, $B:lower)?", 2, 3, new Object[][] { ! new Object[] {new TopicRef("redblock"), new TopicRef("blueblock") } }), new TestQuery("blocks2", "blocks.ltm", --- 49,57 ---- private TopicMapProvider m_provider; private TestQuery[] TEST_QUERIES = new TestQuery[] { ! new TestQuery("blocks1", "blocks.ltm", "select * from restson($A:upper, $B:lower)?", 2, 3, new Object[][] { ! new Object[] {new TopicRef("redblock"), new TopicRef("blueblock") } }), new TestQuery("blocks2", "blocks.ltm", *************** *** 58,62 **** new TestQuery("blocks3", "blocks.ltm", "select $BLOCK, $OTHER, $SHAPE from restson($OTHER:lower, $BLOCK:upper), has-shape($OTHER:block, $SHAPE:shape)?", ! 3, 3, new Object [][] { new Object[] { new TopicRef("redblock"), new TopicRef("blueblock"), new TopicRef("cylinder") }, --- 66,70 ---- new TestQuery("blocks3", "blocks.ltm", "select $BLOCK, $OTHER, $SHAPE from restson($OTHER:lower, $BLOCK:upper), has-shape($OTHER:block, $SHAPE:shape)?", ! 3, 3, new Object [][] { new Object[] { new TopicRef("redblock"), new TopicRef("blueblock"), new TopicRef("cylinder") }, *************** *** 65,69 **** }), }; ! /** * Constructor for MemoryQueryEvaluatorImplTest. --- 73,77 ---- }), }; ! /** * Constructor for MemoryQueryEvaluatorImplTest. *************** *** 79,83 **** } } ! /** * Locates the directory containing tologx package test --- 87,91 ---- } } ! /** * Locates the directory containing tologx package test *************** *** 86,90 **** * by the System property 'testdir' * @return the File that represents the tologx test resource directory. ! * @throws RuntimeException if the System property 'testdir' is not specified, * or if the test directory or the tologx subdirectory could not be found. */ --- 94,98 ---- * by the System property 'testdir' * @return the File that represents the tologx test resource directory. ! * @throws RuntimeException if the System property 'testdir' is not specified, * or if the test directory or the tologx subdirectory could not be found. */ *************** *** 92,96 **** String testdirName = System.getProperty("testdir"); if (testdirName == null) { ! throw new RuntimeException("No value for system property 'testdir'"); } File f = new File(testdirName); --- 100,104 ---- String testdirName = System.getProperty("testdir"); if (testdirName == null) { ! throw new RuntimeException("No value for system property 'testdir'"); } File f = new File(testdirName); *************** *** 109,118 **** return tmpf.newTopicMapProvider(System.getProperties()); } ! public static void main(String[] args) { junit.textui.TestRunner.run(MemoryQueryEvaluatorImplTest.class); } ! public TopicMap getTopicMap(File tmFile, boolean forceReload) throws Exception { Locator tmLoc = m_provider.getLocatorFactory().createLocator("URI", tmFile.toURL().toString()); --- 117,126 ---- return tmpf.newTopicMapProvider(System.getProperties()); } ! public static void main(String[] args) { junit.textui.TestRunner.run(MemoryQueryEvaluatorImplTest.class); } ! public TopicMap getTopicMap(File tmFile, boolean forceReload) throws Exception { Locator tmLoc = m_provider.getLocatorFactory().createLocator("URI", tmFile.toURL().toString()); *************** *** 128,132 **** return m_provider.addTopicMap(src); } ! /* * @see TestCase#setUp() --- 136,140 ---- return m_provider.addTopicMap(src); } ! /* * @see TestCase#setUp() *************** *** 152,156 **** checkResultsSet("simpleQuery", results, 2, 3, expectedResults); } ! public void testQueries() throws Exception { for (int i = 0; i < TEST_QUERIES.length; i++) { --- 160,164 ---- checkResultsSet("simpleQuery", results, 2, 3, expectedResults); } ! public void testQueries() throws Exception { for (int i = 0; i < TEST_QUERIES.length; i++) { *************** *** 177,181 **** checkResultsSet(TEST_QUERIES[i].name, rs, TEST_QUERIES[i].resultsCols, TEST_QUERIES[i].resultsRows, ! TEST_QUERIES[i].expectedRows); } catch (TologProcessingException ex) { if (TEST_QUERIES[i].processingErrorExpected) return; --- 185,189 ---- checkResultsSet(TEST_QUERIES[i].name, rs, TEST_QUERIES[i].resultsCols, TEST_QUERIES[i].resultsRows, ! TEST_QUERIES[i].expectedRows); } catch (TologProcessingException ex) { if (TEST_QUERIES[i].processingErrorExpected) return; *************** *** 183,187 **** } } ! public void testInlineModule() throws Exception { TopicMap tm = getTopicMap(new File(m_tologTestDir, "blocks.ltm"), false); --- 191,195 ---- } } ! public void testInlineModule() throws Exception { TopicMap tm = getTopicMap(new File(m_tologTestDir, "blocks.ltm"), false); *************** *** 200,204 **** (row.get(0).equals(greenblock) && row.get(1).equals(blueblock))); } ! public void testExternalModule() throws Exception { TopicMap tm = getTopicMap(new File(m_tologTestDir, "blocks.ltm"), false); --- 208,212 ---- (row.get(0).equals(greenblock) && row.get(1).equals(blueblock))); } ! public void testExternalModule() throws Exception { TopicMap tm = getTopicMap(new File(m_tologTestDir, "blocks.ltm"), false); *************** *** 216,220 **** (row.get(0).equals(greenblock) && row.get(1).equals(blueblock))); } ! public void testRecursiveRules() throws Exception { TopicMap tm = getTopicMap(new File(m_tologTestDir, "family.ltm"), false); --- 224,228 ---- (row.get(0).equals(greenblock) && row.get(1).equals(blueblock))); } ! public void testRecursiveRules() throws Exception { TopicMap tm = getTopicMap(new File(m_tologTestDir, "family.ltm"), false); *************** *** 242,246 **** } } ! public void testReplacement() throws Exception { TopicMap tm = getTopicMap(new File(m_tologTestDir, "blocks.ltm"), false); --- 250,254 ---- } } ! public void testReplacement() throws Exception { TopicMap tm = getTopicMap(new File(m_tologTestDir, "blocks.ltm"), false); *************** *** 250,254 **** assertEquals(tm.getObjectById("yellowblock"), rst.getRow(0).get(0)); } ! private void checkResultsSet(String testName, TologResultsSet results, int expectedColSize, int expectedRowSize, Object[][]expectedRows) { assertEquals(testName + ": Unexpected results set width.", expectedColSize, results.getNumCols()); --- 258,262 ---- assertEquals(tm.getObjectById("yellowblock"), rst.getRow(0).get(0)); } ! private void checkResultsSet(String testName, TologResultsSet results, int expectedColSize, int expectedRowSize, Object[][]expectedRows) { assertEquals(testName + ": Unexpected results set width.", expectedColSize, results.getNumCols()); *************** *** 263,267 **** } } ! private String dumpRow(List row) { StringBuffer ret = new StringBuffer(); --- 271,275 ---- } } ! private String dumpRow(List row) { StringBuffer ret = new StringBuffer(); *************** *** 280,284 **** return ret.toString(); } ! class TestQuery { String name; --- 288,292 ---- return ret.toString(); } ! class TestQuery { String name; *************** *** 290,294 **** int resultsRows; Object [][] expectedRows; ! public TestQuery(String name, String tm, String queryString, boolean parseErrorExpected, boolean processingErrorExpected) { this.name = name; --- 298,302 ---- int resultsRows; Object [][] expectedRows; ! public TestQuery(String name, String tm, String queryString, boolean parseErrorExpected, boolean processingErrorExpected) { this.name = name; *************** *** 298,302 **** this.processingErrorExpected = processingErrorExpected; } ! public TestQuery(String name, String tm, String queryString, int resultsCols, int resultsRows, Object[][]expectedRows) { this.name = name; --- 306,310 ---- this.processingErrorExpected = processingErrorExpected; } ! public TestQuery(String name, String tm, String queryString, int resultsCols, int resultsRows, Object[][]expectedRows) { this.name = name; *************** *** 308,312 **** } } ! class TopicRef { String id; --- 316,320 ---- } } ! class TopicRef { String id; *************** *** 317,354 **** } - /* - * $Log$ - * Revision 1.2 2005/03/06 21:11:34 lheuer - * More TM4J -> TMAPI translations - * - * Revision 1.1 2005/03/06 17:34:06 lheuer - * Initial tolog import - * - * Revision 1.11 2004/11/02 16:03:39 kal_ahmed - * Fixed reported bug with processing external tolog modules. - * - * Revision 1.10 2004/06/20 14:12:31 kal_ahmed - * Copied TologRsultsSet interface and TologFragmentBuilder implementation from org.tm4j.tolog to this package. - * - * Revision 1.9 2004/06/16 21:21:44 kal_ahmed - * Tolog queries may now contain replaceable references specified in an Object array parameter to the QueryEvaluator at evaluation time. - * - * Revision 1.8 2004/06/14 21:33:07 kal_ahmed - * Fixed query evaluation when multiple predicates introduce new variables. - * - * Revision 1.7 2004/06/13 19:58:12 kal_ahmed - * Fixed testRecursiveRules() query. Reinstated disabled tests. - * - * Revision 1.6 2004/06/13 19:44:31 kal_ahmed - * Added a fix and test for handling recursive rules definitions. - * - * Revision 1.5 2004/06/13 17:18:00 kal_ahmed - * Added registration of builtin predicates. Fixed rule expansion code to handle player/role pairs correctly. - * - * Revision 1.4 2004/06/09 22:15:09 kal_ahmed - * Fixed parser to disallow player:role pairs in predicates other than dynamic association predicates. Fixed initialisation of extension predicates. Added DirectInstanceOfPredicate extension to in-memory query evaluator. - * - * Revision 1.3 2004/06/09 21:12:19 kal_ahmed - * Added standard source file header and footer. - * - */ \ No newline at end of file --- 325,326 ---- Index: TologParserTest.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/test/TologParserTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TologParserTest.java 6 Mar 2005 21:11:34 -0000 1.2 --- TologParserTest.java 8 Mar 2005 12:33:58 -0000 1.3 *************** *** 1,12 **** /* ! 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; --- 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; *************** *** 47,52 **** /** ! * ! * @author Kal Ahmed (ka...@te...) */ public class TologParserTest extends TologParserTestBase { --- 54,60 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class TologParserTest extends TologParserTestBase { *************** *** 57,61 **** {"not(contains(europe : container, $B : containee))?", "select * from not(contains(europe:container, $B:containee))?"}, { ! "{ contains(europe:container, $B:containee) | contains(asia:container, $B:containee) }?", "select * from { contains(europe:container, $B:containee) | contains(asia:container, $B:containee) }?"}, { --- 65,69 ---- {"not(contains(europe : container, $B : containee))?", "select * from not(contains(europe:container, $B:containee))?"}, { ! "{ contains(europe:container, $B:containee) | contains(asia:container, $B:containee) }?", "select * from { contains(europe:container, $B:containee) | contains(asia:container, $B:containee) }?"}, { *************** *** 92,104 **** } }; ! private final String [][] m_rulesTest = { ! { "nestedin($A, $B) :- { contains($B, $A) | contains($C, $A), nestedin($C, $B) }.", "nestedin($A, $B) :- { contains($B, $A) | contains($C, $A), nestedin($C, $B) }." }, { ! "nestedin($A, $B) :- contains($C, $A), contains($B, $C).", ! "nestedin($A, $B) :- contains($C, $A), contains($B, $C)." } /* --- 100,112 ---- } }; ! private final String [][] m_rulesTest = { ! { "nestedin($A, $B) :- { contains($B, $A) | contains($C, $A), nestedin($C, $B) }.", "nestedin($A, $B) :- { contains($B, $A) | contains($C, $A), nestedin($C, $B) }." }, { ! "nestedin($A, $B) :- contains($C, $A), contains($B, $C).", ! "nestedin($A, $B) :- contains($C, $A), contains($B, $C)." } /* *************** *** 109,144 **** */ }; ! private final String [][] m_parserTest2 = { { ! "select $ASSOC, $ROLE1, $ROLE2 from " + " association-role($ASSOC, $ROLE1)," + ! " role-player($ROLE1, AT1)," + ! " association-role($ASSOC, $ROLE2)," + " role-player($ROLE2, AT2)," + " type($ASSOC, activity_responsibility)?", ! "select $ASSOC, $ROLE1, $ROLE2 from " + " association-role($ASSOC, $ROLE1)," + ! " role-player($ROLE1, AT1)," + ! " association-role($ASSOC, $ROLE2)," + " role-player($ROLE2, AT2)," + " type($ASSOC, activity_responsibility)?", }, { ! "select $ASSOC, $ROLE1, $ROLE2 from " + " association-role($ASSOC, $ROLE1)," + ! " role-player($ROLE1, AT1)," + ! " association-role($ASSOC, $ROLE2)," + " role-player($ROLE2, AT2)?", ! "select $ASSOC, $ROLE1, $ROLE2 from " + " association-role($ASSOC, $ROLE1)," + ! " role-player($ROLE1, AT1)," + ! " association-role($ASSOC, $ROLE2)," + " role-player($ROLE2, AT2)?" } }; ! private Map m_predicatesByName; ! /** * Constructor for TologParserTest. --- 117,152 ---- */ }; ! private final String [][] m_parserTest2 = { { ! "select $ASSOC, $ROLE1, $ROLE2 from " + " association-role($ASSOC, $ROLE1)," + ! " role-player($ROLE1, AT1)," + ! " association-role($ASSOC, $ROLE2)," + " role-player($ROLE2, AT2)," + " type($ASSOC, activity_responsibility)?", ! "select $ASSOC, $ROLE1, $ROLE2 from " + " association-role($ASSOC, $ROLE1)," + ! " role-player($ROLE1, AT1)," + ! " association-role($ASSOC, $ROLE2)," + " role-player($ROLE2, AT2)," + " type($ASSOC, activity_responsibility)?", }, { ! "select $ASSOC, $ROLE1, $ROLE2 from " + " association-role($ASSOC, $ROLE1)," + ! " role-player($ROLE1, AT1)," + ! " association-role($ASSOC, $ROLE2)," + " role-player($ROLE2, AT2)?", ! "select $ASSOC, $ROLE1, $ROLE2 from " + " association-role($ASSOC, $ROLE1)," + ! " role-player($ROLE1, AT1)," + ! " association-role($ASSOC, $ROLE2)," + " role-player($ROLE2, AT2)?" } }; ! private Map m_predicatesByName; ! /** * Constructor for TologParserTest. *************** *** 161,165 **** ClauseList rootClauseList = q.getRootClauseList(); assertEquals(1, rootClauseList.size()); ! assertEquals("select * from contains($A:container, $B:containee)?", q.toString()); } --- 169,173 ---- ClauseList rootClauseList = q.getRootClauseList(); assertEquals(1, rootClauseList.size()); ! assertEquals("select * from contains($A:container, $B:containee)?", q.toString()); } *************** *** 188,192 **** System.out.println(q.toString()); //assertEquals("Comparison failure for input " + m_parserTest2[i][0], ! // m_parserTest2[i][1], q.toString()); } } --- 196,200 ---- System.out.println(q.toString()); //assertEquals("Comparison failure for input " + m_parserTest2[i][0], ! // m_parserTest2[i][1], q.toString()); } } *************** *** 200,204 **** } } ! public void testSubjectIndicatorAddressing() throws Exception { TopicMap tm = getTopicMapFromLTMString( --- 208,212 ---- } } ! public void testSubjectIndicatorAddressing() throws Exception { TopicMap tm = getTopicMapFromLTMString( *************** *** 214,218 **** q.toString()); } ! public void testSubjectAddressAddressing() throws Exception { TopicMap tm = getTopicMapFromLTMString( --- 222,... [truncated message content] |