Skip to content

[BUG] JsonController.LDGraph.fromROCrateJsonString(jsonString); does not normalize ro-crate json ids #607

@Freymaurer

Description

@Freymaurer

This behavior was noticed for this ro-crate-json file:

arc-ro-crate-metadata (1).json

For the following code:

const ldgraph = JsonController.LDGraph.fromROCrateJsonString(jsonString);

const files = ldGraph.value.Nodes.filter((n) =>
      ROCrate.LDFile.validate(
          n,
          ldGraph.value?.TryGetContext() as any
      )
  );
console.log(files)

I get the following objects:

[
{
    "properties": {},
    "id": "assays/Imaging/dataset/control/Image2.lsm",
    "schemaType@178": [
        "File"
    ],
    "additionalType@179": [],
    "init@175-1": 1,
    "name": "assays/Imaging/dataset/control/Image2.lsm",
    "sha256": "ecac512e5a224cc6b98e79250ff15b9e6fffef72088289165cde5230033da17f",
    "contentSize": "751515343b"
},
{
    "properties": {},
    "id": "./runs/model_training/training_data_resampled/image4.tif",
    "schemaType@178": [
        "File"
    ],
    "additionalType@179": [],
    "init@175-1": 1,
    "name": "./runs/model_training/training_data_resampled/image4.tif",
    "sha256": "7ee83854892e7a77780b4f11aea8fb48e179230520fc2475ccd1574429ba537f",
    "contentSize": "45636233b"
}
]

Please pay attention to:

  • "./runs/model_training/training_data_resampled/image4.tif"
  • "assays/Imaging/dataset/control/Image2.lsm"

One with ./ and one without. I used this id field for comparisons with paths, and the paths are always without ./:

const arc = JsonController.ARC.fromROCrateJsonString(jsonString)
const paths = arc.value.FileSystem.Tree.ToFilePaths(true);

Which returns the following (all without ./):

"runs/model_training/training_data_resampled/image4.tif",
"assays/ModelTraining/dataset/test_images_masks/image22.tif"

Expected

Should be unified, instead run/-paths are not normalized.

Metadata

Metadata

Assignees

Labels

Type: BugSomething is not working, and it is confirmed by maintainers to be a bug.

Type

No type
No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions