This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start westeros=node(0) | |
set westeros.name = "Westeros" | |
create targaryen={house:"Targaryen"}, | |
stark={house:"Stark"}, | |
lannister={house:"Lannister"}, | |
baratheon={house:"Baratheon"}, | |
tully={house:"Tully"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from neo4j import GraphDatabase | |
# Create db | |
db = GraphDatabase('db') | |
with db.transaction: | |
noun_id = 1 | |
#-----1----------------- | |
#first creating the index, reference node and storing it... | |
noun_index = db.node.indexes.create('noun_idx') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (c) 2010-2012 "Neo Technology," | |
* Network Engine for Objects in Lund AB [http://neotechnology.com] | |
* | |
* This file is part of Neo4j. | |
* | |
* Neo4j is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU Affero General Public License as | |
* published by the Free Software Foundation, either version 3 of the | |
* License, or (at your option) any later version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void shouldCreateAutoIndex() throws Exception | |
{ | |
String path = new File( PATH, "10" ).getAbsolutePath(); | |
BatchInserter inserter = new BatchInserterImpl( path ); | |
BatchInserterIndexProvider provider = new LuceneBatchInserterIndexProviderNewImpl( | |
inserter ); | |
BatchInserterIndex index = provider.nodeIndex( "node_auto_index", EXACT_CONFIG ); | |
long id = inserter.createNode( null ); | |
Map<String, Object> props = new HashMap<String, Object>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
start root=node(0) | |
create unique | |
root-[:GENRES]->({type:'GENRES'}), | |
root-[:MOVIES]->({type:'MOVIES'}), | |
root-[:PEOPLE]->({type:'PEOPLE'}); | |
{:actors=>[{:role=>"Jake Sully", :name=>"Sam Worthington", :id=>65731}, {:role=>"Neytiri", :name=>"Zoe Saldana", :id=>8691}, {:role=>"Dr. Grace Augustine", :name=>"Sigourney Weaver", :id=>10205}, {:role=>"Col. Quaritch", :name=>"Stephen Lang", :id=>32747}, {:role=>"Trudy Chacon", :name=>"Michelle Rodriguez", :id=>17647}, {:role=>"Norm Spellman", :name=>"Joel Moore", :id=>59231}, {:role=>"Selfridge", :name=>"Giovanni Ribisi", :id=>1771}, {:role=>"Moha", :name=>"CCH Pounder", :id=>30485}, {:role=>"TsuTey", :name=>"Laz Alonso", :id=>10964}, {:role=>"Eytukan", :name=>"Wes Studi", :id=>15853}, {:role=>"Dr. Max Patel", :name=>"Dileep Rao", :id=>95697}, {:role=>"Lyle Wainfleet", :name=>"Matt Gerald", :id=>98215}, {:role=>"Samson Pilot", :name=>"Dean Knowsley", :id=>98216}], :movie_id=>19995, :directors=>[{:name=>"James Cameron", :id=>2710}], :tagline=>"Enter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start joe=node:node_auto_index(name = "Joe") match joe-[:knows]->friend-[:knows]->friend_of_friend where not(joe-[:knows]-friend_of_friend) return collect(friend.name), friend_of_friend.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default values for the low-level graph engine | |
#neostore.nodestore.db.mapped_memory=25M | |
#neostore.relationshipstore.db.mapped_memory=50M | |
#neostore.propertystore.db.mapped_memory=90M | |
#neostore.propertystore.db.strings.mapped_memory=130M | |
#neostore.propertystore.db.arrays.mapped_memory=130M | |
# Autoindexing | |
# Enable auto-indexing for nodes, default is false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spatial; | |
import com.vividsolutions.jts.geom.Coordinate; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import org.geotools.map.Layer; | |
import org.neo4j.collections.rtree.Envelope; | |
import org.neo4j.collections.rtree.SpatialIndexReader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= Neo4j und Javascript = | |
// console | |
[source,cypher] | |
---- | |
CREATE (movie:Movie {title:"Matrix", year: 1999}), | |
(movie)<-[:ACTED_IN {role:"Neo"}]-(:Actor {name:"Keanu Reeves", age: 48}), | |
(movie)<-[:DIRECTED]-(:Director {name:"Wachowski"}), | |
(movie)<-[:RATED {stars: 5}]-(:User {login:"Michael"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
== The Neo4j GraphGist Console. == | |
This is a sample GraphGist explaining some of the base concepts of sharing graphs using http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html[the Cypher query language]. | |
[source,cypher] | |
---- | |
CREATE ({name:'you'})-[:SEE]->({name:'This GraphGist'})-[:FORK_ON_GITHUB]->(your_gistfile{name:'Your Gist'}) | |
CREATE (your_gistfile)-[:INSERT_ID_HERE]->({name:'Your GraphGist'}) | |
---- |