Preview a mapping rule
const url = 'https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/semantic-correspondences/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rules/preview';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"derivedElementId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","rule":{"type":"ElementMappingRule","id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","name":"example","description":"example","nestedRules":[{"type":"ElementMappingRule","targetType":"example","targetTraits":["example"],"sourcePath":"example","sourceElementIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"root":false,"targetOwnedRelation":"example","originModelId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}],"targetOwnerId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","targetType":"example","targetTraits":["example"],"sourcePath":"example","sourceElementIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"root":false,"targetOwnedRelation":"example","originModelId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"},"nestedDerivedElementIds":{"additionalProperty":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/semantic-correspondences/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rules/preview \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "derivedElementId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "rule": { "type": "ElementMappingRule", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "description": "example", "nestedRules": [ { "type": "ElementMappingRule", "targetType": "example", "targetTraits": [ "example" ], "sourcePath": "example", "sourceElementIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "root": false, "targetOwnedRelation": "example", "originModelId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ], "targetOwnerId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "targetType": "example", "targetTraits": [ "example" ], "sourcePath": "example", "sourceElementIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "root": false, "targetOwnedRelation": "example", "originModelId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }, "nestedDerivedElementIds": { "additionalProperty": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } }'Preview what a correspondence-owned mapping rule would record, without persisting anything. Returns the base elements the rule matches — one materialized link per match on save — and how reversible its value mappings are. The rule runs against the correspondence’s base model, which grants the source: unlike origin-mapping rules it needs no configured origin.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”A mapping rule owned by a correspondence, describing how one derived element is derived from the correspondence’s base model. Authored in the canonical downward direction (base to derived): the base model is the source, this model the target.
object
The element the rule derives, fixed for the rule’s lifetime. The rule selects which base elements it is derived from.
The rule. Its originModelId is set from the owning correspondence’s base model, so a client-supplied value is ignored. An element rule nested in it, at any depth, explains a derived element of its own, named in nestedDerivedElementIds, and saving records its links the same way, stamped with the nested rule’s id.
object
The type of mapping rule (discriminator for polymorphism).
Unique identifier for this rule. Can be client-provided or server-generated.
The rule’s name, where it has one. A stored mapping names its rules; a rule it writes without one is stored under what it produces.
The author’s note on this rule. Stored as the rule element’s description; a blank note is stored as no note, so saving a rule with the text cleared leaves it without one.
Nested mapping rules owned by this rule. Order matters - rules are executed in list order.
A mapping rule, discriminated by its own type.
object
The type of mapping rule (discriminator for polymorphism).
Unique identifier for this rule. Can be client-provided or server-generated.
The rule’s name, where it has one. A stored mapping names its rules; a rule it writes without one is stored under what it produces.
The author’s note on this rule. Stored as the rule element’s description; a blank note is stored as no note, so saving a rule with the text cleared leaves it without one.
Optional reference to an existing element to attach this rule’s output to.
The target element type to create for each matched source element.
The traits each created element carries beside targetType. Where an owned relation holds the element, the relation decides its form: its default trait is added where the element carries no member of the default’s exclusive group, and replaces a member the relation refuses. Absent when the rule names none.
Path expression to select source elements. Mutually exclusive with sourceElementIds.
Explicit source element IDs to map. Mutually exclusive with sourcePath.
Whether the mapped elements are root elements in the target model.
Target owned relation name for nested element mappings. Required when nested under another element mapping.
Reference to the origin model from which source elements are selected.
object
The type of mapping rule (discriminator for polymorphism).
Unique identifier for this rule. Can be client-provided or server-generated.
The rule’s name, where it has one. A stored mapping names its rules; a rule it writes without one is stored under what it produces.
The author’s note on this rule. Stored as the rule element’s description; a blank note is stored as no note, so saving a rule with the text cleared leaves it without one.
Optional reference to an existing element to attach this rule’s output to.
The target attribute name on the parent element’s target type.
Optional path expression to navigate from the parent’s source context.
Value mapping for the right side of the join (typically from target element).
object
Path expression to navigate to target elements.
Attribute options to extract value from (tries each in order until one has a value).
object
The template expression string.
Variable bindings for the template. Keys are variable names referenced in the expression.
object
Default value if no value is found.
Value transformers to apply in order.
object
The type of value mapper (e.g., “lowercase”, “uppercase”, “replace”).
Optional configuration options for the mapper.
object
A rule that writes a relation on the elements its parent rule generates. The target elements come from exactly one source, which is why targetElementMappingId, selectElement and targetQuery are mutually exclusive and at least one of those three, joinOn or sourcePath must be present. A bare sourcePath names no target of its own: each element it reaches is answered by whatever already corresponds to it in the model being produced.
object
The type of mapping rule (discriminator for polymorphism).
Unique identifier for this rule. Can be client-provided or server-generated.
The rule’s name, where it has one. A stored mapping names its rules; a rule it writes without one is stored under what it produces.
The author’s note on this rule. Stored as the rule element’s description; a blank note is stored as no note, so saving a rule with the text cleared leaves it without one.
Optional reference to an existing element to attach this rule’s output to.
The target relation name on the parent element’s target type.
Optional path expression to navigate from the parent’s source context.
Reference to the element mapping that produces the target elements for this relation.
Selects the relation’s target directly, by naming one element of the target model or one of its dependencies.
object
The selected element.
Optional element-filter expression narrowing when the selection applies, evaluated against the source element the relation is written for.
object
Value mapping for the right side of the join (typically from target element).
object
Path expression to navigate to target elements.
Attribute options to extract value from (tries each in order until one has a value).
object
The template expression string.
Variable bindings for the template. Keys are variable names referenced in the expression.
object
Default value if no value is found.
Value transformers to apply in order.
object
The type of value mapper (e.g., “lowercase”, “uppercase”, “replace”).
Optional configuration options for the mapper.
object
Value mapping for the right side of the join (typically from target element).
object
Path expression to navigate to target elements.
Attribute options to extract value from (tries each in order until one has a value).
object
The template expression string.
Variable bindings for the template. Keys are variable names referenced in the expression.
object
Default value if no value is found.
Value transformers to apply in order.
object
The type of value mapper (e.g., “lowercase”, “uppercase”, “replace”).
Optional configuration options for the mapper.
object
A Core DSL match query selecting the relation’s candidates from the run’s target scope, compiled against the target metamodel (match $c isa Class). joinOn picks which candidate a source element relates to. Read before every other target reference; a blank query counts as absent.
Whether a source element whose join matches none of the targetQuery candidates gets an external element generated for it, carrying the joined value as its key. When false, a join matching nothing fails the run. Refused without a targetQuery.
Whether the rule runs only for the source elements the rules before it on the same relation, under the same parent rule, resolved no target for. Several rules on one relation are the routes of one end, tried in their stored order. When false, the rule runs for every source element. A rule carrying it with no rule on its relation before it is refused on save and at run start. A targetQuery rule that a marked rule follows hands a source element it finds nothing for on to that rule instead of refusing it.
Optional reference to an existing element to attach this rule’s output to.
The target element type to create for each matched source element.
The traits each created element carries beside targetType. Where an owned relation holds the element, the relation decides its form: its default trait is added where the element carries no member of the default’s exclusive group, and replaces a member the relation refuses. Absent when the rule names none.
Path expression to select source elements. Mutually exclusive with sourceElementIds.
Explicit source element IDs to map. Mutually exclusive with sourcePath.
Whether the mapped elements are root elements in the target model.
Target owned relation name for nested element mappings. Required when nested under another element mapping.
Reference to the origin model from which source elements are selected.
The derived element each element rule nested in the rule explains, keyed by the nested rule’s id. A save refuses a nested element rule without an id or an entry here, an entry naming no nested rule of the tree, and a derived element the enclosing rule’s derived element does not hold. Not stored on the rule: the links a save records carry the rule’s id and the derived element, so the map is rebuilt from them.
object
Responses
Section titled “Responses”OK
What a correspondence-owned rule would record, computed without persisting anything.
object
The base elements the rule matches; one link per entry is materialized on save.
What the rule would write for each match, in baseElementIds order. Shorter than baseElementIds where a match generated no element of its own, so pair the two by baseElementId rather than by position.
What a correspondence rule would write for one base element it matched, taken from the element the read-only run generated and discarded. What the rule’s attribute mappings produced, not what they declare.
object
The base element the rule matched, and whose match produced these values.
The values the rule’s attribute mappings wrote, keyed by the targetAttribute each mapping was authored with. An attribute whose mapping found nothing on this base element is absent rather than present and empty.
object
How well a rule could be run backwards — lifting derived values back to the base values they came from. Recorded while authoring; nothing executes on it yet.
object
The weakest finding; the rule as a whole is no better than this.
object
The attribute rule whose value mapping this classifies. One rule can write a target attribute through several attribute rules, so the attribute alone does not say which one a finding is about.
REVERSIBLE — the derived value determines the base value on its own. REVERSIBLE_WITH_IDENTITY_STORE — it determines it only together with the stored links, which resolve which base element the value came from. REVERSIBLE_WITH_PROVENANCE — it does not determine the base value, but every value that fed it is recorded per run, so reversing it is a lookup of those inputs rather than an attempt to undo the computation. CONDITIONALLY_REVERSIBLE — it determines the base value only while an assumption about the data holds. No classifier arm answers this today, because a step that reads the base records what it read; it remains for content no run recorded. NOT_REVERSIBLE — nothing to reverse to, or nothing recorded to look up: a value the base model never held, or a query in a language whose value projection cannot run.
Why it classifies that way, phrased for the authoring UI.
What a reader without this record has to take on trust, composed from the query the author wrote — “If voornaam or achternaam contains a space, this value cannot be split back into its parts.” Independent of the grade: the grade says whether the derivation can be reversed here, which for anything a run records is yes, while this says what the same value costs someone holding only the value. Absent when it costs them nothing, which is most findings, and always absent on a NOT_REVERSIBLE finding — nothing was recorded there, so there is no record for a reader to be holding the value without. Render it verbatim rather than deriving your own wording.
What each element rule nested in the rule, at any depth, selected, in the order the tree holds them. Empty when the rule nests none. A nested rule without an id is left out. Saving records one link per entry’s base element.
What one nested element rule selected, across every match of the rule enclosing it.
object
The nested rule.
The derived element the request names for the nested rule, or null where it names none. A save refuses a nested rule without one; a preview still answers what it selects.
The base elements the nested rule selected, distinct, in the order the run reached them. Saving records one link each.
Example
{ "reversibility": { "overall": "REVERSIBLE", "findings": [ { "reversibility": "REVERSIBLE" } ] }}Bad request
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}Not found
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}default
Section titled “default”Error
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}