Commit 1fc425db authored by Sam Thursfield's avatar Sam Thursfield

tracker-extract: Follow Nepomuk correctly in --file output

When called with `--file --output-format=sparql`, it now correctly
separates the FileDataObject and the InformationElement resources.
parent e6f99f4a
......@@ -696,11 +696,21 @@ tracker_extract_get_metadata_by_cmdline (TrackerExtract *object,
if (resource) {
if (output_format == TRACKER_SERIALIZATION_FORMAT_SPARQL) {
char *text;
g_autoptr (TrackerResource) file_resource = NULL;
/* If this was going into the tracker-store we'd generate a unique ID
* here, so that the data persisted across file renames.
/* Set up the corresponding nfo:FileDataObject resource appropriately,
* so the SPARQL we generate is valid according to Nepomuk.
*/
tracker_resource_set_identifier (resource, uri);
file_resource = tracker_resource_get_first_relation (resource, "nie:isStoredAs");
if (file_resource) {
g_object_ref (file_resource);
} else {
file_resource = tracker_resource_new (uri);
tracker_resource_set_relation (resource, "nie:isStoredAs", file_resource);
}
tracker_resource_add_uri (file_resource, "rdf:type", "nfo:FileDataObject");
text = tracker_resource_print_sparql_update (resource, NULL, NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment