Re: [Neo4j] "Relationship not found" error while traversing/querying (REST API)

2011-11-20 Thread Andres Taylor
On Mon, Nov 21, 2011 at 3:22 AM, Aseem Kishore wrote:

> Hey guys,
>
> If we put our app under a bit of load, creating and removing nodes and
> relationships concurrently, sometimes we get back a 500 Internal Server
> Error from the REST API when we do a traverse or Cypher query. Here's an
> example stack trace:
>
> https://gist.github.com/1381423
>
> We're running Neo4j. 1.4 still, but does this stack trace provide any
> insight/ideas into what might be wrong, what we could do as a workaround,
> etc.? Can I provide any other info that would help?
>

No, not really.


> It goes without saying that our assumption is that Neo4j shouldn't be
> failing/crashing on queries; our expectation was that operations are
> transactional, etc.
>

Cypher in 1.4 was very experimental. If you are using Cypher, I would
suggest you move to 1.5 ASAP - a lot has happened there. If you still have
the same problems with 1.5, then we can start looking for the problem.

Andrés
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Neo4J for semantic graphs + algorithms

2011-11-20 Thread Mattias Persson
Den söndagen den 20:e november 2011 skrev Sébastien HARISPE<
harispe.sebast...@gmail.com>:
> Hello,
> Sorry for the delay in responding, I was busy these days.
>
> Marko
> I will test the proposed stack Thx!
>
> Mattias
> I work on graph based semantic similarity/proximity measures.
> In this case the graph is most of the time a reduction of an ontology i.e
a
> DAG corresponding to the rdfs:SubClassOf backbone of the specification.
> Most of proposed measures use set of ancestors/descendants and require a
> transitive reduction as preprocess...
> I just wanted to known if Neo4J proposed facilities to store temporaly
data
> during a traversal or if I have to manage them by myself.

The closest would be to begin transaction and modify the graph as you go
along to later rollback the transaction. The problem is that you would lock
those parts of the graph during that transaction. So it might be better to
manage it outside the graph if you'd like to have concurrent traversals
over the same subset of the graph
>
> Thanks a lot
>
> SH
>
> On Wed, Nov 16, 2011 at 9:21 AM, Mattias Persson
> wrote:
>
>> 2011/11/13 Sébastien HARISPE 
>>
>> > Hi all,
>> >
>> > First of all, Thx a lot for your amazing work, simply astonishing...
>> > Below three questions related to my interest in using Neo4J as a Graph
DB
>> > on top of which I want to test algorithms dedicated to large semantic
>> > graphs  (OWL/RDF based).
>> > It would be nice if you could help me answer them.
>> >
>> >
>> > A -Using Neo4J with semantic web technologies like RDF/OWL/SPARQL:
>> >
>> > How does Neo4J interact with these technologies?
>> >
>> > I found/read:
>> >
>> >   - an old post explaining how to load OWL into Neo4J using Jena API
>> > [1]<
>> >
>>
http://sujitpal.blogspot.com/2009/05/using-neo4j-to-load-and-query-owl.html
>> > >
>> >   .
>> >   - interesting classes in the org.neo4j.meta.model package
>> > [2
>> >   ,3<
>> >
>>
http://components.neo4j.org/neo4j-meta-model-import/snapshot/apidocs/org/neo4j/meta/input/owl/Owl2GraphDb.html
>> > >]
>> >   but I can't locate the package in the 1.5 apidocs
>> > [4]
>> >   .
>> >   - that the org.neo4j.rdf and org.neo4j.meta do not follow the core
>> >   components release, are they currently supported?
>> >   - a ticket related to the addition of SPARQL plugin to the Neo4J
>> server,
>> >   which means that semantic processes are part of your preoccupations
;).
>> >
>> > Can you detail the position of Neo4J considering OWL/RDF/SPARQL
>> > technologies?
>> > I can't easily find documentation about Neo4J and OWL
>> > [5],
>> > the use of RDF and SPARQL is well detailed however
>> > [6]
>> > .
>> > I also read about Sail on top of Neo4j
>> > [7],
>> > and to be honest, I'm quite lost...
>> >
>> > Do you think Neo4J is an interesting solution to interact with these
>> > technologies, that is to say, loading OWL specification as graph
>> > (simplification of the spec e.g classes, instances relationships
between
>> > them), adding RDF triplet and using SPARQL?
>> >
>> >
>> >
>> > B - Algorithm implementations:
>> >
>> > As you know many graph algorithms need to store temporary results e.g.
>> > Dijkstra stores shortest path cost for all nodes during execution.
>> > Due to the size of the graphs, storing this information in memory is
not
>> > possible most of the time, so how do you manage this information?
>> Temporary
>> > node properties? Is there guidance to implement algorithms using Neo4J?
>> >
>> > For extremely big traversal that could be a problem and the algorithms
>> that come with Neo4j (Dijkstra, A*, Shortest path etc.) don't use
temporary
>> properties. How big traversals are we talking about? I know I've done A*
on
>> rather many millions of relationships/nodes. Most algorithms touch only a
>> fraction of the full graph of course so that's usually not a problem even
>> if there are a billion relationships.
>>
>> >
>> >
>> > C - In-memory usage of Neo4J:
>> >
>> > In-memory graphs are very pleasant in order to perform certain CPU
>> > consuming algorithmic treatments on a reduced part of the graph.
>> > Considering an old post
>> > [8]< 

