Skip to main content

CardInput

Struct CardInput 

Source
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

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for CardInput

Source§

fn clone(&self) -> CardInput

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CardInput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for CardInput

Source§

fn default() -> CardInput

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for CardInput

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<CardInput, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V