Element <key>¶
Zweck: Definiert ein generiertes, kopiertes, konvertiertes oder skriptbasiertes Produktfeld.
Warum: Verwende dieses Element für ein benanntes Feld, wenn es nicht ausdrücklich die Datensatzidentität darstellt.
Beispiel¶
1 | |
Entscheidungshilfe¶
Fachlicher Nutzen: Definiert ein sichtbares Produktfeld und hält dessen Erzeugungs- oder Transformationsregel prüfbar.
-
Verwenden, wenn
- Beim Hinzufügen eines skalaren Feldes zum Ausgabedatensatz.
-
Anderen Ansatz wählen, wenn
- Wenn der Wert nur ein Zwischen-Binding ist oder die Datensatzidentität darstellt.
-
Voraussetzungen
- Platziere key in einem felderzeugenden Elternelement und wähle genau eine kompatible Wertstrategie.
-
Alternativen
- Verwende id für die stabile Produktidentität. (Siehe:
<id>) - Verwende variable für nicht exportierte Zwischenwerte. (Siehe:
<variable>) - Verwende nestedKey für strukturierte Objekte oder wiederholte Datensätze. (Siehe:
<nestedKey>)
- Verwende id für die stabile Produktidentität. (Siehe:
Vollständige Beispiele¶
Explizite Strategien zur Felderzeugung wählen
Verwende Konstanten, Generatoren, Skripte, Pattern oder native numerische Bereiche entsprechend der fachlichen Herkunft des Feldwerts.
| key-generation-strategies/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 8 9 | |
Nullwerte, Bedingungen und Fallbacks steuern
Verwende nullQuota für wahrscheinliche Abwesenheit und defaultValue ausschließlich als Fallback eines skriptbasierten Feldes.
| key-null-condition-fallback/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 | |
Einen rohen Zeitwert bis zur finalen Formatierung erhalten
Führe Zeitarithmetik auf einer unformatierten Variable aus und wende outDateFormat erst auf exportierte Keys an.
| key-datetime-arithmetic/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 | |
Gewichtete oder eindeutige Inline-Werte auswählen
Verwende weights für gewichtetes Ziehen mit Zurücklegen und unique für eindeutiges Ziehen ohne Zurücklegen; kombiniere beides nie auf demselben key.
| key-weighted-and-unique/datamimic.xml | |
|---|---|
1 2 3 4 5 6 | |
Regeln und ungültige Kombinationen¶
Ein Feld benötigt genau einen Modus zur Werterzeugung.
Attribute: type, source, values, script, generator, constant, pattern, string
Warum: Ein Feld ohne Typ, Quelle, Wertepool, Skript, Generator, Konstante, Pattern oder String-Template kann keinen Wert erzeugen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Wähle genau einen expliziten Erzeugungsmodus für das Feld.
Attribute: source, values, script, generator, constant, pattern, string
Warum: Die Kombination mehrerer Wertquellen würde die Herkunft des Feldwerts mehrdeutig machen.
| 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 | |
unique erfordert einen Inline-Pool in values.
Attribute: unique, values
Warum: Feldeindeutigkeit zieht ohne Zurücklegen aus expliziten Werten; Generatoren stellen hier keinen endlichen Pool bereit.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
unique darf nicht mit weights kombiniert werden.
Attribute: unique, weights
Warum: Unique-Auswahl zieht gleichverteilt ohne Zurücklegen; Gewichte beschreiben verzerrte Ziehungen mit Zurücklegen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Optionen zum Quellenlesen erfordern source.
Attribute: source, selector, separator
Warum: selector, separator und weitere Quellenoptionen verändern ausschließlich einen Quellenzugriff.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Eine Feld-distribution erfordert einen int- oder float-Wertebereich.
Attribute: distribution, type, min, max
Warum: Die Distribution auf Feldebene formt ein numerisches Raster und ist nicht die Verteilung von Quelldatensätzen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
outDateFormat erzeugt einen String und lehnt einen anderen type ab.
Attribute: outDateFormat, type
Warum: Formatierung ist der letzte Darstellungsschritt; nachgelagerte Ausdrücke erhalten nicht mehr den rohen Zeitwert.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Die Granularität eines Integer-Felds muss ganzzahlig sein.
Attribute: type, granularity
Warum: Ein Bruchschritt kann ohne stille Kürzung kein Integer-Raster erzeugen.
| 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 Erzeugung unterdrückt.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
nullQuota muss zwischen 0 und 1 liegen.
Attribute: nullQuota
Warum: Der Wert ist eine Wahrscheinlichkeit: 0 erzeugt nie null, 1 erzeugt immer null.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Erlaubte Elternelemente / Erlaubte Kindelemente¶
Erlaubte Elternelemente: else, else-if, generate, if, item, iterate, nestedKey, while
Erlaubte Kindelemente:
element
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.
- Daten-De-Identifizierung — Distinguishes de-identification outcomes from masking, generalization, pseudonymization, and anonymization, then proves the current converter behavior with an executable source project.
- Erstes DATAMIMIC-Modell — Builds the smallest model and then composes preparation and generation stages.
- Benerator-Modelle nach DATAMIMIC migrieren — Maps Benerator concepts to the current generated grammar without freezing another support matrix.
- Werte aus regulären Ausdrücken erzeugen — Shows bounded structural patterns and explains why regex shape is not domain validation.
- Datum und Uhrzeit erzeugen — Explains deterministic windows, weighted selection, offsets, and epoch output.
- Datenbankgestützte Sequenzen erzeugen — Explains bounded database sequence reservation and its single-process policy.
- Eigene Generatoren und Converter — Shows the trusted-code boundary and loader-provided base classes for project-local generators and converters without exposing internal import paths.
- Scripting-API in einem Modell verwenden — Shows all read-only scripting helpers together at their real expression-evaluation boundary.
- Strukturierte Daten und Regel-Pipelines — Shows how composite output shapes and the ordered source-filter, mapping, and target-filter pipeline work together without hiding phase boundaries.
- 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 29 Attribute anzeigen
condition
Condition for key data generation.
optional; string; Standardwert: null.
constant
Constant value for key data.
optional; string; Standardwert: null.
converter
Converter for key data transformation.
optional; string; Standardwert: null.
database
Database client id when source equals 'database'.
optional; string; Standardwert: null.
defaultValue
Default value for the key.
optional; string; Standardwert: null.
distribution
Sampling distribution / sequence for ranged numeric key.
optional; string; Standardwert: null; Werte: uniform, cumulated, step, increment, randomWalk, shuffle, wedge, bitreverse, fibonacci, padovan.
generator
Predefined generators for key data generation.
optional; string; Standardwert: null.
granularity
Step width of numeric grid; defaults 1 for int, 0.1 for float. On int, must be whole.
optional; string; Standardwert: null.
inDateFormat
Input date format for key data.
optional; string; Standardwert: null.
max
Maximum value for numerical generator.
optional; number; Standardwert: null.
maxLength
Maximum length for binary payload generation.
optional; integer; Standardwert: null.
mimeType
Optional MIME signature for binary payload generation.
optional; string; Standardwert: null.
min
Minimum value for numerical generator.
optional; number; Standardwert: null.
minLength
Minimum length for binary payload generation.
optional; integer; Standardwert: null.
name
Name of the key.
erforderlich; string.
nullQuota
Null quota for key data generation.
optional; number; Standardwert: null.
outDateFormat
Output date format for key data.
optional; string; Standardwert: null.
pattern
Pattern for key data generation.
optional; string; Standardwert: null.
script
Script for key data generation.
optional; string; Standardwert: null.
selector
Selector for key data generation.
optional; string; Standardwert: null.
separator
Separator for key data.
optional; string; Standardwert: null.
source
Source of data for the key.
optional; string; Standardwert: null.
string
String for the variable data generation.
optional; string; Standardwert: null.
type
Data type of the key.
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 key.
optional; string; Standardwert: null.
variablePrefix
Prefix before field's name for string in key generation.
optional; string; Standardwert: null.
variableSuffix
Suffix after field's name for string in key generation.
optional; string; Standardwert: null.
weights
Comma-separated relative weights, one per values entry, for weighted random selection.
optional; string; Standardwert: null.