Re: [Neo4j] How to create a pipe (User Defined Step), which returns a set of Vertices for each of input Vertex

2011-10-18 Thread skarab77
Hi All, 

I am sorry for my previous email, I made a mistake and chose a wrong mailing 
list (neo4j instead of gremlin mailing list).  

Best Regards,
Wojtek  


Dnia 18 października 2011 9:59 skarab77  napisał(a):

> I need a pipe, which returns a set of vertices for an input Vertex (wrapped 
> in User Defined Step). I use blueprints pipes with Neo4j. My current code is:
> 
> import org.junit.Test
> import com.tinkerpop.blueprints.pgm.Graph
> import com.tinkerpop.blueprints.pgm.Vertex
> import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex
> import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory
> import com.tinkerpop.gremlin.Gremlin
> import com.tinkerpop.pipes.AbstractPipe
> import com.tinkerpop.pipes.Pipe
> 
> class MyUDSTest  {
> 
> public static class MyPipe extends  AbstractPipe> {
> 
> @Override
> protected Iterable processNextStart() throws 
> NoSuchElementException {
> def v =  this.starts.next();
> 
> def nodes = [v, v, v].iterator; 
> 
> return new Iterable() {
> @Override
> public Iterator iterator() {
> return new Iterator() {
> @Override
> public boolean hasNext() {
> return nodes.hasNext();
> }
> 
> @Override
> public Vertex next() {
> return new Neo4jVertex(nodes.next(), graph);
> }
> 
> @Override
> public void remove() {
> throw new UnsupportedOperationException();
> 
> }
> };
> }
> };
> }
> 
> }
> 
> @Test
> public void testUDS() 
> {   
> Gremlin.load();
> Graph g; 
> Gremlin.defineStep('myPipe',[Vertex,Pipe], { new MyPipe() })
> 
> g = TinkerGraphFactory.createTinkerGraph()
> println "$g"
> def result = [] 
> g.v(1).myPipe.filter{true} >> result
> 
> result.each {
> println "$it"   
> }   
> 
> }
> 
> }
> 
> However it does not work property in the gremlin expression:
> 
> Gremlin.defineStep('myPipe',[Vertex,Pipe], { new MyPipe() })
>  ...
>  def result = [];
>  g.v(1).myPipe >> result
> 
> result.each 
> {
>   println it
> }
> 
> prints out: neo4j.MyUDSTest$MyPipe$1@49aacd5f. I would expect that I will get 
> a list of vertices. Could anybody help me with this pipe? 
> 
> 
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] How to create a pipe (User Defined Step), which returns a set of Vertices for each of input Vertex

2011-10-18 Thread skarab77
I need a pipe, which returns a set of vertices for an input Vertex (wrapped in 
User Defined Step). I use blueprints pipes with Neo4j. My current code is:

import org.junit.Test
import com.tinkerpop.blueprints.pgm.Graph
import com.tinkerpop.blueprints.pgm.Vertex
import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex
import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory
import com.tinkerpop.gremlin.Gremlin
import com.tinkerpop.pipes.AbstractPipe
import com.tinkerpop.pipes.Pipe

class MyUDSTest  {

public static class MyPipe extends  AbstractPipe> {

@Override
protected Iterable processNextStart() throws NoSuchElementException 
{
def v =  this.starts.next();

def nodes = [v, v, v].iterator; 

return new Iterable() {
@Override
public Iterator iterator() {
return new Iterator() {
@Override
public boolean hasNext() {
return nodes.hasNext();
}

@Override
public Vertex next() {
return new Neo4jVertex(nodes.next(), graph);
}

@Override
public void remove() {
throw new UnsupportedOperationException();

}
};
}
};
}

}

@Test
public void testUDS() 
{   
Gremlin.load();
Graph g; 
Gremlin.defineStep('myPipe',[Vertex,Pipe], { new MyPipe() })

g = TinkerGraphFactory.createTinkerGraph()
println "$g"
def result = [] 
g.v(1).myPipe.filter{true} >> result

result.each {
println "$it"   
}   

}

}

However it does not work property in the gremlin expression:

Gremlin.defineStep('myPipe',[Vertex,Pipe], { new MyPipe() })
 ...
 def result = [];
 g.v(1).myPipe >> result

result.each 
{
  println it
}

prints out: neo4j.MyUDSTest$MyPipe$1@49aacd5f. I would expect that I will get a 
list of vertices. Could anybody help me with this pipe? 

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


[Neo4j] TransactionFailureException

2011-09-09 Thread skarab77
Hi,

I have the following problem: when my program crash in the middle of the 
transaction, I am not able to start my neo4j embedded store again. I get the 
following exception.

Exception in thread "main" org.neo4j.graphdb.TransactionFailureException: 
Unable to start TM, no active tx log file found but found either tm_tx_log.1 or 
tm_tx_log.2 file, please set one of them as active or remove them.
at org.neo4j.kernel.impl.transaction.TxManager.init(TxManager.java:175)
at org.neo4j.kernel.impl.transaction.TxModule.start(TxModule.java:96)
at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:161)
at 
org.neo4j.kernel.EmbeddedGraphDbImpl.(EmbeddedGraphDbImpl.java:190)
at 
org.neo4j.kernel.EmbeddedGraphDatabase.(EmbeddedGraphDatabase.java:80)
at 
org.neo4j.kernel.EmbeddedGraphDatabase.(EmbeddedGraphDatabase.java:64)

My settings are: Neo4j 1.4.1 (1.5M1) Community Version, Windows 7 64bit, JDK 
1.6.27 32bit. The file tm_tx_log.1 is empty. My code is following the neo4j 
guideline: //http://wiki.neo4j.org/content/Transactions and I have also 
registered shutdownHook to close Neo4j in case of an error.

Best Regards,
Wojtek
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Relationship[3] exist but relationship type[2] not found.

2011-09-06 Thread skarab77
Hi All,

I have get the following exception: 

Exception in thread "AWT-EventQueue-0" org.neo4j.graphdb.NotFoundException: 
Relationship[1451488] exist but relationship type[2] not found.
at 
org.neo4j.kernel.impl.core.NodeManager.getRelForProxy(NodeManager.java:566)
at 
org.neo4j.kernel.impl.core.RelationshipProxy.getType(RelationshipProxy.java:75)

>From this post 
>(http://neo4j-community-discussions.438527.n3.nabble.com/Neo-NotFoundException-Question-td717235.html)
> I have learned that it can indicate that my neo4j instance is in the 
>inconsistency state. Is it possible to fix this issue, is it possible to add 
>somehow the missing relationship type?

Best Regards,
Wojtek
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user