Hi,
Is there a simple way to create a new URI in a CONSTRUCT query ? For example by concatenating variables with a prefix ? (This new URI is necessary to create a new individual)
Hi,
Is there a simple way to create a new URI in a CONSTRUCT query ? For example by concatenating variables with a prefix ? (This new URI is necessary to create a new individual)
There's a function called URI() that converts a string to a URI
CONSTRUCT { ?s a :Duck . }
WHERE {
:DuckTarget :someProperty ?stringValuedField
BIND (URI(CONCAT("http://ducks.example.com/aDuck/",?stringValuedField)) AS ?s)
}
pretty simple...
Virtuoso uses custom syntax extension --- an expression can be enclosed into backquotes and placed directly into group pattern or in constructor template instead of a plain variable. Plain-old LISP style. In your case it could be
CONSTRUCT { `iri(bif:concat("http://ducks.example.com/aDuck/",?stringValuedField))` a :Duck . }
WHERE { :DuckTarget :someProperty ?stringValuedField }