Liking cljdoc? Tell your friends :D

ont-app.igraph.core

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.
raw docstring

add-to-graphclj/smultimethod

Returns <g>, with <to-add> added Where <g> is a Graph <to-add> is interpetable as a set of triples Dispatched according to triples-format

Returns <g>, with <to-add> added
Where
<g> is a Graph
<to-add> is interpetable as a set of triples
Dispatched according to `triples-format`
sourceraw docstring

assert-uniqueclj/s

(assert-unique g s p o)
source

flatten-descriptionclj/s

(flatten-description p-o)
source

IGraphclj/s≠protocol

An abstraction for S-P-O graphs

An abstraction for S-P-O graphs

subjectsclj/s

(subjects g)

Returns (<s>...) for <g> Where <s> is a subject in one or more triples in <g> <g> is a graph.

Returns (<s>...) for <g>
Where 
<s> is a subject in one or more triples in <g>
<g> is a graph.

queryclj/s

(query g q)

Returns #{<binding> ...} for query spec <q> applied to <g> Where <binding> := {<var> <value>, ...} <q> is a query specification suitable for the native format of <g> <g> is a graph <args> := [<arg>....] <var> is a variable specified in <q> <value> is a value found in <g> bounded to <var> per <q> <arg> is any optional value that informs native execution of the query. for example if the native platform supports a templating scheme as in datalog

Returns #{<binding> ...} for query spec <q> applied to <g>
Where
<binding> := {<var> <value>, ...}
<q> is a query specification suitable for the native format of <g>
<g> is a graph
<args> := [<arg>....]
<var> is a variable specified in <q>
<value> is a value found in <g> bounded to <var> per <q>
<arg> is any optional value that informs native execution of the query.
  for example if the native platform supports a templating scheme as in
  datalog

get-oclj/s

(get-o g s p)

Returns {<o> ...} for <s> and <p> in <g>, or nil. Where <g> is a graph <s> is subject of some triples in <g>

<p> is predicate of some triples in <g> <o> appears in triple [<s> <p> <o>] in <g>

Returns {<o> ...} for <s> and <p> in <g>, or nil.
Where
<g> is a graph
<s> is subject of some triples in <g>
<p> is predicate of some triples in <g>
<o> appears in triple [<s> <p> <o>] in <g>

askclj/s

(ask g s p o)

Returns truthy value iff [<s> <p> <o>] appears in <g> Where <g> is a graph <s> is subject of some triples in <g>

<p> is predicate of some triples in <g> <o> appears in triple [<s> <p> <o>] in <g>

Returns truthy value iff [<s> <p> <o>] appears in <g>
Where
<g> is a graph
<s> is subject of some triples in <g>
<p> is predicate of some triples in <g>
<o> appears in triple [<s> <p> <o>] in <g>

mutabilityclj/s

(mutability g)

Returns one of ::read-only ::immutable ::mutable ::accumulate-only

Returns one of ::read-only ::immutable ::mutable ::accumulate-only

get-p-oclj/s

(get-p-o g s)

