Skip to main content

Graph

Struct Graph 

Source
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

Source

pub fn new(bytes: &[u8]) -> Result<Graph, JsValue>

Open a .rete image and keep it resident for repeated querying.

Source

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.

Source

pub fn info(&self) -> String

See info.

Source

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

Source

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

See query.

Source

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).

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: 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).

Source

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.

Source

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.

Source

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.

Source

pub fn query_triples( &self, subject: Option<String>, predicate: Option<String>, object: Option<String>, ) -> Result<String, JsValue>

Source

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.

Source

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.

Source

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.

Source

pub fn why_triples( &self, subject: Option<String>, predicate: Option<String>, object: Option<String>, ) -> Result<String, JsValue>

Source

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

See schema — the live (scanning) profile; prefer schema_packed when the file carries a pyramid.

Source

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.

Source

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

See card — the Dataset Card of the resident file.

Source

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.

Source

pub fn query_communities( &self, query: &str, round: Option<usize>, ) -> Result<String, JsValue>

Source

pub fn reach( &self, predicate: &str, seeds: &str, reverse: bool, ) -> Result<String, JsValue>

See reach.

Source

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

See shacl.

Source

pub fn reason(&self, graph: Option<String>) -> String

See reason.

Source

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

Source

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

Trait Implementations§

Source§

impl From<Graph> for JsValue

Source§

fn from(value: Graph) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for Graph

Source§

type Abi = WasmPtr<WasmRefCell<Graph>>

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 Graph

Source§

type Abi = WasmPtr<WasmRefCell<Graph>>

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 Graph

Source§

type Abi = WasmPtr<WasmRefCell<Graph>>

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRef<Graph>

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 Graph

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 Graph

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 Graph

Source§

type Abi = WasmPtr<WasmRefCell<Graph>>

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

type Anchor = RcRef<Graph>

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 Graph

Source§

type Abi = WasmPtr<WasmRefCell<Graph>>

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRefMut<Graph>

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 Graph

Source§

impl SupportsInstanceProperty for Graph

Source§

impl SupportsStaticProperty for Graph

Source§

impl TryFromJsValue for Graph

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 Graph

Source§

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

Source§

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

Source§

impl VectorIntoWasmAbi for Graph

Source§

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

Source§

fn vector_into_abi(vector: Box<[Graph]>) -> Self::Abi

Source§

impl WasmDescribe for Graph

Source§

impl WasmDescribeVector 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> 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