Class Metadata
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
ROCrateidentifier
stringproperties
JsonObjectsource
stringdestPath
stringfetchRemote
boolvalidateUrl
bool
Fields
FileName
protected const string FileName = "ro-crate-metadata.json"
Field Value
Profile
protected const string Profile = "https://w3id.org/ro/crate/1.1"
Field Value
Properties
ExtraTerms
public JsonObject? ExtraTerms { get; set; }
Property Value
RootDataset
public RootDataset? RootDataset { get; }
Property Value
Methods
Deserialize(string, ROCrate)
Create a Metadata from JSON properties.
public static Metadata? Deserialize(string entityJson, ROCrate roCrate)
Parameters
Returns
Serialize()
Convert Metadata to JSON string.
public override string Serialize()
Returns
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
stringThe 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");