-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] "Relationship not found" error while traversing/querying (REST API)

2011-11-20 Thread Peter Neubauer
Aseem,
What query are you running, and are you modifying your graph on any way at
the same time? Do you have a small example test reproducing this? Looks
like a normal case where this relationship is deleted for some reason, no
failure. Maybe a better Cypher error should point that out...

/peter

Sent from my phone, please excuse typos and autocorrection.
On Nov 21, 2011 3:22 AM, "Aseem Kishore"  wrote:

> Hey guys,
>
> If we put our app under a bit of load, creating and removing nodes and
> relationships concurrently, sometimes we get back a 500 Internal Server
> Error from the REST API when we do a traverse or Cypher query. Here's an
> example stack trace:
>
> https://gist.github.com/1381423
>
> We're running Neo4j. 1.4 still, but does this stack trace provide any
> insight/ideas into what might be wrong, what we could do as a workaround,
> etc.? Can I provide any other info that would help?
>
> It goes without saying that our assumption is that Neo4j shouldn't be
> failing/crashing on queries; our expectation was that operations are
> transactional, etc.
>
> Thanks!
>
> Aseem
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] "Relationship not found" error while traversing/querying (REST API)

2011-11-20 Thread Aseem Kishore
Hey guys,

If we put our app under a bit of load, creating and removing nodes and
relationships concurrently, sometimes we get back a 500 Internal Server
Error from the REST API when we do a traverse or Cypher query. Here's an
example stack trace:

https://gist.github.com/1381423

We're running Neo4j. 1.4 still, but does this stack trace provide any
insight/ideas into what might be wrong, what we could do as a workaround,
etc.? Can I provide any other info that would help?

It goes without saying that our assumption is that Neo4j shouldn't be
failing/crashing on queries; our expectation was that operations are
transactional, etc.

Thanks!

Aseem
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Creating and managing external index

2011-11-20 Thread Avi Shai
What is the best way to create an external index but only for certain nodes?
Really I want something like the in-graph data structures, but instead it
will be stored in another database(s). I am in essence indexing only a
sub-graph or a straight list of nodes. I then want to use these indexes as
entry points in some cases rather than traversing.

I understand that there is already Lucene, but I have data that is better
suited to other indexes. I still want to use Lucene for full-text, just not
for anything else. I am currently taking a stab at implementing the
blueprint index interfaces (manual, automatic), but for another purpose. If
I am always updating these indexes, but only for certain vertex types, what
is the best integration point? In my data service classes/lower level neo4j
stuff, or in a server event handler to plug-in the transaction? What about
for all vertices? I guess I understand how to write the index classes but
not about the best way of consuming them, and not if they apply well for
lots of partial, smaller indexes.

