## Creating dm objects and basic functions

dm() new_dm() validate_dm() cdm_get_src() cdm_get_tables() cdm_get_data_model() cdm_get_filter() is_dm() as_dm()

Data model class

## Primary keys

cdm_add_pk()

Mark a column of a table in a dm object as its primary key

cdm_has_pk()

Does a table of a dm object have a column set as primary key?

cdm_get_pk()

Retrieve the name of the column marked as primary key of a table of a dm object

cdm_get_all_pks()

Get all primary keys of a dm object

cdm_rm_pk()

Remove primary key from a table in a dm object

enum_pk_candidates() cdm_enum_pk_candidates()

Which columns are candidates for a primary key column?

## Foreign keys

cdm_add_fk()

Add a reference from one table of a dm to another

cdm_has_fk()

Does a reference from one table of a dm to another exist?

cdm_get_fk()

Retrieve the name of the column marked as foreign key, pointing from one table of a dm to another

cdm_get_all_fks()

Retrieve all foreign key constraints in a dm

cdm_rm_fk()

Remove reference(s) from one table of a dm to another

cdm_enum_fk_candidates()

Find foreign key candidates in a table

## Visualization

cdm_draw() cdm_set_colors() cdm_get_colors() cdm_get_available_colors()

Draw schema of a dm-object's data model

## Flattening

cdm_flatten_to_tbl()

Flatten part of a dm into a wide table

cdm_join_to_tbl()

Perform a join between two tables of a dm

## Filtering

cdm_filter() cdm_apply_filters()

Filtering a dm object

## Interaction with DBs

cdm_copy_to()

Copy a dm-object to a src/con

cdm_learn_from_db()

Learn a dm object from a database (DB)

## Utilizing foreign key relations

cdm_is_referenced()

Is a dm's table referenced by another table?

cdm_get_referencing_tables()

Get the names of a dm's tables referencing a given table.

## Table surgery

decompose_table()

Decompose a table into two linked tables

reunite_parent_child() reunite_parent_child_from_list()

Merge two tables linked by a foreign key relation

## Check keys and cardinalities

check_key()

Test if column (combination) is unique key of table

check_if_subset()

Test if values of one column are a subset of values of another column

check_set_equality()

Test if the value sets of two different columns in two different tables are the same

check_cardinality_0_n() check_cardinality_1_n() check_cardinality_1_1() check_cardinality_0_1()

Test if the relation between two tables of a data model meet the requirements

## Miscellaneous

cdm_nycflights13()

Creates a dm object for the nycflights13 data

cdm_select_tbl()

Get a dm only containing the indicated tables

cdm_rename_tbl()

Change names of tables in a dm

cdm_nrow()

Number of rows