2

我正在尝试在 UNION 运算符的两侧使用 SPARQL 属性路径:

SELECT ?leaf
WHERE {
   {?root1 hasChild+ ?leaf} UNION {?root2 hasChild+ ?leaf}
}

但我收到了一个 Virtuoso 错误:

变量 '_::trans_subj_14_0' 用于查询的子表达式但未分配

但是,如果我在任一侧省略加号,则查询有效。例如:

{?root1 hasChild ?leaf} UNION {?root2 hasChild+ ?leaf}

或者

{?root1 hasChild+ ?leaf} UNION {?root2 hasChild ?leaf}

不幸的是,我真的很想得到两个根的叶子......谁能告诉我我做错了什么?

4

0 回答 0