Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Socrates intro.
Search
Zoom.Quiet
December 03, 2009
Programming
0
59
Socrates intro.
091203}COFFEE.55 Socrates项目进展
讲师:刘鑫
时间:16:30-18:00
地点:金山大厦11F中会议室
列席:KSPEG全体
Zoom.Quiet
December 03, 2009
Tweet
Share
More Decks by Zoom.Quiet
See All by Zoom.Quiet
PyCon2014China-Zhuhai-high performance
zoomquiet
0
170
PyCon2014China-Zhuhai-meta programming
zoomquiet
1
150
PyCon2014China-Zhuhai-bpm.py
zoomquiet
0
120
PyCon2014China-Zhuhai-luna kv db
zoomquiet
0
100
PyCon2014China-Zhuhai-seed studio
zoomquiet
0
110
PyCon2014China-Zhuhai-Docker Registry Build By Python
zoomquiet
0
130
PyCon2014China-Zhuhai-jeff
zoomquiet
0
100
PyCon2014China-Zhuhai-pythonic front-end
zoomquiet
0
130
DevFest2014-Zhuhai-Polymer
zoomquiet
0
430
Other Decks in Programming
See All in Programming
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
250
GoLab2025 Recap
kuro_kurorrr
0
780
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
190
SwiftUIで本格音ゲー実装してみた
hypebeans
0
490
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
290
Navigating Dependency Injection with Metro
l2hyunwoo
1
170
Go コードベースの構成と AI コンテキスト定義
andpad
0
140
Deno Tunnel を使ってみた話
kamekyame
0
230
TestingOsaka6_Ozono
o3
0
170
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
410
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
160
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
890
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
57
37k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
1
210
Building the Perfect Custom Keyboard
takai
1
660
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
120
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
190
How to make the Groovebox
asonas
2
1.8k
New Earth Scene 8
popppiees
0
1.2k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
400
AI: The stuff that nobody shows you
jnunemaker
PRO
1
12
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
0
250
Transcript
Socrates 项目介绍
什么是Socrates? 三元语义模型 subject predicate object 通过 subject 和 predicate 组织
object 数据的关系 object 可扩展,支持任意存储层数据类型 解决关系型数据库结构固定,不容易修改的问题 解决稀疏表的存储问题 建立于数据存储层之上,兼容不同类型的数据库 规则简单 元数据信息,自描述 结构开放,可以开发第三方接口 结构简单,基于递归和引用,容易使用 数据粒度小,伸缩性好,容易并发 可插入到其它体系中使用
Socrates 使用 基于SQLALchemy Storage 基于URI,支持自反射,容易联接 Storage(uri) 基于元语的存储层注册机制 Storage.registe Storage.registed_type 条目ID自管理
透明、跨平台的统一序列生成器 基于三元语义的访问模型 writePredicate(name, type) writeSubject(subject_id, segments, **{segments})
Socrates元语——基础指令 SUBJECT = 1 PREDICATE = 2 IS = 3
OBJTYPE = 4 TYPE = 5 STRING = 6 NAME = 7 HAS = 8 SET = 9 STORAGE = 10
Socrates元语——基础定义 - subject is subject - subject has name -
predicate is subject - predicate has name - is is predicate - is has name - is objType subject - objType is predicate - objType has name - objType objType subject - type is subject - type has name
Socrates示例--KUSE日志系统 storage.registe('datetime', DateTime, create=True) storage.writePredicate('kssoid', 'string') storage.writePredicate('who', 'subject') storage.writePredicate('when', 'datetime')
storage.writePredicate('search', 'string') storage.writePredicate('visit snapshot', 'string') storage.writePredicate('visit url', 'string')
Socrates示例--KUSE日志系统 storage.writeSubject(None, {"search":keywords} when=datetime.now, who="kssoid subject")->new subject id
Socrates已实现的技术点 Storage() 使用SQLAlchemy URL 允许指定schema 自引导 新建基础结构 读取已有结构 registed 允许运行时建立存储类型
可以指定存储表 存储定义持久化
Socrates已实现的技术点 registed_type 直接存储table对象,构建查询时无需考虑schema问题 查询时遍历此map 允许多类型存储于同一表(即同义类型)
Socrates讨论——正在谋求解决的问题 多重语义谓词: 涉及数值的谓词往往要隐式支持多类型 avg sum ... 日期与时间类型 date datetime 解决:
谓词重定义 sum objType integer sum objType float sum objType decimal
Socrates讨论——正在谋求解决的问题 多重语义谓词: 写入时的类型判断 解决: 多重谓词必须显式引用 predicate:objType "predicate words":objType 谓词语句化: 允许引号包含的文本化谓词
以上需要简单的语法分析器支持 逃逸字符过滤 引号提取 词法分析
Socrates讨论——正在谋求解决的问题 匿名条目 KSSOID 解决: 直接编写 predicate object 子句
Socrates讨论——正在谋求解决的问题 查询 需要多次select 解决: 先使用 SQLAlchemy的查询功能 积累常用基础指令集: find predicate by
name find segment by query(predicate, object) search by object search by predicate search by name