Assume the following SPARQL query:
CONSTRUCT
{
?s ?p ?o
}
FROM ?context
WHERE
{
?s ?p ?o
}
To bind the named graph context of the query from above, the best solution due to performance implications, is to change the syntax of the query as:
CONSTRUCT
{
?s ?p ?o
}
WHERE
{
graph `iri(??)` { ?s ?p ?o }
}
Note: In case of using "FROM clause", it needs a constant in order to check at the compile time whether the IRI refers to a graph or a graph group:
CONSTRUCT { ?s ?p ?o } FROM `iri(??)` WHERE { ?s ?p ?o }
CONSTRUCT { ?s ?p ?o } FROM iri(??) WHERE { ?s ?p ?o }