summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* libtracker-data: Improve changes over single valued ontology propertiesCarlos Garnacho2020-05-131-3/+13
| | | | | | | | | Things like rdfs:label and rdfs:comment that are not tracker through the TrackerOntology and are single-valued may result in errors if there's changes on those. Handle those better by replacing the value instead of trying to insert over it.
* libtracker-data: Return more than strings in SERVICE queriesCarlos Garnacho2020-05-051-10/+38
| | | | | We rely on those being casted by the upper layers, it seems better to work with the correct types all through.
* libtracker-data: Transfer parameter types correctly to SERVICE patternsCarlos Garnacho2020-05-051-4/+30
| | | | | | | It's better not to rely on internal casts to/from strings working (may be troublesome with e.g. rounding with certain doubles). Transfer the types obtained to the internal statement, so those reach the external service.
* libtracker-data: Bail out after errorCarlos Garnacho2020-05-051-0/+2
| | | | | Otherwise we may potentially overwrite the GError on the next iteration, besides it's a broken state already.
* libtracker-data: Proxy parameters to the "services" virtual tableCarlos Garnacho2020-05-051-1/+34
| | | | | | | | | | | Look up the parameters used within the service graph pattern, and ensure those are proxied to the tracker_services virtual table via their valuename/value column pairs. This pieces everything together in supporting ~var bindings within SERVICE{} clauses. Fixes: https://gitlab.gnome.org/GNOME/tracker/-/issues/200
* libtracker-data: Add hidden columns to pass parametersCarlos Garnacho2020-05-051-8/+87
| | | | | | | | | | Support a total of 50 parameters (in name/value column pairs), we use those as input parameters to the virtual table. With this proxying, the upper SQL query may then do likewise via these hidden columns. This will allow ~var parameters to work within SERVICE{} graph patterns.
* libtracker-sparql: Refactor service graph pattern variable extractionCarlos Garnacho2020-05-051-16/+38
| | | | Move it to a separate function.
* libtracker-data: Reorder columns in "services" virtual tableCarlos Garnacho2020-05-051-15/+36
| | | | So it's easier to extend with extra columns
* libtracker-data: Escape the correct character for SQL stringsCarlos Garnacho2020-05-031-6/+7
| | | | | | | | | We must escape the correct ' or " character for SQL strings, mismatches results in the character being doubly printed. Pass the escape character as an argument to the escaping function, and use " in all places, as it is the convention. Fixes: https://gitlab.gnome.org/GNOME/tracker/-/issues/198
* ontology: Enable notifications for nfo:FileDataObjectSam Thursfield2020-05-021-1/+2
| | | | | This is needed so we continue to get notifications for data created by the miner-fs.
* Merge branch 'sam/errors' into 'master'Sam Thursfield2020-05-012-1/+29
|\ | | | | | | | | libtracker-sparql: Map GError codes to DBus error codes See merge request GNOME/tracker!235
| * libtracker-sparql: Map GError codes to DBus error codesSam Thursfield2020-05-012-1/+29
| | | | | | | | | | | | | | | | | | | | DBus errors before: gi.repository.GLib.GError: tracker-sparql-error-quark: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._tracker_2dsparql_2derror_2dquark.Code0: Parser error at byte 0: Expected Query (0) DBus errors now: gi.repository.GLib.GError: tracker-sparql-error-quark: GDBus.Error:org.freedesktop.Tracker.Error.Parse: Parser error at byte 0: Expected Query (0)
* | libtracker-sparql: Fix TRACKER_DEBUG=sparqlSam Thursfield2020-05-012-11/+11
|/ | | | | | | | Queries weren't being printed as I added the trace in the wrong place. It's intentional that even queries with syntax errors are logged, this is useful because the error sent back to the client doesn't contain the original query.
* Merge branch 'sam/cleanups' into 'master'Sam Thursfield2020-05-0128-2901/+19
|\ | | | | | | | | Remove unused ontologies and utils/ontology tools See merge request GNOME/tracker!218
| * ontologies: Fix gitlog property to point to GitlabSam Thursfield2020-05-019-9/+9
| |
| * Remove unused ontologiesSam Thursfield2020-05-0120-2892/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | All of these are unused within tracker-miners, and as far as we know they are also unused in GNOME. Each ontology has a cost on database size and on time to create a new database, so it's good to limit these as much as we can. Alternatives: - nid3: use nmm ontology - ncal, scal: use evolution-data-server as GNOME Calendar does - mlo: use slo ontology
* | Merge branch 'sam/error-no-ontology' into 'master'Sam Thursfield2020-05-013-2/+49
|\ \ | | | | | | | | | | | | Raise an error if no ontology path is given See merge request GNOME/tracker!232
| * | libtracker-sparql: Raise an error if no ontology is passedSam Thursfield2020-04-293-1/+16
| | | | | | | | | | | | | | | | | | Since a0efd1972b122d0a2 it was possible to crash by passing a NULL ontology path to tracker_sparql_connection_new(). Now we raise an error instead.
| * | libtracker-sparql: Translate errors from libtracker-data domainSam Thursfield2020-04-291-1/+33
| | | | | | | | | | | | | | | | | | The libtracker-data error domain is internal so we need to translate any errors to the libtracker-sparql domain before returning them to the user.
* | | Merge branch 'sam/debug-more' into 'master'Sam Thursfield2020-05-018-66/+91
|\ \ \ | |_|/ |/| | | | | | | | Logging and test cleanups See merge request GNOME/tracker!225
| * | Add TRACKER_DEBUG=sparqlSam Thursfield2020-04-284-2/+26
| | | | | | | | | | | | This outputs all queries to the console.
| * | Move some debug messages into TRACKER_DEBUG=sqliteSam Thursfield2020-04-282-24/+14
| | |
| * | Move some debug output to TRACKER_DEBUG=collationSam Thursfield2020-04-281-7/+7
| | |
| * | Move more debug messages to TRACKER_DEBUG=ontology-changesSam Thursfield2020-04-281-33/+40
| | |
| * | Add TRACKER_DEBUG=collation,sqlite flagsSam Thursfield2020-04-282-2/+6
| |/
* | libtracker-data: Don't assert on NULL subjectCarlos Garnacho2020-04-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Getting a NULL subject in TriplesSameSubject handling is possible in queries like: DELETE { ?b a rdfs:Resource } WHERE { OPTIONAL { ?a nie:isStoredAs ?b } } If ?b didn't happen to get resolved to anything. In those cases, the SPARQL update definition says: If any solution produces a triple containing an unbound variable or an illegal RDF construct, such as a literal in a subject or predicate position, then that triple is not included when processing the operation: INSERT will not instantiate new data in the output graph, and DELETE will not remove anything. So we shouldn't assert here, and we should let the operation be optimized away. The latter is already handled, so remove the asserts.
* | libtracker-sparql: Allow shortened graph forms in TrackerResourceCarlos Garnacho2020-04-301-6/+9
| | | | | | | | | | | | | | | | | | When printing to SPARQL we would only accept graph URIs in their full form. Allow expanding prefixes, so it is possible to pass graphs with a prefix (as long as it is covered by the namespace manager). This allows the use of eg. "tracker:Documents", instead of "https://tracker.api.gnome.org/.../Documents".
* | libtracker-sparql: Fix off-by-one error in TrackerNamespaceManagerCarlos Garnacho2020-04-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | When expanding a prefixed form (e.g. nie:url) into a full blown URL, the anchor point would be set around the colon character, but we on one hand were 1 char short when using the prefix for comparisons (e.g. "ni" instead of "nie"), and still paste the colon character when expanding the URI. Move this around so the prefix has one char more, and the suffix one char less.
* | libtracker-sparql: Don't skip TrackerResources by URICarlos Garnacho2020-04-291-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If different relations are set on different TrackerResources with the same uri, only the first would be found at the same of printing the resulting sparql/json/ttl output. This may miss properties being set on the other resources that are skipped. This is a case happening in the nie:DataObject/nie:InformationElement split, as tracker-extract will receive a TrackerResource to be used for the nie:InformationElement, but nie:hasHash and nie:dataSource need to be set on the nie:DataObject at places isolated from each other. The solution to that is have those places create an intermediate TrackerResource for the nie:DataObject each, and set the desired properties. In order to have all those properties properly printed, we don't need to skip resources based on their identifier URI, detecting cycles is still necessary. This may break if several of these resources where to do tracker_resource_set_*() on the very same property, and all expected the property to be cleared. Let's deem this much of a corner case to justify larger refactors.
* | libtracker-data: Handle property path subqueries on unknown graphsCarlos Garnacho2020-04-291-4/+11
| | | | | | | | | | That should be equivalent to poking an empty graph, but we instead trust the table exists and make the query fail.
* | libtracker-data: Avoid clearing an already empty FTS rowCarlos Garnacho2020-04-291-0/+7
| | | | | | | | | | | | | | | | | | | | It is already known that FTS5 external content tables are extremely picky about their index consistenty. It seems another situation to avoid is clearing of FTS rows that are already empty, that seems enough to have the FTS table deem the index inconsistent. Found via tracker-miner tests along the DataObject/InformationElement split.
* | libtracker-direct: Fix notification of create eventsCarlos Garnacho2020-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our TrackerNotifier machinery informs of changes per rdf:type, the logic is as follows: - If the property being added is "<x> rdf:type <class>" and the class matches the one being notified, this is a CREATE event - Anything else (incl rdf:type additions of other classes) is just an "update" to the class being notified. We were looking the class from the wrong property, thus failed to find a class, thus everything were updates. It is the object holding the class, not the predicate. The functional test seemed to just follow along, fix the expected results, as we now do get CREATE events as expected.
* | libtracker-data: Fix retrieval of old datetime values for updatesCarlos Garnacho2020-04-291-7/+18
|/ | | | | | | | | | Commit 542e1254e4f changed datetime storage so we don't resort to tricks with doubles to store sub-second precision. The code retrieving old values for INSERT/UPDATE handling was missed, leading to warnings trying to cast the contained string to a double. Dates are either unix timestamps (ints) or iso8601 dates (strings), deal properly with the latter.
* Merge branch 'wip/carlosg/data-update-cleanups' into 'master'Sam Thursfield2020-04-275-734/+289
|\ | | | | | | | | Various cleanups and improvements to tracker-data-update.c See merge request GNOME/tracker!230
| * libtracker-data: Refactor insert/delete/commit/rollback callback executionCarlos Garnacho2020-04-271-100/+105
| | | | | | | | | | Some of these are being called from different places, add separate functions for this.
| * libtracker-common: Fix lookup directory for stop wordsCarlos Garnacho2020-04-271-1/+1
| | | | | | | | This was missed in the parallel-installable branch.
| * tracker: Add missing newline in CLI outputCarlos Garnacho2020-04-271-0/+1
| |
| * tracker: Allow in-memory endpoints through the CLI commandCarlos Garnacho2020-04-271-9/+12
| | | | | | | | If no database path is passed, create an in-memory database.
| * libtracker-data: Find out URI-ness through property in ontology updatesCarlos Garnacho2020-04-273-28/+18
| | | | | | | | | | | | It seems we can rely better on our own ontology definition, than the RDF we are being fed. Also makes it unnecessary to expose some tracker-data-update.c guts.
| * libtracker-data: Pass object bytes further down updatesCarlos Garnacho2020-04-271-43/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Converting it to a GValue at the top of our updates handling may slightly break for properties that have superproperties of different types. A practical case, nmm:performer can store nmm:Artist resources, but is a subproperty of dc:contributor, which can store strings. Converting to a GValue with the "resource" type will look up a resource ID, so the superproperty would contain an integer matching the ID of the resource, instead of its URI. To behave better in these situations, pass the GBytes as is further down, and convert it to a GValue according to the (super)property being currently handled. This results URIs being properly casted to strings in this case.
| * libtracker-data: Streamline deletion of all values in a multi-valued propertyCarlos Garnacho2020-04-271-131/+46
| | | | | | | | | | Instead of fetching all values, and deleting those one by one, we can flag the operation so that all values are deleted at once.
| * libtracker-data: Drop needless codeCarlos Garnacho2020-04-271-6/+0
| | | | | | | | | | | | This is a remaining of the extra "*:graph" columns in 2.x databases. The bound value was set to an index that is unused, so this is dead code.
| * libtracker-data: Drop needless optimizationCarlos Garnacho2020-04-271-65/+2
| | | | | | | | | | | | | | It's saves little time to do a "direct delete" when the queue is actually empty and ready for processing it directly too. Now that the fallback here are fixed, just queue the operation like everywhere else.
| * libtracker-data: Fix GValue usageCarlos Garnacho2020-04-271-4/+6
| | | | | | | | | | | | | | | | | | If we enter the paths where a delete is queued together with other updates. The GValue being passed was trusted to exist, although it is implicitly deleted early in value_set_remove_value(). Keep a copy of the GValue and use it to pass it along to superproperties handling.
| * libtracker-data: Simplify tracker_data_update_statement()Carlos Garnacho2020-04-271-362/+78
| | | | | | | | | | | | | | The SPARQL specs don't define "update" operations, we only have this for our INSERT OR REPLACE syntax extension. Make it less of a full blown operation, and more ad-hoc to fit its single usecase.
* | build: Honour DESTDIR when creating subcommand linksSam Thursfield2020-04-271-4/+4
| |
* | libtracker-data: Fix lifetime of blank node labelsCarlos Garnacho2020-04-271-12/+6
|/ | | | | | | | | | | According to https://www.w3.org/TR/sparql11-query/#grammarBNodes: Blank node labels are scoped to the SPARQL Request String in which they occur. Different uses of the same blank node label in a request string refer to the same blank node. Scope correctly blank node labels to the full update string, instead of each InsertClause within.
* Merge branch 'sam/debug' into 'master'Sam Thursfield2020-04-2313-403/+128
|\ | | | | | | | | | | | | Rework debug logging for 3.0 Closes #178 See merge request GNOME/tracker!219
| * Remove TRACKER_VERBOSITY and tracker-log moduleSam Thursfield2020-04-2010-383/+0
| | | | | | | | | | | | | | | | | | Users should now use G_MESSAGES_DEBUG=Tracker to see debug messages on the console. The TRACKER_VERBOSITY only worked if tracker_log_init() had been called, which can't be done when libtracker-sparql is being used from an application outside of Tracker.
| * Add ONTOLOGY_CHANGES debug flag and hide index creation logs by defualtSam Thursfield2020-04-203-40/+40
| |