static ResourceIterator<SemiOrphanRel> isSemiOrphan(
      final DerivationController _derivation, final Person person) {
    final int _derivationlevel = _derivation.size();
    return new IteratorChain<SemiOrphanRel>(2) {

      public ResourceIterator<SemiOrphanRel> getNextIterator(int pos) {
        switch (pos) {
          case 0:
            {
              // invoke rule1: isYoung(p) & Father(f,p) & not Mother(m,p)
              // -> SemiOrphan(p);
              return isSemiOrphan_0(_derivation.pop(_derivationlevel), person);
            }

          case 1:
            {
              // invoke rule2: isYoung(p) & not Father(f,p) & Mother(m,p)
              // -> SemiOrphan(p);
              return isSemiOrphan_1(_derivation.pop(_derivationlevel), person);
            }

          default:
            return EmptyIterator.DEFAULT;
        }
      }
    };
  }
  static ResourceIterator<FrequentCustomerRel> isFrequentCustomer(
      final DerivationController _derivation, final Customer customer) {
    final int _derivationlevel = _derivation.size();
    return new IteratorChain<FrequentCustomerRel>(2) {

      public ResourceIterator<FrequentCustomerRel> getNextIterator(int pos) {
        switch (pos) {
          case 0:
            {
              // invoke rule1: (c.getTransactionCount())>5 ->
              // FrequentCustomer(c);
              return isFrequentCustomer_0(_derivation.pop(_derivationlevel), customer);
            }

          case 1:
            {
              // invoke rule2: (c.getTransactionCount())>3 &
              // (c.getTurnover())>500 -> FrequentCustomer(c);
              return isFrequentCustomer_1(_derivation.pop(_derivationlevel), customer);
            }

          default:
            return EmptyIterator.DEFAULT;
        }
      }
    };
  }