public void batchRelate(
      ModelRoot modelRoot, boolean relateProxies, boolean notifyChanges, boolean searchAllRoots) {
    InstanceList instances = null;
    ModelRoot baseRoot = modelRoot;

    if (ReadsValue == null) {
      // R609
      Value_c relInst40728 =
          (Value_c) baseRoot.getInstanceList(Value_c.class).get(new Object[] {m_r_value_id});
      // if there was no local element, check for any global elements
      // failing that proceed to check other model roots
      if (relInst40728 == null) {
        relInst40728 =
            (Value_c)
                Ooaofooa.getDefaultInstance()
                    .getInstanceList(Value_c.class)
                    .get(new Object[] {m_r_value_id});
      }
      if (relInst40728 == null && searchAllRoots && !baseRoot.isCompareRoot()) {
        Ooaofooa[] roots = Ooaofooa.getInstances();
        for (int i = 0; i < roots.length; i++) {
          if (roots[i].isCompareRoot()) {
            // never use elements from any compare root
            continue;
          }
          relInst40728 =
              (Value_c) roots[i].getInstanceList(Value_c.class).get(new Object[] {m_r_value_id});
          if (relInst40728 != null) break;
        }
      }
      // synchronized
      if (relInst40728 != null) {
        if (relateProxies || !isProxy() || (inSameComponent(this, relInst40728) && !isProxy())) {
          relInst40728.relateAcrossR609To(this, notifyChanges);
        }
      }
    }

    if (WritesValue == null) {
      // R689
      Value_c relInst40729 =
          (Value_c) baseRoot.getInstanceList(Value_c.class).get(new Object[] {m_l_value_id});
      // if there was no local element, check for any global elements
      // failing that proceed to check other model roots
      if (relInst40729 == null) {
        relInst40729 =
            (Value_c)
                Ooaofooa.getDefaultInstance()
                    .getInstanceList(Value_c.class)
                    .get(new Object[] {m_l_value_id});
      }
      if (relInst40729 == null && searchAllRoots && !baseRoot.isCompareRoot()) {
        Ooaofooa[] roots = Ooaofooa.getInstances();
        for (int i = 0; i < roots.length; i++) {
          if (roots[i].isCompareRoot()) {
            // never use elements from any compare root
            continue;
          }
          relInst40729 =
              (Value_c) roots[i].getInstanceList(Value_c.class).get(new Object[] {m_l_value_id});
          if (relInst40729 != null) break;
        }
      }
      // synchronized
      if (relInst40729 != null) {
        if (relateProxies || !isProxy() || (inSameComponent(this, relInst40729) && !isProxy())) {
          relInst40729.relateAcrossR689To(this, notifyChanges);
        }
      }
    }

    // R603
    Statement_c relInst40730 =
        (Statement_c)
            baseRoot.getInstanceList(Statement_c.class).get(new Object[] {m_statement_id});
    // if there was no local element, check for any global elements
    // failing that proceed to check other model roots
    if (relInst40730 == null) {
      relInst40730 =
          (Statement_c)
              Ooaofooa.getDefaultInstance()
                  .getInstanceList(Statement_c.class)
                  .get(new Object[] {m_statement_id});
    }
    if (relInst40730 == null && searchAllRoots && !baseRoot.isCompareRoot()) {
      Ooaofooa[] roots = Ooaofooa.getInstances();
      for (int i = 0; i < roots.length; i++) {
        if (roots[i].isCompareRoot()) {
          // never use elements from any compare root
          continue;
        }
        relInst40730 =
            (Statement_c)
                roots[i].getInstanceList(Statement_c.class).get(new Object[] {m_statement_id});
        if (relInst40730 != null) break;
      }
    }
    // synchronized
    if (relInst40730 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst40730) && !isProxy())) {
        relInst40730.relateAcrossR603To(this, notifyChanges);
      }
    }
  }