Table of Contents

Class Metadata

Namespace
ROCrates.Models
Assembly
ROCrates.Net.dll

RO-Crate Metadata file.

public class Metadata : File
Inheritance
Metadata
Inherited Members

Constructors

Metadata()

public Metadata()

Metadata(ROCrate?, string?, JsonObject?, string?, string?, bool, bool)

public Metadata(ROCrate? crate = null, string? identifier = null, JsonObject? properties = null, string? source = null, string? destPath = null, bool fetchRemote = false, bool validateUrl = false)

Parameters

crate ROCrate
identifier string
properties JsonObject
source string
destPath string
fetchRemote bool
validateUrl bool

Fields

FileName

protected const string FileName = "ro-crate-metadata.json"

Field Value

string

Profile

protected const string Profile = "https://w3id.org/ro/crate/1.1"

Field Value

string

Properties

ExtraTerms

public JsonObject? ExtraTerms { get; set; }

Property Value

JsonObject

RootDataset

public RootDataset? RootDataset { get; }

Property Value

RootDataset

Methods

Deserialize(string, ROCrate)

Create a Metadata from JSON properties.

public static Metadata? Deserialize(string entityJson, ROCrate roCrate)

Parameters

entityJson string

The JSON representing the Metadata

roCrate ROCrate

The RO-Crate for the Metadata

Returns

Metadata

The deserialised Metadata

Serialize()

Convert Metadata to JSON string.

public override string Serialize()

Returns

string

The Metadata as a JSON string.

Write(string)

Write file contents to the specified path. e.g. The root path of an RO-Crate.

If the file is a remote file, and fetchUrl is set to true, the file will be downloaded under "basePath".

If the file is on disk, it will be copied to a new location under "basePath".

In either case, the file will be saved to "basePath/Id"

public override void Write(string basePath)

Parameters

basePath string

The path the file will be written to.

Examples

  var url = "https://hdruk.github.io/hutch/docs/devs";
                                                                                                                                 var fileName = url.Split('/').Last();
                                                                                                                                 var fileEntity = new Models.File(
                                                                                                                                    new ROCrate(),
                                                                                                                                    source: url,
                                                                                                                                    validateUrl: true,
                                                                                                                                    fetchRemote: true);
                                                                                                                                 fileEntity.Write("myCrate");