For instance, I want to store data as temporal values, with the most recent
data first for a group of nodes. I'm not doing "Twitter" or a blog, but
either is a good enough analogy.  If I post something with a given tag, I
want to index all the nodes that have been tagged by that tag (tag edge) in
temporal order for example to create a "recently tagged" feed or a "recently
seen users" feed that contains the users that have recently tagged using
that tag. I could store this data in Redis exactly how I want and have  a
hot set in memory that can then be used either directly in some pages in my
app, or as an entry point into neo4j for more complex queries. These indexes
probably require lots of writes and I wanted to also avoid locking related
nodes on any updates.

Currently part of the reason I'm doing this is I have lots of super nodes in
my design. I've patched this some by keeping counts in node properties and
adding proxy nodes as mini-partions to reduce the number of relationships.
I've also looked at things like combining common nodes together as
junctions, but there are too many permutations to scale probably. Anyway, if
I use in-graph indexes, I have to update my indexes every insertion or
update. I'm going to try out indexed relationships, and I think it will
help, but with respect, I don't think it will scale well or fit my use
cases, especially for indexes where data drops out because the size is fixed
(like a fixed list).

I feel that creating index structures in the graph is nice, but it will
severely balloon the graph. Moreover, I want to save resources on the
servers running neo for graph traversals and other graph activities and I
would rather use other clustered servers to store huge amounts of index data
in memory. One other idea is to use another neo4j instance as an index to
itself, but I think the characteristics of what I am doing are better suited
in some cases for Redis (temporal lists) or Mongo (hierarchical metrics)
depending the use-case. Example: pulling down linear lists of time-data by
page and sorting front to back or back to front.

I know that's a lot, but I wanted to at least give some detail beyond what
I've already read here in all the old posts I've dug through this week. Any
feedback? Thanks.


--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Creating-and-managing-external-index-tp3523613p3523613.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Neo4J for semantic graphs + algorithms

2011-11-20 Thread Sébastien HARISPE
Hello,
Sorry for the delay in responding, I was busy these days.

Marko
I will test the proposed stack Thx!

Mattias
I work on graph based semantic similarity/proximity measures.
In this case the graph is most of the time a reduction of an ontology i.e a
DAG corresponding to the rdfs:SubClassOf backbone of the specification.
Most of proposed measures use set of ancestors/descendants and require a
transitive reduction as preprocess...
I just wanted to known if Neo4J proposed facilities to store temporaly data
during a traversal or if I have to manage them by myself.

Thanks a lot

SH

On Wed, Nov 16, 2011 at 9:21 AM, Mattias Persson
wrote:

