Skip to main content

RemoteGraph

Struct RemoteGraph 

Source
pub struct RemoteGraph { /* private fields */ }
Expand description

A remote .rete opened once over HTTP range and kept resident in the worker, so repeated queries on the same URL reuse (a) the block cache — any 64 KiB block fetched once is served from memory by BlockCacheReader — and (b) the lazily faulted index tiles + decoded dictionary chunks that live inside the resident Rete. The free sparql_url re-opens the file on every call, so its block cache dies after one query; this handle keeps it. The counting reader stays reachable so the worker can read cumulative bytes/requests and show how little a cache-hit query actually fetched. Worker-only (synchronous range-read XHR).

Implementations§

Source§

impl RemoteGraph

Source

pub fn new(url: &str) -> Result<RemoteGraph, JsValue>

Open a remote .rete over HTTP range and keep it resident for repeated querying. The first query faults in the dictionary chunks + index tiles it needs; later queries on this handle reuse them and the block cache.

Source

pub fn quads( &self, graph: Option<String>, s: Option<String>, p: Option<String>, o: Option<String>, ) -> QuadCursor

See Graph::quads — the SAME lazy cursor, over the lazily range-read remote handle.

An unfiltered dump is not network-lazy and cannot be: it resolves every term and visits every tile, so it ends up fetching essentially the whole file (and what it faults stays resident). A filtered one is: pass s / p / o and the scan routes to one permutation, keeps only the tiles whose synopsis admits the bound components, and fetches those. On cordis.rete (801 MB) one predicate of one named graph costs 16 MB instead of 376 MB. To peek at an unfiltered graph, still prefer a LIMIT query. Worker-only in the browser, like every other read here.

Source

pub fn stats(&self) -> String

{ fileLength, bytes, requests, base } — CUMULATIVE physical fetches since this session opened. The worker diffs successive calls to report a single query’s traffic (a fully cached re-run adds ~0). fileLength is the graph’s length and base the byte offset it starts at: 0 for an ordinary .rete, and the size of the HTML shell for a polyglot file.

Source

pub fn content_hash(&self) -> String

The file’s content hash (blake3-16, hex). The worker keys its session cache by this rather than the URL, so two URLs of the same file share the cache — and it’s the stable key a future IndexedDB block store (L3) needs to survive page reloads.

Source

pub fn query(&self, query: &str, format: &str) -> Result<String, JsValue>

See sparql_url — same query, but over the resident, cached handle. The incompleteness verdict is PER QUERY: reset the sticky failure flags first, so one transient fetch failure fails only the query it happened in — not every later query on this session (failed tiles/chunks are never cached, so they retry here).

Source

pub fn query_reasoned( &self, query: &str, format: &str, ) -> Result<String, JsValue>

As query, with OWL 2 QL entailment on (reason over the ontology while reading only the bytes the rewritten query touches).

Source

pub fn query_opts( &self, query: &str, format: &str, reason: bool, union_default: bool, ) -> Result<String, JsValue>

As query, with explicit opt-in toggles — see Graph::query_opts. With union_default on, a lazy remote read may fault the index tiles of every named graph the union touches (the merge is strictly opt-in).

Source

pub fn query_rows( &self, query: &str, reason: bool, union_default: bool, ) -> Result<QueryRows, JsValue>

See Graph::query_rows. The query’s reads happen here; each QueryRows::page then reads the dictionary chunks of its own terms.

Source

pub fn partition_plan(&self, query: &str, var: &str) -> Result<String, JsValue>

See Graph::partition_plan. Reads the dictionary entries of the query’s constants and the resident tile directory — no tile data.

Source

pub fn query_partition( &self, query: &str, format: &str, reason: bool, var: &str, keys: Vec<String>, ) -> Result<String, JsValue>

See prefix_search — over the resident, cached remote handle. Faults the pyramid (where the label index lives) on the first call, then serves the search from memory.

See text_search — over the resident remote handle. Faults the TEXT_INDEX token table on the first call, then fetches only the queried posting lists (never the whole postings blob), serving repeat searches from memory.

Source

pub fn text_index_len(&self) -> f64

