Skip to content

Instantly share code, notes, and snippets.

View moxious's full-sized avatar

David Allen moxious

View GitHub Profile
@moxious
moxious / gist:10888550
Last active August 29, 2015 13:59
Neo4J Relative Performance Experiment

A Neo4J Experiment: Lookup Nodes vs. Labels

Background

In previous versions of neo4j, people have used an "lookup node" pattern to access certain subgraphs or subsets of their data. The "lookup node" pattern basically creates a single node to act as the entry of an index, and relationships from that "lookup node" to whatever the contents of the index would be.

This can also be used for other use cases, such as creating partitions.

More broadly, these kinds of modeling tricks turn out to be very useful to capture a variety of different kinds of domain semantics, including all sorts of set membership expression:

  • Expressing that all linked nodes share some common property, without expressing the property individually in every node (i.e. companies whose home country = 'USA')
dce830382b1307ae38b52b6c7bad9798b701b55311c3d5fc956a1ee9e6d99f4b
07fedcc13bf69c0f553ba26843188056ea1f88e491fdc6584cd44d6df9c080f4
515f6095a7976ea36276e61aa01cbdc4ae0fee31c5ede34a86052d85206b72e3
94a06309e1d59d8609fd22ab2f571ffc34c81899247709b001d201f9aa157275
e4829b455a10892bcf4d3778c3645705c2c66b33511eb64b1854ed63991c0fa0
80792072b8e9b6b910ce41d1d8805f63419a47a1d4d7a53802d974bc2d8ab5f0
4f4905e229c1e282e44efdf99e31c59e4672ecb70553744832bc24c9d2e72024
b185e50639276da1e67c4df9510ba0453767ccd4c09a99071b3e430eff7082e6
4bbf1a308119cabf3d3c6eb41367d68d23b394dd0c3924c28667f5e09923ecb0
7ff1d1630908debebbbd1e6b4f0e00430ef1b7d7b6719495233bc0e34e1253fb
ProvStore: https://provenance.ecs.soton.ac.uk/store/
SPADE (SRI): https://code.google.com/p/data-provenance/
PROV-O-Viz: http://provoviz.org/
Komadu: https://github.com/Data-to-Insight-Center/komadu
CDE Application Virtualization: http://www.pgbovine.net/cde.html
NoWorkflow: https://github.com/gems-uff/noworkflow
MITRE PLUS: https://github.com/plus-provenance/plus
Python PROV: https://pypi.python.org/pypi/prov
PICASO: https://provenance.ecs.soton.ac.uk/picaso/
PROV-N Editor: https://provenance.ecs.soton.ac.uk/tools/editor/
@moxious
moxious / gist:c6db6f7535f28d3dab02
Last active August 29, 2015 14:10
Strange or Counter-Intuitive Things about Neo4J and Cypher

##Lack of Binary Protocol Neo4J (as of the 2.0 series) lacks a binary protocol for communicating with remote databases. Generally, your options are to use the GraphDatabaseService API on an embedded database, or to use RESTful services. There's only an incomplete implementation of GraphDatabaseService for RESTful endpoints, which leads some developers stuck.
(Here's an example: http://stackoverflow.com/questions/27132090/connecting-to-remote-neo4j-using-java-api/27132183?noredirect=1)

##Cypher Weirdness

###Many functions only work on identifiers/properties, when you'd expect them to work on collections

72466144-6018-46e9-b300-05af005c9598
62f51031-86d0-4a7b-9985-2339f624e31d
7047f18f-74c8-41e4-a110-bab7c3b8bb4a
87f2f0af-123a-420b-937c-018371e777f9
3957ba9d-51fa-482b-9ce2-2f8be3717dbb
031e93df-154f-46ae-b3aa-5e0b7522684c
ba89e5da-223f-4c8c-80bf-bd3770ea58c0
c0a39349-2ba5-403d-a6b8-a66975fcb006
c4717a92-e958-45fe-bc06-404adfae6d44
16ef2959-4432-46cd-bfb0-3e069fe5e5f7
64c0df97-e295-4e2d-bd58-cd0daf0745bc
ac8f97a6-f5aa-4fbf-8252-5d6df21c105f
96c7941a-a8cd-4a4a-b8f9-0a0433d2be38
a7d1a3ec-8634-42fa-ba2c-2a24d25e3f07
47d0aee7-773b-40f5-bd61-c5e437d46f7d
84ea8f6f-9d26-4a57-aae2-f3c8da2e073b
3dff2539-940b-494b-b82f-d738b754d91a
8c478e28-8098-4095-a626-2f0b9c0d847f
519abbb2-8332-487b-9d48-14b39d9e1c5a
fa56f4ed-3203-43b0-a9f1-3db6cd5a8e1e
adf0c3f3-922f-43e0-a6f0-23fde74e81a2
49d9db73-f33b-4ac2-9a40-500ebd7f0445
2f410661-57af-4ba2-98c3-ad067afe0f0c
26821340-5305-4d98-94a1-9dcdc559b51a
b341a7d6-ad65-44cb-a4bf-44d3256f162a
20db4fe4-32ca-4d91-b54d-11c6440d94d8
72c22dfb-9fb2-4e41-beaf-6d5cf84cd6ee
728387fd-c575-4d0d-be17-4f41796ff7b3
039c0d80-0f4c-4494-998a-7741f51738fc
5f4c8c95-a804-45b2-aac2-57e67a287c24
/**
* Ensures that all GSI (N1QL) indexes are created and available
* on the server.
*
* @param {StoreAdapter~EnsureCallback} callback
* @private
* @ignore
*/
CbStoreAdapter.prototype._ensureGsiIndices = function(callback) {
var queries = [];
var Something = ottoman.model('Something', {
name: 'string'
});
var model = ottoman.model('Test', {
someStuff: [ 'Mixed' ]
});
var strangeSituation = new model({
someStuff: ['fire truck', null, 3.141592, Something.ref('65993d10-f894-457a-8c3a-e91049d94970')],

Keybase proof

I hereby claim:

  • I am moxious on github.
  • I am mdavidallen (https://keybase.io/mdavidallen) on keybase.
  • I have a public key ASBXSZq4RHyuHCS9oTYuEVvZW-PMoCA2UFZQ_S22dCHU_go

To claim this, I am signing this object: