After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 776723 - Various properties (nmm:flash, slo:location) point to non-existent resources
Various properties (nmm:flash, slo:location) point to non-existent resources
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: Extractor
1.10.x
Other All
: Normal normal
: ---
Assigned To: tracker-extractor
tracker-extractor
Depends on:
Blocks:
 
 
Reported: 2017-01-02 17:27 UTC by Debarshi Ray
Modified: 2017-01-31 13:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
libtracker-sparql: Fix sparql/turtle generation of builtin classes (2.18 KB, patch)
2017-01-03 14:05 UTC, Carlos Garnacho
committed Details | Review
tracker-extract: Insert nmm:flash as a Resource (4.42 KB, patch)
2017-01-03 14:05 UTC, Carlos Garnacho
committed Details | Review
tracker-extract: Insert nmm:meteringMode as a resource (4.59 KB, patch)
2017-01-03 14:05 UTC, Carlos Garnacho
committed Details | Review
tracker-extract: Insert nmm:whiteBalance as a resource (4.56 KB, patch)
2017-01-03 14:05 UTC, Carlos Garnacho
committed Details | Review
tracker-extract: Insert nfo:orientation as a resource (4.59 KB, patch)
2017-01-03 14:05 UTC, Carlos Garnacho
committed Details | Review
libtracker-sparql: Print resources referenced in cardinality>1 properties (1.78 KB, patch)
2017-01-16 13:01 UTC, Carlos Garnacho
committed Details | Review
tracker-extract-png: Insert "nfo:image-category-screenshot" as a URI (1.07 KB, patch)
2017-01-31 10:42 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2017-01-02 17:27:25 UTC
In tracker-1.10.x, various properties (nmm:flash, slo:location) point to non-existent resources.

Related to this, the URNs used to represent nmm:flash-on/off have changed. They used to be fully namespaced in the form of http://www.tracker-project.org/temp/nmm#flash-off, while now they are simply nmm:flash-on/off. Reading commit 8cc026da8c makes me think that they are simply strings, not URNs.

See the following:

[rishi@kolache tracker]$ tracker sparql -q "SELECT ?u WHERE {?u a nmm:Flash}"
Results:
  http://www.tracker-project.org/temp/nmm#flash-on
  http://www.tracker-project.org/temp/nmm#flash-off
 
[rishi@kolache tracker]$ tracker sparql -q "SELECT nmm:flash(?u) WHERE {?u a nmm:Photo}"
Results:
  nmm:flash-off
  ...
  nmm:flash-on
  ...
  http://www.tracker-project.org/temp/nmm#flash-off
  ...
  http://www.tracker-project.org/temp/nmm#flash-on

