[tracker/wip/tintou/fix-doc] docs: Update the documentation to latest tracker version



commit da9d5c5f09185edda2766f6f184a71a7a4516d5a
Author: Corentin Noël <corentin elementary io>
Date:   Tue Mar 26 15:42:49 2019 +0100

    docs: Update the documentation to latest tracker version

 docs/reference/libtracker-sparql/examples.sgml | 50 ++++++++++----------------
 docs/reference/libtracker-sparql/overview.sgml | 23 ++++++------
 2 files changed, 29 insertions(+), 44 deletions(-)
---
diff --git a/docs/reference/libtracker-sparql/examples.sgml b/docs/reference/libtracker-sparql/examples.sgml
index 5590e3b00..09ebabc0e 100644
--- a/docs/reference/libtracker-sparql/examples.sgml
+++ b/docs/reference/libtracker-sparql/examples.sgml
@@ -20,45 +20,33 @@
     </para>
 
     <para>
-<programlisting>
+<programlisting language="C">
 #include &lt;tracker-sparql.h&gt;
 
 int main (int argc, char **argv)
 {
-  <type><link linkend="TrackerSparqlBuilder-struct">TrackerSparqlBuilder</link></type> *builder;
-  const gchar *iri = "urn:example:0001";
-  const gchar *query_str;
-  time_t now;
-
-  /* Create builder */
-  builder = <function><link 
linkend="tracker-sparql-builder-new-update">tracker_sparql_builder_new_update</link></function> ();
-
-  /* Insert new data */
-  <function><link 
linkend="tracker-sparql-builder-insert-open">tracker_sparql_builder_insert_open</link></function> (builder, 
NULL);
-
-  <function><link 
linkend="tracker-sparql-builder-subject-iri">tracker_sparql_builder_subject_iri</link></function> (builder, 
iri);
+  <type><link linkend="TrackerResource-struct">TrackerResource</link></type> *resource;
+  GDateTime *datetime;
+  gchar *last_modified;
+  gchar *query_str;
 
-  <function><link 
linkend="tracker-sparql-builder-predicate">tracker_sparql_builder_predicate</link></function> (builder, "a");
-  <function><link linkend="tracker-sparql-builder-object">tracker_sparql_builder_object</link></function> 
(builder, "nie:DataObject");
-  <function><link linkend="tracker-sparql-builder-object">tracker_sparql_builder_object</link></function> 
(builder, "nfo:FileDataObject");
+  datetime = g_date_time_new_now_utc ();
+  last_modified = g_date_time_format (datetime, "%FT%TZ");
 
-  now = time (NULL);
-  <function><link 
linkend="tracker-sparql-builder-predicate">tracker_sparql_builder_predicate</link></function> (builder, 
"nfo:fileLastModified");
-  <function><link 
linkend="tracker-sparql-builder-object-date">tracker_sparql_builder_object_date</link></function> (builder, 
&amp;now);
-
-  <function><link 
linkend="tracker-sparql-builder-insert-close">tracker_sparql_builder_insert_close</link></function> (builder);
-
-  /* Get query as string. Do NOT g_free() the resulting string! */
-  query_str = <function><link 
linkend="tracker-sparql-builder-get-result">tracker_sparql_builder_get_result</link></function> (builder);
+  resource = <function><link linkend="tracker-resource-new">tracker_resource_new</link></function> 
("urn:example:0001");
+  <function><link linkend="tracker-resource-add-uri">tracker_resource_add_uri</link></function> (resource, 
"rdf:type", "nie:DataObject");
+  <function><link linkend="tracker-resource-add-uri">tracker_resource_add_uri</link></function> (resource, 
"rdf:type", "nfo:FileDataObject");
+  <function><link linkend="tracker-resource-set-string">tracker_resource_set_string</link></function> 
(resource, "nfo:fileLastModified", last_modified);
 
   /* Print it */
-  g_print ("Generated SPARQL query: '%s'\n", query_str);
-
-  /* Once builder no longer needed, unref it. Note that after
-   * this operation, you must not use the returned query result
-   * any more
-   */
-  g_object_unref (builder);
+  query_str = <function><link 
linkend="tracker-resource-print-sparql-update">tracker_resource_print_sparql_update</link></function> 
(resource, NULL, NULL);
+  g_print ("Generated SPARQL query: \n");
+  g_print ("%s\n", query_str);
+
+  g_clear_pointer (&amp;query_str, g_free);
+  g_clear_pointer (&amp;last_modified, g_free);
+  g_clear_pointer (&amp;datetime, g_date_time_unref);
+  g_clear_pointer (&amp;resource, g_object_unref);
 
   return 0;
 }
