<commit_before>import { schema, denormalize } from 'normalizr';

import { AsyncReference } from '../async/AsyncStorage';

/* Collections */
export const COLLECTIONS = Object.freeze({
  PROPERTY_TYPE: 'propertyTypes',
  ENTITY_TYPE: 'entityTypes',
  ENTITY_SET: 'entitySets'
});

/* Normalizr Schemas */
export const PropertyTypeNschema = new schema.Entity(COLLECTIONS.PROPERTY_TYPE);

export const EntityTypeNschema = new schema.Entity(COLLECTIONS.ENTITY_TYPE, {
  properties: [PropertyTypeNschema]
});

export const EntitySetNschema = new schema.Entity(COLLECTIONS.ENTITY_SET, {
  entityType: EntityTypeNschema
});


/**
 * A reference to an object in the normalized data
 */
export type EdmObjectReference = {
  id:string,
  collection:string
}
function referenceToString(reference:EdmObjectReference) {
  return `{id: '${reference.id}, collection: ${reference.collection}}`;
}

/*
** Reference Factories
 */
export function createPropertyTypeReference(id:string) {
  if (!id) {
    throw new Error('"id" can\'t be null');
  }
  return {
    id,
    collection: COLLECTIONS.PROPERTY_TYPE
  };
}

export function createEntitySetReference(id:string) {
  if (!id) {
    throw new Error('"id" can\'t be null');
  }
  return {
    id,
    collection: COLLECTIONS.ENTITY_SET
  }
}

export function createEntityTypeReference(id:string) {
  if (!id) {
    throw new Error('"id" can\'t be null');
  }
  return {
    id,
    collection: COLLECTIONS.ENTITY_SET
  }
}

export function createAsyncReferenceFromEdmReference(edmReferece :EdmObjectReference) :AsyncReference {
  return {
    id: edmReferece.id,<commit_msg>Fixed request permissions dialog<commit_after>import { schema, denormalize } from 'normalizr';

import { AsyncReference } from '../async/AsyncStorage';

/* Collections */
export const COLLECTIONS = Object.freeze({
  PROPERTY_TYPE: 'propertyTypes',
  ENTITY_TYPE: 'entityTypes',
  ENTITY_SET: 'entitySets'
});

/* Normalizr Schemas */
export const PropertyTypeNschema = new schema.Entity(COLLECTIONS.PROPERTY_TYPE);

export const EntityTypeNschema = new schema.Entity(COLLECTIONS.ENTITY_TYPE, {
  properties: [PropertyTypeNschema]
});

export const EntitySetNschema = new schema.Entity(COLLECTIONS.ENTITY_SET, {
  entityType: EntityTypeNschema
});


/**
 * A reference to an object in the normalized data
 */
export type EdmObjectReference = {
  id:string,
  collection:string
}
function referenceToString(reference:EdmObjectReference) {
  return `{id: '${reference.id}, collection: ${reference.collection}}`;
}

/*
** Reference Factories
 */
export function createPropertyTypeReference(id:string) {
  if (!id) {
    throw new Error('"id" can\'t be null');
  }
  return {
    id,
    collection: COLLECTIONS.PROPERTY_TYPE
  };
}

export function createEntitySetReference(id:string) {
  if (!id) {
    throw new Error('"id" can\'t be null');
  }
  return {
    id,
    collection: COLLECTIONS.ENTITY_SET
  }
}

export function createEntityTypeReference(id:string) {
  if (!id) {
    throw new Error('"id" can\'t be null');
  }
  return {
    id,
    collection: COLLECTIONS.ENTITY_TYPE
  }
}

export function createAsyncReferenceFromEdmReference(edmReferece :EdmObjectReference) :AsyncReference {
  return {
    id: edmReferece.id,
{'fraction_non_alphanumeric': 0.11982705373687462, 'fraction_numerical': 0.0, 'mean_word_length': 4.584482758620689, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3376253', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1023, 'n_words': 236}