Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated batch properties; elaborated readms

  • Loading branch information...
commit 7e9e8d813994ec3ad0ee1fa0e151c42f5e6b8c74 1 parent ba3963f
@akollegger authored
Showing with 40 additions and 8 deletions.
  1. +0 −1  .gitignore
  2. +4 −0 README.md
  3. +8 −0 batch.properties
  4. +28 −7 cql/related.cql
View
1  .gitignore
@@ -2,5 +2,4 @@
*.graphdb
ivy/
bin/
-batch.properties
neo4j-community*
View
4 README.md
@@ -21,6 +21,10 @@ Follow these Steps
3. `ant initialize`
4. `ant`
5. `./bin/fec2graph --force --importer=[RAW|CONNECTED|RELATED]`
+ - choose one of the importers, like `./bin/fec2graph --force --impoerter=RAW`
+ - RAW: imports records with no modifications
+ - CONNECTED: connects imported records based on cross-referenced IDs
+ - RELATED: replaces "join table" records with graph relationships
6. `ant neo4j-start`
Wanna code? Get a Neo4j Driver
View
8 batch.properties
@@ -0,0 +1,8 @@
+use_memory_mapped_buffers=true
+neostore.nodestore.db.mapped_memory=50M
+neostore.relationshipstore.db.mapped_memory=250M
+neostore.propertystore.db.mapped_memory=512M
+neostore.propertystore.db.strings.mapped_memory=100M
+neostore.propertystore.db.arrays.mapped_memory=0M
+neostore.propertystore.db.index.keys.mapped_memory=7M
+neostore.propertystore.db.index.mapped_memory=7M
View
35 cql/related.cql
@@ -1,9 +1,30 @@
-// other committees supporting presidential candidates in 2012
-start candidate=node:candidates('CAND_ID:*') match (candidate)-[r:SUPPORTS]-(campaign) where candidate.CAND_OFFICE='P' AND candidate.CAND_ELECTION_YR='2012' return campaign.CMTE_NM, TYPE(r), candidate.CAND_NAME;
+// All presidential candidates for 2012
+start candidate=node:candidates('CAND_ID:*') where candidate.CAND_OFFICE='P' AND candidate.CAND_ELECTION_YR='2012' return candidate.CAND_NAME;
-start committee=node:committees('CMTE_ID:*') match p=(committee)<-[:CONTRIBUTION_FROM]-(recipient) return p limit 10;
+// Top 10 Presidential candidates according to number of campaign committees
+start candidate=node:candidates('CAND_ID:*') match candidate<-[r:SUPPORTS]-(campaign)
+where candidate.CAND_OFFICE='P' AND candidate.CAND_ELECTION_YR='2012'
+return candidate.CAND_NAME, COUNT(campaign) as count
+ORDER BY count desc LIMIT 10;
+
+// find President Barack Obama
+start obama=node:candidates('CAND_ID:*') WHERE obama.CAND_NAME =~ '.*OBAMA.*' return obama.CAND_NAME, obama.CAND_ID;
+
+// lookup Obama by his candidate ID
+start obama=node:candidates(CAND_ID='P80003338') return obama;
+
+// find Presidential Candidate Mitt Romney
+start romney=node:candidates('CAND_ID:*') WHERE romney.CAND_NAME =~ '.*ROMNEY.*' return romney.CAND_NAME, romney.CAND_ID;
+
+// lookup Romney by his candidate ID
+start romney=node:candidates(CAND_ID='P80003353') return romney;
+
+// find the shortest path of funding between Obama and Romney
+start romney=node:candidates(CAND_ID='P80003353'), obama=node:candidates(CAND_ID='P80003338') MATCH p=shortestPath(romney-[*..10]-obama) return p;
+
+// 10 top individual contributions to Obama
+start obama=node:candidates(CAND_ID='P80003338') match obama<-[:SUPPORTS]-(campaign)<-[:INDIVIDUAL_CONTRIBUTION]-(contribution) return contribution.NAME, contribution.TRANSACTION_AMT order by contribution.TRANSACTION_AMT desc limit 10;
+
+// 10 top individual contributions to Romney
+start romney=node:candidates(CAND_ID='P80003353') match romney<-[:SUPPORTS]-(campaign)<-[:INDIVIDUAL_CONTRIBUTION]-(contribution) return contribution.NAME, contribution.TRANSACTION_AMT order by contribution.TRANSACTION_AMT desc limit 10;
-// first 10 contributions made from committees to some recipient
-start committee=node:committees('CMTE_ID:*')
-match (committee)<-[:CONTRIBUTION_FROM]-(contrib)-[:CONTRIBUTION_TO]->(recipient)
-return contrib.TRANSACTION_AMT, recipient.CMTE_NM limit 10;
Please sign in to comment.
Something went wrong with that request. Please try again.