Skip to content

Commit 8ae7dfe

Browse files
authored
Merge branch 'mlcommons:main' into docs/update-spec-draft-v2
2 parents 8cc47c4 + 4a249b8 commit 8ae7dfe

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

python/mlcroissant/mlcroissant/_src/core/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def ML_COMMONS(ctx) -> rdflib.Namespace:
7575
# ML_COMMONS.replace is understood as the `replace` method on the class Namespace.
7676
ML_COMMONS_REPLACE = lambda ctx: ML_COMMONS(ctx)["replace"]
7777
ML_COMMONS_SAMPLING_RATE = lambda ctx: ML_COMMONS(ctx).samplingRate
78+
ML_COMMONS_SD_VERSION = lambda ctx: ML_COMMONS(ctx).sdVersion
7879
ML_COMMONS_SEPARATOR = lambda ctx: ML_COMMONS(ctx).separator
7980
ML_COMMONS_SOURCE = lambda ctx: ML_COMMONS(ctx).source
8081
ML_COMMONS_SUB_FIELD = lambda ctx: ML_COMMONS(ctx).subField
@@ -187,6 +188,7 @@ def ML_COMMONS(ctx) -> rdflib.Namespace:
187188
ML_COMMONS_SAMPLING_RATE(ctx): "sampling_rate",
188189
ML_COMMONS_SEPARATOR(ctx): "separator",
189190
ML_COMMONS_SOURCE(ctx): "source",
191+
ML_COMMONS_SD_VERSION(ctx): "sd_version",
190192
ML_COMMONS_TRANSFORM(ctx): "transforms",
191193
DCTERMS_CONFORMS_TO: "conforms_to",
192194
SCHEMA_ORG_CONTENT_SIZE: "content_size",

python/mlcroissant/mlcroissant/_src/structure_graph/nodes/metadata.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ class Metadata(Node):
177177
input_types=[SDO.Integer, SDO.Number, SDO.Text],
178178
url=constants.SCHEMA_ORG_VERSION,
179179
)
180+
sd_version: str | None = mlc_dataclasses.jsonld_field(
181+
cast_fn=cast_version,
182+
default=None,
183+
description="The version of the dataset metadata.",
184+
input_types=[SDO.Integer, SDO.Number, SDO.Text],
185+
url=constants.ML_COMMONS_SD_VERSION,
186+
)
180187
distribution: list[FileObject | FileSet] = mlc_dataclasses.jsonld_field(
181188
cardinality="MANY",
182189
default_factory=list,

python/mlcroissant/mlcroissant/_src/structure_graph/nodes/metadata_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def test_from_jsonld(conforms_to: CroissantVersion, version: Any):
6666
constants.SCHEMA_ORG_URL: "https://mlcommons.org",
6767
constants.SCHEMA_ORG_VERSION: version,
6868
constants.ML_COMMONS_IS_LIVE_DATASET(ctx): False,
69+
constants.ML_COMMONS_SD_VERSION(ctx): "2.0.0",
6970
}
7071
metadata = Metadata.from_jsonld(ctx, jsonld)
7172
assert metadata.name == "foo"
@@ -81,6 +82,7 @@ def test_from_jsonld(conforms_to: CroissantVersion, version: Any):
8182
assert metadata.ctx.is_live_dataset == False
8283
assert metadata.url == "https://mlcommons.org"
8384
assert metadata.version == "1.0.0"
85+
assert metadata.sd_version == "2.0.0"
8486
assert not ctx.issues.errors
8587
assert not ctx.issues.warnings
8688

0 commit comments

Comments
 (0)