Another Word For It Patrick Durusau on Topic Maps and Semantic Diversity

March 9, 2012

Visualizing Social Network Changes

Filed under: Cypher,Heroku,Neo4j,Visualization — Patrick Durusau @ 8:44 pm

Visualizing Social Network Changes by Max De Marzi.

From the post:

Some relationships change over time. Think about your friends from high school, college, work, the city you used to live in, the ones that liked you ex- better, etc. When exploring a social network it is important that we understand not only the strength of the relationship now, but over time. We can use communication between people as a measure.

I ran into a visualization that explored how multiple parties where connected by communications in multiple projects. We’re going to reuse it to explore how multiple people interact with each other. So let’s make a network of 50 friends and connect them to each other multiple times. Think of it as people writing on your facebook wall.

Excellent example of using a graph database to visualize changes in a social network. Not sure if it would be robust enough to capture the social dynamics of your local high school but it might be worth a shot. 😉

February 22, 2012

Gremlin vs Cypher Initial Thoughts @Neo4j

Filed under: Cypher,Graphs,Gremlin,Neo4j,Neo4jClient — Patrick Durusau @ 4:49 pm

Gremlin vs Cypher Initial Thoughts @Neo4j

Romiko Derbynew writes:

The Neo4jClient now supports Cypher as a query language with Neo4j. However I noticed the following:

  • Simple graph traversals are much more efficient when using Gremlin
  • Queries in Gremlin are 30-50% faster for simple traversals
  • Cypher is ideal for complex traversals where back tracking is required
  • Cypher is our choice of query language for reporting
  • Gremlin is our choice of query language for simple traversals where projections are not required
  • Cypher has intrinsic table projection model, where Gremlins table projection model relies on AS steps which can be cumbersome when backtracking e.g. Back(), As() and _CopySplit, where cypher is just comma separated matches
  • Cypher is much better suited for outer joins than Gremlin, to achieve similar results in gremlin requires parallel querying with CopySplit.
  • Gremlin is ideal when you need to retrieve very simple data structures
  • Table projection in gremlin can be very powerful, however outer joins can be very verbose

So in a nutshell, we like to use Cypher when we need tabular data back from Neo4j and is especially useful in outer joins.

Excellent comparison of Gremlin vs. Cypher. Both have their advantages.

February 13, 2012

Visualizing a Network with Cypher and D3.js

Filed under: Cypher,Graphs,Neo4j — Patrick Durusau @ 8:20 pm

Visualizing a Network with Cypher and D3.js by Max De Marzi.

From the post:

We’ve seen some pretty nice visualizations of nodes and their immediate neighbors, but we want to be able to visualize more. So we’re going to prepare a 200 node network, use Cypher to extract the data we want and visualize it with D3.js.

Be sure and take the concluding advice about refreshing the Heroku based page. You won’t be disappointed.

February 12, 2012

Using Cypher with Neography

Filed under: Cypher,Neography — Patrick Durusau @ 5:15 pm

Using Cypher with Neography by Max De Marzi.

From the post:

Cypher is the query language of Neo4j, and as promised I’ll show you how you can use it to implement friend recommendations as well as degrees of separation.

Curious. What other questions would you ask of a graph database other than friend recommendations and degrees of separation?

January 24, 2012

Mining Bio4j data: finding topological patterns in PPI networks

Filed under: Cypher,Neo4j — Patrick Durusau @ 3:41 pm

Mining Bio4j data: finding topological patterns in PPI networks

From the post:

That’s where I came up with the idea of looking for topological patterns through a large sub-set of the Protein-Protein interactions network included in Bio4j; – rather than focusing in a few proteins selected a priori.

I decided to mine the data in order to find circuits/simple cycles of length 3 where at least one protein is from Swiss-Prot dataset:

Interesting use of the Neo4j Cypher query language to look for topological patterns.

January 11, 2012

Bio4j release 0.7 is out !

Filed under: Bioinformatics,Biomedical,Cypher,Graphs,Gremlin,Medical Informatics,Visualization — Patrick Durusau @ 8:02 pm

Bio4j release 0.7 is out !

A quick list of the new features:

  • Expasy Enzyme database integration
  • Node type indexing
  • Amazon web services Availability in all Regions
  • New CloudFormation templates
  • Bio4j REST server
  • Explore you database with the Data browser
  • Run queries with Cypher
  • Querying Bio4j with Gremlin

Wait! Did I say Cypher and Gremlin!?

Looks like this graph querying stuff is spreading. 🙂

Even if you are not working in bioinformatics, Bio4j is worth more than a quick look.

January 8, 2012

Geoff

Filed under: Cypher,Geoff,Neo4j — Patrick Durusau @ 7:48 pm

Geoff This link is broken. New URL (and somewhat different explanatory text): http://nigelsmall.com/geoff

