I was following the tutorial named logical data modeling by Terry Halpin (link stated below) but was unable to insert data. https://www.brcommunity.com/articles.php?id=b760
Here is the code:
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"). '
Error message:
Could anyone please help me to understand what is wrong?
When Terry wrote that tutorial, the LogicBlox/datalog/LogiQL language allowed some syntax shortcuts that have been deprecated. The first block of schema is ok as written. The second execute block of assertions is now required to explicitly declare entity and reference mode predicates. Here is a working sample:
+Country(c),
+isLarge(c),
+hasCountryCode(c:"AU"),
+Language(l),
+hasLanguageName(l:"English"),
+officiallyUses(c, l).
To assert +isLarge(c)
you need to also (or previously) assert the entity and its reference mode +Country(c), +hasCountryCode(c:"AU").
Same pattern applies for asserting language entities when or prior to asserting +officiallyUses(c, l).