[rishi@kolache tracker]$ tracker sql -q "select \"nmm:flash\" from \"nmm:Photo\""
(tracker sql:24446): Tracker-DEBUG: Locale 'TRACKER_LOCALE_LANGUAGE' was set to 'en_IN.UTF-8'
(tracker sql:24446): Tracker-DEBUG: Locale 'TRACKER_LOCALE_TIME' was set to 'en_IN.UTF-8'
(tracker sql:24446): Tracker-DEBUG: Locale 'TRACKER_LOCALE_COLLATE' was set to 'en_IN.UTF-8'
(tracker sql:24446): Tracker-DEBUG: Locale 'TRACKER_LOCALE_NUMERIC' was set to 'en_IN.UTF-8'
(tracker sql:24446): Tracker-DEBUG: Locale 'TRACKER_LOCALE_MONETARY' was set to 'en_IN.UTF-8'
Tracker-Message: Setting database locations
Tracker-Message: Checking database directories exist
Tracker-Message: Checking database version
Tracker-Message: Checking database files exist
Tracker-Message: Loading databases files...
Tracker-Message: Didn't shut down cleanly last time, doing integrity checks
Tracker-Message: Loading database... '/home/rishi/.cache/tracker/meta.db' (metadata)
Tracker-Message: Opened sqlite3 database:'/home/rishi/.cache/tracker/meta.db'
(tracker sql:24446): Tracker-DEBUG: Resetting collator in db interface 0x56252943e030
(tracker sql:24446): Tracker-DEBUG: [ICU collation] Initializing collator for locale 'en_IN.UTF-8'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'PRAGMA journal_mode = WAL;'
Tracker-Message:   Setting page size to 8192
Tracker-Message:   Setting cache size to 250
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'PRAGMA integrity_check(1)'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'SELECT 1 FROM Resource'
Tracker-Message: Opened sqlite3 database:'/home/rishi/.cache/tracker/meta.db'
(tracker sql:24446): Tracker-DEBUG: Resetting collator in db interface 0x56252943e0f0
(tracker sql:24446): Tracker-DEBUG: [ICU collation] Initializing collator for locale 'en_IN.UTF-8'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'PRAGMA journal_mode = WAL;'
Tracker-Message:   Setting page size to 8192
Tracker-Message:   Setting cache size to 250
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'SELECT (SELECT Uri FROM Resource WHERE ID = "tracker:Ontology".ID), "nao:lastModified" FROM "tracker:Ontology"'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'SELECT (SELECT Uri FROM Resource WHERE ID = "tracker:Namespace".ID), "tracker:prefix" FROM "tracker:Namespace"'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'SELECT "rdfs:Class".ID, (SELECT Uri FROM Resource WHERE ID = "rdfs:Class".ID), "tracker:notify" FROM "rdfs:Class" ORDER BY ID'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'SELECT (SELECT Uri FROM Resource WHERE ID = "rdfs:subClassOf") FROM "rdfs:Class_rdfs:subClassOf" WHERE ID = (SELECT ID FROM Resource WHERE Uri = ?)'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'SELECT "rdf:Property".ID, (SELECT Uri FROM Resource WHERE ID = "rdf:Property".ID), (SELECT Uri FROM Resource WHERE ID = "rdfs:domain"), (SELECT Uri FROM Resource WHERE ID = "rdfs:range"), "nrl:maxCardinality", "tracker:indexed", (SELECT Uri FROM Resource WHERE ID = "tracker:secondaryIndex"), "tracker:fulltextIndexed", "tracker:transient", "tracker:writeback", (SELECT 1 FROM "rdfs:Resource_rdf:type" WHERE ID = "rdf:Property".ID AND "rdf:type" = (SELECT ID FROM Resource WHERE Uri = 'http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#InverseFunctionalProperty')), "tracker:forceJournal", "tracker:defaultValue" FROM "rdf:Property" ORDER BY ID'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'SELECT (SELECT Uri FROM Resource WHERE ID = "rdfs:subPropertyOf") FROM "rdf:Property_rdfs:subPropertyOf" WHERE ID = (SELECT ID FROM Resource WHERE Uri = ?)'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'SELECT (SELECT Uri FROM Resource WHERE ID = "tracker:domainIndex") FROM "rdfs:Class_tracker:domainIndex" WHERE ID = (SELECT ID FROM Resource WHERE Uri = ?)'
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'SELECT Resource.Uri, "rdfs:Resource"."nao:lastModified" FROM "tracker:Ontology" INNER JOIN Resource ON Resource.ID = "tracker:Ontology".ID INNER JOIN "rdfs:Resource" ON "tracker:Ontology".ID = "rdfs:Resource".ID'
Tracker-Message: Current and DB locales match: 'en_IN.UTF-8'
--------------------------------------------------
 
 
(tracker sql:24446): Tracker-DEBUG: Preparing query: 'select "nmm:flash" from "nmm:Photo"'
Results:
100541
...
(null)
...
100558
...
971

[rishi@kolache tracker]$ tracker info ~/Pictures/gnome-bug-747123.jpg
Querying information for entity:'/home/rishi/Pictures/gnome-bug-747123.jpg'
  'urn:uuid:4fada2c1-377a-d41b-3517-ed21b7ae8671'
