I have a dataset with documents and users. Users can like documents.
Schema:
<likes>: uid @count @reverse .
<title>: string .
<url>: string @index(hash) @upsert .
Given a document A, I want to return all likes of users who have liked document A liked. Preferably excluding A.
I roughly want the following pseudo code but I can’t figure out how to structure it as a valid query.
query ($url: string) {
var(func: eq(url, $url)) @ignorereflex {
~likes {
likes {
uids as uid
}
}
}
var(func: uid(uids)) @groupby(uid) {
counts as count(uid)
}
docs(func: uid(counts)) {
val(counts)
url
title
}
}
Any help or suggestions would be very appreciated
I can just return all the uids from the server and aggregate in the client but that is fairly expensive given the size of the dataset. I’d then have to do a bunch more queries to return the details from each document.