pub struct CardInput {Show 18 fields
pub title: Option<String>,
pub description: Option<String>,
pub license: Option<String>,
pub source: Option<String>,
pub created: Option<String>,
pub version: Option<String>,
pub creators: Vec<Creator>,
pub publisher: Option<Publisher>,
pub canonical_url: Option<String>,
pub sparql_endpoint: Option<String>,
pub source_date: Option<String>,
pub derived_from: Vec<String>,
pub doi: Option<String>,
pub cite_as: Option<String>,
pub keywords: Vec<String>,
pub theme: Vec<String>,
pub extra: BTreeMap<String, Value>,
pub example_queries: Vec<String>,
}Expand description
The curated subset, as supplied by a --card-file JSON document (every field
optional). CLI flags override whatever the file provides. The identity/
provenance fields (version, creators, publisher, canonical_url,
sparql_endpoint, source_date, derived_from, doi, cite_as, keywords, theme)
have no CLI flag — they come from the card file only.
deny_unknown_fields keeps the card file’s top level reserved for
rete-defined fields: a stray key is a loud error (usually a typo, or a
custom field that belongs inside extra), never a silent drop — and it is
what makes the collision guarantee real: a publisher’s field can only ever
live in the bag, so a future official top-level field cannot capture one.
Fields§
§title: Option<String>§description: Option<String>A string, or an array of lines joined with \n — see
crate::card_input::normalize_description. Markdown is allowed here (raw HTML is not); the
array shape exists because hand-writing \n escapes in JSON is awful.
license: Option<String>§source: Option<String>§created: Option<String>§version: Option<String>§creators: Vec<Creator>§publisher: Option<Publisher>§canonical_url: Option<String>§sparql_endpoint: Option<String>§source_date: Option<String>§derived_from: Vec<String>§doi: Option<String>§cite_as: Option<String>§keywords: Vec<String>Free-text keywords (see DatasetCard::keywords).
theme: Vec<String>Controlled-vocabulary theme IRIs (see DatasetCard::theme).
extra: BTreeMap<String, Value>Publisher-defined custom fields (see DatasetCard::extra).
example_queries: Vec<String>Implementations§
Source§impl CardInput
impl CardInput
Sourcepub fn from_json_str(text: &str) -> Result<CardInput, String>
pub fn from_json_str(text: &str) -> Result<CardInput, String>
Parse a curated card document — the JSON a publisher writes for
rete build --card-file, or a client hands its builder — applying the
same write-time rules the CLI applies.
This is the client-side twin of rete-cli’s load_curated, minus the
file read: same deny_unknown_fields top level, same
UNKNOWN_FIELD_HINT pointing a stray key at the extra bag, same
normalize pass afterwards. A Python/R/JS caller
that parses its card this way is held to exactly the rules the CLI and
the browser builder enforce, instead of the “is it an object?” check
those bindings used to do on their own.
Sourcepub fn normalize(self) -> Result<CardInput, String>
pub fn normalize(self) -> Result<CardInput, String>
Canonicalize and bounds-check every curated field — the write-time gate each card-writing path funnels through, applied after any per-field override a caller layered on top of a card file.
The rules themselves live in [crate::card_input]; this is the
serde-typed face of them, so rete build --card-file, the browser
builder and every language binding reject the same documents with the
same words.