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

January 16, 2012

Neo4j 1.6.M03 “Jörn Kniv”

Filed under: Graphs,Neo4j — Patrick Durusau @ 2:39 pm

Neo4j 1.6.M03 “Jörn Kniv”

Didn’t mean for today to turn into a Neo4j day but I missed this release last week.

From the post:

Kernel changes

This release includes a popular feature request: the ability to ensure that key-value pairs for entities are unique!

If you look up entities (nodes or relationships) using an external key, you’ll want exactly one entity to correspond to each value of the key. For example, if you have nodes representing people, and you look these up using Social Security Number (SSN), you’ll want exactly one node for each SSN. This is easily achieved if you load all your data sequentially, because you can add a new node each time you meet a value of the key (a new SSN). However, up to now, it has been awkward to maintain this uniqueness when multiple processes are adding data simultaneously (via web requests for example).

Since this is a common use-case, we’ve improved the API to make it easy to enforce entity uniqueness for a given key-value pair. At the index level, we’ve added a new method putIfAbsent which ensures that only one entity will indexed for the key-value pair, even if lots of threads are using the same key-value pair at the same time. Alternatively, if you’d prefer to work with nodes or relationships rather than with the underlying indexes, there’s a higher level API provided by UniqueFactory. This makes it easy to retrieve an entity using get-or-create semantics, i.e. it returns a matching entity if one exists, otherwise it creates one. Again, this mechanism is thread-safe, so it doesn’t matter how many threads call getOrCreate simultaneously, only one entity will be created for each key-value pair. This functionality is also exposed through the REST API, via a ?unique query parameter.

Cypher

Array properties have been supported in Neo4j for a long time, but until now it wasn’t possible to query on them. This milestone makes it possible to filter on array properties in Cypher. We have also improved aggregation performance.

Lucene upgrade

Neo4j uses Apache Lucene for its indexing features – this allows you to find “entry points” into the graph before starting graph-based queries. Lucene is an actively developed project in its own right, and is constantly being enhanced and improved. In this Neo4j release, we’re taking the opportunity to upgrade to a newer stable release of Apache Lucene, so that all users get the benefits of recent enhancements in Lucene. We’ve moved to Lucene 3.5; for details on all the changes, have a look at their changelog.

Hmmm, so putifAbsent returns “the previously indexed entity,” so I should be able to determine if properties I have are absent from the entity. If they are, add, if not, ignore (or add additional provenance information, etc).

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress