Version: dev

extract

Stable function · Editing

Tier: stable · Kind: function · Topic: Editing

JuliaTypeScriptPythonRustGo
extractextractextract, extract_component_from_filenot exportedExtract

Note: spelling differs from the §2 rule: python=extract_component_from_file (expected extract); multiple spellings exported by: python

Julia

extract(file::EsmFile, component_name::String)
extract(file::EsmFile, component_name::String) -> EsmFile

Extract a single component into a standalone ESM file.

Creates a new file containing only the specified component and any coupling entries that reference it. Throws EditError if the component does not exist.

Source

TypeScript

function extract(file: EsmFile, componentName: string): EsmFile

Extract a specific component from an ESM file into a new file

Parameters

  • file — ESM file to extract from
  • componentName — Name of the component to extract

Returns

New ESM file containing only the specified component

Throws

  • EntityNotFoundError if component not found

Source

Python

Exported as extract and extract_component_from_file. Both names refer to the same operation.

extract

extract(esm_file: EsmFile, component_name: str, validate_after_edit: bool = True) -> EditResult

Extract a single component into a standalone ESM file.

Source

extract_component_from_file

extract_component_from_file(esm_file: EsmFile, component_name: str, validate_after_edit: bool = True) -> EditResult

Deprecated alias for extract . Extract a single component into a standalone ESM file.

Source

Rust

Rust does not export this function.

Go

func Extract(file ESMFile, componentName string) (ESMFile, error)

Extract returns a new file containing only the component componentName, together with every coupling entry that references it.

Models and reaction systems are searched, in that order. data_sources is deliberately NOT searched: from esm 1.0.0 a data source is not a COMPONENT — it has no variables, is not a coupling endpoint or a subsystem — so there is no such thing as extracting one as a standalone document. A model that consumes a source carries the binding on its own parameter, and extracting that model is what carries the dependency with it.

DIVERGENCE: Julia’s extract still offers data sources as an extractable component; TypeScript’s does not, and TypeScript is followed here for the reason above.

Returns *EntityNotFoundError when no component of that name exists.

Source · Go docs