Logo Search packages:      
Sourcecode: tagcoll version File versions  Download package

template<class ITEM, class TAG>
OpSet< ITEM > CardinalityStore::getRelatedItems ( const OpSet< TAG > &  tags,
int  maxdistance = 1 
) const [inline, virtual]

Get the related items at the given maximum distance

Examples:

 // Get the items related to a given one, at the given distance
 OpSet<Item> getRelated(const Item& item, int distance)
 {
    OpSet<Item> res = collection.getRelatedItems(collection.getTags(item), distance);
    return res - item;
 }

 // Get the items related to the given ones, at the given distance
 OpSet<Item> getRelated(const OpSet<Item>& items, int distance)
 {
    OpSet<Item> res = collection.getRelatedItems(collection.getTags(items), distance);
    return res - items;
 }

 // Get the related items, increasing the distance until it finds at
 // least 'minimum' items
 OpSet<Item> getRelated(const Item& item, int minimum)
 {
    OpSet<Tag> tags = collection.getTags(item);
    OpSet<Item> res;
    for (int i = 0; i < tags.size() && res.size() < minimum; i++)
       res += collection.getRelatedItems(tags, i);
        return res - item;
 }

Reimplemented from Tagcoll::Collection< ITEM, TAG >.

Definition at line 312 of file CardinalityStore.cc.

References Tagcoll::CardinalityStore< ITEM, TAG >::getItemsExactMatch(), and Tagcoll::CardinalityStore< ITEM, TAG >::getRelatedTagsets().

{
      list< OpSet<TAG> > tagsets = getRelatedTagsets(ts, maxdistance);
      OpSet<ITEM> items;
      for (typename list< OpSet<TAG> >::const_iterator i = tagsets.begin(); i != tagsets.end(); i++)
            items += getItemsExactMatch(*i);
      return items;
}


Generated by  Doxygen 1.6.0   Back to index