pub struct Graph { /* private fields */ }Expand description
A .rete opened once and kept resident, so a client (the playground’s
cached/in-memory mode) can run many queries on a big file without re-copying
the whole buffer into wasm and re-decoding its dictionary on every call. The
methods mirror the free functions above but operate on the already-open
Rete. The few index-free readers (schema_packed, progressive_query,
check_schema) stay free functions — they read small ranges from the buffer
and are called rarely (once at load / on demand), so a handle buys little.
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn new(bytes: &[u8]) -> Result<Graph, JsValue>
pub fn new(bytes: &[u8]) -> Result<Graph, JsValue>
Open a .rete image and keep it resident for repeated querying.
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
A lazy, resumable cursor over the quads of this graph — the streaming
export path. See QuadCursor; graph selects one graph ("" = the
default graph), None streams the default graph followed by every named
graph. s / p / o optionally restrict the dump to a triple pattern,
which prunes tiles rather than filtering rows.
Sourcepub fn graph_names(&self) -> Result<String, JsValue>
pub fn graph_names(&self) -> Result<String, JsValue>
See graph_names.
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 (rdfs:subClassOf /
subPropertyOf / domain / range reasoning by query rewriting).
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: reason (OWL 2 QL
entailment) and union_default (union default graph — a pattern
outside GRAPH matches the merge of the default graph and every named
graph, the Virtuoso / GraphDB / Jena TDB mode; non-standard, so plain
Graph::query never does this).
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>
Run a SELECT to a result handle: the rows stay dictionary ids and
QueryRows::page decodes a window on demand. See QueryRows.
Sourcepub fn partition_plan(&self, query: &str, var: &str) -> Result<String, JsValue>
pub fn partition_plan(&self, query: &str, var: &str) -> Result<String, JsValue>
Plan running query as chunks split by the values of var — see
rete_core::partition_plan. JSON {var, form, keys_query, keys_from_where, offset, limit, dedupe}, or an error saying why the
split would change the answer.
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>
One chunk of a split query: the solutions whose var is one of keys
(term tokens, as the plan’s keys query returned them), without the
query’s top-level OFFSET/LIMIT. Same envelope as Graph::query.
Sourcepub fn query_triples(
&self,
subject: Option<String>,
predicate: Option<String>,
object: Option<String>,
) -> Result<String, JsValue>
pub fn query_triples( &self, subject: Option<String>, predicate: Option<String>, object: Option<String>, ) -> Result<String, JsValue>
See query_triples.
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.
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.
Sourcepub fn text_index_len(&self) -> f64
pub fn text_index_len(&self) -> f64
Byte length of the TEXT_INDEX section, 0 when the file has none — a
header read, never a fault. The UI asks this to decide whether to offer
full-text search at all, and to state the cost before the first one.
f64 because the section outgrows u32: causenet’s is 1.88 GB.
Sourcepub fn text_index_token_table_len(&self) -> f64
pub fn text_index_token_table_len(&self) -> f64
Byte length of the TEXT_INDEX’s leading token table — what a first
Graph::text_search_one actually faults, and therefore the only honest
number to quote as its cost. Graph::text_index_len is the whole
section, postings blob included, and overstates it 6.5× on
epfl-infoscience (195 MB section, 29 MB token table); the postings are
only ever fetched one list at a time. 0 when the file has no text index
or the length could not be read — the caller must then say nothing about
a token table rather than pass the section length off as one.
f64 for the same reason as the section length: causenet’s table is
1.88 GB.
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>
Graph::text_search from ONE phrase: whitespace splits it into words
and every word must match (AND), like rete search --contains a b.
One string in, one string out — that is what the remote twin’s
hand-marshaled asyncify path can carry (a JS array marshaled raw is what
traps), and the UI is a single text box either way. Same JSON envelope.
Sourcepub fn why_triples(
&self,
subject: Option<String>,
predicate: Option<String>,
object: Option<String>,
) -> Result<String, JsValue>
pub fn why_triples( &self, subject: Option<String>, predicate: Option<String>, object: Option<String>, ) -> Result<String, JsValue>
See why_triples.
Sourcepub fn schema(&self) -> Result<String, JsValue>
pub fn schema(&self) -> Result<String, JsValue>
See schema — the live (scanning) profile; prefer schema_packed when
the file carries a pyramid.
Sourcepub fn quoted_triples_signal(&self) -> String
pub fn quoted_triples_signal(&self) -> String
The card’s signals.quoted_triples for this file, from its header: does
it hold quoted triples, and in which surfaces can an export write them.
Sourcepub fn card_and_build(&self) -> String
pub fn card_and_build(&self) -> String
See card_and_build — the card and the build record of the resident
file, in the same envelope the remote path returns, so one caller
handles both sources.
Sourcepub fn query_communities(
&self,
query: &str,
round: Option<usize>,
) -> Result<String, JsValue>
pub fn query_communities( &self, query: &str, round: Option<usize>, ) -> Result<String, JsValue>
See query_communities.
Sourcepub fn reach(
&self,
predicate: &str,
seeds: &str,
reverse: bool,
) -> Result<String, JsValue>
pub fn reach( &self, predicate: &str, seeds: &str, reverse: bool, ) -> Result<String, JsValue>
See reach.
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.
Sourcepub fn pyramid_tree(&self) -> Result<String, JsValue>
pub fn pyramid_tree(&self) -> Result<String, JsValue>
See pyramid_tree.
Sourcepub fn file_layout(&self) -> Result<String, JsValue>
pub fn file_layout(&self) -> Result<String, JsValue>
See file_layout.
Trait Implementations§
Source§impl FromWasmAbi for Graph
impl FromWasmAbi for Graph
Source§impl IntoWasmAbi for Graph
impl IntoWasmAbi for Graph
Source§impl LongRefFromWasmAbi for Graph
impl LongRefFromWasmAbi for Graph
Source§impl OptionFromWasmAbi for Graph
impl OptionFromWasmAbi for Graph
Source§impl OptionIntoWasmAbi for Graph
impl OptionIntoWasmAbi for Graph
Source§impl RefFromWasmAbi for Graph
impl RefFromWasmAbi for Graph
Source§type Abi = WasmPtr<WasmRefCell<Graph>>
type Abi = WasmPtr<WasmRefCell<Graph>>
Self are recovered from.Source§impl RefMutFromWasmAbi for Graph
impl RefMutFromWasmAbi for Graph
impl SupportsConstructor for Graph
impl SupportsInstanceProperty for Graph
impl SupportsStaticProperty for Graph
Source§impl TryFromJsValue for Graph
impl TryFromJsValue for Graph
Source§impl VectorFromWasmAbi for Graph
impl VectorFromWasmAbi for Graph
Source§impl VectorIntoWasmAbi for Graph
impl VectorIntoWasmAbi for Graph
Auto Trait Implementations§
impl !RefUnwindSafe for Graph
impl !Send for Graph
impl !Sync for Graph
impl !UnwindSafe for Graph
impl Forget for Graph
impl Freeze for Graph
impl Move for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
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.