我正在尝试使用pyDatalog来确定是否满足各种功能的依赖关系。某些库 (lA,lB,...) 提供功能 (fX,fY,...) 所需的输出 (1,2,...)。
例如:
+has("lA", 1) #Library A has output 1
+has("lA", 2) #Library A has output 2
+has("lB", 2) #Library B has output 2
+needs("fX", 1) #Feature X needs output 1
+needs("fX", 2) #Feature X needs output 2
+needs("fY", 2) #Feature Y needs output 2
使用 pyDatalog 图形教程,我可以找到至少提供功能所需输出之一的库:
lib_supports_feature(X, Z) <= has(X, Y) & needs(Z, Y)
lib_supports_feature(X,"fX")
这将返回: [('lA',), ('lB',)] 因为它只是查找具有至少一个特征路径的任何库。
有没有一种好方法可以使用 pyDatalog 仅返回满足该功能所有需求的库?