Rdf Sparql查询不工作

Rdf Sparql查询不工作,rdf,sparql,semantic-web,virtuoso,linked-data,Rdf,Sparql,Semantic Web,Virtuoso,Linked Data,我在端点尝试下面的SPARQL查询,但它告诉我 Virtuoso 37000错误SP030:SPARQL编译器,第4行:“select”之前的“UNION”处的语法错误 select?uri,?label其中{quad-map virtrdf:DefaultQuadMap{graph?g{uri?p?label.FILTER(?label='biomal'@en)。}.value?g{} 联合 选择“uri”,其中的标签为{quad-map virtrdf:DefaultQuadMap{grap

我在端点尝试下面的SPARQL查询,但它告诉我

Virtuoso 37000错误SP030:SPARQL编译器,第4行:“select”之前的“UNION”处的语法错误

select?uri,?label其中{quad-map virtrdf:DefaultQuadMap{graph?g{uri?p?label.FILTER(?label='biomal'@en)。}.value?g{}
联合
选择“uri”,其中的标签为{quad-map virtrdf:DefaultQuadMap{graph?g{uri?p?label.FILTER(?label='biomal'@en)。}.values?g{}

什么端点上运行此操作?这有很大的不同。在您的查询中有很多东西不是合法的SPARQL(尽管它们可能会被一个优秀的端点所接受)。例如:(i)它使用未定义的前缀;(ii)投影变量之间有逗号(
?uri,?label
);(iii)
quad map…
不是SPARQL语法的一部分;等等

不过,您收到的错误消息的主要问题是,
union
应该出现在某些三重模式之间,而不是两个查询之间。例如,你可以做:

prefix : <http://example.org/>

select ?person ?name where {
  { ?person :firstName ?name }
  union 
  { ?person :lastName ?name }
}
前缀:
选择?人员?姓名,其中{
{?人:名字?名字}
联合
{?人:姓?名}
}
但你不会这么做的

prefix : <http://example.org/>

select ?person ?name where { ?person :firstName ?name }
union 
select ?person ?name where { ?person :lastName ?name }
前缀:
选择人员姓名,其中{人员:名字}
联合
选择人员姓名,其中{人员:lastName?姓名}

只是一个想法,但可能您在“选择”之前的“联合”处有语法错误。你费心平衡你的牙套了吗?@torazaburo甚至不是这样;这是因为
union
并没有组合多个
select
s,而是在
select
中组合了三种模式。
prefix : <http://example.org/>

select ?person ?name where { ?person :firstName ?name }
union 
select ?person ?name where { ?person :lastName ?name }