Skip to main content

DatasetCard

Struct DatasetCard 

Source
pub struct DatasetCard {
Show 36 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 triple_count: u64, pub quad_count: u64, pub named_graph_count: u64, pub term_count: u64, pub predicates: Vec<(String, u64)>, pub classes: Vec<(String, u64)>, pub vocabularies: Vec<String>, pub example_queries: Vec<String>, pub datatypes: Vec<(String, u64)>, pub languages: Vec<(String, u64)>, pub class_links: Vec<ClassLink>, pub top_hubs: Vec<(String, u64)>, pub in_hubs: Vec<(String, u64)>, pub signals: Signals, pub queries: Vec<ExampleQuery>, pub coherence: Coherence, pub truncated: bool, pub top_n: u32, pub format_version: u8,
}
Expand description

The embeddable dataset card. Curated fields come from rete build flags or a --card-file JSON document; the statistics are derived from the data at build time. Absent optional/empty fields are omitted from the JSON.

Fields§

§title: Option<String>§description: Option<String>§license: Option<String>§source: Option<String>§created: Option<String>§version: Option<String>

The publisher’s dataset version (e.g. a date or semver) — Croissant requires one. One of three distinct versions a .rete carries, each with its own owner, never merged: version (the data, set by the publisher here), format_version (the spec the file conforms to, stamped by the builder), and the builder’s own identity (rete-cli 0.3.2, in the build-info section).

§creators: Vec<Creator>

The people who made the dataset. ORCID as an IRI, not a string, so a card’s creator is joinable against the published ORCID graph.

§publisher: Option<Publisher>

Publishing organisation, with its ROR IRI for the same joinability.

§canonical_url: Option<String>

Where the authoritative copy of THIS file lives (void:dataDump). A .rete found on a disk can then say where to verify against.

§sparql_endpoint: Option<String>

A public SPARQL endpoint serving this dataset (void:sparqlEndpoint).

§source_date: Option<String>

The SOURCE data’s own date (harvest/snapshot), distinct from both the curated created and the build-info timestamp.

§derived_from: Vec<String>

What this file was derived from (prov:wasDerivedFrom): source dumps, upstream .rete shards a merge folded in, an endpoint harvested.

§doi: Option<String>

