2
0
mirror of https://github.com/DistSysCorp/ddia.git synced 2025-04-26 04:40:21 +08:00

Update ch02.md

remove redundant * in ch02
This commit is contained in:
muniao 2023-01-08 16:11:22 +08:00 committed by GitHub
parent 98411d8804
commit f037c9711b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

12
ch02.md
View File

@ -582,7 +582,7 @@ CREATE PROPERTY GRAPH bank_transfers
| Object | 1. 一个原子数据,如 string 或者 number。<br/>2. 另一个 Subject。 |
| Predicate | 1. 如果 Object 是原子数据,则 <Predicate, Object> 对应点附带的 KV 对。<br/>2. 如果 Object 是另一个 Object则 Predicate 对应图中的边。 |
仍是上边例子,用 Turtle triples (一种 **Triple-Stores** 语法****表达为****
仍是上边例子,用 Turtle triples (一种 **Triple-Stores** 语法)**表达为**
```scheme
@prefix : <urn:example:>.
@ -672,7 +672,7 @@ lives_in 会表示为 <http://my-company.com/namespace#lives_in>
有了语义网,自然需要在语义网中进行遍历查询,于是有了 RDF 的查询语言SPARQL Protocol and RDF Query Language, pronounced “sparkle.”
```json
```
PREFIX : <urn:example:>
SELECT ?personName WHERE {
?person :name ?personName.
@ -683,14 +683,14 @@ SELECT ?personName WHERE {
他是 Cypher 的前驱,因此结构看起来很像:
```json
```
(person) -[:BORN_IN]-> () -[:WITHIN*0..]-> (location) # Cypher
?person :bornIn / :within* ?location. # SPARQL
```
**SPARQL** 没有区分边和属性的关系,都用了 Predicates。
```json
```
(usa {name:'United States'}) # Cypher
?usa :name "United States". # SPARQL
```
@ -715,7 +715,7 @@ SELECT ?personName WHERE {
有点像 triple-store但是变了下次序(*subject*, *predicate*, *object*) → *predicate*(*subject*, *object*).
之前数据用 Datalog 表示为:
```json
```
name(namerica, 'North America').
type(namerica, continent).
@ -733,7 +733,7 @@ born_in(lucy, idaho).
查询从*美国迁移到欧洲的人*可以表示为:
```json
```
within_recursive(Location, Name) :- name(Location, Name). /* Rule 1 */
within_recursive(Location, Name) :- within(Location, Via), /* Rule 2 */
within_recursive(Via, Name).