| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This prefix is used in some of our base SPARQL API (e.g. fts:match
and the misc functions to deal with results), but the prefix is
currently defined in the Nepomuk ontology side.
This makes applications that want to use FTS with custom ontologies
either need to declare the prefix themselves, or help queries with
`PREFIX` syntax to add the missing stock prefix.
Move this prefix definition to the base ontology, so all databases
inherit the builtin fts: prefix and it can be used right away in
FTS queries.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The 0x20 character should also be escaped as per the SPARQL reference,
and it correctly is when setting a TrackerResource IRI. Even though,
the fast path check for the presence of characters that should be
escaped is missing it, so it would be possible to let IRIs that only
have this invalid character as valid.
Since 0x20 (whitespace) is possibly the most ubiquitous character that
should be escaped, it's a bit of an oversight.
Fixes: 33031007c ("libtracker-sparql: Escape illegal characters in IRIREF...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, all IRIREF going through SPARQL updates will be validated for the
characters being in the expected set (https://www.w3.org/TR/sparql11-query/#rIRIREF),
meanwhile TrackerResource is pretty liberal in the characters used by a
TrackerResource identifier or IRI reference.
This disagreement causes has 2 possible outcomes:
- If the resource is inserted via print_sparql_update(), print_rdf() or alike while
containing illegal characters, it will find errors when handling the SPARQL update.
- If the resource is directly inserted via TrackerBatch or update_resource(), the
validation step will be bypassed, ending up with an IRI that contains illegal
characters as per the SPARQL grammar.
In order to make TrackerResource friendly to e.g. sloppy IRI composition and avoid
these ugly situations when an illegal char sneaks in, make it escape the IRIs as
defined by IRIREF in the SPARQL grammar definition. This way every method of insertion
will succeed and be most correct with the given input.
Also, add tests for this behavior, to ensure we escape what should be escaped.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, our caching of triples does have a number of nested structures:
- In the buffer there is a struct for each graph
- In the graph struct there is a set of changed resource
- In the resource struct there is a set of modified tables
- In the table struct there is a set of modified properties
- In the property struct there is a list of values
This incurs in a maintenance cost that is higher than desired, adding and
removing elements here becomes a fair chunk of the time spent in updates,
since there is a number of allocations and list/hashtable updates
performed for batches that deal with a fair amount of different resources
(i.e. most of them).
In order to improve this, keep use two arrays to buffer this data:
- A "properties" array, that keeps individual predicate/object pairs. This
is used to store the values of properties being inserted or deleted for
single-valued and multivalued properties. This struct is "linked" with
(i.e. references) other elements in the array, so that e.g. class updates
may reference multiple properties/values being updated.
- An "update log" array, containing structs that are a event_type/graph/
subject tuple, plus optionally a link to one of the properties in the
previous array, all other properties are fetched through iterating through
the linked properties. These log entries are valid for class table updates
(i.e. single-valued properties) or multi-valued property tables.
These arrays make allocating the buffer a one-time operation (buffer size
is fixed, and the arrays are reused during the processing of a TrackerBatch)
and insertions into the log largely O(1) as opposed to a number of
array/hashtable lookups and inserts.
But we still want to coalesce updates to a same class table (e.g. changes to
several single-valued properties in the same table), for that there is an
additional hashtable set that uses these log entries as keys themselves,
with special hash/equal functions, lookups for prior events modifying the
same TrackerClass is also quite fast.
Overall, this makes the maintenance of this buffer less expensive in the
big picture. Even though there are still some remnants of the previous
caching for graphs and resources, this plays less of a role.
Since this changes the ordering of updates, some tests that rely on implicit
ordering (DESCRIBE ones) had to be adapted for this change.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For nrl:modified, we had some double handling since the modifier was
pushed as a property change, but also dealt with directly when flushing
the buffer.
Since these are essentially properties (even though changed automatically),
it makes sense to stick to the former, also for nrl:added. Do that, and
drop the special handling of these 2 properties when flushing the buffer.
This commit also changes the expected output of a serialization test,
since nrl:added is added now on more graphs than the first one that sees
a resource, this slightly changes the spacing after filtering the test
filters nrl:added/nrl:modified.
|
|
|
|
|
|
| |
When checking a function with a return value and a GError out argument,
it often gives better clues to check the error first, then the return
value.
|
|
|
|
|
|
|
|
|
| |
The order of the returned resultset was implicit and up to SQLite, but
the order for this test started changing starting with SQLite 3.39.0.
Make the order explicit, so that SQLite implementation details don't
leak up here.
Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/370
|
|
|
|
|
|
| |
These tests take some RDF, deserialize into a local connection,
serialize it again, and deserializes it into a dbus connection.
Then queries are run on both connections to verify data matches.
|
|
|
|
|
| |
We already wrap this with a prefix that adds location/line/col, so this
is inconsistently duplicated info.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This test is currently ineffective (finds an error handling a duplicate
@prefix, but the test doesn't quite catch it or test anything worthwhile),
and it will actually break with the changes to come (arguably for the
better, since the error is actually propagated).
Comment out this test so far, we do need to handle @prefix possibly
overwriting a previous value, and we need to test this behavior properly.
Avoid making deserializers depend on this just because error propagation
was fixed in this place. This will be improved in the future.
|
|\
| |
| |
| |
| |
| |
| | |
libtracker-sparql: Fix handling of partial FTS deletion
Closes #361
See merge request GNOME/tracker!510
|
| |
| |
| |
| | |
Test paths fixed by the previous commits.
|
|\ \
| | |
| | |
| | |
| | | |
Implement TrackerNamespaceManager for remote connections
See merge request GNOME/tracker!508
|
| |/
| |
| |
| |
| |
| | |
Ensure all namespaces that can be obtained through public API
(the deprecated default, but also for each type of SPARQL connection)
contains everything that is expected.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have 2 behaviors to test here, the default non-standard behavior
that treats blank nodes as the equivalent of a lazy IRI generator,
and the spec-compliant behavior that was made possible through the
TRACKER_SPARQL_CONNECTION_FLAGS_ANONYMOUS_BNODES in 3.3.x.
In the former, we expect the engine to treat blank nodes like IRIs
when passed as literals, e.g.:
SELECT (<urn:bnode:...> AS ?u) { }
SELECT ?p ?o { <urn:bnode:...> ?p ?o }
should identify the correct resource from the blank node name
and return data around it, making it effectively identifiable.
In the latter, blank nodes are tightly scoped to the result set,
a blank node existing in a result set just means something exists
that matches the graph patter, but it cannot be kept and poked
around in future queries like the above.
Add tests to ensure that both behaviors are gotten right.
|
|
|
|
|
| |
Test for tracker_sparql_cursor_get_connection() returning the right
thing on cursor and statement tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no exposed mechanism to decide what cursor format do
an endpoint/cursor negotiate between themselves, as a result
we are currently only testing the JSON cursor format.
Add a test-only environment variable so that TrackerEndpointHttp
prefers a given TrackerSerializerFormat, and run cursor tests
twice to ensure we test all cursor paths on HTTP connections.
This additionally also exercises the XML serializer on the HTTP
endpoint side.
|
|
|
|
|
|
| |
The original bug was a sigpipe in the dbus connection, but this
now simply tests that cursors can be closed before all results
are read.
|
|
|
|
|
|
| |
In some cursor tests we compare the output of specific connections
with the output of a direct connection. Poke harder around both
cursors looking exactly the same.
|
|
|
|
|
| |
Run the cursor tests on all of direct/bus/http connections, in
order to ensure consistent behavior across all connection types.
|
|
|
|
|
| |
We do not want these variables static, as we want to spawn tests
several times, and want to avoid each run to affect the next.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, the behavior of tracker_sparql_cursor_get*() over an already
finished cursor is inconsistent. All return NULL, but some trigger a
warning and some don't.
Since we want to run these tests on all connections, at the moment
drop this test that asserted for failures/warnings. We might want to
find a consistent behavior and test for it, and if it turns out to
involve runtime warnings, it is best to use g_test_expect_message()
than subprocesses.
|
|
|
|
|
| |
Separate g_test_add() calls to a separate function, so that we
can test different connections and cursors in future commits.
|
|
|
|
|
|
|
| |
At tests/libtracker-sparql there is a few scattered tests that check
for high-level cursor behavior. We'll want to run those for all
connection types, and cursor formats. So far separate them all to
a distinct test executable so they can be refactored together.
|
|
|
|
| |
These may lead to FD leaks and other misbehaviors.
|
|
|
|
| |
Abandon the static library name for these tests.
|
|
|
|
|
|
|
|
|
| |
These tests poke at libtracker-data internals that have a 1:1 mapping
on the high-level API, we can use that and avoid relying on internal
API.
This is accessory now, but libtracker-data will stop being a static
library during build.
|
|
|
|
|
|
| |
This does not refer to static libraries anymore, generalize the
testsuite name. While at it, drop the unnecessary libtracker-data
dependency.
|
|
|
|
| |
This was only used by its own test.
|
| |
|
|
|
|
|
| |
Ensure these are parsed correctly, and are able to contain quotes
of the same nature.
|
|
|
|
|
|
| |
echo -n is not portable and most notably it is not implemented by the
bultin echo in the old version of bash used to implement /bin/sh on
macOS. Use printf to supprtess the newline character.
|
|
|
|
| |
Add tests for column names, and value types.
|
|
|
|
|
| |
Test all corners in graph lookups, and whether visibility changes
accordingly with graph modifications.
|
| |
|
| |
|