Results:
  'http://purl.org/dc/elements/1.1/date' = '2015-11-19T10:02:53Z'
  'http://purl.org/dc/elements/1.1/date' = '2015-11-19T10:08:11Z'
  'http://purl.org/dc/elements/1.1/date' = '2017-01-02T15:15:56Z'
  'http://purl.org/dc/elements/1.1/source' = 'http://www.tracker-project.org/ontologies/tracker#extractor-data-source'
  'http://purl.org/dc/elements/1.1/source' = 'urn:nepomuk:datasource:9291a450-1d49-11de-8c30-0800200c9a66'
  'tracker:added' = '2017-01-02T17:12:14Z'
  'tracker:modified' = '10'
  'rdf:type' = 'http://www.w3.org/2000/01/rdf-schema#Resource'
  'rdf:type' = 'http://www.semanticdesktop.org/ontologies/2007/01/19/nie#DataObject'
  'rdf:type' = 'http://www.semanticdesktop.org/ontologies/2007/01/19/nie#InformationElement'
  'rdf:type' = 'http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject'
  'rdf:type' = 'http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Media'
  'rdf:type' = 'http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Visual'
  'rdf:type' = 'http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Image'
  'rdf:type' = 'http://www.tracker-project.org/temp/nmm#Photo'
  'nie:byteSize' = '1057589'
  'nie:dataSource' = 'http://www.tracker-project.org/ontologies/tracker#extractor-data-source'
  'nie:dataSource' = 'urn:nepomuk:datasource:9291a450-1d49-11de-8c30-0800200c9a66'
  'nie:isPartOf' = 'urn:uuid:cf968b0e-b7cc-fe77-4c58-26dbc8212592'
  'nie:url' = 'file:///home/rishi/Pictures/gnome-bug-747123.jpg'
  'nfo:belongsToContainer' = 'urn:uuid:cf968b0e-b7cc-fe77-4c58-26dbc8212592'
  'tracker:available' = 'true'
  'nie:contentCreated' = '2015-11-19T10:02:53Z'
  'nie:informationElementDate' = '2015-11-19T10:02:53Z'
  'nie:isStoredAs' = 'urn:uuid:4fada2c1-377a-d41b-3517-ed21b7ae8671'
  'nie:mimeType' = 'image/jpeg'
  'slo:location' = 'urn:uuid:868e1af9-de5c-9256-3104-8359a4a0991d'
  'nfo:fileLastAccessed' = '2017-01-02T15:15:56Z'
  'nfo:fileLastModified' = '2015-11-19T10:08:11Z'
  'nfo:fileName' = 'gnome-bug-747123.jpg'
  'nfo:fileSize' = '1057589'
  'nfo:equipment' = 'urn:equipment:Motorola:XT1033:'
  'nmm:dlnaMime' = 'image/jpeg'
  'nmm:dlnaProfile' = 'JPEG_LRG'
  'nfo:height' = '2592'
  'nfo:width' = '1456'
  'nfo:horizontalResolution' = '72'
  'nfo:verticalResolution' = '72'
  'nmm:exposureTime' = '0.1'
  'nmm:flash' = 'nmm:flash-off'
  'nmm:fnumber' = '2.4'
  'nmm:focalLength' = '3.5'
  'nmm:isoSpeed' = '1250.0'
  'nmm:meteringMode' = 'nmm:metering-mode-average'
  'nmm:whiteBalance' = 'nmm:white-balance-auto'

[rishi@kolache tracker]$ tracker info 'urn:uuid:868e1af9-de5c-9256-3104-8359a4a0991d'
Querying information for entity:'urn:uuid:868e1af9-de5c-9256-3104-8359a4a0991d'
Results:
 
 
[rishi@kolache tracker]$
Comment 1 Debarshi Ray 2017-01-02 17:44:03 UTC
Bisection points to this commit:

commit 8cc026da8cdebba4d5b17ed23841ec59d79f60e3
Author: Sam Thursfield <ssssam@gmail.com>
Date:   Sun Mar 27 00:15:33 2016 +0000

    Use TrackerResource instead of TrackerSparqlBuilder in all extractors
    
    For a long time, all the Tracker extractors have manually constructed a
    SPARQL update command using TrackerSparqlBuilder to represent their
    output. This commit changes all of them to use the TrackerResource
    class instead, which makes the code a lot more concise and readable.
    
    This introduces some API breaks in the internal libtracker-extract
    library. This has been a private library since Tracker 0.16 or earlier,
    so it's fine.
    
    If the extractors only output SPARQL then they are only useful to
    people who are using a SPARQL store. Now we can output a serialization
    format like Turtle as well. This will hopefully make the extract modules
    useful outside of Tracker itself.
    
    I've tried to preserve the behaviour of the extractors as much as
    possible, but there are two things that are now handled differently:
    
      * nao:Tag resources are given a fixed URI based on the tag label, such
        as <urn:tag:My_Tag>. Previously they were inserted as blank nodes,
        so tracker-store would give them unique IDs like <urn:uuid:1234...>
    
      * All extractors created nco:Contact resources for content publishers,
        but previously some would assign fixed URIs based on the name
        <urn:contact:James%20Joyce>, while others would insert them as blank
        nodes so they would be assigned unique IDs like <urn:uuid:1234...>.
        Now, all extractors create nco:Contact resources with fixed URIs
        based on the content creator's name.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767472
