630 {
632 for (const auto &p : nt) {
633 if (auto *pkg = dynamic_cast<package *>(p.get());
634 pkg != nullptr) {
636 current_iteration_context);
637 }
638 else {
639 for (
const relationship &rel : p.
get()->relationships()) {
641 !d.should_include(rel.type())) {
642 continue;
643 }
644
645
646
647 if (context_cfg.direction ==
651 continue;
652 }
653 if (context_cfg.direction ==
657 continue;
658 }
659 for (const auto &element_id : effective_context) {
660 if (rel.destination() == element_id)
661 current_iteration_context.emplace(
662 p.get()->id());
663 }
664 }
665
666
667
668
669 for (const auto element_id : effective_context) {
670 const auto &maybe_element = d.get(element_id);
671
672 if (!maybe_element)
673 continue;
674
675 for (const relationship &rel :
676 maybe_element.value().relationships()) {
678 !d.should_include(rel.type())) {
679 continue;
680 }
681
682 if ((context_cfg.direction ==
685 rel.type() !=
687 continue;
688 }
689 if (context_cfg.direction ==
692 rel.type() ==
694 continue;
695 }
696
697 if (rel.destination() == p.get()->id())
698 current_iteration_context.emplace(
699 p.get()->id());
700 }
701 }
702 }
703 }
704 }
706 for (const auto &p : nt) {
707 auto *pkg = dynamic_cast<package *>(p.get());
708 if (pkg == nullptr)
709 continue;
710
712 current_iteration_context);
713
714 for (
const relationship &rel : p.
get()->relationships()) {
716 !d.should_include(rel.type())) {
717 continue;
718 }
719
720
721
722 if (context_cfg.direction ==
726 continue;
727 }
728 if (context_cfg.direction ==
732 continue;
733 }
734 for (const auto &element_id : effective_context) {
735 if (rel.destination() == element_id)
736 current_iteration_context.emplace(p.get()->id());
737 }
738 }
739
740
741
742
743 for (const auto element_id : effective_context) {
744 const auto &maybe_element = d.get(element_id);
745
746 if (!maybe_element)
747 continue;
748
749 for (const relationship &rel :
750 maybe_element.value().relationships()) {
752 !d.should_include(rel.type())) {
753 continue;
754 }
755
756 if ((context_cfg.direction ==
760 continue;
761 }
762 if (context_cfg.direction ==
766 continue;
767 }
768
769 if (rel.destination() == p.get()->id())
770 current_iteration_context.emplace(p.get()->id());
771 }
772 }
773 }
774 }
775 }