Friday, September 27, 2013

Py2neo 1.6

Hi all,
It's a weird thought that although Neo4j has been part of my life for well over two years, I've only met in person a few of the people that I know from its community. Thanks to the wonderful generosity of Emil and co though, that will soon change as I'll be jetting over to San Francisco for Graph Connect, giving me a chance to meet both the Neo guys and my fellow driver authors.

The timing is also pretty good as I've just released Py2neo 1.6 which introduces one of the most requested features of recent months: node labels. As most Neophiles will know, labels allow nodes to be tagged with keywords that can be used for categorisation and indexing. Adding labels to a node in Py2neo is straightforward with the add_labels method:

>>> from py2neo import neo4j, node
>>> graph_db = neo4j.GraphDatabaseService()
>>> alice, = graph_db.create(node(name="Alice"))
>>> alice.add_labels("Female", "Human")

The set_labels and remove_labels methods similarly allow labels to be replaced or deleted and get_labels returns the set of labels currently defined. The GraphDatabaseService.find method can then be used to gather up all the nodes with a particular label and iterate through them:

>>> for node in graph_db.find("Human"):
...     print node["name"]

Aside from labels, the biggest change in the 1.6 release is a complete rewrite of the underlying HTTP/REST mechanism. In order to achieve better support for streaming responses, it was necessary to rip out the simple mechanism that had been with Py2neo since the early days and build a more comprehensive layer from the ground up. Incremental JSON decoding is a key feature that allows server responses to be handled step by step instead of only after the response has been completely received. This new layer has grown into a separate project, HTTPStream, but is embedded into Py2neo to avoid dependencies.

But what advantages does HTTPStream give to Py2neo-based applications? Well, it's now possible to incrementally handle the results of Cypher queries and batch requests as well as those from a few other functions, such as match. These functions now provide result iterators instead of full result objects. Here's an example of a Cypher query streamed against the data inserted above:

>>> query = neo4j.CypherQuery(graph_db, "MATCH (being:Human) RETURN being")
>>> for result in query.stream():
...     print result.being["name"]

Neotool has received some love too. The command line variant of Py2neo now fully supports Unicode, provides facilities for Cypher execution, Geoff insertion and XML conversion as well as options for HTTP authentication. The diagram below shows the conversion paths now available:


For a quick demonstration of the XML conversion feature in action, check out this web service. Another good place for a good neotool overview is my recent lightning talk from the London Graph Café.

So what isn't included? Cypher transactions are the main omission from the Neo4j 2.0 feature set and have been deliberately left out until a few major technical challenges have been overcome. Other than that, Py2neo 1.6 is the perfect companion to Neo4j 2.0 and well worth a try!

Py2neo 1.6 is available from PyPI, the source is hosted on GitHub and the documentation at ReadTheDocs. For a full list of changes, have a peek at the release notes.

/Nigel Small (@technige)

Wednesday, September 25, 2013

Neo4j 1.9.4 - Installer? Check! Desktop Launcher? Check!

Philip Rathle
People love Neo4j for many good reasons. The Windows installation however isn't usually at the very top of this list. With today's release, we are making it a lot easier to run Neo4j Community on Windows. Neo4j 1.9.4 Community Edition introduces a Windows installer, coupled with a simple launcher that lets you choose a target directory, start your database, and run in the system tray.

Try it now here!

New Windows Installer for Neo4j Community

The installer affects the Community Edition only. Among other things, it bundles in Java, avoiding the need to download & install Java separately, and adding another measure of convenience. It's quite straightforward, but if you have any feedback or ideas for improvement, we look forward to hearing it.

Enterprise is not changing for the time being: we figure that Enterprise customers place a high value the configuration & tuning flexibility that comes from running the JVM independently. Over time we will revisit Enterprise and may add an installer.

New Neo4j Desktop Launcher for Neo4j Community

The Desktop Launcher is a very simple application that lets you start and stop Neo4j, and launch the web UI. It was primarily developed with Windows in mind, but we have found it to be a nice added convenience on Mac & Linux. It is therefore being made available on those platforms as well.