Nigel Small writes:

Geoff is a declarative notation for representing graph data within concise human-readable text, designed specifically with Neo4j in mind. It can be used to store snapshots within a flat file or to transmit data changes over a network stream.

A Geoff data set or file consists of a sequence of rules. Each rule comprises a descriptor and an optional set of data held as key:value pairs. The descriptor is a sequence of tokens, somewhat similar to the notation used in the Cypher query language and can designate additive or subtractive requirements for nodes and relationships as well as manipulations to index entries.

This looks like it will repay close study fairly quickly. More to follow.

January 5, 2012

Graph Algorithms

Filed under: Algorithms,Cypher,Graphs,Gremlin,Neo4j — Patrick Durusau @ 4:14 pm

Graph Algorithms

I ran across this Wikipedia book while working on one of the data structures posts for today.

I think you may find it useful but some cautions:

First, being a collection of Wikipedia articles, it doesn’t have a consistent editorial voice. That is more than being fussy, the depth and usefulness of explanations will vary from article to article.

Second, you will find topics that are “stubs,” and hence not very useful.

Third, I think with the advent of Neo4j, Grelim, Cypher and other graph databases/software, future entries should have in addition to text, exercises that users can perform with common software to reinforce their understanding of entries.

December 4, 2011

Power Modeling And Querying with Neo4j

Filed under: Cypher,Neo4j — Patrick Durusau @ 8:15 pm

Power Modeling And Querying with Neo4j

From the description:

Neo4j 1.5 has just been released, with another batch of features and enhancements. In this talk, Alistair Jones will demonstrate two significant changes. First we’ll look at the new custom visualisation support, that turns Neo4j Server into a sophisticated analysis tool.Then we’ll turn to the Cypher query language, first introduced in Neo4j 1.4, and now beefed up with even more powerful graph-oriented features. Alistair will demonstrate how simple cypher queries can now find answers that would otherwise require a lot of code, or which would have been nearly impossible in a relational database.

Neo4j 1.5 highlights:

  • Kernel: better, smaller property storage
  • Web admin: custom visualization
  • Cypher: more powerful queries

Well, as one watcher of the video, I wasn’t lucky that the kernel details weren’t covered! 😉 Understand the reasoning and time constraints but hard core presentations are appreciated as well.

The style for displays looks quite interesting but overly complicated. Suggestion: Names should be the defaults for nodes and edges, not a user defined style.

If attendees are though to have trouble reading screens, consider the plight of people watching the podcast. Capture the screen separately.

On Cypher, “more logical to read” isn’t a good marketing point. Easier to follow SQL query format.

Expect someone to write a SQL-like DSL if Neo4j does not.

Variable Length Paths – Ability that passes SQL!

Jump to time mark: 52:53 (or a bit before, I had trouble with the back/forward control):

  • Any relationship
  • Directed
  • Typed
  • Limited length
  • Shortest path

The entire video is quite nice but watch this part if no other.

Applications will suggest themselves.

December 3, 2011

Heroku, Neo4j and Google Spreadsheet in 10min. Flat.

Filed under: Cypher,Heroku,Neo4j,Ruby — Patrick Durusau @ 8:21 pm

Heroku, Neo4j and Google Spreadsheet in 10min. Flat. by Peter Neubauer

From the description:

This screencast shows how to use Neo4j on Heroku. We will do:

  • Create and install a Heroku app
  • Add a Neo4j instance to it
  • create a custom Ruby app
  • execute Cypher queries
  • Connect to the app using Google Spreadsheet
  • Build a small bar chart from a Cypher query.

Great presentation, with one tiny flaw. That is that the screen was so tiny that one has to guess at the contents of commands. Sure I can come fairly close but a file with transcripts of the terminal sessions and code would be nicer.

Recommend that you download the video for viewing. Watch it once online and you will see what I mean. I ran it on a 22 inch Samsung as full screen and a copy of the command sequence would have been appreciated.

November 21, 2011

Creating a DSL for Cypher graph queries

Filed under: Cypher,DSL — Patrick Durusau @ 7:32 pm

Creating a DSL for Cypher graph queries

From the post:

My first assignment at Neo4j was to create a Java DSL for the Cypher query language, that is used to access data from the Neo4j database in a graphy way.

First off, why a DSL? There’s a ton of reasons why using a DSL instead of strings is a good idea. From a practical point of view a DSL and a decent IDE will make creating queries so much easier, as you can use code completion to build the query. No need to refer to manuals and cheat sheets if you forget the syntax. Second, I have found it useful to create queries iteratively in a layered architecture, whereby the domain model can create a base query that describes some concept, like “all messages in my inbox”, and then the application layer can take this and enhance with filtering, like “all messages in my inbox that are sent from XYZ”, and then finally the UI can add the order by and paging. Doing something like this would be extremely difficult without a DSL.

