diff --git a/ch02.md b/ch02.md index 74beaeb..abe7074 100644 --- a/ch02.md +++ b/ch02.md @@ -582,7 +582,7 @@ CREATE PROPERTY GRAPH bank_transfers | Object | 1. 一个原子数据,如 string 或者 number。
2. 另一个 Subject。 | | Predicate | 1. 如果 Object 是原子数据,则 对应点附带的 KV 对。
2. 如果 Object 是另一个 Object,则 Predicate 对应图中的边。 | -仍是上边例子,用 Turtle triples (一种 **Triple-Stores** 语法**)**表达为**:** +仍是上边例子,用 Turtle triples (一种 **Triple-Stores** 语法)**表达为**: ```scheme @prefix : . @@ -672,7 +672,7 @@ lives_in 会表示为 有了语义网,自然需要在语义网中进行遍历查询,于是有了 RDF 的查询语言:SPARQL Protocol and RDF Query Language, pronounced “sparkle.” -```json +``` PREFIX : 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).