1. 17 Feb, 2019 2 commits
  2. 14 Feb, 2019 1 commit
  3. 13 Feb, 2019 6 commits
  4. 06 Feb, 2019 1 commit
  5. 05 Feb, 2019 4 commits
    • Carlos Garnacho's avatar
      libtracker-data: Add quotes around string literal · 7bb2bdfb
      Carlos Garnacho authored
      If the query is not cacheable, we were adding string literals unquoted.
    • Carlos Garnacho's avatar
      libtracker-data: Use "tracker_triples" table in variable predicate queries · 5d186707
      Carlos Garnacho authored
      There were some special cases that were handled individually:
      - select * { <s> ?p ?o } was handled through querying the rdf:types of <s>,
        and performing an UNION of all related tables. This doesn't play along
        with parameterized variables where the subject might be a variable assigned
        later through the TrackerSparqlStatement.
      - select * { ?s ?p <o> } used similar tricks (querying <o> this time). It had
        all those drawbacks, plus it only worked for properties with rdfs:Resource
      - select * { ?s ?p ?o . ?p rdfs:domain <dom> } was handled specially.
      - select * { ?s ?p ?o } is unsupported
      - select * { <s> ?p <o> } was silently unhandled
      All those combinations are transparently handled with the tracker_triples
      virtual table now.
    • Carlos Garnacho's avatar
      libtracker-data: Initialize "tracker_triples" virtual table on all interfaces · a27b7b28
      Carlos Garnacho authored
      This table may be used in either select or update queries, so make sure it
      gets initialized in all paths.
    • Carlos Garnacho's avatar
      libtracker-data: Add "triples" virtual table · ab3c6d7e
      Carlos Garnacho authored
      This eponymous virtual table is able to decompose the full database
      in all its composing triples. This may be used to implement queries
      with predicate variables in a generic way, and finally support the
      kind of queries where we gave up (e.g. "select * { ?s ?p ?o }").
      Internally it works by using the TrackerOntologies in order to
      split the query into a set of queries for individual
      properties/columns, some optimizations happen when specific matches
      are given, and the SQLite engine does take care of the ones we don't
      optimize, sorting, etc...
      This virtual table will also be useful in the future when implementing
      CONSTRUCT/DESCRIBE commands.
  6. 24 Jan, 2019 5 commits
  7. 05 Jan, 2019 1 commit
  8. 26 Dec, 2018 4 commits
    • Carlos Garnacho's avatar
      libtracker-data: Implement alternative path sequences · 0d5c1a65
      Carlos Garnacho authored
      The alternative path operator '|' allows multiplexing the ways to get a
      value. For example:
        { ?u nie:title|nfo:fileName 'foo' }
      will return elements whose title or filename matches the given string.
    • Carlos Garnacho's avatar
      libtracker-data: Implement PathMod · 862b1617
      Carlos Garnacho authored
      All three modifiers in PathMod are implemented now:
        - ?(zero or one): { ?u nfo:belongsToContainer? ?c } returns direct
          children of ?c, plus ?c itself.
        - *(zero or more): { ?u nfo:belongsToContainer* ?c } returns all children
          of ?c recursively, including ?c itself.
        - +(one or more): { ?u nfo:belongsToContainer+ ?c } returns all children
          of ?c recursively.
    • Carlos Garnacho's avatar
      libtracker-data: Handle current path operators through WITH clause · 0b80cc61
      Carlos Garnacho authored
      Using the WITH clause is already a pre-requisite for * and + operators
      (as those queries need to be recursive). It then struck me that using
      it for all path operators is simpler and easier to read both in code and
      SQL, for starters:
        - We were going long ways to invert the processing order of VerbPath and
          ObjectList, so the latter would be handled within the former. This was
          necessary so we could eg. invert subject and object in ^.
        - Each property path element results in a rather simple SELECT in the
          WITH clause, and nesting those comes off naturally. This is handy as
          a property path is actually an expression tree, which we weren't
          handling that well.
      As a first step, add this infrastructure for property paths using the WITH
      clause and use it for the currently supported operators.
      We still fall through the usual code paths (no subqueries in WITH clause)
      if the property path is formed of a single literal with no operators
      (i.e. the good old "?s foo:bar ?o" case). This is still necessary for
      fts:match (which is not really a property, thus can't be used in property
      paths) and rdfs:domain special casing (which just applies if the predicate
      is a variable, not the case with property paths).
    • Carlos Garnacho's avatar
      libtracker-data: Gracefully exclude NULL subject/pred/object from resultset · 8433d386
      Carlos Garnacho authored
      This is mentioned in the spec, and was correctly handled in the previous
      parser (although the comment mentioned text from a similar restriction with
      CONSTRUCT). Solutions with unbound variables should simply be ignored,
      this was kinda the case but just detected through g_return_if_fail() later
  9. 18 Dec, 2018 2 commits
  10. 17 Dec, 2018 1 commit
    • Andrea Azzarone's avatar
      tests: compile gschemas in the build dir · c33c080c
      Andrea Azzarone authored
      Allow running tests without the need to install the gsettings schemas.
      This commit moves all the gschemas in the data directory and compiles
      them in the build directory. Tests that require gschemas need to be
      launched with the proper GSETTINGS_SCHEMA_DIR env variable.
      Fixes: #60
  11. 05 Dec, 2018 1 commit
  12. 17 Nov, 2018 7 commits
    • Carlos Garnacho's avatar
      libtracker-data: Tell TrackerPredicateVariable to return graph if needed · aa2c2dac
      Carlos Garnacho authored
      This got lost in the new parser, fixes a tracker-writeback query involving
      variables in graph and predicate. Pointed out by Sam Thursfield on
      tracker-miners!27 (comment 367289)
      Enabling the return_graph variable, we create the appropriate column and
      the "no such column: predicate1.graph" error goes away.
    • Carlos Garnacho's avatar
      libtracker-data: Convert coalesced elements to string · 311f947c
      Carlos Garnacho authored
      Dropping that possibly fixes coalescing of URNs and datetimes with
      other types transparently handled by SQLite. Eg. this broke the
      "tracker search" CLI subcommand, where it uses:
        SELECT COALESCE(nie:url(?u), ?u) ...
      This resulted in "tracker search foo" returning "(null)" as the
      file uri/urn.
      We must translate each Expression to string so that correctly results
      in the URL string being coalesced with the URN string. This is the
      expected result, and a regression compared to the older parser.
    • Carlos Garnacho's avatar
      libtracker-data: Convert arguments to string in string functions · fc16c98e
      Carlos Garnacho authored
      This results in eg. URN strings or ISO8601 dates being passed to
      those if used in one such function, instead of ROWIDs or timestamps.
      It's unclear how that should behave as per the spec, this is however
      what the old parser did, so better to stick to the same implementation
      defined behavior.
    • Carlos Garnacho's avatar
      libtracker-data: Add builtin way to convert a Expression to a string · 9d99c8a4
      Carlos Garnacho authored
      The Expression element may be used in several places (eg. ArgList or
      ExpressionList in functions) that may require them to be converted
      to string, add a builtin toggle in the state so this can ben done
    • Carlos Garnacho's avatar
      libtracker-data: Do not force cursor column types to be strings · 3588ac64
      Carlos Garnacho authored
      We must propagate the original types, despite converting the
      resultset to string in the topmost select. Fixes warnings in the
      bus backend (seen with several flatpak apps), since it's not as
      lenient as the direct one wrt fetching values with the "wrong"
    • Carlos Garnacho's avatar
      libtracker-bus: Make error clearer · f81c4cd0
      Carlos Garnacho authored
      The data != null check in get_string() really happens because of
      fetching values on a finished or not yet started cursor, so make
      it clearer to reason about.
      This is of course a programming error.
    • Carlos Garnacho's avatar
      libtracker-bus: Make cursor conform to API docs · a0f4c09c
      Carlos Garnacho authored
      It says "NULL is returned if column is not between [0,n_columns]",
      says nothing about it being a programming error though.
  13. 15 Nov, 2018 2 commits
  14. 13 Nov, 2018 3 commits