where 子句中的单个值

Sac*_*nth 0 rdf ontology sparql owlim graphdb

您好,我有一个 SPARQL 查询,它在 where 子句中包含此内容

...
optional {
        ?v foo:thing ?something .
        $dontgetthis
        ?v bar:somethingelse ?otherthing .
...
}
...
Run Code Online (Sandbox Code Playgroud)

现在,我明白了大部分内容,除了一件事。我不明白$dontgetthis。这是什么意思? $dontgetthis不在查询中的其他任何地方使用。

Jos*_*lor 5

美元符号是 SPARQL 中的合法变量前缀,因此您可以使用诸如 之类的变量$v,但这似乎并不是发生的情况。您可以将可选作为 WHERE 中唯一的内容,因此这样的查询是合法的:

prefix foo: <>
prefix bar: <>
select * where { 
  optional {
          ?v foo:thing ?something .
          ?v bar:somethingelse ?otherthing .
  }
}
Run Code Online (Sandbox Code Playgroud)

我宁愿想知道您在内部看到的查询是否$dontgetthis是一个字符串,该字符串$dontgetthis将被其他代码替换为其他内容。它本身并不是合法的 SPARQL。