<commit_before><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * OAI Provider: Records model
 *
 * OAI Records are sources from registry_objects
 *
 *
 * @author <NAME> <<EMAIL>>
 * @package ands/services/oai
 *
 */
class Records extends CI_Model
{

	public function get($set,
			    $after=false,
			    $before=false,
                $start=0,
                $supplied_format='rif')
	{
		$this->load->model('oai/Sets', 'sets');
		$this->load->model('registry_object/Registry_objects', 'ro');
		$args = array();
		$delArgs = array();
		$args['rawclause'] = array('registry_objects.status' => "'PUBLISHED'");
		$args['clause'] = array();
		$args['wherein'] = false;
        $args['allowedclass'] = false;
        $args['checkType'] = false;
		$count = '';
		$deleted_records = array();
		if ($after)
		{
			$args["clause"]["registry_object_attributes.value >="] = $after->getTimestamp();
			$delArgs['deleted >='] = $after->getTimestamp();
		}

		if ($before)
		{
			$args["clause"]["registry_object_attributes.value <="] = $before->getTimestamp();
			$delArgs['deleted <='] = $before->getTimestamp();
		}

		if ($after or $before)
		{
			$args["clause"]["registry_object_attributes.attribute"] = "updated";
		}

		if ($set)
		{
			$args["wherein"] = $this->sets->getIDsForSet($set);
			$delArgs[$set->source] = $set->val;
		}

        if($supplied_format == 'dci')
        {
            $args["allowedclass"] = 'collection';
            $args['checkType'] = false;
        }

		if(!($set&&!$args["wherein"]))
		{
		$count = $this->ro->_get(array(array('args' => $args,
						     'fn' => function($db, $args) {
							     $db->select("count(distinct(registry_objects.registry_object_id))")
								     ->from("registry_objects")
								     ->join("data_sources",
									    "data_sources.data_source_id = registry_objects.data_source_id",
									    "inner")
								     ->join("registry_object_attributes",
									    "registry_object_attributes.registry_object_id = registry_objects.registry_object_id",
									    "inner")
								     ->where($args['rawclause'], null, false)
								     ->where($args['clause']);
                                 if ($args['checkType'])
                                 {
                                     $db->join("registry_object_attributes at",
                                         "at.registry_object_id = registry_objects.registry_object_id",
                                         "inner")
                                         ->where("at.value IN ('collection', 'repository', 'dataset', 'software')")<commit_msg>OAI hotfix for deleted bug and DCI type query<commit_after><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * OAI Provider: Records model
 *
 * OAI Records are sources from registry_objects
 *
 *
 * @author <NAME> <<EMAIL>>
 * @package ands/services/oai
 *
 */
class Records extends CI_Model
{

	public function get($set,
			    $after=false,
			    $before=false,
                $start=0,
                $supplied_format='rif')
	{
		$this->load->model('oai/Sets', 'sets');
		$this->load->model('registry_object/Registry_objects', 'ro');
		$args = array();
		$delArgs = array();
		$args['rawclause'] = array('registry_objects.status' => "'PUBLISHED'");
		$args['clause'] = array();
		$args['wherein'] = false;
        $args['allowedclass'] = false;
        $args['checkType'] = false;
		$count = '';
		$deleted_records = array();
		if ($after)
		{
			$args["clause"]["registry_object_attributes.value >="] = $after->getTimestamp();
			$delArgs['deleted >='] = $after->getTimestamp();
		}

		if ($before)
		{
			$args["clause"]["registry_object_attributes.value <="] = $before->getTimestamp();
			$delArgs['deleted <='] = $before->getTimestamp();
		}

		if ($after or $before)
		{
			$args["clause"]["registry_object_attributes.attribute"] = "updated";
		}

		if ($set)
		{
			$args["wherein"] = $this->sets->getIDsForSet($set);
			$delArgs[$set->source] = $set->val;
		}

        if($supplied_format == 'dci')
        {
            $args["allowedclass"] = 'collection';
            $args['checkType'] = true;
        }

		if(!($set&&!$args["wherein"]))
		{
		$count = $this->ro->_get(array(array('args' => $args,
						     'fn' => function($db, $args) {
							     $db->select("count(distinct(registry_objects.registry_object_id))")
								     ->from("registry_objects")
								     ->join("data_sources",
									    "data_sources.data_source_id = registry_objects.data_source_id",
									    "inner")
								     ->join("registry_object_attributes",
									    "registry_object_attributes.registry_object_id = registry_objects.registry_object_id",
									    "inner")
								     ->where($args['rawclause'], null, false)
								     ->where($args['clause']);
                                 if ($args['checkType'])
                                 {
                                     $db->join("registry_object_attributes at",
                                         "at.registry_object_id = registry_objects.registry_object_id",
                                         "inner")
                                         ->where("at.value IN ('collection', 'repository', 'dataset', 'software')")
{'fraction_non_alphanumeric': 0.17536534446764093, 'fraction_numerical': 0.0003795786676788764, 'mean_word_length': 2.3631142310146775, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '822217', 'n_tokens_mistral': 1826, 'n_tokens_neox': 1553, 'n_words': 247}