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: SignalsDetected 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: CoherenceOWL 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: boolSet iff any capped list was actually truncated (the profile is partial).
top_n: u32The 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: u8The .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
impl DatasetCard
Sourcepub fn to_json_bytes(&self) -> Vec<u8> ⓘ
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.)
Sourcepub fn observe_text_index(
&mut self,
measured: TextIndexSignal,
) -> Option<TextIndexSignal>
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.
Sourcepub fn observe_permutations(
&mut self,
measured: PermutationsSignal,
) -> Option<PermutationsSignal>
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.
Sourcepub fn observe_quoted_triples(
&mut self,
measured: QuotedTriplesSignal,
) -> Option<QuotedTriplesSignal>
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.
Sourcepub fn from_json_bytes(b: &[u8]) -> Result<Self, String>
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.
Sourcepub fn with_coherence(self, r: &Reasoning, materialized: bool) -> Self
pub fn with_coherence(self, r: &Reasoning, materialized: bool) -> Self
Stamp the build-time coherence verdict (consuming builder).
Sourcepub fn with_final_counts(self, counts: FinalCounts) -> Self
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
impl Clone for DatasetCard
Source§impl Debug for DatasetCard
impl Debug for DatasetCard
Source§impl Default for DatasetCard
impl Default for DatasetCard
Source§impl<'de> Deserialize<'de> for DatasetCard
impl<'de> Deserialize<'de> for DatasetCard
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DatasetCard
impl PartialEq for DatasetCard
Source§impl Serialize for DatasetCard
impl Serialize for DatasetCard
impl StructuralPartialEq for DatasetCard
Auto Trait Implementations§
impl Freeze for DatasetCard
impl RefUnwindSafe for DatasetCard
impl Send for DatasetCard
impl Sync for DatasetCard
impl Unpin for DatasetCard
impl UnsafeUnpin for DatasetCard
impl UnwindSafe for DatasetCard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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