Auto-sync: 2026-04-27 08:02
This commit is contained in:
31
wiki/concepts/QueryLanguage.md
Normal file
31
wiki/concepts/QueryLanguage.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: "QueryLanguage"
|
||||
type: concept
|
||||
tags: []
|
||||
sources: []
|
||||
last_updated: 2025-03-07
|
||||
---
|
||||
|
||||
## Aliases
|
||||
- 查询语言
|
||||
- DSL(领域特定语言)
|
||||
- 声明式查询
|
||||
|
||||
## Definition
|
||||
查询语言(QueryLanguage)是一种用于从数据库或知识库中检索信息的领域特定语言。在 Obsidian 生态中,[[DataviewPlugin]] 提供了类 SQL 的查询语法,允许用户声明式地描述"要什么数据",而非"如何获取数据"。
|
||||
|
||||
## Core Syntax(Dataview 为例)
|
||||
- `LIST`:罗列匹配的笔记标题
|
||||
- `TABLE`:以表格形式展示多个字段
|
||||
- `TASK`:列出匹配的待办事项
|
||||
- `WHERE`:过滤条件(如 `WHERE contains(tags, "学习")`)
|
||||
- `FROM`:指定搜索范围(如 `FROM "Notes"`)
|
||||
|
||||
## Design Principles
|
||||
- **声明式**:描述期望结果,而非操作步骤
|
||||
- **类 SQL**:借鉴关系型数据库查询的直观语法
|
||||
- **结构化字段**:查询基于 frontmatter 和内联字段,而非纯文本搜索
|
||||
|
||||
## Related Concepts
|
||||
- [[NoteDatabase]]:查询语言服务于笔记数据库场景
|
||||
- [[TagBasedIndexing]]:查询语言支持标签索引的查询需求
|
||||
Reference in New Issue
Block a user