<commit_before>//
//  yas_db_object_utils.cpp
//

#include "yas_db_object_utils.h"
#include "yas_db_model.h"
#include "yas_stl_utils.h"

using namespace yas;

std::vector<db::const_object> db::get_const_relation_objects(const_object const &object,
                                                             const_object_map_map const &objects,
                                                             std::string const &rel_name) {
    auto const rel_ids = object.get_relation_ids(rel_name);
    std::string const &tgt_entity_name = object.model().relation(object.entity_name(), rel_name).target_entity_name;

    if (objects.count(tgt_entity_name) > 0) {
        auto const &entity_objects = objects.at(tgt_entity_name);
        return to_vector<db::const_object>(rel_ids,
                                           [&entity_objects, entity_name = object.entity_name()](db::value const &id) {
                                               if (entity_objects.count(id.get<integer>()) > 0) {
                                                   return entity_objects.at(id.get<integer>());
                                               }
                                               return db::const_object::null_object();
                                           });
    }

    return {};
}
<commit_msg>update object_utils<commit_after>//
//  yas_db_object_utils.cpp
//

#include "yas_db_model.h"
#include "yas_db_object_utils.h"
#include "yas_stl_utils.h"

using namespace yas;

std::vector<db::const_object> db::get_const_relation_objects(const_object const &object,
                                                             const_object_map_map const &objects,
                                                             std::string const &rel_name) {
    auto const rel_ids = object.get_relation_ids(rel_name);
    std::string const &tgt_entity_name = object.model().relation(object.entity_name(), rel_name).target_entity_name;

    if (objects.count(tgt_entity_name) > 0) {
        auto const &entity_objects = objects.at(tgt_entity_name);
        return to_vector<db::const_object>(rel_ids,
                                           [&entity_objects, entity_name = object.entity_name()](db::value const &id) {
                                               if (entity_objects.count(id.get<integer>()) > 0) {
                                                   return entity_objects.at(id.get<integer>());
                                               }
                                               return db::const_object::null_object();
                                           });
    }

    return {};
}

{'fraction_non_alphanumeric': 0.10030395136778116, 'fraction_numerical': 0.001519756838905775, 'mean_word_length': 1.4653558052434457, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '327683', 'n_tokens_mistral': 662, 'n_tokens_neox': 653, 'n_words': 105}