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