Let say I have the following schema:
<asset>: default .
<a.label>: string @index(term) @lang .
<a.tag>: uid .
<tag>: default .
<t.label>: string @index(exact) .
<user>: default .
<u.asset>: uid @count @reverse .
<u.name>: string .
And I have the following query (working fine):
query all($userId: string) {
profile(func: uid($userId)) {
name: u.name
total_assets: count(u.asset)
}
var(func: uid($userId)) {
assetIds as u.asset
u.asset @groupby(a.tag) {
tagsCount as count(uid)
}
}
assets(func: uid(assetIds)) {
label: a.label
}
tags(func: uid(tagsCount)) {
label: t.label
count : val(tagsCount)
}
}
How do I move everything inside var
block to be inside profile
block? I tried this:
profile(func: uid($userId)) {
name: u.name
total_assets: count(u.asset)
assetIds as u.asset
UNUSEDVAR as u.asset @groupby(a.tag) {
tagsCount as count(uid)
}
}
But Ratel complains:
Message: Some variables are defined but not used
Defined:[assetIds tagsCount UNUSEDVAR]
Used:[assetIds tagsCount]
The reason I put UNUSEDVAR is to suppress it from appearing in the result of profile
.
Side question: Is this query performant/memory-efficient? Considering I need to retrieve all assetIds
to use it in assets()
.