I would like to use a script to export part of the data from a database and then import it in another database.
I can use stardog query to export the desired partition of my data. However, the result formats (such as CSV, TEXT, SPARQL, etc) do not seem to be accepteb by stardog data add.
CONSTRUCT seems to work, although it is getting more than desired. Is it possible to restrict the results only to the default graph? (ie. not querying any named graphs) I have the option "query all graphs" activated in the database and should not remove this even temporarily. I just need for this specific query to be able to say "only query the default graph, not any named graph".
I suppose there is no "standard" way to do it in SPARQL. Before, I tried to get the name of the default graph (select distinct ?g where { graph ?g {?s ?p ?o} }) and then use it in the FROM clause (ie. FROM <def_name_url>) but it did not work. It only showed my preffixes.
Yeah, managing query datasets is a bit odd part of the SPARQL spec. The spec intentionally does not define the query dataset in case the query doesn't use either FROM or FROM NAMED. In that case the dataset is determined by the vendor, and Stardog uses either the default graph or all graphs depending on query.all.graphs for patterns outside of graph g { ... }.
If you don't use query.all.graphs you can still run SPARQL queries without any Stardog-specific URIs but you'd need to manually UNION scans in the default and named scopes, e.g. { ?s ?p ?o } UNION { graph ?g { ?s ?p ?o } } to get all data. But if you do use query.all.graphs=true, then you need FROM <tag:stardog:api:context:default> to access the default graph because it really does not have any name in the SPARQL spec.