Hi to all

I am trying to develop a SPARQL statement in a stored procedure related to
a virtual graph (result of a R2RML mapping) having its IRI not hard coded,
but contained in a variable.

I have tried for example the following syntax, but the query does not
return any triple.


declare graphName varchar;
graphName := 'http://example.com/resource';
for (sparql define input:storage "
http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage";
    select distinct ?class where
        {
          graph ?:graphName
          {
            ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?class
          }
        } order by ?class
      ) do
    {
      -- do something
      string_to_file ('./dump/out.txt',"class" || '\n',-1);
    } ;


As soon as I use the hard coded graph name in the SPARQL statement it works
fine.

    ...
    select distinct ?class where
        {
          graph <http://example.com/resource>
          {
            ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?class
          }
        } order by ?class
      ) do
      ...

The same if I switch from a virtual graph to a real one. It works
immediately with te graph in a variable. Like in the following code.

declare graphName varchar;
graphName := 'http://xmlns.com/foaf/0.1/';
for (sparql define input:storage ""
      select distinct ?class where
       {
         graph ?:graphName
         {
            ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?class
         }
       } order by ?class limit 10
      ) do
    {
      -- do something
      string_to_file ('./dump/out.txt',"class" || '\n',-1);
    } ;


Any chance to have a virtual graph IRI contained in a variable in a working
SPARQL statement?

Thanks!

Cheers

Beppe
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to