You get to learn something about DSLs and Cypher at the same time!

How cool is that?

November 3, 2011

Neo4j’s Cypher internals – Part 2: All clauses, more Scala’s Parser Combinators and query entry point

Filed under: Cypher,Graphs,Neo4j,Query Language,Scala — Patrick Durusau @ 7:15 pm

Neo4j’s Cypher internals – Part 2: All clauses, more Scala’s Parser Combinators and query entry point

From the post:

During the previous post, I’ve explained what is Neo4j and then, explained how graph traversal could be done on Neo4j using the Java API. Next, I’ve introduced Cypher and how it helped write queries, in order to retrieve data from the graph. After introducing Cypher’s syntax, we dissected the Start Clause, which is the start point (duh) for any query being written on Cypher. If you hadn’t read it, go there, and then come back to read this one.

In this second part, I’ll show the other clauses existents in Cypher, the Match, Where, Return, Skip and Limit, OrderBy and Return. Some will be simple, some not and I’ll go in a more detailed way on those clauses that aren’t so trivial. After that, we will take a look at the Cypher query entry point, and how the query parsing is unleashed.

Nuff said, let’s get down to business.

This and part 1 are starting points for understanding Cypher. A key to evaluation of Neo4j as a topic map storage/application platform.

True enough, at present (1.4) Neo4j only supports 32 billion nodes, 32 billion relationships and 64 billion properties per database but on the other hand, I have fewer than 32 billion books than that so at a certain level of coarseness it should be fine. 😉

BTW, I do collect CS texts, old as well as new. Mostly algorithm, parsing, graph, IR, database sort of stuff but occasionally other stuff too. Just in case you have a author’s copy or need to clear out space for more books. Drop me a line if you would like to make a donation to my collection.

October 14, 2011

Cypher Cookbook

Filed under: Cypher,Graphs,Hypergraphs,Neo4j — Patrick Durusau @ 6:25 pm

Cypher Cookbook

I have been learning to bake bread so you can imagine my disappointment when I saw “Cypher Cookbook” only to find that Peter was talking about Neo4j queries. Really! 😉

From the first entry:

Hyperedges and Cypher

Imagine a user being part of different groups. A group can have different roles, and a user can be part of different groups. He also can have different roles in different groups apart from the membership. The association of a User, a Group and a Role can be referred to as a HyperEdge. However, it can be easily modeled in a property graph as a node that captures this n-ary relationship, as depicted below in the U1G2R1 node.

The graph model is necessary to illustrate the query but hyperedges need to also be treated under modeling or the current Domain Modeling Galllery. I would argue that full examples should be provided for as many domains as possible. (See how easy it is to assign work to others? I don’t know how soon but I hope to be a contributor in that respect.)

Another “cookbook” section could address importing data into Neo4j. Particularly from some of the larger public databases.