The Desktop Launcher is likewise being made available for the Community edition only. Enterprise may follow over time if you find it useful. For those of you who need Community Edition in the older format, we will continue to build the zip package. If you do, please let us know why, as this will help us understand your deployment needs.

We hope this will make it easier and more convenient to develop with Neo4j. Any suggestions, please drop us a note!

For the full changelog, see the Changelog file on Github.


Philip Rathle and The Neo4j Team

Please Note: 

If you are running Windows 8 you might get a big blue warning saying that "Windows protected your PC". Please select "More" and "Run Anyway" to run the Neo4j installer.




Wednesday, September 18, 2013

We are surrounded by graphs, they are...everywhere!





In early October we are hosting our annual graph database conference GraphConnect in San Francisco.
We want YOU to participate! 
Save the date: October 3-4 2013, the conference will be on 4th and we offer trainings on the 3rd. Read about our un-conference to get a chance to get a free ticket or the discount code so you can buy tickets for only $99.

We have some really awesome talks at the conference. One of them is by the man, the legend ... Emil Eifrem who is also my CEO. He is a fantastic speaker and will fill the room with more graph-love then you can imagine.
Fred Trotter the healthcare data journalist who started to dig into graphs and also how they can be used in a not-only-profit way. I can’t wait to listen to him and how his new open dataset called DocGraph can help patients, doctors, hospitals and the health system in the United states. Open Data is the best! :)



Talking about doctors...our own doctor will be in the house, Dr. Jim Webber -  if you want to talk to him - talk about Doctor Who and impress him with your skills or the Graph Database book he wrote together with Ian Robinson and the aforementioned Emil.


So of course you want to listen to all these amazing speakers, but you know, sometimes you just want to share something that you are thinking about or need to discuss.

In the morning we are going to have an opportunity for this called Graph Clinic, where we don’t hand out drugs or do surgery on you. It’s a more a direct way of getting help with graph related or Neo4j questions - if you are stuck or need some support with your code or application. We provide the necessary band-aid and hugs to.

The Graph Clinic Doctors will be Doctor Ruby, Doctor Functional Programming and of course we bring a Delivery Doctor who can help you give birth of new graphs.

After giving birth to graphs, or receiving band-aids we need to talk about your experiences. The therapists of the afternoon will be Michael Hunger, Peter Neubauer and Pernilla Lindh. We know, we know we are not real therapists - but we love to talk and discuss and listen to people.

SO we are arranging a un-conference during the classic conference. Maybe doesn't make sense but I promise - you will love it since you can actively participate. As a local San Franciscan you can drop by and chat about NOSQL, data and graphs, as a participant on the conference you can sit down and talk about how you want to save the world by using graphs. As a speaker you can continue your talk and discuss your solution face to face with people.


So what I want you to do right now is to submit any topic you want to present as a lightning talk just before our un-conference on the real conference. Invite your best friends in San Francisco to come along, invite everyone to participate.


I love to give away stuff, so If you submit a lightning talk we'll get  you a free ticket. - fair deal right?  And if you want to share discount codes do so - just use "sfgraph" for a $99 ticket !!! 

Everyone can register here!


Also, if you want to contribute in some way, please ping me on twitter (@p3rnilla) and I might use my magic and give away more than one ticket.



As a special treat(meant) we'll have the driver authors for most of the Neo4j drivers at GraphConnect. The one in a lifetime chance to talk to them about your ideas, issues or praise for any of our awesome drivers.


