Is it possible to create a subject in a SPARQL triple that is created by combining a variable and a literal?
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>
I can't use <info:fedora/$identifier/MODS>
but is there another way to 'glue' variables and literals together?
With SPARQL 1.1, you should be able to use a combination of BIND(), STR(), IRI(), and CONCAT() to do what you want. 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 .
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With