Export query result into a file

I want to export all the triples of a database in a rdf or nt file. I have the Reasoning enabled.
My query:

construct {?s ?p ?o} where {?s ?p ?o }

When I try to export the result using the web interface, the downloading takes a lot of time. I tried to load the exported rdf into a new database but I keep getting errors regarding the format of the file

There was a fatal failure during preparation of 13363e20-5cf3-401f-858a-9693da42f87e org.openrdf.rio.RDFParseException: XML document structures must start and end within the same entity. [line 8367444, column 1]

When I check the file, the xml is broken.
I have tried it multiple times and the result is the same. Similar issue with nt format as well.

My best guess would be that the query is timing out and the result is truncated. You may want to adjust the query.timeout option

I tired increasing the query.timeout.
Now, the downloading gets stuck for really long time and eventually fails.

Can this be done via command line? I want to try having a really large value for timeout and leave it running in my openstack instance.

Yes, you can do it via the stardog query command [1]. You can specify both format and timeout in the arguments.

However using reasoning with unrestricted patterns like ?s ?p ?o is discouraged. In many cases this will produce more results than the user expects many of which will be meaningless for the client application. Stardog is not particularly optimized for it and we suggest you always try to keep the predicate variable bound to a value (as well as the object variable in patterns with rdf:type in the middle).

Cheers,
Pavel

[1] Command Line Interface | Stardog Documentation Latest

I tried it but the format parameter is not working for me. I get:

'RDF/XML' is not a valid RDF format identifier. Acceptable format strings are SPARQL, JSON, TEXT, TABLE, CSV, TSV, HTML.

This is the correct behavior. SELECT query returns binding sets (aka tuples) while RDF/XML is a format for RDF triples. Choose one of the acceptable formats or use CONSTRUCT.

Best,
Pavel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.