Ejemplo n.º 1
0
	virtual void retrieve(const Query& q, Answer& a) throw (dlvhex::PluginError)
  {
    #if 0
    // get inputs
    assert(q.input.size() == 2);
    ID pred = q.input[0];
    ID cmp = q.input[1];
    LOG(INFO,"calculating above extatom for predicate " << pred << " and symbol " << cmp);
    const Term& cmpt = registry->terms.getByID(cmp);

    // get query
    assert(q.pattern.size() == 1);
    ID out = q.pattern.front();

    // build set of found targets
    assert(q.interpretation != 0);
    dlvhex::OrdinaryAtomTable::PredicateIterator it, it_end;
    assert(registry != 0);
    for(boost::tie(it, it_end) = registry->ogatoms.getRangeByPredicateID(pred);
        it != it_end; ++it)
    {
      const dlvhex::OrdinaryAtom& oatom = *it;

      // skip ogatoms not present in interpretation
      if( !q.interpretation->getFact(registry->ogatoms.getIDByStorage(oatom).address) )
        continue;

      // the edge predicate must be unary
      assert(oatom.tuple.size() == 2);
      const Term& t = registry->terms.getByID(oatom.tuple[1]);
      if( t.symbol >= cmpt.symbol )
      {
        if( (out.isTerm() && out.isVariableTerm()) ||
            (out == oatom.tuple[1]) )
        {
          Tuple t;
          t.push_back(oatom.tuple[1]);
          a.get().push_back(t);
        }
      }
    }
    #endif
    throw std::runtime_error("todo implement SenseNotArmed1PluginAtom::retrieve");
  }