Chuyển đến nội dung
Skillpedia
Cơ sở dữ liệu14k · #11154

query

Skill này làm gì

Skill tìm kiếm đồ thị tri thức Semantica, hoặc trong bộ nhớ hoặc trong các cơ sở dữ liệu RDF hay đồ thị bên ngoài. Skill dành cho người muốn tìm các sự kiện và kết nối cụ thể trong đồ thị.

Khi nào nên dùng

  • ✓Khi bạn muốn tìm trong đồ thị tri thức theo một nhóm từ khóa.
  • ✓Khi đồ thị của bạn được lưu trong một triple store RDF và bạn cần truy vấn SPARQL.
  • ✓Khi đồ thị của bạn nằm trong cơ sở dữ liệu property graph có nhãn và cần truy vấn Cypher.

Liên kết skill

https://github.com/semantica-agi/semantica/blob/main/plugins/skills/query/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/semantica-agi/semantica/blob/main/plugins/skills/query/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể tìm trong đồ thị tri thức của tôi mọi thứ liên quan đến lựa chọn nhà cung cấp không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent tải đồ thị và chạy tìm kiếm trên các mục của nó, hoặc gửi truy vấn SPARQL hay Cypher đến cơ sở dữ liệu bạn chỉ định. Nó trả về các kết quả khớp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

/semantica:query

Query the graph. Usage: /semantica:query <task> [args]

Which API you want depends on where the graph lives.


search "<keywords>" — the in-memory ContextGraph

This is the one that works with no external server.

import os
from semantica.context import ContextGraph

graph = ContextGraph()
graph.load_from_file(os.path.expanduser("~/.semantica/kg.json"))   # load_from_file does not expand ~

results = graph.query("vendor selection", skip=0, limit=20)

Related lookups on the same object:

graph.find_nodes(...)          graph.find_node(...)
graph.find_related_nodes(...)  graph.get_neighbors(node_id)
graph.find_similar_nodes(...)  graph.get_nodes_by_label(label)

Decision-specific queries belong to /semantica:decision.


sparql "<query>" — RDF triple stores

from semantica.triplet_store import TripletStore

store = TripletStore(backend="oxigraph")       # embedded; needs semantica[tripletstore-oxigraph]
# or backend="blazegraph" | "jena" | "rdf4j" with endpoint="http://..."
result = store.execute_query(sparql)

For query planning, optimisation, and caching over a backend:

from semantica.triplet_store import QueryEngine, OxigraphStore

# QueryEngine needs an object exposing execute_sparql() — the raw backend,
# not the TripletStore wrapper above (which only exposes execute_query()).
backend = OxigraphStore()

qe = QueryEngine()
plan   = qe.plan_query(sparql)
tuned  = qe.optimize_query(sparql)
result = qe.execute_query(sparql, store_backend=backend)
stats  = qe.get_query_statistics()

Blazegraph / Jena / RDF4J need no extra — semantica.triplet_store speaks SPARQL over HTTP using the core requests dependency.


cypher "<query>" — labeled property graphs

from semantica.graph_store import Neo4jStore    # needs semantica[graph-neo4j]

store = Neo4jStore(uri=..., user=..., password=...)
result = store.execute_query(query, parameters={...})

Also available: FalkorDBStore, ApacheAgeStore, AmazonNeptuneStore, and GraphManager / GraphStore for backend-agnostic access.

Not installed in this environment — add the backend extra first, e.g. pip install "semantica[graph-neo4j]".

Câu hỏi thường gặp

Tìm kiếm từ khóa có cần máy chủ cơ sở dữ liệu không?

Không. Tìm kiếm từ khóa chạy trên đồ thị được tải vào bộ nhớ từ một file.

SPARQL là gì?

Là ngôn ngữ truy vấn dùng cho đồ thị dữ liệu liên kết được lưu dưới dạng bộ ba RDF.

Những cơ sở dữ liệu nào được nhắc đến?

Skill nêu kho nhúng Oxigraph và các kho RDF khác như Blazegraph, Jena và RDF4J.

Chi tiết

Mô tả gốc của tác giả

Query Semantica knowledge graphs — in-memory ContextGraph search, SPARQL over RDF triple stores, and Cypher over LPG backends.

repo: semantica-agi/semantica

Độ phổ biến

Sao GitHub
14k
Vị trí xếp hạng
#11154
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự