Last active
September 15, 2023 08:57
-
-
Save gkorland/a07df69a80a16593351403f642d579fa to your computer and use it in GitHub Desktop.
FakorDB BoltDemo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.falkordb; | |
import redis.clients.jedis.UnifiedJedis; | |
import redis.clients.jedis.graph.ResultSet; | |
import redis.clients.jedis.graph.Record; | |
public class FalkorDBBench { | |
public static void main(String args[]) { | |
try (UnifiedJedis jedis = new UnifiedJedis("redis://localhost:6379")) { | |
jedis.graphQuery("MotoGP", "CREATE " | |
+ "(:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}), " | |
+ "(:Rider {name:'Dani Pedrosa'})-[:rides]->(:Team {name:'Honda'}), " | |
+ "(:Rider {name:'Andrea Dovizioso'})-[:rides]->(:Team {name:'Ducati'})"); | |
jedis.graphQuery("MotoGP", "CREATE INDEX FOR (r:Rider) ON (r.name)"); | |
jedis.graphQuery("MotoGP", "CREATE INDEX FOR (t:Team) ON (t.name)"); | |
ResultSet result = jedis.graphQuery("MotoGP", "MATCH (r:Rider)-[:rides]->(t:Team) " | |
+ "WHERE t.name = 'Yamaha' RETURN r.name, t.name"); | |
for (Record record : result) { | |
System.out.println(record.getString("r.name") | |
+ " in " + record.getString("t.name")); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment