2017-08-24 62 views
0

我正在按照由Terry Halpin(链接下面所述)命名的逻辑数据建模教程,但无法插入数据。 https://www.brcommunity.com/articles.php?id=b760逻辑数据建模与logiQL

下面是代码:

addblock 'Country(c), hasCountryCode(c:cc) -> string(cc). 
Language(l), hasLanguageName(l:ln) -> string(ln). 
isLarge(c) -> Country(c). 
officiallyUses(c, l) -> Country(c), Language(l). 
isMultilingual(c) <- officiallyUses(c, l1), officiallyUses(c, l2), l1 != l2.' 

exec' 
+isLarge("AU"), +isLarge("CA"), +isLarge("FR"), +isLarge("US"). 
+officiallyUses("AU", "English"), +officiallyUses("CA", "English"). 
+officiallyUses("CA", "French"), +officiallyUses("FR", "French"). 
+officiallyUses("LU", "French"), +officiallyUses("LU", "German"). 
+officiallyUses("LU", "Luxembourgish"). 
+officiallyUses("US", "English"), +officiallyUses("VA", "Italian"). ' 

错误消息:

it gives me this

任何人都可以请帮助我了解什么是错的?

回答

1

当Terry编写该教程时,LogicBlox/datalog/LogiQL语言允许使用某些已过时的语法快捷方式。第一个模式块可以写成。第二个断言执行块现在需要显式声明实体和参考模式谓词。这里是工作示例:

+Country(c), 
+isLarge(c), 
+hasCountryCode(c:"AU"), 
+Language(l), 
+hasLanguageName(l:"English"), 
+officiallyUses(c, l). 

要断言+isLarge(c)你也需要(或之前)断言+officiallyUses(c, l).

时或之前断言 +Country(c), +hasCountryCode(c:"AU").

同样的模式适用的实体和它的参考模式断言语言实体

+0

嗨丹,非常感谢。完美的作品。 – kushol