Comment 2 Carlos Garnacho 2017-01-03 14:05:16 UTC
Created attachment 342764 [details] [review]
libtracker-sparql: Fix sparql/turtle generation of builtin classes

We don't need to generate sparql/turtle for builtin classes
(eg. nmm:flash-on).
Comment 3 Carlos Garnacho 2017-01-03 14:05:22 UTC
Created attachment 342765 [details] [review]
tracker-extract: Insert nmm:flash as a Resource

This is not an string, but a builtin class, so it must be dealt
with as a resource.
Comment 4 Carlos Garnacho 2017-01-03 14:05:27 UTC
Created attachment 342766 [details] [review]
tracker-extract: Insert nmm:meteringMode as a resource

This is not an string, but a builtin class, so it must be dealt
with as a resource.
Comment 5 Carlos Garnacho 2017-01-03 14:05:33 UTC
Created attachment 342767 [details] [review]
tracker-extract: Insert nmm:whiteBalance as a resource

This is not an string, but a builtin class, so it must be dealt
with as a resource.
Comment 6 Carlos Garnacho 2017-01-03 14:05:40 UTC
Created attachment 342769 [details] [review]
tracker-extract: Insert nfo:orientation as a resource

This is not an string, but a builtin class, so it must be dealt
with as a resource.
Comment 7 Carlos Garnacho 2017-01-16 13:01:09 UTC
Created attachment 343552 [details] [review]
libtracker-sparql: Print resources referenced in cardinality>1 properties

Those were not being printed, just referenced in the parent resource.
Fixes properties like slo:location being lost on newly indexed photos.
Comment 8 Carlos Garnacho 2017-01-18 11:11:00 UTC
Pushed to master so far, these will be probably cherry-picked on 1.10 though.

Attachment 342764 [details] pushed as ad26b15 - libtracker-sparql: Fix sparql/turtle generation of builtin classes
Attachment 342765 [details] pushed as 8110036 - tracker-extract: Insert nmm:flash as a Resource
Attachment 342766 [details] pushed as 12aae08 - tracker-extract: Insert nmm:meteringMode as a resource
Attachment 342767 [details] pushed as 1be7060 - tracker-extract: Insert nmm:whiteBalance as a resource
Attachment 342769 [details] pushed as 7ef71db - tracker-extract: Insert nfo:orientation as a resource
Attachment 343552 [details] pushed as e48de2e - libtracker-sparql: Print resources referenced in cardinality>1 properties
Comment 9 Debarshi Ray 2017-01-31 10:42:54 UTC
Created attachment 344639 [details] [review]
tracker-extract-png: Insert "nfo:image-category-screenshot" as a URI
Comment 10 Debarshi Ray 2017-01-31 10:51:11 UTC
Review of attachment 342765 [details] [review]:

::: src/libtracker-extract/tracker-xmp.c
@@ +999,3 @@
+
+		flash = tracker_resource_new (data->flash);
+		tracker_resource_set_relation (resource, "nmm:flash", flash);

I wonder if it makes sense to use tracker_resource_{add,set}_uri instead.
Comment 11 Debarshi Ray 2017-01-31 10:52:56 UTC
Thanks for the fixes, Carlos. I tested them and they work as expected.
Comment 12 Carlos Garnacho 2017-01-31 11:16:18 UTC
Comment on attachment 344639 [details] [review]
tracker-extract-png: Insert "nfo:image-category-screenshot" as a URI

Nice catch :)
Comment 13 Debarshi Ray 2017-01-31 13:27:30 UTC
Comment on attachment 344639 [details] [review]
tracker-extract-png: Insert "nfo:image-category-screenshot" as a URI

Pushed to master and tracker-1.10.