mirror of
https://github.com/Noratrieb/recommentation-bot.git
synced 2026-01-14 16:25:03 +01:00
code:neo4j
This commit is contained in:
parent
b976380cd9
commit
3d25b85201
1 changed files with 11 additions and 0 deletions
|
|
@ -54,6 +54,17 @@ public class Neo4jConnection implements AutoCloseable {
|
|||
}
|
||||
|
||||
public boolean isSubbed(String uid, String targetId) {
|
||||
try (Session session = driver.session()) {
|
||||
var result = session.writeTransaction(tx -> {
|
||||
Result r = tx.run("""
|
||||
MATCH (:User {id:$uid}) - [:SUBS_TO] -> (:User {id:$target})
|
||||
RETURN
|
||||
""",
|
||||
parameters("uid", uid, "target", targetId));
|
||||
return r.single().size();
|
||||
});
|
||||
System.out.println(result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue