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分类的推广。该分类涉及多种结构度量,即树宽、收缩树宽、星大小和链匹配数。我们的结果基于关系符号的元数被常数界定的假设,并且在本体中介查询的情况下,假设来自本体和查询的所有符号都可以出现在数据中(即完整数据模式)。我们还研究了所提及结构度量的元问题,即判定给定本体中介查询或约束查询规范是否等价于结构度量有界的规范。