SPARQL: Combining Variables with Literals

Is it possible to create an object in the triple SPARQL, which is created by combining a variable and a literal?

My business:

OPTIONAL { $object dc:identifier $identifier . <info:fedora/abc:123/MODS> fedora-view:disseminationType $mods . <info:fedora/abc:123/TN> fedora-view:disseminationType $tn } 
An object

$ looks like this: <info:fedora/abc:123> $ identifier looks like this: abc:123 and I need it: <info:fedora/abc:123/MODS>

I cannot use <info:fedora/$identifier/MODS> , but is there any other way to "glue" variables and literals together?

+6
source share
1 answer

With SPARQL 1.1, you must use a combination of BIND (), STR (), IRI (), and CONCAT () to do what you want. Sort of:

 SELECT * WHERE { $object dc:identifier $identifier . BIND(IRI(CONCAT(STR($object), "/MODS")) AS $new) $new fedora-view:disseminationType $mods . $new fedora-view:disseminationType $tn . } 
+6
source

Source: https://habr.com/ru/post/908459/


All Articles