Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
utopia/migrations/0066_a_phrase_binds_to_a_property.sql at main · deeplethe/utopia · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
deeplethe
utopia
Repository navigation
Code
Issues
55
(55)
Pull requests
18
(18)
Discussions
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
utopia
/
migrations
/
0066_a_phrase_binds_to_a_property.sql
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
56 lines (53 loc) · 3.79 KB
main
Breadcrumbs
utopia
/
migrations
/
0066_a_phrase_binds_to_a_property.sql
Copy path
Top
File metadata and controls
Code
Blame
56 lines (53 loc) · 3.79 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--
一条关系短语按签名绑到一个属性(0044 决定 3 的第二片:签名 = 短语 × 主语的类 ×
--
宾语的类,宾语是字面值时记「值」)。
--
--
开放陈述的关系是文档自己的短语(`facts.phrase`:acquired、「细化解读」、Revenue),
--
不选属性。属性是本体的事。一个库里 distinct 的签名比陈述少得多——同一个短语在同一对
--
类之间出现多少次,只判一次:判了记在 `phrase_bindings` 里,本体一改只重判过期的
--
(绑到的属性判定后改过 `relation_types.updated_at`;判成 none / undecided 之后长出了
--
新属性 `relation_types.created_at`)。绑上的签名下的陈述算成类型化事实,那是下一片
--
(物化视图,`facts.from_statement_id`);这一片只记判定。
--
--
两端的类来自类别词绑定(`entities.type_id`);一端没有类的签名照样判——文档的例句
--
和引文就是证据——但类为空的签名和类为某个类的签名是两条不同的签名。
--
`direction`:forward 是陈述的主语就是属性的主语,reverse 是反过来(「owns」绑到
--
subsidiary_of)。人的判定不被代理覆盖。
--
属性改过没有,从前也只有 created_at;绑定按它判过期,每条 UPDATE relation_types 都摸一下
ALTER
TABLE
relation_types ADD COLUMN updated_at
TIMESTAMPTZ
NOT NULL
DEFAULT now();
CREATE
TABLE
phrase_bindings
(
id UUID
PRIMARY KEY
,
kb_id UUID
NOT NULL
REFERENCES
knowledge_bases(id)
ON DELETE CASCADE
,
--
归一过的短语:空白折成一个空格、小写、去两端空白(同 type_bindings.kind_word)
phrase
TEXT
NOT NULL
,
--
两端的类;空表示那一端的类别词还没绑到类(或宾语是字面值)。类删了绑定跟着走
subject_type_id UUID
REFERENCES
entity_types(id)
ON DELETE CASCADE
,
object_type_id UUID
REFERENCES
entity_types(id)
ON DELETE CASCADE
,
--
宾语是字面值(金额、百分比、称号)而不是一样东西
object_is_value
BOOLEAN
NOT NULL
DEFAULT false,
--
status 为 none / undecided 时为空;属性删了绑定跟着走
relation_type_id UUID
REFERENCES
relation_types(id)
ON DELETE CASCADE
,
--
forward:陈述的主语是属性的主语;reverse:陈述的宾语是
direction
TEXT
CHECK
(direction
IN
(
'
forward
'
,
'
reverse
'
)),
--
bound 绑上了
--
none 没有属性对得上:陈述留在开放图谱,签名计入工作台的建议
--
undecided 两票不一致,留给审核(#725 对齐队列)
status
TEXT
NOT NULL
CHECK
(status
IN
(
'
bound
'
,
'
none
'
,
'
undecided
'
)),
--
得出这个判定的那几票
votes JSONB,
--
判定时这个签名下有几条陈述,三条例句——工作台按它排建议
statement_count
INTEGER
NOT NULL
DEFAULT
0
,
examples
TEXT
[]
NOT NULL
DEFAULT
'
{}
'
,
decided_at
TIMESTAMPTZ
NOT NULL
DEFAULT now(),
--
人的判定不被代理覆盖
decided_by
TEXT
NOT NULL
DEFAULT
'
agent
'
CHECK
(decided_by
IN
(
'
agent
'
,
'
person
'
)),
--
一个库里一条签名一行;类为空也是一种签名(NULLS NOT DISTINCT)
UNIQUE NULLS NOT DISTINCT (kb_id, phrase, subject_type_id, object_type_id, object_is_value),
--
绑上了就得有属性和方向,没绑就都不能有
CONSTRAINT
phrase_bindings_shape
CHECK
((status
=
'
bound
'
)
=
(relation_type_id
IS NOT NULL
)
AND
(status
=
'
bound
'
)
=
(direction
IS NOT NULL
)),
--
宾语是字面值的签名没有宾语类
CONSTRAINT
phrase_bindings_value_has_no_class
CHECK
(NOT object_is_value
OR
object_type_id IS
NULL
)
);
CREATE
INDEX
phrase_bindings_kb_status_idx
ON
phrase_bindings (kb_id, status);
You can’t perform that action at this time.