Abstractions over a graph object, intended to sit alongside the other basic clojure data structures such as maps, vectors and sets.
Abstractions over a graph object, intended to sit alongside the other basic clojure data structures such as maps, vectors and sets.
No vars found in this namespace.
Implementation of a simple graph type implementing IGraph.
On typically adds to it with [[s
p
o
]...].
One queries it with a simple graph pattern of the form [[s
p
o
]...]
With variables of the form :?x.
The core type declaration:
(deftype Graph [schema contents]
IGraph
(normal-form [g] (.contents g))
(subjects [g] (lazy-seq (keys (.contents g))))
(get-p-o [g s] (get (.contents g) s))
(get-o [g s p] (get-in (.contents g) [s p]))
(ask [g s p o] (get-in (.contents g) [s p o]))
(query [g q] (query-graph g q))
(add [g to-add] (add-to-graph g to-add))
(subtract [g to-subtract] (remove-from-graph g to-subtract))
clojure.lang.IFn
(invoke [g] (normal-form g))
(invoke [g s] (get-p-o g s))
(invoke [g s p] (match-or-traverse g s p))
(invoke [g s p o] (match-or-traverse g s p o))
IGraphSet
(union [g1 g2] (add-to-graph g1 (g2)))
(intersection [g1 g2] (get-intersection g1 g2))
(difference [g1 g2] (remove-from-graph g1 (g2)))
)
Implementation of a simple graph type implementing IGraph. On typically adds to it with [[`s` `p` `o`]...]. One queries it with a simple graph pattern of the form [[`s` `p` `o`]...] With variables of the form :?x. The core type declaration: ``` (deftype Graph [schema contents] IGraph (normal-form [g] (.contents g)) (subjects [g] (lazy-seq (keys (.contents g)))) (get-p-o [g s] (get (.contents g) s)) (get-o [g s p] (get-in (.contents g) [s p])) (ask [g s p o] (get-in (.contents g) [s p o])) (query [g q] (query-graph g q)) (add [g to-add] (add-to-graph g to-add)) (subtract [g to-subtract] (remove-from-graph g to-subtract)) clojure.lang.IFn (invoke [g] (normal-form g)) (invoke [g s] (get-p-o g s)) (invoke [g s p] (match-or-traverse g s p)) (invoke [g s p o] (match-or-traverse g s p o)) IGraphSet (union [g1 g2] (add-to-graph g1 (g2))) (intersection [g1 g2] (get-intersection g1 g2)) (difference [g1 g2] (remove-from-graph g1 (g2))) ) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close