If anyone who wants wider adoption of Neo4j needs a motivating example, consider the number of people who use DocBook (its an XML format) versus ODF or OOXML (used by OpenOffice and MS Office (well, MS Office saves as both). If you want wide adoption (which I personally think is a good idea for graph databases) then use can’t be a test of user dedication or integrity.

October 12, 2011

Neo4j 1.5 “Borden Bord” Milestone 2 – Autumnal Fruits of our Labor

Filed under: Cypher,Graphs,Neo4j — Patrick Durusau @ 4:35 pm

Neo4j 1.5 “Borden Bord” Milestone 2 – Autumnal Fruits of our Labor

To temp you in reading the announcement (and downloading the release):

As the last of the summer sunshine leaves us and the northern winter approaches, at Neo HQ we’ve been hunkered around our laptops for warmth and been busy packing in all manner of new functionality for the forthcoming Neo4j 1.5 release. In our last milestone release before our GA, we’re opening the floodgates and letting out a feature-complete stack. And there’s a lot in here too!

<snip>

The team behind the Cypher query language continues to innovate at a ferocious pace which has meant some powerful upgrades to the syntax. Some existing queries might have to be migrated. In this release Cypher’s been extended and refined so that:

  • Relationships can be made optional
  • Added new predicates for iterables: ALL/ANY/NONE/SINGLE to refine filtering on returned subgraphs
  • New path functions: NODES/RELATIONSHIPS/LENGTH return respectively the nodes, relationships or length of a path
  • Parameters for literals, index queries and node/relationship id
  • Shortest path support has been added
  • The Pattern matcher implementation will, if possible, eliminate subgraphs early, by using the predicates from the WHERE clause providing faster response times
  • Relationships can be bound
  • Added IS NULL for painless null checking
  • Added new aggregate function COLLECT which combines multiple result rows into a single list of values

Cypher’s capabilities and expressiveness continue to improve, and they’re fueled by your feedback so take these features for a test drive.

There are lots of other new features, I just have a weakness for Cypher features. Comment to list your favorites!

September 15, 2011

Pagination with Neo4j

Filed under: Cypher,Neo4j,py2neo — Patrick Durusau @ 7:53 pm

Pagination with Neo4j by Nigel Small.

I saw this on a retweet from Peter Neubauer.

Following a request on Twitter, I have spent a few hours putting together a quick article on pagination using Neo4j and more specifically the Cypher query language. Predictably, this is written from a Python standpoint and uses py2neo, but the theory should hold true for any language since all the clever bits come from Cypher.

Fundamentally, the method described here exploits the order by, skip and limit features of Cypher in order to return only a segment of the total results from the overall result set. These features are available in the latest stable version of Neo4j at the time of writing, so if you don’t have access to them already, maybe it’s time to consider an upgrade!

The longer you wait to upgrade, the more stuff you will have to learn! 😉

Please upgrade responsibly (to a stable version, but if you are brave, not!).

September 8, 2011

How Neo4j uses Scala’s Parser Combinator: Cypher’s internals – Part 1

Filed under: Cypher,Graphs,Neo4j,Query Language,Scala — Patrick Durusau @ 5:54 pm

How Neo4j uses Scala’s Parser Combinator: Cypher’s internals – Part 1

From the post:

I think that most of us, software developers, while kids, always wanted to know how things were made by inside. Since I was a child, I always wanted to understand how my toys worked. And then, what I used to do? Opened’em, sure. And of course, later, I wasn’t able to re-join its pieces properly, but this is not this post subject 😉 . Well, understanding how things works behind the scenes can teach us several things, and in software this is no different, and we can study how an specific piece of code was created and mixed together with other code.

In this series of posts I’ll share what I’ve found inside Neo4J implementation, specifically, at Cypher’s code (its query language).

In this first part, I’ll briefly introduce Neo4J and Cypher and then I’ll start to explain the internals of its parser and how it works. Since it is a long (very very long subject, in fact), part 2 and subsequents are coming very very soon.

If you want to understand the internals of a graph query language, this looks like a good place to start.


Update: Neo4j’s Cypher internals – Part 2: All clauses, more Scala’s Parser Combinators and query entry point

August 21, 2011

Spring Data Graph 1.1.0 with Neo4j support released

Filed under: Cypher,Graphs,Gremlin,Neo4j,Spring Data — Patrick Durusau @ 7:05 pm

Spring Data Graph 1.1.0 with Neo4j support released

From the wiki:

We are pleased to announce that the second release (1.1.0.RELEASE) of the Spring Data Graph project with Neo4j support is now available!

After the first public release of Spring Data Graph in April 2011 we mainly focused on user feedback.

With the improved documentation around the tooling and an upgraded AspectJ version we addressed many of the AspectJ issues that where reported by users. With the latest STS and Eclipse and hopefully with Idea11 it is possible to develop Spring Data Graph applications without the red wiggles. To further ease the development we also provided sample build scripts for ant/ivy and a plugin for gradle.

Of course we kept pace with development of Neo4j, currently using the latest stable release of Neo4j (1.4.1).

During the last months of Neo4j development the improved querying (Cypher, Gremlin) support was one of the important aspects.

So we strove to support it on all levels. Now, it is possible to execute Cypher queries from Spring Data Graph Repositories, from the Neo4j-Template but also as part of dynamic field annotations and via the introduced entity methods. The same goes for Gremlin scripts. What’s possible with this new expressive power? Let’s take a look. …

OK, better? Worse? About the same? Projects can’t improve without your feedback. Issues discussed only around water coolers can’t be addressed. Yes?

There’s some famous so-and-so’s Law about non-reported comments but I can’t find the reference. You?

July 28, 2011

Neo4j 1.4 and Cypher

Filed under: Cypher,Neo4j — Patrick Durusau @ 6:56 pm

Neo4j 1.4 and Cypher

From the description:

Neo4j 1.4 has just been released and it’s chock full of new features for seasoned users and novices alike. At this meetup we’ll cover new features like auto-indexing, paged graph traversal and batch-orientation in the REST API. We’ll also dive a little deeper, revisiting the Doctor Who dataset and use the new Neo4j query language called “Cypher” to explore the universe in a humane, DBA-friendly manner. As always there’ll be plenty of scope for war stories and graph chit-chat, and a round of beers on the Neo4j team.

June 27, 2011

Introduction to Cypher

Filed under: Cypher,Neo4j,Query Language — Patrick Durusau @ 6:37 pm

Introduction to Cypher

From the webpage:

Michael Hunger introduces basic graph queries on a movie dataset using Neo4j’s Cypher language.

Short but impressive! Show this one to anyone you want to convince about using graph databases.

« Newer Posts

Powered by WordPress