diff --git a/docs/reference/libtracker-sparql/overview.sgml b/docs/reference/libtracker-sparql/overview.sgml
index 14890457d..98fd30a26 100644
--- a/docs/reference/libtracker-sparql/overview.sgml
+++ b/docs/reference/libtracker-sparql/overview.sgml
@@ -17,7 +17,11 @@
 
     <para>
       The Tracker SPARQL library provides several underlying methods to perform
-      queries and updates to the Tracker Store.
+      queries and updates to the Tracker Store. Every operation is done in a
+      <type><link linkend="TrackerSparqlConnection-struct">TrackerSparqlConnection</link></type>
+      which creates the right access method depending on the query. You can obtain a
+      <type><link linkend="TrackerSparqlConnection-struct">TrackerSparqlConnection</link></type>
+      object using <function><link 
linkend="tracker-sparql-connection-get">tracker_sparql_connection_get</link></function> or <function><link 
linkend="tracker-sparql-connection-get-async">tracker_sparql_connection_get_async</link></function> for 
asynchronous operation.
 
       <itemizedlist>
        <listitem>
@@ -31,13 +35,6 @@
            SQLite database. Again, note that this method applies only to
            <emphasis>Read-Only</emphasis> operations.
          </para>
-         <para>
-           If you plan to only do Read-Only queries to the store, you can get the
-           <type><link linkend="TrackerSparqlConnection-struct">TrackerSparqlConnection</link></type>
-           object using <function><link 
linkend="tracker-sparql-connection-get-direct">tracker_sparql_connection_get_direct</link></function>. 
Otherwise, if you also plan to use the same connection object
-           for <emphasis>Write</emphasis> operations, you must get the connection object with
-           <function><link 
linkend="tracker-sparql-connection-get">tracker_sparql_connection_get</link></function>.
-         </para>
        </listitem>
        <listitem>
          <emphasis>D-Bus FD passing:</emphasis>
@@ -73,11 +70,11 @@
       <application>pkg-config</application> is used (the actual output on
       your system may be different):
 <programlisting>
-$ pkg-config --cflags tracker-sparql-0.12
--pthread -I/usr/include/tracker-0.12 -I/usr/include/tracker-0.12/libtracker-sparql -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include
+$ pkg-config --cflags tracker-sparql-2.0
+-pthread -I/usr/include/tracker-2.0 -I/usr/include/tracker-2.0/libtracker-sparql -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include
 
-$ pkg-config --libs tracker-sparql-0.12
--Wl,--export-dynamic -pthread -ltracker-sparql-0.12 -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt 
-lglib-2.0
+$ pkg-config --libs tracker-sparql-2.0
+-ltracker-sparql-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0
 </programlisting>
     </para>
     <para>
@@ -86,7 +83,7 @@ $ pkg-config --libs tracker-sparql-0.12
       (<emphasis>not single quotes</emphasis>), then its output will be
       substituted into the command line before execution:
 <programlisting>
- $ cc `pkg-config --cflags --libs tracker-sparql-0.12` hello.c -o hello
+ $ cc `pkg-config --cflags --libs tracker-sparql-2.0` hello.c -o hello
 </programlisting>
     </para>
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]