Files
nexus/wiki/concepts/QueryLanguage.md
2026-04-27 08:02:55 +08:00

32 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "QueryLanguage"
type: concept
tags: []
sources: []
last_updated: 2025-03-07
---
## Aliases
- 查询语言
- DSL领域特定语言
- 声明式查询
## Definition
查询语言QueryLanguage是一种用于从数据库或知识库中检索信息的领域特定语言。在 Obsidian 生态中,[[DataviewPlugin]] 提供了类 SQL 的查询语法,允许用户声明式地描述"要什么数据",而非"如何获取数据"。
## Core SyntaxDataview 为例)
- `LIST`:罗列匹配的笔记标题
- `TABLE`:以表格形式展示多个字段
- `TASK`:列出匹配的待办事项
- `WHERE`:过滤条件(如 `WHERE contains(tags, "学习")`
- `FROM`:指定搜索范围(如 `FROM "Notes"`
## Design Principles
- **声明式**:描述期望结果,而非操作步骤
- **类 SQL**:借鉴关系型数据库查询的直观语法
- **结构化字段**:查询基于 frontmatter 和内联字段,而非纯文本搜索
## Related Concepts
- [[NoteDatabase]]:查询语言服务于笔记数据库场景
- [[TagBasedIndexing]]:查询语言支持标签索引的查询需求