# The Data Exchange API¶

The following functions you can use within your model, are exposed by the Data Exchange library.

dex::AddMapping(mappingName, mappingFile)

Parses mappingFile to create a mapping called mappingName.

Arguments
• mappingName – the name of the mapping to be created

• mappingFile – the relative path to the mapping file to be parsed.

dex::ReadFromFile(dataFile, mappingName, emptyIdentifiers, resetCounters)

Reads data from file dataFile into model identifiers using mapping mappingName.

Arguments
• dataFile – the relative path to the data file to be read

• mappingName – the name of the mapping to be used

• emptyIdentifiers – indicates whether all identifiers referred in the mapping should be emptied prior to reading the file

• resetCounters – indicates whether to reset all counters for iterative-binds-to indices prior to reading the file

dex::WriteToFile(dataFile, mappingName, pretty)

Writes file dataFile from data in model identifiers using mapping mappingName.

Arguments
• dataFile – the relative path to the data file to write to

• mappingName – the name of the mapping to be used for writing

• pretty – indicates whether to use a pretty writer (enhances readibility at the cost of bigger file size)

dex::ReadAllMappings()

Read all mappings contained in the folder Mappings and store all successfully read mappings in the set dex::Mappings.