假设我有下面的Turtle声明:
@prefix : <http://example.org#> .
:ls :list (:a :b :c)
有没有办法获得元素在集合中的位置?
例如,使用以下查询:
PREFIX : <http://example.org#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?elem WHERE {
?x :list ?ls .
?ls rdf:rest*/rdf:first ?elem .
}
我得到了:
--------
| elem |
========
| :a |
| :b |
| :c |
--------
但是我想要一个查询来获得:
--------------
| elem | pos |
==============
| :a | 0 |
| :b | 1 |
| :c | 2 |
--------------
有可能吗?
https://stackoverflow.com/questions/17523804
复制相似问题