- What are "Queries" in Logseq?
- Queries are for asking questions from your knowledge base and the outside world.
- How to write simple queries?
- By using
{{query }}
, the format is something like this:
{{query Something you're looking for}}
- By using
- How to write simple queries?
- Queries are for asking questions from your knowledge base and the outside world.
- **Query Operators **
These three operators can be applied around any query filters.
- and
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def conn (d/create-conn {:db/ident {:db/unique :db.unique/identity} | |
:block/uuid {:db/unique :db.unique/identity} | |
:block/content {} | |
:block/properties {:db/valueType :db.type/ref | |
:db/cardinality :db.cardinality/many | |
:db/isComponent true} | |
:property-value/property {:db/valueType :db.type/ref}})) | |
;; Add internal properties | |
(d/transact! conn [{:db/ident :logseq.property/created-by |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Logseq's block order is determined by both :block/parent and :block/left. | |
;; | |
;; Let's say we have a list like this: | |
;; - 1 | |
;; - 1.1 | |
;; - 1.2 | |
;; - 2 | |
;; | |
;; Block `2`'s left is block 1, block `1.2`'s left is block `1.1`, | |
;; Block `1.2`'s left and parent is block `1`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0'?> | |
<font> | |
<info aa='1' size='50' smooth='1' stretchH='100' bold='0' padding='0,0,0,0' spacing='0,0' charset='' italic='0' unicode='0' face='HelveticaRegular'/> | |
<common scaleW='384' packed='0' pages='1' lineHeight='50' scaleH='320' base='39'/> | |
<pages> | |
<page id='0' file='HelveticaRegular.png'/> | |
</pages> | |
<chars count='95'> | |
<char xadvance='14' x='46' chnl='0' yoffset='39' y='42' xoffset='0' id='32' page='0' height='0' width='0'/> | |
<char xadvance='14' x='226' chnl='0' yoffset='3' y='200' xoffset='6' id='33' page='0' height='38' width='8'/> |
- [[Logseq School]] #.v-kanban
#.v-kanban
- [[Plugins 101]]
- [[Plugins 01]]
- [[Plugins 02 - Build a mind map plugin]]
- [[Outliner 101]]
- [[Outliner 01]]
- [[Outliner 02]]
- [[Plugins 101]]
- [[Document syntax]] #.v-numlist
#.v-numlist
- [[Markdown]]
- [[Org Mode]]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{;; Currently, we support either "Markdown" or "Org". | |
;; This can overwrite your global preference so that | |
;; maybe your personal preferred format is Org but you'd | |
;; need to use Markdown for some projects. | |
;; :preferred-format "" | |
;; Preferred workflow style. | |
;; Value is either ":now" for NOW/LATER style, | |
;; or ":todo" for TODO/DOING style. | |
:preferred-workflow :now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Because in formal logic, ∀x.P(x) = ¬∃x.¬P(x) | |
(d/q '[:find ?id | |
:in $ [?interest ...] | |
:where | |
[?a :account/id ?id] | |
(not-join [?a ?interest] | |
[?a :account/interest ?i] | |
(not [(= ?i ?interest)]))]) | |
;; It is harder to understand when you bind interest as above if you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[{{{url}}}][{{{title}}}]] #Article | |
*** *Summary* | |
{{#Notes}} | |
**** {{{NoteText}}} | |
{{/Notes}} | |
*** *Highlights* | |
{{#Notes}} | |
**** {{{NoteHighlight}}} | |
{{/Notes}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#+BEGIN_QUERY | |
{:title [:h2 "Programming languages list"] | |
:query [:find (pull ?b [*]) | |
:where | |
[?b :block/properties ?p] | |
[(get ?p "type") ?t] | |
[(= "programming_lang" ?t)]] | |
:view (fn [result] | |
(when (seq result) | |
(let [blocks (flatten result)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def schema | |
{:db/ident {:db/unique :db.unique/identity} | |
;; user | |
:me/name {} | |
:me/email {} | |
:me/avatar {} | |
;; local, github, dropbox, etc. | |
:db/type {} |
NewerOlder