Is it possible to export the results of a SPARQL query to a TRIG file? I’ve used the Stardog data export command to export specific named graphs before, but I have a situation where I have many more named graphs than I care to explicitly name. I want to use something like sparql to specify which graphs should be exported.
I’m thinking of something like this:
export to foo.trig
construct{
graph ?g {
?s ?p ?o
}
}
where {
graph ?g {
... some criteria here....
?s ?p ?o
}
}
Thanks for the suggestion Pavel. I finally got around to trying this today and the CLI command complained whenever I use the graph keyword in my construct statement. Here's some console output:
c:\Users\pneorr\Desktop\SPARQL-FU>stardog query execute cyber-working export_all_4624_graphs.sparql -- --format TRIG
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Encountered " "where" "where "" at line 6, column 1.
Was expecting one of:
<EOF>
"limit" ...
"order" ...
"group" ...
"having" ...
"offset" ...
"values" ...
"bindings" ...
c:\Users\pneorr\Desktop\SPARQL-FU>cat export_all_4624_graphs.sparql
construct {
graph ?g {
?s ?p ?o
}
}
where {
graph ?g {
?x a <http://www.champtc.com/ontologies/winevent#T4624> .
?s ?p ?o
}
}
Removing the graph keyword produces output, but I lose any named-graph context in the results.
Thanks Zachary,
This makes sense to me except that I’m stuck on a windows box and need something that works the same way on different platforms. (windows,bash etc…) I’ll probably end up doing something in Java.