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
impl RemoteGraph
Sourcepub fn new(url: &str) -> Result<RemoteGraph, JsValue>
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.
Sourcepub fn quads(
&self,
graph: Option<String>,
s: Option<String>,
p: Option<String>,
o: Option<String>,
) -> QuadCursor
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.
Sourcepub fn stats(&self) -> String
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.
Sourcepub fn content_hash(&self) -> String
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.
Sourcepub fn query(&self, query: &str, format: &str) -> Result<String, JsValue>
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).
Sourcepub fn query_reasoned(
&self,
query: &str,
format: &str,
) -> Result<String, JsValue>
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).
Sourcepub fn query_opts(
&self,
query: &str,
format: &str,
reason: bool,
union_default: bool,
) -> Result<String, JsValue>
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).
Sourcepub fn query_rows(
&self,
query: &str,
reason: bool,
union_default: bool,
) -> Result<QueryRows, JsValue>
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.
Sourcepub fn partition_plan(&self, query: &str, var: &str) -> Result<String, JsValue>
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.
Sourcepub fn query_partition(
&self,
query: &str,
format: &str,
reason: bool,
var: &str,
keys: Vec<String>,
) -> Result<String, JsValue>
pub fn query_partition( &self, query: &str, format: &str, reason: bool, var: &str, keys: Vec<String>, ) -> Result<String, JsValue>
Sourcepub fn prefix_search(
&self,
prefix: &str,
limit: usize,
) -> Result<String, JsValue>
pub fn prefix_search( &self, prefix: &str, limit: usize, ) -> 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.
Sourcepub fn text_search(
&self,
words: Vec<String>,
contains_prefix: Option<String>,
limit: usize,
) -> Result<String, JsValue>
pub fn text_search( &self, words: Vec<String>, contains_prefix: Option<String>, limit: usize, ) -> Result<String, JsValue>
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.
Sourcepub fn text_index_len(&self) -> f64
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.
Sourcepub fn text_index_token_table_len(&self) -> f64
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.
Sourcepub fn text_search_one(
&self,
phrase: &str,
limit: usize,
) -> Result<String, JsValue>
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.
Sourcepub fn quoted_triples_signal(&self) -> String
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.
Sourcepub fn card(&self) -> Result<Option<String>, JsValue>
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).
Sourcepub fn card_and_build(&self) -> Result<String, JsValue>
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).
Sourcepub fn schema(&self) -> Result<String, JsValue>
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.
Sourcepub fn graph_names(&self) -> Result<String, JsValue>
pub fn graph_names(&self) -> Result<String, JsValue>
See graph_names.
Sourcepub fn shacl(
&self,
shapes_turtle: &str,
graph: Option<String>,
format: &str,
) -> Result<String, JsValue>
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
impl From<RemoteGraph> for JsValue
Source§fn from(value: RemoteGraph) -> Self
fn from(value: RemoteGraph) -> Self
Source§impl FromWasmAbi for RemoteGraph
impl FromWasmAbi for RemoteGraph
Source§impl IntoWasmAbi for RemoteGraph
impl IntoWasmAbi for RemoteGraph
Source§impl LongRefFromWasmAbi for RemoteGraph
impl LongRefFromWasmAbi for RemoteGraph
Source§type Abi = WasmPtr<WasmRefCell<RemoteGraph>>
type Abi = WasmPtr<WasmRefCell<RemoteGraph>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<RemoteGraph>
type Anchor = RcRef<RemoteGraph>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for RemoteGraph
impl OptionFromWasmAbi for RemoteGraph
Source§impl OptionIntoWasmAbi for RemoteGraph
impl OptionIntoWasmAbi for RemoteGraph
Source§impl RefFromWasmAbi for RemoteGraph
impl RefFromWasmAbi for RemoteGraph
Source§type Abi = WasmPtr<WasmRefCell<RemoteGraph>>
type Abi = WasmPtr<WasmRefCell<RemoteGraph>>
Self are recovered from.Source§type Anchor = RcRef<RemoteGraph>
type Anchor = RcRef<RemoteGraph>
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§impl RefMutFromWasmAbi for RemoteGraph
impl RefMutFromWasmAbi for RemoteGraph
Source§type Abi = WasmPtr<WasmRefCell<RemoteGraph>>
type Abi = WasmPtr<WasmRefCell<RemoteGraph>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<RemoteGraph>
type Anchor = RcRefMut<RemoteGraph>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for RemoteGraph
impl SupportsInstanceProperty for RemoteGraph
impl SupportsStaticProperty for RemoteGraph
Source§impl TryFromJsValue for RemoteGraph
impl TryFromJsValue for RemoteGraph
Source§impl VectorFromWasmAbi for RemoteGraph
impl VectorFromWasmAbi for RemoteGraph
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[RemoteGraph]>
Source§impl VectorIntoWasmAbi for RemoteGraph
impl VectorIntoWasmAbi for RemoteGraph
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[RemoteGraph]>) -> Self::Abi
Source§impl WasmDescribeVector for RemoteGraph
impl WasmDescribeVector for RemoteGraph
Auto Trait Implementations§
impl !RefUnwindSafe for RemoteGraph
impl !Send for RemoteGraph
impl !Sync for RemoteGraph
impl !UnwindSafe for RemoteGraph
impl Forget for RemoteGraph
impl Freeze for RemoteGraph
impl Move for RemoteGraph
impl Unpin for RemoteGraph
impl UnsafeUnpin for RemoteGraph
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
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.