Posts Tagged ‘neo4j’

Neo4j: org.neo4j.graphdb.NotFoundException: Target file[nioneo_logical.log.v1] already exists

July 18th, 2012

My Neo4j didn’t start and my log showed

1
org.neo4j.graphdb.NotFoundException: Target file[nioneo_logical.log.v1] already exists

I solved it by removing all nioneo_logical.log* files in data/graph.db/
Right or wrong I don’t know but my nodes and indices remained intact.

Neo4j and Neo4jClient dis and dat

July 11th, 2012

Below is various stuff I have found while working with Neo4j and Neo4jClient.  Helpful?  Dunno.  At least it is better to keep text searchable than living just in my head.  To be forgotten.  Like tears in rain.

Neo4jClient can be installed through Nuget.  Install-Package Neo4jClient.  Awesome.

How to do some calls is here: http://hg.readify.net/neo4jclient/src/4693da483a90/Test/ApiUsageIdeas.cs

Stackoverflow tag for Neo4jClient is here: http://stackoverflow.com/questions/tagged/neo4jclient

Info on creating index is found here:  http://romikoderbynew.com/2011/08/28/lucene-full-text-indexing-with-neo4j/

Creating a relation is a totally different horse than node.  Why? Here is dotnet code for said: http://blog.micic.ch/net/using-neo4j-graph-db-with-c-net

Finding all nodes, and deleting them if wished is found here: http://stackoverflow.com/questions/12903873/neo4j-get-all-nodes-in-a-graph-even-those-that-are-unconnected-by-relationship.
The queries are

1
2
START n=node(*)
RETURN n

and

1
2
3
START n=node(*)
MATCH n-[r?]-() where ID(n) <> 0
DELETE n, r;

(replace &lt;&gt; with <>

Looking at an index in the web client:

http://stackoverflow.com/questions/8518541/neo4j-querying-a-node-index-with-wildcards-via-the-webadmin-data-browser

For getting all nodes for an index with index name “MyIndexName” and property “MyProperty” write

1
node:index:MyIndexName:MyProperty:*

in the web admin.  It also works with an exact index.

Writing a Relation is not as easy as writing a node.  Se here: http://blog.micic.ch/net/using-neo4j-graph-db-with-c-net

I have not been able to confirm that it is possible to write properties on the relation.

Reading the relation again through its ID is also not as easy a reading a node.  A workaround is to use Gremlin: http://stackoverflow.com/questions/15086596/how-do-i-use-neo4jclient-to-get-a-neo4j-relation-by-its-id

 

Talking to Neo4j running on OSX from Windows7

July 5th, 2012

This is not a deep diving article but just a brain dump.  Maybe it will help someone.  At least it works on my machine.

I wanted to use Neo4j with dotnet.  So I put Neo4j as a server on the Mac and my regular dotnet stuff on a Win7 machine running through Parallels.

I don’t remember exactly what was needed to get Neo4j up and running but it was easy I recall.  Download.  Extract.  Find the right folder.  Type “neo4j start”. Open a browser.  Type “localhost:7474”.  Create a node.  Check it was created.  Done.
I opted for running Neo4j stand alone to keep my machine tidy – starting the Neo4j server every time I develop is easy.

Since I want to talk to Neo4j from another machine I need to bridge the network and open the firewall on the mac.  It’s just a google away even though the way to open the firewall seems to shifts with every OSX release.  To the better in my case.

A caveat that burned some time for me was that the admin GUI for Neo4j is set to only answer on localhost.  It is considered a good thing since there is no usr/pwd.  That is solved by updating the config and restarting the Neo4j server. Use http://yourmachine:7474 to check this.

On the Windows/Visual studio/Dotnet side I opted for Neo4jclient since it is under present development and open source.  The 2 top hits I found otherwise had their last update set in 2010.  It’s an easy install with Nuget.

Creating nodes from dotnet was easy.  I just followed the getting started.

That’s all I’ve done for now.

Neo4j web admin user interface only listens on localhost as default

July 2nd, 2012

If you can’t connect to the Neo4j web admin through a URL like

http://mymachine:7474

it might be because the default setting is that only localhost is allowed.

Open the neo4j-server.properties file in the conf directory.  Find

#org.neo4j.server.webserver.address=0.0.0.0

and uncomment it.

There are security considerations for removing this.