See Graph::text_index_len — read from the resident header, so it costs no fetch at all. Worth asking before RemoteGraph::text_search: it is the size of the section the first search starts pulling over the wire, so the UI can warn instead of surprising the user.

Source

pub fn text_index_token_table_len(&self) -> f64

See Graph::text_index_token_table_len — the figure to quote before RemoteGraph::text_search, because it is what that first search pulls over the wire; the section length would promise the user several times the real bill.

Unlike RemoteGraph::text_index_len this is not free: the token table’s length lives in the section’s first bytes, not the header, so it costs ONE ≤10-byte range read (memoized). Trivial next to the table it measures — but it is IO, so the asyncify path must drive this call rather than treat it as a header field.

Source

pub fn text_search_one( &self, phrase: &str, limit: usize, ) -> Result<String, JsValue>

See Graph::text_search_one — over the resident remote handle, with the same token-table-then-posting-lists fault pattern as RemoteGraph::text_search. This is the shape the playground’s raw asyncify glue drives: one string in, one string out, marshaled once.

Source

pub fn quoted_triples_signal(&self) -> String

See Graph::quoted_triples_signal — from the header the open already holds, so no range read at all.

Source

pub fn card(&self) -> Result<Option<String>, JsValue>

See card_url — the Dataset Card, over the resident handle’s reader (so the header range it already fetched is served from the block cache).

Source

pub fn card_and_build(&self) -> Result<String, JsValue>

See card_and_build_url — card + build record over the resident handle’s reader, still one coalesced range (and served from the block cache when the header range is already there).

Source

pub fn schema(&self) -> Result<String, JsValue>

See schema_url — the baked schema pyramid over the resident handle. Deliberately never falls back to the scanning schema: that would drag the whole remote file across the wire.

Source

pub fn info(&self) -> String

See info — read from the resident header, no extra fetch.

Source

pub fn graph_names(&self) -> Result<String, JsValue>

Source

pub fn shacl( &self, shapes_turtle: &str, graph: Option<String>, format: &str, ) -> Result<String, JsValue>

See shacl_url — validate over the resident handle. The default graph validates lazily against the index (only the shapes’ targets are fetched), so a shape over a huge remote file stays cheap.

Trait Implementations§

Source§

impl From<RemoteGraph> for JsValue

Source§

fn from(value: RemoteGraph) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for RemoteGraph

Source§

type Abi = WasmPtr<WasmRefCell<RemoteGraph>>

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl IntoWasmAbi for RemoteGraph

Source§

type Abi = WasmPtr<WasmRefCell<RemoteGraph>>

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl LongRefFromWasmAbi for RemoteGraph

Source§

type Abi = WasmPtr<WasmRefCell<RemoteGraph>>

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRef<RemoteGraph>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl OptionFromWasmAbi for RemoteGraph

Source§

fn is_none(abi: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl OptionIntoWasmAbi for RemoteGraph

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl RefFromWasmAbi for RemoteGraph

Source§

type Abi = WasmPtr<WasmRefCell<RemoteGraph>>

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = RcRef<RemoteGraph>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous.
Source§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl RefMutFromWasmAbi for RemoteGraph

Source§

type Abi = WasmPtr<WasmRefCell<RemoteGraph>>

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRefMut<RemoteGraph>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl SupportsConstructor for RemoteGraph

Source§

impl SupportsInstanceProperty for RemoteGraph

Source§

impl SupportsStaticProperty for RemoteGraph

Source§

impl TryFromJsValue for RemoteGraph

Source§

fn try_from_js_value(value: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

fn try_from_js_value_ref(value: &JsValue) -> Option<Self>

Performs the conversion.
Source§

impl VectorFromWasmAbi for RemoteGraph

Source§

type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi

Source§

unsafe fn vector_from_abi(js: Self::Abi) -> Box<[RemoteGraph]>

Source§

impl VectorIntoWasmAbi for RemoteGraph

Source§

impl WasmDescribe for RemoteGraph

Source§

impl WasmDescribeVector for RemoteGraph

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> 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> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

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

Source§

fn vzip(self) -> V