RoamJS / query-builder

https://roamjs.com/extensions/query-builder
MIT License
20 stars 5 forks source link

Having a [[node]] page breaks dgraph relation queries #275

Closed mdroidian closed 1 day ago

mdroidian commented 1 month ago

Problem

Query Builder condition: node {dgraph relation} {specific dgraph node} EG: image

results in con

{
    "uid": "XOCN-tpwl",
    "source": "node",
    "target": "[[CLM]] - test mg clm",
    "relation": "Opposes",
    "type": "clause",
    "not": false
}

The Discourse Datalog Translator checks to see if the value being passed is a

The value being passed is source, which is "node"

https://github.com/RoamJS/query-builder/blob/315dcc7f3dbc3fb2e23bd1045d56212b7223c2cb/src/utils/registerDiscourseDatalogTranslators.ts#L311-L316

so if the graph has [[node]], this is true:

https://github.com/RoamJS/query-builder/blob/315dcc7f3dbc3fb2e23bd1045d56212b7223c2cb/src/utils/registerDiscourseDatalogTranslators.ts#L290

which results in has title instead of is a

Proposed Solution

also check for node here https://github.com/RoamJS/query-builder/blob/315dcc7f3dbc3fb2e23bd1045d56212b7223c2cb/src/utils/registerDiscourseDatalogTranslators.ts#L266