Named virtual graphs

Hi,

Is it possible to somehow achieve something like the following with virtual graphs:

mapping from sql {
  SELECT FROM `mydatasource`.`products` P
}
to {
  graph ?graph {
    ?product a commercial:Product .
    ?product rdfs:label ?product_name
  }
}
where {
  BIND(template("http://www.onlineshopforall.com/stores/id={store_id}") AS ?graph)
  BIND(template("http://www.onlineshopforall.com/products/id={product_id}") AS ?product)
}

That is, I'd like for some of the triples in a virtual graph to sit in a named graph, also derived from my relational source. In other words, I'd like to be working with "virtual quads" not only "virtual triples". Is that possible?

When I try the above, the effect is that the virtual graph is empty with no warning or error (well, perhaps in the server logs, but I don't have access to them).

Thanks much in advance!
Boris

Hi Boris,

named graphs (or virtual quads) are currently not supported as part of Virtual Graph mappings. See also the end of this section in the docs: Virtual Graphs | Stardog Documentation Latest
However, you can specify multiple Virtual Graphs for the same data source which you can query just like named graphs. Alternatively, in your example, you can add an additional triple to each product in the mapping to indicate the products' store_id. Then using an INSERT query you can materialize the data into a named graph in a DB. This would look something like this:

INSERT {
    GRAPH ?storeId { 
        ....
    }
}
WHERE {
    ?product a commercial:Product .
    ?product commercial:storeId ?storeId
}

I hope this helps.
Best regards,

Lars

Hi,

Thanks for the clarification. Yes, will consider alternatives such materialization.

Best,
Boris