用一个优惠券运营案例,把 IRI、RDF、RDFS、OWL、SHACL、SPARQL 与 Palantir Object、Action、Function、AIP 串成完整链路。
W3C 技术栈负责让事实可命名、可表达、可推理、可查询;Palantir Ontology 把这些事实接到对象、动作、函数、权限、应用和 AI agent。
ex:customer/alice
ex:product/sku-7788
ex:coupon/c-new-30
ex:category/daily-chemical
ex:order-intent/2026-06-23-001
rdfs:label "洗衣液"@zh
rdfs:label "Laundry Detergent"@en
| Subject | Predicate | Object | 含义 |
|---|---|---|---|
| ex:customer/alice | ex:isNewCustomer | true | Alice 是新人 |
| ex:product/sku-7788 | ex:inCategory | ex:category/daily-chemical | 商品属于日化 |
| ex:coupon/c-new-30 | ex:minOrderAmount | 100 | 券门槛是 100 元 |
| ex:coupon/c-new-30 | ex:eligibleCategory | ex:category/daily-chemical | 券可用于日化 |
| ex:order-intent/001 | ex:buyer | ex:customer/alice | 意图由 Alice 发起 |
RDF 不先要求固定表结构,而是用边把事实连成可扩展的图。
ex:customer/alice a ex:NewCustomer ;
rdfs:label "Alice" ;
ex:memberLevel "Silver" .
ex:coupon/c-new-30 a ex:Coupon ;
ex:discountAmount 30 ;
ex:minOrderAmount 100 ;
ex:eligibleCategory ex:category/daily-chemical .
ex:NewCustomer rdfs:subClassOf ex:Customer .
ex:buyer
rdfs:domain ex:OrderIntent ;
rdfs:range ex:Customer ;
rdfs:label "购买人"@zh .
ex:eligibleCategory
rdfs:domain ex:Coupon ;
rdfs:range ex:Category .
ex:category/daily-chemical a skos:Concept ;
skos:prefLabel "日化"@zh ;
skos:altLabel "清洁用品"@zh ;
skos:narrower ex:category/laundry .
ex:category/laundry a skos:Concept ;
skos:prefLabel "洗衣用品"@zh ;
skos:broader ex:category/daily-chemical .
| Profile | 在案例中的角色 | 适合什么规模 |
|---|---|---|
| OWL 2 QL | 把“查 Customer”改写成查 Customer + NewCustomer + VIPCustomer。 | 大量实例数据,关系库/虚拟图谱。 |
| OWL 2 RL | 用规则推出“订单意图 eligibleFor 新人券”。 | RDF 仓库,规则物化,批量推理。 |
| OWL 2 EL | 处理大规模类层级,如商品、疾病、零件分类。 | 类和属性非常多的本体。 |
| OWL 2 DL | 做严格一致性检查和复杂建模。 | 表达力强,但推理成本更高。 |
选 QL/RL/EL/DL 本质是在表达能力和可扩展推理之间做工程取舍。
# 用户问所有 Customer
?x a ex:Customer .
# 系统可改写为
{ ?x a ex:Customer }
UNION { ?x a ex:NewCustomer }
UNION { ?x a ex:VIPCustomer }
适合“数据在数据库里,不想提前物化所有推理结果”。
IF
?order ex:buyer ?c ;
ex:product ?p ;
ex:amount ?a .
?c a ex:NewCustomer .
?p ex:inCategory ?cat .
?coupon ex:eligibleCategory ?cat .
?coupon ex:minOrderAmount ?min .
FILTER(?a >= ?min)
THEN
?order ex:eligibleFor ?coupon .
适合把高频结论预先推成新三元组。
ex:CouponShape a sh:NodeShape ;
sh:targetClass ex:Coupon ;
sh:property [
sh:path ex:discountAmount ;
sh:minCount 1 ;
sh:datatype xsd:decimal
] ;
sh:property [
sh:path ex:eligibleCategory ;
sh:minCount 1
] .
推理生成“更多事实”,验证保证“事实可信”,SPARQL 负责“把事实取出来并组合”。
SELECT ?coupon ?discount
WHERE {
ex:order-intent/001
ex:eligibleFor ?coupon .
?coupon
ex:discountAmount ?discount ;
rdfs:label ?name .
}
LIMIT 10
INSERT DATA {
ex:order-intent/001
ex:selectedCoupon ex:coupon/c-new-30 ;
ex:decisionTime
"2026-06-23T10:30:00+08:00"^^xsd:dateTime .
}
Alice 是新用户;洗衣液属于日化;新人券适用于日化;订单金额 128 >= 门槛 100。
Palantir 中对应为 ApplyCoupon Action:检查权限与提交条件,写回 selectedCoupon,并生成 Action Log。
W3C 语义网解释“事实如何表达”;Palantir Ontology 进一步回答“事实如何被操作、治理、审计并进入业务闭环”。
OSv2 将 indexing 与 querying 解耦,并支持增量索引、流式 datasource、对象/属性级权限和更高规模 Search Around。
| W3C / 语义网概念 | Palantir Ontology 对应能力 | 工程意义 |
|---|---|---|
| IRI / RDF identity | Object RID / primary key | 对象稳定寻址,跨应用复用。 |
| RDFS class / property | Object types / properties / link types | 把现实实体、属性、关系变成治理资源。 |
| OWL / SKOS semantics | Interfaces / shared properties / type design | 复用共同形状、分类和业务抽象。 |
| SHACL validation | Action rules / submission criteria / policies | 读写前验证数据、权限和业务条件。 |
| SPARQL query/update | Object Set Service / OSDK / Actions | 读取对象集合,并把决策写回业务状态。 |
| RAG / semantic search | Ontology-augmented generation / AIP | 把 chunk、embedding、对象和动作放在同一上下文里。 |
语义网技术栈提供可表达、可推理、可验证的知识结构;Palantir Ontology 把结构接到对象查询、动作执行、权限治理、AI agent 和审计闭环。