Skip to content

Commit f183cf4

Browse files
committed
Make inlining explicit when classes are used as ranges
1 parent 5f275ff commit f183cf4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/dcat_ap_plus/dcat_ap_shacl_2_linkml.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ def parse_dcat_ap_shacl_shapes(builder):
229229
# sh:maxCount is only used in DCAT-AP for 0..1 cardinality so far and left out for 0..n or 1..n
230230
required = True if 'sh:minCount' in slot_shape and int(slot_shape['sh:minCount']) >= 1 else False
231231
multivalued = False if 'sh:maxCount' in slot_shape and int(slot_shape['sh:maxCount']) == 1 else True
232-
# Allow list inlining of objects in LinkML for multivalued slots
232+
# Allow inlining of objects in LinkML
233+
inlined = None
233234
inlined_as_list = True if multivalued is True else None
234235
# Use default slot range 'string' as substitute for 'rdfs:Literal' and 'xsd:date' for
235236
# https://semiceu.github.io/DCAT-AP/releases/3.0.0/#TemporalLiteral, except for
@@ -286,6 +287,9 @@ def parse_dcat_ap_shacl_shapes(builder):
286287
if 'sh:maxCount' in slot_shape:
287288
class_slots[slot_name].multivalued = multivalued
288289
class_slots[slot_name].inlined_as_list = inlined_as_list
290+
# Allow inlining of objects for single valued slots with classes as ranges
291+
if 'sh:class' in slot_shape:
292+
class_slots[slot_name].inlined = True
289293

290294
# Add the class slot
291295
else:
@@ -297,6 +301,7 @@ def parse_dcat_ap_shacl_shapes(builder):
297301
range=slot_range,
298302
any_of=any_of,
299303
multivalued=multivalued,
304+
inlined = inlined,
300305
inlined_as_list=inlined_as_list)
301306

302307

0 commit comments

Comments
 (0)