@uipath/skills 1.207.0-preview.2139 → 1.207.0-preview.2143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CODEOWNERS +8 -0
  2. package/README.md +1 -0
  3. package/assets/skill-status.json +8 -0
  4. package/assets/uip-catalog-snapshot.json +13 -0
  5. package/package.json +1 -1
  6. package/skills/uipath-ontology/SKILL.md +316 -0
  7. package/skills/uipath-ontology/references/artifacts-guide.md +53 -0
  8. package/skills/uipath-ontology/references/document-guide.md +128 -0
  9. package/skills/uipath-ontology/references/entity-guide.md +162 -0
  10. package/skills/uipath-ontology/references/errors-guide.md +70 -0
  11. package/skills/uipath-ontology/references/mapping-yarrrml-guide.md +260 -0
  12. package/skills/uipath-ontology/references/owl-patterns-guide.md +377 -0
  13. package/skills/uipath-ontology/references/relationships-guide.md +97 -0
  14. package/skills/uipath-ontology/references/shacl-patterns-guide.md +220 -0
  15. package/skills/uipath-ontology/references/summary-context-guide.md +61 -0
  16. package/skills/uipath-planner/SKILL.md +2 -2
  17. package/skills/uipath-planner/references/shared/skill-mapping-guide.md +1 -0
  18. package/skills/uipath-planner/scripts/check-genome.mjs +1 -0
  19. package/skills/uipath-platform/SKILL.md +2 -1
  20. package/skills/uipath-platform/references/orchestrator/end-to-end-readiness-guide.md +68 -0
  21. package/skills/uipath-platform/references/orchestrator/manage-sessions.md +3 -3
  22. package/skills/uipath-platform/references/orchestrator/run-jobs.md +1 -1
  23. package/skills/uipath-platform/references/orchestrator/triggers-and-webhooks.md +1 -1
  24. package/skills/uipath-rpa/references/cli-reference.md +2 -0
  25. package/skills/uipath-solution/SKILL.md +1 -1
  26. package/skills/uipath-solution/references/develop-solution.md +4 -2
  27. package/skills/uipath-solution/references/pack-and-deploy.md +4 -0
  28. package/skills/uipath-solution/references/scenarios/local-entity-file-field.md +30 -0
  29. package/skills/uipath-solution/references/scenarios/ontology-solution.md +37 -0
  30. package/skills/uipath-solution/references/scenarios.md +4 -0
  31. package/version-manifest.json +1 -1
