Skip to content

Commit db4e053

Browse files
committed
Updated Linked.Art Context
Updated the Linked.Art profile document in preparation for the migration to the Linked.Art 1.0 specification. The updates have been made where possible in a backwards compatible way, so that existing properties that are superseded/removed in 1.0 are still present in the profile for backwards compatibility for a period of time while mapping work may be undertaken to migrate from legacy patterns to fully 1.0 compliant patterns, entities and properties. Some changes however could not be made in a backwards compatible way, such as updating the cardinality of properties, or updating properties to have a more specific domain than they did previously, such as the domain for `Joining` being changed from the broader `Activity` to the narrower `Addition`. Changes of this nature could not be made in a backwards compatible way. Where properties have been renamed, an alias has been provided for the interim to allow the continued use of the legacy naming until any mappings and consuming code is updated. Some changes that necessitated removal of unused properties, such as the `inScheme`, `topConceptOf` and `hasTopConcept` properties of the `Type` entity do not have backwards compatible workarounds, and code referencing these unused properties should be updated. The full list of changes is documented below: * Added the `CRMEntity.notation` property; * Added the `Set.members_contained_by` property; * Added the `Set.members_exemplified_by` property; * Added the `PhysicalThing.contains_members_of` property; * Added the `TemporalEntity.after` property; * Added the `TemporalEntity.before` property; * Added the `SpacetimeVolume.includes` property; * Added the new `Transfer` entity type (a subtype of `Activity`) and updated the superclasses from the broader `Activity` to the more specific `Transfer` for `Acquisition`, `Move`, `Payment`, `RightAcquisition` and `TransferOfCustody`; * Updated the superclass for `Joining` from the broader `Activity` to the more specific `Addition`; * Updated the superclass for `Leaving` from the broader `Activity` to the more specific `Removal`; * Updated the superclasses for `Group` from `Actor` previously, to both `Set` and `Actor`; * Updated the cardinality for the `RightAcquisition` entity’s `establishes` property from one to many (`individual: false`), this will result in the property being serialised to a list of dictionaries instead of being a reference to a single dictionary, so consuming code will need to be updated (breaking change); * Broadened domain for `PhysicalObject.current_location` from `PhysicalObject` to `PhysicalThing`; * Broadened the domain for `PhysicalObject.current_permanent_location` from `PhysicalObject` to `PhysicalThing`, marked the field as being newly accepted for use (accepted: true), and adjusted the cardinality from many to one (`individual: true`), resulting in the property being serialised as a reference to a single dictionary instead of a list of dictionaries, so consuming code will need to be updated (breaking change); * Updated scope note for `Payment.paid_amount` to remove the extraneous period; * Broadened the domain of `PhysicalObject.current_permanent_location_of` from `PhysicalObject` to `PhysicalThing`; * Broadened the domain of `Place.currently_holds` from `PhysicalObject` to `PhysicalThing`; * Renamed the `PropositionalObject` entity’s `c_part` property to `conceptual_part` (with an alias for backwards compatibility to `c_part`); * Renamed the `PropositionalObject` entity’s `c_part_of` property to `conceptual_part_of` (with an alias for backwards compatibility to `c_part_of`); * Renamed the `ConditionState` entity’s `subState` property to `sub_state` (with an alias for backwards compatibility to `subState`); * Renamed the `ConditionState` entity’s `subState_of` property to `sub_state_of` (with an aliased for backwards compatibility to `subState_of`); * Renamed the `SpacetimeVolume` entity’s `falls_within` property to `during` and enabled the property for use (with an alias for backwards compatibility to `during`); * Removed the `Type.inScheme` property (breaking change); * Removed the `Type.topConceptOf` property (breaking change); * Removed the `Type.hasTopConcept` property (breaking change).
1 parent f4075f0 commit db4e053

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

source/semanticpy/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ def _class_factory(name: str) -> type:
179179
# properties_sorted[key] = properties[key]
180180
# properties = properties_sorted
181181

182+
aliases: dict[str, dict[str, object]] = {}
183+
182184
for prop, props in properties.items():
183185
# determine if at least one property on the model is marked as accepted
184186
if props.get("accepted", True) is True:
@@ -194,6 +196,16 @@ def _class_factory(name: str) -> type:
194196
if not prop in hidden:
195197
hidden.append(prop)
196198

199+
# if the property has an alias, map the alias name to the property data
200+
if isinstance(alias := props.get("alias"), str):
201+
if alias in aliases:
202+
if not aliases[alias] is props:
203+
raise SemanticPyError(
204+
f"An alias for '{alias}' already exists for the '{name}' entity!"
205+
)
206+
else:
207+
aliases[alias] = props
208+
197209
sorting[prop] = props.get("sorting") or 10000
198210

199211
if accepted is False:
@@ -205,6 +217,9 @@ def _class_factory(name: str) -> type:
205217
),
206218
)
207219

220+
if len(aliases) > 0:
221+
properties.update(aliases)
222+
208223
attributes = {
209224
"_context": context,
210225
"_type": entity.get("type"),

source/semanticpy/profiles/linked-art.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,7 @@
12191219
"sorting": 10000
12201220
},
12211221
"sub_state": {
1222+
"alias": "subState",
12221223
"name": "crm:P5_consists_of",
12231224
"label": "consists of",
12241225
"inverse": "crm:P5i_forms_part_of",
@@ -1232,6 +1233,7 @@
12321233
"sorting": 10000
12331234
},
12341235
"sub_state_of": {
1236+
"alias": "subState_of",
12351237
"name": "crm:P5i_forms_part_of",
12361238
"label": "forms part of",
12371239
"inverse": "crm:P5_consists_of",
@@ -4072,6 +4074,7 @@
40724074
"sorting": 18
40734075
},
40744076
"conceptual_part": {
4077+
"alias": "c_part",
40754078
"name": "crm:P148_has_component",
40764079
"label": "has component",
40774080
"inverse": "crm:P148i_is_component_of",
@@ -4085,6 +4088,7 @@
40854088
"sorting": 10000
40864089
},
40874090
"conceptually_part_of": {
4091+
"alias": "c_part_of",
40884092
"name": "crm:P148i_is_component_of",
40894093
"label": "is component of",
40904094
"inverse": "crm:P148_has_component",
@@ -4244,7 +4248,7 @@
42444248
"subclasses": null,
42454249
"accepted": true,
42464250
"hidden": false,
4247-
"individual": true,
4251+
"individual": false,
42484252
"range": "crm:E30_Right",
42494253
"domain": "la:RightAcquisition",
42504254
"scope_note": "The right established by a RightAcquisition",
@@ -4384,6 +4388,7 @@
43844388
"sorting": 10000
43854389
},
43864390
"during": {
4391+
"alias": "falls_within",
43874392
"name": "crm:P10_falls_within",
43884393
"label": "falls within",
43894394
"inverse": "crm:P10i_contains",

0 commit comments

Comments
 (0)