@girs/tracker-3.0 3.0.0-3.1.0 → 3.6.0-3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +6 -12
- package/tracker-3.0.d.cts +1154 -510
- package/tracker-3.0.d.ts +1154 -510
- package/{tsconfig.doc.json → tsconfig.json} +2 -0
- package/typedoc.json +7 -0
package/tracker-3.0.d.ts
CHANGED
|
@@ -19,13 +19,13 @@ import type GLib from '@girs/glib-2.0';
|
|
|
19
19
|
export namespace Tracker {
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Flags affecting deserialization
|
|
22
|
+
* Flags affecting deserialization from a RDF data format.
|
|
23
23
|
*/
|
|
24
24
|
enum DeserializeFlags {
|
|
25
25
|
/**
|
|
26
26
|
* No flags.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
NONE,
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Notifier event types.
|
|
@@ -69,12 +69,18 @@ enum RdfFormat {
|
|
|
69
69
|
*/
|
|
70
70
|
LAST,
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Flags affecting serialization into a RDF data format.
|
|
74
|
+
*/
|
|
72
75
|
enum SerializeFlags {
|
|
73
|
-
|
|
76
|
+
/**
|
|
77
|
+
* No flags.
|
|
78
|
+
*/
|
|
79
|
+
NONE,
|
|
74
80
|
}
|
|
75
81
|
/**
|
|
76
82
|
* Error domain for Tracker Sparql. Errors in this domain will be from the
|
|
77
|
-
*
|
|
83
|
+
* [error`Tracker`.SparqlError] enumeration. See [struct`GLib`.Error] for more information on error
|
|
78
84
|
* domains.
|
|
79
85
|
*/
|
|
80
86
|
enum SparqlError {
|
|
@@ -204,7 +210,7 @@ enum SparqlConnectionFlags {
|
|
|
204
210
|
*/
|
|
205
211
|
FTS_ENABLE_UNACCENT,
|
|
206
212
|
/**
|
|
207
|
-
* FTS Search terms are filtered through a stop word list.
|
|
213
|
+
* FTS Search terms are filtered through a stop word list. This flag is deprecated since Tracker 3.6, and will do nothing.
|
|
208
214
|
*/
|
|
209
215
|
FTS_ENABLE_STOP_WORDS,
|
|
210
216
|
/**
|
|
@@ -217,6 +223,24 @@ enum SparqlConnectionFlags {
|
|
|
217
223
|
*/
|
|
218
224
|
ANONYMOUS_BNODES,
|
|
219
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* The major version of the Tracker library.
|
|
228
|
+
*
|
|
229
|
+
* Like #tracker_major_version, but intended to be used at application compile time.
|
|
230
|
+
*/
|
|
231
|
+
const MAJOR_VERSION: number
|
|
232
|
+
/**
|
|
233
|
+
* The micro version of the Tracker library.
|
|
234
|
+
*
|
|
235
|
+
* Like #tracker_micro_version, but intended to be used at application compile time.
|
|
236
|
+
*/
|
|
237
|
+
const MICRO_VERSION: number
|
|
238
|
+
/**
|
|
239
|
+
* The minor version of the Tracker library.
|
|
240
|
+
*
|
|
241
|
+
* Like #tracker_minor_version, but intended to be used at application compile time.
|
|
242
|
+
*/
|
|
243
|
+
const MINOR_VERSION: number
|
|
220
244
|
/**
|
|
221
245
|
* The Prefix of the DC (Dublin Core) namespace
|
|
222
246
|
*/
|
|
@@ -274,9 +298,10 @@ const PREFIX_TRACKER: string | null
|
|
|
274
298
|
*/
|
|
275
299
|
const PREFIX_XSD: string | null
|
|
276
300
|
/**
|
|
277
|
-
* Checks that the Tracker library in use is compatible with the
|
|
278
|
-
*
|
|
279
|
-
*
|
|
301
|
+
* Checks that the Tracker library in use is compatible with the given version.
|
|
302
|
+
*
|
|
303
|
+
* Generally you would pass in the constants
|
|
304
|
+
* [const`Tracker`.MAJOR_VERSION], [const`Tracker`.MINOR_VERSION], [const`Tracker`.MICRO_VERSION]
|
|
280
305
|
* as the three arguments to this function; that produces
|
|
281
306
|
* a check that the library in use is compatible with
|
|
282
307
|
* the version of Tracker the application or module was compiled
|
|
@@ -284,31 +309,32 @@ const PREFIX_XSD: string | null
|
|
|
284
309
|
*
|
|
285
310
|
* Compatibility is defined by two things: first the version
|
|
286
311
|
* of the running library is newer than the version
|
|
287
|
-
* `required_major
|
|
312
|
+
* `required_major`.`required_minor`.`required_micro`. Second
|
|
288
313
|
* the running library must be binary compatible with the
|
|
289
|
-
* version `required_major
|
|
314
|
+
* version `required_major`.`required_minor`.`required_micro`
|
|
290
315
|
* (same major version.)
|
|
291
316
|
* @param required_major the required major version.
|
|
292
317
|
* @param required_minor the required minor version.
|
|
293
318
|
* @param required_micro the required micro version.
|
|
294
|
-
* @returns %NULL if the Tracker library is compatible with the given version, or a string describing the version mismatch.
|
|
319
|
+
* @returns %NULL if the Tracker library is compatible with the given version, or a string describing the version mismatch.
|
|
295
320
|
*/
|
|
296
321
|
function check_version(required_major: number, required_minor: number, required_micro: number): string | null
|
|
297
322
|
function sparql_error_quark(): GLib.Quark
|
|
298
323
|
/**
|
|
299
324
|
* Escapes `literal` so it is suitable for insertion in
|
|
300
|
-
* SPARQL queries as string literals.
|
|
301
|
-
*
|
|
302
|
-
*
|
|
325
|
+
* SPARQL queries as string literals.
|
|
326
|
+
*
|
|
327
|
+
* Manual construction of query strings based user input is best
|
|
328
|
+
* avoided at all cost, use of #TrackerSparqlStatement is recommended
|
|
303
329
|
* instead.
|
|
304
330
|
* @param literal a string to escape
|
|
305
331
|
* @returns the escaped string
|
|
306
332
|
*/
|
|
307
333
|
function sparql_escape_string(literal: string | null): string | null
|
|
308
334
|
/**
|
|
309
|
-
*
|
|
335
|
+
* Escapes a string for use as a URI.
|
|
310
336
|
* @param uri a string to be escaped, following the tracker sparql rules
|
|
311
|
-
* @returns a newly-allocated string holding the result.
|
|
337
|
+
* @returns a newly-allocated string holding the result.
|
|
312
338
|
*/
|
|
313
339
|
function sparql_escape_uri(uri: string | null): string | null
|
|
314
340
|
/**
|
|
@@ -330,7 +356,7 @@ module Batch {
|
|
|
330
356
|
// Own constructor properties of Tracker-3.0.Tracker.Batch
|
|
331
357
|
|
|
332
358
|
/**
|
|
333
|
-
* The
|
|
359
|
+
* The [class`Tracker`.SparqlConnection] the batch belongs to.
|
|
334
360
|
*/
|
|
335
361
|
connection?: SparqlConnection | null
|
|
336
362
|
}
|
|
@@ -342,7 +368,7 @@ interface Batch {
|
|
|
342
368
|
// Own properties of Tracker-3.0.Tracker.Batch
|
|
343
369
|
|
|
344
370
|
/**
|
|
345
|
-
* The
|
|
371
|
+
* The [class`Tracker`.SparqlConnection] the batch belongs to.
|
|
346
372
|
*/
|
|
347
373
|
readonly connection: SparqlConnection
|
|
348
374
|
|
|
@@ -352,28 +378,42 @@ interface Batch {
|
|
|
352
378
|
|
|
353
379
|
// Owm methods of Tracker-3.0.Tracker.Batch
|
|
354
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Inserts the RDF data contained in `stream` as part of `batch`.
|
|
383
|
+
*
|
|
384
|
+
* The RDF data will be inserted in the given `default_graph` if one is provided,
|
|
385
|
+
* or the anonymous graph if `default_graph` is %NULL. Any RDF data that has a
|
|
386
|
+
* graph specified (e.g. using the `GRAPH` clause in the Trig format) will
|
|
387
|
+
* be inserted in the specified graph instead of `default_graph`.
|
|
388
|
+
*
|
|
389
|
+
* The `flags` argument is reserved for future expansions, currently
|
|
390
|
+
* %TRACKER_DESERIALIZE_FLAGS_NONE must be passed.
|
|
391
|
+
* @param flags Deserialization flags
|
|
392
|
+
* @param format RDF format of data in stream
|
|
393
|
+
* @param default_graph Default graph that will receive the RDF data
|
|
394
|
+
* @param stream Input stream with RDF data
|
|
395
|
+
*/
|
|
396
|
+
add_rdf(flags: DeserializeFlags, format: RdfFormat, default_graph: string | null, stream: Gio.InputStream): void
|
|
355
397
|
/**
|
|
356
398
|
* Adds the RDF represented by `resource` to `batch`.
|
|
357
399
|
* @param graph RDF graph to insert the resource to
|
|
358
|
-
* @param resource
|
|
400
|
+
* @param resource A [class`Tracker`.Resource]
|
|
359
401
|
*/
|
|
360
402
|
add_resource(graph: string | null, resource: Resource): void
|
|
361
403
|
/**
|
|
362
404
|
* Adds an SPARQL update string to `batch`.
|
|
363
|
-
* @param sparql
|
|
405
|
+
* @param sparql A SPARQL update string
|
|
364
406
|
*/
|
|
365
407
|
add_sparql(sparql: string | null): void
|
|
366
408
|
/**
|
|
367
|
-
* Adds a
|
|
409
|
+
* Adds a [class`Tracker`.SparqlStatement] containing an SPARQL update. The statement will
|
|
368
410
|
* be executed once in the batch, with the values bound as specified by `variable_names`
|
|
369
411
|
* and `values`.
|
|
370
412
|
*
|
|
371
413
|
* For example, for a statement that has a single `~name` parameter,
|
|
372
414
|
* it could be given a value for execution with the given code:
|
|
373
415
|
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
* ```
|
|
416
|
+
* ```c
|
|
377
417
|
* const char *names = { "name" };
|
|
378
418
|
* const GValue values[G_N_ELEMENTS (names)] = { 0, };
|
|
379
419
|
*
|
|
@@ -383,45 +423,36 @@ interface Batch {
|
|
|
383
423
|
* G_N_ELEMENTS (names),
|
|
384
424
|
* names, values);
|
|
385
425
|
* ```
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
* <div class="gi-lang-python"><pre><code class="language-python">
|
|
389
|
-
*
|
|
390
|
-
* ```
|
|
426
|
+
* ```python
|
|
391
427
|
* batch.add_statement(stmt, ['name'], ['John Smith']);
|
|
392
428
|
* ```
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
* <div class="gi-lang-javascript"><pre><code class="language-javascript">
|
|
396
|
-
*
|
|
397
|
-
* ```
|
|
429
|
+
* ```js
|
|
398
430
|
* batch.add_statement(stmt, ['name'], ['John Smith']);
|
|
399
431
|
* ```
|
|
400
|
-
* </code></pre></div>
|
|
401
432
|
*
|
|
402
|
-
*
|
|
403
|
-
* calls with the same or different values, on the same or different
|
|
433
|
+
* A [class`Tracker`.SparqlStatement] may be used on multiple [method`Tracker`.Batch.add_statement]
|
|
434
|
+
* calls with the same or different values, on the same or different `TrackerBatch`
|
|
404
435
|
* objects.
|
|
405
436
|
*
|
|
406
|
-
* This function should only be called on
|
|
407
|
-
* obtained through
|
|
408
|
-
* update statements loaded through
|
|
409
|
-
* @param stmt
|
|
410
|
-
* @param variable_names
|
|
411
|
-
* @param values
|
|
437
|
+
* This function should only be called on [class`Tracker`.SparqlStatement] objects
|
|
438
|
+
* obtained through [method`Tracker`.SparqlConnection.update_statement] or
|
|
439
|
+
* update statements loaded through [method`Tracker`.SparqlConnection.load_statement_from_gresource].
|
|
440
|
+
* @param stmt A [class`Tracker`.SparqlStatement] containing a SPARQL update
|
|
441
|
+
* @param variable_names The names of each bound parameter
|
|
442
|
+
* @param values The values of each bound parameter
|
|
412
443
|
*/
|
|
413
444
|
add_statement(stmt: SparqlStatement, variable_names: string[], values: any[]): void
|
|
414
445
|
/**
|
|
415
446
|
* Executes the batch. This operations happens synchronously.
|
|
416
|
-
* @param cancellable
|
|
447
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
417
448
|
* @returns %TRUE of there were no errors, %FALSE otherwise
|
|
418
449
|
*/
|
|
419
450
|
execute(cancellable: Gio.Cancellable | null): boolean
|
|
420
451
|
/**
|
|
421
452
|
* Executes the batch. This operation happens asynchronously, when
|
|
422
453
|
* finished `callback` will be executed.
|
|
423
|
-
* @param cancellable
|
|
424
|
-
* @param callback
|
|
454
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
455
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
425
456
|
*/
|
|
426
457
|
execute_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
427
458
|
|
|
@@ -432,18 +463,19 @@ interface Batch {
|
|
|
432
463
|
*
|
|
433
464
|
* Executes the batch. This operation happens asynchronously, when
|
|
434
465
|
* finished `callback` will be executed.
|
|
435
|
-
* @param cancellable
|
|
466
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
436
467
|
* @returns A Promise of: %TRUE of there were no errors, %FALSE otherwise
|
|
437
468
|
*/
|
|
438
469
|
execute_async(cancellable: Gio.Cancellable | null): globalThis.Promise<boolean>
|
|
439
470
|
/**
|
|
440
|
-
* Finishes the operation started with
|
|
441
|
-
* @param res
|
|
471
|
+
* Finishes the operation started with [method`Tracker`.Batch.execute_async].
|
|
472
|
+
* @param res A [type`Gio`.AsyncResult] with the result of the operation
|
|
442
473
|
* @returns %TRUE of there were no errors, %FALSE otherwise
|
|
443
474
|
*/
|
|
444
475
|
execute_finish(res: Gio.AsyncResult): boolean
|
|
445
476
|
/**
|
|
446
|
-
* Returns the
|
|
477
|
+
* Returns the [class`Tracker`.SparqlConnection] that this batch was created
|
|
478
|
+
* from.
|
|
447
479
|
* @returns The SPARQL connection of this batch.
|
|
448
480
|
*/
|
|
449
481
|
get_connection(): SparqlConnection
|
|
@@ -459,6 +491,26 @@ interface Batch {
|
|
|
459
491
|
disconnect(id: number): void
|
|
460
492
|
}
|
|
461
493
|
|
|
494
|
+
/**
|
|
495
|
+
* `TrackerBatch` executes a series of SPARQL updates and RDF data
|
|
496
|
+
* insertions within a transaction.
|
|
497
|
+
*
|
|
498
|
+
* A batch is created with [method`Tracker`.SparqlConnection.create_batch].
|
|
499
|
+
* To add resources use [method`Tracker`.Batch.add_resource],
|
|
500
|
+
* [method`Tracker`.Batch.add_sparql] or [method`Batch`.add_statement].
|
|
501
|
+
*
|
|
502
|
+
* When a batch is ready for execution, use [method`Tracker`.Batch.execute]
|
|
503
|
+
* or [method`Tracker`.Batch.execute_async]. The batch is executed as a single
|
|
504
|
+
* transaction, it will succeed or fail entirely.
|
|
505
|
+
*
|
|
506
|
+
* This object has a single use, after the batch is executed it can
|
|
507
|
+
* only be finished and freed.
|
|
508
|
+
*
|
|
509
|
+
* The mapping of blank node labels is global in a `TrackerBatch`,
|
|
510
|
+
* referencing the same blank node label in different operations in
|
|
511
|
+
* a batch will resolve to the same resource.
|
|
512
|
+
* @class
|
|
513
|
+
*/
|
|
462
514
|
class Batch extends GObject.Object {
|
|
463
515
|
|
|
464
516
|
// Own properties of Tracker-3.0.Tracker.Batch
|
|
@@ -480,6 +532,9 @@ module Endpoint {
|
|
|
480
532
|
|
|
481
533
|
// Own constructor properties of Tracker-3.0.Tracker.Endpoint
|
|
482
534
|
|
|
535
|
+
/**
|
|
536
|
+
* The [class`Tracker`.SparqlConnection] being proxied by this endpoint.
|
|
537
|
+
*/
|
|
483
538
|
sparql_connection?: SparqlConnection | null
|
|
484
539
|
}
|
|
485
540
|
|
|
@@ -489,6 +544,9 @@ interface Endpoint {
|
|
|
489
544
|
|
|
490
545
|
// Own properties of Tracker-3.0.Tracker.Endpoint
|
|
491
546
|
|
|
547
|
+
/**
|
|
548
|
+
* The [class`Tracker`.SparqlConnection] being proxied by this endpoint.
|
|
549
|
+
*/
|
|
492
550
|
readonly sparql_connection: SparqlConnection
|
|
493
551
|
|
|
494
552
|
// Own fields of Tracker-3.0.Tracker.Endpoint
|
|
@@ -498,7 +556,8 @@ interface Endpoint {
|
|
|
498
556
|
// Owm methods of Tracker-3.0.Tracker.Endpoint
|
|
499
557
|
|
|
500
558
|
/**
|
|
501
|
-
* Returns the
|
|
559
|
+
* Returns the [class`Tracker`.SparqlConnection] that this endpoint proxies
|
|
560
|
+
* to a wider audience.
|
|
502
561
|
* @returns The proxied SPARQL connection
|
|
503
562
|
*/
|
|
504
563
|
get_sparql_connection(): SparqlConnection
|
|
@@ -515,8 +574,19 @@ interface Endpoint {
|
|
|
515
574
|
}
|
|
516
575
|
|
|
517
576
|
/**
|
|
518
|
-
*
|
|
519
|
-
*
|
|
577
|
+
* `TrackerEndpoint` is a helper object to make RDF triple stores represented
|
|
578
|
+
* by a [class`Tracker`.SparqlConnection] publicly available to other processes/hosts.
|
|
579
|
+
*
|
|
580
|
+
* This is a base abstract object, see [class`Tracker`.EndpointDBus] to make
|
|
581
|
+
* RDF triple stores available to other processes in the same machine, and
|
|
582
|
+
* [class`Tracker`.EndpointHttp] to make it available to other hosts in the
|
|
583
|
+
* network.
|
|
584
|
+
*
|
|
585
|
+
* When the RDF triple store represented by a [class`Tracker`.SparqlConnection]
|
|
586
|
+
* is made public this way, other peers may connect to the database using
|
|
587
|
+
* [ctor`Tracker`.SparqlConnection.bus_new] or [ctor`Tracker`.SparqlConnection.remote_new]
|
|
588
|
+
* to access this endpoint exclusively, or they may use the `SERVICE <uri> { ... }` SPARQL
|
|
589
|
+
* syntax from their own [class`Tracker`.SparqlConnection]s to expand their data set.
|
|
520
590
|
* @class
|
|
521
591
|
*/
|
|
522
592
|
class Endpoint extends GObject.Object {
|
|
@@ -540,7 +610,13 @@ module EndpointDBus {
|
|
|
540
610
|
|
|
541
611
|
// Own constructor properties of Tracker-3.0.Tracker.EndpointDBus
|
|
542
612
|
|
|
613
|
+
/**
|
|
614
|
+
* The [class`Gio`.DBusConnection] where the connection is proxied through.
|
|
615
|
+
*/
|
|
543
616
|
dbus_connection?: Gio.DBusConnection | null
|
|
617
|
+
/**
|
|
618
|
+
* The DBus object path that this endpoint manages.
|
|
619
|
+
*/
|
|
544
620
|
object_path?: string | null
|
|
545
621
|
}
|
|
546
622
|
|
|
@@ -550,7 +626,13 @@ interface EndpointDBus extends Gio.Initable {
|
|
|
550
626
|
|
|
551
627
|
// Own properties of Tracker-3.0.Tracker.EndpointDBus
|
|
552
628
|
|
|
629
|
+
/**
|
|
630
|
+
* The [class`Gio`.DBusConnection] where the connection is proxied through.
|
|
631
|
+
*/
|
|
553
632
|
readonly dbus_connection: Gio.DBusConnection
|
|
633
|
+
/**
|
|
634
|
+
* The DBus object path that this endpoint manages.
|
|
635
|
+
*/
|
|
554
636
|
readonly object_path: string | null
|
|
555
637
|
|
|
556
638
|
// Class property signals of Tracker-3.0.Tracker.EndpointDBus
|
|
@@ -571,8 +653,40 @@ interface EndpointDBus extends Gio.Initable {
|
|
|
571
653
|
}
|
|
572
654
|
|
|
573
655
|
/**
|
|
574
|
-
*
|
|
575
|
-
*
|
|
656
|
+
* `TrackerEndpointDBus` makes the RDF data in a [class`Tracker`.SparqlConnection]
|
|
657
|
+
* accessible to other processes via DBus.
|
|
658
|
+
*
|
|
659
|
+
* This object is a [class`Tracker`.Endpoint] subclass that exports
|
|
660
|
+
* a [class`Tracker`.SparqlConnection] so its RDF data is accessible to other
|
|
661
|
+
* processes through the given [class`Gio`.DBusConnection].
|
|
662
|
+
*
|
|
663
|
+
* ```c
|
|
664
|
+
* // This process already has org.example.Endpoint bus name
|
|
665
|
+
* endpoint = tracker_endpoint_dbus_new (sparql_connection,
|
|
666
|
+
* dbus_connection,
|
|
667
|
+
* NULL,
|
|
668
|
+
* NULL,
|
|
669
|
+
* &error);
|
|
670
|
+
*
|
|
671
|
+
* // From another process
|
|
672
|
+
* connection = tracker_sparql_connection_bus_new ("org.example.Endpoint",
|
|
673
|
+
* NULL,
|
|
674
|
+
* dbus_connection,
|
|
675
|
+
* &error);
|
|
676
|
+
* ```
|
|
677
|
+
*
|
|
678
|
+
* The `TrackerEndpointDBus` will manage a DBus object at the given path
|
|
679
|
+
* with the `org.freedesktop.Tracker3.Endpoint` interface, if no path is
|
|
680
|
+
* given the object will be at the default `/org/freedesktop/Tracker3/Endpoint`
|
|
681
|
+
* location.
|
|
682
|
+
*
|
|
683
|
+
* Access to these endpoints may be transparently managed through
|
|
684
|
+
* the Tracker portal service for applications sandboxed via Flatpak, and
|
|
685
|
+
* access to data constrained to the graphs defined in the applications
|
|
686
|
+
* manifest.
|
|
687
|
+
*
|
|
688
|
+
* A `TrackerEndpointDBus` may be created on a different thread/main
|
|
689
|
+
* context from the one that created [class`Tracker`.SparqlConnection].
|
|
576
690
|
* @class
|
|
577
691
|
*/
|
|
578
692
|
class EndpointDBus extends Endpoint {
|
|
@@ -587,24 +701,24 @@ class EndpointDBus extends Endpoint {
|
|
|
587
701
|
constructor(config?: EndpointDBus.ConstructorProperties)
|
|
588
702
|
/**
|
|
589
703
|
* Registers a Tracker endpoint object at `object_path` on `dbus_connection`.
|
|
590
|
-
* The default object path is
|
|
704
|
+
* The default object path is `/org/freedesktop/Tracker3/Endpoint`.
|
|
591
705
|
* @constructor
|
|
592
|
-
* @param sparql_connection
|
|
593
|
-
* @param dbus_connection
|
|
594
|
-
* @param object_path
|
|
595
|
-
* @param cancellable
|
|
596
|
-
* @returns a
|
|
706
|
+
* @param sparql_connection The [class`Tracker`.SparqlConnection] being made public
|
|
707
|
+
* @param dbus_connection #GDBusConnection to expose the DBus object over
|
|
708
|
+
* @param object_path The object path to use, or %NULL to use the default
|
|
709
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
710
|
+
* @returns a `TrackerEndpointDBus` object.
|
|
597
711
|
*/
|
|
598
712
|
constructor(sparql_connection: SparqlConnection, dbus_connection: Gio.DBusConnection, object_path: string | null, cancellable: Gio.Cancellable | null)
|
|
599
713
|
/**
|
|
600
714
|
* Registers a Tracker endpoint object at `object_path` on `dbus_connection`.
|
|
601
|
-
* The default object path is
|
|
715
|
+
* The default object path is `/org/freedesktop/Tracker3/Endpoint`.
|
|
602
716
|
* @constructor
|
|
603
|
-
* @param sparql_connection
|
|
604
|
-
* @param dbus_connection
|
|
605
|
-
* @param object_path
|
|
606
|
-
* @param cancellable
|
|
607
|
-
* @returns a
|
|
717
|
+
* @param sparql_connection The [class`Tracker`.SparqlConnection] being made public
|
|
718
|
+
* @param dbus_connection #GDBusConnection to expose the DBus object over
|
|
719
|
+
* @param object_path The object path to use, or %NULL to use the default
|
|
720
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
721
|
+
* @returns a `TrackerEndpointDBus` object.
|
|
608
722
|
*/
|
|
609
723
|
static new(sparql_connection: SparqlConnection, dbus_connection: Gio.DBusConnection, object_path: string | null, cancellable: Gio.Cancellable | null): EndpointDBus
|
|
610
724
|
_init(config?: EndpointDBus.ConstructorProperties): void
|
|
@@ -628,7 +742,13 @@ module EndpointHttp {
|
|
|
628
742
|
|
|
629
743
|
// Own constructor properties of Tracker-3.0.Tracker.EndpointHttp
|
|
630
744
|
|
|
745
|
+
/**
|
|
746
|
+
* [class`Gio`.TlsCertificate] to encrypt the communication.
|
|
747
|
+
*/
|
|
631
748
|
http_certificate?: Gio.TlsCertificate | null
|
|
749
|
+
/**
|
|
750
|
+
* HTTP port used to listen requests.
|
|
751
|
+
*/
|
|
632
752
|
http_port?: number | null
|
|
633
753
|
}
|
|
634
754
|
|
|
@@ -638,7 +758,13 @@ interface EndpointHttp extends Gio.Initable {
|
|
|
638
758
|
|
|
639
759
|
// Own properties of Tracker-3.0.Tracker.EndpointHttp
|
|
640
760
|
|
|
761
|
+
/**
|
|
762
|
+
* [class`Gio`.TlsCertificate] to encrypt the communication.
|
|
763
|
+
*/
|
|
641
764
|
readonly http_certificate: Gio.TlsCertificate
|
|
765
|
+
/**
|
|
766
|
+
* HTTP port used to listen requests.
|
|
767
|
+
*/
|
|
642
768
|
readonly http_port: number
|
|
643
769
|
|
|
644
770
|
// Own signals of Tracker-3.0.Tracker.EndpointHttp
|
|
@@ -665,8 +791,45 @@ interface EndpointHttp extends Gio.Initable {
|
|
|
665
791
|
}
|
|
666
792
|
|
|
667
793
|
/**
|
|
668
|
-
*
|
|
669
|
-
*
|
|
794
|
+
* `TrackerEndpointHttp` makes the RDF data in a [class`Tracker`.SparqlConnection]
|
|
795
|
+
* accessible to other hosts via HTTP.
|
|
796
|
+
*
|
|
797
|
+
* This object is a [class`Tracker`.Endpoint] subclass that exports
|
|
798
|
+
* a [class`Tracker`.SparqlConnection] so its RDF data is accessible via HTTP
|
|
799
|
+
* requests on the given port. This endpoint implementation is compliant
|
|
800
|
+
* with the [SPARQL protocol specifications](https://www.w3.org/TR/2013/REC-sparql11-protocol-20130321/)
|
|
801
|
+
* and may interoperate with other implementations.
|
|
802
|
+
*
|
|
803
|
+
* ```c
|
|
804
|
+
* // This host has "example.local" hostname
|
|
805
|
+
* endpoint = tracker_endpoint_http_new (sparql_connection,
|
|
806
|
+
* 8080,
|
|
807
|
+
* tls_certificate,
|
|
808
|
+
* NULL,
|
|
809
|
+
* &error);
|
|
810
|
+
*
|
|
811
|
+
* // From another host
|
|
812
|
+
* connection = tracker_sparql_connection_remote_new ("http://example.local:8080/sparql");
|
|
813
|
+
* ```
|
|
814
|
+
*
|
|
815
|
+
* Access to HTTP endpoints may be managed via the
|
|
816
|
+
* [signal`Tracker`.EndpointHttp::block-remote-address] signal, the boolean
|
|
817
|
+
* return value expressing whether the connection is blocked or not.
|
|
818
|
+
* Inspection of the requester address is left up to the user. The
|
|
819
|
+
* default value allows all requests independently of their provenance,
|
|
820
|
+
* users are encouraged to add a handler.
|
|
821
|
+
*
|
|
822
|
+
* If the provided [class`Gio`.TlsCertificate] is %NULL, the endpoint will allow
|
|
823
|
+
* plain HTTP connections. Users are encouraged to provide a certificate
|
|
824
|
+
* in order to use HTTPS.
|
|
825
|
+
*
|
|
826
|
+
* As a security measure, and in compliance specifications,
|
|
827
|
+
* the HTTP endpoint does not handle database updates or modifications in any
|
|
828
|
+
* way. The database content is considered to be entirely managed by the
|
|
829
|
+
* process that creates the HTTP endpoint and owns the [class`Tracker`.SparqlConnection].
|
|
830
|
+
*
|
|
831
|
+
* A `TrackerEndpointHttp` may be created on a different thread/main
|
|
832
|
+
* context from the one that created [class`Tracker`.SparqlConnection].
|
|
670
833
|
* @class
|
|
671
834
|
*/
|
|
672
835
|
class EndpointHttp extends Endpoint {
|
|
@@ -684,11 +847,11 @@ class EndpointHttp extends Endpoint {
|
|
|
684
847
|
* If `certificate` is not %NULL, HTTPS may be used to connect to the
|
|
685
848
|
* endpoint.
|
|
686
849
|
* @constructor
|
|
687
|
-
* @param sparql_connection
|
|
688
|
-
* @param port HTTP port to
|
|
689
|
-
* @param certificate
|
|
690
|
-
* @param cancellable
|
|
691
|
-
* @returns a
|
|
850
|
+
* @param sparql_connection The [class`Tracker`.SparqlConnection] being made public
|
|
851
|
+
* @param port HTTP port to handle incoming requests
|
|
852
|
+
* @param certificate Optional [type`Gio`.TlsCertificate] to use for encription
|
|
853
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
854
|
+
* @returns a `TrackerEndpointHttp` object.
|
|
692
855
|
*/
|
|
693
856
|
constructor(sparql_connection: SparqlConnection, port: number, certificate: Gio.TlsCertificate | null, cancellable: Gio.Cancellable | null)
|
|
694
857
|
/**
|
|
@@ -696,11 +859,11 @@ class EndpointHttp extends Endpoint {
|
|
|
696
859
|
* If `certificate` is not %NULL, HTTPS may be used to connect to the
|
|
697
860
|
* endpoint.
|
|
698
861
|
* @constructor
|
|
699
|
-
* @param sparql_connection
|
|
700
|
-
* @param port HTTP port to
|
|
701
|
-
* @param certificate
|
|
702
|
-
* @param cancellable
|
|
703
|
-
* @returns a
|
|
862
|
+
* @param sparql_connection The [class`Tracker`.SparqlConnection] being made public
|
|
863
|
+
* @param port HTTP port to handle incoming requests
|
|
864
|
+
* @param certificate Optional [type`Gio`.TlsCertificate] to use for encription
|
|
865
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
866
|
+
* @returns a `TrackerEndpointHttp` object.
|
|
704
867
|
*/
|
|
705
868
|
static new(sparql_connection: SparqlConnection, port: number, certificate: Gio.TlsCertificate | null, cancellable: Gio.Cancellable | null): EndpointHttp
|
|
706
869
|
_init(config?: EndpointHttp.ConstructorProperties): void
|
|
@@ -725,16 +888,16 @@ interface NamespaceManager {
|
|
|
725
888
|
* Only one prefix is allowed for a given namespace, and all prefixes must
|
|
726
889
|
* be unique.
|
|
727
890
|
*
|
|
728
|
-
* Since 3.3,
|
|
729
|
-
*
|
|
730
|
-
*
|
|
891
|
+
* Since 3.3, The `TrackerNamespaceManager` instances obtained through
|
|
892
|
+
* [method`Tracker`.SparqlConnection.get_namespace_manager] are "sealed",
|
|
893
|
+
* this API call should not performed on those.
|
|
731
894
|
* @param prefix a short, unique prefix to identify `namespace`
|
|
732
895
|
* @param ns the URL of the given namespace
|
|
733
896
|
*/
|
|
734
897
|
add_prefix(prefix: string | null, ns: string | null): void
|
|
735
898
|
/**
|
|
736
899
|
* If `uri` begins with one of the namespaces known to this
|
|
737
|
-
*
|
|
900
|
+
* `TrackerNamespaceManager`, then the return value will be the
|
|
738
901
|
* compressed URI. Otherwise, %NULL will be returned.
|
|
739
902
|
* @param uri a URI or compact URI
|
|
740
903
|
* @returns (nullable): the compressed URI
|
|
@@ -742,10 +905,10 @@ interface NamespaceManager {
|
|
|
742
905
|
compress_uri(uri: string | null): string | null
|
|
743
906
|
/**
|
|
744
907
|
* If `compact_uri` begins with one of the prefixes known to this
|
|
745
|
-
*
|
|
908
|
+
* `TrackerNamespaceManager`, then the return value will be the
|
|
746
909
|
* expanded URI. Otherwise, a copy of `compact_uri` will be returned.
|
|
747
910
|
* @param compact_uri a URI or compact URI
|
|
748
|
-
* @returns a newly-allocated string
|
|
911
|
+
* @returns The possibly expanded URI in a newly-allocated string.
|
|
749
912
|
*/
|
|
750
913
|
expand_uri(compact_uri: string | null): string | null
|
|
751
914
|
/**
|
|
@@ -756,18 +919,19 @@ interface NamespaceManager {
|
|
|
756
919
|
/**
|
|
757
920
|
* Returns whether `prefix` is known.
|
|
758
921
|
* @param prefix a string
|
|
759
|
-
* @returns %TRUE if the
|
|
922
|
+
* @returns %TRUE if the `TrackerNamespaceManager` knows about @prefix, %FALSE otherwise
|
|
760
923
|
*/
|
|
761
924
|
has_prefix(prefix: string | null): boolean
|
|
762
925
|
/**
|
|
763
926
|
* Looks up the namespace URI corresponding to `prefix,` or %NULL if the prefix
|
|
764
927
|
* is not known.
|
|
765
928
|
* @param prefix a string
|
|
766
|
-
* @returns a string owned by the
|
|
929
|
+
* @returns a string owned by the `TrackerNamespaceManager`, or %NULL
|
|
767
930
|
*/
|
|
768
931
|
lookup_prefix(prefix: string | null): string | null
|
|
769
932
|
/**
|
|
770
|
-
* Writes out all namespaces as
|
|
933
|
+
* Writes out all namespaces as ``prefix`` statements in
|
|
934
|
+
* the [Turtle](https://www.w3.org/TR/turtle/) RDF format.
|
|
771
935
|
* @returns a newly-allocated string
|
|
772
936
|
*/
|
|
773
937
|
print_turtle(): string | null
|
|
@@ -781,8 +945,17 @@ interface NamespaceManager {
|
|
|
781
945
|
}
|
|
782
946
|
|
|
783
947
|
/**
|
|
784
|
-
*
|
|
785
|
-
*
|
|
948
|
+
* `TrackerNamespaceManager` object represents a mapping between namespaces and
|
|
949
|
+
* their shortened prefixes.
|
|
950
|
+
*
|
|
951
|
+
* This object keeps track of namespaces, and allows you to assign
|
|
952
|
+
* short prefixes for them to avoid frequent use of full namespace IRIs. The syntax
|
|
953
|
+
* used is that of [Compact URIs (CURIEs)](https://www.w3.org/TR/2010/NOTE-curie-20101216).
|
|
954
|
+
*
|
|
955
|
+
* Usually you will want to use a namespace manager obtained through
|
|
956
|
+
* [method`Tracker`.SparqlConnection.get_namespace_manager] from the
|
|
957
|
+
* [class`Tracker`.SparqlConnection] that manages the RDF data, as that will
|
|
958
|
+
* contain all prefixes and namespaces that are pre-defined by its ontology.
|
|
786
959
|
* @class
|
|
787
960
|
*/
|
|
788
961
|
class NamespaceManager extends GObject.Object {
|
|
@@ -796,26 +969,26 @@ class NamespaceManager extends GObject.Object {
|
|
|
796
969
|
|
|
797
970
|
constructor(config?: NamespaceManager.ConstructorProperties)
|
|
798
971
|
/**
|
|
799
|
-
* Creates a new
|
|
972
|
+
* Creates a new, empty `TrackerNamespaceManager` instance.
|
|
800
973
|
* @constructor
|
|
801
|
-
* @returns a new
|
|
974
|
+
* @returns a new `TrackerNamespaceManager` instance
|
|
802
975
|
*/
|
|
803
976
|
constructor()
|
|
804
977
|
/**
|
|
805
|
-
* Creates a new
|
|
978
|
+
* Creates a new, empty `TrackerNamespaceManager` instance.
|
|
806
979
|
* @constructor
|
|
807
|
-
* @returns a new
|
|
980
|
+
* @returns a new `TrackerNamespaceManager` instance
|
|
808
981
|
*/
|
|
809
982
|
static new(): NamespaceManager
|
|
810
983
|
_init(config?: NamespaceManager.ConstructorProperties): void
|
|
811
984
|
/**
|
|
812
|
-
* Returns the global
|
|
813
|
-
* namespaces and prefixes, such as rdf
|
|
985
|
+
* Returns the global `TrackerNamespaceManager` that contains a set of well-known
|
|
986
|
+
* namespaces and prefixes, such as `rdf:`, `rdfs:`, `nie:`, `tracker:`, etc.
|
|
814
987
|
*
|
|
815
988
|
* Note that the list of prefixes and namespaces is hardcoded in
|
|
816
989
|
* libtracker-sparql. It may not correspond with the installed set of
|
|
817
990
|
* ontologies, if they have been modified since they were installed.
|
|
818
|
-
* @returns a global, shared
|
|
991
|
+
* @returns a global, shared `TrackerNamespaceManager` instance
|
|
819
992
|
*/
|
|
820
993
|
static get_default(): NamespaceManager
|
|
821
994
|
}
|
|
@@ -862,24 +1035,30 @@ interface Notifier {
|
|
|
862
1035
|
// Owm methods of Tracker-3.0.Tracker.Notifier
|
|
863
1036
|
|
|
864
1037
|
/**
|
|
865
|
-
* Listens to notification events from a remote SPARQL endpoint
|
|
866
|
-
*
|
|
867
|
-
* %NULL, the default
|
|
1038
|
+
* Listens to notification events from a remote DBus SPARQL endpoint.
|
|
1039
|
+
*
|
|
1040
|
+
* If the `object_path` argument is %NULL, the default
|
|
1041
|
+
* `/org/freedesktop/Tracker3/Endpoint` path will be
|
|
868
1042
|
* used. If `graph` is %NULL, all graphs will be listened for.
|
|
869
1043
|
*
|
|
870
1044
|
* The signal subscription can be removed with
|
|
871
|
-
*
|
|
872
|
-
*
|
|
1045
|
+
* [method`Tracker`.Notifier.signal_unsubscribe].
|
|
1046
|
+
*
|
|
1047
|
+
* Note that this call is not necessary to receive notifications on
|
|
1048
|
+
* a connection obtained through [ctor`Tracker`.SparqlConnection.bus_new],
|
|
1049
|
+
* only to listen to update notifications from additional DBus endpoints.
|
|
1050
|
+
* @param connection A [class`Gio`.DBusConnection]
|
|
873
1051
|
* @param service DBus service name to subscribe to events for
|
|
874
1052
|
* @param object_path DBus object path to subscribe to events for, or %NULL
|
|
875
|
-
* @param graph
|
|
1053
|
+
* @param graph Graph to listen events for, or %NULL
|
|
876
1054
|
* @returns An ID for this subscription
|
|
877
1055
|
*/
|
|
878
1056
|
signal_subscribe(connection: Gio.DBusConnection, service: string | null, object_path: string | null, graph: string | null): number
|
|
879
1057
|
/**
|
|
880
|
-
* Undoes a
|
|
881
|
-
*
|
|
882
|
-
*
|
|
1058
|
+
* Undoes a signal subscription done through [method`Tracker`.Notifier.signal_subscribe].
|
|
1059
|
+
*
|
|
1060
|
+
* The `handler_id` argument was previously obtained during signal subscription creation.
|
|
1061
|
+
* @param handler_id A signal subscription handler ID
|
|
883
1062
|
*/
|
|
884
1063
|
signal_unsubscribe(handler_id: number): void
|
|
885
1064
|
|
|
@@ -901,8 +1080,37 @@ interface Notifier {
|
|
|
901
1080
|
}
|
|
902
1081
|
|
|
903
1082
|
/**
|
|
904
|
-
*
|
|
905
|
-
*
|
|
1083
|
+
* `TrackerNotifier` allows receiving notification on changes
|
|
1084
|
+
* in the data stored by a [class`Tracker`.SparqlConnection].
|
|
1085
|
+
*
|
|
1086
|
+
* This object may be created through [method`Tracker`.SparqlConnection.create_notifier],
|
|
1087
|
+
* events can then be listened for by connecting to the
|
|
1088
|
+
* [signal`Tracker`.Notifier::events] signal.
|
|
1089
|
+
*
|
|
1090
|
+
* Not every change is notified, only RDF resources with a
|
|
1091
|
+
* class that has the [nrl:notify](nrl-ontology.html#nrl:notify)
|
|
1092
|
+
* property defined by the ontology will be notified upon changes.
|
|
1093
|
+
*
|
|
1094
|
+
* Database changes are communicated through [struct`Tracker`.NotifierEvent] events on
|
|
1095
|
+
* individual graph/resource pairs. The event type obtained through
|
|
1096
|
+
* [method`Tracker`.NotifierEvent.get_event_type] will determine the type of event.
|
|
1097
|
+
* Insertion of new resources is notified through
|
|
1098
|
+
* %TRACKER_NOTIFIER_EVENT_CREATE events, deletion of
|
|
1099
|
+
* resources is notified through %TRACKER_NOTIFIER_EVENT_DELETE
|
|
1100
|
+
* events, and changes on any property of the resource is notified
|
|
1101
|
+
* through %TRACKER_NOTIFIER_EVENT_UPDATE events.
|
|
1102
|
+
*
|
|
1103
|
+
* The events happen in reaction to database changes, after a `TrackerNotifier`
|
|
1104
|
+
* received an event of type %TRACKER_NOTIFIER_EVENT_DELETE, the resource will
|
|
1105
|
+
* not exist anymore and only the information in the [struct`Tracker`.NotifierEvent]
|
|
1106
|
+
* will remain.
|
|
1107
|
+
*
|
|
1108
|
+
* Similarly, when receiving an event of type %TRACKER_NOTIFIER_EVENT_UPDATE,
|
|
1109
|
+
* the resource will have already changed, so the data previous to the update is
|
|
1110
|
+
* no longer available.
|
|
1111
|
+
*
|
|
1112
|
+
* The [signal`Tracker`.Notifier::events] signal is emitted in the thread-default
|
|
1113
|
+
* main context of the thread where the `TrackerNotifier` instance was created.
|
|
906
1114
|
* @class
|
|
907
1115
|
*/
|
|
908
1116
|
class Notifier extends GObject.Object {
|
|
@@ -952,48 +1160,83 @@ interface Resource {
|
|
|
952
1160
|
// Owm methods of Tracker-3.0.Tracker.Resource
|
|
953
1161
|
|
|
954
1162
|
/**
|
|
955
|
-
* Adds a boolean
|
|
956
|
-
*
|
|
957
|
-
*
|
|
1163
|
+
* Adds a boolean property. Previous values for the same property are kept.
|
|
1164
|
+
*
|
|
1165
|
+
* This method is meant for RDF properties allowing multiple values, see
|
|
1166
|
+
* [nrl:maxCardinality](nrl-ontology.html#nrl:maxCardinality).
|
|
1167
|
+
*
|
|
1168
|
+
* This method corresponds to [xsd:boolean](xsd-ontology.html#xsd:boolean).
|
|
1169
|
+
* @param property_uri A string identifying the property to modify
|
|
1170
|
+
* @param value The property boolean value
|
|
958
1171
|
*/
|
|
959
1172
|
add_boolean(property_uri: string | null, value: boolean): void
|
|
960
1173
|
/**
|
|
961
|
-
* Adds
|
|
1174
|
+
* Adds a date property as a [type`GLib`.DateTime]. Previous values for the
|
|
1175
|
+
* same property are kept.
|
|
1176
|
+
*
|
|
1177
|
+
* This method is meant for RDF properties allowing multiple values, see
|
|
1178
|
+
* [nrl:maxCardinality](nrl-ontology.html#nrl:maxCardinality).
|
|
1179
|
+
*
|
|
1180
|
+
* This method corresponds to [xsd:date](xsd-ontology.html#xsd:date) and
|
|
1181
|
+
* [xsd:dateTime](xsd-ontology.html#xsd:dateTime).
|
|
962
1182
|
* @param property_uri a string identifying the property to modify
|
|
963
1183
|
* @param value the property object
|
|
964
1184
|
*/
|
|
965
1185
|
add_datetime(property_uri: string | null, value: GLib.DateTime): void
|
|
966
1186
|
/**
|
|
967
|
-
* Adds a double
|
|
1187
|
+
* Adds a numeric property with double precision. Previous values for the same property are kept.
|
|
1188
|
+
*
|
|
1189
|
+
* This method is meant for RDF properties allowing multiple values, see
|
|
1190
|
+
* [nrl:maxCardinality](nrl-ontology.html#nrl:maxCardinality).
|
|
1191
|
+
*
|
|
1192
|
+
* This method corresponds to [xsd:double](xsd-ontology.html#xsd:double).
|
|
968
1193
|
* @param property_uri a string identifying the property to modify
|
|
969
1194
|
* @param value the property object
|
|
970
1195
|
*/
|
|
971
1196
|
add_double(property_uri: string | null, value: number): void
|
|
972
1197
|
/**
|
|
973
|
-
* Add
|
|
1198
|
+
* Add `value` to the list of values for given property.
|
|
974
1199
|
*
|
|
975
|
-
* You can pass any kind of
|
|
1200
|
+
* You can pass any kind of [struct`GObject`.Value] for `value,` but serialization functions will
|
|
976
1201
|
* normally only be able to serialize URIs/relationships and fundamental value
|
|
977
1202
|
* types (string, int, etc.).
|
|
978
1203
|
* @param property_uri a string identifying the property to set
|
|
979
|
-
* @param value an initialised
|
|
1204
|
+
* @param value an initialised [struct`GObject`.Value]
|
|
980
1205
|
*/
|
|
981
1206
|
add_gvalue(property_uri: string | null, value: any): void
|
|
982
1207
|
/**
|
|
983
|
-
* Adds
|
|
1208
|
+
* Adds a numeric property with integer precision. Previous values for the same property are kept.
|
|
1209
|
+
*
|
|
1210
|
+
* This method is meant for RDF properties allowing multiple values, see
|
|
1211
|
+
* [nrl:maxCardinality](nrl-ontology.html#nrl:maxCardinality).
|
|
1212
|
+
*
|
|
1213
|
+
* This method corresponds to [xsd:integer](xsd-ontology.html#xsd:integer).
|
|
984
1214
|
* @param property_uri a string identifying the property to modify
|
|
985
1215
|
* @param value the property object
|
|
986
1216
|
*/
|
|
987
1217
|
add_int(property_uri: string | null, value: number): void
|
|
988
1218
|
/**
|
|
989
|
-
* Adds
|
|
1219
|
+
* Adds a numeric property with 64-bit integer precision. Previous values for the same property are kept.
|
|
1220
|
+
*
|
|
1221
|
+
* This method is meant for RDF properties allowing multiple values, see
|
|
1222
|
+
* [nrl:maxCardinality](nrl-ontology.html#nrl:maxCardinality).
|
|
1223
|
+
*
|
|
1224
|
+
* This method corresponds to [xsd:integer](xsd-ontology.html#xsd:integer).
|
|
990
1225
|
* @param property_uri a string identifying the property to modify
|
|
991
1226
|
* @param value the property object
|
|
992
1227
|
*/
|
|
993
1228
|
add_int64(property_uri: string | null, value: number): void
|
|
994
1229
|
/**
|
|
995
|
-
* Adds a resource
|
|
996
|
-
*
|
|
1230
|
+
* Adds a resource property as a `TrackerResource`. Previous values for the same property are kept.
|
|
1231
|
+
*
|
|
1232
|
+
* This method is meant for RDF properties allowing multiple values, see
|
|
1233
|
+
* [nrl:maxCardinality](nrl-ontology.html#nrl:maxCardinality).
|
|
1234
|
+
*
|
|
1235
|
+
* This method applies to properties with a [rdfs:range](rdf-ontology.html#rdfs:range)
|
|
1236
|
+
* that points to a non-literal class (i.e. a subclass of
|
|
1237
|
+
* [rdfs:Resource](rdf-ontology.html#rdfs:Resource)).
|
|
1238
|
+
*
|
|
1239
|
+
* This method produces similar RDF to [method`Tracker`.Resource.add_uri],
|
|
997
1240
|
* although in this function the URI will depend on the identifier
|
|
998
1241
|
* set on `resource`.
|
|
999
1242
|
* @param property_uri a string identifying the property to modify
|
|
@@ -1001,14 +1244,28 @@ interface Resource {
|
|
|
1001
1244
|
*/
|
|
1002
1245
|
add_relation(property_uri: string | null, resource: Resource): void
|
|
1003
1246
|
/**
|
|
1004
|
-
* Adds a string
|
|
1247
|
+
* Adds a string property. Previous values for the same property are kept.
|
|
1248
|
+
*
|
|
1249
|
+
* This method is meant for RDF properties allowing multiple values, see
|
|
1250
|
+
* [nrl:maxCardinality](nrl-ontology.html#nrl:maxCardinality).
|
|
1251
|
+
*
|
|
1252
|
+
* This method corresponds to [xsd:string](xsd-ontology.html#xsd:string).
|
|
1005
1253
|
* @param property_uri a string identifying the property to modify
|
|
1006
1254
|
* @param value the property object
|
|
1007
1255
|
*/
|
|
1008
1256
|
add_string(property_uri: string | null, value: string | null): void
|
|
1009
1257
|
/**
|
|
1010
|
-
* Adds a resource
|
|
1011
|
-
*
|
|
1258
|
+
* Adds a resource property as a `TrackerResource`. Previous values for the same property are kept.
|
|
1259
|
+
* Takes ownership on the given `resource`.
|
|
1260
|
+
*
|
|
1261
|
+
* This method is meant to RDF properties allowing multiple values, see
|
|
1262
|
+
* [nrl:maxCardinality](nrl-ontology.html#nrl:maxCardinality).
|
|
1263
|
+
*
|
|
1264
|
+
* This method applies to properties with a [rdfs:range](rdf-ontology.html#rdfs:range)
|
|
1265
|
+
* that points to a non-literal class (i.e. a subclass of
|
|
1266
|
+
* [rdfs:Resource](rdf-ontology.html#rdfs:Resource)).
|
|
1267
|
+
*
|
|
1268
|
+
* This function produces similar RDF to [method`Tracker`.Resource.add_uri],
|
|
1012
1269
|
* although in this function the URI will depend on the identifier
|
|
1013
1270
|
* set on `resource`. This function takes ownership of `resource`.
|
|
1014
1271
|
* @param property_uri a string identifying the property to modify
|
|
@@ -1016,8 +1273,16 @@ interface Resource {
|
|
|
1016
1273
|
*/
|
|
1017
1274
|
add_take_relation(property_uri: string | null, resource: Resource): void
|
|
1018
1275
|
/**
|
|
1019
|
-
* Adds a resource
|
|
1020
|
-
*
|
|
1276
|
+
* Adds a resource property as an URI string. Previous values for the same property are kept.
|
|
1277
|
+
*
|
|
1278
|
+
* This method applies to properties with a [rdfs:range](rdf-ontology.html#rdfs:range)
|
|
1279
|
+
* that points to a non-literal class (i.e. a subclass of
|
|
1280
|
+
* [rdfs:Resource](rdf-ontology.html#rdfs:Resource)).
|
|
1281
|
+
*
|
|
1282
|
+
* This method is meant for RDF properties allowing multiple values, see
|
|
1283
|
+
* [nrl:maxCardinality](nrl-ontology.html#nrl:maxCardinality).
|
|
1284
|
+
*
|
|
1285
|
+
* This function produces similar RDF to [method`Tracker`.Resource.add_relation], although
|
|
1021
1286
|
* it requires that the URI is previously known.
|
|
1022
1287
|
* @param property_uri a string identifying the property to modify
|
|
1023
1288
|
* @param value the property object
|
|
@@ -1030,7 +1295,7 @@ interface Resource {
|
|
|
1030
1295
|
*/
|
|
1031
1296
|
get_first_boolean(property_uri: string | null): boolean
|
|
1032
1297
|
/**
|
|
1033
|
-
* Returns the first
|
|
1298
|
+
* Returns the first [type`GLib`.DateTime] previously assigned to a property.
|
|
1034
1299
|
* @param property_uri a string identifying the property to look up
|
|
1035
1300
|
* @returns the first GDateTime object
|
|
1036
1301
|
*/
|
|
@@ -1074,14 +1339,14 @@ interface Resource {
|
|
|
1074
1339
|
/**
|
|
1075
1340
|
* Returns the identifier of a resource.
|
|
1076
1341
|
*
|
|
1077
|
-
* If the identifier was set to NULL, the identifier returned will be a
|
|
1078
|
-
* SPARQL blank node identifier, such as
|
|
1342
|
+
* If the identifier was set to NULL, the identifier returned will be a locally
|
|
1343
|
+
* unique SPARQL blank node identifier, such as `_:123`.
|
|
1079
1344
|
* @returns a string owned by the resource
|
|
1080
1345
|
*/
|
|
1081
1346
|
get_identifier(): string | null
|
|
1082
1347
|
/**
|
|
1083
1348
|
* Gets the list of properties defined in `resource`
|
|
1084
|
-
* @returns The list of properties.
|
|
1349
|
+
* @returns The list of properties.
|
|
1085
1350
|
*/
|
|
1086
1351
|
get_properties(): string[]
|
|
1087
1352
|
/**
|
|
@@ -1094,11 +1359,11 @@ interface Resource {
|
|
|
1094
1359
|
/**
|
|
1095
1360
|
* Returns the list of all known values of the given property.
|
|
1096
1361
|
* @param property_uri a string identifying the property to look up
|
|
1097
|
-
* @returns a
|
|
1362
|
+
* @returns a [struct@GLib.List] of [struct@GObject.Value] instances. The list should be freed with [func@GLib.List.free]
|
|
1098
1363
|
*/
|
|
1099
1364
|
get_values(property_uri: string | null): any[] | null
|
|
1100
1365
|
/**
|
|
1101
|
-
* A helper function that compares a
|
|
1366
|
+
* A helper function that compares a `TrackerResource` by its identifier
|
|
1102
1367
|
* string.
|
|
1103
1368
|
* @param identifier a string identifying the resource
|
|
1104
1369
|
* @returns an integer less than, equal to, or greater than zero, if the resource identifier is <, == or > than @identifier
|
|
@@ -1111,7 +1376,7 @@ interface Resource {
|
|
|
1111
1376
|
* serialization format.
|
|
1112
1377
|
*
|
|
1113
1378
|
* The `namespaces` object is used to expand any compact URI values. In most
|
|
1114
|
-
* cases you should pass the one returned by
|
|
1379
|
+
* cases you should pass the one returned by [method`Tracker`.SparqlConnection.get_namespace_manager]
|
|
1115
1380
|
* from the connection that is the intended recipient of this data.
|
|
1116
1381
|
* @param namespaces a set of prefixed URLs, or %NULL to use the Nepomuk set
|
|
1117
1382
|
* @returns a newly-allocated string containing JSON-LD data.
|
|
@@ -1121,7 +1386,7 @@ interface Resource {
|
|
|
1121
1386
|
* Serialize all the information in `resource` into the selected RDF format.
|
|
1122
1387
|
*
|
|
1123
1388
|
* The `namespaces` object is used to expand any compact URI values. In most
|
|
1124
|
-
* cases you should pass the one returned by
|
|
1389
|
+
* cases you should pass the one returned by [method`Tracker`.SparqlConnection.get_namespace_manager]
|
|
1125
1390
|
* from the connection that is the intended recipient of this data.
|
|
1126
1391
|
* @param namespaces a set of prefixed URLs
|
|
1127
1392
|
* @param format RDF format of the printed string
|
|
@@ -1134,7 +1399,7 @@ interface Resource {
|
|
|
1134
1399
|
* stored in `resource`.
|
|
1135
1400
|
*
|
|
1136
1401
|
* The `namespaces` object is used to expand any compact URI values. In most
|
|
1137
|
-
* cases you should pass the one returned by
|
|
1402
|
+
* cases you should pass the one returned by [method`Tracker`.SparqlConnection.get_namespace_manager]
|
|
1138
1403
|
* from the connection that is the intended recipient of this data.
|
|
1139
1404
|
* @param namespaces a set of prefixed URLs, or %NULL to use the Nepomuk set
|
|
1140
1405
|
* @param graph_id the URN of the graph the data should be added to, or %NULL
|
|
@@ -1148,78 +1413,93 @@ interface Resource {
|
|
|
1148
1413
|
* <https://www.w3.org/TR/2014/REC-turtle-20140225/>
|
|
1149
1414
|
*
|
|
1150
1415
|
* The `namespaces` object is used to expand any compact URI values. In most
|
|
1151
|
-
* cases you should pass the one returned by
|
|
1416
|
+
* cases you should pass the one returned by [method`Tracker`.SparqlConnection.get_namespace_manager]
|
|
1152
1417
|
* from the connection that is the intended recipient of this data.
|
|
1153
1418
|
* @param namespaces a set of prefixed URLs, or %NULL to use the Nepomuk set
|
|
1154
1419
|
* @returns a newly-allocated string
|
|
1155
1420
|
*/
|
|
1156
1421
|
print_turtle(namespaces: NamespaceManager | null): string | null
|
|
1157
1422
|
/**
|
|
1158
|
-
* Serializes a
|
|
1423
|
+
* Serializes a `TrackerResource` to a [type`GLib`.Variant] in a lossless way.
|
|
1159
1424
|
* All child resources are subsequently serialized. It is implied
|
|
1160
|
-
* that both ends use a common
|
|
1425
|
+
* that both ends use a common [class`Tracker`.NamespaceManager].
|
|
1161
1426
|
* @returns A variant describing the resource, the reference is floating.
|
|
1162
1427
|
*/
|
|
1163
1428
|
serialize(): GLib.Variant | null
|
|
1164
1429
|
/**
|
|
1165
|
-
* Sets a
|
|
1166
|
-
*
|
|
1167
|
-
*
|
|
1430
|
+
* Sets a boolean property. Replaces any previous value.
|
|
1431
|
+
*
|
|
1432
|
+
* This method corresponds to [xsd:boolean](xsd-ontology.html#xsd:boolean).
|
|
1433
|
+
* @param property_uri A string identifying the property to modify
|
|
1434
|
+
* @param value The property boolean value
|
|
1168
1435
|
*/
|
|
1169
1436
|
set_boolean(property_uri: string | null, value: boolean): void
|
|
1170
1437
|
/**
|
|
1171
|
-
* Sets a
|
|
1438
|
+
* Sets a date property as a [type`GLib`.DateTime]. Replaces any previous value.
|
|
1439
|
+
*
|
|
1440
|
+
* This method corresponds to [xsd:date](xsd-ontology.html#xsd:date) and
|
|
1441
|
+
* [xsd:dateTime](xsd-ontology.html#xsd:dateTime).
|
|
1172
1442
|
* @param property_uri a string identifying the property to modify
|
|
1173
1443
|
* @param value the property object
|
|
1174
1444
|
*/
|
|
1175
1445
|
set_datetime(property_uri: string | null, value: GLib.DateTime): void
|
|
1176
1446
|
/**
|
|
1177
|
-
* Sets a
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1447
|
+
* Sets a numeric property with double precision. Replaces any previous value.
|
|
1448
|
+
*
|
|
1449
|
+
* This method corresponds to [xsd:double](xsd-ontology.html#xsd:double).
|
|
1450
|
+
* @param property_uri A string identifying the property to modify
|
|
1451
|
+
* @param value The property object
|
|
1180
1452
|
*/
|
|
1181
1453
|
set_double(property_uri: string | null, value: number): void
|
|
1182
1454
|
/**
|
|
1183
|
-
*
|
|
1184
|
-
* values for 'property' will be removed.
|
|
1455
|
+
* Replace any previously existing value for `property_uri` with `value`.
|
|
1185
1456
|
*
|
|
1186
1457
|
* When serialising to SPARQL, any properties that were set with this function
|
|
1187
1458
|
* will get a corresponding DELETE statement to remove any existing values in
|
|
1188
1459
|
* the database.
|
|
1189
1460
|
*
|
|
1190
|
-
* You can pass any kind of
|
|
1461
|
+
* You can pass any kind of [struct`GObject`.Value] for `value,` but serialization functions will
|
|
1191
1462
|
* normally only be able to serialize URIs/relationships and fundamental value
|
|
1192
1463
|
* types (string, int, etc.).
|
|
1193
1464
|
* @param property_uri a string identifying the property to set
|
|
1194
|
-
* @param value an initialised
|
|
1465
|
+
* @param value an initialised [struct`GObject`.Value]
|
|
1195
1466
|
*/
|
|
1196
1467
|
set_gvalue(property_uri: string | null, value: any): void
|
|
1197
1468
|
/**
|
|
1198
|
-
* Changes the identifier of a
|
|
1469
|
+
* Changes the identifier of a `TrackerResource`. The identifier should be a
|
|
1199
1470
|
* URI or compact URI, but this is not necessarily enforced. Invalid
|
|
1200
1471
|
* identifiers may cause errors when serializing the resource or trying to
|
|
1201
1472
|
* insert the results in a database.
|
|
1202
1473
|
*
|
|
1203
1474
|
* If the identifier is set to %NULL, a SPARQL blank node identifier such as
|
|
1204
|
-
*
|
|
1475
|
+
* `_:123` is assigned to the resource.
|
|
1205
1476
|
* @param identifier a string identifying the resource
|
|
1206
1477
|
*/
|
|
1207
1478
|
set_identifier(identifier: string | null): void
|
|
1208
1479
|
/**
|
|
1209
|
-
* Sets a
|
|
1210
|
-
*
|
|
1211
|
-
*
|
|
1480
|
+
* Sets a numeric property with integer precision. Replaces any previous value.
|
|
1481
|
+
*
|
|
1482
|
+
* This method corresponds to [xsd:integer](xsd-ontology.html#xsd:integer).
|
|
1483
|
+
* @param property_uri A string identifying the property to modify
|
|
1484
|
+
* @param value The property object
|
|
1212
1485
|
*/
|
|
1213
1486
|
set_int(property_uri: string | null, value: number): void
|
|
1214
1487
|
/**
|
|
1215
|
-
* Sets a
|
|
1488
|
+
* Sets a numeric property with 64-bit integer precision. Replaces any previous value.
|
|
1489
|
+
*
|
|
1490
|
+
* This method corresponds to [xsd:integer](xsd-ontology.html#xsd:integer).
|
|
1216
1491
|
* @param property_uri a string identifying the property to modify
|
|
1217
1492
|
* @param value the property object
|
|
1218
1493
|
*/
|
|
1219
1494
|
set_int64(property_uri: string | null, value: number): void
|
|
1220
1495
|
/**
|
|
1221
|
-
* Sets a
|
|
1222
|
-
*
|
|
1496
|
+
* Sets a resource property as a `TrackerResource`. Replaces any previous value.
|
|
1497
|
+
*
|
|
1498
|
+
* This method applies to properties with a [rdfs:range](rdf-ontology.html#rdfs:range)
|
|
1499
|
+
* that points to a non-literal class (i.e. a subclass of
|
|
1500
|
+
* [rdfs:Resource](rdf-ontology.html#rdfs:Resource)).
|
|
1501
|
+
*
|
|
1502
|
+
* This function produces similar RDF to [method`Tracker`.Resource.set_uri],
|
|
1223
1503
|
* although in this function the URI will depend on the identifier
|
|
1224
1504
|
* set on `resource`.
|
|
1225
1505
|
* @param property_uri a string identifying the property to modify
|
|
@@ -1227,23 +1507,36 @@ interface Resource {
|
|
|
1227
1507
|
*/
|
|
1228
1508
|
set_relation(property_uri: string | null, resource: Resource): void
|
|
1229
1509
|
/**
|
|
1230
|
-
* Sets a
|
|
1510
|
+
* Sets a string property. Replaces any previous value.
|
|
1511
|
+
*
|
|
1512
|
+
* This method corresponds to [xsd:string](xsd-ontology.html#xsd:string).
|
|
1231
1513
|
* @param property_uri a string identifying the property to modify
|
|
1232
1514
|
* @param value the property object
|
|
1233
1515
|
*/
|
|
1234
1516
|
set_string(property_uri: string | null, value: string | null): void
|
|
1235
1517
|
/**
|
|
1236
|
-
* Sets a
|
|
1237
|
-
*
|
|
1518
|
+
* Sets a resource property as a `TrackerResource`. Replaces any previous value.
|
|
1519
|
+
* Takes ownership on the given `resource`.
|
|
1520
|
+
*
|
|
1521
|
+
* This method applies to properties with a [rdfs:range](rdf-ontology.html#rdfs:range)
|
|
1522
|
+
* that points to a non-literal class (i.e. a subclass of
|
|
1523
|
+
* [rdfs:Resource](rdf-ontology.html#rdfs:Resource)).
|
|
1524
|
+
*
|
|
1525
|
+
* This function produces similar RDF to [method`Tracker`.Resource.set_uri],
|
|
1238
1526
|
* although in this function the URI will depend on the identifier
|
|
1239
|
-
* set on `resource`.
|
|
1527
|
+
* set on `resource`.
|
|
1240
1528
|
* @param property_uri a string identifying the property to modify
|
|
1241
1529
|
* @param resource the property object
|
|
1242
1530
|
*/
|
|
1243
1531
|
set_take_relation(property_uri: string | null, resource: Resource): void
|
|
1244
1532
|
/**
|
|
1245
|
-
* Sets a
|
|
1246
|
-
*
|
|
1533
|
+
* Sets a resource property as an URI string. Replaces any previous value.
|
|
1534
|
+
*
|
|
1535
|
+
* This method applies to properties with a [rdfs:range](rdf-ontology.html#rdfs:range)
|
|
1536
|
+
* that points to a non-literal class (i.e. a subclass of
|
|
1537
|
+
* [rdfs:Resource](rdf-ontology.html#rdfs:Resource)).
|
|
1538
|
+
*
|
|
1539
|
+
* This function produces similar RDF to [method`Tracker`.Resource.set_relation], although
|
|
1247
1540
|
* it requires that the URI is previously known.
|
|
1248
1541
|
* @param property_uri a string identifying the property to modify
|
|
1249
1542
|
* @param value the property object
|
|
@@ -1262,8 +1555,35 @@ interface Resource {
|
|
|
1262
1555
|
}
|
|
1263
1556
|
|
|
1264
1557
|
/**
|
|
1265
|
-
*
|
|
1266
|
-
*
|
|
1558
|
+
* `TrackerResource` is an in-memory representation of RDF data about a given resource.
|
|
1559
|
+
*
|
|
1560
|
+
* This object keeps track of a set of properties for a given resource, and can
|
|
1561
|
+
* also link to other `TrackerResource` objects to form trees or graphs of RDF
|
|
1562
|
+
* data. See [method`Tracker`.Resource.set_relation] and [method`Tracker`.Resource.set_uri]
|
|
1563
|
+
* on how to link a `TrackerResource` to other RDF data.
|
|
1564
|
+
*
|
|
1565
|
+
* `TrackerResource` may also hold data about literal values, added through
|
|
1566
|
+
* the specialized [method`Tracker`.Resource.set_int64], [method`Tracker`.Resource.set_string],
|
|
1567
|
+
* etc family of functions, or the generic [method`Tracker`.Resource.set_gvalue] method.
|
|
1568
|
+
*
|
|
1569
|
+
* Since RDF properties may be multi-valued, for every `set` call there exists
|
|
1570
|
+
* another `add` call (e.g. [method`Tracker`.Resource.add_int64], [method`Tracker`.Resource.add_string]
|
|
1571
|
+
* and so on). The `set` methods do also reset any previously value the
|
|
1572
|
+
* property might hold for the given resource.
|
|
1573
|
+
*
|
|
1574
|
+
* Resources may have an IRI set at creation through [ctor`Tracker`.Resource.new],
|
|
1575
|
+
* or set afterwards through [method`Tracker`.Resource.set_identifier]. Resources
|
|
1576
|
+
* without a name will represent a blank node, and will be dealt with as such
|
|
1577
|
+
* during database insertions.
|
|
1578
|
+
*
|
|
1579
|
+
* `TrackerResource` performs no validation on the data being coherent as per
|
|
1580
|
+
* any ontology. Errors will be found out at the time of using the TrackerResource
|
|
1581
|
+
* for e.g. database updates.
|
|
1582
|
+
*
|
|
1583
|
+
* Once the RDF data is built in memory, the (tree of) `TrackerResource` may be
|
|
1584
|
+
* converted to a RDF format through [method`Tracker`.Resource.print_rdf], or
|
|
1585
|
+
* directly inserted into a database through [method`Tracker`.Batch.add_resource]
|
|
1586
|
+
* or [method`Tracker`.SparqlConnection.update_resource].
|
|
1267
1587
|
* @class
|
|
1268
1588
|
*/
|
|
1269
1589
|
class Resource extends GObject.Object {
|
|
@@ -1280,22 +1600,22 @@ class Resource extends GObject.Object {
|
|
|
1280
1600
|
* Creates a TrackerResource instance.
|
|
1281
1601
|
* @constructor
|
|
1282
1602
|
* @param identifier A string containing a URI, or %NULL.
|
|
1283
|
-
* @returns a newly created
|
|
1603
|
+
* @returns a newly created `TrackerResource`.
|
|
1284
1604
|
*/
|
|
1285
1605
|
constructor(identifier: string | null)
|
|
1286
1606
|
/**
|
|
1287
1607
|
* Creates a TrackerResource instance.
|
|
1288
1608
|
* @constructor
|
|
1289
1609
|
* @param identifier A string containing a URI, or %NULL.
|
|
1290
|
-
* @returns a newly created
|
|
1610
|
+
* @returns a newly created `TrackerResource`.
|
|
1291
1611
|
*/
|
|
1292
1612
|
static new(identifier: string | null): Resource
|
|
1293
1613
|
_init(config?: Resource.ConstructorProperties): void
|
|
1294
1614
|
/**
|
|
1295
|
-
* Deserializes a
|
|
1296
|
-
*
|
|
1297
|
-
* use a common
|
|
1298
|
-
* @param variant a
|
|
1615
|
+
* Deserializes a `TrackerResource` previously serialized with
|
|
1616
|
+
* [method`Tracker`.Resource.serialize]. It is implied that both ends
|
|
1617
|
+
* use a common [class`Tracker`.NamespaceManager].
|
|
1618
|
+
* @param variant a [type`GLib`.Variant]
|
|
1299
1619
|
* @returns A TrackerResource, or %NULL if deserialization fails.
|
|
1300
1620
|
*/
|
|
1301
1621
|
static deserialize(variant: GLib.Variant): Resource | null
|
|
@@ -1319,8 +1639,9 @@ interface SparqlConnection {
|
|
|
1319
1639
|
// Owm methods of Tracker-3.0.Tracker.SparqlConnection
|
|
1320
1640
|
|
|
1321
1641
|
/**
|
|
1322
|
-
* Closes a SPARQL connection.
|
|
1323
|
-
*
|
|
1642
|
+
* Closes a SPARQL connection.
|
|
1643
|
+
*
|
|
1644
|
+
* No other API calls than g_object_unref() should happen after this call.
|
|
1324
1645
|
*
|
|
1325
1646
|
* This call is blocking. All pending updates will be flushed, and the
|
|
1326
1647
|
* store databases will be closed orderly. All ongoing SELECT queries
|
|
@@ -1328,11 +1649,11 @@ interface SparqlConnection {
|
|
|
1328
1649
|
*/
|
|
1329
1650
|
close(): void
|
|
1330
1651
|
/**
|
|
1331
|
-
* Closes a connection asynchronously.
|
|
1332
|
-
*
|
|
1333
|
-
*
|
|
1334
|
-
* @param cancellable
|
|
1335
|
-
* @param callback
|
|
1652
|
+
* Closes a SPARQL connection asynchronously.
|
|
1653
|
+
*
|
|
1654
|
+
* No other API calls than g_object_unref() should happen after this call.
|
|
1655
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1656
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1336
1657
|
*/
|
|
1337
1658
|
close_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
1338
1659
|
|
|
@@ -1341,51 +1662,55 @@ interface SparqlConnection {
|
|
|
1341
1662
|
/**
|
|
1342
1663
|
* Promisified version of {@link close_async}
|
|
1343
1664
|
*
|
|
1344
|
-
* Closes a connection asynchronously.
|
|
1345
|
-
*
|
|
1346
|
-
*
|
|
1347
|
-
* @param cancellable
|
|
1665
|
+
* Closes a SPARQL connection asynchronously.
|
|
1666
|
+
*
|
|
1667
|
+
* No other API calls than g_object_unref() should happen after this call.
|
|
1668
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1348
1669
|
* @returns A Promise of: %FALSE if some error occurred, %TRUE otherwise
|
|
1349
1670
|
*/
|
|
1350
1671
|
close_async(cancellable: Gio.Cancellable | null): globalThis.Promise<boolean>
|
|
1351
1672
|
/**
|
|
1352
|
-
* Finishes the
|
|
1353
|
-
* @param res the
|
|
1673
|
+
* Finishes the operation started with [method`Tracker`.SparqlConnection.close_async].
|
|
1674
|
+
* @param res A [type`Gio`.AsyncResult] with the result of the operation
|
|
1354
1675
|
* @returns %FALSE if some error occurred, %TRUE otherwise
|
|
1355
1676
|
*/
|
|
1356
1677
|
close_finish(res: Gio.AsyncResult): boolean
|
|
1357
1678
|
/**
|
|
1358
|
-
* Creates a new
|
|
1359
|
-
*
|
|
1360
|
-
*
|
|
1679
|
+
* Creates a new [class`Tracker`.Batch] to store and execute SPARQL updates.
|
|
1680
|
+
*
|
|
1681
|
+
* If the connection is readonly or cannot issue SPARQL updates, %NULL will be returned.
|
|
1682
|
+
* @returns (nullable): A new [class@Tracker.Batch]
|
|
1361
1683
|
*/
|
|
1362
1684
|
create_batch(): Batch
|
|
1363
1685
|
/**
|
|
1364
|
-
* Creates a new
|
|
1365
|
-
*
|
|
1686
|
+
* Creates a new [class`Tracker`.Notifier] to receive notifications about changes in `connection`.
|
|
1687
|
+
*
|
|
1688
|
+
* See [class`Tracker`.Notifier] documentation for information about how to use this
|
|
1366
1689
|
* object.
|
|
1367
|
-
*
|
|
1690
|
+
*
|
|
1691
|
+
* Connections to HTTP endpoints will return %NULL.
|
|
1692
|
+
* @returns A newly created notifier.
|
|
1368
1693
|
*/
|
|
1369
|
-
create_notifier(): Notifier
|
|
1694
|
+
create_notifier(): Notifier | null
|
|
1370
1695
|
/**
|
|
1371
|
-
*
|
|
1372
|
-
*
|
|
1373
|
-
* `callback` will be invoked when the
|
|
1374
|
-
* `connection`.
|
|
1696
|
+
* Loads the RDF data contained in `stream` into the given `connection`.
|
|
1697
|
+
*
|
|
1698
|
+
* This is an asynchronous operation, `callback` will be invoked when the
|
|
1699
|
+
* data has been fully inserted to `connection`.
|
|
1375
1700
|
*
|
|
1376
|
-
* RDF data will be inserted in the given `default_graph` if one is provided,
|
|
1377
|
-
* or the
|
|
1701
|
+
* The RDF data will be inserted in the given `default_graph` if one is provided,
|
|
1702
|
+
* or the anonymous graph if `default_graph` is %NULL. Any RDF data that has a
|
|
1378
1703
|
* graph specified (e.g. using the `GRAPH` clause in the Trig format) will
|
|
1379
1704
|
* be inserted in the specified graph instead of `default_graph`.
|
|
1380
1705
|
*
|
|
1381
1706
|
* The `flags` argument is reserved for future expansions, currently
|
|
1382
1707
|
* %TRACKER_DESERIALIZE_FLAGS_NONE must be passed.
|
|
1383
|
-
* @param flags
|
|
1708
|
+
* @param flags Deserialization flags
|
|
1384
1709
|
* @param format RDF format of data in stream
|
|
1385
|
-
* @param default_graph
|
|
1386
|
-
* @param stream
|
|
1387
|
-
* @param cancellable
|
|
1388
|
-
* @param callback
|
|
1710
|
+
* @param default_graph Default graph that will receive the RDF data
|
|
1711
|
+
* @param stream Input stream with RDF data
|
|
1712
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1713
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1389
1714
|
*/
|
|
1390
1715
|
deserialize_async(flags: DeserializeFlags, format: RdfFormat, default_graph: string | null, stream: Gio.InputStream, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
1391
1716
|
|
|
@@ -1394,52 +1719,62 @@ interface SparqlConnection {
|
|
|
1394
1719
|
/**
|
|
1395
1720
|
* Promisified version of {@link deserialize_async}
|
|
1396
1721
|
*
|
|
1397
|
-
*
|
|
1398
|
-
* data stored by `connection`. This is an asynchronous operation,
|
|
1399
|
-
* `callback` will be invoked when the data has been fully inserted to
|
|
1400
|
-
* `connection`.
|
|
1722
|
+
* Loads the RDF data contained in `stream` into the given `connection`.
|
|
1401
1723
|
*
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1724
|
+
* This is an asynchronous operation, `callback` will be invoked when the
|
|
1725
|
+
* data has been fully inserted to `connection`.
|
|
1726
|
+
*
|
|
1727
|
+
* The RDF data will be inserted in the given `default_graph` if one is provided,
|
|
1728
|
+
* or the anonymous graph if `default_graph` is %NULL. Any RDF data that has a
|
|
1404
1729
|
* graph specified (e.g. using the `GRAPH` clause in the Trig format) will
|
|
1405
1730
|
* be inserted in the specified graph instead of `default_graph`.
|
|
1406
1731
|
*
|
|
1407
1732
|
* The `flags` argument is reserved for future expansions, currently
|
|
1408
1733
|
* %TRACKER_DESERIALIZE_FLAGS_NONE must be passed.
|
|
1409
|
-
* @param flags
|
|
1734
|
+
* @param flags Deserialization flags
|
|
1410
1735
|
* @param format RDF format of data in stream
|
|
1411
|
-
* @param default_graph
|
|
1412
|
-
* @param stream
|
|
1413
|
-
* @param cancellable
|
|
1736
|
+
* @param default_graph Default graph that will receive the RDF data
|
|
1737
|
+
* @param stream Input stream with RDF data
|
|
1738
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1414
1739
|
* @returns A Promise of: %TRUE if all data was inserted successfully.
|
|
1415
1740
|
*/
|
|
1416
1741
|
deserialize_async(flags: DeserializeFlags, format: RdfFormat, default_graph: string | null, stream: Gio.InputStream, cancellable: Gio.Cancellable | null): globalThis.Promise<boolean>
|
|
1417
1742
|
/**
|
|
1418
|
-
* Finishes
|
|
1419
|
-
*
|
|
1420
|
-
* @param result the #GAsyncResult
|
|
1743
|
+
* Finishes the operation started with [method`Tracker`.SparqlConnection.deserialize_async].
|
|
1744
|
+
* @param result A [type`Gio`.AsyncResult] with the result of the operation
|
|
1421
1745
|
* @returns %TRUE if all data was inserted successfully.
|
|
1422
1746
|
*/
|
|
1423
1747
|
deserialize_finish(result: Gio.AsyncResult): boolean
|
|
1424
1748
|
/**
|
|
1425
|
-
*
|
|
1749
|
+
* Returns a [class`Tracker`.NamespaceManager] that contains all
|
|
1426
1750
|
* prefixes in the ontology of `connection`.
|
|
1427
|
-
* @returns a
|
|
1751
|
+
* @returns a [class@Tracker.NamespaceManager] with the prefixes of @connection.
|
|
1428
1752
|
*/
|
|
1429
1753
|
get_namespace_manager(): NamespaceManager
|
|
1430
1754
|
/**
|
|
1431
|
-
* Prepares a
|
|
1432
|
-
* file at `resource_path`.
|
|
1433
|
-
*
|
|
1434
|
-
*
|
|
1435
|
-
*
|
|
1755
|
+
* Prepares a [class`Tracker`.SparqlStatement] for the SPARQL contained as a [struct`Gio`.Resource]
|
|
1756
|
+
* file at `resource_path`.
|
|
1757
|
+
*
|
|
1758
|
+
* SPARQL Query files typically have the .rq extension. This will use
|
|
1759
|
+
* [method`Tracker`.SparqlConnection.query_statement] or [method`Tracker`.SparqlConnection.update_statement]
|
|
1760
|
+
* underneath to indistinctly return SPARQL query or update statements.
|
|
1761
|
+
* @param resource_path The resource path of the file to parse.
|
|
1762
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1763
|
+
* @returns A prepared statement
|
|
1436
1764
|
*/
|
|
1437
1765
|
load_statement_from_gresource(resource_path: string | null, cancellable: Gio.Cancellable | null): SparqlStatement | null
|
|
1438
1766
|
/**
|
|
1439
|
-
* Maps `
|
|
1440
|
-
*
|
|
1767
|
+
* Maps a `TrackerSparqlConnection` onto another through a `private:`handle_name`` URI.
|
|
1768
|
+
*
|
|
1769
|
+
* This can be accessed via the SERVICE SPARQL syntax in
|
|
1441
1770
|
* queries from `connection`. E.g.:
|
|
1442
1771
|
*
|
|
1772
|
+
* ```c
|
|
1773
|
+
* tracker_sparql_connection_map_connection (connection,
|
|
1774
|
+
* "other-connection",
|
|
1775
|
+
* other_connection);
|
|
1776
|
+
* ```
|
|
1777
|
+
*
|
|
1443
1778
|
* ```sparql
|
|
1444
1779
|
* SELECT ?u {
|
|
1445
1780
|
* SERVICE <private:other-connection> {
|
|
@@ -1449,32 +1784,45 @@ interface SparqlConnection {
|
|
|
1449
1784
|
* ```
|
|
1450
1785
|
*
|
|
1451
1786
|
* This is useful to interrelate data from multiple
|
|
1452
|
-
*
|
|
1787
|
+
* `TrackerSparqlConnection` instances maintained by the same process,
|
|
1453
1788
|
* without creating a public endpoint for `service_connection`.
|
|
1454
1789
|
*
|
|
1455
|
-
* `connection` may only be a
|
|
1456
|
-
*
|
|
1457
|
-
* @param handle_name
|
|
1458
|
-
* @param service_connection a
|
|
1790
|
+
* `connection` may only be a `TrackerSparqlConnection` created via
|
|
1791
|
+
* [ctor`Tracker`.SparqlConnection.new] and [func`Tracker`.SparqlConnection.new_async].
|
|
1792
|
+
* @param handle_name Handle name for `service_connection`
|
|
1793
|
+
* @param service_connection a `TrackerSparqlConnection` to use from `connection`
|
|
1459
1794
|
*/
|
|
1460
1795
|
map_connection(handle_name: string | null, service_connection: SparqlConnection): void
|
|
1461
1796
|
/**
|
|
1462
|
-
* Executes a SPARQL query on
|
|
1463
|
-
* it may block.
|
|
1797
|
+
* Executes a SPARQL query on `connection`.
|
|
1464
1798
|
*
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1799
|
+
* This method is synchronous and will block until the query
|
|
1800
|
+
* is executed. See [method`Tracker`.SparqlConnection.query_async]
|
|
1801
|
+
* for an asynchronous variant.
|
|
1802
|
+
*
|
|
1803
|
+
* If the query is partially built from user input or other
|
|
1804
|
+
* untrusted sources, special care is required about possible
|
|
1805
|
+
* SPARQL injection. In order to avoid it entirely, it is recommended
|
|
1806
|
+
* to use [class`Tracker`.SparqlStatement]. The function
|
|
1807
|
+
* [func`Tracker`.sparql_escape_string] exists as a last resort,
|
|
1808
|
+
* but its use is not recommended.
|
|
1809
|
+
* @param sparql String containing the SPARQL query
|
|
1810
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1811
|
+
* @returns a [class@Tracker.SparqlCursor] with the results.
|
|
1471
1812
|
*/
|
|
1472
1813
|
query(sparql: string | null, cancellable: Gio.Cancellable | null): SparqlCursor
|
|
1473
1814
|
/**
|
|
1474
|
-
* Executes asynchronously a SPARQL query
|
|
1475
|
-
*
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1815
|
+
* Executes asynchronously a SPARQL query on `connection`
|
|
1816
|
+
*
|
|
1817
|
+
* If the query is partially built from user input or other
|
|
1818
|
+
* untrusted sources, special care is required about possible
|
|
1819
|
+
* SPARQL injection. In order to avoid it entirely, it is recommended
|
|
1820
|
+
* to use [class`Tracker`.SparqlStatement]. The function
|
|
1821
|
+
* [func`Tracker`.sparql_escape_string] exists as a last resort,
|
|
1822
|
+
* but its use is not recommended.
|
|
1823
|
+
* @param sparql String containing the SPARQL query
|
|
1824
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1825
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1478
1826
|
*/
|
|
1479
1827
|
query_async(sparql: string | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
1480
1828
|
|
|
@@ -1483,42 +1831,52 @@ interface SparqlConnection {
|
|
|
1483
1831
|
/**
|
|
1484
1832
|
* Promisified version of {@link query_async}
|
|
1485
1833
|
*
|
|
1486
|
-
* Executes asynchronously a SPARQL query
|
|
1487
|
-
*
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1834
|
+
* Executes asynchronously a SPARQL query on `connection`
|
|
1835
|
+
*
|
|
1836
|
+
* If the query is partially built from user input or other
|
|
1837
|
+
* untrusted sources, special care is required about possible
|
|
1838
|
+
* SPARQL injection. In order to avoid it entirely, it is recommended
|
|
1839
|
+
* to use [class`Tracker`.SparqlStatement]. The function
|
|
1840
|
+
* [func`Tracker`.sparql_escape_string] exists as a last resort,
|
|
1841
|
+
* but its use is not recommended.
|
|
1842
|
+
* @param sparql String containing the SPARQL query
|
|
1843
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1844
|
+
* @returns A Promise of: a [class@Tracker.SparqlCursor] with the results.
|
|
1490
1845
|
*/
|
|
1491
1846
|
query_async(sparql: string | null, cancellable: Gio.Cancellable | null): globalThis.Promise<SparqlCursor>
|
|
1492
1847
|
/**
|
|
1493
|
-
* Finishes the
|
|
1494
|
-
* @param res
|
|
1495
|
-
* @returns a
|
|
1848
|
+
* Finishes the operation started with [method`Tracker`.SparqlConnection.query_async].
|
|
1849
|
+
* @param res A [type`Gio`.AsyncResult] with the result of the operation
|
|
1850
|
+
* @returns a [class@Tracker.SparqlCursor] with the results.
|
|
1496
1851
|
*/
|
|
1497
1852
|
query_finish(res: Gio.AsyncResult): SparqlCursor
|
|
1498
1853
|
/**
|
|
1499
|
-
* Prepares the given SELECT
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1502
|
-
*
|
|
1503
|
-
*
|
|
1504
|
-
* @
|
|
1854
|
+
* Prepares the given `SELECT`/`ASK`/`DESCRIBE`/`CONSTRUCT` SPARQL query as a
|
|
1855
|
+
* [class`Tracker`.SparqlStatement].
|
|
1856
|
+
*
|
|
1857
|
+
* This prepared statement can be executed through [method`Tracker`.SparqlStatement.execute]
|
|
1858
|
+
* or [method`Tracker`.SparqlStatement.serialize_async] families of functions.
|
|
1859
|
+
* @param sparql The SPARQL query
|
|
1860
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1861
|
+
* @returns A prepared statement
|
|
1505
1862
|
*/
|
|
1506
1863
|
query_statement(sparql: string | null, cancellable: Gio.Cancellable | null): SparqlStatement | null
|
|
1507
1864
|
/**
|
|
1508
|
-
* Serializes
|
|
1509
|
-
*
|
|
1510
|
-
* `callback` will be invoked when
|
|
1865
|
+
* Serializes a `DESCRIBE` or `CONSTRUCT` query into the specified RDF format.
|
|
1866
|
+
*
|
|
1867
|
+
* This is an asynchronous operation, `callback` will be invoked when
|
|
1868
|
+
* the data is available for reading.
|
|
1511
1869
|
*
|
|
1512
1870
|
* The SPARQL endpoint may not support the specified format, in that case
|
|
1513
1871
|
* an error will be raised.
|
|
1514
1872
|
*
|
|
1515
1873
|
* The `flags` argument is reserved for future expansions, currently
|
|
1516
1874
|
* %TRACKER_SERIALIZE_FLAGS_NONE must be passed.
|
|
1517
|
-
* @param flags
|
|
1518
|
-
* @param format
|
|
1875
|
+
* @param flags Serialization flags
|
|
1876
|
+
* @param format Output RDF format
|
|
1519
1877
|
* @param query SPARQL query
|
|
1520
|
-
* @param cancellable
|
|
1521
|
-
* @param callback
|
|
1878
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1879
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1522
1880
|
*/
|
|
1523
1881
|
serialize_async(flags: SerializeFlags, format: RdfFormat, query: string | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
1524
1882
|
|
|
@@ -1527,47 +1885,66 @@ interface SparqlConnection {
|
|
|
1527
1885
|
/**
|
|
1528
1886
|
* Promisified version of {@link serialize_async}
|
|
1529
1887
|
*
|
|
1530
|
-
* Serializes
|
|
1531
|
-
*
|
|
1532
|
-
* `callback` will be invoked when
|
|
1888
|
+
* Serializes a `DESCRIBE` or `CONSTRUCT` query into the specified RDF format.
|
|
1889
|
+
*
|
|
1890
|
+
* This is an asynchronous operation, `callback` will be invoked when
|
|
1891
|
+
* the data is available for reading.
|
|
1533
1892
|
*
|
|
1534
1893
|
* The SPARQL endpoint may not support the specified format, in that case
|
|
1535
1894
|
* an error will be raised.
|
|
1536
1895
|
*
|
|
1537
1896
|
* The `flags` argument is reserved for future expansions, currently
|
|
1538
1897
|
* %TRACKER_SERIALIZE_FLAGS_NONE must be passed.
|
|
1539
|
-
* @param flags
|
|
1540
|
-
* @param format
|
|
1898
|
+
* @param flags Serialization flags
|
|
1899
|
+
* @param format Output RDF format
|
|
1541
1900
|
* @param query SPARQL query
|
|
1542
|
-
* @param cancellable
|
|
1543
|
-
* @returns A Promise of:
|
|
1901
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1902
|
+
* @returns A Promise of: A [class@Gio.InputStream] to read RDF content.
|
|
1544
1903
|
*/
|
|
1545
1904
|
serialize_async(flags: SerializeFlags, format: RdfFormat, query: string | null, cancellable: Gio.Cancellable | null): globalThis.Promise<Gio.InputStream>
|
|
1546
1905
|
/**
|
|
1547
|
-
* Finishes
|
|
1548
|
-
*
|
|
1549
|
-
* @
|
|
1550
|
-
* @returns a #GInputStream to read RDF content.
|
|
1906
|
+
* Finishes the operation started with [method`Tracker`.SparqlConnection.serialize_async].
|
|
1907
|
+
* @param result A [type`Gio`.AsyncResult] with the result of the operation
|
|
1908
|
+
* @returns A [class@Gio.InputStream] to read RDF content.
|
|
1551
1909
|
*/
|
|
1552
1910
|
serialize_finish(result: Gio.AsyncResult): Gio.InputStream
|
|
1553
1911
|
/**
|
|
1554
|
-
* Executes a SPARQL update
|
|
1555
|
-
* synchronous, so it may block.
|
|
1912
|
+
* Executes a SPARQL update on `connection`.
|
|
1556
1913
|
*
|
|
1557
|
-
*
|
|
1558
|
-
*
|
|
1559
|
-
*
|
|
1560
|
-
*
|
|
1561
|
-
*
|
|
1914
|
+
* This method is synchronous and will block until the update
|
|
1915
|
+
* is finished. See [method`Tracker`.SparqlConnection.update_async]
|
|
1916
|
+
* for an asynchronous variant.
|
|
1917
|
+
*
|
|
1918
|
+
* It is recommented to consider the usage of [class`Tracker`.Batch]
|
|
1919
|
+
* to cluster database updates. Frequent isolated SPARQL updates
|
|
1920
|
+
* through this method will have a degraded performance in comparison.
|
|
1921
|
+
*
|
|
1922
|
+
* If the query is partially built from user input or other
|
|
1923
|
+
* untrusted sources, special care is required about possible
|
|
1924
|
+
* SPARQL injection. In order to avoid it entirely, it is recommended
|
|
1925
|
+
* to use [class`Tracker`.SparqlStatement], or to build the SPARQL
|
|
1926
|
+
* input through [class`Tracker`.Resource]. The function
|
|
1927
|
+
* [func`Tracker`.sparql_escape_string] exists as a last resort,
|
|
1928
|
+
* but its use is not recommended.
|
|
1929
|
+
* @param sparql String containing the SPARQL update query
|
|
1930
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1562
1931
|
*/
|
|
1563
1932
|
update(sparql: string | null, cancellable: Gio.Cancellable | null): void
|
|
1564
1933
|
/**
|
|
1565
1934
|
* Executes asynchronously an array of SPARQL updates. All updates in the
|
|
1566
1935
|
* array are handled within a single transaction.
|
|
1567
|
-
*
|
|
1568
|
-
*
|
|
1569
|
-
*
|
|
1570
|
-
*
|
|
1936
|
+
*
|
|
1937
|
+
* If the query is partially built from user input or other
|
|
1938
|
+
* untrusted sources, special care is required about possible
|
|
1939
|
+
* SPARQL injection. In order to avoid it entirely, it is recommended
|
|
1940
|
+
* to use [class`Tracker`.SparqlStatement], or to build the SPARQL
|
|
1941
|
+
* input through [class`Tracker`.Resource]. The function
|
|
1942
|
+
* [func`Tracker`.sparql_escape_string] exists as a last resort,
|
|
1943
|
+
* but its use is not recommended.
|
|
1944
|
+
* @param sparql An array of strings containing the SPARQL update queries
|
|
1945
|
+
* @param sparql_length The amount of strings you pass as `sparql`
|
|
1946
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1947
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1571
1948
|
*/
|
|
1572
1949
|
update_array_async(sparql: string | null, sparql_length: number, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
1573
1950
|
|
|
@@ -1578,23 +1955,43 @@ interface SparqlConnection {
|
|
|
1578
1955
|
*
|
|
1579
1956
|
* Executes asynchronously an array of SPARQL updates. All updates in the
|
|
1580
1957
|
* array are handled within a single transaction.
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1583
|
-
*
|
|
1958
|
+
*
|
|
1959
|
+
* If the query is partially built from user input or other
|
|
1960
|
+
* untrusted sources, special care is required about possible
|
|
1961
|
+
* SPARQL injection. In order to avoid it entirely, it is recommended
|
|
1962
|
+
* to use [class`Tracker`.SparqlStatement], or to build the SPARQL
|
|
1963
|
+
* input through [class`Tracker`.Resource]. The function
|
|
1964
|
+
* [func`Tracker`.sparql_escape_string] exists as a last resort,
|
|
1965
|
+
* but its use is not recommended.
|
|
1966
|
+
* @param sparql An array of strings containing the SPARQL update queries
|
|
1967
|
+
* @param sparql_length The amount of strings you pass as `sparql`
|
|
1968
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1584
1969
|
* @returns A Promise of: #TRUE if there were no errors.
|
|
1585
1970
|
*/
|
|
1586
1971
|
update_array_async(sparql: string | null, sparql_length: number, cancellable: Gio.Cancellable | null): globalThis.Promise<boolean>
|
|
1587
1972
|
/**
|
|
1588
|
-
* Finishes the
|
|
1589
|
-
* @param res
|
|
1973
|
+
* Finishes the operation started with [method`Tracker`.SparqlConnection.update_array_async].
|
|
1974
|
+
* @param res A [type`Gio`.AsyncResult] with the result of the operation
|
|
1590
1975
|
* @returns #TRUE if there were no errors.
|
|
1591
1976
|
*/
|
|
1592
1977
|
update_array_finish(res: Gio.AsyncResult): boolean
|
|
1593
1978
|
/**
|
|
1594
1979
|
* Executes asynchronously a SPARQL update.
|
|
1595
|
-
*
|
|
1596
|
-
*
|
|
1597
|
-
*
|
|
1980
|
+
*
|
|
1981
|
+
* It is recommented to consider the usage of [class`Tracker`.Batch]
|
|
1982
|
+
* to cluster database updates. Frequent isolated SPARQL updates
|
|
1983
|
+
* through this method will have a degraded performance in comparison.
|
|
1984
|
+
*
|
|
1985
|
+
* If the query is partially built from user input or other
|
|
1986
|
+
* untrusted sources, special care is required about possible
|
|
1987
|
+
* SPARQL injection. In order to avoid it entirely, it is recommended
|
|
1988
|
+
* to use [class`Tracker`.SparqlStatement], or to build the SPARQL
|
|
1989
|
+
* input through [class`Tracker`.Resource]. The function
|
|
1990
|
+
* [func`Tracker`.sparql_escape_string] exists as a last resort,
|
|
1991
|
+
* but its use is not recommended.
|
|
1992
|
+
* @param sparql String containing the SPARQL update query
|
|
1993
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1994
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1598
1995
|
*/
|
|
1599
1996
|
update_async(sparql: string | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
1600
1997
|
|
|
@@ -1604,17 +2001,32 @@ interface SparqlConnection {
|
|
|
1604
2001
|
* Promisified version of {@link update_async}
|
|
1605
2002
|
*
|
|
1606
2003
|
* Executes asynchronously a SPARQL update.
|
|
1607
|
-
*
|
|
1608
|
-
*
|
|
2004
|
+
*
|
|
2005
|
+
* It is recommented to consider the usage of [class`Tracker`.Batch]
|
|
2006
|
+
* to cluster database updates. Frequent isolated SPARQL updates
|
|
2007
|
+
* through this method will have a degraded performance in comparison.
|
|
2008
|
+
*
|
|
2009
|
+
* If the query is partially built from user input or other
|
|
2010
|
+
* untrusted sources, special care is required about possible
|
|
2011
|
+
* SPARQL injection. In order to avoid it entirely, it is recommended
|
|
2012
|
+
* to use [class`Tracker`.SparqlStatement], or to build the SPARQL
|
|
2013
|
+
* input through [class`Tracker`.Resource]. The function
|
|
2014
|
+
* [func`Tracker`.sparql_escape_string] exists as a last resort,
|
|
2015
|
+
* but its use is not recommended.
|
|
2016
|
+
* @param sparql String containing the SPARQL update query
|
|
2017
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1609
2018
|
* @returns A Promise of the result of {@link update_async}
|
|
1610
2019
|
*/
|
|
1611
2020
|
update_async(sparql: string | null, cancellable: Gio.Cancellable | null): globalThis.Promise<void>
|
|
1612
2021
|
/**
|
|
1613
|
-
* Executes a SPARQL update and returns the
|
|
1614
|
-
* if any. The API call is completely synchronous, so it may block.
|
|
2022
|
+
* Executes a SPARQL update and returns the names of the generated blank nodes.
|
|
1615
2023
|
*
|
|
1616
|
-
*
|
|
1617
|
-
*
|
|
2024
|
+
* This method is synchronous and will block until the update
|
|
2025
|
+
* is finished. See [method`Tracker`.SparqlConnection.update_blank_async]
|
|
2026
|
+
* for an asynchronous variant.
|
|
2027
|
+
*
|
|
2028
|
+
* The `sparql` query should be built with [class`Tracker`.Resource], or
|
|
2029
|
+
* its parts correctly escaped using [func`Tracker`.sparql_escape_string],
|
|
1618
2030
|
* otherwise SPARQL injection is possible.
|
|
1619
2031
|
*
|
|
1620
2032
|
* The format string of the `GVariant` is `aaa{ss}` (an array of an array
|
|
@@ -1623,18 +2035,19 @@ interface SparqlConnection {
|
|
|
1623
2035
|
* WHERE clause. The last array holds a string pair with the blank node name
|
|
1624
2036
|
* (e.g. `foo` for the blank node `_:foo`) and the URN that was generated for
|
|
1625
2037
|
* it. For most updates the first two outer arrays will only contain one item.
|
|
1626
|
-
* @param sparql
|
|
1627
|
-
* @param cancellable
|
|
1628
|
-
* @returns a
|
|
2038
|
+
* @param sparql String containing the SPARQL update query
|
|
2039
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2040
|
+
* @returns a [type@GLib.Variant] with the generated URNs.
|
|
1629
2041
|
*/
|
|
1630
2042
|
update_blank(sparql: string | null, cancellable: Gio.Cancellable | null): GLib.Variant
|
|
1631
2043
|
/**
|
|
1632
|
-
* Executes asynchronously a SPARQL update
|
|
1633
|
-
*
|
|
1634
|
-
*
|
|
1635
|
-
*
|
|
1636
|
-
* @param
|
|
1637
|
-
* @param
|
|
2044
|
+
* Executes asynchronously a SPARQL update and returns the names of the generated blank nodes.
|
|
2045
|
+
*
|
|
2046
|
+
* See the [method`Tracker`.SparqlConnection.update_blank] documentation to
|
|
2047
|
+
* learn the differences with [method`Tracker`.SparqlConnection.update].
|
|
2048
|
+
* @param sparql String containing the SPARQL update query
|
|
2049
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2050
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1638
2051
|
*/
|
|
1639
2052
|
update_blank_async(sparql: string | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
1640
2053
|
|
|
@@ -1643,45 +2056,56 @@ interface SparqlConnection {
|
|
|
1643
2056
|
/**
|
|
1644
2057
|
* Promisified version of {@link update_blank_async}
|
|
1645
2058
|
*
|
|
1646
|
-
* Executes asynchronously a SPARQL update
|
|
1647
|
-
*
|
|
1648
|
-
*
|
|
1649
|
-
*
|
|
1650
|
-
* @param
|
|
1651
|
-
* @
|
|
2059
|
+
* Executes asynchronously a SPARQL update and returns the names of the generated blank nodes.
|
|
2060
|
+
*
|
|
2061
|
+
* See the [method`Tracker`.SparqlConnection.update_blank] documentation to
|
|
2062
|
+
* learn the differences with [method`Tracker`.SparqlConnection.update].
|
|
2063
|
+
* @param sparql String containing the SPARQL update query
|
|
2064
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2065
|
+
* @returns A Promise of: a [type@GLib.Variant] with the generated URNs.
|
|
1652
2066
|
*/
|
|
1653
2067
|
update_blank_async(sparql: string | null, cancellable: Gio.Cancellable | null): globalThis.Promise<GLib.Variant>
|
|
1654
2068
|
/**
|
|
1655
|
-
* Finishes the
|
|
1656
|
-
*
|
|
1657
|
-
*
|
|
1658
|
-
*
|
|
1659
|
-
*
|
|
1660
|
-
* @
|
|
2069
|
+
* Finishes the operation started with [method`Tracker`.SparqlConnection.update_blank_async].
|
|
2070
|
+
*
|
|
2071
|
+
* This method returns the URNs of the generated nodes, if any. See the
|
|
2072
|
+
* [method`Tracker`.SparqlConnection.update_blank] documentation for the interpretation
|
|
2073
|
+
* of the returned [type`GLib`.Variant].
|
|
2074
|
+
* @param res A [type`Gio`.AsyncResult] with the result of the operation
|
|
2075
|
+
* @returns a [type@GLib.Variant] with the generated URNs.
|
|
1661
2076
|
*/
|
|
1662
2077
|
update_blank_finish(res: Gio.AsyncResult): GLib.Variant
|
|
1663
2078
|
/**
|
|
1664
|
-
* Finishes the
|
|
1665
|
-
* @param res
|
|
2079
|
+
* Finishes the operation started with [method`Tracker`.SparqlConnection.update_async].
|
|
2080
|
+
* @param res A [type`Gio`.AsyncResult] with the result of the operation
|
|
1666
2081
|
*/
|
|
1667
2082
|
update_finish(res: Gio.AsyncResult): void
|
|
1668
2083
|
/**
|
|
1669
|
-
* Inserts a resource as described by `resource
|
|
1670
|
-
*
|
|
2084
|
+
* Inserts a resource as described by `resource` on the given `graph`.
|
|
2085
|
+
*
|
|
2086
|
+
* This method is synchronous and will block until the update
|
|
2087
|
+
* is finished. See [method`Tracker`.SparqlConnection.update_resource_async]
|
|
2088
|
+
* for an asynchronous variant.
|
|
2089
|
+
*
|
|
2090
|
+
* It is recommented to consider the usage of [class`Tracker`.Batch]
|
|
2091
|
+
* to cluster database updates. Frequent isolated SPARQL updates
|
|
2092
|
+
* through this method will have a degraded performance in comparison.
|
|
1671
2093
|
* @param graph RDF graph where the resource should be inserted/updated, or %NULL for the default graph
|
|
1672
|
-
* @param resource
|
|
1673
|
-
* @param cancellable
|
|
2094
|
+
* @param resource A [class`Tracker`.Resource]
|
|
2095
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1674
2096
|
* @returns #TRUE if there were no errors.
|
|
1675
2097
|
*/
|
|
1676
2098
|
update_resource(graph: string | null, resource: Resource, cancellable: Gio.Cancellable | null): boolean
|
|
1677
2099
|
/**
|
|
1678
|
-
* Inserts a resource as described by `resource
|
|
1679
|
-
*
|
|
1680
|
-
*
|
|
2100
|
+
* Inserts asynchronously a resource as described by `resource` on the given `graph`.
|
|
2101
|
+
*
|
|
2102
|
+
* It is recommented to consider the usage of [class`Tracker`.Batch]
|
|
2103
|
+
* to cluster database updates. Frequent isolated SPARQL updates
|
|
2104
|
+
* through this method will have a degraded performance in comparison.
|
|
1681
2105
|
* @param graph RDF graph where the resource should be inserted/updated, or %NULL for the default graph
|
|
1682
|
-
* @param resource
|
|
1683
|
-
* @param cancellable
|
|
1684
|
-
* @param callback
|
|
2106
|
+
* @param resource A [class`Tracker`.Resource]
|
|
2107
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2108
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1685
2109
|
*/
|
|
1686
2110
|
update_resource_async(graph: string | null, resource: Resource, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
1687
2111
|
|
|
@@ -1690,28 +2114,31 @@ interface SparqlConnection {
|
|
|
1690
2114
|
/**
|
|
1691
2115
|
* Promisified version of {@link update_resource_async}
|
|
1692
2116
|
*
|
|
1693
|
-
* Inserts a resource as described by `resource
|
|
1694
|
-
*
|
|
1695
|
-
*
|
|
2117
|
+
* Inserts asynchronously a resource as described by `resource` on the given `graph`.
|
|
2118
|
+
*
|
|
2119
|
+
* It is recommented to consider the usage of [class`Tracker`.Batch]
|
|
2120
|
+
* to cluster database updates. Frequent isolated SPARQL updates
|
|
2121
|
+
* through this method will have a degraded performance in comparison.
|
|
1696
2122
|
* @param graph RDF graph where the resource should be inserted/updated, or %NULL for the default graph
|
|
1697
|
-
* @param resource
|
|
1698
|
-
* @param cancellable
|
|
2123
|
+
* @param resource A [class`Tracker`.Resource]
|
|
2124
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
1699
2125
|
* @returns A Promise of: #TRUE if there were no errors.
|
|
1700
2126
|
*/
|
|
1701
2127
|
update_resource_async(graph: string | null, resource: Resource, cancellable: Gio.Cancellable | null): globalThis.Promise<boolean>
|
|
1702
2128
|
/**
|
|
1703
|
-
* Finishes
|
|
1704
|
-
* @param res
|
|
2129
|
+
* Finishes the operation started with [method`Tracker`.SparqlConnection.update_resource_async].
|
|
2130
|
+
* @param res A [type`Gio`.AsyncResult] with the result of the operation
|
|
1705
2131
|
* @returns #TRUE if there were no errors.
|
|
1706
2132
|
*/
|
|
1707
2133
|
update_resource_finish(res: Gio.AsyncResult): boolean
|
|
1708
2134
|
/**
|
|
1709
|
-
* Prepares the given INSERT
|
|
1710
|
-
*
|
|
1711
|
-
*
|
|
1712
|
-
*
|
|
1713
|
-
* @param
|
|
1714
|
-
* @
|
|
2135
|
+
* Prepares the given `INSERT`/`DELETE` SPARQL as a [class`Tracker`.SparqlStatement].
|
|
2136
|
+
*
|
|
2137
|
+
* This prepared statement can be executed through
|
|
2138
|
+
* the [method`Tracker`.SparqlStatement.update] family of functions.
|
|
2139
|
+
* @param sparql The SPARQL update
|
|
2140
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2141
|
+
* @returns A prepared statement
|
|
1715
2142
|
*/
|
|
1716
2143
|
update_statement(sparql: string | null, cancellable: Gio.Cancellable | null): SparqlStatement | null
|
|
1717
2144
|
|
|
@@ -1724,8 +2151,65 @@ interface SparqlConnection {
|
|
|
1724
2151
|
}
|
|
1725
2152
|
|
|
1726
2153
|
/**
|
|
1727
|
-
*
|
|
1728
|
-
*
|
|
2154
|
+
* `TrackerSparqlConnection` holds a connection to a RDF triple store.
|
|
2155
|
+
*
|
|
2156
|
+
* This triple store may be of three types:
|
|
2157
|
+
*
|
|
2158
|
+
* - Local to the process, created through [ctor`Tracker`.SparqlConnection.new].
|
|
2159
|
+
* - A HTTP SPARQL endpoint over the network, created through
|
|
2160
|
+
* [ctor`Tracker`.SparqlConnection.remote_new]
|
|
2161
|
+
* - A DBus SPARQL endpoint owned by another process in the same machine, created
|
|
2162
|
+
* through [ctor`Tracker`.SparqlConnection.bus_new]
|
|
2163
|
+
*
|
|
2164
|
+
* When creating a local triple store, it is required to give details about its
|
|
2165
|
+
* structure. This is done by passing a location to an ontology, see more
|
|
2166
|
+
* on how are [ontologies defined](ontologies.html). A local database may be
|
|
2167
|
+
* stored in a filesystem location, or it may reside in memory.
|
|
2168
|
+
*
|
|
2169
|
+
* A `TrackerSparqlConnection` is private to the calling process, it can be
|
|
2170
|
+
* exposed to other hosts/processes via a [class`Tracker`.Endpoint], see
|
|
2171
|
+
* [ctor`Tracker`.EndpointDBus.new] and [ctor`Tracker`.EndpointHttp.new].
|
|
2172
|
+
*
|
|
2173
|
+
* When issuing SPARQL queries and updates, it is recommended that these are
|
|
2174
|
+
* created through [class`Tracker`.SparqlStatement] to avoid the SPARQL
|
|
2175
|
+
* injection class of bugs, see [method`Tracker`.SparqlConnection.query_statement]
|
|
2176
|
+
* and [method`Tracker`.SparqlConnection.update_statement]. For SPARQL updates
|
|
2177
|
+
* it is also possible to use a "builder" approach to generate RDF data, see
|
|
2178
|
+
* [class`Tracker`.Resource]. It is also possible to create [class`Tracker`.SparqlStatement]
|
|
2179
|
+
* objects for SPARQL queries and updates from SPARQL strings embedded in a
|
|
2180
|
+
* [struct`Gio`.Resource], see [method`Tracker`.SparqlConnection.load_statement_from_gresource].
|
|
2181
|
+
*
|
|
2182
|
+
* To get the best performance, it is recommended that SPARQL updates are clustered
|
|
2183
|
+
* through [class`Tracker`.Batch].
|
|
2184
|
+
*
|
|
2185
|
+
* `TrackerSparqlConnection` also offers a number of methods for the simple cases,
|
|
2186
|
+
* [method`Tracker`.SparqlConnection.query] may be used when there is a SPARQL
|
|
2187
|
+
* query string directly available, and the [method`Tracker`.SparqlConnection.update]
|
|
2188
|
+
* family of functions may be used for one-off updates. All functions have asynchronous
|
|
2189
|
+
* variants.
|
|
2190
|
+
*
|
|
2191
|
+
* When a SPARQL query is executed, a [class`Tracker`.SparqlCursor] will be obtained
|
|
2192
|
+
* to iterate over the query results.
|
|
2193
|
+
*
|
|
2194
|
+
* Depending on the ontology definition, `TrackerSparqlConnection` may emit
|
|
2195
|
+
* notifications whenever resources of certain types get insert, modified or
|
|
2196
|
+
* deleted from the triple store (see [nrl:notify](nrl-ontology.html#nrl:notify).
|
|
2197
|
+
* These notifications can be handled via a [class`Tracker`.Notifier] obtained with
|
|
2198
|
+
* [method`Tracker`.SparqlConnection.create_notifier].
|
|
2199
|
+
*
|
|
2200
|
+
* After done with a connection, it is recommended to call [method`Tracker`.SparqlConnection.close]
|
|
2201
|
+
* or [method`Tracker`.SparqlConnection.close_async] explicitly to cleanly close the
|
|
2202
|
+
* connection and prevent consistency checks on future runs. The triple store
|
|
2203
|
+
* connection will be implicitly closed when the `TrackerSparqlConnection` object
|
|
2204
|
+
* is disposed.
|
|
2205
|
+
*
|
|
2206
|
+
* A `TrackerSparqlConnection` may be used from multiple threads, asynchronous
|
|
2207
|
+
* updates are executed sequentially on arrival order, asynchronous
|
|
2208
|
+
* queries are dispatched in a thread pool.
|
|
2209
|
+
*
|
|
2210
|
+
* If you ever have the need to procedurally compose SPARQL query strings, consider
|
|
2211
|
+
* the use of [func`Tracker`.sparql_escape_string] for literal strings and
|
|
2212
|
+
* the [func`Tracker`.sparql_escape_uri] family of functions for URIs.
|
|
1729
2213
|
* @class
|
|
1730
2214
|
*/
|
|
1731
2215
|
class SparqlConnection extends GObject.Object {
|
|
@@ -1740,115 +2224,141 @@ class SparqlConnection extends GObject.Object {
|
|
|
1740
2224
|
constructor(config?: SparqlConnection.ConstructorProperties)
|
|
1741
2225
|
/**
|
|
1742
2226
|
* Connects to a database owned by another process on the
|
|
1743
|
-
* local machine.
|
|
2227
|
+
* local machine via DBus.
|
|
1744
2228
|
* @constructor
|
|
1745
2229
|
* @param service_name The name of the D-Bus service to connect to.
|
|
1746
2230
|
* @param object_path The path to the object, or %NULL to use the default.
|
|
1747
|
-
* @param dbus_connection The
|
|
1748
|
-
* @returns a new
|
|
2231
|
+
* @param dbus_connection The [type`Gio`.DBusConnection] to use, or %NULL to use the session bus
|
|
2232
|
+
* @returns a new `TrackerSparqlConnection`.
|
|
1749
2233
|
*/
|
|
1750
2234
|
static bus_new(service_name: string | null, object_path: string | null, dbus_connection: Gio.DBusConnection | null): SparqlConnection
|
|
1751
2235
|
/**
|
|
1752
|
-
*
|
|
2236
|
+
* Finishes the operation started with [func`Tracker`.SparqlConnection.bus_new_async].
|
|
1753
2237
|
* @constructor
|
|
1754
|
-
* @param result the
|
|
1755
|
-
* @returns a new
|
|
2238
|
+
* @param result A [type`Gio`.AsyncResult] with the result of the operation
|
|
2239
|
+
* @returns a new `TrackerSparqlConnection`.
|
|
1756
2240
|
*/
|
|
1757
2241
|
static bus_new_finish(result: Gio.AsyncResult): SparqlConnection
|
|
1758
2242
|
/**
|
|
1759
|
-
* Creates or opens a database.
|
|
2243
|
+
* Creates or opens a process-local database.
|
|
1760
2244
|
*
|
|
1761
2245
|
* This method should only be used for databases owned by the current process.
|
|
1762
2246
|
* To connect to databases managed by other processes, use
|
|
1763
|
-
*
|
|
2247
|
+
* [ctor`Tracker`.SparqlConnection.bus_new].
|
|
1764
2248
|
*
|
|
1765
2249
|
* If `store` is %NULL, the database will be created in memory.
|
|
1766
2250
|
*
|
|
1767
|
-
*
|
|
1768
|
-
* `.ontology` files in Turtle format. These
|
|
1769
|
-
*
|
|
1770
|
-
*
|
|
1771
|
-
*
|
|
1772
|
-
*
|
|
1773
|
-
*
|
|
1774
|
-
*
|
|
1775
|
-
*
|
|
1776
|
-
*
|
|
1777
|
-
*
|
|
1778
|
-
*
|
|
1779
|
-
*
|
|
1780
|
-
*
|
|
2251
|
+
* If defined, the `ontology` argument must point to a location containing
|
|
2252
|
+
* suitable `.ontology` files in Turtle format. These define the structure of
|
|
2253
|
+
* the triple store. You can learn more about [ontologies](ontologies.html),
|
|
2254
|
+
* or you can use the stock Nepomuk ontologies by calling
|
|
2255
|
+
* [func`Tracker`.sparql_get_ontology_nepomuk].
|
|
2256
|
+
*
|
|
2257
|
+
* If opening an existing database, it is possible to pass %NULL as the
|
|
2258
|
+
* `ontology` location, the ontology will be introspected from the database.
|
|
2259
|
+
* Passing a %NULL `ontology` will raise an error if the database does not exist.
|
|
2260
|
+
*
|
|
2261
|
+
* If a database is opened without the #TRACKER_SPARQL_CONNECTION_FLAG_READONLY
|
|
2262
|
+
* flag enabled, and the given `ontology` holds differences with the current
|
|
2263
|
+
* data layout, migration to the new structure will be attempted. This operation
|
|
2264
|
+
* may raise an error. In particular, not all migrations are possible without
|
|
2265
|
+
* causing data loss and Tracker will refuse to delete data during a migration.
|
|
2266
|
+
* The database is always left in a consistent state, either prior or posterior
|
|
2267
|
+
* to migration.
|
|
2268
|
+
*
|
|
2269
|
+
* It is considered a developer error to ship ontologies that contain format
|
|
2270
|
+
* errors, or that fail at migrations.
|
|
2271
|
+
*
|
|
2272
|
+
* It is encouraged to use `resource:///` URI locations for `ontology` wherever
|
|
2273
|
+
* possible, so the triple store structure is tied to the executable binary,
|
|
2274
|
+
* and in order to minimize disk seeks during `TrackerSparqlConnection`
|
|
2275
|
+
* initialization.
|
|
1781
2276
|
* @constructor
|
|
1782
|
-
* @param flags
|
|
1783
|
-
* @param store
|
|
1784
|
-
* @param ontology
|
|
1785
|
-
* @param cancellable
|
|
1786
|
-
* @returns a new
|
|
2277
|
+
* @param flags Connection flags to define the SPARQL connection behavior
|
|
2278
|
+
* @param store The directory that contains the database as a [iface`Gio`.File], or %NULL
|
|
2279
|
+
* @param ontology The directory that contains the database schemas as a [iface`Gio`.File], or %NULL
|
|
2280
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2281
|
+
* @returns a new `TrackerSparqlConnection`.
|
|
1787
2282
|
*/
|
|
1788
2283
|
constructor(flags: SparqlConnectionFlags, store: Gio.File | null, ontology: Gio.File | null, cancellable: Gio.Cancellable | null)
|
|
1789
2284
|
/**
|
|
1790
|
-
* Creates or opens a database.
|
|
2285
|
+
* Creates or opens a process-local database.
|
|
1791
2286
|
*
|
|
1792
2287
|
* This method should only be used for databases owned by the current process.
|
|
1793
2288
|
* To connect to databases managed by other processes, use
|
|
1794
|
-
*
|
|
2289
|
+
* [ctor`Tracker`.SparqlConnection.bus_new].
|
|
1795
2290
|
*
|
|
1796
2291
|
* If `store` is %NULL, the database will be created in memory.
|
|
1797
2292
|
*
|
|
1798
|
-
*
|
|
1799
|
-
* `.ontology` files in Turtle format. These
|
|
1800
|
-
*
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1803
|
-
*
|
|
1804
|
-
*
|
|
1805
|
-
*
|
|
1806
|
-
*
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
*
|
|
1811
|
-
*
|
|
2293
|
+
* If defined, the `ontology` argument must point to a location containing
|
|
2294
|
+
* suitable `.ontology` files in Turtle format. These define the structure of
|
|
2295
|
+
* the triple store. You can learn more about [ontologies](ontologies.html),
|
|
2296
|
+
* or you can use the stock Nepomuk ontologies by calling
|
|
2297
|
+
* [func`Tracker`.sparql_get_ontology_nepomuk].
|
|
2298
|
+
*
|
|
2299
|
+
* If opening an existing database, it is possible to pass %NULL as the
|
|
2300
|
+
* `ontology` location, the ontology will be introspected from the database.
|
|
2301
|
+
* Passing a %NULL `ontology` will raise an error if the database does not exist.
|
|
2302
|
+
*
|
|
2303
|
+
* If a database is opened without the #TRACKER_SPARQL_CONNECTION_FLAG_READONLY
|
|
2304
|
+
* flag enabled, and the given `ontology` holds differences with the current
|
|
2305
|
+
* data layout, migration to the new structure will be attempted. This operation
|
|
2306
|
+
* may raise an error. In particular, not all migrations are possible without
|
|
2307
|
+
* causing data loss and Tracker will refuse to delete data during a migration.
|
|
2308
|
+
* The database is always left in a consistent state, either prior or posterior
|
|
2309
|
+
* to migration.
|
|
2310
|
+
*
|
|
2311
|
+
* It is considered a developer error to ship ontologies that contain format
|
|
2312
|
+
* errors, or that fail at migrations.
|
|
2313
|
+
*
|
|
2314
|
+
* It is encouraged to use `resource:///` URI locations for `ontology` wherever
|
|
2315
|
+
* possible, so the triple store structure is tied to the executable binary,
|
|
2316
|
+
* and in order to minimize disk seeks during `TrackerSparqlConnection`
|
|
2317
|
+
* initialization.
|
|
1812
2318
|
* @constructor
|
|
1813
|
-
* @param flags
|
|
1814
|
-
* @param store
|
|
1815
|
-
* @param ontology
|
|
1816
|
-
* @param cancellable
|
|
1817
|
-
* @returns a new
|
|
2319
|
+
* @param flags Connection flags to define the SPARQL connection behavior
|
|
2320
|
+
* @param store The directory that contains the database as a [iface`Gio`.File], or %NULL
|
|
2321
|
+
* @param ontology The directory that contains the database schemas as a [iface`Gio`.File], or %NULL
|
|
2322
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2323
|
+
* @returns a new `TrackerSparqlConnection`.
|
|
1818
2324
|
*/
|
|
1819
2325
|
static new(flags: SparqlConnectionFlags, store: Gio.File | null, ontology: Gio.File | null, cancellable: Gio.Cancellable | null): SparqlConnection
|
|
1820
2326
|
/**
|
|
1821
|
-
*
|
|
2327
|
+
* Finishes the operation started with [func`Tracker`.SparqlConnection.new_async].
|
|
1822
2328
|
* @constructor
|
|
1823
|
-
* @param result the
|
|
2329
|
+
* @param result A [type`Gio`.AsyncResult] with the result of the operation
|
|
1824
2330
|
*/
|
|
1825
2331
|
static new_finish(result: Gio.AsyncResult): SparqlConnection
|
|
1826
2332
|
/**
|
|
1827
|
-
*
|
|
1828
|
-
*
|
|
2333
|
+
* Creates a connection to a remote HTTP SPARQL endpoint.
|
|
2334
|
+
*
|
|
2335
|
+
* The connection is made using the libsoup HTTP library. The connection will
|
|
2336
|
+
* normally use the `https://` or `http://` protocols.
|
|
1829
2337
|
* @constructor
|
|
1830
2338
|
* @param uri_base Base URI of the remote connection
|
|
1831
|
-
* @returns a new remote
|
|
2339
|
+
* @returns a new remote `TrackerSparqlConnection`.
|
|
1832
2340
|
*/
|
|
1833
2341
|
static remote_new(uri_base: string | null): SparqlConnection
|
|
1834
2342
|
_init(config?: SparqlConnection.ConstructorProperties): void
|
|
1835
2343
|
/**
|
|
1836
|
-
*
|
|
1837
|
-
*
|
|
1838
|
-
*
|
|
1839
|
-
* @param
|
|
1840
|
-
* @param
|
|
1841
|
-
* @param
|
|
2344
|
+
* Creates or opens a process-local database asynchronously.
|
|
2345
|
+
*
|
|
2346
|
+
* See [ctor`Tracker`.SparqlConnection.new] for more information.
|
|
2347
|
+
* @param flags Connection flags to define the SPARQL connection behavior
|
|
2348
|
+
* @param store The directory that contains the database as a [iface`Gio`.File], or %NULL
|
|
2349
|
+
* @param ontology The directory that contains the database schemas as a [iface`Gio`.File], or %NULL
|
|
2350
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2351
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1842
2352
|
*/
|
|
1843
2353
|
static new_async(flags: SparqlConnectionFlags, store: Gio.File | null, ontology: Gio.File | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<SparqlConnection> | null): void
|
|
1844
2354
|
/**
|
|
1845
|
-
* Connects to a database owned by another process on the
|
|
1846
|
-
* local machine
|
|
2355
|
+
* Connects asynchronously to a database owned by another process on the
|
|
2356
|
+
* local machine via DBus.
|
|
1847
2357
|
* @param service_name The name of the D-Bus service to connect to.
|
|
1848
2358
|
* @param object_path The path to the object, or %NULL to use the default.
|
|
1849
|
-
* @param dbus_connection The
|
|
1850
|
-
* @param cancellable
|
|
1851
|
-
* @param callback
|
|
2359
|
+
* @param dbus_connection The [class`Gio`.DBusConnection] to use, or %NULL to use the session bus
|
|
2360
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2361
|
+
* @param callback User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
1852
2362
|
*/
|
|
1853
2363
|
static bus_new_async(service_name: string | null, object_path: string | null, dbus_connection: Gio.DBusConnection | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<SparqlConnection> | null): void
|
|
1854
2364
|
}
|
|
@@ -1862,7 +2372,7 @@ module SparqlCursor {
|
|
|
1862
2372
|
// Own constructor properties of Tracker-3.0.Tracker.SparqlCursor
|
|
1863
2373
|
|
|
1864
2374
|
/**
|
|
1865
|
-
* The
|
|
2375
|
+
* The [class`Tracker`.SparqlConnection] used to retrieve the results.
|
|
1866
2376
|
*/
|
|
1867
2377
|
connection?: SparqlConnection | null
|
|
1868
2378
|
}
|
|
@@ -1874,9 +2384,12 @@ interface SparqlCursor {
|
|
|
1874
2384
|
// Own properties of Tracker-3.0.Tracker.SparqlCursor
|
|
1875
2385
|
|
|
1876
2386
|
/**
|
|
1877
|
-
* The
|
|
2387
|
+
* The [class`Tracker`.SparqlConnection] used to retrieve the results.
|
|
1878
2388
|
*/
|
|
1879
2389
|
readonly connection: SparqlConnection
|
|
2390
|
+
/**
|
|
2391
|
+
* Number of columns available in the result set.
|
|
2392
|
+
*/
|
|
1880
2393
|
readonly n_columns: number
|
|
1881
2394
|
|
|
1882
2395
|
// Own fields of Tracker-3.0.Tracker.SparqlCursor
|
|
@@ -1886,82 +2399,124 @@ interface SparqlCursor {
|
|
|
1886
2399
|
// Owm methods of Tracker-3.0.Tracker.SparqlCursor
|
|
1887
2400
|
|
|
1888
2401
|
/**
|
|
1889
|
-
* Closes the
|
|
2402
|
+
* Closes the cursor. The object can only be freed after this call.
|
|
1890
2403
|
*/
|
|
1891
2404
|
close(): void
|
|
1892
2405
|
/**
|
|
1893
2406
|
* Retrieve a boolean for the current row in `column`.
|
|
2407
|
+
*
|
|
2408
|
+
* If the row/column do not have a boolean value, the result is
|
|
2409
|
+
* undefined, see [method`Tracker`.SparqlCursor.get_value_type].
|
|
1894
2410
|
* @param column column number to retrieve (first one is 0)
|
|
1895
|
-
* @returns a
|
|
2411
|
+
* @returns a boolean value.
|
|
1896
2412
|
*/
|
|
1897
2413
|
get_boolean(column: number): boolean
|
|
1898
2414
|
/**
|
|
1899
|
-
* Returns the
|
|
1900
|
-
*
|
|
1901
|
-
* @returns the cursor
|
|
2415
|
+
* Returns the [class`Tracker`.SparqlConnection] associated with this
|
|
2416
|
+
* `TrackerSparqlCursor`.
|
|
2417
|
+
* @returns the cursor [class@Tracker.SparqlConnection]. The returned object must not be unreferenced by the caller.
|
|
1902
2418
|
*/
|
|
1903
2419
|
get_connection(): SparqlConnection
|
|
1904
2420
|
/**
|
|
1905
|
-
*
|
|
1906
|
-
* @param column
|
|
1907
|
-
* @returns
|
|
2421
|
+
* Retrieves a [type`GLib`.DateTime] pointer for the current row in `column`.
|
|
2422
|
+
* @param column Column number to retrieve (first one is 0)
|
|
2423
|
+
* @returns [type@GLib.DateTime] object, or %NULL if the given column does not contain a [xsd:date](xsd-ontology.html#xsd:date) or [xsd:dateTime](xsd-ontology.html#xsd:dateTime).
|
|
1908
2424
|
*/
|
|
1909
2425
|
get_datetime(column: number): GLib.DateTime | null
|
|
1910
2426
|
/**
|
|
1911
2427
|
* Retrieve a double for the current row in `column`.
|
|
2428
|
+
*
|
|
2429
|
+
* If the row/column do not have a integer or double value, the result is
|
|
2430
|
+
* undefined, see [method`Tracker`.SparqlCursor.get_value_type].
|
|
1912
2431
|
* @param column column number to retrieve (first one is 0)
|
|
1913
|
-
* @returns a double.
|
|
2432
|
+
* @returns a double value.
|
|
1914
2433
|
*/
|
|
1915
2434
|
get_double(column: number): number
|
|
1916
2435
|
/**
|
|
1917
2436
|
* Retrieve an integer for the current row in `column`.
|
|
2437
|
+
*
|
|
2438
|
+
* If the row/column do not have an integer value, the result is
|
|
2439
|
+
* undefined, see [method`Tracker`.SparqlCursor.get_value_type].
|
|
1918
2440
|
* @param column column number to retrieve (first one is 0)
|
|
1919
|
-
* @returns a
|
|
2441
|
+
* @returns a 64-bit integer value.
|
|
1920
2442
|
*/
|
|
1921
2443
|
get_integer(column: number): number
|
|
1922
2444
|
/**
|
|
2445
|
+
* Retrieves the number of columns available in the result set.
|
|
2446
|
+
*
|
|
1923
2447
|
* This method should only be called after a successful
|
|
1924
|
-
*
|
|
2448
|
+
* [method`Tracker`.SparqlCursor.next], otherwise its return value
|
|
1925
2449
|
* will be undefined.
|
|
1926
|
-
* @returns
|
|
2450
|
+
* @returns The number of columns returned in the result set.
|
|
1927
2451
|
*/
|
|
1928
2452
|
get_n_columns(): number
|
|
1929
2453
|
/**
|
|
1930
2454
|
* Retrieves a string representation of the data in the current
|
|
1931
2455
|
* row in `column`.
|
|
2456
|
+
*
|
|
2457
|
+
* Any type may be converted to a string. If the value is not bound
|
|
2458
|
+
* (See [method`Tracker`.SparqlCursor.is_bound]) this method will return %NULL.
|
|
1932
2459
|
* @param column column number to retrieve (first one is 0)
|
|
1933
|
-
* @returns a string which must not be freed. %NULL is returned if the column is not in the [0
|
|
2460
|
+
* @returns a string which must not be freed. %NULL is returned if the column is not in the `[0, n_columns]` range, or if the row/column refer to a nullable optional value in the result set.
|
|
1934
2461
|
*/
|
|
1935
2462
|
get_string(column: number): [ /* returnType */ string | null, /* length */ number | null ]
|
|
1936
2463
|
/**
|
|
1937
|
-
*
|
|
2464
|
+
* Returns the data type bound to the current row and the given `column`.
|
|
2465
|
+
*
|
|
2466
|
+
* If the column is unbound, the value will be %TRACKER_SPARQL_VALUE_TYPE_UNBOUND.
|
|
2467
|
+
* See also [method`Tracker`.SparqlCursor.is_bound].
|
|
2468
|
+
*
|
|
2469
|
+
* Values of type #TRACKER_SPARQL_VALUE_TYPE_RESOURCE and
|
|
2470
|
+
* #TRACKER_SPARQL_VALUE_TYPE_BLANK_NODE can be considered equivalent, the
|
|
2471
|
+
* difference is the resource being referenced as a named IRI or a blank
|
|
2472
|
+
* node.
|
|
2473
|
+
*
|
|
2474
|
+
* All other [enum`Tracker`.SparqlValueType] value types refer to literal values.
|
|
1938
2475
|
* @param column column number to retrieve (first one is 0)
|
|
1939
|
-
* @returns a
|
|
2476
|
+
* @returns a [enum@Tracker.SparqlValueType] expressing the content type of the given column for the current row.
|
|
1940
2477
|
*/
|
|
1941
2478
|
get_value_type(column: number): SparqlValueType
|
|
1942
2479
|
/**
|
|
1943
|
-
* Retrieves the
|
|
2480
|
+
* Retrieves the name of the given `column`.
|
|
2481
|
+
*
|
|
2482
|
+
* This name will be defined at the SPARQL query, either
|
|
2483
|
+
* implicitly from the names of the variables returned in
|
|
2484
|
+
* the resultset, or explicitly through the `AS ?var` SPARQL
|
|
2485
|
+
* syntax.
|
|
1944
2486
|
* @param column column number to retrieve (first one is 0)
|
|
1945
|
-
* @returns
|
|
2487
|
+
* @returns The name of the given column.
|
|
1946
2488
|
*/
|
|
1947
2489
|
get_variable_name(column: number): string | null
|
|
1948
2490
|
/**
|
|
1949
|
-
*
|
|
2491
|
+
* Returns whether the given `column` has a bound value in the current row.
|
|
2492
|
+
*
|
|
2493
|
+
* This may not be the case through e.g. the `OPTIONAL { }` SPARQL syntax.
|
|
1950
2494
|
* @param column column number to retrieve (first one is 0)
|
|
1951
2495
|
* @returns a %TRUE or %FALSE.
|
|
1952
2496
|
*/
|
|
1953
2497
|
is_bound(column: number): boolean
|
|
1954
2498
|
/**
|
|
1955
|
-
* Iterates to the next result.
|
|
1956
|
-
*
|
|
1957
|
-
*
|
|
1958
|
-
*
|
|
2499
|
+
* Iterates the cursor to the next result.
|
|
2500
|
+
*
|
|
2501
|
+
* If the cursor was not started, it will point to the first result after
|
|
2502
|
+
* this call. This operation is completely synchronous and it may block,
|
|
2503
|
+
* see [method`Tracker`.SparqlCursor.next_async] for an asynchronous variant.
|
|
2504
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2505
|
+
* @returns %FALSE if there are no more results or if an error is found, otherwise %TRUE.
|
|
1959
2506
|
*/
|
|
1960
2507
|
next(cancellable: Gio.Cancellable | null): boolean
|
|
1961
2508
|
/**
|
|
1962
|
-
* Iterates
|
|
1963
|
-
*
|
|
1964
|
-
*
|
|
2509
|
+
* Iterates the cursor asyncronously to the next result.
|
|
2510
|
+
*
|
|
2511
|
+
* If the cursor was not started, it will point to the first result after
|
|
2512
|
+
* this operation completes.
|
|
2513
|
+
*
|
|
2514
|
+
* In the period between this call and the corresponding
|
|
2515
|
+
* [method`Tracker`.SparqlCursor.next_finish] call, the other cursor methods
|
|
2516
|
+
* should not be used, nor their results trusted. The cursor should only
|
|
2517
|
+
* be iterated once at a time.
|
|
2518
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2519
|
+
* @param callback user-defined [type`Gio`.AsyncReadyCallback] to be called when asynchronous operation is finished.
|
|
1965
2520
|
*/
|
|
1966
2521
|
next_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
1967
2522
|
|
|
@@ -1970,15 +2525,24 @@ interface SparqlCursor {
|
|
|
1970
2525
|
/**
|
|
1971
2526
|
* Promisified version of {@link next_async}
|
|
1972
2527
|
*
|
|
1973
|
-
* Iterates
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
2528
|
+
* Iterates the cursor asyncronously to the next result.
|
|
2529
|
+
*
|
|
2530
|
+
* If the cursor was not started, it will point to the first result after
|
|
2531
|
+
* this operation completes.
|
|
2532
|
+
*
|
|
2533
|
+
* In the period between this call and the corresponding
|
|
2534
|
+
* [method`Tracker`.SparqlCursor.next_finish] call, the other cursor methods
|
|
2535
|
+
* should not be used, nor their results trusted. The cursor should only
|
|
2536
|
+
* be iterated once at a time.
|
|
2537
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2538
|
+
* @returns A Promise of: %FALSE if there are no more results or if an error is found, otherwise %TRUE.
|
|
1976
2539
|
*/
|
|
1977
2540
|
next_async(cancellable: Gio.Cancellable | null): globalThis.Promise<boolean>
|
|
1978
2541
|
/**
|
|
1979
|
-
* Finishes the asynchronous iteration to the next result
|
|
1980
|
-
*
|
|
1981
|
-
* @
|
|
2542
|
+
* Finishes the asynchronous iteration to the next result started with
|
|
2543
|
+
* [method`Tracker`.SparqlCursor.next_async].
|
|
2544
|
+
* @param res a [type`Gio`.AsyncResult] with the result of the operation
|
|
2545
|
+
* @returns %FALSE if there are no more results or if an error is found, otherwise %TRUE.
|
|
1982
2546
|
*/
|
|
1983
2547
|
next_finish(res: Gio.AsyncResult): boolean
|
|
1984
2548
|
/**
|
|
@@ -2001,8 +2565,31 @@ interface SparqlCursor {
|
|
|
2001
2565
|
}
|
|
2002
2566
|
|
|
2003
2567
|
/**
|
|
2004
|
-
*
|
|
2005
|
-
*
|
|
2568
|
+
* `TrackerSparqlCursor` provides the methods to iterate the results of a SPARQL query.
|
|
2569
|
+
*
|
|
2570
|
+
* Cursors are obtained through e.g. [method`Tracker`.SparqlStatement.execute]
|
|
2571
|
+
* or [method`Tracker`.SparqlConnection.query] after the SPARQL query has been
|
|
2572
|
+
* executed.
|
|
2573
|
+
*
|
|
2574
|
+
* When created, a cursor does not point to any element, [method`Tracker`.SparqlCursor.next]
|
|
2575
|
+
* is necessary to iterate one by one to the first (and following) results.
|
|
2576
|
+
* When the cursor iterated across all rows in the result set, [method`Tracker`.SparqlCursor.next]
|
|
2577
|
+
* will return %FALSE with no error set.
|
|
2578
|
+
*
|
|
2579
|
+
* On each row, it is possible to extract the result values through the
|
|
2580
|
+
* [method`Tracker`.SparqlCursor.get_integer], [method`Tracker`.SparqlCursor.get_string], etc... family
|
|
2581
|
+
* of methods. The column index of those functions starts at 0. The number of columns is
|
|
2582
|
+
* dependent on the SPARQL query issued, but may be checked at runtime through the
|
|
2583
|
+
* [method`Tracker`.SparqlCursor.get_n_columns] method.
|
|
2584
|
+
*
|
|
2585
|
+
* After a cursor is iterated, it is recommended to call [method`Tracker`.SparqlCursor.close]
|
|
2586
|
+
* explicitly to free up resources for other users of the same [class`Tracker`.SparqlConnection],
|
|
2587
|
+
* this is especially important in garbage collected languages. These resources
|
|
2588
|
+
* will be also implicitly freed on cursor object finalization.
|
|
2589
|
+
*
|
|
2590
|
+
* It is possible to use a given `TrackerSparqlCursor` in other threads than
|
|
2591
|
+
* the one it was created from. It must be however used from just one thread
|
|
2592
|
+
* at any given time.
|
|
2006
2593
|
* @class
|
|
2007
2594
|
*/
|
|
2008
2595
|
class SparqlCursor extends GObject.Object {
|
|
@@ -2027,7 +2614,7 @@ module SparqlStatement {
|
|
|
2027
2614
|
// Own constructor properties of Tracker-3.0.Tracker.SparqlStatement
|
|
2028
2615
|
|
|
2029
2616
|
/**
|
|
2030
|
-
* The
|
|
2617
|
+
* The [class`Tracker`.SparqlConnection] the statement was created for.
|
|
2031
2618
|
*/
|
|
2032
2619
|
connection?: SparqlConnection | null
|
|
2033
2620
|
/**
|
|
@@ -2043,7 +2630,7 @@ interface SparqlStatement {
|
|
|
2043
2630
|
// Own properties of Tracker-3.0.Tracker.SparqlStatement
|
|
2044
2631
|
|
|
2045
2632
|
/**
|
|
2046
|
-
* The
|
|
2633
|
+
* The [class`Tracker`.SparqlConnection] the statement was created for.
|
|
2047
2634
|
*/
|
|
2048
2635
|
readonly connection: SparqlConnection
|
|
2049
2636
|
/**
|
|
@@ -2058,59 +2645,71 @@ interface SparqlStatement {
|
|
|
2058
2645
|
// Owm methods of Tracker-3.0.Tracker.SparqlStatement
|
|
2059
2646
|
|
|
2060
2647
|
/**
|
|
2061
|
-
* Binds the boolean `value` to variable `name`.
|
|
2648
|
+
* Binds the boolean `value` to the parameterized variable given by `name`.
|
|
2062
2649
|
* @param name variable name
|
|
2063
2650
|
* @param value value
|
|
2064
2651
|
*/
|
|
2065
2652
|
bind_boolean(name: string | null, value: boolean): void
|
|
2066
2653
|
/**
|
|
2067
|
-
* Binds the
|
|
2654
|
+
* Binds the [type`GLib`.DateTime] `value` to the parameterized variable given by `name`.
|
|
2068
2655
|
* @param name variable name
|
|
2069
2656
|
* @param value value
|
|
2070
2657
|
*/
|
|
2071
2658
|
bind_datetime(name: string | null, value: GLib.DateTime): void
|
|
2072
2659
|
/**
|
|
2073
|
-
* Binds the double `value` to variable `name`.
|
|
2660
|
+
* Binds the double `value` to the parameterized variable given by `name`.
|
|
2074
2661
|
* @param name variable name
|
|
2075
2662
|
* @param value value
|
|
2076
2663
|
*/
|
|
2077
2664
|
bind_double(name: string | null, value: number): void
|
|
2078
2665
|
/**
|
|
2079
|
-
* Binds the integer `value` to variable `name`.
|
|
2666
|
+
* Binds the integer `value` to the parameterized variable given by `name`.
|
|
2080
2667
|
* @param name variable name
|
|
2081
2668
|
* @param value value
|
|
2082
2669
|
*/
|
|
2083
2670
|
bind_int(name: string | null, value: number): void
|
|
2084
2671
|
/**
|
|
2085
|
-
* Binds the string `value` to variable `name`.
|
|
2672
|
+
* Binds the string `value` to the parameterized variable given by `name`.
|
|
2086
2673
|
* @param name variable name
|
|
2087
2674
|
* @param value value
|
|
2088
2675
|
*/
|
|
2089
2676
|
bind_string(name: string | null, value: string | null): void
|
|
2090
2677
|
/**
|
|
2091
|
-
* Clears all
|
|
2678
|
+
* Clears all bindings.
|
|
2092
2679
|
*/
|
|
2093
2680
|
clear_bindings(): void
|
|
2094
2681
|
/**
|
|
2095
|
-
* Executes the SPARQL query with the currently bound values.
|
|
2682
|
+
* Executes the `SELECT` or `ASK` SPARQL query with the currently bound values.
|
|
2096
2683
|
*
|
|
2097
|
-
* This function
|
|
2098
|
-
*
|
|
2684
|
+
* This function also works for `DESCRIBE` and `CONSTRUCT` queries that
|
|
2685
|
+
* retrieve data from the triple store. These query forms that return
|
|
2686
|
+
* RDF data are however more useful together with [method`Tracker`.SparqlStatement.serialize_async].
|
|
2687
|
+
*
|
|
2688
|
+
* This function should only be called on `TrackerSparqlStatement` objects
|
|
2689
|
+
* obtained through [method`Tracker`.SparqlConnection.query_statement] or
|
|
2099
2690
|
* SELECT/CONSTRUCT/DESCRIBE statements loaded through
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2691
|
+
* [method`Tracker`.SparqlConnection.load_statement_from_gresource].
|
|
2692
|
+
* An error will be raised if this method is called on a `INSERT` or `DELETE`
|
|
2693
|
+
* SPARQL query.
|
|
2694
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2695
|
+
* @returns A `TrackerSparqlCursor` with the query results.
|
|
2103
2696
|
*/
|
|
2104
2697
|
execute(cancellable: Gio.Cancellable | null): SparqlCursor
|
|
2105
2698
|
/**
|
|
2106
|
-
*
|
|
2699
|
+
* Executes asynchronously the `SELECT` or `ASK` SPARQL query with the currently bound values.
|
|
2700
|
+
*
|
|
2701
|
+
* This function also works for `DESCRIBE` and `CONSTRUCT` queries that
|
|
2702
|
+
* retrieve data from the triple store. These query forms that return
|
|
2703
|
+
* RDF data are however more useful together with [method`Tracker`.SparqlStatement.serialize_async].
|
|
2107
2704
|
*
|
|
2108
|
-
* This function should only be called on
|
|
2109
|
-
* obtained through
|
|
2705
|
+
* This function should only be called on `TrackerSparqlStatement` objects
|
|
2706
|
+
* obtained through [method`Tracker`.SparqlConnection.query_statement] or
|
|
2110
2707
|
* SELECT/CONSTRUCT/DESCRIBE statements loaded through
|
|
2111
|
-
*
|
|
2112
|
-
*
|
|
2113
|
-
*
|
|
2708
|
+
* [method`Tracker`.SparqlConnection.load_statement_from_gresource].
|
|
2709
|
+
* An error will be raised if this method is called on a `INSERT` or `DELETE`
|
|
2710
|
+
* SPARQL query.
|
|
2711
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2712
|
+
* @param callback user-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
2114
2713
|
*/
|
|
2115
2714
|
execute_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
2116
2715
|
|
|
@@ -2119,25 +2718,31 @@ interface SparqlStatement {
|
|
|
2119
2718
|
/**
|
|
2120
2719
|
* Promisified version of {@link execute_async}
|
|
2121
2720
|
*
|
|
2122
|
-
*
|
|
2721
|
+
* Executes asynchronously the `SELECT` or `ASK` SPARQL query with the currently bound values.
|
|
2123
2722
|
*
|
|
2124
|
-
* This function
|
|
2125
|
-
*
|
|
2723
|
+
* This function also works for `DESCRIBE` and `CONSTRUCT` queries that
|
|
2724
|
+
* retrieve data from the triple store. These query forms that return
|
|
2725
|
+
* RDF data are however more useful together with [method`Tracker`.SparqlStatement.serialize_async].
|
|
2726
|
+
*
|
|
2727
|
+
* This function should only be called on `TrackerSparqlStatement` objects
|
|
2728
|
+
* obtained through [method`Tracker`.SparqlConnection.query_statement] or
|
|
2126
2729
|
* SELECT/CONSTRUCT/DESCRIBE statements loaded through
|
|
2127
|
-
*
|
|
2128
|
-
*
|
|
2129
|
-
*
|
|
2730
|
+
* [method`Tracker`.SparqlConnection.load_statement_from_gresource].
|
|
2731
|
+
* An error will be raised if this method is called on a `INSERT` or `DELETE`
|
|
2732
|
+
* SPARQL query.
|
|
2733
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2734
|
+
* @returns A Promise of: A `TrackerSparqlCursor` with the query results.
|
|
2130
2735
|
*/
|
|
2131
2736
|
execute_async(cancellable: Gio.Cancellable | null): globalThis.Promise<SparqlCursor>
|
|
2132
2737
|
/**
|
|
2133
2738
|
* Finishes the asynchronous operation started through
|
|
2134
|
-
*
|
|
2135
|
-
* @param res
|
|
2136
|
-
* @returns A
|
|
2739
|
+
* [method`Tracker`.SparqlStatement.execute_async].
|
|
2740
|
+
* @param res a [type`Gio`.AsyncResult] with the result of the operation
|
|
2741
|
+
* @returns A `TrackerSparqlCursor` with the query results.
|
|
2137
2742
|
*/
|
|
2138
2743
|
execute_finish(res: Gio.AsyncResult): SparqlCursor
|
|
2139
2744
|
/**
|
|
2140
|
-
* Returns the
|
|
2745
|
+
* Returns the [class`Tracker`.SparqlConnection] that this statement was created for.
|
|
2141
2746
|
* @returns The SPARQL connection of this statement.
|
|
2142
2747
|
*/
|
|
2143
2748
|
get_connection(): SparqlConnection
|
|
@@ -2147,9 +2752,10 @@ interface SparqlStatement {
|
|
|
2147
2752
|
*/
|
|
2148
2753
|
get_sparql(): string | null
|
|
2149
2754
|
/**
|
|
2150
|
-
* Serializes
|
|
2151
|
-
*
|
|
2152
|
-
*
|
|
2755
|
+
* Serializes a `DESCRIBE` or `CONSTRUCT` query into the given RDF `format`.
|
|
2756
|
+
*
|
|
2757
|
+
* The query `stmt` was created from must be either a `DESCRIBE` or `CONSTRUCT`
|
|
2758
|
+
* query, an error will be raised otherwise.
|
|
2153
2759
|
*
|
|
2154
2760
|
* This is an asynchronous operation, `callback` will be invoked when the
|
|
2155
2761
|
* data is available for reading.
|
|
@@ -2158,11 +2764,11 @@ interface SparqlStatement {
|
|
|
2158
2764
|
* an error will be raised.
|
|
2159
2765
|
*
|
|
2160
2766
|
* The `flags` argument is reserved for future expansions, currently
|
|
2161
|
-
*
|
|
2767
|
+
* #TRACKER_SERIALIZE_FLAGS_NONE must be passed.
|
|
2162
2768
|
* @param flags serialization flags
|
|
2163
2769
|
* @param format RDF format of the serialized data
|
|
2164
|
-
* @param cancellable
|
|
2165
|
-
* @param callback user-defined
|
|
2770
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2771
|
+
* @param callback user-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
2166
2772
|
*/
|
|
2167
2773
|
serialize_async(flags: SerializeFlags, format: RdfFormat, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
2168
2774
|
|
|
@@ -2171,9 +2777,10 @@ interface SparqlStatement {
|
|
|
2171
2777
|
/**
|
|
2172
2778
|
* Promisified version of {@link serialize_async}
|
|
2173
2779
|
*
|
|
2174
|
-
* Serializes
|
|
2175
|
-
*
|
|
2176
|
-
*
|
|
2780
|
+
* Serializes a `DESCRIBE` or `CONSTRUCT` query into the given RDF `format`.
|
|
2781
|
+
*
|
|
2782
|
+
* The query `stmt` was created from must be either a `DESCRIBE` or `CONSTRUCT`
|
|
2783
|
+
* query, an error will be raised otherwise.
|
|
2177
2784
|
*
|
|
2178
2785
|
* This is an asynchronous operation, `callback` will be invoked when the
|
|
2179
2786
|
* data is available for reading.
|
|
@@ -2182,38 +2789,44 @@ interface SparqlStatement {
|
|
|
2182
2789
|
* an error will be raised.
|
|
2183
2790
|
*
|
|
2184
2791
|
* The `flags` argument is reserved for future expansions, currently
|
|
2185
|
-
*
|
|
2792
|
+
* #TRACKER_SERIALIZE_FLAGS_NONE must be passed.
|
|
2186
2793
|
* @param flags serialization flags
|
|
2187
2794
|
* @param format RDF format of the serialized data
|
|
2188
|
-
* @param cancellable
|
|
2189
|
-
* @returns A Promise of: a
|
|
2795
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2796
|
+
* @returns A Promise of: a [class@Gio.InputStream] to read RDF content.
|
|
2190
2797
|
*/
|
|
2191
2798
|
serialize_async(flags: SerializeFlags, format: RdfFormat, cancellable: Gio.Cancellable | null): globalThis.Promise<Gio.InputStream>
|
|
2192
2799
|
/**
|
|
2193
|
-
* Finishes
|
|
2194
|
-
*
|
|
2195
|
-
* @param result the
|
|
2196
|
-
* @returns a
|
|
2800
|
+
* Finishes the asynchronous operation started through
|
|
2801
|
+
* [method`Tracker`.SparqlStatement.serialize_async].
|
|
2802
|
+
* @param result a [type`Gio`.AsyncResult] with the result of the operation
|
|
2803
|
+
* @returns a [class@Gio.InputStream] to read RDF content.
|
|
2197
2804
|
*/
|
|
2198
2805
|
serialize_finish(result: Gio.AsyncResult): Gio.InputStream
|
|
2199
2806
|
/**
|
|
2200
|
-
* Executes the SPARQL
|
|
2807
|
+
* Executes the `INSERT`/`DELETE` SPARQL query series with the currently bound values.
|
|
2201
2808
|
*
|
|
2202
|
-
* This function should only be called on
|
|
2203
|
-
* obtained through
|
|
2204
|
-
*
|
|
2205
|
-
*
|
|
2809
|
+
* This function should only be called on `TrackerSparqlStatement` objects
|
|
2810
|
+
* obtained through [method`Tracker`.SparqlConnection.update_statement] or
|
|
2811
|
+
* `INSERT`/`DELETE` statements loaded through
|
|
2812
|
+
* [method`Tracker`.SparqlConnection.load_statement_from_gresource].
|
|
2813
|
+
* An error will be raised if this method is called on
|
|
2814
|
+
* `SELECT`/`ASK`/`DESCRIBE`/`CONSTRUCT` SPARQL queries.
|
|
2815
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2206
2816
|
* @returns %TRUE if the update finished with no errors, %FALSE otherwise
|
|
2207
2817
|
*/
|
|
2208
2818
|
update(cancellable: Gio.Cancellable | null): boolean
|
|
2209
2819
|
/**
|
|
2210
|
-
*
|
|
2820
|
+
* Executes asynchronously the `INSERT`/`DELETE` SPARQL query series with the currently bound values.
|
|
2211
2821
|
*
|
|
2212
|
-
* This function should only be called on
|
|
2213
|
-
* obtained through
|
|
2214
|
-
*
|
|
2215
|
-
*
|
|
2216
|
-
*
|
|
2822
|
+
* This function should only be called on `TrackerSparqlStatement` objects
|
|
2823
|
+
* obtained through [method`Tracker`.SparqlConnection.update_statement] or
|
|
2824
|
+
* `INSERT`/`DELETE` statements loaded through
|
|
2825
|
+
* [method`Tracker`.SparqlConnection.load_statement_from_gresource].
|
|
2826
|
+
* An error will be raised if this method is called on
|
|
2827
|
+
* `SELECT`/`ASK`/`DESCRIBE`/`CONSTRUCT` SPARQL queries.
|
|
2828
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2829
|
+
* @param callback user-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.
|
|
2217
2830
|
*/
|
|
2218
2831
|
update_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
|
|
2219
2832
|
|
|
@@ -2222,19 +2835,22 @@ interface SparqlStatement {
|
|
|
2222
2835
|
/**
|
|
2223
2836
|
* Promisified version of {@link update_async}
|
|
2224
2837
|
*
|
|
2225
|
-
*
|
|
2838
|
+
* Executes asynchronously the `INSERT`/`DELETE` SPARQL query series with the currently bound values.
|
|
2226
2839
|
*
|
|
2227
|
-
* This function should only be called on
|
|
2228
|
-
* obtained through
|
|
2229
|
-
*
|
|
2230
|
-
*
|
|
2840
|
+
* This function should only be called on `TrackerSparqlStatement` objects
|
|
2841
|
+
* obtained through [method`Tracker`.SparqlConnection.update_statement] or
|
|
2842
|
+
* `INSERT`/`DELETE` statements loaded through
|
|
2843
|
+
* [method`Tracker`.SparqlConnection.load_statement_from_gresource].
|
|
2844
|
+
* An error will be raised if this method is called on
|
|
2845
|
+
* `SELECT`/`ASK`/`DESCRIBE`/`CONSTRUCT` SPARQL queries.
|
|
2846
|
+
* @param cancellable Optional [type`Gio`.Cancellable]
|
|
2231
2847
|
* @returns A Promise of: %TRUE if the update finished with no errors, %FALSE otherwise
|
|
2232
2848
|
*/
|
|
2233
2849
|
update_async(cancellable: Gio.Cancellable | null): globalThis.Promise<boolean>
|
|
2234
2850
|
/**
|
|
2235
2851
|
* Finishes the asynchronous update started through
|
|
2236
|
-
*
|
|
2237
|
-
* @param result
|
|
2852
|
+
* [method`Tracker`.SparqlStatement.update_async].
|
|
2853
|
+
* @param result a [type`Gio`.AsyncResult] with the result of the operation
|
|
2238
2854
|
* @returns %TRUE if the update finished with no errors, %FALSE otherwise
|
|
2239
2855
|
*/
|
|
2240
2856
|
update_finish(result: Gio.AsyncResult): boolean
|
|
@@ -2254,8 +2870,36 @@ interface SparqlStatement {
|
|
|
2254
2870
|
}
|
|
2255
2871
|
|
|
2256
2872
|
/**
|
|
2257
|
-
*
|
|
2258
|
-
*
|
|
2873
|
+
* `TrackerSparqlStatement` represents a prepared statement for a SPARQL query.
|
|
2874
|
+
*
|
|
2875
|
+
* The SPARQL query will be internally compiled into the format that is most
|
|
2876
|
+
* optimal to execute the query many times. For connections created
|
|
2877
|
+
* through [ctor`Tracker`.SparqlConnection.new] that will be a
|
|
2878
|
+
* SQLite compiled statement.
|
|
2879
|
+
*
|
|
2880
|
+
* The SPARQL query may contain parameterized variables expressed via the
|
|
2881
|
+
* `~` prefix in the SPARQL syntax (e.g. `~var`), these may happen anywhere
|
|
2882
|
+
* in the SPARQL where a literal or variable would typically happen. These
|
|
2883
|
+
* parameterized variables may be mapped to arbitrary values prior to
|
|
2884
|
+
* execution. The `TrackerSparqlStatement` may be reused for future
|
|
2885
|
+
* queries with different values.
|
|
2886
|
+
*
|
|
2887
|
+
* The argument bindings may be changed through the [method`Tracker`.SparqlStatement.bind_int],
|
|
2888
|
+
* [method`Tracker`.SparqlStatement.bind_int], etc... family of functions. Those functions
|
|
2889
|
+
* receive a `name` argument corresponding for the variable name in the SPARQL query
|
|
2890
|
+
* (eg. `"var"` for `~var`) and a value to map the variable to.
|
|
2891
|
+
*
|
|
2892
|
+
* Once all arguments have a value, the query may be executed through
|
|
2893
|
+
* [method`Tracker`.SparqlStatement.execute_async] or [method`Tracker`.SparqlStatement.execute].
|
|
2894
|
+
*
|
|
2895
|
+
* It is possible to use any `TrackerSparqlStatement` from other threads than
|
|
2896
|
+
* the one it was created from. However, binding values and executing the
|
|
2897
|
+
* statement must only happen from one thread at a time. It is possible to reuse
|
|
2898
|
+
* the `TrackerSparqlStatement` right after [method`Tracker`.SparqlStatement.execute_async]
|
|
2899
|
+
* was called, there is no need to wait for [method`Tracker`.SparqlStatement.execute_finish].
|
|
2900
|
+
*
|
|
2901
|
+
* In some circumstances, it is possible that the query needs to be recompiled
|
|
2902
|
+
* from the SPARQL source. This will happen transparently.
|
|
2259
2903
|
* @class
|
|
2260
2904
|
*/
|
|
2261
2905
|
class SparqlStatement extends GObject.Object {
|
|
@@ -2335,7 +2979,7 @@ interface NotifierEvent {
|
|
|
2335
2979
|
* public identifier for the resource.
|
|
2336
2980
|
*
|
|
2337
2981
|
* This URN is an unique string identifier for the resource being
|
|
2338
|
-
* notified upon, typically of the form
|
|
2982
|
+
* notified upon, typically of the form `urn:uuid:...`.
|
|
2339
2983
|
* @returns The element URN
|
|
2340
2984
|
*/
|
|
2341
2985
|
get_urn(): string | null
|