是否可以计算多个命名图中三元组的出现次数并将结果作为表中的行返回?如:
?g ?count ?sequence_count
-------- ------- ---------------
graph1 54 54
graph2 120 80
这是我尝试过的查询。
SELECT ?g ?count ?sequence_count
FROM NAMED <graph1>
FROM NAMED <graph2>
WHERE {
{
select (COUNT(?identifier) as ?count) (COUNT(?sequence) as ?sequence_count)
WHERE { GRAPH ?g {
?identifier a <http://www.w3.org/2000/01/rdf-schema#Resource> .
OPTIONAL { ?identifier <urn:sequence> ?sequence }
} }
}
}
但结果是:
?g ?count ?sequence_count
-------- ------- ---------------
174 134
我试图避免写出:
select ?count_graph1 ?sequence_count_graph1 ?count_graph2 ...
因为可能有数百个图表可供查询。