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