Element <variable>¶
Zweck: Bindet einen wiederverwendbaren Skalar, eine Entity, eine Quellauswahl oder einen Skriptwert im aktiven Scope.
Warum: Verwende dieses Element für wiederverwendbare Zwischendaten, die nicht selbst exportiert werden sollen.
Beispiel¶
1 | |
Entscheidungshilfe¶
Fachlicher Nutzen: Trennt wiederverwendbare Berechnungen und Quell-Bindings von den exportierten Produktfeldern.
-
Verwenden, wenn
- Wenn mehrere spätere Felder dieselbe Entity, Quellzeile, denselben Wert oder dieselbe Berechnung benötigen.
-
Anderen Ansatz wählen, wenn
- Wenn der Wert direkt zum exportierten Datensatz gehört.
-
Voraussetzungen
- Deklariere die Variable vor allen Ausdrücken, die ihren Namen verwenden.
-
Alternativen
- Verwende key, wenn der Wert Teil des Ausgabedatensatzes sein muss. (Siehe:
<key>)
- Verwende key, wenn der Wert Teil des Ausgabedatensatzes sein muss. (Siehe:
Vollständige Beispiele¶
Wiederverwendbare Werte vor dem Feldexport binden
Verwende Variablen für Zwischenwerte und exportiere nur die Keys, die zum Produkt gehören.
| variable-binding-strategies/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 | |
Eine geordnete Entity-CSV-Quelle zyklisch durchlaufen
Verwende cyclic nur, wenn ein begrenztes Produkt bewusst mehr Datensätze als die endliche Quelle benötigt.
| variable-ordered-cyclic/data/people.ent.csv | |
|---|---|
1 2 3 4 | |
| variable-ordered-cyclic/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 8 9 10 | |
iterator, data oder value bewusst als Storage-Modus wählen
Verwende iterator für zeilenweises Durchlaufen, data für Berechnungen auf dem gesamten Pool und value für einen gehaltenen Datensatz.
| variable-storage-modes/data/colors.ent.csv | |
|---|---|
1 2 3 4 | |
| variable-storage-modes/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 8 9 10 | |
Regeln und ungültige Kombinationen¶
Eine variable benötigt genau einen Modus zur Werterzeugung.
Attribute: source, entity, script, generator, values, constant, type, pattern, string
Warum: Ein Binding ohne Quelle, Entity, Skript, Generator, Wertepool, Konstante, Typ, Pattern oder String-Template kann keinen Wert bereitstellen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Wähle genau einen expliziten Erzeugungsmodus für die variable.
Attribute: source, entity, script, generator, values, constant, pattern, string
Warum: Die Kombination von source, entity, script, generator, values, constant, pattern oder string würde das Binding mehrdeutig machen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
storage erfordert eine materialisierbare source.
Attribute: storage, source
Warum: value, data und iterator beschreiben die Aufbewahrung von Quelldatensätzen; sie gelten nicht für Konstanten oder Generatorergebnisse.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
storage darf nicht mit iterationSelector kombiniert werden.
Attribute: storage, iterationSelector
Warum: Abfragen pro Iteration stellen keinen stabilen Quellpool bereit, den eine Storage-Strategie benötigt.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
unique darf nicht mit cyclic kombiniert werden.
Attribute: unique, cyclic
Warum: Unique-Auswahl verbraucht einen endlichen Pool ohne Zurücklegen, während cyclic ihn bewusst wiederholt.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
weights erfordert einen Inline-Pool in values.
Attribute: weights, values
Warum: Jedes Gewicht beeinflusst den entsprechenden values-Eintrag und hat ohne diesen Pool keine Bedeutung.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
defaultValue erfordert script.
Attribute: defaultValue, script
Warum: Der Fallback wird nur ausgewertet, wenn der Skriptwert fehlt oder seine condition die Variable unterdrückt.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Optionen zur Quellenauswahl erfordern source.
Attribute: source, selector, separator, sourceScripted, cyclic
Warum: Optionen zum Parsen und Auswählen besitzen ohne Quellenzugriff keine Bedeutung.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Generator- und Entity-Optionen erfordern generator oder entity.
Attribute: generator, entity, locale, dataset, rngSeed
Warum: Locale, Dataset, Alter, Conditions und RNG konfigurieren einen komponenteneigenen Wert.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
storage darf nicht mit sourceScripted kombiniert werden.
Attribute: storage, sourceScripted
Warum: Eine skriptgesteuerte Quelle stellt keinen stabilen materialisierbaren Pool bereit.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
storage darf nicht mit converter kombiniert werden.
Attribute: storage, converter
Warum: Ein materialisierter Listen- oder Proxywert besitzt keine Konvertierungsgrenze pro Datensatz.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
storage kann keine gewichtete Entity-Quelle materialisieren.
Attribute: storage, source
Warum: Gewichtete Auswahl verbraucht Quellmetadaten, die ein gespeicherter Proxy nicht korrekt bewahren kann.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
unique erfordert values oder source.
Attribute: unique, values, source
Warum: Eine Stichprobe ohne Zurücklegen benötigt einen endlichen Pool.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
unique lässt sich nur mit distribution='random' kombinieren.
Attribute: unique, distribution
Warum: Geordnete oder gewichtete Auswahl widerspricht einer gleichverteilten Stichprobe ohne Zurücklegen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
unique darf nicht mit weights kombiniert werden.
Attribute: unique, weights
Warum: Unique-Auswahl ist gleichverteilt ohne Zurücklegen; Gewichte beschreiben verzerrte wiederholte Ziehungen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
cyclic erfordert eine wiederholungskompatible Distribution.
Attribute: cyclic, distribution
Warum: Gewichtete und stratifizierte Vollpool-Ziehungen besitzen keine Neustartgrenze.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
distribution='weighted' erfordert weightColumn.
Attribute: distribution, weightColumn
Warum: Die Auswahl benötigt eine numerische Quellspalte zur Berechnung der Wahrscheinlichkeiten.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
distribution='stratified' erfordert stratifyBy.
Attribute: distribution, stratifyBy
Warum: Die Auswahl benötigt eine Quellspalte, die jedes Stratum identifiziert.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Inline-values akzeptieren nur von dieser Oberfläche unterstützte Distributionen.
Attribute: values, source, distribution
Warum: Vollquellen-Policies benötigen Zeilenmetadaten, die ein skalarer Inline-Pool nicht bereitstellt.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Eine semantische Projektdatei-Quelle erfordert ihre katalogisierte Distribution.
Attribute: source, distribution
Warum: Der Suffix deklariert Auswahlsemantik, die eine widersprechende explizite Distribution nicht überschreiben darf.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
I192 — Source Reference Identifier Empty
Explicit source URI for family '{family}' requires a non-empty identifier
Warum: A recognized source-family URI was declared without the identifier needed to resolve its source.
Lösung: Add the source identifier after the URI scheme and retry.
I193 — Source Reference Consumer Unsupported
Explicit source family '{family}' is not supported by <{consumer}>
Warum: The source family is valid, but the consuming DSL element does not implement its read contract.
Lösung: Use a source family supported by this element or move the read to generate/iterate.
I194 — Source Reference Client Family Mismatch
Explicit source family '{family}' does not match configured client '{client_id}' of type '{actual_client_type}'
Warum: The referenced client exists but does not implement the source family declared by the URI.
Lösung: Use the URI scheme matching the configured client or reference a client of the declared family.
I195 — Source Reference Identifier Conflict
Explicit source identifier '{identifier}' conflicts with {attribute}='{configured_identifier}'
Warum: Two source attributes select different identities for the same explicit source reference.
Lösung: Remove the legacy override or make it equal to the identifier in source.
Erlaubte Elternelemente / Erlaubte Kindelemente¶
Erlaubte Elternelemente: ama-generate, else, else-if, generate, if, iterate, nestedKey, setup, while
Erlaubte Kindelemente:
Keine
Zugehörige Konzepte und Anwendungsfälle¶
- Ausdrucksauswertung und Lebensdauer — Explains the different evaluation lifetimes of literal values, cached expressions, and dynamic expressions so descriptor authors do not accidentally move runtime state into setup-time attributes.
- Variablen-Scope in verschachtelten Generates — Prevents accidental ancestor reads and shadowing, and routes memstore reads through the public Scripting API.
- Erstes DATAMIMIC-Modell — Builds the smallest model and then composes preparation and generation stages.
- Modelle von DATAMIMIC 3.5 auf 4.0 umstellen — Helps existing 3.5 users identify affected models, understand the reasons for 4.0 changes, and migrate syntax and expected results without confusing retained compatibility with breakage.
- Benerator-Modelle nach DATAMIMIC migrieren — Maps Benerator concepts to the current generated grammar without freezing another support matrix.
- Scripting-API in einem Modell verwenden — Shows all read-only scripting helpers together at their real expression-evaluation boundary.
- Skriptbasierte Source-Templates — Explains typed full-value source expressions, embedded string substitution, and the boundary between sourceScripted templates and field or generate scripts.
- Ein komplexes deterministisches Modell zusammensetzen — Provides the requirement-to-model sequence for products, field dependencies, relationships, targets, and acceptance evidence.
Attribute¶
Alle 39 Attribute anzeigen
ageMax
Maximum age when generating entity data.
optional; integer; Standardwert: null.
ageMin
Minimum age when generating entity data.
optional; integer; Standardwert: null.
condition
Condition for including the variable value.
optional; string; Standardwert: null.
conditionsExclude
Conditions that must be excluded during generation.
optional; string; Standardwert: null.
conditionsInclude
Conditions that must be included during generation.
optional; string; Standardwert: null.
constant
Constant value for variable data.
optional; string; Standardwert: null.
converter
Converter for variable data transformation.
optional; string; Standardwert: null.
cyclic
Enable or disable cyclic generation for variables.
optional; boolean; Standardwert: null.
database
Database client id when source equals 'database'.
optional; string; Standardwert: null.
dataset
Dataset for variable data.
optional; string; Standardwert: null.
defaultValue
Default value for the variable.
optional; string; Standardwert: null.
distribution
Distribution type for data generation.
optional; string; Standardwert: null; Werte: ordered, random, weighted, stratified, round_robin, reservoir, cumulated.
entity
Entity type for the variable.
optional; string; Standardwert: null.
generator
Generator for variable data.
optional; string; Standardwert: null.
inDateFormat
Input date format for variable data.
optional; string; Standardwert: null.
iterationSelector
Selector for iteration of variable data.
optional; string; Standardwert: null.
locale
Locale for variable data.
optional; string; Standardwert: null.
name
Name of the variable.
erforderlich; string.
outDateFormat
Output date format for variable data.
optional; string; Standardwert: null.
paged
Enable paged DB variable behavior for selectors.
optional; boolean; Standardwert: null.
pattern
Pattern for variable data generation.
optional; string; Standardwert: null.
rngSeed
Deterministic RNG seed for this variable.
optional; integer; Standardwert: null.
script
Script for variable data generation.
optional; string; Standardwert: null.
selector
Selector for variable data generation.
optional; string; Standardwert: null.
separator
Separator for variable data.
optional; string; Standardwert: null.
source
Literal project-file, memstore, database, or Mongo source; expressions remain lazy.
optional; string; Standardwert: null.
sourceClient
Override the client used to load variable data.
optional; string; Standardwert: null.
sourceEntity
Explicit physical entity to read (table/collection/product).
optional; string; Standardwert: null.
sourceScripted
Enable or disable scripted sources.
optional; boolean; Standardwert: null.
storage
Variable storage strategy.
optional; string; Standardwert: null; Werte: value, data, iterator.
stratifyBy
Stratum column for distribution='stratified' source selection.
optional; string; Standardwert: null.
string
String for the variable data generation.
optional; string; Standardwert: null.
type
Data type of the variable.
optional; string; Standardwert: null; Werte: string, int, integer, float, bool, binary.
unique
Emit each value at most once (distinct picks from values, no replacement).
optional; boolean; Standardwert: null.
values
Comma-separated list of values for the variable.
optional; string; Standardwert: null.
variablePrefix
Prefix before field's name for query select data in selector element
optional; string; Standardwert: null.
variableSuffix
Suffix after field's name for query select data in selector element
optional; string; Standardwert: null.
weightColumn
Weight column for variable data generation; required for a .wgt.ent.csv source.
optional; string; Standardwert: null.
weights
Comma-separated relative weights, one per values entry, for weighted random selection.
optional; string; Standardwert: null.