Skip to content

Commit

Permalink
updated batch properties; elaborated readms
Browse files Browse the repository at this point in the history
  • Loading branch information
akollegger committed Sep 25, 2012
1 parent ba3963f commit 7e9e8d8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -2,5 +2,4 @@
*.graphdb
ivy/
bin/
batch.properties
neo4j-community*
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions 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
35 changes: 28 additions & 7 deletions 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;

0 comments on commit 7e9e8d8

Please sign in to comment.