We study the complexity of answer counting for ontology-mediated queries and for querying under constraints, considering conjunctive queries and unions thereof (UCQs) as the query language and guarded TGDs as the ontology and constraint language, respectively. Our main result is a classification according to whether answer counting is fixed-parameter tractable (FPT), W[1]-equivalent, #W[1]-equivalent, #W[2]-hard, or #A[2]-equivalent, lifting a recent classification for UCQs without ontologies and constraints due to Dell et al. The classification pertains to various structural measures, namely treewidth, contract treewidth, starsize, and linked matching number. Our results rest on the assumption that the arity of relation symbols is bounded by a constant and, in the case of ontology-mediated querying, that all symbols from the ontology and query can occur in the data (so-called full data schema). We also study the meta-problems for the mentioned structural measures, that is, to decide whether a given ontology-mediated query or constraint-query specification is equivalent to one for which the structural measure is bounded.
翻译:我们研究了本体介导查询及约束查询中答案计数问题的复杂性,分别以合取查询及其并集(UCQs)作为查询语言,以受保护TGDs作为本体和约束语言。主要结果是对答案计数是否为固定参数可解(FPT)、W[1]-等价、#W[1]-等价、#W[2]-困难或#A[2]-等价进行了分类,这推广了Dell等人近期关于无本体和约束的UCQs分类结果。该分类涉及多种结构度量,即树宽、收缩树宽、星大小和链接匹配数。我们的结果基于关系符号元数被常数约束的假设,在本体介导查询情形下,还要求本体和查询中的所有符号可出现在数据中(即完整数据模式)。我们还研究了上述结构度量的元问题,即判断给定的本体介导查询或约束查询规范是否等价于具有有界结构度量的规范。