libreccm-legacy/ccm-ldn-terms/pdl/com/arsdigita/london/terms/indexing/query-getNonPreferredTerms.pdl

47 lines
1.5 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 getNonPreferredTerms {
String[1..1] uniqueID;
String[1..1] preferredUniqueID;
String[1..1] name;
do {
SELECT
t1.unique_id as uniqueID,
c.name as name,
t2.unique_id as preferredUniqueID
FROM
trm_terms t1,
cat_categories c,
cat_category_category_map ccm,
trm_terms t2
WHERE
t1.model_category_id = c.category_id
AND t1.domain = :domain
AND ccm.category_id = c.category_id
AND ccm.relation_type = 'preferred'
AND t2.model_category_id = ccm.related_category_id
AND t2.domain = :domain
} map {
uniqueID = uniqueID;
preferredUniqueID = preferredUniqueID;
name = name;
}
}