我正在尝试在LogicBlox项目中使用measure服务。我试图揭示的层次结构很简单:
day(d), day_id(d:i) -> string(i).
week(w), week_id(w:i) -> string(i).
month(m), month_id(m:i) -> string(i).
year(y), year_id(y:i) -> string(i).
day2month[d] = m -> day(d), month(m).
所有这些谓词都存在于hierarchy:calendar
命名空间中。要添加度量服务元数据,我现在在项目文件中设置为“执行”的.logic文件中包含以下内容:
+measure:config:enable().
// Calendar dimension
+measure:config:dimension(_) {
+measure:config:dimension_hasName[]="Calendar",
+measure:config:dimension_hasDefaultHierarchy[]="Default"
}.
// hierarchy default in calendar dimension
+measure:config:hierarchy_byDimName["Calendar", "Default"] = calHier,
+measure:config:hierarchy(calHier) {
+measure:config:level["day"] = "hierarchy:calendar:day",
+measure:config:attribute["day","id","STRING"]="hierarchy:calendar:day_id",
+measure:config:level["month"] = "hierarchy:calendar:month",
+measure:config:attribute["month","id","STRING"]="hierarchy:calendar:month_id",
+measure:config:level["year"] = "hierarchy:calendar:year",
+measure:config:attribute["year","id","STRING"]="hierarchy:calendar:year_id",
+measure:config:levelMap["day", "month"] = "hierarchy:calendar:day2month"
}.
当我编译并将其部署到工作区时,我收到以下错误:
Error: measure:schema (line 227, column 5): Functional dependency violation: hier=[0], #V0=0, level=[2]. Occurred in logic clause:
+measure:schema:hierarchy_levelAtIndex[hier, 0] = level [fundepcheck] <-
+measure:schema:hierarchy_hasLevel(hier, level),
!$measure_schema:_projection_t_YHtD752_Dm7(hier, level).
我做错了什么和/或我该如何调试?
答案 0 :(得分:0)
您的层次结构未指定其他级别与“年”级别的关系。每月添加一个级别图应该可以解决这个问题:
+measure:config:levelMap["month", "year"] = "hierarchy:calendar:month2year"