> 2011/11/13 Sébastien HARISPE 
>
> > Hi all,
> >
> > First of all, Thx a lot for your amazing work, simply astonishing...
> > Below three questions related to my interest in using Neo4J as a Graph DB
> > on top of which I want to test algorithms dedicated to large semantic
> > graphs  (OWL/RDF based).
> > It would be nice if you could help me answer them.
> >
> >
> > A -Using Neo4J with semantic web technologies like RDF/OWL/SPARQL:
> >
> > How does Neo4J interact with these technologies?
> >
> > I found/read:
> >
> >   - an old post explaining how to load OWL into Neo4J using Jena API
> > [1]<
> >
> http://sujitpal.blogspot.com/2009/05/using-neo4j-to-load-and-query-owl.html
> > >
> >   .
> >   - interesting classes in the org.neo4j.meta.model package
> > [2
> >   ,3<
> >
> http://components.neo4j.org/neo4j-meta-model-import/snapshot/apidocs/org/neo4j/meta/input/owl/Owl2GraphDb.html
> > >]
> >   but I can't locate the package in the 1.5 apidocs
> > [4]
> >   .
> >   - that the org.neo4j.rdf and org.neo4j.meta do not follow the core
> >   components release, are they currently supported?
> >   - a ticket related to the addition of SPARQL plugin to the Neo4J
> server,
> >   which means that semantic processes are part of your preoccupations ;).
> >
> > Can you detail the position of Neo4J considering OWL/RDF/SPARQL
> > technologies?
> > I can't easily find documentation about Neo4J and OWL
> > [5],
> > the use of RDF and SPARQL is well detailed however
> > [6]
> > .
> > I also read about Sail on top of Neo4j
> > [7],
> > and to be honest, I'm quite lost...
> >
> > Do you think Neo4J is an interesting solution to interact with these
> > technologies, that is to say, loading OWL specification as graph
> > (simplification of the spec e.g classes, instances relationships between
> > them), adding RDF triplet and using SPARQL?
> >
> >
> >
> > B - Algorithm implementations:
> >
> > As you know many graph algorithms need to store temporary results e.g.
> > Dijkstra stores shortest path cost for all nodes during execution.
> > Due to the size of the graphs, storing this information in memory is not
> > possible most of the time, so how do you manage this information?
> Temporary
> > node properties? Is there guidance to implement algorithms using Neo4J?
> >
> > For extremely big traversal that could be a problem and the algorithms
> that come with Neo4j (Dijkstra, A*, Shortest path etc.) don't use temporary
> properties. How big traversals are we talking about? I know I've done A* on
> rather many millions of relationships/nodes. Most algorithms touch only a
> fraction of the full graph of course so that's usually not a problem even
> if there are a billion relationships.
>
> >
> >
> > C - In-memory usage of Neo4J:
> >
> > In-memory graphs are very pleasant in order to perform certain CPU
> > consuming algorithmic treatments on a reduced part of the graph.
> > Considering an old post
> > [8],
> > a proposed alternative was to rollback the transaction after the
> treatment,
> > i.e load the graph without flushing it. This make sense if you want to
> load
> > a new graph but is it possible to load a specific part of an existing
> graph
> > database in memory? Moreover, in the previously cited post you said that
> > you planned to add an in-memory implementation but I can't find more
> > information in the 1.5 doc, did I missed something?
> >
>
>
> Thx,
> >
> > SH
> >
> > [1]
> >
> http://sujitpal.blogspot.com/2009/05/using-neo4j-to-load-and-query-owl.html
> > [2] http://components.neo4j.org/neo4j-meta-model/snapshot/
> > [3]
> >
> >
> http://components.neo4j.org/neo4j-meta-model-import/snapshot/apidocs/org/neo4j/meta/input/owl/Owl2GraphDb.html
> > [4] http://components.neo4j.org/neo4j/1.5/apidocs/
> > [5] http://wiki.neo4j.org/content/OWL,_SPARQL,_SAIL,_and_RDF
> > [6] http://wiki.neo4j.org/content/RDF_/_SPARQL_Quickstart_Guide
> > [7] https://github.com/datablend/neo4j-sail-test
> > [8] http://lists.neo4j.org/pipermail/user/2010-February/002719.html
> >

