Expand description

For querying data. Describe groups of entity-attribute-value triples and constraints to search.

Suppose you want:

?b :book/title "The Complete Calvin and Hobbes"
?r :review/book ?b
?r :review/user ?u
?r :review/score 1

But now imagine it like:

                +---+
                | e |<-
 :review/user<->| a |  \  
                | v |   \  +---+   ->:review/book
                +---+    ->| e |  /
                        /  | a |<-    +---+
                +---+  /   | v |<---->| e |
                | e |<-    +---+      | a |<->:book/title
:review/score<->| a |                 | v |<->"The Complete Calvin and Hobbes"
            1<->| v |                 +---+
                +---+             

That’s a Network, each block is a group of database Triples, the lines are constraints defining what data the triples can match.

This is how you might use the API to build that Network.

let mut network: Network = Default::default();
// ?b :book/title "The Complete Calvin and Hobbes"
let b = network
    .fluent_triples()
    .match_attribute(AttributeRef::from_static(":book/title"))
    .match_value("The Complete Calvin and Hobbes")
    .entity();
// ?r :review/book ?b
let r = network
    .fluent_triples()
    .match_attribute(AttributeRef::from_static(":review/book"))
    .link_value(b)
    .entity();
// ?r :review/user ?u
let u = network
    .fluent_triples()
    .link_entity(r)
    .match_attribute(AttributeRef::from_static(":review/user"))
    .value();
// ?r :review/score 1
network
    .fluent_triples()
    .link_entity(r)
    .match_attribute(AttributeRef::from_static(":review/book"))
    .match_value(1)
    .entity();

Structs

A plan or projection of entity-attribute-value sets with constraints between them.

Enums

Type Definitions

A borrowing type alias for GenericNetwork using ValueRef.

A owning types alias for GenericNetwork using Value.