Hi,
I would like to use val© in upsert mutatation, but it returns error:
{
"name": "t",
"url": "https://XYZ.eu-central-1.aws.cloud.dgraph.io/mutate?commitNow=true",
"errors": [
{
"message": "while lexing uid(this) <Device.structuralSim> uid(other) (t=val(c)) . at line 1 column 53: Invalid input: ) at lexText",
"extensions": {
"code": "ErrorInvalidRequest"
}
}
]
}
usert query looks like:
upsert {
query{
THIS as var(func: eq(Device.id,"Dev1"))
var(func: uid(THIS)) {
this as uid
Q as all: count(Device.additionalProperties)
P as math(1)
THIS_PROPERTIES as Device.additionalProperties {
THIS_ATT as Property.attribute
OTHER as Property.devices @filter(NOT uid(THIS)) {
ALL_PROPERTIES as math(Q/P)
}
}
}
var(func: uid(OTHER)) {
SAME_VALUE as same: Device.additionalProperties @filter(uid(THIS_PROPERTIES))
ONLY_ATT as only_att: Device.additionalProperties @filter(NOT uid(THIS_PROPERTIES)) @cascade {
Property.id
Property.attribute @filter(uid(THIS_ATT)){
Attribute.inProperties @filter(NOT uid(SAME_VALUE))
}
}
}
var(func: uid(OTHER)) {
SAME_VALUE_COUNT as c: count(Device.additionalProperties @filter(uid(SAME_VALUE)))
ONLY_ATT_COUNT as a: count(Device.additionalProperties @filter(uid(ONLY_ATT)))
}
structural_sim(func: uid(OTHER)) @normalize {
other as uid
id: Device.id
all: math(ALL_PROPERTIES)
same_values: math(SAME_VALUE_COUNT)
only_same_attributes: math(ONLY_ATT_COUNT)
c as coefficient: math((SAME_VALUE_COUNT*1.0 / ALL_PROPERTIES*1.0) + (ONLY_ATT_COUNT*1.0 / ALL_PROPERTIES)*0.7)
}
}
mutation {
set {
uid(this) <Device.structuralSim> uid(other) (t=val(c)) .
}
}
}
Upsert is working if I change (t=val(c))
to (t=1)
I run Dgraph instance on cloud. Version is v20.11.2-rc1-16-g4d041a3a