49 lines
1.7 KiB
Plaintext
49 lines
1.7 KiB
Plaintext
// Copyright (C) 2009 Permeance Technologies Pty Ltd. All Rights Reserved.
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it under
|
|
// the terms of the GNU Lesser General Public License as published by the Free
|
|
// Software Foundation; either version 2.1 of the License, or (at your option)
|
|
// any later version.
|
|
//
|
|
// This library is distributed in the hope that it will be useful, but WITHOUT
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
// details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with this library; if not, write to the Free Software Foundation, Inc.,
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
model com.arsdigita.london.terms.indexing;
|
|
|
|
query getRelatedTerms {
|
|
String[1..1] uniqueID;
|
|
String[1..1] relatedUniqueID;
|
|
String[1..1] relationType;
|
|
|
|
do {
|
|
SELECT
|
|
t1.unique_id as uniqueID,
|
|
t2.unique_id as relatedUniqueID,
|
|
ccm.relation_type as relationType
|
|
FROM
|
|
trm_terms t1,
|
|
cat_categories c1,
|
|
trm_terms t2,
|
|
cat_categories c2,
|
|
cat_category_category_map ccm
|
|
WHERE
|
|
t1.model_category_id = c1.category_id
|
|
AND t1.domain = :domain
|
|
AND ccm.category_id = c1.category_id
|
|
AND ccm.related_category_id = c2.category_id
|
|
AND c2.category_id = t2.model_category_id
|
|
AND t2.domain = t1.domain
|
|
AND ccm.relation_type <> 'preferred'
|
|
} map {
|
|
uniqueID = uniqueID;
|
|
relatedUniqueID = relatedUniqueID;
|
|
relationType = relationType;
|
|
}
|
|
}
|