是否可以在SPARQL

问题描述

我需要执行CONSTRUCT查询,其中必须将谓词值之一(即IRI)转换为结果中带前缀的格式字符串。例如

TTL中的资源:

@prefix sh:                    <http://www.w3.org/ns/shacl#>
@prefix x: <somenamespace does not matter#>
@prefix rdfs:                  <http://www.w3.org/2000/01/rdf-schema#> .

x:Test
  sh:path rdfs:label
.

构造查询

    PREFIXES LIST...

CONSTRUCT
{
  x:Test2 x:customPredicate ?requiredValue .
} 
WHERE
{
 x:Test sh:path ?requiredValue .
}

实际结果:

x:Test2 x:customPredicate <http://www.w3.org/2000/01/rdf-schema#label> .

预期结果:

x:Test2 x:customPredicate "rdfs:label" .

是否可以使用普通SPARQL?或者也许我不得不使用某种自定义函数(使用Apache Jena)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)