On 09/02/15 15:07, Willie Milnor wrote:
Hello,

I want to be able to load a set of ontologies into dataset in order to be
able to have named graph support in my SPARQL queries against said
dataset.  Specifically, I would like to be able to use FROM, FROM NAMED,
and GRAPH clauses in my SPARQL.

 From my investigation, it appears that full named graph support is only
available with TDB datasets, but not available when creating a dataset
using DatasetFactory.  Specifically, against a DatasetFactory created
dataset, using FROM in the query appears to have no affect at all, and even
using FROM NAMED has no affect over simply having GRAPH in the query.

Am I correct, or is there something I'm missing?  Perhaps there is a
specific implementation of DatasetGraph that I should be creating?

I have sample code, but thought I'd simply ask the question in hopes that
there's a simple answer, either way.  Please let me know if the sample code
will be useful.


GRAPH and FROM/FROM NAMED do different things.

GRAPH accesses named graphs in the dataset (i.e. happens during query execution)

FROM/FROM NAMED describe the dataset to be queried (i.e. happens before the query starts).

FROM/FROM NAMED completely overrides the dataset to be queried.

In the case of a TDB dataset, the FROM/FROM NAMED pick graph out of the dataset to form a new one specifically for the query.

https://jena.apache.org/documentation/tdb/dynamic_datasets.html

For a general query, on a general Dataset from DatasetFactory, the graphs are drawn from the web at large.

If you want FROM/FROM NAMED to pull graphs from the web, use a general dataset.

If you want some graphs from a TDB dataset and some from the web at large, create a general Dataset, and add graphs from TDB.

If you use a TDB dataset alone, you can't have dynamic data from the web. It's database, not a web cache.

        Andy


Reply via email to