[gnome-photos/wip/uajain/de_dup: 1/3] query-builder: Add insert and relate remote objects queries
- From: Umang Jain <uajain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/uajain/de_dup: 1/3] query-builder: Add insert and relate remote objects queries
- Date: Wed, 24 Aug 2016 10:14:49 +0000 (UTC)
commit e2877777621faf2a00bad1a4edaaf35e6e33697d
Author: Umang Jain <mailumangjain gmail com>
Date: Wed Aug 24 15:36:51 2016 +0530
query-builder: Add insert and relate remote objects queries
https://bugzilla.gnome.org/show_bug.cgi?id=770267
src/photos-query-builder.c | 29 +++++++++++++++++++++++++++++
src/photos-query-builder.h | 4 ++++
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index a16bc8e..39c9c55 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -348,6 +348,35 @@ photos_query_builder_update_mtime_query (PhotosSearchContextState *state, const
}
+PhotosQuery *
+photos_query_builder_relate_objects (PhotosSearchContextState *state, const gchar *obj1, const gchar *obj2)
+{
+ gchar *sparql;
+
+ sparql = g_strdup_printf ("INSERT OR REPLACE { <%s> nie:relatedTo '%s' }", obj1, obj2);
+
+ return photos_query_new (state, sparql);
+}
+
+
+PhotosQuery *
+photos_query_builder_insert_remote_object (PhotosSearchContextState *state, const gchar *title, const gchar
*id)
+{
+ gchar *identifier;
+ gchar *sparql;
+
+ identifier = g_strconcat ("google:picasaweb:", id, NULL);
+ sparql = g_strdup_printf ("INSERT { _:res a nfo:RemoteDataObject; a nmm:Photo ; "
+ "nie:title '%s' ; "
+ "nao:identifier '%s' }",
+ title,
+ identifier);
+ g_free (identifier);
+
+ return photos_query_new (state, sparql);
+}
+
+
gchar *
photos_query_builder_filter_local (void)
{
diff --git a/src/photos-query-builder.h b/src/photos-query-builder.h
index 30c9693..a0a3c51 100644
--- a/src/photos-query-builder.h
+++ b/src/photos-query-builder.h
@@ -62,6 +62,10 @@ PhotosQuery *photos_query_builder_update_mtime_query (PhotosSearchContextState
gchar *photos_query_builder_filter_local (void);
+PhotosQuery *photos_query_builder_insert_remote_object (PhotosSearchContextState *state, const gchar
*title, const gchar *id);
+
+PhotosQuery *photos_query_builder_relate_objects (PhotosSearchContextState *state, const gchar *obj1,
const gchar *obj2);
+
G_END_DECLS
#endif /* PHOTOS_QUERY_BUILDER */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]