Skip to content

Commit

Permalink
Update ch2.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Panmax authored Nov 20, 2019
1 parent 1285655 commit 4d18bcc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ch2.md
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ migrated(Name, BornIn, LivingIn) :- name(Person, Name), /* Rule 3 */
```

Cypher和SPARQL使用SELECT立即跳转,但是Datalog一次只进行一小步。我们定义**规则**,以将新谓语告诉数据库:在这里,我们定义了两个新的谓语,`_recursive``migrated`。这些谓语不是存储在数据库中的三元组中,而是它们是从数据或其他规则派生而来的。规则可以引用其他规则,就像函数可以调用其他函数或者递归地调用自己一样。像这样,复杂的查询可以一次构建其中的一小块。
Cypher和SPARQL使用SELECT立即跳转,但是Datalog一次只进行一小步。我们定义**规则**,以将新谓语告诉数据库:在这里,我们定义了两个新的谓语,`within_recursive``migrated`。这些谓语不是存储在数据库中的三元组中,而是它们是从数据或其他规则派生而来的。规则可以引用其他规则,就像函数可以调用其他函数或者递归地调用自己一样。像这样,复杂的查询可以一次构建其中的一小块。

在规则中,以大写字母开头的单词是变量,谓语则用Cypher和SPARQL的方式一样来匹配。例如,`name(Location, Name)`通过变量绑定`Location = namerica``Name ='North America'`可以匹配三元组`name(namerica, 'North America')`

Expand Down

0 comments on commit 4d18bcc

Please sign in to comment.