Update of /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17903/src/org/tmapiutils/query/tolog/predicates Modified Files: AssociationPredicate.java AssociationRolePredicate.java BaseLocatorPredicate.java DirectInstanceOfPredicate.java DynamicAssociationPredicate.java InstanceOfPredicate.java OccurrencePredicate.java PredicateBase.java ReifiesPredicate.java ResourcePredicate.java RolePlayerPredicate.java ScopePredicate.java SourceLocatorsPredicate.java SubjectIdentifierPredicate.java SubjectLocatorPredicate.java TopicMapPredicate.java TopicNamePredicate.java TopicPredicate.java TypePredicate.java ValueLikePredicate.java ValuePredicate.java VariantPredicate.java Log Message: Shift to Apache License 2.0 More TMAPI compatible, some classes already compile. ;) Deleted CVS log from files Index: TopicPredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/TopicPredicate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TopicPredicate.java 6 Mar 2005 17:30:00 -0000 1.1 --- TopicPredicate.java 8 Mar 2005 12:33:57 -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$ */ --- 1,17 ---- /* ! * 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. */ *************** *** 21,26 **** /** ! * @author Kal ! * */ public class TopicPredicate extends PredicateBase { --- 27,33 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class TopicPredicate extends PredicateBase { *************** *** 30,34 **** new ParameterInfo(true, Object.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() --- 37,41 ---- new ParameterInfo(true, Object.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() *************** *** 64,78 **** } - - /* - * $Log$ - * Revision 1.1 2005/03/06 17:30:00 lheuer - * Initial tolog import - * - * Revision 1.1 2004/06/12 14:58:50 kal_ahmed - * Initial version - * - * Revision 1.5 2004/06/11 08:29:28 kal_ahmed - * Added association and association-role predicates. - * - */ \ No newline at end of file --- 71,72 ---- Index: AssociationPredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/AssociationPredicate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AssociationPredicate.java 6 Mar 2005 17:29:58 -0000 1.1 --- AssociationPredicate.java 8 Mar 2005 12:33:56 -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$ */ --- 1,17 ---- /* ! * 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. */ *************** *** 21,27 **** /** ! * @author Kal ! * ! * Describe AssociationPredicate here. */ public class AssociationPredicate extends PredicateBase { --- 27,33 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class AssociationPredicate extends PredicateBase { *************** *** 31,35 **** new ParameterInfo(true, Object.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() --- 37,41 ---- new ParameterInfo(true, Object.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() *************** *** 66,76 **** } - /* - * $Log$ - * Revision 1.1 2005/03/06 17:29:58 lheuer - * Initial tolog import - * - * Revision 1.5 2004/06/11 08:29:28 kal_ahmed - * Added association and association-role predicates. - * - */ \ No newline at end of file --- 72,73 ---- Index: TopicMapPredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/TopicMapPredicate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TopicMapPredicate.java 7 Mar 2005 12:32:00 -0000 1.2 --- TopicMapPredicate.java 8 Mar 2005 12:33:57 -0000 1.3 *************** *** 1,10 **** /* ! 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$ */ --- 1,17 ---- /* ! * 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. */ *************** *** 20,24 **** /** * ! * @author Kal Ahmed (ka...@te...) */ public class TopicMapPredicate extends PredicateBase { --- 27,32 ---- /** * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class TopicMapPredicate extends PredicateBase { *************** *** 53,57 **** } else if (params.get(0) instanceof TopicMap) { TopicMap topicmap = (TopicMap)params.get(0); ! if (tst.equals(getTopicMap())) { addResultsRow(ret, new Object[] { topicmap }); } --- 61,65 ---- } else if (params.get(0) instanceof TopicMap) { TopicMap topicmap = (TopicMap)params.get(0); ! if (getTopicMap().equals(topicmap)) { addResultsRow(ret, new Object[] { topicmap }); } *************** *** 62,78 **** } - - /* - * $Log$ - * Revision 1.2 2005/03/07 12:32:00 lheuer - * More TM4J -> TMAPI translations - * Updated ToDo - * ResourcePredicate can handle Variants, too - * - * Revision 1.1 2005/03/06 17:30:00 lheuer - * Initial tolog import - * - * Revision 1.1 2004/06/13 10:32:28 kal_ahmed - * Initial implementation of topicmap() predicate. - * - */ \ No newline at end of file --- 70,71 ---- Index: ValuePredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/ValuePredicate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ValuePredicate.java 7 Mar 2005 16:17:20 -0000 1.3 --- ValuePredicate.java 8 Mar 2005 12:33:57 -0000 1.4 *************** *** 1,10 **** /* ! 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$ */ --- 1,17 ---- /* ! * 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. */ *************** *** 34,38 **** /** * ! * @author Kal Ahmed (ka...@te...) */ public class ValuePredicate extends PredicateBase { --- 41,46 ---- /** * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class ValuePredicate extends PredicateBase { *************** *** 130,134 **** } catch (TMAPIException ex) { ! throw new TologParserException("Error initialising indexes for " + PREDICATE_NAME, ex); } for (Iterator it = _occIdx.getOccurrencesByValue(data).iterator(); it.hasNext();) { --- 138,142 ---- } catch (TMAPIException ex) { ! throw new TologProcessingException("Error initialising indexes for " + PREDICATE_NAME, ex); } for (Iterator it = _occIdx.getOccurrencesByValue(data).iterator(); it.hasNext();) { Index: ScopePredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/ScopePredicate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ScopePredicate.java 6 Mar 2005 23:38:00 -0000 1.2 --- ScopePredicate.java 8 Mar 2005 12:33:57 -0000 1.3 *************** *** 1,6 **** /* ! * Created on 11-Jun-2004 ! * @author Kal */ package org.tmapiutils.query.tolog.predicates; --- 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.predicates; *************** *** 23,29 **** /** ! * @author Kal ! * ! * Describe ScopePredicate here. */ public class ScopePredicate extends PredicateBase { --- 36,42 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class ScopePredicate extends PredicateBase { *************** *** 35,39 **** new ParameterInfo(true) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() --- 48,52 ---- new ParameterInfo(true) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() *************** *** 78,82 **** Topic topic = (Topic) themes.next(); for (Iterator scoped = _scopeIdx.getScopedObjectsByScopingTopic(topic).iterator(); scoped.hasNext();) { ! addResultsRow(ret, new Object[] {scoped.next(), theme}); } } --- 91,95 ---- Topic topic = (Topic) themes.next(); for (Iterator scoped = _scopeIdx.getScopedObjectsByScopingTopic(topic).iterator(); scoped.hasNext();) { ! addResultsRow(ret, new Object[] {scoped.next(), topic}); } } Index: AssociationRolePredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/AssociationRolePredicate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AssociationRolePredicate.java 7 Mar 2005 12:32:00 -0000 1.3 --- AssociationRolePredicate.java 8 Mar 2005 12:33:56 -0000 1.4 *************** *** 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$ */ --- 1,17 ---- /* ! * 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. */ *************** *** 23,29 **** /** - * @author Kal * ! * Describe AssociationRolePredicate here. */ public class AssociationRolePredicate extends PredicateBase { --- 29,35 ---- /** * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class AssociationRolePredicate extends PredicateBase { *************** *** 108,126 **** } - /* - * $Log$ - * Revision 1.3 2005/03/07 12:32:00 lheuer - * More TM4J -> TMAPI translations - * Updated ToDo - * ResourcePredicate can handle Variants, too - * - * Revision 1.2 2005/03/06 19:37:22 lheuer - * Changed getTopicByID to getObjectById - * - * Revision 1.1 2005/03/06 17:29:58 lheuer - * Initial tolog import - * - * Revision 1.1 2004/06/11 08:29:29 kal_ahmed - * Added association and association-role predicates. - * - */ \ No newline at end of file --- 114,115 ---- Index: SubjectLocatorPredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/SubjectLocatorPredicate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SubjectLocatorPredicate.java 6 Mar 2005 23:38:00 -0000 1.3 --- SubjectLocatorPredicate.java 8 Mar 2005 12:33:57 -0000 1.4 *************** *** 1,6 **** /* ! * Created on 11-Jun-2004 ! * @author Kal */ package org.tmapiutils.query.tolog.predicates; --- 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.predicates; *************** *** 8,11 **** --- 21,25 ---- import java.util.List; + import org.tmapiutils.query.tolog.TologParserException; import org.tmapiutils.query.tolog.TologProcessingException; import org.tmapiutils.query.tolog.parser.Variable; *************** *** 15,18 **** --- 29,33 ---- // TMAPI import org.tmapi.core.Locator; + import org.tmapi.core.TopicMap; import org.tmapi.core.Topic; import org.tmapi.core.TMAPIException; *************** *** 20,26 **** /** ! * @author Kal ! * ! * Describe SubjectIdentifierPredicate here. */ public class SubjectLocatorPredicate extends PredicateBase { --- 35,41 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class SubjectLocatorPredicate extends PredicateBase { *************** *** 32,36 **** new ParameterInfo(true) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() --- 47,51 ---- new ParameterInfo(true) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() *************** *** 55,59 **** VariableSet ret = new VariableSet(); initialiseResultsSet(ret); ! if ((topic instanceof Topic) && (loc instanceof Variable)) { matchSubjectLocator((Topic)topic, ret); --- 70,74 ---- VariableSet ret = new VariableSet(); initialiseResultsSet(ret); ! if ((topic instanceof Topic) && (loc instanceof Variable)) { matchSubjectLocator((Topic)topic, ret); Index: ValueLikePredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/ValueLikePredicate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ValueLikePredicate.java 6 Mar 2005 17:30:00 -0000 1.1 --- ValueLikePredicate.java 8 Mar 2005 12:33:57 -0000 1.2 *************** *** 1,14 **** /* ! 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.predicates; import java.util.List; --- 1,22 ---- /* ! * 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.predicates; + import java.util.Iterator; import java.util.List; *************** *** 17,34 **** import org.tmapiutils.query.tolog.parser.Variable; import org.tmapiutils.query.tolog.utils.VariableSet; ! import org.tmapi.core.TopicMap; import org.tmapi.core.TopicMapObject; ! import org.tmapi.core.index.IndexManager; ! import org.tmapi.core.index.text.FullTextIndex; ! import org.tmapi.core.index.text.QueryHit; ! import org.tmapi.core.index.text.QueryResult; /** ! * ! * @author Kal Ahmed (ka...@te...) */ public class ValueLikePredicate extends PredicateBase { - private FullTextIndex m_txtIx; public static final String PREDICATE_NAME="value-like"; private static final ParameterInfo[] PARAM_INFO = new ParameterInfo[] { --- 25,44 ---- import org.tmapiutils.query.tolog.parser.Variable; import org.tmapiutils.query.tolog.utils.VariableSet; ! // TMAPI import org.tmapi.core.TopicMapObject; ! import org.tmapi.core.TopicMap; ! import org.tmapi.core.Topic; ! import org.tmapi.core.Occurrence; ! import org.tmapi.core.TopicName; ! import org.tmapi.core.Variant; ! /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class ValueLikePredicate extends PredicateBase { public static final String PREDICATE_NAME="value-like"; private static final ParameterInfo[] PARAM_INFO = new ParameterInfo[] { *************** *** 36,40 **** new ParameterInfo(true, String.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() --- 46,50 ---- new ParameterInfo(true, String.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() *************** *** 56,67 **** public VariableSet matches(List params) throws TologProcessingException { VariableSet ret = new VariableSet(); ! Object o = params.get(0); ! String srchString = (String)params.get(1); initialiseResultsSet(ret); ! if (o instanceof Variable) { ! getAllMatches(srchString, ret); ! } else if (o instanceof TopicMapObject) { ! getObjectMatches((TopicMapObject)o, srchString, ret); } return ret; --- 66,77 ---- public VariableSet matches(List params) throws TologProcessingException { VariableSet ret = new VariableSet(); ! Object obj = params.get(0); ! String searchString = (String)params.get(1); initialiseResultsSet(ret); ! if (obj instanceof Variable) { ! getAllMatches(searchString, ret); ! } else if (obj instanceof TopicMapObject) { ! getObjectMatches((TopicMapObject) obj, searchString, ret); } return ret; *************** *** 72,86 **** * @param ret */ ! private void getAllMatches(String srchString, VariableSet ret) throws TologProcessingException { ! try { ! QueryResult qr = m_txtIx.findByText(srchString, true); ! for (int i = 0; i < qr.size(); i++) { ! QueryHit qh = qr.getHit(i); ! addResultsRow(ret, new Object[] { qh.getObject(), srchString }); } ! } catch (TologProcessingException ex) { ! throw ex; ! } catch (Exception ex) { ! throw new TologProcessingException("Error processing full-text query in " + PREDICATE_NAME + " predicate.", ex); } } --- 82,101 ---- * @param ret */ ! private void getAllMatches(String searchString, VariableSet ret) throws TologProcessingException { ! for (Iterator topicIter = getTopicMap().getTopics().iterator(); topicIter.hasNext();) { ! Topic topic = (Topic) topicIter.next(); ! for (Iterator tnIter = topic.getTopicNames().iterator(); tnIter.hasNext();) { ! TopicName tn = (TopicName) tnIter.next(); ! addMatch(tn, tn.getValue(), searchString, ret); ! for (Iterator varIter = tn.getVariants().iterator(); varIter.hasNext();) { ! Variant variant = (Variant) varIter.next(); ! addMatch(variant, variant.getValue(), searchString, ret); ! } } ! for (Iterator occIter = topic.getOccurrences().iterator(); occIter.hasNext();) { ! Occurrence occ = (Occurrence) occIter.next(); ! addMatch(occ, occ.getValue(), searchString, ret); ! } ! } } *************** *** 91,107 **** * @param ret */ ! private void getObjectMatches(TopicMapObject object, String srchString, VariableSet ret) throws TologProcessingException { ! try { ! QueryResult qr = m_txtIx.findByText(srchString, true); ! for (int i = 0; i < qr.size(); i++) { ! QueryHit qh = qr.getHit(i); ! if (qh.getObject().equals(object)) { ! addResultsRow(ret, new Object[] { object, srchString }); ! } ! } ! } catch (TologProcessingException ex) { ! throw ex; ! } catch (Exception ex) { ! throw new TologProcessingException("Error processing full-text query in " + PREDICATE_NAME + " predicate.", ex); } } --- 106,127 ---- * @param ret */ ! private void getObjectMatches(TopicMapObject object, String searchString, VariableSet ret) throws TologProcessingException { ! String value = null; ! if (object instanceof Occurrence) { ! value = ((Occurrence) object).getValue(); ! } ! else if (object instanceof TopicName) { ! value = ((TopicName) object).getValue(); ! } ! else if(object instanceof Variant) { ! value = ((Variant) object).getValue(); ! } ! addMatch(object, value, searchString, ret); ! } ! ! ! private void addMatch(TopicMapObject obj, String value, String searchString, VariableSet ret) throws TologProcessingException { ! if (value != null && value.indexOf(searchString) != -1) { ! addResultsRow(ret, new Object[] { obj, searchString }); } } *************** *** 112,142 **** public void initialise(TopicMap tm) throws TologParserException { super.initialise(tm); ! IndexManager ixMgr = tm.getIndexManager(); ! try { ! m_txtIx = (FullTextIndex) ixMgr.getIndex(FullTextIndex.class); ! if (m_txtIx == null) { ! throw new TologParserException("No full-text index is registered for this topic map. '" + PREDICATE_NAME + "' predicates cannot be used."); ! } ! if (!m_txtIx.isOpen()) { ! m_txtIx.open(); ! } ! m_txtIx.reindex(); ! } catch (TologParserException ex) { ! throw ex; ! } catch (Exception ex) { ! throw new TologParserException("Error initialising text index for predicate " + PREDICATE_NAME, ex); ! } } } - - /* - * $Log$ - * Revision 1.1 2005/03/06 17:30:00 lheuer - * Initial tolog import - * - * Revision 1.1 2004/06/13 11:30:26 kal_ahmed - * Initial implementation of value-like predicate. - * - */ \ No newline at end of file --- 132,152 ---- public void initialise(TopicMap tm) throws TologParserException { super.initialise(tm); ! // IndexManager ixMgr = tm.getIndexManager(); ! // try { ! // m_txtIx = (FullTextIndex) ixMgr.getIndex(FullTextIndex.class); ! // if (m_txtIx == null) { ! // throw new TologParserException("No full-text index is registered for this topic map. '" + PREDICATE_NAME + "' predicates cannot be used."); ! // } ! // if (!m_txtIx.isOpen()) { ! // m_txtIx.open(); ! // } ! // m_txtIx.reindex(); ! // } catch (TologParserException ex) { ! // throw ex; ! // } catch (Exception ex) { ! // throw new TologParserException("Error initialising text index for predicate " + PREDICATE_NAME, ex); ! // } } } Index: SourceLocatorsPredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/SourceLocatorsPredicate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SourceLocatorsPredicate.java 6 Mar 2005 23:38:00 -0000 1.3 --- SourceLocatorsPredicate.java 8 Mar 2005 12:33:57 -0000 1.4 *************** *** 1,6 **** /* ! * Created on 11-Jun-2004 ! * @author Kal */ package org.tmapiutils.query.tolog.predicates; --- 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.predicates; *************** *** 8,11 **** --- 21,25 ---- import java.util.List; + import org.tmapiutils.query.tolog.TologParserException; import org.tmapiutils.query.tolog.TologProcessingException; import org.tmapiutils.query.tolog.parser.Variable; *************** *** 24,30 **** /** ! * @author Kal ! * ! * Describe SourceLocatorsPredicate here. */ public class SourceLocatorsPredicate extends PredicateBase { --- 38,44 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class SourceLocatorsPredicate extends PredicateBase { *************** *** 35,41 **** private static final ParameterInfo [] PARAM_INFO = new ParameterInfo [] { new ParameterInfo(true), ! new ParameterInfo(true) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() --- 49,55 ---- private static final ParameterInfo [] PARAM_INFO = new ParameterInfo [] { new ParameterInfo(true), ! new ParameterInfo(true) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() *************** *** 86,91 **** ! private void addSourceLocators(TopicMapObject tmObj) { ! for (Iterator iter = tmObj.getSourceLocators().iter(); iter.hasNext();) { addResultsRow(ret, new Object[] {tmObj, iter.next()}); } --- 100,105 ---- ! private void addSourceLocators(VariableSet ret, TopicMapObject tmObj) throws TologProcessingException { ! for (Iterator iter = tmObj.getSourceLocators().iterator(); iter.hasNext();) { addResultsRow(ret, new Object[] {tmObj, iter.next()}); } *************** *** 96,111 **** */ private void openMatch(VariableSet ret) throws TologProcessingException { ! addSourceLocators(getTopicMap()); for (Iterator topicIter = getTopicMap().getTopics().iterator(); topicIter.hasNext();) { Topic topic = (Topic) topicIter.next(); ! addSourceLocators(topic); for (Iterator occIter = topic.getOccurrences().iterator(); occIter.hasNext();) { ! addSourceLocators((TopicMapObject) occIter.next()); } for (Iterator tnIter = topic.getTopicNames().iterator(); tnIter.hasNext();) { TopicName tn = (TopicName) tnIter.next(); ! addSourceLocators(tn); for (Iterator varIter = tn.getVariants().iterator(); varIter.hasNext();) { ! addSourceLocator((TopicMapObject) varIter.next()); } } --- 110,125 ---- */ private void openMatch(VariableSet ret) throws TologProcessingException { ! addSourceLocators(ret, getTopicMap()); for (Iterator topicIter = getTopicMap().getTopics().iterator(); topicIter.hasNext();) { Topic topic = (Topic) topicIter.next(); ! addSourceLocators(ret, topic); for (Iterator occIter = topic.getOccurrences().iterator(); occIter.hasNext();) { ! addSourceLocators(ret, (TopicMapObject) occIter.next()); } for (Iterator tnIter = topic.getTopicNames().iterator(); tnIter.hasNext();) { TopicName tn = (TopicName) tnIter.next(); ! addSourceLocators(ret, tn); for (Iterator varIter = tn.getVariants().iterator(); varIter.hasNext();) { ! addSourceLocators(ret, (TopicMapObject) varIter.next()); } } *************** *** 113,119 **** for (Iterator iter = getTopicMap().getAssociations().iterator(); iter.hasNext();) { Association assoc = (Association) iter.next(); ! addSourceLocators(assoc); for (Iterator roleIter = assoc.getAssociationRoles().iterator(); iter.hasNext();) { ! addSourceLocators((TopicMapObject) iter.next()); } } --- 127,133 ---- for (Iterator iter = getTopicMap().getAssociations().iterator(); iter.hasNext();) { Association assoc = (Association) iter.next(); ! addSourceLocators(ret, assoc); for (Iterator roleIter = assoc.getAssociationRoles().iterator(); iter.hasNext();) { ! addSourceLocators(ret, (TopicMapObject) iter.next()); } } *************** *** 126,134 **** */ private void closedMatch(TopicMapObject tmo, Locator locator, VariableSet ret) throws TologProcessingException { ! for (Iterator iter = tmo.getSourceLocators().iterator(); iter.hasNext();) { ! if (iter.next().equals(locator)) { ! addResultsRow(ret, new Object[] {tmo, locator}); ! return; ! } } } --- 140,145 ---- */ private void closedMatch(TopicMapObject tmo, Locator locator, VariableSet ret) throws TologProcessingException { ! if (tmo.getSourceLocators().contains(locator)) { ! addResultsRow(ret, new Object[] {tmo, locator}); } } *************** *** 140,148 **** private void matchObject(Locator locator, VariableSet ret) throws TologProcessingException { IndexUtils.updateIndex(_tmoIdx); ! TopicMapObject tmo = _tmoIdx.getTopicMapObjectBySourceLocator(locator); ! if (tmo != null) { ! addResultsRow(ret, new Object[] {tmo, locator}); ! } ! } /** --- 151,159 ---- private void matchObject(Locator locator, VariableSet ret) throws TologProcessingException { IndexUtils.updateIndex(_tmoIdx); ! TopicMapObject tmo = _tmoIdx.getTopicMapObjectBySourceLocator(locator); ! if (tmo != null) { ! addResultsRow(ret, new Object[] {tmo, locator}); ! } ! } /** Index: OccurrencePredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/OccurrencePredicate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OccurrencePredicate.java 6 Mar 2005 21:39:42 -0000 1.2 --- OccurrencePredicate.java 8 Mar 2005 12:33:57 -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.predicates; --- 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.predicates; *************** *** 22,28 **** /** ! * @author Kal ! * ! * Describe OccurrencePredicate here. */ public class OccurrencePredicate extends PredicateBase --- 30,36 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class OccurrencePredicate extends PredicateBase *************** *** 33,37 **** new ParameterInfo(true, Object.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() --- 41,45 ---- new ParameterInfo(true, Object.class) }; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() *************** *** 98,111 **** } - /* - * $Log$ - * Revision 1.2 2005/03/06 21:39:42 lheuer - * More TM4J -> TMAPI translations - * - * Revision 1.1 2005/03/06 17:30:00 lheuer - * Initial tolog import - * - * Revision 1.2 2004/06/10 08:19:40 kal_ahmed - * Added standard file header and footer. - * - */ \ No newline at end of file --- 106,107 ---- Index: TopicNamePredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/TopicNamePredicate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TopicNamePredicate.java 6 Mar 2005 22:44:55 -0000 1.2 --- TopicNamePredicate.java 8 Mar 2005 12:33:57 -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$ */ --- 1,17 ---- /* ! * 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. */ *************** *** 28,39 **** /** - * - * @author Henke * */ public class TopicNamePredicate extends PredicateBase { // private TopicNamesIndex idx=null; public static final String PREDICATE_NAME = "topic-name"; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() --- 34,46 ---- /** * + * @author Henke + * @author Kal Ahmed (kal[at]techquila.com) + * @author Lars Heuer (heuer[at]semagia.com) */ public class TopicNamePredicate extends PredicateBase { // private TopicNamesIndex idx=null; public static final String PREDICATE_NAME = "topic-name"; ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.predicates.PredicateBase#getParamInfo() *************** *** 60,67 **** VariableSet ret = new VariableSet(); initialiseResultsSet(ret); ! Object paramTopic = params.get(0); Object paramName = params.get(1); ! if((paramName instanceof Variable) && (paramTopic instanceof Variable)) { Iterator itTopics = getTopicMap().getTopics().iterator(); --- 67,74 ---- VariableSet ret = new VariableSet(); initialiseResultsSet(ret); ! Object paramTopic = params.get(0); Object paramName = params.get(1); ! if((paramName instanceof Variable) && (paramTopic instanceof Variable)) { Iterator itTopics = getTopicMap().getTopics().iterator(); *************** *** 111,115 **** public void initialise(TopicMap tm) throws TologParserException { super.initialise(tm); ! /* try { --- 118,122 ---- public void initialise(TopicMap tm) throws TologParserException { super.initialise(tm); ! /* try { *************** *** 122,138 **** } - /* - * $Log$ - * Revision 1.2 2005/03/06 22:44:55 lheuer - * More TM4J -> TMAPI translations - * - * Revision 1.1 2005/03/06 17:30:00 lheuer - * Initial tolog import - * - * Revision 1.2 2004/06/14 21:31:17 kal_ahmed - * Added TopicNamePredicate to builtins. - * - * Revision 1.1 2004/06/14 20:08:05 kal_ahmed - * Initial version. Contributed by Stefan Henke. - * - */ \ No newline at end of file --- 129,130 ---- Index: TypePredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/TypePredicate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TypePredicate.java 7 Mar 2005 12:32:00 -0000 1.3 --- TypePredicate.java 8 Mar 2005 12:33:57 -0000 1.4 *************** *** 1,10 **** /* ! 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$ */ --- 1,17 ---- /* ! * 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. */ *************** *** 36,40 **** /** * ! * @author Kal Ahmed (ka...@te...) */ public class TypePredicate extends PredicateBase { --- 43,48 ---- /** * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public class TypePredicate extends PredicateBase { *************** *** 105,108 **** --- 113,141 ---- } + + private void initializeIndexes() throws TologProcessingException { + try { + _assocIdx.open(); + if (!_assocIdx.getFlags().isAutoUpdated()) { + _assocIdx.reindex(); + } + _roleIdx.open(); + if (!_roleIdx.getFlags().isAutoUpdated()) { + _roleIdx.reindex(); + } + _occIdx.open(); + if (!_occIdx.getFlags().isAutoUpdated()) { + _occIdx.reindex(); + } + _tnIdx.open(); + if (!_tnIdx.getFlags().isAutoUpdated()) { + _tnIdx.reindex(); + } + } + catch (TMAPIException ex) { + throw new TologProcessingException("Error initialising indexes for " + PREDICATE_NAME, ex); + } + } + /** * @param topic *************** *** 110,124 **** */ private void getTyped(Topic type, VariableSet ret) throws TologProcessingException { ! IndexUtils.updateIndex(_assocIdx); Iterator it = _assocIdx.getAssociationsByType(type).iterator(); addInstances(type, it, ret); - IndexUtils.updateIndex(_roleIdx); it = _roleIdx.getAssociationRolesByType(type).iterator(); addInstances(type, it, ret); - IndexUtils.updateIndex(_occIdx); it = _occIdx.getOccurrencesByType(type).iterator(); addInstances(type, it, ret); ! IndexUtils.updateIndex(_tnIdx); ! it = _tnIdx.getOccurrencesByType(type).iterator(); addInstances(type, it, ret); } --- 143,154 ---- */ private void getTyped(Topic type, VariableSet ret) throws TologProcessingException { ! initializeIndexes(); Iterator it = _assocIdx.getAssociationsByType(type).iterator(); addInstances(type, it, ret); it = _roleIdx.getAssociationRolesByType(type).iterator(); addInstances(type, it, ret); it = _occIdx.getOccurrencesByType(type).iterator(); addInstances(type, it, ret); ! it = _tnIdx.getTopicNamesByType(type).iterator(); addInstances(type, it, ret); } *************** *** 160,164 **** */ private void openMatch(VariableSet ret) throws TologProcessingException { ! IndexUtils.updateIndex(_assocIdx); for (Iterator types = _assocIdx.getAssociationTypes().iterator(); types.hasNext();) { Topic type = (Topic)types.next(); --- 190,194 ---- */ private void openMatch(VariableSet ret) throws TologProcessingException { ! initializeIndexes(); for (Iterator types = _assocIdx.getAssociationTypes().iterator(); types.hasNext();) { Topic type = (Topic)types.next(); *************** *** 167,171 **** } } - IndexUtils.updateIndex(_roleIdx); for (Iterator types = _roleIdx.getAssociationRoleTypes().iterator(); types.hasNext();) { Topic type = (Topic)types.next(); --- 197,200 ---- *************** *** 174,178 **** } } - IndexUtils.updateIndex(_occIdx); for (Iterator types = _occIdx.getOccurrenceTypes().iterator(); types.hasNext();) { Topic type = (Topic)types.next(); --- 203,206 ---- *************** *** 181,185 **** } } - IndexUtils.updateIndex(_tnIdx); for (Iterator types = _tnIdx.getTopicNameTypes().iterator(); types.hasNext();) { Topic type = (Topic)types.next(); --- 209,212 ---- *************** *** 207,226 **** } - - /* - * $Log$ - * Revision 1.3 2005/03/07 12:32:00 lheuer - * More TM4J -> TMAPI translations - * Updated ToDo - * ResourcePredicate can handle Variants, too - * - * Revision 1.2 2005/03/06 21:11:33 lheuer - * More TM4J -> TMAPI translations - * - * Revision 1.1 2005/03/06 17:30:00 lheuer - * Initial tolog import - * - * Revision 1.1 2004/06/13 10:16:47 kal_ahmed - * Initial implementation of type() predicate. - * - */ \ No newline at end of file --- 234,235 ---- Index: PredicateBase.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/PredicateBase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PredicateBase.java 6 Mar 2005 17:30:00 -0000 1.1 --- PredicateBase.java 8 Mar 2005 12:33:57 -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.predicates; --- 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.predicates; *************** *** 28,33 **** /** ! * ! * @author Kal Ahmed (ka...@te...) */ public abstract class PredicateBase implements Predicate { --- 35,41 ---- /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) */ public abstract class PredicateBase implements Predicate { *************** *** 35,48 **** private List m_params; private TopicMap m_tm; ! ! public void initialise(TopicMap tm) throws TologParserException { m_tm = tm; } ! public TopicMap getTopicMap() { return m_tm; } ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.Predicate#setParameters(java.util.List) --- 43,56 ---- private List m_params; private TopicMap m_tm; ! ! public void initialise(TopicMap tm) throws TologParserException { m_tm = tm; } ! public TopicMap getTopicMap() { return m_tm; } ! /* (non-Javadoc) * @see org.tmapiutils.query.tolog.Predicate#setParameters(java.util.List) *************** *** 57,63 **** return matches(params); } ! public abstract VariableSet matches(List params) throws TologProcessingException ; ! public Object getParameterValue(int paramIx, Map paramMap) { Object param = m_params.get(paramIx); --- 65,71 ---- return matches(params); } ! public abstract VariableSet matches(List params) throws TologProcessingException ; ! public Object getParameterValue(int paramIx, Map paramMap) { Object param = m_params.get(paramIx); *************** *** 102,106 **** return m_params; } ! public void validateParameters() throws TologParserException { if (m_params.size() < getMinParamCount()) { --- 110,114 ---- return m_params; } ! public void validateParameters() throws TologParserException { if (m_params.size() < getMinParamCount()) { *************** *** 121,128 **** } } ! } } ! /** * Returns the minimum number of parameters accepted by this predicate. --- 129,136 ---- } } ! } } ! /** * Returns the minimum number of parameters accepted by this predicate. *************** *** 132,136 **** return getParamCount(); } ! /** * Returns the maximum number of parameters accepted by this predicate. --- 140,144 ---- return getParamCount(); } ! /** * Returns the maximum number of parameters accepted by this predicate. *************** *** 150,154 **** */ public abstract ParameterInfo [] getParamInfo(); ! /** * Returns the number of parameters accepted by this predicate. --- 158,162 ---- */ public abstract ParameterInfo [] getParamInfo(); ! /** * Returns the number of parameters accepted by this predicate. *************** *** 160,164 **** return pi == null ? 0 : pi.length; } ! /** * Indicates if a variable is allowed to be specified for a predicate parameter. --- 168,172 ---- return pi == null ? 0 : pi.length; } ! /** * Indicates if a variable is allowed to be specified for a predicate parameter. *************** *** 173,186 **** ParameterInfo pi = getParamInfo()[ix]; if (pi != null) { ! return pi.isVariableAllowed(); } else { return true; } } ! /** * Validates that a parameter is of the expected type. * @param ix the index of the predicate parameter being tested ! * @param paramType the type of the predicate parameter * @return true if <code>paramType</code> is an allowed type * for the parameter at <code>ix</code>, false otherwise. --- 181,194 ---- ParameterInfo pi = getParamInfo()[ix]; if (pi != null) { ! return pi.isVariableAllowed(); } else { return true; } } ! /** * Validates that a parameter is of the expected type. * @param ix the index of the predicate parameter being tested ! * @param paramType the type of the predicate parameter * @return true if <code>paramType</code> is an allowed type * for the parameter at <code>ix</code>, false otherwise. *************** *** 189,193 **** ParameterInfo pi = getParamInfo()[ix]; if (pi != null) { ! return pi.validateParamType(paramType); } else { return true; --- 197,201 ---- ParameterInfo pi = getParamInfo()[ix]; if (pi != null) { ! return pi.validateParamType(paramType); } else { return true; *************** *** 204,208 **** } } ! public void addResultsRow(VariableSet resultsSet, Object[] results) throws TologProcessingException { int max = getParameters().size(); --- 212,216 ---- } } ! public void addResultsRow(VariableSet resultsSet, Object[] results) throws TologProcessingException { int max = getParameters().size(); *************** *** 215,219 **** resultsSet.addRow(row); } ! /** * Returns the name of this predicate. This name is used in exception --- 223,227 ---- resultsSet.addRow(row); } ! /** * Returns the name of this predicate. This name is used in exception *************** *** 238,242 **** } /** ! * Parameter description information for predicates derived from the PredicateBase * abstract class. This class keeps track of two pieces of information for a parameter. * The first, <code>variableAllowed</code>, is a boolean flag which is true if it is allowable --- 246,250 ---- } /** ! * Parameter description information for predicates derived from the PredicateBase * abstract class. This class keeps track of two pieces of information for a parameter. * The first, <code>variableAllowed</code>, is a boolean flag which is true if it is allowable *************** *** 244,248 **** * is an array of Class instances which define the allowed Class (or interface) that * the parameter value should implement. The parameter is required to be assignable ! * to one of the classes specified in <code>allowedTypes</code>. * @author Kal Ahmed (ka...@te...) */ --- 252,256 ---- * is an array of Class instances which define the allowed Class (or interface) that * the parameter value should implement. The parameter is required to be assignable ! * to one of the classes specified in <code>allowedTypes</code>. * @author Kal Ahmed (ka...@te...) */ *************** *** 250,254 **** private boolean m_varAllowed; private Class[] m_allowedTypes; ! /** * Creates information for a parameter where the type of the parameter --- 258,262 ---- private boolean m_varAllowed; private Class[] m_allowedTypes; ! /** * Creates information for a parameter where the type of the parameter *************** *** 260,266 **** m_allowedTypes = null; } ! /** ! * Creates information for a parameter where the parameter type is * constrainted to a single class * @param variableAllowed indicates whether or not a variable is allowed for this parameter. --- 268,274 ---- m_allowedTypes = null; } ! /** ! * Creates information for a parameter where the parameter type is * constrainted to a single class * @param variableAllowed indicates whether or not a variable is allowed for this parameter. *************** *** 271,275 **** m_allowedTypes = new Class[] {allowedType}; } ! /** * Creates information for a parameter where the parameter type can be one --- 279,283 ---- m_allowedTypes = new Class[] {allowedType}; } ! /** * Creates information for a parameter where the parameter type can be one *************** *** 282,290 **** m_allowedTypes = allowedTypes; } ! public boolean isVariableAllowed() { return m_varAllowed; } ! public boolean validateParamType(Class paramType) { if (m_allowedTypes == null) return true; --- 290,298 ---- m_allowedTypes = allowedTypes; } ! public boolean isVariableAllowed() { return m_varAllowed; } ! public boolean validateParamType(Class paramType) { if (m_allowedTypes == null) return true; *************** *** 297,335 **** } - - /* - * $Log$ - * Revision 1.1 2005/03/06 17:30:00 lheuer - * Initial tolog import - * - * Revision 1.8 2004/07/20 07:12:07 kal_ahmed - * getParameters() now returns a direct reference to the parameters which can be modified. - * - * Revision 1.7 2004/07/16 13:51:36 kal_ahmed - * Fixes for tolog engine handling of rules and rule-recursion. - * - * Revision 1.6 2004/06/16 21:21:43 kal_ahmed - * Tolog queries may now contain replaceable references specified in an Object array parameter to the QueryEvaluator at evaluation time. - * - * Revision 1.5 2004/06/13 19:44:30 kal_ahmed - * Added a fix and test for handling recursive rules definitions. - * - * Revision 1.4 2004/06/13 17:17:59 kal_ahmed - * Added registration of builtin predicates. Fixed rule expansion code to handle player/role pairs correctly. - * - * Revision 1.3 2004/06/09 22:15:08 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.2 2004/06/09 20:20:30 kal_ahmed - * Major reworking of the predicate interfaces and internal implementation of VariableSet to reduce the use of HashMaps. - * - * Revision 1.1 2004/06/07 20:31:59 kal_ahmed - * Completed work on projection and sorting. Performed a bit more code reorganisation. Added DirectInstanceOfPredicate. - * - * Revision 1.2 2004/06/02 19:22:13 kal_ahmed - * Added support for parsing rules and including them in queries. - * - * Revision 1.1 2004/05/30 22:08:25 kal_ahmed - * Initial version of tolog 1.0 engine - * - */ \ No newline at end of file --- 305,306 ---- Index: SubjectIdentifierPredicate.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/predicates/SubjectIdentifierPredicate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SubjectIdentifierPredicate.java 6 Mar 2005 23:38:00 -0000 1.3 --- SubjectIdentifierPredicate.java 8 Mar 2005 12:33:57 -0000 1.4 *************** *** 1,6 **** /* ! * Created on 11-Jun-2004 ! * @author Kal */ package org.tmapiutils.query.tolog.predicates; --- 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 ... [truncated message content] |