Aseem Kishore - node-neo4j (JavaScript, Node.js)
Josh Adell - Neo4jPHP (PHP)
Nigel Small  - Py2Neo  (Python, Server)
Matt Luongo - Neo4Django  (Python)
Tatham Oddie - Neo4jClient (c# .net)
Javier de la Rosa - Neo4jRestClient (Python)
Wes Freeman - AnormCypher (Scala)
Andreas Ronge - Neo4j.rb (J)Ruby
Stefan Armbruster - Neo4j Grails Plugin (Groovy, Grails)
Max de Marzi - Neography (Ruby)
Michael Hunger - Spring Data Neo4j (Java,Spring), Java Rest Binding (Java), Neo4j-JDBC Driver (Java), CSV-Batch-Importer
Tobias Lindaaker, Jacob Hansson - Python Embedded / Jython


Here is the form for the lightning talk submissions:


Remember:
If you submit a lightning talk we'll get  you a free ticket.
If you want to know what an un-conference is you can read about it more here:
(http://en.wikipedia.org/wiki/Unconference) Looking forward to see you there :)
Cheers!

Pernilla








Thursday, September 12, 2013

Bring your own graph - The GraphGist challenge.

Hi all,
we have been working on an easy way to share your graph for some time, and we are proud to present you with the first ever GraphGist Challenge!

We want to encourage you to model a domain that you know / like in a graph model and describe it interactively in a GraphGist. A GraphGist is just a really simple AsciiDoc file, and can be hosted simply in a GitHub Gist.

This is how easy it is to create a GraphGist:


How to create a Neoj4 GraphGist from Peter Neubauer on Vimeo.

Ho does it work?

You just have to follow some simple steps (bascially they are described in the video above):
  • Find a great domain (Music, Dating, Comics, Healthcare, Politics, Sciences, ...)
  • Whiteboard a good example graph model.
  • Determine interesting use-cases.
  • Create Cypher statements for setup and query-use-cases.
  • The graphgist needs to be public, so the ASCIIDOC source can be shown and linked.
  • Write a good description and create a pretty model picture.
  • Compose it all nicely in your asciidoc-graphgist-file.

How do I participate?

  • Tweet the public URL of your graphgist and add the tag #graphgist to the tweet.
  • Add it to the GraphGist Wiki page under the GraphGist Challenge Section
  • The GraphGist needs to be registered before Sept 30, 2013

What can I win?

#1 - the honor and 500 USD

#2 - the honor and 300 USD

#3 - the honor and 200 USD

Also, all participants get a GraphConnect ticket, so EVERYBODY WINS - we are from Sweden :)

Whom can I talk to?





Peter Neubauer

@peterneubauer

Michael Hunger

Reach us me @neo4j

Pernilla Lindh

@p3rnilla


Tuesday, September 10, 2013

Neo4j 2.0.0-M05 released

We are proud to release  Neo4j 2.0.0-M05 as a milestone today. The 2.0 project is now in full speed development after summer vacation. We’re getting close to feature completeness now, and we want to get this release out to you so you can give us refined feedback for the final release.


Unique Constraints
Neo4j values the agility and development speed you get from using a schema-free database. It makes it possible and easy to start prototyping and learning. There is a huge value in this. On the other hand, it’s really nice to be able to make the graph structure more strictly constrained as a project evolves towards production (a big theme in our Neo4j 2.x roadmap). We think the new Optional schema gives you the best of both worlds.


A major step in this direction is the addition of unique constraints. This release includes fully functional unique constraints which allow you to specify that a label/property combination must be unique in a database. Adding constraints make your database safer to work with and catch problems you'd otherwise have to work hard to detect manually.


For example by running this Cypher query, you’ll end up with a unique constraint on the Person label for the email property.


CREATE CONSTRAINT ON (n:Person) ASSERT n.email IS UNIQUE;


If you try to create two different nodes with the same email, you’ll get an error about it from the database:


CREATE (:Person {email: "dude@company.com"});
CypherExecutionException: Node 2 already exists with label Person and property "email"=[dude@company.com]


In the engine room, unique constraints are implemented using a unique index. You can see this when looking at the schema, for example using the shell:

neo4j-sh (?)$ schema
Indexes
 ON :Person(email) ONLINE (for uniqueness constraint)


Constraints
 ON (person:Person) ASSERT person.email IS UNIQUE


Except for the fact you can’t drop the index manually, it works as any other index and can be used for read query execution as well as to check uniqueness.


Label store
Milestone releases prior to this stored labels in the Node store. This meant to find all the nodes with the Person label on them, we would scan the whole node store and look at each node. In the Neo4j 2.0.0-M05 release, we now have a Label store where we persist this information, which makes it faster to find all nodes with a certain label on them.


You don’t need to do anything to make use of this new store -- Cypher will automatically use it, and GlobalGraphOperations.getAllNodesWithLabel(Label) will also use it, but don't be surprised when you see new files in your data/graph.db directory.


AutoClosable transactions
Since Neo4j 2.0 is a Java 7 product, and following our transition to make sure that all resources are tied to a transaction, we’ve changed the age old Transaction interface so that it now implements AutoClosable.


AutoClosable is the interface that allows you to write a try statement, and have an implicit finally block that releases any AutoClosable resources registered with the try block.


This means you can now write to the Core API as follows:


try (Transaction tx = db.beginTransaction()){
  // do stuff inside the transaction
  tx.success();
}


This block will make sure the transaction is closed, even if an exception is thrown inside the try block.


Removed a lot of deprecated methods/classes
Since we’re getting closer to a major release, it’s time to clean up our API a little. In this release, most of the things marked as deprecated in the 1.9 version has been removed so now's a good time to think about moving any of your code that relies on deprecated methods over to the new APIs.


New Cypher Syntax
Cypher tries hard to work well with not only graphs, but also with collections. In this release, we took the liberty of updating the capabilities we have around collections.


We’ve had functions to do some of these things before, but the queries using them didn’t exactly roll off your tongue. Now we’re trying to make these features easier to use and read once you’ve used them.


Fo more information about ranges, literal maps and list comprehensions, you can read all about it here: http://docs.neo4j.org/chunked/2.0.0-M05/syntax-collections.html


Minimalistic Cypher and JSON
After making the START syntax optional owing to the expressiveness of Labels and the new Indexes, we now are also making WHERE and MATCH optional if you don’t need variables at all. And you now can return literal maps directly, making Cypher way more JSON-friendly


RETURN { key : "Value", collectionKey: [ { inner: "Map1" }, { inner: "Map2" } ] } as JSON

Deprecated > /dev/null
We have now removed a number of deprecated APIs from Neo4j, as announced at least 2 versions earlier, see the changelogs.

As always, we’re done a bunch of bugfixes and performance improvements, the release notes.


Also, a big thanks for all the good suggestions, discussions and error reports that have gone into this release. It makes a big difference!

Yours connectedly,

Andres Taylor
Andres Taylor

Saturday, September 7, 2013

GraphConnect SF: Keynote Speaker Fred Trotter

Howdy all,

Here at Neo4j, we're excited that Fred Trotter will be delivering a keynote at GraphConnect San Francisco! His talk, Hacking Healthcare with Neo4j, will cover his recent efforts with the open data set DocGraph. Here is an abstract of his talk:

Hacking Healthcare requires a really good model of the healthcare system. DocGraph is a graph of how healthcare providers collaborate in the United States, and is probably the largest named graph available to the public. It is exactly the kind of thing that is nightmare to work with in SQL and becomes pliable only when modeled and stored as graph data.

Learn more about DocGraph by reading this article or check out their website DocGraph.org.

Earlier this summer, he wrote an awesome article titled "Moving to the Open Health-care Graph" on the need for the healthcare industry to shift towards using a network graph approach to better model the healthcare system. Click here to read the article.

Fred frequently blogs including his recent post on "Doctors vs. Data" on O'Reilly's Strata Blog and regularly tweets @fredtrotter. His biography is available on his website FredTrotter.com.

Check out all of the speakers on the GraphConnect SF agenda.

Want to also present at GraphConnect SF? Submit your idea for a lightning talk during our unconference sessions in the afternoon!

More information including registration is available at graphconnect.com/san-francisco.

Looking forward to seeing you in October,
Adam

P.S. Register now with discount code BLOG50 for 50% off conference admission!

Monday, September 2, 2013

Neo4j 1.9.3 now available

Hello everyone,

Today we're pleased to release  Neo4j 1.9.3. This is a bugfix release in the 1.9.x series and has no new features (though it does restore an old way of registering unmanaged extensions with the server).

If you're on an earlier 1.9 release then you're strongly encouraged to upgrade (which can be performed without downtime in an HA cluster). You can download it from the neo4j.org web site.

Enjoy!

Ian Robinson
Author of Graph Databases (O'Reilly), Neo4j engineer, and Doctor Who aficionado.