Re: [Neo4j] REST, Gremlin and transactions (neo4django's type hierarchy)

2011-11-20 Thread Matt Luongo
Ah, thanks Mattias.

--
Matt Luongo
Co-Founder, Scholr.ly



On Sun, Nov 20, 2011 at 6:12 AM, Mattias Persson
wrote:

> you must add manually taken locks to LockReleaser to tie them to the
> current transaction, otherwise thet will not be released when finishing the
> transaction
>
> Den lördagen den 19:e november 2011 skrev Matt Luongo:
> > Peter,
> >
> > That plus the Gremlin docs both helped. LockManager was actually the
> > difficult piece of the puzzle- even once I knew the name of the class and
> > had the java docs, some things online seemed to suggest that closing a
> > transaction would release read locks (not true, in my experience thus
> far).
> >
> > For posterity -> http://wiki.neo4j.org/content/Locks and
> > http://wiki.neo4j.org/content/Transactions#Isolation were both very
> helpful.
> >
> > --
> > Matt Luongo
> > Co-Founder, Scholr.ly
> >
> >
> >
> > On Sat, Nov 19, 2011 at 4:17 PM, Peter Neubauer <
> > peter.neuba...@neotechnology.com> wrote:
> >
> >> Great Matt,
> >> Did you find this via
> >>
> >>
>
> http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-send-an-arbitrary-groovy-script---lucene-sortingor
> >> should it be better documented?
> >> On Nov 19, 2011 9:56 PM, "Matt Luongo"  wrote:
> >>
> >> > Aha! Scratched my own itch. For anyone interested...
> >> >
> >> > I found Gremlin's getRawGraph(), which let's me play with the
> >> LockManager.
> >> >
> >> >g.setMaxBufferSize(0)
> >> >g.startTransaction()
> >> >lockManager = g.getRawGraph().getConfig().getLockManager()
> >> >
> >> >locked = []
> >> >curVertex = g.v(0)
> >> >for (def typeProps : types) {
> >> >rawVertex = curVertex.getRawVertex()
> >> >lockManager.getReadLock(rawVertex)
> >> >locked << rawVertex
> >> >
> >> >candidate = curVertex.outE('<>').inV.find{
> >> >it.map.subMap(typeProps.keySet()) == typeProps
> >> >}
> >> >if (candidate == null) {
> >> >newTypeNode = g.addVertex(typeProps)
> >> >name = typeProps['app_label'] + ":" +
> typeProps['model_name']
> >> >newTypeNode.name = name
> >> >g.addEdge(curVertex, newTypeNode, "<>")
> >> >curVertex = newTypeNode
> >> >}
> >> >else {
> >> >curVertex = candidate
> >> >}
> >> >}
> >> >for (def lockedRes : locked) {
> >> >lockManager.releaseReadLock(lockedRes, null)
> >> >}
> >> >g.stopTransaction(TransactionalGraph.Conclusion.SUCCESS)
> >> >
> >> >result = curVertex
> >> >
> >> > Of course this puts a read lock on the reference node, which stinks,
> but
> >> > it's what the problem required.
> >> > I'm going to memoize the result of this client-side so it only gets
> >> called
> >> > a couple times.
> >> >
> >> > --
> >> > Matt Luongo
> >> > Co-Founder, Scholr.ly
> >> >
> >> >
> >> >
> >> > On Sat, Nov 19, 2011 at 2:46 AM, Matt Luongo  wrote:
> >> >
> >> > > Guys,
> >> > >
> >> > > I'm trying to get neo4django's type hierarchy behaving in a safe way
> >> for
> >> > > multiprocessing. I ducked the
> >> > > REST API proper and am using the Gremlin extension, since I need the
> >> type
> >> > > creation operation to be atomic.
> >> > >
> >> > > The hierarchy is a simple single-inheritance system represented
> >> in-graph
> >> > > as a tree rooted at the reference
> >> > > node. Each node in the tree represents a type, including it's name
> >> > > (`model_name`) and the module the type
> >> > > was defined in (`app_label`).
> >> > >
> >> > > I came up with the following script
> >> > >
> >> > > g.setMaxBufferSize(0)
> >> > > g.startTransaction()
> >> > >
> >> > > cur_vertex = g.v(0)
> >> > > for (def type_props : types) {
> >> > > candidate = cur_vertex.outE('<>').inV.find{
> >> > > it.map.subMap(type_props.keySet()) == type_props
> >> > > }
> >> > > if (candidate == nu
>
> --
> Mattias Persson, [matt...@neotechnology.com]
> Hacker, Neo Technology
> www.neotechnology.com
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Neo4j server plugin

2011-11-20 Thread Michael Hunger
right you don't need those classes just an inspiration from the code

mobile mail please excuse brevity and typos

Am 20.11.2011 um 14:19 schrieb Jim Webber :

> Hi Shrieesh,
> 
> Take a look here:
> 
> http://mvnrepository.com/artifact/org.neo4j/server-api/1.5
> 
> You'll get the Maven/Ivy/whatever config you need for those dependencies.
> 
> Jim
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Neo4j server plugin

2011-11-20 Thread Michael Hunger
no they are in
org.neo4j.app:server:1.5

mobile mail please excuse brevity and typos

Am 20.11.2011 um 13:29 schrieb Shireesh :

> Hi Michael,
> 
> I was not able to get the specific classes ( DatabaseActions and
> TraverserReturnType) in server-api-1.4.2 jar
> Can you guide me in getting the dependency jar for DatabaseActions and
> TraverserReturnType classes.
> 
> Thanks,
> Shireesh.
> 
> --
> View this message in context: 
> http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-server-plugin-tp3521193p3522610.html
> Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Neo4j server plugin

2011-11-20 Thread Jim Webber
Hi Shrieesh,

Take a look here:

http://mvnrepository.com/artifact/org.neo4j/server-api/1.5

You'll get the Maven/Ivy/whatever config you need for those dependencies.

Jim
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Neo4j server plugin

2011-11-20 Thread Shireesh
Hi Michael,

I was not able to get the specific classes ( DatabaseActions and
TraverserReturnType) in server-api-1.4.2 jar
Can you guide me in getting the dependency jar for DatabaseActions and
TraverserReturnType classes.

Thanks,
Shireesh.

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-server-plugin-tp3521193p3522610.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] REST, Gremlin and transactions (neo4django's type hierarchy)

2011-11-20 Thread Mattias Persson
you must add manually taken locks to LockReleaser to tie them to the
current transaction, otherwise thet will not be released when finishing the
transaction

Den lördagen den 19:e november 2011 skrev Matt Luongo:
> Peter,
>
> That plus the Gremlin docs both helped. LockManager was actually the
> difficult piece of the puzzle- even once I knew the name of the class and
> had the java docs, some things online seemed to suggest that closing a
> transaction would release read locks (not true, in my experience thus
far).
>
> For posterity -> http://wiki.neo4j.org/content/Locks and
> http://wiki.neo4j.org/content/Transactions#Isolation were both very
helpful.
>
> --
> Matt Luongo
> Co-Founder, Scholr.ly
>
>
>
> On Sat, Nov 19, 2011 at 4:17 PM, Peter Neubauer <
> peter.neuba...@neotechnology.com> wrote:
>
>> Great Matt,
>> Did you find this via
>>
>>
http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-send-an-arbitrary-groovy-script---lucene-sortingor
>> should it be better documented?
>> On Nov 19, 2011 9:56 PM, "Matt Luongo"  wrote:
>>
>> > Aha! Scratched my own itch. For anyone interested...
>> >
>> > I found Gremlin's getRawGraph(), which let's me play with the
>> LockManager.
>> >
>> >g.setMaxBufferSize(0)
>> >g.startTransaction()
>> >lockManager = g.getRawGraph().getConfig().getLockManager()
>> >
>> >locked = []
>> >curVertex = g.v(0)
>> >for (def typeProps : types) {
>> >rawVertex = curVertex.getRawVertex()
>> >lockManager.getReadLock(rawVertex)
>> >locked << rawVertex
>> >
>> >candidate = curVertex.outE('<>').inV.find{
>> >it.map.subMap(typeProps.keySet()) == typeProps
>> >}
>> >if (candidate == null) {
>> >newTypeNode = g.addVertex(typeProps)
>> >name = typeProps['app_label'] + ":" +
typeProps['model_name']
>> >newTypeNode.name = name
>> >g.addEdge(curVertex, newTypeNode, "<>")
>> >curVertex = newTypeNode
>> >}
>> >else {
>> >curVertex = candidate
>> >}
>> >}
>> >for (def lockedRes : locked) {
>> >lockManager.releaseReadLock(lockedRes, null)
>> >}
>> >g.stopTransaction(TransactionalGraph.Conclusion.SUCCESS)
>> >
>> >result = curVertex
>> >
>> > Of course this puts a read lock on the reference node, which stinks,
but
>> > it's what the problem required.
>> > I'm going to memoize the result of this client-side so it only gets
>> called
>> > a couple times.
>> >
>> > --
>> > Matt Luongo
>> > Co-Founder, Scholr.ly
>> >
>> >
>> >
>> > On Sat, Nov 19, 2011 at 2:46 AM, Matt Luongo  wrote:
>> >
>> > > Guys,
>> > >
>> > > I'm trying to get neo4django's type hierarchy behaving in a safe way
>> for
>> > > multiprocessing. I ducked the
>> > > REST API proper and am using the Gremlin extension, since I need the
>> type
>> > > creation operation to be atomic.
>> > >
>> > > The hierarchy is a simple single-inheritance system represented
>> in-graph
>> > > as a tree rooted at the reference
>> > > node. Each node in the tree represents a type, including it's name
>> > > (`model_name`) and the module the type
>> > > was defined in (`app_label`).
>> > >
>> > > I came up with the following script
>> > >
>> > > g.setMaxBufferSize(0)
>> > > g.startTransaction()
>> > >
>> > > cur_vertex = g.v(0)
>> > > for (def type_props : types) {
>> > > candidate = cur_vertex.outE('<>').inV.find{
>> > > it.map.subMap(type_props.keySet()) == type_props
>> > > }
>> > > if (candidate == nu

-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user