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

cljc-lazy-seqclj/s

source

get-contentsclj/s

(get-contents g)

Returns (.contents g) or (.-contents g) appropriate to clj/cljs

Returns (.contents g) or (.-contents g) appropriate to clj/cljs
sourceraw docstring

Graphcljs

source

make-graphclj/s

(make-graph & {:keys [contents] :or {contents {}}})

Returns graph, intialized per optional contents Where

  • graph is an instance of the Graph type, which implments IGraph, Ifn and ISet
  • contents is a normal-form representation of initial contents. SEE ALSO: igraph/normal-form.
Returns `graph`, intialized per optional `contents`
Where
-   `graph` is an instance of the `Graph` type, which implments `IGraph`, `Ifn` and `ISet`
-   `contents` is a normal-form representation of initial contents.
SEE ALSO: igraph/normal-form.
sourceraw docstring

query-graphclj/s

(query-graph g graph-pattern)
(query-graph g graph-pattern query-var?)

Returns #{binding...} for graph-pattern applied to g Where

  • g is a Graph
  • graph-pattern := [[var-or-value var-or-value var-or-value]...]
  • var-or-value is in #{var value}
  • var is a keyword whose name begins with '?'
  • value is a value which must match an element of g exactly.
  • binding := {var matching-value, ...}
  • matching-value matches var within graph-pattern applied to g
Returns #{`binding`...} for `graph-pattern` applied to `g`
Where
-   `g` is a Graph
-   `graph-pattern` := [[`var-or-value` `var-or-value` `var-or-value`]...]
-   `var-or-value` is in #{`var` `value`}
-   `var` is a keyword whose name begins with '?'
-   `value` is a value which must match an element of `g` exactly.
-   `binding` := {`var` `matching-value`, ...}
-   `matching-value` matches `var` within `graph-pattern` applied to `g`
sourceraw docstring

vector-of-triplesclj/s

(vector-of-triples g)

Returns (g) as [[s p o]...]

Returns (g) as [[`s` `p` `o`]...]
sourceraw docstring

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

× close