sense-bases
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesesense-bases
sense-bases
A file is YAML: filters selecting notes, formulas computing values, and views ordering
and grouping them. Obsidian evaluates it against its own metadata cache; sense holds the same
data in SQL tables. Every Bases construct that selects or computes rows has a SQL equivalent.
What has none is presentation (, card layout), those change pixels, not rows, so
a translation loses nothing by ignoring them.
.basecolumnSizeTranslate one view to one query: base-level AND the view's , the view's
// as the SELECT list, ORDER BY, and LIMIT. A base with four views becomes
four queries; saving them under the base's name in 's block keeps
them runnable as . The general query surface is the skill; this one only
maps Bases constructs onto it.
filtersfiltersordersortlimitsense.config.jsonqueriessense <name>sense.basecolumnSize将一个视图翻译为一个查询:base 级别的 与视图的 进行 AND 连接,视图的 // 分别对应 SELECT 列表、ORDER BY 和 LIMIT。一个有四个视图的 base 变成四个查询;将它们以 base 的名称保存在 的 块中,即可通过 运行。通用的查询界面是 skill;本 skill 仅将 Bases 结构映射到它上面。
filtersfiltersordersortlimitsense.config.jsonqueriessense <name>senseProperties
属性
| Bases | sense | notes |
|---|---|---|
| | frontmatter column, same name |
| | the Name column: no directory, no extension |
| a name with extension | | the suffix arg is Unix basename's: present, stripped |
| | for |
| | sense indexes only markdown |
| | bytes |
| | stored as ms |
| | see the caveat below |
| the | frontmatter + inline |
| | one row per distinct written target |
| | |
| | |
| a bound | see below |
file.ctimegit clonemap| Bases | sense | 说明 |
|---|---|---|
| | frontmatter 列,同名 |
| | Name 列:无目录、无扩展名 |
| 带扩展名的名称 | | suffix 参数同 Unix basename:存在则去除 |
| | 用于 |
| | sense 仅索引 markdown |
| | 字节 |
| | 存储为毫秒 |
| | 见下方注意事项 |
| | frontmatter + 行内 |
| | 每个不同的写入目标一行 |
| | |
| | |
| 绑定 | 见下文 |
file.ctimegit clonemapPredicates
谓词
| Bases | sense |
|---|---|
| same |
| |
| parenthesized |
| |
| |
| |
| |
| |
| the |
| no SQLite regex; |
| |
A field no note in the tree declares has no column at all, so a filter naming it errors with
instead of treating every row as empty. Obsidian's evaluator returns empty
for unknown properties; SQL does not. Dropping the clause states the same thing the error
did, and lists what exists.
no such columnSELECT name FROM pragma_table_info('frontmatter')isEmpty()'''[]'[]'[null]'-isEmpty()IS NULLjson_array_length()'[null]'json_eachvaluejson_type(value)malformed JSONtypecontains(link("Movies"))json_each[[Movies]]hasLinklinks.dstNULLsense's own is looser than both variants: exact membership on JSON
arrays but substring on strings, so also matches . It
reads shorter when the field is known to be a list; the form is the exact
translation.
has(field, x)containshas(f.status, 'active')inactivejson_each| Bases | sense |
|---|---|
| 相同 |
| |
| 带括号的 |
| |
| |
| |
| |
| |
| |
| 没有 SQLite 正则; |
| |
树中没有笔记声明的字段根本没有列,因此命名它的过滤器会以 报错,而不是将每一行视为空。Obsidian 的求值器对未知属性返回空;SQL 不会。删除该子句所表达的意思与报错相同, 可以列出存在的内容。
no such columnSELECT name FROM pragma_table_info('frontmatter')isEmpty()'''[]'[]'[null]'-isEmpty()IS NULLjson_array_length()'[null]'json_eachvaluejson_type(value)malformed JSONtypecontains(link("Movies"))json_each[[Movies]]hasLinklinks.dstNULLsense 自身的 比两种 变体都更宽松:对 JSON 数组是精确成员判断,但对字符串是子串匹配,因此 也会匹配 。当字段已知是列表时,它读起来更短; 形式才是精确的翻译。
has(field, x)containshas(f.status, 'active')inactivejson_eachFormulas
公式
Formulas are SELECT expressions. The Bases functions map onto SQLite's:
| Bases | sense |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| an EXISTS-joined subquery; worked example in EXAMPLES.md |
Bases durations are typed; SQL date arithmetic is julianday day-fractions. A formula chaining
duration fields () flattens to arithmetic on the julianday difference.
.days.round()A formula referencing another formula becomes a CTE layer: SQL cannot read a SELECT alias in
the same SELECT list, so each dependency level computes its formulas as columns and the next
level reads them (). A five-formula chain is however many levels it has, not five
CTEs. Formulas that only read base columns share one layer.
WITH t AS (SELECT ..., <level-1 formulas> FROM frontmatter) SELECT ..., <level-2 formulas> FROM t公式是 SELECT 表达式。Bases 函数映射到 SQLite 的:
| Bases | sense |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| JSON 列上使用 |
| 一个 EXISTS 连接的子查询;EXAMPLES.md 中有完整示例 |
Bases 的时长是有类型的;SQL 日期运算是 julianday 的日分数。一个链接时长字段的公式()会展开为对 julianday 差值的算术运算。
.days.round()引用另一个公式的公式变成 CTE 层:SQL 无法在同一个 SELECT 列表中读取 SELECT 别名,因此每个依赖级别将其公式计算为列,下一级别读取它们()。一个五公式链的 CTE 数量是其所拥有的层级数,而不是五个 CTE。仅读取基础列的公式共享一个层级。
WITH t AS (SELECT ..., <level-1 formulas> FROM frontmatter) SELECT ..., <level-2 formulas> FROM tViews
视图
-
(multi-key, each with direction) ->
sort:.ORDER BY a DESC, b ASC->limit:.LIMIT -
does not collapse rows. Obsidian shows every row bucketed under headers with per-group summaries. The SQL producing the same rows and numbers is ordering plus window functions, not GROUP BY:
groupBysqlSELECT f.path, f.status, f.days, AVG(f.days) OVER (PARTITION BY f.status) AS group_avg, COUNT(*) OVER (PARTITION BY f.status) AS group_n FROM frontmatter f WHERE f.days IS NOT NULL ORDER BY f.status, f.days DESCA collapsed one-row-per-group report is plain. That is a different result than the Bases view shows.GROUP BY -
View(Sum, Average, Median via ordering, Unique, Filled, Checked) are the matching aggregates, windowed as above to keep the rows, or a separate aggregate query.
summaries
-
(多键,每个带方向)->
sort:。ORDER BY a DESC, b ASC->limit:。LIMIT -
不会折叠行。Obsidian 将每一行显示在带有每组摘要的标题下。生成相同行和数字的 SQL 是排序加窗口函数,而不是 GROUP BY:
groupBysqlSELECT f.path, f.status, f.days, AVG(f.days) OVER (PARTITION BY f.status) AS group_avg, COUNT(*) OVER (PARTITION BY f.status) AS group_n FROM frontmatter f WHERE f.days IS NOT NULL ORDER BY f.status, f.days DESC每组合并为一行的报告是普通的。这与 Bases 视图显示的结果不同。GROUP BY -
视图(Sum、Average、通过排序实现的 Median、Unique、Filled、Checked)是对应的聚合,按上述方式加窗口以保留行,或作为单独的聚合查询。
summaries
this
thisthis
thisthissense sql "..." <path>sense <name> <path>sql
WITH me AS (SELECT ? AS p)and every expression joins . The full Related.base translation in
EXAMPLES.md is the worked case: link overlap, mutual-link filters, and the shared-target list
via , all from one bound path.
this.file.*meGROUP_CONCATthissense sql "..." <path>sense <name> <path>sql
WITH me AS (SELECT ? AS p)并且每个 表达式都连接 。EXAMPLES.md 中完整的 Related.base 翻译是完整案例:链接重叠、互链过滤器,以及通过 实现的共享目标列表,全部来自一个绑定路径。
this.file.*meGROUP_CONCATNot translatable, and why it costs nothing
不可翻译,以及为什么毫无损失
- , card/table/list/map chrome: pixel layout over the same rows.
columnSize - Obsidian choosing from the active pane: there is no pane; the path parameter is the resolution.
this - Live re-evaluation as files change: every sense query reconciles against the filesystem first, so the freshness is already there; nothing re-renders on its own.
- 、卡片/表格/列表/地图外观:在相同行上的像素布局。
columnSize - Obsidian 从活动面板选择 :没有面板;路径参数就是解决方案。
this - 文件变化时的实时重新评估:每个 sense 查询都会先与文件系统同步,因此数据的新鲜度已经具备;不会有任何内容自行重新渲染。