0

I'm trying to learn Datascript in the context of LogSeq, and I've stumbled into something I'm not sure how to solve.

The Fundamental Problem

I'm trying to query for a subset of entities that have NOT been referenced by attributes on a different group of filtered entities.

The Background

General LogSeq schema: https://github.com/logseq/logseq/blob/master/deps/db/src/logseq/db/schema.cljs

LogSeq Documentation for Datascript: https://docs.logseq.com/#/page/advanced%20queries

I've got a set of entities, with :block/properties like so:

  • tags:: contact
  • list:: C

Other entities have :block/refs to these pages.

I'm trying to create a query that shows me the contacts in a given list (A|B|C) that have NO notes within the past two weeks.

In SQL this would be a straightforward left join, but I'm having trouble translating that to Datalog since the information is in two different entity groups (instead of attributes all on the same entity). I assume there's some sort of not-join to filter out the contacts that have recent refs, but since that data is in other entities, I'm not sure how to structure the query since my implicit joins knock out either one group or the other.

I should add, because this is in LogSeq, I can't do two separate queries and join them in code. It has to be in one go.

Thank you!

FTWynn
  • 1,349
  • 2
  • 11
  • 11

0 Answers0