@@ -0,0 +1,377 @@
1
+ # OWL Functional Syntax — Patterns Reference
2
+
3
+ IRI convention used throughout: `https://ontology.uipath.com/{name}#`
4
+
5
+ **`{name}` is the exact ontology name slug (the Ontology resource name in the local solution) — verbatim, no transformation. Derive it once before generating any files and use the same value in every artifact file (schema, constraints, mapping, summary, context). A mismatch across files disconnects ontology terms.**
6
+
7
+ ---
8
+
9
+ ## File Header
10
+
11
+ ```text
12
+ Prefix(:=<https://ontology.uipath.com/{name}#>)
13
+ Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
14
+ Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
15
+ Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
16
+ Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
17
+ Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
18
+
19
+ Ontology(<https://ontology.uipath.com/{name}>
20
+
21
+ ... all declarations and axioms ...
22
+
23
+ )
24
+ ```
25
+
26
+ > **`skos:` prefix** — add `Prefix(skos:=<http://www.w3.org/2004/02/skos/core#>)` only when at least one class or property has a synonym (`skos:altLabel`). Omit it otherwise.
27
+ >
28
+ > **No ontology-level annotations** — do not put `Annotation(rdfs:label ...)` or `Annotation(rdfs:comment ...)` directly inside `Ontology(...)`. The real platform artifacts omit them. Use `AnnotationAssertion(rdfs:label :X ...)` and `AnnotationAssertion(rdfs:comment :X ...)` per class and property in the sections below.
29
+
30
+ ---
31
+
32
+ ## rdfs:label and rdfs:comment — required on every class and every property
33
+
34
+ `rdfs:label` and `rdfs:comment` are mandatory on every declared class, data property, and object property. They are not optional metadata — without them, the AI agent that reads this ontology cannot answer questions about value domains, grain, cardinality, or join columns.
35
+
36
+ | Element | rdfs:label | rdfs:comment |
37
+ |---|---|---|
38
+ | Every `Declaration(Class(:X))` | Required — human name of the class | Required — grain statement first: `"ONE row per {business thing}…"` |
39
+ | Every `Declaration(DataProperty(:X))` | Required — human name of the property | Required — pick the matching fact type form (see Data Property Block below) |
40
+ | Every `Declaration(ObjectProperty(:X))` | Required — human verb phrase | Required — business sentence + join columns + cardinality note if "exactly one" |
41
+
42
+ ---
43
+
44
+ ## OWL 2 QL profile — what is and isn't legal
45
+
46
+ A syntax check alone does not catch these — forbidden constructs parse cleanly but fail any QL reasoner. `uip ont validate --local` (rule `XF-005`) rejects them; fix every violation before packing.
47
+
48
+ **QL-legal object property axioms — confirmed by example artifacts, use freely:**
49
+ - `InverseObjectProperties(:a :b)` — marks two properties as semantic inverses. Only one of the pair gets a mapping join; see the join rule below
50
+ - `SubObjectPropertyOf(:child :parent)` — declares a sub-property hierarchy (e.g. `billedTo ⊑ relatedCustomer`). Each of the two still needs its own mapping join
51
+
52
+ **Forbidden — never write these:**
53
+ - `ObjectExactCardinality` / `DataExactCardinality`
54
+ - `ObjectMinCardinality` / `ObjectMaxCardinality` / `DataMinCardinality` / `DataMaxCardinality`
55
+ - `ObjectAllValuesFrom` / `DataAllValuesFrom`
56
+ - `ObjectHasValue` / `DataHasValue`
57
+ - `ObjectOneOf` / `DataOneOf`
58
+ - `ObjectUnionOf` / `DataUnionOf`
59
+ - `ObjectHasSelf`
60
+ - `FunctionalObjectProperty` / `FunctionalDataProperty` / `InverseFunctionalObjectProperty`
61
+ - `TransitiveObjectProperty`
62
+ - `HasKey`
63
+ - Negative assertions
64
+
65
+ **Express cardinality constraints in annotation text instead:**
66
+ ```text
67
+ AnnotationAssertion(rdfs:comment :placedBy "Each sales order is placed by exactly one customer. 'Exactly one' is QL-inexpressible as an axiom; recorded here.")
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Ordering inside Ontology(...)
73
+
74
+ Follow the structure of the real artifact files:
75
+
76
+ 1. `Declaration(AnnotationProperty(:domain))`, then all `Declaration(Class(...))` statements — grouped at the top
77
+ 2. All `Declaration(ObjectProperty(...))` statements
78
+ 3. All `Declaration(DataProperty(...))` statements
79
+ 4. **`#### Object Properties ####`** section — for each: `AnnotationAssertion(rdfs:label)`, `AnnotationAssertion(rdfs:comment)`, domain, range, then `InverseObjectProperties` / `SubObjectPropertyOf` if applicable
80
+ 5. **`#### Data Properties ####`** section — for each: `AnnotationAssertion(rdfs:label)`, `AnnotationAssertion(rdfs:comment)`, domain, range
81
+ 6. **`#### Classes ####`** section — per class: `AnnotationAssertion(:domain)`, `AnnotationAssertion(rdfs:label)`, `AnnotationAssertion(rdfs:comment)` (grain first), then `skos:altLabel` synonyms if any
82
+ 7. `SubClassOf(...)` restriction axioms last (existential and inheritance only)
83
+
84
+ ---
85
+
86
+ ## Declaration block (top of file)
87
+
88
+ All declarations go first before any axioms:
89
+
90
+ ```text
91
+ Declaration(AnnotationProperty(:domain))
92
+ Declaration(Class(:Customer))
93
+ Declaration(Class(:SalesOrder))
94
+ Declaration(ObjectProperty(:placedBy))
95
+ Declaration(ObjectProperty(:places))
96
+ Declaration(DataProperty(:Customer.customerName))
97
+ Declaration(DataProperty(:SalesOrder.orderId))
98
+ Declaration(DataProperty(:SalesOrder.status))
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Object Property Block
104
+
105
+ ```text
106
+ ############################
107
+ # Object Properties
108
+ ############################
109
+
110
+ # Object Property: <https://ontology.uipath.com/{name}#{verbPhrase}> ({Human Label})
111
+
112
+ AnnotationAssertion(rdfs:label :{verbPhrase} "{verb phrase}")
113
+ AnnotationAssertion(rdfs:comment :{verbPhrase} "Each {FromClass} {verb phrase} {ToClass}. Join: {FromClass}.{relationshipField} = {ToClass}.Id.")
114
+ ObjectPropertyDomain(:{verbPhrase} :{FromClass})
115
+ ObjectPropertyRange(:{verbPhrase} :{ToClass})
116
+ ```
117
+
118
+ When the relationship is "exactly one", append the cardinality note to the comment:
119
+ ```text
120
+ AnnotationAssertion(rdfs:comment :placedBy "Each SalesOrder is placed by one Customer. Join: SalesOrder.customer = Customer.Id. 'Exactly one' is QL-inexpressible; recorded here.")
121
+ ```
122
+
123
+ **Join rule.** Every object property between two mapped classes needs its own join in the mapping, on plain columns (`XF-015`). The one exception is a property declared `InverseObjectProperties` of a property that already has a join: the inverse is answered from that join and gets none. Sub-properties are not exempt; `billedTo` and `relatedCustomer` each need a join. See [Inverse properties](#inverse-properties).
124
+
125
+ **Sub-property** — when one relationship is a specialisation of another:
126
+ ```text
127
+ AnnotationAssertion(rdfs:label :billedTo "Billed to")
128
+ AnnotationAssertion(rdfs:comment :billedTo "Specialisation of :relatedCustomer. The customer the order is billed to. Join: SalesOrder.billTo = Customer.Id.")
129
+ SubObjectPropertyOf(:billedTo :relatedCustomer)
130
+ ObjectPropertyDomain(:billedTo :SalesOrder)
131
+ ObjectPropertyRange(:billedTo :Customer)
132
+ ```
133
+
134
+ - Name with a verb: `placedBy`, `belongsToCategory`, `lineOfOrder`
135
+ - Standard `rdfs:comment` form: business sentence + join columns + cardinality note if "exactly one"
136
+ - Inverse `rdfs:comment` form: `"Inverse of :{primaryProp}. {One-line meaning.}"` (no join of its own)
137
+ - Sub-property `rdfs:comment` form: `"Specialisation of :{parentProp}. {One-line meaning.}"`
138
+
139
+ ---
140
+
141
+ ## Inverse properties
142
+
143
+ A relationship has one `RELATIONSHIP` field, on the referencing entity (`SalesOrder.customer`). Its inverse exists only in the schema, as `InverseObjectProperties`. The inverse has no field on the other entity, no mapping join and no shape of its own.
144
+
145
+ ```text
146
+ Declaration(ObjectProperty(:places))
147
+
148
+ AnnotationAssertion(rdfs:label :places "Places")
149
+ AnnotationAssertion(rdfs:comment :places "Inverse of :placedBy. A customer places sales orders. No join of its own; answered from placedBy (SalesOrder.customer = Customer.Id).")
150
+ InverseObjectProperties(:places :placedBy)
151
+ ObjectPropertyDomain(:places :Customer)
152
+ ObjectPropertyRange(:places :SalesOrder)
153
+ ```
154
+
155
+ - Join only `placedBy`, the side whose entity holds the field. `places` gets none.
156
+ - Never add a second field on `Customer` for the inverse. When a user describes the relationship from both sides ("customers have orders, each order has a customer"), it is still one field on `SalesOrder`.
157
+ - Comment form: `"Inverse of :{primaryProp}. {One-line meaning.}"`.
158
+
159
+ ---
160
+
161
+ ## Data Property Block
162
+
163
+ **Naming rule: `{ClassName}.{propName}` — never `has{PropName}`.**
164
+
165
+ ```text
166
+ ############################
167
+ # Data Properties
168
+ ############################
169
+
170
+ # Data Property: <https://ontology.uipath.com/{name}#{ClassName}.{propName}> ({Human Label})
171
+
172
+ AnnotationAssertion(rdfs:label :{ClassName}.{propName} "{human label}")
173
+ AnnotationAssertion(rdfs:comment :{ClassName}.{propName} "{See comment forms below.}")
174
+ AnnotationAssertion(skos:altLabel :{ClassName}.{propName} "{synonym}")
175
+ DataPropertyDomain(:{ClassName}.{propName} :{ClassName})
176
+ DataPropertyRange(:{ClassName}.{propName} xsd:{type})
177
+ ```
178
+
179
+ - Add `skos:altLabel` only when the SDD names a synonym or alias; omit if none
180
+ - `rdfs:comment` is required — pick the form that matches what the data contains
181
+
182
+ Examples: `:Customer.customerName`, `:SalesOrder.orderId`, `:SalesOrder.status`
183
+
184
+ ### DataProperty comment forms
185
+
186
+ **Plain meaning** (most properties):
187
+ ```text
188
+ AnnotationAssertion(rdfs:comment :SalesOrder.orderDate "The date and time the order was placed.")
189
+ ```
190
+
191
+ **Value domain** — a choice-set field: exact, complete, case-sensitive value names, read from the choice set (`uip df choice-sets list-values <CHOICE_SET> --local --output json`). Range is `xsd:string`:
192
+ ```text
193
+ AnnotationAssertion(rdfs:comment :SalesOrder.status "Values of choice set OrderStatus: 'Open' | 'Shipped' | 'Cancelled' (case-sensitive; copy exactly).")
194
+ ```
195
+
196
+ **Code list** — cryptic codes with meanings + phrase-to-code bridge:
197
+ ```text
198
+ AnnotationAssertion(rdfs:comment :Contract.status "'A' = finished, no problems | 'B' = finished, not paid | 'C' = running, OK | 'D' = running, in debt. 'Running contract' means status IN ('C','D').")
199
+ ```
200
+
201
+ **Format / scale** — zero-padding, stored fraction vs percent, date shape:
202
+ ```text
203
+ AnnotationAssertion(rdfs:comment :Score.value "Stored 0–1 fraction; multiply by 100 for a percent answer.")
204
+ ```
205
+
206
+ **NULL behavior with condition** (state the fact and what to leave undone, to prevent over-filtering):
207
+ ```text
208
+ AnnotationAssertion(rdfs:comment :Score.rank "NULL for ~600 rows. NULLs sort last in DESC — highest-score queries need no IS NOT NULL filter; add it only when ranking ascending.")
209
+ ```
210
+
211
+ **Boolean**:
212
+ ```text
213
+ AnnotationAssertion(rdfs:comment :SalesOrder.isPaid "Compare true/false, never 1/0.")
214
+ ```
215
+
216
+ ### Choosing the XSD range
217
+
218
+ | User says | XSD type |
219
+ |---|---|
220
+ | text, name, description, code, ID (string) | `xsd:string` |
221
+ | price, amount, cost, rate, percentage | `xsd:decimal` |
222
+ | count, quantity, number of | `xsd:integer` |
223
+ | date, timestamp, created at | `xsd:dateTime` |
224
+ | date only (no time) | `xsd:date` |
225
+ | true/false, flag, enabled | `xsd:boolean` |
226
+ | one of a fixed set of values (choice set) | `xsd:string` |
227
+ | URL, link, URI | `xsd:anyURI` |
228
+
229
+ Each range maps to a Data Fabric field type; see [`entity-guide.md`](entity-guide.md) for the mapping (for example `xsd:integer` is `DECIMAL` with `decimalPrecision: 0`, `xsd:dateTime` is `DATETIME_WITH_TZ`).
230
+
231
+ ---
232
+
233
+ ## Class Annotation Block
234
+
235
+ Classes get their annotations in a dedicated section at the end of the property blocks:
236
+
237
+ ```text
238
+ ############################
239
+ # Classes
240
+ ############################
241
+
242
+ # Class: <https://ontology.uipath.com/{name}#{ClassName}> ({Human Label})
243
+
244
+ AnnotationAssertion(:domain :{ClassName} "{Domain}")
245
+ AnnotationAssertion(rdfs:label :{ClassName} "{Human Label}")
246
+ AnnotationAssertion(rdfs:comment :{ClassName} "ONE row per {business thing}, keyed by Id. {What this class represents.}")
247
+ AnnotationAssertion(skos:altLabel :{ClassName} "{synonym1}")
248
+ ```
249
+
250
+ - `ClassName`: PascalCase, no spaces (e.g., `CustomerOrder`, `RMA_Transaction`)
251
+ - Add `skos:altLabel` for every synonym the user mentions or that aids query matching
252
+ - `rdfs:comment` must state the **grain** (what one row is) first, then the business meaning
253
+
254
+ **Grain variants:**
255
+
256
+ Standard (one row per entity):
257
+ ```text
258
+ AnnotationAssertion(rdfs:comment :{ClassName} "ONE row per {business thing}, keyed by Id. Maps local entity '{EntityName}'.")
259
+ ```
260
+
261
+ Time series (multiple rows per business parent — highest-impact annotation):
262
+ ```text
263
+ AnnotationAssertion(rdfs:comment :{ClassName} "TIME SERIES: ~{N} dated rows per {parent}. A per-{parent} question returns duplicates unless SELECT DISTINCT.")
264
+ ```
265
+
266
+ ---
267
+
268
+ ## Domain annotation
269
+
270
+ The ontology viewer draws one region per **domain**: the part of the business a class belongs to (`Sales`, `Master data`, `Intake`). It reads the domain only from an `ont:domain` annotation in the schema; with none, every class is drawn loose on one canvas with no grouping. Give every class exactly one domain:
271
+
272
+ ```text
273
+ Declaration(AnnotationProperty(:domain))
274
+
275
+ AnnotationAssertion(:domain :Customer "Master data")
276
+ AnnotationAssertion(:domain :SalesOrder "Sales")
277
+ AnnotationAssertion(:domain :OrderLine "Sales")
278
+ ```
279
+
280
+ - Declare `:domain` once as an `AnnotationProperty`, at the top with the other declarations. It is an annotation, not a data property: it gets no mapping and no shape.
281
+ - One `AnnotationAssertion(:domain …)` per class, in the class's annotation block. A class without one lands in a "Not stated" pile.
282
+ - The value is a short business label in Title or sentence case, spelled identically on every class of the group; a typo makes a second region.
283
+ - Pick 3–7 domains from the document's own sections or process stages. Group by business area, not by source system: the source system is shown separately, by the icon the mapping's `system:` key gives (see the mapping guide's *Source system* section).
284
+ - The viewer matches the annotation by its local name, so `:domain` in the ontology's own namespace is correct. Never write `rdfs:domain` here: that is the property-domain axiom, a different thing.
285
+
286
+ ---
287
+
288
+ ## Every class must be backed by data — no annotation-only classes
289
+
290
+ Every `Declaration(Class(...))` must be (a) the domain of ≥1 `DataPropertyDomain`/`ObjectPropertyDomain`, and (b) instantiated in `{name}-mapping.yarrrml.yml` over a local entity. A class that fails either — typically a "role"/"actor" concept (approving manager, external system name, job title) with zero properties and no entity — parses as valid OWL but fails `uip ont validate --local` (`XF-009`, every class needs a backing entity). If the concept is narrative-only, fold it into the relevant property's `rdfs:comment` instead (e.g. `Payment.approvedBy`'s comment) rather than declaring a class.
291
+
292
+ **Real properties don't mean relationships are modeled.** A `DataProperty` whose value equals another class's key (e.g. a text column that happens to hold another entity's key) is two matching columns, not a relationship, until the entity has a `RELATIONSHIP` field and the schema an `ObjectProperty` (with `ObjectPropertyDomain`/`ObjectPropertyRange`) wired into the mapping as a join. Every object property between two mapped classes needs that join (`XF-015`), and every join needs a declared object property (`XF-014`). See [`relationships-guide.md`](relationships-guide.md).
293
+
294
+ ---
295
+
296
+ ## Many-to-many relationships
297
+
298
+ When two classes have a mutual "can have many" relationship (e.g. a SalesOrder can contain many Products, and a Product appears on many SalesOrders), OWL 2 QL cannot directly express this as two ObjectProperties — each ObjectProperty has a single domain and range. Model it with a **junction class**.
299
+
300
+ ### Pattern — junction class
301
+
302
+ Introduce a class that represents the association itself:
303
+
304
+ ```text
305
+ Classes:
306
+ SalesOrder
307
+ Product
308
+ OrderLine ← junction: one row per (order, product) pair
309
+
310
+ ObjectProperties:
311
+ lineOfOrder: OrderLine → SalesOrder
312
+ lineOfProduct: OrderLine → Product
313
+ ```
314
+
315
+ In the OWL file:
316
+ ```text
317
+ Declaration(Class(:OrderLine))
318
+ Declaration(ObjectProperty(:lineOfOrder))
319
+ Declaration(ObjectProperty(:lineOfProduct))
320
+
321
+ AnnotationAssertion(rdfs:label :OrderLine "Order line")
322
+ AnnotationAssertion(rdfs:comment :OrderLine "ONE row per (order, product) line. Junction between SalesOrder and Product.")
323
+ AnnotationAssertion(rdfs:label :lineOfOrder "Line of order")
324
+ AnnotationAssertion(rdfs:comment :lineOfOrder "Links an order line to its order. Join: OrderLine.order = SalesOrder.Id.")
325
+ AnnotationAssertion(rdfs:label :lineOfProduct "Line of product")
326
+ AnnotationAssertion(rdfs:comment :lineOfProduct "Links an order line to its product. Join: OrderLine.product = Product.Id.")
327
+ ObjectPropertyDomain(:lineOfOrder :OrderLine)
328
+ ObjectPropertyRange(:lineOfOrder :SalesOrder)
329
+ ObjectPropertyDomain(:lineOfProduct :OrderLine)
330
+ ObjectPropertyRange(:lineOfProduct :Product)
331
+ ```
332
+
333
+ The junction class maps to its own local entity. It holds one `RELATIONSHIP` field per side.
334
+
335
+ **When to introduce a junction class:**
336
+ - User says "X can have many Y AND Y can be shared across many X"
337
+ - There is a real association entity with its own `Id`
338
+ - The association itself carries extra fields (quantity, unit price, etc.)
339
+
340
+ **Do not use a junction class when:**
341
+ - One side is strictly "many owned by one" (use a plain ObjectProperty with `RELATIONSHIP` field on the many-side entity)
342
+ - There is no association entity
343
+
344
+ ---
345
+
346
+ ## SubClassOf axioms (OWL 2 QL legal forms only)
347
+
348
+ Add after all Declaration + annotation blocks.
349
+
350
+ ### Existential restriction (QL-legal)
351
+ ```text
352
+ SubClassOf(:{Class} ObjectSomeValuesFrom(:{prop} :{Range}))
353
+ SubClassOf(:{Class} DataSomeValuesFrom(:{dataProp} xsd:{type}))
354
+ ```
355
+
356
+ ### Subclass / inheritance (QL-legal)
357
+ ```text
358
+ SubClassOf(:{Child} :{Parent})
359
+ ```
360
+
361
+ A subclass is a class like any other, so `XF-009` holds for it too:
362
+
363
+ 1. **The subtype has fields of its own** (a `ContractorWorker` with `agencyName`): it gets its own local entity, its own mapping block over that entity, and at least one data or object property whose domain it is. The parent keeps its own entity and block.
364
+ 2. **The subtype has no fields of its own** ("a premium customer is a customer"): it is not a class. Model it as a choice-set property on the parent (`Customer.tier` with value `Premium`) and record the meaning in that property's `rdfs:comment`.
365
+
366
+ Never declare a subclass with no property and no mapping block: the mapping cannot filter the parent's rows into it.
367
+
368
+ ---
369
+
370
+ ## Naming Conventions
371
+
372
+ | Construct | Convention | Example |
373
+ |---|---|---|
374
+ | Class | PascalCase | `CustomerOrder`, `RMA_Transaction` |
375
+ | DataProperty | `{ClassName}.{propName}` camelCase — **never** `has{Prop}` | `SalesOrder.orderDate`, `SalesOrder.totalAmount` |
376
+ | ObjectProperty | camelCase verb phrase | `orderedBy`, `belongsToCategory` |
377
+ | Label | natural business phrase, sentence case | `"Order date"`, `"Placed by"` |
@@ -0,0 +1,97 @@
1
+ # Relationships Guide
2
+
3
+ A relationship between two classes has three parts, and all three must exist.
4
+
5
+ | Where | What |
6
+ |---|---|
7
+ | Entity | one `RELATIONSHIP` field on the referencing entity, naming the target entity |
8
+ | Schema (`{name}.ofn`) | an `ObjectProperty` with `ObjectPropertyDomain` (the class holding the field) and `ObjectPropertyRange` (the class it points to) |
9
+ | Mapping (`{name}-mapping.yarrrml.yml`) | a join in the domain class's mapping block, on the field and the target's `Id` |
10
+
11
+ When a constraints file is written and a shape constrains the relationship, it adds `sh:class` on the object property path.
12
+
13
+ ## Worked example: SalesOrder to Customer
14
+
15
+ A sales order has one customer. `SalesOrder` holds the field, and `Customer` is keyed by its system field `Id`.
16
+
17
+ Entity field (see [entity-guide.md](entity-guide.md)):
18
+
19
+ ```json
20
+ { "name": "customer", "type": "RELATIONSHIP", "referenceEntityName": "Customer" }
21
+ ```
22
+
23
+ `referenceFieldName` defaults to `Id`; add it only to reference a different unique field of the target.
24
+
25
+ Schema:
26
+
27
+ ```text
28
+ Declaration(ObjectProperty(:placedBy))
29
+ ObjectPropertyDomain(:placedBy :SalesOrder)
30
+ ObjectPropertyRange(:placedBy :Customer)
31
+ Declaration(ObjectProperty(:places))
32
+ InverseObjectProperties(:places :placedBy)
33
+ ```
34
+
35
+ Mapping, on the `SalesOrder` block:
36
+
37
+ <!-- skill-lint-disable-next-line CODE-FENCE-PARSE reason="valid YAML; the linter strips the nesting of a top-level fence (skill-linter _md.fences, indent 0)" -->
38
+ ```yaml
39
+ - p: ont:placedBy
40
+ o:
41
+ mapping: Customer
42
+ condition:
43
+ function: equal
44
+ parameters:
45
+ - [str1, $(customer)]
46
+ - [str2, $(Id)]
47
+ ```
48
+
49
+ `str1` is read from the current mapping's entity, `str2` from the target mapping's entity. Both are fields of those entities or system fields, case-sensitive.
50
+
51
+ ## One field, inverse in the schema only
52
+
53
+ The inverse lives only in the schema, as `InverseObjectProperties`. **Never add a second RELATIONSHIP field for the inverse.** Two fields pointing at each other form a cycle: `uip df entities create|update <E> --local` refuses the field that closes it (`RELATIONSHIP_CYCLE`), and `uip ont validate --local` reports any cycle among the ontology's entities as `XF-017`, including longer ones (A to B to C to A). The inverse gets no field, no join and no shape. Break a cycle by keeping only one field of the loop.
54
+
55
+ If `XF-017` is reported, remove the second field with `uip df entities update <E> --local` (`removeFields`), then validate again.
56
+
57
+ ## Which side holds the field
58
+
59
+ 1. **The user named a field.** Use it exactly as stated.
60
+ 2. **The user described the relationship but named no field.** Propose a field named after the target (`customer`) on the many side and **ask before adding it**.
61
+ 3. **The many side holds it.** `SalesOrder.customer`, not a list on `Customer`. The object property's domain is the class that holds the field.
62
+ 4. **Create order.** The referenced entity is created before the entity that references it (see [entity-guide.md](entity-guide.md)).
63
+
64
+ For an entity you did not write (`ENTITY_SOURCE` is `supplied`), ask before adding the field.
65
+
66
+ ## Federated target
67
+
68
+ A federated entity can't be a `RELATIONSHIP` target. Join on a plain column of the referencing entity to the federated entity's key column. The key is `Id` for a federated entity over a local native entity, and the connector object's primary-key field for a connector source. Read it from the created entity:
69
+
70
+ ```yaml
71
+ - [str1, $(accountKey)] # plain column on the referencing entity
72
+ - [str2, $(AccountKey)] # key column of the federated entity (connector source)
73
+ ```
74
+
75
+ The plain column has the key's type, and `RELATIONSHIPS` records that key as `toColumn`.
76
+
77
+ ## Many-to-many
78
+
79
+ Use a junction entity with two `RELATIONSHIP` fields, one per side (`OrderLine.order`, `OrderLine.product`). Its mapping block carries two joins. See [owl-patterns-guide.md](owl-patterns-guide.md) and [mapping-yarrrml-guide.md](mapping-yarrrml-guide.md).
80
+
81
+ ## Self-reference
82
+
83
+ A `RELATIONSHIP` field may name its own entity (`"referenceEntityName": "<E>"`), authored with `uip df entities create|update <E> --local`. Deploying a self-reference is unverified: before authoring one, tell the user, and add it only on their confirmation.
84
+
85
+ ## Rules the validator checks
86
+
87
+ - Every join uses an object property declared in the schema (`XF-014`).
88
+ - Every object property between two mapped classes has a join in the domain class's mapping (`XF-015`). **Exception:** a property declared `InverseObjectProperties` of a joined property gets none. Sub-properties are not exempt.
89
+ - Every `$(column)` in a join is a field of its entity or a system field.
90
+ - Do not write an inline `~iri` relationship. Use the join form above.
91
+
92
+ ## Do not
93
+
94
+ - Declare a key as a `DataProperty` and stop there. Two matching columns are not a relationship.
95
+ - Add a second `RELATIONSHIP` field for an inverse.
96
+ - Substitute a `STRING` column for a `RELATIONSHIP` field.
97
+ - Write an entity, field or folder id in the mapping.