Reads x when it is a path, URL, or JSON string, then checks the
metadata, and reports every problem found in one CroissantIssues object.
Problems that read_croissant() raises as an error, such as a value of the
wrong JSON type, are reported here as issues.
Details
Errors cover: values of the wrong JSON type; node types; mandatory
properties (encodingFormat and contentUrl of a FileObject,
encodingFormat and includes of a FileSet); a checksum (md5 or
sha256) on each
FileObject that is not contained in another file; @ids that contain
whitespace or repeat; references to nodes that do not exist; sources that
do not name exactly one field, fileObject, or fileSet; fields with
neither source nor value; fields without a data type of their own or
of their source field; record sets that combine several sources without a
join (references); inline data whose records do not match the fields;
arrayShape without isArray or with non-integer dimensions; and
transforms that define no transformation, or more than one string
transformation.
Warnings cover the recommended dataset properties citeAs,
datePublished, license, and version; a missing conformsTo; nodes
without @id, which no other node can reference; record set keys that
name no field; and Croissant terms used as keys without a definition in
the @context.
Examples
x <- Croissant(
name = "example",
distribution = list(FileObject(id = "data.csv", encoding_format = "text/csv"))
)
issues <- validate_croissant(x)
issues#> <CroissantIssues>
#> 2 errors, 4 warnings
#> Errors
#> - [data.csv] The FileObject has no contentUrl, which is mandatory.
#> - [data.csv] The FileObject has neither md5 nor sha256. Add the sha256 checksum of the file at contentUrl.
#> Warnings
#> - [Croissant(example)] The recommended property citeAs is absent.
#> - [Croissant(example)] The recommended property datePublished is absent.
#> - [Croissant(example)] The recommended property license is absent.
#> - [Croissant(example)] The recommended property version is absent.is_valid(issues)#> [1] FALSE