Query Building Tools

Two tools for building test graphs and advanced queries
GitHub - adxsoft/buildlogseqtestgraph: Build a test logseq graph with generated data and query testing capabilities - python app includes a generated test graph with query testing (only tested on Mac OS so far)
GitHub - adxsoft/logseqadvancedquerybuilder - online pyscript app that simplifies building advanced queries (Seems to work ok on Desktop and Mobile)
I have used these for my testing purposes so they may help others especially those struggling with advanced queries

I will be refining these tools further as I aquier a deeper understanding of advanced queries.

Thanks for that @adxsoft !

@adxsoft thank you! I’ll test it.

I am continuing to develop the tool further as my understanding of advanced queries improves.

One key area that took me some time to appreciate is that there are two types of major retrieval mechanisms and I am implementing them for v0.2 of the onlline tool which I should release in the next week or two

Type 1 retrieval is for each page (which has a ‘special block’ of its own which I detect by presence of :block/original-name. All the page attributes are available in the query results ie page tags, page properties, alias, original page name(case sensitive) and pagename (lower case) and are returned in the query result.

Type 2 is for every block in the graph (which includes the page special blocks) and it has references to the page that owns the block. However it returns only the block in the result.

Wish me luck :slight_smile:

PS it would be great if the type 2 queries returned the page title in the result. Still haven;t worked out how to get that as a property in the result

6 Likes

Upgraded logseqadvancedquerybuilder to v0.2 with the following

  • clarify pages retrieval vs blocks retrieval in FAQ, Simple Commands
  • Added ‘and’ and ‘or’ keywords in arguments for a command, For example can now say
- tagA
- or tagA

and also

- property category, "fiction"
- and property category, "western"
  • Added a logseq test graph download button to help user test advanced queries
  • Force user to choose either pages or block retrieval, Default to block retrieval
  • improved error messaging
  • improved descriptions for the generated advanced query lines
  • bug fixes

Notes.
(1) The introduction of and and or prefixes will enable more control over boolean logic while still keeping the command arguments relatively simple
(2) You can now download the full test graph without the need to use the buildlogseqtestgraph tool. however if you want to control the random content and number of pages, journals, tags etc then you should use the buildlogseqtestgraph and ‘roll your own’ test graph.
(3) The test graph when downloaded contains over 40 advanced query examples that execute within the test graph

2 Likes

Grate! Thanks, @adxsoft!

I now have a logseq plugin that builds advanced queries using the same functions from the online tool.

See demo at Logseq Query Builder Plugin Demo - YouTube

Can find the plugin at GitHub - adxsoft/logseq-query-builder-plugin: A logseq plugin that generates advanced queries from simple commands

Full documentation is at GitHub - adxsoft/docs-logseq-query-builder-plugin

1 Like

Note. The online tool at Logseq Query Builder has been re-written in Javascript and is much faster than the previous pyScript version.

2 Likes