Returns {<p> #{<o> ...}} associated with <s> in <g>, or nil. Where <g> is a graph <s> is subject

<p> and <o> are in triples := [<s> <p> <o>] in <g>

Returns {<p> #{<o> ...}} associated with <s> in <g>, or nil.
Where
<g> is a graph
<s> is subject 
<p> and <o> are in triples := [<s> <p> <o>] in <g>

normal-formclj/s

(normal-form g)

Returns {<s> {<p> #{<o>...}...}...} Where <s> is the subject of a triple := [<s> <p> <o>] in <g>

<p> is predicate of same <o> is the object of same

Returns {<s> {<p> #{<o>...}...}...}
Where 
<s> is the subject of a triple := [<s> <p> <o>] in <g>
<p> is predicate of same
<o> is the object of same

invokeclj/s

(invoke g)
(invoke g s)
(invoke g s p)
(invoke g s p o)

Applies <g> as a function to the rest of its arguments, representing triples [<s> <p> <o>] in <g> respectively. <p> may optionally be a traversal function (See traverse docs) (g) -> {<s> {<p> #{<o>...}...}...} ;; = (normal-form <g>) (g s) -> {<p> #{<o>...}, ...} ;; = (get-p-o <g>) (g s p) -> #{<o> ...} ;; = (match-or-traverse g s p) (g s p o) -> <o> iff [<s> <p> <o>] is in <g> ;; = (match-or-traverse g s p o)

Applies <g> as a function to the rest of its arguments, representing 
   triples [<s> <p> <o>] in <g> respectively. <p> may optionally be 
   a traversal function (See `traverse` docs)
(g) -> {<s> {<p> #{<o>...}...}...} ;; = (normal-form <g>)
(g s) -> {<p> #{<o>...}, ...} ;; = (get-p-o <g>)
(g s p) -> #{<o> ...} ;; = (match-or-traverse g s p)
(g s p o) -> <o> iff [<s> <p> <o>] is in <g> ;; = (match-or-traverse g s p o)
sourceraw docstring

IGraphAccumulateOnlyclj/s≠protocol

claimclj/s

(claim g to-add)

Returns <g>, with <to-add> added to <g>'s associated transactor. Throws an exception if (mutability g) != ::accumulate-only Where <g> is a mutable graph <to-add> is in triples-format NOTE: see Datomic documentation for the 'add' operation for details

Returns <g>, with <to-add> added to <g>'s associated transactor.
Throws an exception if (mutability g) != ::accumulate-only
Where
<g> is a mutable graph
<to-add> is in triples-format
NOTE: see Datomic documentation for the 'add' operation for details

retractclj/s

(retract g to-retract)

Returns <g> with <comm> reset to head Side-effect: <to-retract> retracted from <comm> Throws an exception if (mutability g) != ::accumulate-only. Where <g> is a graph <comm> is a datomic-style transactor <to-retract> is in triples-removal-format NOTE: see Datomic documentation for details

Returns <g> with <comm> reset to head
Side-effect:  <to-retract> retracted from <comm>
Throws an exception if (mutability g) != ::accumulate-only.
Where
<g> is a graph
<comm> is a datomic-style transactor
<to-retract> is in triples-removal-format
NOTE: see Datomic documentation for details
source

IGraphImmutableclj/s≠protocol

addclj/s

(add g to-add)

Returns <g>', with <to-add> added to its contents. Throws a ::ReadOnly exception if (read-only? <g>) Where <g> is a graph <to-add> is in triples-format

Returns <g>', with <to-add> added to its contents.
Throws a ::ReadOnly exception if (read-only? <g>)
Where
<g> is a graph
<to-add> is in triples-format

subtractclj/s

(subtract g to-subtract)

Returns <g>' with <to-subtract> removed from its contents. Throws an exception if (mutability g) != ::immutable Where <g> is an immutablegraph <to-subtract> is in triples-removal-format

Returns <g>' with <to-subtract> removed from its contents.
Throws an exception if (mutability g) != ::immutable
Where
<g> is an immutablegraph
<to-subtract> is in triples-removal-format
source

IGraphMutableclj/s≠protocol

add!clj/s

(add! g to-add)

Returns <g>, with <to-add> added to its contents. Throws an exception if (mutability g) != ::mutable Where <g> is a mutable graph <to-add> is in triples-format

Returns <g>, with <to-add> added to its contents.
Throws an exception if (mutability g) != ::mutable
Where
<g> is a mutable graph
<to-add> is in triples-format

subtract!clj/s

(subtract! g to-subtract)

Returns <g> with <to-subtract> removed from its contents. Throws a ::ReadOnly exception if (read-only? <g>) Where <g> is a graph <to-subtract> is in triples-removal-format

Returns <g> with <to-subtract> removed from its contents.
Throws a ::ReadOnly exception if (read-only? <g>)
Where
<g> is a graph
<to-subtract> is in triples-removal-format
source

IGraphSetclj/s≠protocol

Basic set operations between graphs.

Basic set operations between graphs.

differenceclj/s

(difference g1 g2)

Returns an IGraph whose normal form contains all statements in g1 not present in g2.

Returns an IGraph whose normal form contains all statements in g1 not present in g2.

intersectionclj/s

(intersection g1 g2)

Returns an IGraph whose normal form contains all and only statements shared by both g1 and g2

Returns an IGraph whose normal form contains all and only statements shared by both g1 and g2

unionclj/s

(union g1 g2)

Returns an IGraph whose normal form contains all triples from g1 and g2

Returns an IGraph whose normal form contains all triples from g1 and g2
sourceraw docstring

match-or-traverseclj/smultimethod

Returns values appropriate for (g s p) or (g s p o) invocations Where <o> is an object in <g> <s> is a subject in <g>

<p> is either a predicate in <g> or a traversal function accumulating a set, starting with an empty accumulator and queue of [<s>] (see docs for `traverse`) NOTE: Implementers of IGraph will typically use this method for IFn `invoke` members involving a <p> argument.

Returns values appropriate for (g s p) or (g s p o) invocations
Where
<o> is an object in <g>
<s> is a subject in <g>
<p> is either a predicate in <g> or a traversal function accumulating
  a set, starting with an empty accumulator and  queue of [<s>]
  (see docs for `traverse`)
NOTE: Implementers of IGraph will typically use this
  method for IFn `invoke` members involving a <p> argument.
sourceraw docstring

(maybe-traverse-link p)
source

normal-form?clj/s

(normal-form? m)

Returns true iff <m> is in normal form for IGraph.

Returns true iff <m> is in normal form for IGraph.
sourceraw docstring

normalize-flat-descriptionclj/s

(normalize-flat-description m)

Returns a normalized p-o description of m Where <m> is a plain clojure map

Returns a normalized p-o description of `m`
Where
<m> is a plain clojure map
sourceraw docstring

on-js-reloadcljs

(on-js-reload)
source

p-dispatcherclj/s

(p-dispatcher g s p)
(p-dispatcher g s p o)

Returns :traverse or :match, as a basis for dispatching standard invoke methods involving a <p> argument, which may be either a value ot match or a traversal function.

Returns :traverse or :match, as a basis for dispatching standard `invoke` methods involving a <p> argument, which may be either a value ot match or a traversal function.
sourceraw docstring

read-from-fileclj

(read-from-file g path)
source

reduce-spoclj/s

(reduce-spo f acc g)
source

remove-from-graphclj/smultimethod

Returns <g>, with <to-remove> removed Where <g> is a Graph <to-add> is interpetable as a set of triples Dispatched according to triples-removal-format

Returns <g>, with <to-remove> removed
Where
<g> is a Graph
<to-add> is interpetable as a set of triples
Dispatched according to `triples-removal-format`
sourceraw docstring

t-compclj/s

(t-comp comp-spec)
source

transitive-closureclj/s

(transitive-closure p)

Returns <traversal> for chains of p. Where <traversal> := (fn [g acc queue]...) -> [<context> <acc'> <queue'>], s.t. <queue'> conj's all <o> s.t. (g <s> <p> <o>).
A traversal function argument for the traverse function .

<p> is a predicate, typcially an element of <g> <g> is a graph. NOTE: cf the '*' operator in SPARQL property paths

Returns <traversal> for chains of `p`.
Where
<traversal> := (fn [g acc queue]...) -> [<context> <acc'> <queue'>], 
  s.t. <queue'> conj's all <o> s.t. (g <s> <p> <o>).  
  A traversal function argument for the `traverse` function .
<p> is a predicate, typcially an element of <g>
<g> is a graph.
NOTE:
cf the '*' operator in SPARQL property paths
sourceraw docstring

traverseclj/s

(traverse g traversal acc queue)
(traverse g traversal context acc queue)

Returns acc acquired by applying traversal to g starting with queue, informed by context Where <acc> is an arbitrary clojure 'accumulator' object (similar to a reduce function) <traversal> := (fn [g context acc queue]...) -> [<context'> <acc'> <queue'>] <g> is a graph <context> := {<context-key> <context-value>....}, expressing important aspects of the traversal state <queue> := [<node> ...], nodes to visit <context-key> := #{:history ... maybe :skip? ... :seek ... or other keys specific to <traversal>, which <traversal> may use to communicate with future iterations of itself. <history> := #{<visited-node> ...}, this is conj'd with each visited node on each call to avoid cycles. <skip?> (optional) := (fn [<node>] -> true if we should skip). This may also be a set of nodes to skip. This allows for overriding the default skipping behavior which simply skips <history> <seek> (optional) := (fn [context acc] -> <acc'>, a function to be called at the start of each traversal, a truthy, non-empty response to which will be the immediate return value of the traverse function. This would save you the time and trouble of processing the whole queue, or making each traversal function smart enough to stop early. Must return the same type as <acc>. <node> is typically an element in <g>, but can be any value the traversal function knows how to handle <visited-node> is a node visited upstream. We filter these out to avoid cycles. This can also be specified in advance by the user. <target> is a node we may be searching for. Note: it is good practice to assign a :transition-fn metadata tag to transition functions, though such data is not referenced anywhere at this point.

Returns `acc` acquired by applying `traversal` to `g` starting with `queue`, informed by `context`
Where
<acc> is an arbitrary clojure 'accumulator' object (similar to a
  reduce function)
<traversal> := (fn [g context acc queue]...)
                -> [<context'> <acc'> <queue'>]
<g> is a graph
<context> := {<context-key> <context-value>....}, expressing important
  aspects of the traversal state
<queue> := [<node> ...], nodes to visit
<context-key> := #{:history ... maybe :skip? ... :seek ... or other
  keys specific to <traversal>, which <traversal> may use to communicate
  with future iterations of itself.
<history> := #{<visited-node> ...}, this is conj'd with each visited node on
  each call to avoid cycles.
<skip?> (optional) := (fn [<node>] -> true if we should skip). This may also
  be a set of nodes to skip. This allows for overriding the default skipping
  behavior which simply skips <history>
<seek> (optional) := (fn [context acc] -> <acc'>, a function to be called
  at the start of each traversal, a truthy, non-empty response to which will
  be the immediate return value of the traverse function. This would save you
  the time and trouble of processing the whole queue, or making each traversal
  function smart enough to stop early. Must return the same type as <acc>.
<node> is typically an element in <g>, but can be any value the traversal
  function knows how to handle
<visited-node> is a node visited upstream. We filter these out to
  avoid cycles. This can also be specified in advance by the user.
<target> is a node we may be searching for.
Note: it is good practice to assign a :transition-fn metadata tag to
  transition functions, though such data is not referenced anywhere
  at this point.
sourceraw docstring

(traverse-link p)

Returns traversal function (fn [g context, acc queue]...) -> [context, acc', queue'], following one <p> in <g> Where <acc> is a set <queue> := [<node> ...], nodes to visit in traversal

<p> is a predicate in <g> <g> is a graph

NOTE: typically used as one component in a traversal path

Returns traversal function (fn [g context, acc queue]...)
  -> [context, acc', queue'], following one <p> in <g>
Where
<acc> is a set
<queue> := [<node> ...], nodes to visit in traversal
<p> is a predicate in <g>
<g> is a graph

NOTE: typically used as one component in a traversal path
sourceraw docstring

traverse-orclj/s

(traverse-or & ps)
source

triples-formatclj/s

(triples-format triples-spec)

Returns the value of (:triples-format (meta <triples-spec>)) or one of #{:vector :vector-of-vectors :normal-form <type>} inferred from the shape of <triples-spec> Where <args> := [<g> <triples-spec>], arguments to a method add or remove from graph <g> is a graph <triples-spec> is a specification of triples typically to add to or remove from <g> :normal-form indicates (normal-form? <triples-spec>) = true :triple indicates <triples-spec> := [<s> <p> <o>] :vector-of-vectors indicates <triples-spec> := [<triple>...] <type> = (type <triples-spec>)

Returns the value of (:triples-format (meta <triples-spec>)) or one of #{:vector :vector-of-vectors :normal-form <type>} inferred from the shape of <triples-spec>
Where
<args> := [<g> <triples-spec>],  arguments to a method add or remove from graph
<g> is a graph
<triples-spec> is a specification of triples typically to add to or remove
  from  <g>
:normal-form indicates (normal-form? <triples-spec>) = true
:triple indicates <triples-spec> := [<s> <p> <o>]
:vector-of-vectors indicates <triples-spec> := [<triple>...]
<type> = (type <triples-spec>)
sourceraw docstring

triples-removal-formatclj/s

(triples-removal-format triples-spec)

Returns a keyword describing the format of triples-spec for removing a set of triples from a graph.

Returns a keyword describing the format of `triples-spec` for removing a
set of triples from a graph.
sourceraw docstring

uniqueclj/s

(unique coll)
(unique coll on-ambiguity)

Returns the single member of <coll>, or nil if <coll> is empty. Calls <on-ambiguity> if there is more than one member (default is to throw an Exception). Where <coll> is a collection <on-ambiguity> := (fn [coll] ...) -> <value>, default raises an error. Note: this can be used when you've called (G s p) and you're sure there is only one object.

Returns the single member of <coll>, or nil if <coll> is empty. Calls <on-ambiguity> if there is more than one member (default is to throw an Exception).
Where
<coll> is a collection
<on-ambiguity> := (fn [coll] ...) -> <value>, default raises an error.
Note: this can be used when you've called (G s p) and you're sure there is
  only one object.
sourceraw docstring

write-to-fileclj

(write-to-file path g)
source

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

× close