Skip to content

Commit 641a3cc

Browse files
realmarcinclaude
andcommitted
Refactor resources from class attributes to shared slot
Convert resources from duplicated class attribute definitions to a shared LinkML slot, following the same pattern as external_resources. Changes: - Add resources slot to D4D_Base_import.yaml with range: Dataset - Update DatasetCollection class to use slots + slot_usage - Update Dataset class to use slots + slot_usage with nested description - Remove duplicate attribute definitions Benefits: - Eliminates "Ambiguous attribute: resources" OWL generation warnings - Single source of truth for resources semantics - Follows LinkML best practices for slot reuse - Consistent pattern with external_resources refactoring - No functional changes - maintains backward compatibility The recursive structure still works correctly: - DatasetCollection.resources → list of Dataset objects - Dataset.resources → list of nested Dataset objects (sub-resources) All tests pass with no ambiguous attribute warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1802968 commit 641a3cc

File tree

7 files changed

+1008
-960
lines changed

7 files changed

+1008
-960
lines changed

project/jsonld/data_sheets_schema.jsonld

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,18 +1923,18 @@
19231923
"@type": "SlotDefinition"
19241924
},
19251925
{
1926-
"name": "datasetCollection__resources",
1927-
"from_schema": "https://w3id.org/bridge2ai/data-sheets-schema",
1926+
"name": "resources",
1927+
"definition_uri": "https://w3id.org/bridge2ai/data-sheets-schema/resources",
1928+
"description": "Sub-resources or component datasets. Used in DatasetCollection to contain Dataset objects, and in Dataset to allow nested resource structures.",
1929+
"from_schema": "https://w3id.org/bridge2ai/data-sheets-schema/base",
19281930
"slot_uri": "https://w3id.org/bridge2ai/data-sheets-schema/resources",
1929-
"alias": "resources",
1930-
"owner": "DatasetCollection",
1931+
"owner": "Dataset",
19311932
"domain_of": [
1932-
"DatasetCollection"
1933+
"DatasetCollection",
1934+
"Dataset"
19331935
],
19341936
"range": "Dataset",
19351937
"multivalued": true,
1936-
"inlined": true,
1937-
"inlined_as_list": true,
19381938
"@type": "SlotDefinition"
19391939
},
19401940
{
@@ -2756,22 +2756,6 @@
27562756
"inlined_as_list": true,
27572757
"@type": "SlotDefinition"
27582758
},
2759-
{
2760-
"name": "dataset__resources",
2761-
"description": "Sub-resources or component datasets that are part of this dataset. Allows datasets to contain nested resource structures.",
2762-
"from_schema": "https://w3id.org/bridge2ai/data-sheets-schema",
2763-
"slot_uri": "https://w3id.org/bridge2ai/data-sheets-schema/resources",
2764-
"alias": "resources",
2765-
"owner": "Dataset",
2766-
"domain_of": [
2767-
"Dataset"
2768-
],
2769-
"range": "Dataset",
2770-
"multivalued": true,
2771-
"inlined": true,
2772-
"inlined_as_list": true,
2773-
"@type": "SlotDefinition"
2774-
},
27752759
{
27762760
"name": "dataSubset__is_data_split",
27772761
"description": "Is this subset a split of the larger dataset, e.g., is it a set for model training, testing, or validation?",
@@ -5459,6 +5443,27 @@
54595443
"multivalued": true,
54605444
"@type": "SlotDefinition"
54615445
},
5446+
{
5447+
"name": "DatasetCollection_resources",
5448+
"definition_uri": "https://w3id.org/bridge2ai/data-sheets-schema/resources",
5449+
"description": "Sub-resources or component datasets. Used in DatasetCollection to contain Dataset objects, and in Dataset to allow nested resource structures.",
5450+
"from_schema": "https://w3id.org/bridge2ai/data-sheets-schema/base",
5451+
"is_a": "resources",
5452+
"domain": "DatasetCollection",
5453+
"slot_uri": "https://w3id.org/bridge2ai/data-sheets-schema/resources",
5454+
"alias": "resources",
5455+
"owner": "DatasetCollection",
5456+
"domain_of": [
5457+
"DatasetCollection"
5458+
],
5459+
"is_usage_slot": true,
5460+
"usage_slot_name": "resources",
5461+
"range": "Dataset",
5462+
"multivalued": true,
5463+
"inlined": true,
5464+
"inlined_as_list": true,
5465+
"@type": "SlotDefinition"
5466+
},
54625467
{
54635468
"name": "Dataset_external_resources",
54645469
"definition_uri": "https://w3id.org/bridge2ai/data-sheets-schema/external_resources",
@@ -5483,6 +5488,27 @@
54835488
"inlined_as_list": true,
54845489
"@type": "SlotDefinition"
54855490
},
5491+
{
5492+
"name": "Dataset_resources",
5493+
"definition_uri": "https://w3id.org/bridge2ai/data-sheets-schema/resources",
5494+
"description": "Sub-resources or component datasets that are part of this dataset. Allows datasets to contain nested resource structures.",
5495+
"from_schema": "https://w3id.org/bridge2ai/data-sheets-schema/base",
5496+
"is_a": "resources",
5497+
"domain": "Dataset",
5498+
"slot_uri": "https://w3id.org/bridge2ai/data-sheets-schema/resources",
5499+
"alias": "resources",
5500+
"owner": "Dataset",
5501+
"domain_of": [
5502+
"Dataset"
5503+
],
5504+
"is_usage_slot": true,
5505+
"usage_slot_name": "resources",
5506+
"range": "Dataset",
5507+
"multivalued": true,
5508+
"inlined": true,
5509+
"inlined_as_list": true,
5510+
"@type": "SlotDefinition"
5511+
},
54865512
{
54875513
"name": "ExternalResource_external_resources",
54885514
"definition_uri": "https://w3id.org/bridge2ai/data-sheets-schema/external_resources",
@@ -5548,18 +5574,9 @@
55485574
"title",
55495575
"version",
55505576
"was_derived_from",
5551-
"datasetCollection__resources"
5577+
"DatasetCollection_resources"
55525578
],
55535579
"slot_usage": {},
5554-
"attributes": [
5555-
{
5556-
"name": "resources",
5557-
"range": "Dataset",
5558-
"multivalued": true,
5559-
"inlined_as_list": true,
5560-
"@type": "SlotDefinition"
5561-
}
5562-
],
55635580
"class_uri": "https://w3id.org/bridge2ai/data-sheets-schema/DatasetCollection",
55645581
"tree_root": true,
55655582
"@type": "ClassDefinition"
@@ -5615,6 +5632,7 @@
56155632
"path",
56165633
"sha256",
56175634
"Dataset_external_resources",
5635+
"Dataset_resources",
56185636
"dataset__purposes",
56195637
"dataset__tasks",
56205638
"dataset__addressing_gaps",
@@ -5668,8 +5686,7 @@
56685686
"dataset__is_tabular",
56695687
"dataset__citation",
56705688
"dataset__parent_datasets",
5671-
"dataset__related_datasets",
5672-
"dataset__resources"
5689+
"dataset__related_datasets"
56735690
],
56745691
"slot_usage": {},
56755692
"attributes": [
@@ -6064,14 +6081,6 @@
60646081
"multivalued": true,
60656082
"inlined_as_list": true,
60666083
"@type": "SlotDefinition"
6067-
},
6068-
{
6069-
"name": "resources",
6070-
"description": "Sub-resources or component datasets that are part of this dataset. Allows datasets to contain nested resource structures.",
6071-
"range": "Dataset",
6072-
"multivalued": true,
6073-
"inlined_as_list": true,
6074-
"@type": "SlotDefinition"
60756084
}
60766085
],
60776086
"class_uri": "http://www.w3.org/ns/dcat#Distribution",
@@ -6117,6 +6126,7 @@
61176126
"path",
61186127
"sha256",
61196128
"Dataset_external_resources",
6129+
"Dataset_resources",
61206130
"dataset__purposes",
61216131
"dataset__tasks",
61226132
"dataset__addressing_gaps",
@@ -6171,7 +6181,6 @@
61716181
"dataset__citation",
61726182
"dataset__parent_datasets",
61736183
"dataset__related_datasets",
6174-
"dataset__resources",
61756184
"dataSubset__is_data_split",
61766185
"dataSubset__is_subpopulation"
61776186
],
@@ -8869,9 +8878,9 @@
88698878
],
88708879
"metamodel_version": "1.7.0",
88718880
"source_file": "data_sheets_schema.yaml",
8872-
"source_file_date": "2025-12-09T21:41:37",
8873-
"source_file_size": 14165,
8874-
"generation_date": "2025-12-09T21:41:49",
8881+
"source_file_date": "2025-12-09T21:48:49",
8882+
"source_file_size": 14114,
8883+
"generation_date": "2025-12-09T21:49:07",
88758884
"@type": "SchemaDefinition",
88768885
"@context": [
88778886
"project/jsonld/data_sheets_schema.context.jsonld",

project/jsonschema/data_sheets_schema.schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,6 +2493,7 @@
24932493
]
24942494
},
24952495
"resources": {
2496+
"description": "Sub-resources or component datasets. Used in DatasetCollection to contain Dataset objects, and in Dataset to allow nested resource structures.",
24962497
"items": {
24972498
"$ref": "#/$defs/Dataset"
24982499
},
@@ -6166,6 +6167,7 @@
61666167
]
61676168
},
61686169
"resources": {
6170+
"description": "Sub-resources or component datasets. Used in DatasetCollection to contain Dataset objects, and in Dataset to allow nested resource structures.",
61696171
"items": {
61706172
"$ref": "#/$defs/Dataset"
61716173
},

0 commit comments

Comments
 (0)