> 译文仅供阅读便利。具有规范效力的是英文原文。 # 对象 → RDF / OWL 投影 **元宇宙规范** **文档编号:** MU-V2-EX-011 **标题:** 走通的附录 - 把一个 MUIF 对象投到 RDF 与 OWL **文档类别:** 说明性 **版本:** 2.0(草案) **状态:** 工作草案 **规范性引用:** 无 **说明性引用:** [MMAS-Interchange](../../02-architecture/MMAS-Interchange.md)、[Object](../../04-core-concepts/Object.md)、[Projection](../../04-core-concepts/Projection.md)、[Semantic-Mapping](../../03-federation/Semantic-Mapping.md) **版权:** © Orkestron.AI **许可:** Apache-2.0 --- # 1. 目的 一个 MUIF [对象](../../04-core-concepts/Object.md)是一个语义真相点。一份 [投影](../../04-core-concepts/Projection.md)则是这个对象在某个语境下现出的样子。一 张 RDF 图与一部 OWL 本体便是两个这样的语境:本附录展示同一个 `employee.person` 对象 如何各自投过去,于是语义网那边的消费方不学 MUIF 也读得懂它。 这是一次*投影*,不是重新定义:对象在元模型中依旧权威,而 RDF 与 OWL 的形态是派生的 视图,受本附录中[语义映射](person-mappings.json)的管束。 --- # 2. 作为来源的对象 贯穿始终的例子是 `employee.person` 对象(本附录与 [`../federation-acme-govtax`](../federation-acme-govtax/)里用的是同一个): ```json { "muifType": "Object", "id": "employee:Person", "csn": "employee.person", "kind": "Entity", "namespace": "employee", "provenance": { "owner": "urn:mu:universe:acme" }, "properties": [ { "name": "employee.givenName", "valueType": "string", "required": true }, { "name": "employee.familyName", "valueType": "string", "required": true }, { "name": "employee.birthDate", "valueType": "date", "required": false } ] } ``` 作投影时,我们绑定两个前缀: ```text @prefix emp: . @prefix mu: . ``` --- # 3. 投影(a) - RDF 三元组(Turtle) 这个对象分两部分投到 RDF:**架构**那几条三元组(类及其属性作为术语),以及一个显示 单个个体的**实例**。[`person-mappings.json`](person-mappings.json)中的那些映射,会 以 `owl:equivalentClass` / `rdfs:subClassOf` 与 `owl:equivalentProperty` 链接的形式 发出,好让这张图与外部标准始终相连。 ```turtle @prefix emp: . @prefix mu: . @prefix schema: . @prefix foaf: . @prefix rdf: . @prefix rdfs: . @prefix owl: . @prefix xsd: . # --- schema: the Object as an RDF class --- emp:Person a rdfs:Class, owl:Class ; rdfs:label "Employee Person" ; mu:csn "employee.person" ; mu:owner ; rdfs:subClassOf schema:Person ; # employee.person is narrower than schema:Person rdfs:subClassOf foaf:Person . emp:givenName a rdf:Property, owl:DatatypeProperty ; rdfs:domain emp:Person ; rdfs:range xsd:string ; owl:equivalentProperty schema:givenName, foaf:givenName . emp:familyName a rdf:Property, owl:DatatypeProperty ; rdfs:domain emp:Person ; rdfs:range xsd:string ; owl:equivalentProperty schema:familyName, foaf:familyName . emp:birthDate a rdf:Property, owl:DatatypeProperty ; rdfs:domain emp:Person ; rdfs:range xsd:date ; owl:equivalentProperty schema:birthDate . # --- instance: one employee.person individual --- a emp:Person ; emp:givenName "Ada" ; emp:familyName "Lovelace" ; emp:birthDate "1815-12-10"^^xsd:date . ``` 只通 Schema.org 或 FOAF 的消费方,顺着 `owl:equivalentProperty` 与 `rdfs:subClassOf` 链接走,就能完全用自己的词汇把这个个体读下来。 --- # 4. 投影(b) - OWL 类 同一个对象也投成一份 OWL 类定义。MUIF 中必填的属性化作 `owl:Restriction` 的基数约 束,选填的则不然。此处为求清楚用的是函数式语法,前缀与第 3 节相同。 ```text Class: emp:Person Annotations: rdfs:label "Employee Person", mu:csn "employee.person" SubClassOf: schema:Person, # narrower than the Schema.org concept foaf:Person, # required: employee.givenName (exactly 1 string) emp:givenName exactly 1 xsd:string, # required: employee.familyName (exactly 1 string) emp:familyName exactly 1 xsd:string, # optional: employee.birthDate (0..1 date) emp:birthDate max 1 xsd:date DatatypeProperty: emp:givenName EquivalentTo: schema:givenName, foaf:givenName Domain: emp:Person Range: xsd:string DatatypeProperty: emp:familyName EquivalentTo: schema:familyName, foaf:familyName Domain: emp:Person Range: xsd:string DatatypeProperty: emp:birthDate EquivalentTo: schema:birthDate Domain: emp:Person Range: xsd:date ``` --- # 5. 投影过后,什么得以保全 | MUIF 概念 | RDF / OWL 投影 | |--------------|----------------------| | 对象 `employee:Person` | `emp:Person` 作为 `owl:Class` | | `csn` / `provenance.owner` | `mu:csn` / `mu:owner` 注解 | | 属性(`required: true`) | `owl:DatatypeProperty` + `exactly 1` 约束 | | 属性(`required: false`) | `owl:DatatypeProperty` + `max 1` 约束 | | 映射 `relation: equivalent` | `owl:equivalentProperty` | | 映射 `relation: broader`(目标) | `rdfs:subClassOf`(本地 ⊑ 外部) | 这次投影**于意义无损,于任何语义之物亦无损**:身份、所有权、是否必填,以及那些对外 的映射,统统活了下来。与每一份投影一样,RDF 与 OWL 的形态都是派生视图;权威的真相仍 留在 MUIF 对象里。 --- # 6. 另见 - [`schemaorg-person.import.json`](schemaorg-person.import.json) - 那份 Schema.org 导入,它把 `schema:Person` 作为语义包供了出来。 - [`person-mappings.json`](person-mappings.json) - 上面以 `owl:equivalentProperty` / `rdfs:subClassOf` 发出的那些逐字段映射。 - [MMAS-Interchange](../../02-architecture/MMAS-Interchange.md) - 这些对象所出自的 MUIF 文档模型。