2017-08-24 67 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