Liking cljdoc? Tell your friends :D

ont-app.igraph.graph

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 [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 [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)))
  )
```
raw docstring

ont-app.igraph.test-support

These are tests that should be applicable to implemenations of the IGraph protocols. Most examples are drawn from the README. After running tests, query-for-failures should be empty.

These are tests that should be applicable to implemenations of the IGraph protocols. Most examples are drawn from the README. After running tests, query-for-failures should be empty.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close