Select 所有具有相同前缀的 SPARQL
Select All That Has The Same Prefix SPARQL
我想 return 所有主题具有相同前缀的所有三元组。
PREFIX dv: <http://example.org/example_vocabulary:>
SELECT DISTINCT *
FROM <http://example.org/dataset.example>
WHERE {
?s ?p ?o .
}
您应该将 URI 视为一个字符串,并基本上根据您的需要过滤您的变量。由于要查找前缀,因此可以使用 strstarts
。例如,沿着这些方向的东西将起作用:
PREFIX dv: <http://example.org/example_vocabulary>
SELECT DISTINCT *
FROM <http://example.org/dataset.example>
WHERE {
?s ?p ?o .
filter strstarts(str(?s),str(dv:))
}
您应该阅读 string function。
我想 return 所有主题具有相同前缀的所有三元组。
PREFIX dv: <http://example.org/example_vocabulary:>
SELECT DISTINCT *
FROM <http://example.org/dataset.example>
WHERE {
?s ?p ?o .
}
您应该将 URI 视为一个字符串,并基本上根据您的需要过滤您的变量。由于要查找前缀,因此可以使用 strstarts
。例如,沿着这些方向的东西将起作用:
PREFIX dv: <http://example.org/example_vocabulary>
SELECT DISTINCT *
FROM <http://example.org/dataset.example>
WHERE {
?s ?p ?o .
filter strstarts(str(?s),str(dv:))
}
您应该阅读 string function。