Skip to content

Instantly share code, notes, and snippets.

View tomzeppenfeldt's full-sized avatar

Tom Zeppenfeldt tomzeppenfeldt

View GitHub Profile
@tomzeppenfeldt
tomzeppenfeldt / gist:8a257f97750c104a54fe6f98282389ed
Last active January 6, 2017 09:04
Evaluation of logical trees
### Evaluating a logical tree with Cypher / APOC
I'm looking at a set of logical ports that together determine which rules apply to given entities, based on the existence of properties. This is the dataset:
//setup
[source,cypher]
----
CREATE (_181732:Entity {`name`:'A'})
CREATE (_181733:Entity {`name`:'B'})
@tomzeppenfeldt
tomzeppenfeldt / hierarchicalfacets
Last active August 29, 2015 14:01
Hierarchical facets
= Using hierarchical facets
We have a usecase with documents that are tagged with keywords in a theasaurus. This gists explains the model and is at the same time an invitation to suggest improvements. Because it would be nice to have something that performs better.
NOTE : In this example we have a quite regular thesaurus. IRL the thesaurus with branches of varying depth and docs are tagged with both leaf and non-leaf nodes (i.e. nodes without and with children repectively)
== The model
//setup
[source,cypher]
@tomzeppenfeldt
tomzeppenfeldt / gist:40364ac2a52f57aa520a
Last active August 29, 2015 14:01
Network versioning using transition nodes
= Network versioning using relationnodes
Recently there was a nice blog on versioning networks by Ian Robinson (http://iansrobinson.com/2014/05/13/time-based-versioned-graphs/[read it here]) on using identity nodes and separating structure from state. In this gist I'd like to put in my 2 cents by introducing another approach using _relationnodes_. This is more about structure of a network than about states of nodes, but it treats versioning differently. As Ian states in his blog, there's always a trade-off to be made, since versioning causes an extra load on storage and processing.
== Relationnodes?
=== What are relationnodes?
Relation nodes are intermediary nodes between two network nodes that represents the relation between the nodes.
So, if A and B are two network nodes, instead of connecting them with a relationship of `[:RELTYPE]`,