Expand description

A higher-level way of adding constraints to a GenericNetwork.

NamedNetwork is just a network paired with a list of variables that map to triples-fields in the network.

NamedNetwork::add_pattern allows adding a constraint from a Pattern which can be parsed from a string. See crate::types::parse_value on how parsing is attempted.

let mut network = NamedNetwork::<ValueRef>::default();
let pattern = r#"?p :pet/name "Garfield""#
        .borrowed_parse()
        .expect("parse pattern");
assert_eq!(
    pattern,
    Pattern {
        entity: Left(Variable::Unify("?p")),
        attribute: Right(Value::Attribute(Attribute::from_static(":pet/name"))),
        value: Right(Value::Text("Garfield".to_owned())),
    }
);
network.add_pattern(&pattern);

One nice thing about this is that variables are automatically unified.

So if I add another pattern ?p :animal/name "Cat", there will be a constraint linking the ?p variables together.

Also, a GenericNetwork specifies the FROM clause of a SELECT in SQL, everything else goes on to a Select object that can be returned by GenericNetwork::select().

A Select has crate::sql::PushToQuery::to_query returning a crate::sql::Query. And you can execute a crate::sql::Query with crate::sql::Query::disperse. (There should be an example of this at the root of the documentation in lib.rs.)

See the dispersal module about executing a query and reading data back from SQLite.


“I need some information.”

“This is Information Retrieval, not Information Dispersal.”

Structs

A GenericNetwork paired with Names to associate variables to their first occurrence in a network.

A mapping of names or variables to the TriplesField of their location in a network.

A data structure for specifying high-level constraints with NamedNetwork::add_pattern.

LIMIT, ORDER BY, and SELECT clauses forming an entire SELECT statement. Needed to actually query for stuff using a GenericNetwork.

Enums

Functions