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