DOI of the dataset, as an IRI (https://doi.org/…).

§cite_as: Option<String>

Preferred citation text.

§keywords: Vec<String>

Free-text keywords/tags describing the dataset. First-class rather than an extra entry because keywords carry agreed meaning: dcat:keyword and schema:keywords are long-standing terms (DCAT-AP catalogs require the former; dataset-search harvesters read the latter), and the bag’s contract is precisely the absence of a term — it projects as opaque values. Canonicalized by crate::card_input::normalize_string_list at build time: trimmed, sorted, deduplicated — dcat:keyword is an unordered repeated property, so sorting loses nothing and keeps the card’s bytes (hence the reproducible content hash) independent of authoring order.

§theme: Vec<String>

Curated themes — IRIs into a controlled vocabulary (dcat:theme, e.g. the EU data-theme authority). IRIs are required (crate::card_input::normalize_themes): a free-text theme is a keyword by another name and belongs in keywords — the IRI into an agreed scheme is exactly what makes dcat:theme worth a separate field. Sorted/deduplicated like keywords.

§extra: BTreeMap<String, Value>

Publisher-defined custom fields — one bounded, reserved bag. Anything under extra is by definition not a rete-defined field: official card fields are only ever added at the top level (which CardInput keeps reserved by rejecting unknown keys), so a future release can never collide with a publisher’s key. Curated input, so the bag folds into the content hash; crate::card_input::normalize_extra canonicalizes (sorts) nested object keys and enforces the CARD_EXTRA_* bounds at build time. Readers accept whatever is present — the limits bite when writing, never when reading.

§triple_count: u64§quad_count: u64§named_graph_count: u64§term_count: u64§predicates: Vec<(String, u64)>§classes: Vec<(String, u64)>§vocabularies: Vec<String>§example_queries: Vec<String>§datatypes: Vec<(String, u64)>

DATATYPE(o) histogram over literal objects, descending by count. Keys are bracketed datatype IRIs (<…#integer>, <…#langString> for @lang).

§languages: Vec<(String, u64)>

LANG(o) histogram over literal objects, descending by count. The empty string "" counts untagged/typed literals.

§class_links: Vec<ClassLink>

The effective schema: (s_class, predicate, o_class, count) over the default graph, the same quotient as crate::schema_summary. Object classes use the (literal)/(untyped) sentinels of that function.

§top_hubs: Vec<(String, u64)>

Top subjects by out-degree (how many statements they make), descending.

§in_hubs: Vec<(String, u64)>

Top non-literal objects by in-degree (how often referenced), descending.

§signals: Signals

Detected affordances — which exploration query families the data supports and the vocabulary to instantiate them with.

§queries: Vec<ExampleQuery>

Auto-generated, tiered starter-query library — vetted SPARQL with the dataset’s own vocabulary substituted in, each tagged with the cheapest tier that can answer it. The cold-start “what do I ask?” fix.

§coherence: Coherence

OWL RL / RDFS coherence verdict, stamped at build time by --reason. Lets a remote reader learn the graph’s coherence from the index-free card with zero compute; rete reason --verify-card recomputes it to guard against drift.

§truncated: bool

Set iff any capped list was actually truncated (the profile is partial).

§top_n: u32

The top-N cap the profile lists were derived under — the number truncated: true was hinting at without stating. 0 (omitted) on cards whose profile was never derived (external builds, pre-existing cards).

§format_version: u8

The .rete spec version the file was written against (currently 5). The format’s version — not the dataset’s (the curated version above) and not the builder’s (builder in build-info).

Implementations§

Source§

impl DatasetCard

Source

pub fn to_json_bytes(&self) -> Vec<u8> ⓘ

Serialize to the JSON bytes stored in the metadata section (compact).

Signals::text_index is stripped on the way out: it is measured from the file’s section directory at read time, and a copy inside the hashed metadata section would be a claim that can outlive the sections it describes (rete repyramid --text-index rewrites them). Stripping here — the single choke point every card-writing command funnels through — is what makes “derived, never authored” true of the bytes and not only of the intent. (CardInput has no signals field and rejects unknown keys, so a hand-written card file cannot set it either.)

Source

pub fn observe_text_index( &mut self, measured: TextIndexSignal, ) -> Option<TextIndexSignal>

Attach the read-time TextIndexSignal, returning whatever the card’s own bytes claimed before it (normally None — the writers strip it).

A Some(_) return is drift: a card asserting a full-text index that no longer has to be believed, because the file itself was just measured. rete card-audit reports it.

Source

pub fn observe_permutations( &mut self, measured: PermutationsSignal, ) -> Option<PermutationsSignal>

Attach the read-time PermutationsSignal. Same contract as observe_text_index: a Some(_) return is a card whose bytes claimed a permutation set, which the writers strip and CardInput cannot author.

Source

pub fn observe_quoted_triples( &mut self, measured: QuotedTriplesSignal, ) -> Option<QuotedTriplesSignal>

Attach the read-time QuotedTriplesSignal. Same contract as observe_permutations: the writers strip it and CardInput cannot author it, so a Some(_) return is a card whose bytes claimed something about the file’s own header.

Source

pub fn from_json_bytes(b: &[u8]) -> Result<Self, String>

Parse a card from the metadata-section bytes.

The error is a plain String, like every other message in the card modules: the CLI wraps it in anyhow, the wasm build hands it to JavaScript, and neither needs a dependency on the other’s error type.

Source

pub fn with_coherence(self, r: &Reasoning, materialized: bool) -> Self

Stamp the build-time coherence verdict (consuming builder).

Source

pub fn with_final_counts(self, counts: FinalCounts) -> Self

Replace the derived sizes with the counts the file was actually written with (consuming builder).

A card is derived from the ingested statements, which is the input multiset; the file holds that multiset deduplicated, because every permutation index sorts and dedups. The two agree for input with no duplicates — and only then, which is why rete card used to report the raw harvest size of any dataset paged with overlapping windows while rete info reported the real one. The header’s count is authoritative; this is how it reaches the card. See crate::FinalCounts.

The distributions (predicate/class histograms, hub degrees) stay over the derived multiset — they are shapes, not sizes.

Trait Implementations§

Source§

impl Clone for DatasetCard

Source§

fn clone(&self) -> Self

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 DatasetCard

Source§

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

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

impl Default for DatasetCard

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for DatasetCard

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for DatasetCard

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DatasetCard

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DatasetCard

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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