[英]SPARQL: combining variables with literals
Is it possible to create a subject in a SPARQL triple that is created by combining a variable and a literal? 是否可以在通过组合变量和文字创建的SPARQL三元组中创建主题?
My case is this: 我的情况是这样的:
OPTIONAL
{
$object dc:identifier $identifier .
<info:fedora/abc:123/MODS> fedora-view:disseminationType $mods .
<info:fedora/abc:123/TN> fedora-view:disseminationType $tn
}
$object looks like this: <info:fedora/abc:123>
$identifier looks like this: abc:123
and what I need is this: <info:fedora/abc:123/MODS>
$ object看起来像这样: <info:fedora/abc:123>
$ identifier看起来像这样: abc:123
而我需要的是: <info:fedora/abc:123/MODS>
I can't use <info:fedora/$identifier/MODS>
but is there another way to 'glue' variables and literals together? 我不能使用<info:fedora/$identifier/MODS>
但是还有另一种方法将变量和文字“粘合”在一起吗?
With SPARQL 1.1 , you should be able to use a combination of BIND(), STR(), IRI(), and CONCAT() to do what you want. 使用SPARQL 1.1 ,您应该能够使用BIND(),STR(),IRI()和CONCAT()的组合来执行您想要的操作。 Something like: 就像是:
SELECT * WHERE {
$object dc:identifier $identifier .
BIND(IRI(CONCAT(STR($object), "/MODS")) AS $new)
$new fedora-view:disseminationType $mods .
$new fedora-view:disseminationType $tn .
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.