【发布时间】:2013-02-08 17:30:27
【问题描述】:
我有一些命名图存储在 Virtuoso 中,我想从提供的列表中找到与最多术语匹配的图。
我的查询是以编程方式构建的,如下所示:
SELECT DISTINCT ?graph (count(DISTINCT ?match) as ?matches)
WHERE {
GRAPH ?graph {
{?match rdf:label "term 1"}
UNION {?match rdf:label "term 2"}
UNION {?match rdf:label "term 3"}
...
}
}
ORDER BY DESC(?matches)
每个术语成为另一个 UNION 子句。
有没有更好的方法来做到这一点?查询变得又长又丑,而且当词太多时,Virtuoso 会抱怨。
【问题讨论】:
标签: sparql rdf semantic-web virtuoso named-graphs