On Wednesday, June 6, 2012 at 5:50:16 PM UTC+5:30, Neo wrote:
>
> Resolved!! Thanks for the help Mark.
>
> On Wednesday, June 6, 2012 12:42:06 PM UTC+5:30, Neo wrote:
>>
>> Hey thanks Mark, I have tried according to your instructions with 
>> following code.
>>
>> import javax.script.ScriptEngine;import javax.script.ScriptEngineManager;
>> import com.tinkerpop.blueprints.pgm.Graph;import 
>> com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph;
>> public class query_caller{
>>     public static void main(String[] args){
>>         ScriptEngineManager manager = new ScriptEngineManager();
>>         ScriptEngine engine = manager.getEngineByName("gremlin-groovy");
>>         Graph graph = new 
>> Neo4jGraph("E:/Projects/Neo4j/neo4j-community-1.7/data/graph.db");
>>         
>>     }}
>>
>>
>>
>> But I got following error.
>>
>> Exception in thread "main" org.neo4j.graphdb.TransactionFailureException: 
>> Could not create data source [nioneodb], see nested exception for cause of 
>> error
>>     at 
>> org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:153)
>>     at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:111)
>>     at 
>> org.neo4j.kernel.EmbeddedGraphDbImpl.<init>(EmbeddedGraphDbImpl.java:190)
>>     at 
>> org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:80)
>>     at 
>> org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:64)
>>     at 
>> com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph.<init>(Neo4jGraph.java:71)
>>     at 
>> com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph.<init>(Neo4jGraph.java:62)
>>     at query_caller.main(query_caller.java:12)
>> Caused by: 
>> org.neo4j.kernel.impl.transaction.xaframework.IllegalLogFormatException: 
>> Invalid log format version found, expected 1 but was 2. To be able to 
>> upgrade from an older log format version there must have been a clean 
>> shutdown of the database
>>     at 
>> org.neo4j.kernel.impl.transaction.xaframework.LogIoUtils.readLogHeader(LogIoUtils.java:54)
>>     at 
>> org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.readLogHeader(XaLogicalLog.java:1213)
>>     at 
>> org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.doInternalRecovery(XaLogicalLog.java:742)
>>     at 
>> org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.open(XaLogicalLog.java:230)
>>     at 
>> org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.open(XaLogicalLog.java:184)
>>     at 
>> org.neo4j.kernel.impl.transaction.xaframework.XaContainer.openLogicalLog(XaContainer.java:97)
>>     at 
>> org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.<init>(NeoStoreXaDataSource.java:143)
>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
>>     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown 
>> Source)
>>     at java.lang.reflect.Constructor.newInstance(Unknown Source)
>>     at 
>> org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:75)
>>     at 
>> org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:147)
>>     ... 7 more
>>
>> On Tuesday, June 5, 2012 10:03:17 PM UTC+5:30, Marko Rodriguez wrote:
>>>
>>> Hi,
>>>
>>> There is an example here:
>>>
>>> https://github.com/tinkerpop/gremlin/wiki/Using-Gremlin-through-Java
>>>
>>> See the last section entitled:
>>> Using JSR 223 GremlinGroovyScriptEngine
>>>
>>> Where instead of 
>>>
>>> graph = TinkerGraphFactory.createTinkerGraph();
>>>
>>> do
>>> graph = new Neo4jGraph(...);
>>>
>>> Good luck,
>>> Marko.
>>>
>>> http://markorodriguez.com 
>>>
>>> On Jun 5, 2012, at 9:46 AM, Neo wrote:
>>>
>>> Hey Peter,
>>> Thanks for the reply. Could you please kindly give a very simple sample 
>>> code to run queries on a Neo4j graphdb (not based on gremlin plug-in for 
>>> REST API). It's very difficult for me to comprehend from the link you have 
>>> give.
>>>
>>> On Tuesday, June 5, 2012 9:05:54 PM UTC+5:30, Peter Neubauer wrote:
>>>>
>>>> Hi there, 
>>>> you put the reference to any bound variables in a map and give it to 
>>>> the engine for evaluation, look at the Gremlin plugin for reference, 
>>>>
>>>>
>>>> https://github.com/neo4j/gremlin-plugin/blob/master/src/main/java/org/neo4j/server/plugin/gremlin/GremlinPlugin.java#L81
>>>>  
>>>>
>>>> Cheers, 
>>>>
>>>> /peter neubauer 
>>>>
>>>> G:  neubauer.peter 
>>>> S:  peter.neubauer 
>>>> P:  +46 704 106975 
>>>> L:   http://www.linkedin.com/in/neubauer 
>>>> T:   @peterneubauer 
>>>>
>>>> If you can write, you can code - @coderdojomalmo 
>>>> If you can sketch, you can use a graph database - @neo4j 
>>>>
>>>>
>>>> On Tue, Jun 5, 2012 at 7:52 AM, Neo <[email protected] <javascript:>> 
>>>> wrote: 
>>>> > Hello, 
>>>> >      I am trying to execute gremlin queries(that I can execute on 
>>>> console) 
>>>> > in Java directly(not through REST-API) similar to executing Cypher 
>>>> queries. 
>>>> > Some documentation is given at which gives following instructions 
>>>> > 
>>>> > 1 ScriptEngineManager manager = new ScriptEngineManager(); 
>>>> > 2 ScriptEngine engine = manager.getEngineByName("gremlin-groovy"); 
>>>> > 3 // or, instead of above, simply do: 
>>>> > 4 //       ScriptEngine engine = new 
>>>> > GremlinGroovyScriptEngineFactory().getScriptEngine(); 
>>>> > 5 // or 
>>>> > 6 //       ScriptEngine engine = new GremlinGroovyScriptEngine(); 
>>>> > 7 Graph graph = TinkerGraphFactory.createTinkerGraph(); 
>>>> > 8 List results = new ArrayList(); 
>>>> > ... 
>>>> > 9 engine.eval("v.out('knows'){it.name.equals(name)}.fill(results)"); 
>>>> > 10 String script = "i = 0\n" + 
>>>> >                 "for(x in 1..10)\n" + 
>>>> >                 "  i++"; 
>>>> > 11 engine.eval(script); 
>>>> > 
>>>> > In line number 7 I have to give a reference to my graphdb, I have 
>>>> tried 
>>>> > following 
>>>> > 
>>>> > Graph graph = new Neo4jGraph($PATH); 
>>>> > 
>>>> > But I am not able to query anything on the graph. How can I give the 
>>>> > reference to my graphdb to Execution Engine? 
>>>> > I tried exploring further, but still after one full day, I can not 
>>>> execute 
>>>> > simple queries on my graphdb . Please tell any other alternative than 
>>>> this 
>>>> > if any. 
>>>> > 
>>>> > Thanks 
>>>>
>>> How to execute through engine gremlin queries on neo4j database in java? 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to