/* trf-persona-store.c generated by valac 0.12.0, the Vala compiler
 * generated from trf-persona-store.vala, do not modify */

/*
 * Copyright (C) 2011 Collabora Ltd.
 *
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *         Travis Reitter <travis.reitter@collabora.co.uk>
 *         Philip Withnall <philip.withnall@collabora.co.uk>
 *         Marco Barisione <marco.barisione@collabora.co.uk>
 *         Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
 */

#include <glib.h>
#include <glib-object.h>
#include <folks/folks.h>
#include <gee.h>
#include <gio/gio.h>
#include <libtracker-sparql/tracker-sparql.h>
#include <string.h>
#include <stdlib.h>
#include <glib/gi18n-lib.h>


#define TRF_TYPE_FIELDS (trf_fields_get_type ())

#define TRF_TYPE_AFFL_INFO_FIELDS (trf_affl_info_fields_get_type ())

#define TRF_TYPE_POSTAL_ADDRESS_FIELDS (trf_postal_address_fields_get_type ())

#define TRF_TYPE_URLS_FIELDS (trf_urls_fields_get_type ())

#define TRF_TYPE_ROLE_FIELDS (trf_role_fields_get_type ())

#define TRF_TYPE_IM_FIELDS (trf_im_fields_get_type ())

#define TRF_TYPE_PHONE_FIELDS (trf_phone_fields_get_type ())

#define TRF_TYPE_EMAIL_FIELDS (trf_email_fields_get_type ())

#define TRF_TYPE_TAG_FIELDS (trf_tag_fields_get_type ())

#define TRF_TYPE_ATTRIB (trf_attrib_get_type ())

#define TRF_TYPE_PERSONA_STORE (trf_persona_store_get_type ())
#define TRF_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRF_TYPE_PERSONA_STORE, TrfPersonaStore))
#define TRF_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRF_TYPE_PERSONA_STORE, TrfPersonaStoreClass))
#define TRF_IS_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRF_TYPE_PERSONA_STORE))
#define TRF_IS_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRF_TYPE_PERSONA_STORE))
#define TRF_PERSONA_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRF_TYPE_PERSONA_STORE, TrfPersonaStoreClass))

typedef struct _TrfPersonaStore TrfPersonaStore;
typedef struct _TrfPersonaStoreClass TrfPersonaStoreClass;
typedef struct _TrfPersonaStorePrivate TrfPersonaStorePrivate;

#define TRF_TYPE_PERSONA (trf_persona_get_type ())
#define TRF_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRF_TYPE_PERSONA, TrfPersona))
#define TRF_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRF_TYPE_PERSONA, TrfPersonaClass))
#define TRF_IS_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRF_TYPE_PERSONA))
#define TRF_IS_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRF_TYPE_PERSONA))
#define TRF_PERSONA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRF_TYPE_PERSONA, TrfPersonaClass))

typedef struct _TrfPersona TrfPersona;
typedef struct _TrfPersonaClass TrfPersonaClass;

#define TYPE_RESOURCES (resources_get_type ())
#define RESOURCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESOURCES, Resources))
#define IS_RESOURCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESOURCES))
#define RESOURCES_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_RESOURCES, ResourcesIface))

typedef struct _Resources Resources;
typedef struct _ResourcesIface ResourcesIface;

#define TYPE_RESOURCES_PROXY (resources_proxy_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
typedef struct _TrfPersonaStoreAddPersonaFromDetailsData TrfPersonaStoreAddPersonaFromDetailsData;
typedef struct _TrfPersonaStoreRemovePersonaData TrfPersonaStoreRemovePersonaData;
typedef struct _TrfPersonaStoreRemoveAttributesFromPersonaData TrfPersonaStoreRemoveAttributesFromPersonaData;
typedef struct _TrfPersonaStoreBuildUpdateQuerySetData TrfPersonaStoreBuildUpdateQuerySetData;
typedef struct _TrfPersonaStoreRemoveAttributesData TrfPersonaStoreRemoveAttributesData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _TrfPersonaStorePrepareData TrfPersonaStorePrepareData;
typedef struct _TrfPersonaStoreBuildPredicatesTableData TrfPersonaStoreBuildPredicatesTableData;
typedef struct _TrfPersonaStoreBuildUrnPrefixTableData TrfPersonaStoreBuildUrnPrefixTableData;
#define _g_variant_iter_free0(var) ((var == NULL) ? NULL : (var = (g_variant_iter_free (var), NULL)))
typedef struct _TrfPersonaStoreHandleEventsData TrfPersonaStoreHandleEventsData;

#define TYPE_EVENT (event_get_type ())
typedef struct _Event Event;
typedef struct _TrfPersonaStoreHandleDeleteEventsData TrfPersonaStoreHandleDeleteEventsData;
typedef struct _TrfPersonaStoreHandleInsertEventsData TrfPersonaStoreHandleInsertEventsData;
typedef struct _TrfPersonaStoreDoAddContactsData TrfPersonaStoreDoAddContactsData;

#define TRF_TYPE_AFFL_INFO (trf_affl_info_get_type ())
#define TRF_AFFL_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRF_TYPE_AFFL_INFO, TrfAfflInfo))
#define TRF_AFFL_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRF_TYPE_AFFL_INFO, TrfAfflInfoClass))
#define TRF_IS_AFFL_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRF_TYPE_AFFL_INFO))
#define TRF_IS_AFFL_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRF_TYPE_AFFL_INFO))
#define TRF_AFFL_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRF_TYPE_AFFL_INFO, TrfAfflInfoClass))

typedef struct _TrfAfflInfo TrfAfflInfo;
typedef struct _TrfAfflInfoClass TrfAfflInfoClass;
typedef struct _TrfAfflInfoPrivate TrfAfflInfoPrivate;
typedef struct _TrfPersonaStoreDoUpdateData TrfPersonaStoreDoUpdateData;
typedef struct _TrfPersonaStoreGetPropertyData TrfPersonaStoreGetPropertyData;
typedef struct _TrfPersonaStoreGetNaoPropertyByPersonIdData TrfPersonaStoreGetNaoPropertyByPersonIdData;
typedef struct _TrfPersonaStoreGetNaoPropertyByPropIdData TrfPersonaStoreGetNaoPropertyByPropIdData;
typedef struct _TrfPersonaStoreGetAfflInfoData TrfPersonaStoreGetAfflInfoData;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _TrfPersonaStoreInsertPersonaData TrfPersonaStoreInsertPersonaData;
typedef struct _TrfPersonaStoreSingleValueQueryData TrfPersonaStoreSingleValueQueryData;
typedef struct _TrfPersonaStoreMultiValueQueryData TrfPersonaStoreMultiValueQueryData;
typedef struct _TrfPersonaStoreUrnFromTrackerIdData TrfPersonaStoreUrnFromTrackerIdData;
typedef struct _TrfPersonaStoreSetAliasData TrfPersonaStoreSetAliasData;
typedef struct _TrfPersonaStoreSetLocalIdsData TrfPersonaStoreSetLocalIdsData;
typedef struct _TrfPersonaStoreSetWebServiceAddrsData TrfPersonaStoreSetWebServiceAddrsData;
typedef struct _TrfPersonaStoreSetTrackerPropertyData TrfPersonaStoreSetTrackerPropertyData;
typedef struct _TrfPersonaStoreSetIsFavouriteData TrfPersonaStoreSetIsFavouriteData;
typedef struct _TrfPersonaStoreSetEmailsData TrfPersonaStoreSetEmailsData;
typedef struct _TrfPersonaStoreSetPhonesData TrfPersonaStoreSetPhonesData;
typedef struct _TrfPersonaStoreSetUniqueAttribSetData TrfPersonaStoreSetUniqueAttribSetData;
typedef struct _TrfPersonaStoreSetUrlsData TrfPersonaStoreSetUrlsData;
typedef struct _TrfPersonaStoreSetImAddressesData TrfPersonaStoreSetImAddressesData;
typedef struct _TrfPersonaStoreSetPostalAddressesData TrfPersonaStoreSetPostalAddressesData;
typedef struct _TrfPersonaStoreSetRolesData TrfPersonaStoreSetRolesData;
typedef struct _TrfPersonaStoreSetNotesData TrfPersonaStoreSetNotesData;
typedef struct _TrfPersonaStoreSetBirthdayData TrfPersonaStoreSetBirthdayData;
typedef struct _TrfPersonaStoreSetGenderData TrfPersonaStoreSetGenderData;
typedef struct _TrfPersonaStoreSetAvatarData TrfPersonaStoreSetAvatarData;
typedef struct _TrfPersonaStoreSetStructuredNameData TrfPersonaStoreSetStructuredNameData;
typedef struct _TrfPersonaStoreSetFullNameData TrfPersonaStoreSetFullNameData;
typedef struct _TrfPersonaStoreSetAttribSetData TrfPersonaStoreSetAttribSetData;
typedef struct _TrfPersonaStoreTrackerUpdateData TrfPersonaStoreTrackerUpdateData;
typedef struct _TrfPersonaStoreAffiliationsFromPersonaData TrfPersonaStoreAffiliationsFromPersonaData;
typedef struct _TrfPersonaStorePhonesFromAffiliationData TrfPersonaStorePhonesFromAffiliationData;
typedef struct _TrfPersonaStorePostalsFromAffiliationData TrfPersonaStorePostalsFromAffiliationData;
typedef struct _TrfPersonaStoreImaddrsFromAffiliationData TrfPersonaStoreImaddrsFromAffiliationData;
typedef struct _TrfPersonaStoreEmailsFromAffiliationData TrfPersonaStoreEmailsFromAffiliationData;
typedef struct _TrfPersonaStoreResourceUsageCountData TrfPersonaStoreResourceUsageCountData;
typedef struct _TrfPersonaStoreDeleteResourceData TrfPersonaStoreDeleteResourceData;
typedef struct _TrfPersonaStoreLinkedResourcesData TrfPersonaStoreLinkedResourcesData;
typedef struct _TrfPersonaStoreUrnFromPersonaData TrfPersonaStoreUrnFromPersonaData;
typedef struct _TrfPersonaStoreUrnFromPropertyData TrfPersonaStoreUrnFromPropertyData;

typedef enum  {
	TRF_FIELDS_TRACKER_ID,
	TRF_FIELDS_FULL_NAME,
	TRF_FIELDS_FAMILY_NAME,
	TRF_FIELDS_GIVEN_NAME,
	TRF_FIELDS_ADDITIONAL_NAMES,
	TRF_FIELDS_PREFIXES,
	TRF_FIELDS_SUFFIXES,
	TRF_FIELDS_ALIAS,
	TRF_FIELDS_BIRTHDAY,
	TRF_FIELDS_AVATAR_URL,
	TRF_FIELDS_IM_ADDRESSES,
	TRF_FIELDS_PHONES,
	TRF_FIELDS_EMAILS,
	TRF_FIELDS_URLS,
	TRF_FIELDS_FAVOURITE,
	TRF_FIELDS_CONTACT_URN,
	TRF_FIELDS_ROLES,
	TRF_FIELDS_NOTE,
	TRF_FIELDS_GENDER,
	TRF_FIELDS_POSTAL_ADDRESS,
	TRF_FIELDS_LOCAL_IDS_PROPERTY
} TrfFields;

typedef enum  {
	TRF_AFFL_INFO_FIELDS_IM_TRACKER_ID,
	TRF_AFFL_INFO_FIELDS_IM_PROTOCOL,
	TRF_AFFL_INFO_FIELDS_IM_ACCOUNT_ID,
	TRF_AFFL_INFO_FIELDS_AFFL_TRACKER_ID,
	TRF_AFFL_INFO_FIELDS_AFFL_ROLE,
	TRF_AFFL_INFO_FIELDS_AFFL_ORG,
	TRF_AFFL_INFO_FIELDS_AFFL_POBOX,
	TRF_AFFL_INFO_FIELDS_AFFL_DISTRICT,
	TRF_AFFL_INFO_FIELDS_AFFL_COUNTY,
	TRF_AFFL_INFO_FIELDS_AFFL_LOCALITY,
	TRF_AFFL_INFO_FIELDS_AFFL_POSTALCODE,
	TRF_AFFL_INFO_FIELDS_AFFL_STREET_ADDRESS,
	TRF_AFFL_INFO_FIELDS_AFFL_ADDRESS_LOCATION,
	TRF_AFFL_INFO_FIELDS_AFFL_EXTENDED_ADDRESS,
	TRF_AFFL_INFO_FIELDS_AFFL_COUNTRY,
	TRF_AFFL_INFO_FIELDS_AFFL_REGION,
	TRF_AFFL_INFO_FIELDS_AFFL_EMAIL,
	TRF_AFFL_INFO_FIELDS_AFFL_PHONE,
	TRF_AFFL_INFO_FIELDS_AFFL_WEBSITE,
	TRF_AFFL_INFO_FIELDS_AFFL_BLOG,
	TRF_AFFL_INFO_FIELDS_AFFL_URL,
	TRF_AFFL_INFO_FIELDS_IM_NICKNAME
} TrfAfflInfoFields;

typedef enum  {
	TRF_POSTAL_ADDRESS_FIELDS_TRACKER_ID,
	TRF_POSTAL_ADDRESS_FIELDS_POBOX,
	TRF_POSTAL_ADDRESS_FIELDS_DISTRICT,
	TRF_POSTAL_ADDRESS_FIELDS_COUNTY,
	TRF_POSTAL_ADDRESS_FIELDS_LOCALITY,
	TRF_POSTAL_ADDRESS_FIELDS_POSTALCODE,
	TRF_POSTAL_ADDRESS_FIELDS_STREET_ADDRESS,
	TRF_POSTAL_ADDRESS_FIELDS_ADDRESS_LOCATION,
	TRF_POSTAL_ADDRESS_FIELDS_EXTENDED_ADDRESS,
	TRF_POSTAL_ADDRESS_FIELDS_COUNTRY,
	TRF_POSTAL_ADDRESS_FIELDS_REGION
} TrfPostalAddressFields;

typedef enum  {
	TRF_URLS_FIELDS_TRACKER_ID,
	TRF_URLS_FIELDS_BLOG,
	TRF_URLS_FIELDS_WEBSITE,
	TRF_URLS_FIELDS_URL
} TrfUrlsFields;

typedef enum  {
	TRF_ROLE_FIELDS_TRACKER_ID,
	TRF_ROLE_FIELDS_ROLE,
	TRF_ROLE_FIELDS_DEPARTMENT
} TrfRoleFields;

typedef enum  {
	TRF_IM_FIELDS_TRACKER_ID,
	TRF_IM_FIELDS_PROTO,
	TRF_IM_FIELDS_ID,
	TRF_IM_FIELDS_IM_NICKNAME
} TrfIMFields;

typedef enum  {
	TRF_PHONE_FIELDS_TRACKER_ID,
	TRF_PHONE_FIELDS_PHONE
} TrfPhoneFields;

typedef enum  {
	TRF_EMAIL_FIELDS_TRACKER_ID,
	TRF_EMAIL_FIELDS_EMAIL
} TrfEmailFields;

typedef enum  {
	TRF_TAG_FIELDS_TRACKER_ID
} TrfTagFields;

typedef enum  {
	TRF_ATTRIB_EMAILS,
	TRF_ATTRIB_PHONES,
	TRF_ATTRIB_URLS,
	TRF_ATTRIB_IM_ADDRESSES,
	TRF_ATTRIB_POSTAL_ADDRESSES
} TrfAttrib;

struct _TrfPersonaStore {
	FolksPersonaStore parent_instance;
	TrfPersonaStorePrivate * priv;
};

struct _TrfPersonaStoreClass {
	FolksPersonaStoreClass parent_class;
};

struct _ResourcesIface {
	GTypeInterface parent_iface;
};

struct _TrfPersonaStorePrivate {
	GeeHashMap* _personas;
	GStaticRecMutex __lock__personas;
	GeeMap* _personas_ro;
	gboolean _is_prepared;
	GStaticRecMutex __lock__is_prepared;
	Resources* _resources_object;
	TrackerSparqlConnection* _connection;
};

struct _TrfPersonaStoreAddPersonaFromDetailsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	GHashTable* details;
	FolksPersona* result;
	TrackerSparqlBuilder* _tmp0_;
	TrackerSparqlBuilder* builder;
	GList* _tmp1_;
	GList* k_collection;
	GList* k_it;
	const gchar* k;
	gconstpointer _tmp2_;
	GValue* _tmp3_;
	GValue* v;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	GObject* _tmp9_;
	FolksStructuredName* _tmp10_;
	FolksStructuredName* sname;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gboolean _tmp17_;
	const gchar* _tmp18_;
	GObject* _tmp19_;
	GFile* _tmp20_;
	GFile* avatar;
	gchar* _tmp21_;
	gchar* _tmp22_;
	const gchar* _tmp23_;
	void* _tmp24_;
	GDateTime* _tmp25_;
	GDateTime* birthday;
	GTimeVal tv;
	GTimeVal _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	const gchar* _tmp29_;
	gint _tmp30_;
	FolksGender gender;
	const gchar* _tmp31_;
	GObject* _tmp32_;
	GeeSet* _tmp33_;
	GeeSet* email_addresses;
	const gchar* _tmp34_;
	GObject* _tmp35_;
	GeeMultiMap* _tmp36_;
	GeeMultiMap* im_addresses;
	gint im_cnt;
	GeeSet* _tmp37_;
	GeeSet* _tmp38_;
	GeeIterator* _tmp39_;
	GeeIterator* _tmp40_;
	GeeIterator* _proto_it;
	gboolean _tmp41_;
	gpointer _tmp42_;
	gchar* proto;
	GeeCollection* _tmp43_;
	GeeCollection* addrs_a;
	GeeIterator* _tmp44_;
	GeeIterator* _addr_it;
	gboolean _tmp45_;
	gpointer _tmp46_;
	gchar* addr;
	gchar* _tmp47_;
	gchar* im_affl;
	gchar* _tmp48_;
	gchar* im;
	const gchar* _tmp49_;
	GObject* _tmp50_;
	GeeHashSet* _tmp51_;
	GeeHashSet* notes;
	GeeIterator* _tmp52_;
	GeeIterator* _n_it;
	gboolean _tmp53_;
	gpointer _tmp54_;
	FolksNote* n;
	const gchar* _tmp55_;
	const gchar* _tmp56_;
	GObject* _tmp57_;
	GeeSet* _tmp58_;
	GeeSet* phone_numbers;
	const gchar* _tmp59_;
	GObject* _tmp60_;
	GeeHashSet* _tmp61_;
	GeeHashSet* roles;
	gint roles_cnt;
	GeeIterator* _tmp62_;
	GeeIterator* _r_it;
	gboolean _tmp63_;
	gpointer _tmp64_;
	FolksRole* r;
	gchar* _tmp65_;
	gchar* role_affl;
	const gchar* _tmp66_;
	const gchar* _tmp67_;
	const gchar* _tmp68_;
	GObject* _tmp69_;
	GeeSet* _tmp70_;
	GeeSet* postal_addresses;
	gint postal_cnt;
	GeeIterator* _tmp71_;
	GeeIterator* _pa_it;
	gboolean _tmp72_;
	gpointer _tmp73_;
	FolksPostalAddress* pa;
	gchar* _tmp74_;
	gchar* postal_affl;
	gchar* _tmp75_;
	gchar* postal;
	const gchar* _tmp76_;
	const gchar* _tmp77_;
	const gchar* _tmp78_;
	const gchar* _tmp79_;
	const gchar* _tmp80_;
	const gchar* _tmp81_;
	const gchar* _tmp82_;
	const gchar* _tmp83_;
	GObject* _tmp84_;
	GeeSet* _tmp85_;
	GeeSet* urls;
	gint url_cnt;
	GeeIterator* _tmp86_;
	GeeIterator* _u_it;
	gboolean _tmp87_;
	gpointer _tmp88_;
	FolksFieldDetails* u;
	gchar* _tmp89_;
	gchar* url_affl;
	const gchar* _tmp90_;
	const gchar* _tmp91_;
	GObject* _tmp92_;
	GeeHashSet* _tmp93_;
	GeeHashSet* local_ids;
	gchar* _tmp94_;
	gchar* ids;
	const gchar* _tmp95_;
	GObject* _tmp96_;
	GeeMultiMap* _tmp97_;
	GeeMultiMap* ws_obj;
	gchar* _tmp98_;
	gchar* ws_addrs;
	const gchar* _tmp99_;
	const gchar* _tmp100_;
	GError* _tmp101_;
	TrfPersona* ret;
	const gchar* _tmp102_;
	gchar* _tmp103_;
	gchar* contact_urn;
	gchar* _tmp104_;
	gchar* filter;
	gchar* _tmp105_;
	gchar* query;
	GeeHashSet* _tmp106_;
	GeeHashSet* ret_personas;
	GeeIterator* _tmp107_;
	GeeIterator* _p_it;
	gboolean _tmp108_;
	gpointer _tmp109_;
	TrfPersona* p;
	TrfPersona* _tmp110_;
	GError * _inner_error_;
};

struct _TrfPersonaStoreRemovePersonaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	gchar* _tmp0_;
	gchar* urn;
	gchar* _tmp1_;
	gchar* q;
	gchar* _tmp2_;
	gchar* _tmp3_;
};

struct _TrfPersonaStoreRemoveAttributesFromPersonaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	gchar remove_flag;
	gchar* result;
	gchar* _tmp0_;
	gchar* urn;
};

struct _TrfPersonaStoreBuildUpdateQuerySetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	TrackerSparqlBuilder* builder;
	GeeSet* properties;
	gchar* contact_var;
	TrfAttrib attrib;
	gchar* affl_var;
	gchar* obj_var;
	const gchar* related_attrib;
	const gchar* related_prop;
	const gchar* related_connection;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gint cnt;
	GeeIterator* _tmp4_;
	GeeIterator* _p_it;
	gboolean _tmp5_;
	gpointer _tmp6_;
	FolksFieldDetails* p;
	gchar* _tmp7_;
	gchar* affl;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* obj;
	gchar* _tmp10_;
	const gchar* _tmp11_;
};

struct _TrfPersonaStoreRemoveAttributesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* urn;
	gchar remove_flag;
	GeeHashSet* _tmp0_;
	GeeHashSet* affiliations;
	GeeIterator* _tmp1_;
	GeeIterator* _affl_it;
	gboolean _tmp2_;
	gpointer _tmp3_;
	gchar* affl;
	gboolean got_attrib;
	gboolean _tmp4_;
	GeeHashSet* _tmp5_;
	GeeHashSet* phones;
	GeeIterator* _tmp6_;
	GeeIterator* _phone_it;
	gboolean _tmp7_;
	gpointer _tmp8_;
	gchar* phone;
	gboolean _tmp9_;
	GeeHashSet* _tmp10_;
	GeeHashSet* postals;
	GeeIterator* _tmp11_;
	GeeIterator* _postal_it;
	gboolean _tmp12_;
	gpointer _tmp13_;
	gchar* postal;
	gboolean _tmp14_;
	GeeHashSet* _tmp15_;
	GeeHashSet* im_addrs;
	GeeIterator* _tmp16_;
	GeeIterator* _im_addr_it;
	gboolean _tmp17_;
	gpointer _tmp18_;
	gchar* im_addr;
	gboolean _tmp19_;
	GeeHashSet* _tmp20_;
	GeeHashSet* emails;
	GeeIterator* _tmp21_;
	GeeIterator* _email_it;
	gboolean _tmp22_;
	gpointer _tmp23_;
	gchar* email;
	gboolean _tmp24_;
};

struct _TrfPersonaStorePrepareData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	TrackerSparqlConnection* _tmp0_;
	TrackerSparqlConnection* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GeeHashSet* _tmp4_;
	GeeHashSet* _tmp5_;
	Resources* _tmp6_;
	Resources* _tmp7_;
	GDBusConnection* _tmp8_;
	GDBusConnection* _tmp9_;
	GError * e1;
	GError* _tmp10_;
	GError * e2;
	GError* _tmp11_;
	GError * e3;
	GError* _tmp12_;
	GError * _inner_error_;
};

struct _TrfPersonaStoreBuildPredicatesTableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	GeeTreeMap* _tmp0_;
	gchar* _tmp1_;
	gchar* query;
	GeeSet* _tmp2_;
	GeeSet* _tmp3_;
	GeeIterator* _tmp4_;
	GeeIterator* _tmp5_;
	GeeIterator* _urn_t_it;
	gboolean _tmp6_;
	gpointer _tmp7_;
	gchar* urn_t;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	TrackerSparqlCursor* _tmp14_;
	TrackerSparqlCursor* cursor;
	gboolean _tmp15_;
	gboolean _tmp16_;
	gint i;
	GeeSet* _tmp17_;
	GeeSet* _tmp18_;
	GeeIterator* _tmp19_;
	GeeIterator* _tmp20_;
	GeeIterator* _urn_it;
	gboolean _tmp21_;
	gpointer _tmp22_;
	gchar* urn;
	gint64 _tmp23_;
	gint tracker_id;
	gpointer _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* prefix;
	GError * e1;
	GError * e2;
	GError * _inner_error_;
};

struct _TrfPersonaStoreBuildUrnPrefixTableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	GeeTreeMap* _tmp0_;
};

struct _TrfPersonaStoreHandleEventsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	GVariantIter* iter_del;
	GVariantIter* iter_ins;
	GVariantIter* _tmp0_;
	GVariantIter* _tmp1_;
};

struct _Event {
	gint graph_id;
	gint subject_id;
	gint pred_id;
	gint object_id;
};

struct _TrfPersonaStoreHandleDeleteEventsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	GVariantIter* iter_del;
	GeeHashSet* _tmp0_;
	GeeHashSet* removed_personas;
	gpointer _tmp1_;
	gint nco_person_id;
	gpointer _tmp2_;
	gint rdf_type_id;
	Event e;
	gboolean _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* p_id;
	gboolean _tmp9_;
	gpointer _tmp10_;
	TrfPersona* removed_p;
	const gchar* _tmp11_;
	gpointer _tmp12_;
	TrfPersona* persona;
	gint _tmp13_;
	GError * _inner_error_;
};

struct _TrfPersonaStoreHandleInsertEventsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	GVariantIter* iter_ins;
	GeeHashSet* _tmp0_;
	GeeHashSet* added_personas;
	Event e;
	gboolean _tmp1_;
	gchar* _tmp2_;
	gchar* subject_tracker_id;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* p_id;
	TrfPersona* persona;
	gpointer _tmp5_;
	TrfPersona* _tmp6_;
	const gchar* _tmp7_;
	gint _tmp8_;
	GError * _inner_error_;
};

struct _TrfPersonaStoreDoAddContactsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* query;
	GeeHashSet* result;
	GeeHashSet* _tmp0_;
	GeeHashSet* added_personas;
	TrackerSparqlCursor* _tmp1_;
	TrackerSparqlCursor* cursor;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gint64 _tmp4_;
	gint tracker_id;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* p_id;
	gpointer _tmp10_;
	TrfPersona* _tmp11_;
	gboolean _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	TrfPersona* _tmp15_;
	TrfPersona* _tmp16_;
	TrfPersona* persona;
	const gchar* _tmp17_;
	gint _tmp18_;
	GError * e;
	GError * _inner_error_;
};

struct _TrfAfflInfo {
	GObject parent_instance;
	TrfAfflInfoPrivate * priv;
	FolksPostalAddress* postal_address;
};

struct _TrfAfflInfoClass {
	GObjectClass parent_class;
};

struct _TrfPersonaStoreDoUpdateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	TrfPersona* p;
	Event e;
	gboolean adding;
	gpointer _tmp0_;
	gchar* _tmp1_;
	gchar* fullname;
	gchar* _tmp2_;
	gpointer _tmp3_;
	gchar* _tmp4_;
	gchar* alias;
	gchar* _tmp5_;
	gpointer _tmp6_;
	gchar* _tmp7_;
	gchar* family_name;
	gchar* _tmp8_;
	gpointer _tmp9_;
	gchar* _tmp10_;
	gchar* given_name;
	gchar* _tmp11_;
	gpointer _tmp12_;
	gchar* _tmp13_;
	gchar* additional_name;
	gchar* _tmp14_;
	gpointer _tmp15_;
	gchar* _tmp16_;
	gchar* suffix_name;
	gchar* _tmp17_;
	gpointer _tmp18_;
	gchar* _tmp19_;
	gchar* prefix_name;
	gchar* _tmp20_;
	gpointer _tmp21_;
	gint _tmp22_;
	gpointer _tmp23_;
	gchar* _tmp24_;
	gchar* email;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gpointer _tmp29_;
	gchar* _tmp30_;
	gchar* phone;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gpointer _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	TrfAfflInfo* _tmp40_;
	TrfAfflInfo* _tmp41_;
	TrfAfflInfo* affl_info;
	gchar* _tmp42_;
	gchar* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	const gchar* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	gboolean _tmp51_;
	const gchar* _tmp52_;
	const gchar* _tmp53_;
	const gchar* _tmp54_;
	const gchar* _tmp55_;
	const gchar* _tmp56_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	gchar* _tmp59_;
	gchar* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	gchar* _tmp63_;
	gchar* _tmp64_;
	const gchar* _tmp65_;
	const gchar* _tmp66_;
	const gchar* _tmp67_;
	const gchar* _tmp68_;
	const gchar* _tmp69_;
	const gchar* _tmp70_;
	const gchar* _tmp71_;
	const gchar* _tmp72_;
	const gchar* _tmp73_;
	gchar* _tmp74_;
	gchar* _tmp75_;
	gchar* _tmp76_;
	gchar* _tmp77_;
	gchar* _tmp78_;
	gchar* _tmp79_;
	gchar* _tmp80_;
	gchar* _tmp81_;
	gchar* _tmp82_;
	gchar* _tmp83_;
	gchar* _tmp84_;
	gchar* _tmp85_;
	gpointer _tmp86_;
	gchar* _tmp87_;
	gchar* bday;
	gchar* _tmp88_;
	gpointer _tmp89_;
	gchar* _tmp90_;
	gchar* note;
	gchar* _tmp91_;
	gpointer _tmp92_;
	gpointer _tmp93_;
	gchar* _tmp94_;
	gchar* avatar_url;
	gchar* _tmp95_;
	gpointer _tmp96_;
	gint _tmp97_;
	gchar** _tmp98_;
	gchar** prop_info;
	gint prop_info_length1;
	gint _prop_info_size_;
	gchar* _tmp99_;
	gchar* local_ids;
	gchar* _tmp100_;
	gchar* ws_addrs;
};

struct _TrfPersonaStoreGetPropertyData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gint subject_tracker_id;
	gchar* property;
	gchar* subject_type;
	gchar* result;
	gchar* _tmp0_;
	gchar* query;
	gchar* _tmp1_;
};

struct _TrfPersonaStoreGetNaoPropertyByPersonIdData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gint nco_person_id;
	gchar* prop_name;
	gchar* result;
	gchar* _tmp0_;
	gchar* query;
	gchar* _tmp1_;
};

struct _TrfPersonaStoreGetNaoPropertyByPropIdData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gint nao_prop_id;
	gchar** result;
	gint result_length1;
	gchar* _tmp0_;
	gchar* query;
	gchar* _tmp1_;
	gchar* ret;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
};

struct _TrfPersonaStoreGetAfflInfoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* person_id;
	gchar* affiliation_id;
	TrfAfflInfo* result;
	TrfAfflInfo* _tmp0_;
	TrfAfflInfo* affl_info;
	gchar* _tmp1_;
	gchar* query;
	TrackerSparqlCursor* _tmp2_;
	TrackerSparqlCursor* cursor;
	gboolean _tmp3_;
	gboolean _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* po_box;
	const gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* extension;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* street;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* locality;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* region;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* postal_code;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* country;
	GeeHashSet* _tmp40_;
	GeeHashSet* types;
	const gchar* _tmp41_;
	FolksPostalAddress* _tmp42_;
	const gchar* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	const gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	const gchar* _tmp49_;
	gchar* _tmp50_;
	gchar* _tmp51_;
	const gchar* _tmp52_;
	gchar* _tmp53_;
	gchar* _tmp54_;
	const gchar* _tmp55_;
	gchar* _tmp56_;
	gchar* _tmp57_;
	GError * e1;
	GError * e2;
	GError * _inner_error_;
};

struct _TrfPersonaStoreInsertPersonaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* query;
	gchar* persona_var;
	gchar* result;
	GVariant* variant;
	gchar* contact_urn;
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	GVariantIter* iter1;
	GVariantIter* iter2;
	GVariantIter* iter3;
	gchar* anon_var;
	GVariantIter* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	GError * e;
	GError * _inner_error_;
};

struct _TrfPersonaStoreSingleValueQueryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* query;
	gchar* result;
	GeeHashSet* _tmp0_;
	GeeHashSet* rows;
	GeeIterator* _tmp1_;
	GeeIterator* _r_it;
	gboolean _tmp2_;
	gpointer _tmp3_;
	gchar* r;
	gchar* _tmp4_;
};

struct _TrfPersonaStoreMultiValueQueryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* query;
	GeeHashSet* result;
	GeeHashSet* _tmp0_;
	GeeHashSet* ret;
	TrackerSparqlCursor* _tmp1_;
	TrackerSparqlCursor* cursor;
	gboolean _tmp2_;
	gboolean _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* prop;
	GError * e1;
	GError * e2;
	GError * _inner_error_;
};

struct _TrfPersonaStoreUrnFromTrackerIdData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* tracker_id;
	gchar* result;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
};

struct _TrfPersonaStoreSetAliasData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	TrfPersona* persona;
	gchar* alias;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* query;
};

struct _TrfPersonaStoreSetLocalIdsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	TrfPersona* persona;
	GeeSet* local_ids;
	gchar* _tmp0_;
	gchar* ids;
};

struct _TrfPersonaStoreSetWebServiceAddrsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	TrfPersona* persona;
	GeeMultiMap* ws_obj;
	gchar* _tmp0_;
	gchar* ws_addrs;
};

struct _TrfPersonaStoreSetTrackerPropertyData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	TrfPersona* persona;
	gchar* prop_name;
	gchar* prop_value;
	gchar* callers_name;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* query;
};

struct _TrfPersonaStoreSetIsFavouriteData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	gboolean is_favourite;
	gchar* query;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
};

struct _TrfPersonaStoreSetEmailsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GeeSet* emails;
};

struct _TrfPersonaStoreSetPhonesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GeeSet* phone_numbers;
};

struct _TrfPersonaStoreSetUniqueAttribSetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GeeSet* properties;
	TrfAttrib attrib;
	gchar* query_name;
	gchar* _tmp0_;
	gchar* p_id;
	TrackerSparqlBuilder* _tmp1_;
	TrackerSparqlBuilder* builder;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* filter;
	const gchar* _tmp9_;
};

struct _TrfPersonaStoreSetUrlsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GeeSet* urls;
};

struct _TrfPersonaStoreSetImAddressesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GeeMultiMap* im_addresses;
	GeeHashSet* _tmp0_;
	GeeHashSet* ims;
	GeeSet* _tmp1_;
	GeeSet* _tmp2_;
	GeeIterator* _tmp3_;
	GeeIterator* _tmp4_;
	GeeIterator* _proto_it;
	gboolean _tmp5_;
	gpointer _tmp6_;
	gchar* proto;
	GeeCollection* _tmp7_;
	GeeCollection* addrs;
	GeeIterator* _tmp8_;
	GeeIterator* _a_it;
	gboolean _tmp9_;
	gpointer _tmp10_;
	gchar* a;
	FolksFieldDetails* _tmp11_;
	FolksFieldDetails* fd;
};

struct _TrfPersonaStoreSetPostalAddressesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GeeSet* postal_addresses;
};

struct _TrfPersonaStoreSetRolesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GeeSet* roles;
	gchar* _tmp0_;
	gchar* p_id;
	gchar* _tmp1_;
	gchar* del_q;
	TrackerSparqlBuilder* _tmp2_;
	TrackerSparqlBuilder* builder;
	gint i;
	GeeIterator* _tmp3_;
	GeeIterator* _r_it;
	gboolean _tmp4_;
	gpointer _tmp5_;
	FolksRole* r;
	gchar* _tmp6_;
	gchar* affl;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* filter;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
};

struct _TrfPersonaStoreSetNotesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GeeSet* notes;
	gchar* _tmp0_;
	gchar* p_id;
	gchar* _tmp1_;
	gchar* del_q;
	TrackerSparqlBuilder* _tmp2_;
	TrackerSparqlBuilder* builder;
	GeeIterator* _tmp3_;
	GeeIterator* _n_it;
	gboolean _tmp4_;
	gpointer _tmp5_;
	FolksNote* n;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* filter;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
};

struct _TrfPersonaStoreSetBirthdayData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GDateTime* bday;
	gchar* _tmp0_;
	gchar* p_id;
	GTimeVal tv;
	GTimeVal _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* query;
};

struct _TrfPersonaStoreSetGenderData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	FolksGender gender;
	gchar* _tmp0_;
	gchar* p_id;
	gchar* query;
	gchar* _tmp1_;
	gchar* gender_urn;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
};

struct _TrfPersonaStoreSetAvatarData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GFile* avatar;
	gchar* _tmp0_;
	gchar* p_id;
	gint _tmp1_;
	gchar* _tmp2_;
	gchar* image_urn;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* query;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
};

struct _TrfPersonaStoreSetStructuredNameData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	FolksStructuredName* sname;
	gchar* _tmp0_;
	gchar* p_id;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* query;
};

struct _TrfPersonaStoreSetFullNameData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	gchar* full_name;
	gchar* _tmp0_;
	gchar* p_id;
	gchar* _tmp1_;
	gchar* query;
};

struct _TrfPersonaStoreSetAttribSetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	GeeSet* attribs;
	TrfAttrib what;
	gchar* _tmp0_;
	gchar* p_id;
	const gchar* related_attrib;
	const gchar* related_prop;
	const gchar* related_prop_2;
	const gchar* related_connection;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	TrackerSparqlBuilder* _tmp5_;
	TrackerSparqlBuilder* builder;
	gint i;
	GeeIterator* _tmp6_;
	GeeIterator* _p_it;
	gboolean _tmp7_;
	gpointer _tmp8_;
	GObject* p;
	FolksFieldDetails* fd;
	FolksPostalAddress* pa;
	gchar* _tmp9_;
	gchar* affl;
	gchar* attr;
	FolksPostalAddress* _tmp10_;
	gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	FolksFieldDetails* _tmp19_;
	GeeCollection* _tmp20_;
	GeeCollection* type_p;
	gboolean _tmp21_;
	gboolean _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	FolksFieldDetails* _tmp25_;
	gchar* _tmp26_;
	const gchar* _tmp27_;
	GeeCollection* _tmp28_;
	GeeCollection* _tmp29_;
	gint _tmp30_;
	gpointer* _tmp31_;
	gchar** _tmp32_;
	gchar** im_params;
	gint im_params_length1;
	gint _im_params_size_;
	gchar* _tmp33_;
	gchar* filter;
	const gchar* _tmp34_;
};

struct _TrfPersonaStoreTrackerUpdateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* query;
	gchar* caller;
	gboolean result;
	gboolean ret;
	GError * e1;
	GError * e2;
	GError * e3;
	GError * _inner_error_;
};

struct _TrfPersonaStoreAffiliationsFromPersonaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* urn;
	GeeHashSet* result;
	GeeHashSet* _tmp0_;
};

struct _TrfPersonaStorePhonesFromAffiliationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* affl;
	GeeHashSet* result;
	GeeHashSet* _tmp0_;
};

struct _TrfPersonaStorePostalsFromAffiliationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* affl;
	GeeHashSet* result;
	GeeHashSet* _tmp0_;
};

struct _TrfPersonaStoreImaddrsFromAffiliationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* affl;
	GeeHashSet* result;
	GeeHashSet* _tmp0_;
};

struct _TrfPersonaStoreEmailsFromAffiliationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* affl;
	GeeHashSet* result;
	GeeHashSet* _tmp0_;
};

struct _TrfPersonaStoreResourceUsageCountData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* resource;
	gint result;
	gchar* _tmp0_;
	gchar* query;
	gchar* _tmp1_;
	gchar* _result_;
	gint _tmp2_;
};

struct _TrfPersonaStoreDeleteResourceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* resource_urn;
	gboolean check_count;
	gboolean result;
	gboolean deleted;
	gchar* _tmp0_;
	gchar* query_t;
	gchar* _tmp1_;
	gchar* query;
	gint _tmp2_;
	gint count;
	gboolean _tmp3_;
	gboolean _tmp4_;
};

struct _TrfPersonaStoreLinkedResourcesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* urn;
	gchar* subject_type;
	gchar* linking_predicate;
	GeeHashSet* result;
	gchar* _tmp0_;
	gchar* query_t;
	gchar* _tmp1_;
	gchar* query;
	GeeHashSet* _tmp2_;
};

struct _TrfPersonaStoreUrnFromPersonaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	FolksPersona* persona;
	gchar* result;
	gchar* _tmp0_;
	gchar* id;
	gchar* _tmp1_;
};

struct _TrfPersonaStoreUrnFromPropertyData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrfPersonaStore* self;
	gchar* class_name;
	gchar* property_name;
	gchar* property_value;
	gchar* result;
	gchar* _tmp0_;
	gchar* query;
	gchar* _tmp1_;
};


static gpointer trf_persona_store_parent_class = NULL;
static GeeTreeMap* trf_persona_store__urn_prefix;
static GeeTreeMap* trf_persona_store__urn_prefix = NULL;
static GeeTreeMap* trf_persona_store__prefix_tracker_id;
static GeeTreeMap* trf_persona_store__prefix_tracker_id = NULL;

GType trf_fields_get_type (void) G_GNUC_CONST;
GType trf_affl_info_fields_get_type (void) G_GNUC_CONST;
GType trf_postal_address_fields_get_type (void) G_GNUC_CONST;
GType trf_urls_fields_get_type (void) G_GNUC_CONST;
GType trf_role_fields_get_type (void) G_GNUC_CONST;
GType trf_im_fields_get_type (void) G_GNUC_CONST;
GType trf_phone_fields_get_type (void) G_GNUC_CONST;
GType trf_email_fields_get_type (void) G_GNUC_CONST;
GType trf_tag_fields_get_type (void) G_GNUC_CONST;
GType trf_attrib_get_type (void) G_GNUC_CONST;
#define _REMOVE_ALL_ATTRIBS ((gchar) 0x01)
#define _REMOVE_PHONES ((gchar) 0x02)
#define _REMOVE_POSTALS ((gchar) 0x04)
#define _REMOVE_IM_ADDRS ((gchar) 0x08)
#define _REMOVE_EMAILS ((gchar) 0x10)
GType trf_persona_store_get_type (void) G_GNUC_CONST;
GType trf_persona_get_type (void) G_GNUC_CONST;
GType resources_get_type (void) G_GNUC_CONST;
GType resources_proxy_get_type (void) G_GNUC_CONST;
guint resources_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
#define TRF_PERSONA_STORE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRF_TYPE_PERSONA_STORE, TrfPersonaStorePrivate))
enum  {
	TRF_PERSONA_STORE_DUMMY_PROPERTY,
	TRF_PERSONA_STORE_TYPE_ID,
	TRF_PERSONA_STORE_CAN_ADD_PERSONAS,
	TRF_PERSONA_STORE_CAN_ALIAS_PERSONAS,
	TRF_PERSONA_STORE_CAN_GROUP_PERSONAS,
	TRF_PERSONA_STORE_CAN_REMOVE_PERSONAS,
	TRF_PERSONA_STORE_IS_PREPARED,
	TRF_PERSONA_STORE_PERSONAS
};
#define TRF_PERSONA_STORE__LOCAL_ID_PROPERTY_NAME "folks-linking-ids"
#define TRF_PERSONA_STORE__WSD_PROPERTY_NAME "folks-linking-ws-addrs"
#define TRF_PERSONA_STORE__OBJECT_NAME "org.freedesktop.Tracker1"
#define TRF_PERSONA_STORE__OBJECT_IFACE "org.freedesktop.Tracker1.Resources"
#define TRF_PERSONA_STORE__OBJECT_PATH "/org/freedesktop/Tracker1/Resources"
#define TRF_PERSONA_STORE__default_timeout 100
#define TRF_PERSONA_STORE__INITIAL_QUERY "SELECT " "tracker:id(?_contact) " "nco:fullname(?_contact) " "nco:nameFamily(?_contact) " "nco:nameGiven(?_contact) " "nco:nameAdditional(?_contact) " "nco:nameHonorificPrefix(?_contact) " "nco:nameHonorificSuffix(?_contact) " "nco:nickname(?_contact) " "nco:birthDate(?_contact) " "nie:url(nco:photo(?_contact)) " "(SELECT " "GROUP_CONCAT ( " " fn:concat(tracker:id(?affl),'\t'," " tracker:coalesce(nco:imProtocol(?a),''), " "'\t', tracker:coalesce(nco:imID(?a),''), '\t'," " tracker:coalesce(nco:imNickname(?a),'')), '\\n') " "WHERE { ?_contact nco:hasAffiliation ?affl. " " ?affl nco:hasIMAddress ?a } ) " "(SELECT " "GROUP_CONCAT " " (fn:concat(tracker:id(?affl),'\t', " " nco:phoneNumber(?aff_number)), " "'\\n') " "WHERE { ?_contact nco:hasAffiliation ?affl . " " ?affl nco:hasPhoneNumber ?aff_number  } ) " "(SELECT " "GROUP_CONCAT " " (fn:concat(tracker:id(?affl), '\t', " "  nco:emailAddress(?emailaddress)), " "',') " "WHERE { ?_contact nco:hasAffiliation ?affl . " " ?affl nco:hasEmailAddress ?emailaddress }) " " (SELECT " "GROUP_CONCAT " " (fn:concat(tracker:id(?affl), '\t'," "  tracker:coalesce(nco:blogUrl(?affl),'')," "  '\t'," "  tracker:coalesce(nco:websiteUrl(?affl),'')" "  , '\t'," "  tracker:coalesce(nco:url(?affl),''))," "  '\\n') " "WHERE { ?_contact nco:hasAffiliation ?affl  } )" "(SELECT " "GROUP_CONCAT(tracker:id(?_tag), " "',') " "WHERE { ?_contact nao:hasTag " "?_tag }) " "?_contact " "(SELECT " "GROUP_CONCAT " " (fn:concat(tracker:id(?affl), '\t', " "  tracker:coalesce(nco:role(?affl),''), '\t', " "  tracker:coalesce(nco:department(?affl),'')),  " "'\\n') " "WHERE { ?_contact nco:hasAffiliation " "?affl }) " "nco:note(?_contact) " "tracker:id(nco:gender(?_contact)) " "(SELECT " "GROUP_CONCAT " " (fn:concat(tracker:id(?affl), '\t', " "  tracker:coalesce(nco:pobox(?postal),'')" "  , '\t', " "  tracker:coalesce(nco:district(?postal),'')" "  , '\t', " "  tracker:coalesce(nco:county(?postal),'')" "  , '\t', " "  tracker:coalesce(nco:locality(?postal),'')" "  , '\t', " "  tracker:coalesce(nco:postalcode(?postal),'')" "  , '\t', " "  tracker:coalesce(nco:streetAddress(?postal)" "  ,''), '\t', " "  tracker:coalesce(nco:addressLocation(?postal)" "  ,''), '\t', " "  tracker:coalesce(nco:extendedAddress(?postal)" "  ,''), '\t', " "  tracker:coalesce(nco:country(?postal),'')" "  , '\t', " "  tracker:coalesce(nco:region(?postal),'')),  " "'\\n') " "WHERE { ?_contact nco:hasAffiliation " "?affl . ?affl nco:hasPostalAddress ?postal }) " "(SELECT " "GROUP_CONCAT " " (?prop_value,  " "',') " "WHERE { ?_contact nao:hasProperty ?prop . " " ?prop nao:propertyName ?prop_name . " " ?prop nao:propertyValue ?prop_value . " " FILTER (?prop_name = 'folks-linking-ids') } ) " "{ ?_contact a nco:PersonContact . %s } " "ORDER BY tracker:id(?_contact) "
TrfPersonaStore* trf_persona_store_new (void);
TrfPersonaStore* trf_persona_store_construct (GType object_type);
static void trf_persona_store_real_add_persona_from_details_data_free (gpointer _data);
static void trf_persona_store_real_add_persona_from_details (FolksPersonaStore* base, GHashTable* details, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean trf_persona_store_real_add_persona_from_details_co (TrfPersonaStoreAddPersonaFromDetailsData* data);
static GValue* _g_value_dup (GValue* self);
#define TRF_ONTOLOGY_DEFS_NCO_NICKNAME "nco:nickname"
#define TRF_ONTOLOGY_DEFS_NCO_FULLNAME "nco:fullname"
#define TRF_ONTOLOGY_DEFS_NCO_FAMILY "nco:nameFamily"
#define TRF_ONTOLOGY_DEFS_NCO_GIVEN "nco:nameGiven"
#define TRF_ONTOLOGY_DEFS_NCO_ADDITIONAL "nco:nameAdditional"
#define TRF_ONTOLOGY_DEFS_NCO_SUFFIX "nco:nameHonorificSuffix"
#define TRF_ONTOLOGY_DEFS_NCO_PREFIX "nco:nameHonorificPrefix"
#define TRF_ONTOLOGY_DEFS_NAO_TAG "nao:hasTag"
#define TRF_ONTOLOGY_DEFS_NAO_FAVORITE "nao:predefined-tag-favorite"
#define TRF_ONTOLOGY_DEFS_NIE_URL "nie:url"
#define TRF_ONTOLOGY_DEFS_NCO_PHOTO "nco:photo"
#define TRF_ONTOLOGY_DEFS_NCO_BIRTHDAY "nco:birthDate"
#define TRF_ONTOLOGY_DEFS_NCO_GENDER "nco:gender"
#define TRF_ONTOLOGY_DEFS_NCO_MALE "nco:gender-male"
#define TRF_ONTOLOGY_DEFS_NCO_FEMALE "nco:gender-female"
static void _trf_persona_store_build_update_query_set (TrfPersonaStore* self, TrackerSparqlBuilder* builder, GeeSet* properties, const gchar* contact_var, TrfAttrib attrib, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_build_update_query_set_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void trf_persona_store_add_persona_from_details_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
#define TRF_ONTOLOGY_DEFS_NCO_IMADDRESS "nco:IMAddress"
#define TRF_ONTOLOGY_DEFS_NCO_IMID "nco:imID"
#define TRF_ONTOLOGY_DEFS_NCO_IMPROTOCOL "nco:imProtocol"
#define TRF_ONTOLOGY_DEFS_NCO_AFFILIATION "nco:Affiliation"
#define TRF_ONTOLOGY_DEFS_NCO_HAS_IMADDRESS "nco:hasIMAddress"
#define TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION "nco:hasAffiliation"
#define TRF_ONTOLOGY_DEFS_NCO_NOTE "nco:note"
#define TRF_ONTOLOGY_DEFS_NCO_ROLE "nco:role"
#define TRF_ONTOLOGY_DEFS_NCO_ORG "nco:org"
#define TRF_ONTOLOGY_DEFS_NCO_POSTAL_ADDRESS "nco:PostalAddress"
#define TRF_ONTOLOGY_DEFS_NCO_POBOX "nco:pobox"
#define TRF_ONTOLOGY_DEFS_NCO_LOCALITY "nco:locality"
#define TRF_ONTOLOGY_DEFS_NCO_POSTALCODE "nco:postalcode"
#define TRF_ONTOLOGY_DEFS_NCO_STREET_ADDRESS "nco:streetAddress"
#define TRF_ONTOLOGY_DEFS_NCO_EXTENDED_ADDRESS "nco:extendedAddress"
#define TRF_ONTOLOGY_DEFS_NCO_COUNTRY "nco:country"
#define TRF_ONTOLOGY_DEFS_NCO_REGION "nco:region"
#define TRF_ONTOLOGY_DEFS_NCO_HAS_POSTAL_ADDRESS "nco:hasPostalAddress"
#define TRF_ONTOLOGY_DEFS_NCO_URL "nco:url"
gchar* trf_persona_store_serialize_local_ids (GeeSet* local_ids);
#define TRF_ONTOLOGY_DEFS_NAO_PROPERTY "nao:Property"
#define TRF_ONTOLOGY_DEFS_NAO_PROPERTY_NAME "nao:propertyName"
#define TRF_ONTOLOGY_DEFS_NAO_PROPERTY_VALUE "nao:propertyValue"
#define TRF_ONTOLOGY_DEFS_NAO_HAS_PROPERTY "nao:hasProperty"
gchar* trf_persona_store_serialize_web_services (GeeMultiMap* ws_obj);
static void _vala_GValue_free (GValue* self);
static void _trf_persona_store_insert_persona (TrfPersonaStore* self, const gchar* query, const gchar* persona_var, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar* _trf_persona_store_insert_persona_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_do_add_contacts (TrfPersonaStore* self, const gchar* query, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GeeHashSet* _trf_persona_store_do_add_contacts_finish (TrfPersonaStore* self, GAsyncResult* _res_);
GeeMultiMap* trf_persona_store_unserialize_web_services (const gchar* ws_addrs);
GeeSet* trf_persona_store_unserialize_local_ids (const gchar* local_ids);
static void trf_persona_store_real_remove_persona_data_free (gpointer _data);
static void trf_persona_store_real_remove_persona (FolksPersonaStore* base, FolksPersona* persona, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean trf_persona_store_real_remove_persona_co (TrfPersonaStoreRemovePersonaData* data);
static void _trf_persona_store_remove_attributes_from_persona (TrfPersonaStore* self, FolksPersona* persona, gchar remove_flag, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar* _trf_persona_store_remove_attributes_from_persona_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void trf_persona_store_remove_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_tracker_update (TrfPersonaStore* self, const gchar* query, const gchar* caller, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean _trf_persona_store_tracker_update_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_remove_attributes_from_persona_data_free (gpointer _data);
static gboolean _trf_persona_store_remove_attributes_from_persona_co (TrfPersonaStoreRemoveAttributesFromPersonaData* data);
static void _trf_persona_store_urn_from_persona (TrfPersonaStore* self, FolksPersona* persona, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar* _trf_persona_store_urn_from_persona_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_remove_attributes_from_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_remove_attributes (TrfPersonaStore* self, const gchar* urn, gchar remove_flag, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_remove_attributes_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_build_update_query_set_data_free (gpointer _data);
static gboolean _trf_persona_store_build_update_query_set_co (TrfPersonaStoreBuildUpdateQuerySetData* data);
#define TRF_ONTOLOGY_DEFS_NCO_PHONE "nco:PhoneNumber"
#define TRF_ONTOLOGY_DEFS_NCO_PHONE_PROP "nco:phoneNumber"
#define TRF_ONTOLOGY_DEFS_NCO_HAS_PHONE "nco:hasPhoneNumber"
#define TRF_ONTOLOGY_DEFS_NCO_EMAIL "nco:EmailAddress"
#define TRF_ONTOLOGY_DEFS_NCO_EMAIL_PROP "nco:emailAddress"
#define TRF_ONTOLOGY_DEFS_NCO_HAS_EMAIL "nco:hasEmailAddress"
static void _trf_persona_store_urn_from_property (TrfPersonaStore* self, const gchar* class_name, const gchar* property_name, const gchar* property_value, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar* _trf_persona_store_urn_from_property_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_build_update_query_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_remove_attributes_data_free (gpointer _data);
static gboolean _trf_persona_store_remove_attributes_co (TrfPersonaStoreRemoveAttributesData* data);
static void _trf_persona_store_affiliations_from_persona (TrfPersonaStore* self, const gchar* urn, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GeeHashSet* _trf_persona_store_affiliations_from_persona_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_remove_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_phones_from_affiliation (TrfPersonaStore* self, const gchar* affl, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GeeHashSet* _trf_persona_store_phones_from_affiliation_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_delete_resource (TrfPersonaStore* self, const gchar* resource_urn, gboolean check_count, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean _trf_persona_store_delete_resource_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_postals_from_affiliation (TrfPersonaStore* self, const gchar* affl, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GeeHashSet* _trf_persona_store_postals_from_affiliation_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_imaddrs_from_affiliation (TrfPersonaStore* self, const gchar* affl, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GeeHashSet* _trf_persona_store_imaddrs_from_affiliation_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_emails_from_affiliation (TrfPersonaStore* self, const gchar* affl, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GeeHashSet* _trf_persona_store_emails_from_affiliation_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void trf_persona_store_real_prepare_data_free (gpointer _data);
static void trf_persona_store_real_prepare (FolksPersonaStore* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean trf_persona_store_real_prepare_co (TrfPersonaStorePrepareData* data);
static void trf_persona_store_prepare_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_build_predicates_table (TrfPersonaStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_build_predicates_table_finish (TrfPersonaStore* self, GAsyncResult* _res_);
#define TRF_ONTOLOGY_DEFS_PERSON_CLASS "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#PersonContact"
static void _trf_persona_store_graph_updated_cb (TrfPersonaStore* self, GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters);
static void __trf_persona_store_graph_updated_cb_gd_bus_signal_callback (GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters, gpointer self);
gint trf_persona_store_get_favorite_id (TrfPersonaStore* self);
gint trf_persona_store_get_gender_male_id (TrfPersonaStore* self);
gint trf_persona_store_get_gender_female_id (TrfPersonaStore* self);
static void _trf_persona_store_build_predicates_table_data_free (gpointer _data);
static gboolean _trf_persona_store_build_predicates_table_co (TrfPersonaStoreBuildPredicatesTableData* data);
static void _trf_persona_store_build_urn_prefix_table (TrfPersonaStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_build_urn_prefix_table_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_build_predicates_table_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_build_urn_prefix_table_data_free (gpointer _data);
static gboolean _trf_persona_store_build_urn_prefix_table_co (TrfPersonaStoreBuildUrnPrefixTableData* data);
#define TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "<http://www.semanticdesktop.org/ontologies/2007/03/22/"
#define TRF_ONTOLOGY_DEFS_RDF_URL_PREFIX "<http://www.w3.org/1999/02/"
#define TRF_ONTOLOGY_DEFS_RDF_TYPE "ns:type"
#define TRF_ONTOLOGY_DEFS_NCO_PERSON "nco:PersonContact"
#define TRF_ONTOLOGY_DEFS_NCO_WEBSITE "nco:websiteUrl"
#define TRF_ONTOLOGY_DEFS_NCO_BLOG "nco:blogUrl"
#define TRF_ONTOLOGY_DEFS_NAO_URL_PREFIX "<http://www.semanticdesktop.org/ontologies/2007/08/15/"
static void _trf_persona_store_handle_events (TrfPersonaStore* self, GVariantIter* iter_del, GVariantIter* iter_ins, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_handle_events_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_handle_events_data_free (gpointer _data);
static gboolean _trf_persona_store_handle_events_co (TrfPersonaStoreHandleEventsData* data);
static void _trf_persona_store_handle_delete_events (TrfPersonaStore* self, GVariantIter* iter_del, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_handle_delete_events_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_handle_events_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_handle_insert_events (TrfPersonaStore* self, GVariantIter* iter_ins, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_handle_insert_events_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_handle_delete_events_data_free (gpointer _data);
static gboolean _trf_persona_store_handle_delete_events_co (TrfPersonaStoreHandleDeleteEventsData* data);
GType event_get_type (void) G_GNUC_CONST;
Event* event_dup (const Event* self);
void event_free (Event* self);
gchar* trf_persona_build_iid (const gchar* store_id, const gchar* tracker_id);
static void _trf_persona_store_do_update (TrfPersonaStore* self, TrfPersona* p, Event* e, gboolean adding, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_do_update_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_handle_delete_events_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_handle_insert_events_data_free (gpointer _data);
static gboolean _trf_persona_store_handle_insert_events_co (TrfPersonaStoreHandleInsertEventsData* data);
TrfPersona* trf_persona_new (TrfPersonaStore* store, const gchar* tracker_id, TrackerSparqlCursor* cursor);
TrfPersona* trf_persona_construct (GType object_type, TrfPersonaStore* store, const gchar* tracker_id, TrackerSparqlCursor* cursor);
static void _trf_persona_store_handle_insert_events_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_do_add_contacts_data_free (gpointer _data);
static gboolean _trf_persona_store_do_add_contacts_co (TrfPersonaStoreDoAddContactsData* data);
static void _trf_persona_store_do_add_contacts_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_do_update_data_free (gpointer _data);
static gboolean _trf_persona_store_do_update_co (TrfPersonaStoreDoUpdateData* data);
static void _trf_persona_store_get_property (TrfPersonaStore* self, gint subject_tracker_id, const gchar* property, const gchar* subject_type, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar* _trf_persona_store_get_property_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_do_update_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void _trf_persona_update_full_name (TrfPersona* self, const gchar* fn);
void _trf_persona_update_alias (TrfPersona* self, const gchar* alias);
void _trf_persona_update_family_name (TrfPersona* self, const gchar* family_name);
void _trf_persona_update_given_name (TrfPersona* self, const gchar* given_name);
void _trf_persona_update_additional_names (TrfPersona* self, const gchar* additional_names);
void _trf_persona_update_suffixes (TrfPersona* self, const gchar* suffixes);
void _trf_persona_update_prefixes (TrfPersona* self, const gchar* prefixes);
void _trf_persona_set_favourite (TrfPersona* self, gboolean is_fav);
gboolean _trf_persona_add_email (TrfPersona* self, const gchar* addr, const gchar* tracker_id);
gboolean _trf_persona_remove_email (TrfPersona* self, const gchar* tracker_id);
gboolean _trf_persona_add_phone (TrfPersona* self, const gchar* phone, const gchar* tracker_id);
gboolean _trf_persona_remove_phone (TrfPersona* self, const gchar* tracker_id);
static void _trf_persona_store_get_affl_info (TrfPersonaStore* self, const gchar* person_id, const gchar* affiliation_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
GType trf_affl_info_get_type (void) G_GNUC_CONST;
static TrfAfflInfo* _trf_persona_store_get_affl_info_finish (TrfPersonaStore* self, GAsyncResult* _res_);
gchar* trf_affl_info_to_string (TrfAfflInfo* self);
const gchar* trf_affl_info_get_im_tracker_id (TrfAfflInfo* self);
void _trf_persona_update_nickname (TrfPersona* self, const gchar* nickname);
const gchar* trf_affl_info_get_im_nickname (TrfAfflInfo* self);
const gchar* trf_affl_info_get_im_proto (TrfAfflInfo* self);
gboolean _trf_persona_add_im_address (TrfPersona* self, const gchar* tracker_id, const gchar* im_proto, const gchar* account_id, gboolean notify);
const gchar* trf_affl_info_get_affl_tracker_id (TrfAfflInfo* self);
const gchar* trf_affl_info_get_im_account_id (TrfAfflInfo* self);
const gchar* trf_affl_info_get_title (TrfAfflInfo* self);
const gchar* trf_affl_info_get_org (TrfAfflInfo* self);
gboolean _trf_persona_add_role (TrfPersona* self, const gchar* tracker_id, const gchar* title, const gchar* org);
gboolean _trf_persona_add_postal_address (TrfPersona* self, FolksPostalAddress* postal_address);
const gchar* trf_affl_info_get_phone (TrfAfflInfo* self);
const gchar* trf_affl_info_get_email (TrfAfflInfo* self);
const gchar* trf_affl_info_get_website (TrfAfflInfo* self);
gboolean _trf_persona_add_url (TrfPersona* self, const gchar* url, const gchar* tracker_id, const gchar* type);
const gchar* trf_affl_info_get_blog (TrfAfflInfo* self);
const gchar* trf_affl_info_get_url (TrfAfflInfo* self);
gboolean _trf_persona_remove_im_address (TrfPersona* self, const gchar* tracker_id, gboolean notify);
gboolean _trf_persona_remove_role (TrfPersona* self, const gchar* tracker_id);
gboolean _trf_persona_remove_postal_address (TrfPersona* self, const gchar* tracker_id);
gboolean _trf_persona_remove_url (TrfPersona* self, const gchar* tracker_id);
void _trf_persona_set_birthday (TrfPersona* self, const gchar* birthday);
void _trf_persona_set_note (TrfPersona* self, const gchar* note_content);
void _trf_persona_set_gender (TrfPersona* self, gint gender_id);
#define TRF_ONTOLOGY_DEFS_NFO_IMAGE "nfo:Image"
gboolean _trf_persona_set_avatar (TrfPersona* self, const gchar* avatar_url);
static void _trf_persona_store_get_nao_property_by_prop_id (TrfPersonaStore* self, gint nao_prop_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar** _trf_persona_store_get_nao_property_by_prop_id_finish (TrfPersonaStore* self, GAsyncResult* _res_, int* result_length1);
gboolean _trf_persona_set_local_ids (TrfPersona* self, const gchar* local_ids);
gboolean _trf_persona_set_web_service_addrs (TrfPersona* self, const gchar* ws_addrs);
static void _trf_persona_store_get_nao_property_by_person_id (TrfPersonaStore* self, gint nco_person_id, const gchar* prop_name, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar* _trf_persona_store_get_nao_property_by_person_id_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_get_property_data_free (gpointer _data);
static gboolean _trf_persona_store_get_property_co (TrfPersonaStoreGetPropertyData* data);
static void _trf_persona_store_single_value_query (TrfPersonaStore* self, const gchar* query, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar* _trf_persona_store_single_value_query_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_get_property_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_get_nao_property_by_person_id_data_free (gpointer _data);
static gboolean _trf_persona_store_get_nao_property_by_person_id_co (TrfPersonaStoreGetNaoPropertyByPersonIdData* data);
static void _trf_persona_store_get_nao_property_by_person_id_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_get_nao_property_by_prop_id_data_free (gpointer _data);
static gboolean _trf_persona_store_get_nao_property_by_prop_id_co (TrfPersonaStoreGetNaoPropertyByPropIdData* data);
static void _trf_persona_store_get_nao_property_by_prop_id_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_get_affl_info_data_free (gpointer _data);
static gboolean _trf_persona_store_get_affl_info_co (TrfPersonaStoreGetAfflInfoData* data);
TrfAfflInfo* trf_affl_info_new (void);
TrfAfflInfo* trf_affl_info_construct (GType object_type);
#define TRF_ONTOLOGY_DEFS_NCO_DISTRICT "nco:district"
#define TRF_ONTOLOGY_DEFS_NCO_COUNTY "nco:county"
#define TRF_ONTOLOGY_DEFS_NCO_ADDRESS_LOCATION "nco:addressLocation"
#define TRF_ONTOLOGY_DEFS_NCO_IM_NICKNAME "nco:imNickname"
static void _trf_persona_store_get_affl_info_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void trf_affl_info_set_im_tracker_id (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_im_proto (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_im_account_id (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_im_nickname (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_affl_tracker_id (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_title (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_org (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_email (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_phone (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_website (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_blog (TrfAfflInfo* self, const gchar* value);
void trf_affl_info_set_url (TrfAfflInfo* self, const gchar* value);
static void _trf_persona_store_insert_persona_data_free (gpointer _data);
static gboolean _trf_persona_store_insert_persona_co (TrfPersonaStoreInsertPersonaData* data);
static void _trf_persona_store_insert_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_single_value_query_data_free (gpointer _data);
static gboolean _trf_persona_store_single_value_query_co (TrfPersonaStoreSingleValueQueryData* data);
static void _trf_persona_store_multi_value_query (TrfPersonaStore* self, const gchar* query, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GeeHashSet* _trf_persona_store_multi_value_query_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_single_value_query_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_multi_value_query_data_free (gpointer _data);
static gboolean _trf_persona_store_multi_value_query_co (TrfPersonaStoreMultiValueQueryData* data);
static void _trf_persona_store_multi_value_query_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_urn_from_tracker_id_data_free (gpointer _data);
static void _trf_persona_store_urn_from_tracker_id (TrfPersonaStore* self, const gchar* tracker_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar* _trf_persona_store_urn_from_tracker_id_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_urn_from_tracker_id_co (TrfPersonaStoreUrnFromTrackerIdData* data);
static void _trf_persona_store_urn_from_tracker_id_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_alias_data_free (gpointer _data);
void _trf_persona_store_set_alias (TrfPersonaStore* self, TrfPersona* persona, const gchar* alias, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_alias_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_alias_co (TrfPersonaStoreSetAliasData* data);
gchar* trf_persona_tracker_id (TrfPersona* self);
static void _trf_persona_store_set_alias_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_local_ids_data_free (gpointer _data);
void _trf_persona_store_set_local_ids (TrfPersonaStore* self, TrfPersona* persona, GeeSet* local_ids, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_local_ids_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_local_ids_co (TrfPersonaStoreSetLocalIdsData* data);
static void _trf_persona_store_set_tracker_property (TrfPersonaStore* self, TrfPersona* persona, const gchar* prop_name, const gchar* prop_value, const gchar* callers_name, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_set_tracker_property_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_set_local_ids_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_web_service_addrs_data_free (gpointer _data);
void _trf_persona_store_set_web_service_addrs (TrfPersonaStore* self, TrfPersona* persona, GeeMultiMap* ws_obj, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_web_service_addrs_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_web_service_addrs_co (TrfPersonaStoreSetWebServiceAddrsData* data);
static void _trf_persona_store_set_web_service_addrs_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_tracker_property_data_free (gpointer _data);
static gboolean _trf_persona_store_set_tracker_property_co (TrfPersonaStoreSetTrackerPropertyData* data);
static void _trf_persona_store_set_tracker_property_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_is_favourite_data_free (gpointer _data);
void _trf_persona_store_set_is_favourite (TrfPersonaStore* self, FolksPersona* persona, gboolean is_favourite, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_is_favourite_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_is_favourite_co (TrfPersonaStoreSetIsFavouriteData* data);
static void _trf_persona_store_set_is_favourite_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_emails_data_free (gpointer _data);
void _trf_persona_store_set_emails (TrfPersonaStore* self, FolksPersona* persona, GeeSet* emails, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_emails_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_emails_co (TrfPersonaStoreSetEmailsData* data);
void _trf_persona_store_set_unique_attrib_set (TrfPersonaStore* self, FolksPersona* persona, GeeSet* properties, TrfAttrib attrib, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_unique_attrib_set_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_set_emails_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_phones_data_free (gpointer _data);
void _trf_persona_store_set_phones (TrfPersonaStore* self, FolksPersona* persona, GeeSet* phone_numbers, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_phones_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_phones_co (TrfPersonaStoreSetPhonesData* data);
static void _trf_persona_store_set_phones_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_unique_attrib_set_data_free (gpointer _data);
static gboolean _trf_persona_store_set_unique_attrib_set_co (TrfPersonaStoreSetUniqueAttribSetData* data);
static void _trf_persona_store_set_unique_attrib_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_urls_data_free (gpointer _data);
void _trf_persona_store_set_urls (TrfPersonaStore* self, FolksPersona* persona, GeeSet* urls, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_urls_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_urls_co (TrfPersonaStoreSetUrlsData* data);
static void _trf_persona_store_set_attrib_set (TrfPersonaStore* self, FolksPersona* persona, GeeSet* attribs, TrfAttrib what, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _trf_persona_store_set_attrib_set_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_set_urls_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_im_addresses_data_free (gpointer _data);
void _trf_persona_store_set_im_addresses (TrfPersonaStore* self, FolksPersona* persona, GeeMultiMap* im_addresses, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_im_addresses_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_im_addresses_co (TrfPersonaStoreSetImAddressesData* data);
static void _trf_persona_store_set_im_addresses_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_postal_addresses_data_free (gpointer _data);
void _trf_persona_store_set_postal_addresses (TrfPersonaStore* self, FolksPersona* persona, GeeSet* postal_addresses, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_postal_addresses_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_postal_addresses_co (TrfPersonaStoreSetPostalAddressesData* data);
static void _trf_persona_store_set_postal_addresses_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_roles_data_free (gpointer _data);
void _trf_persona_store_set_roles (TrfPersonaStore* self, FolksPersona* persona, GeeSet* roles, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_roles_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_roles_co (TrfPersonaStoreSetRolesData* data);
static void _trf_persona_store_set_roles_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_notes_data_free (gpointer _data);
void _trf_persona_store_set_notes (TrfPersonaStore* self, FolksPersona* persona, GeeSet* notes, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_notes_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_notes_co (TrfPersonaStoreSetNotesData* data);
static void _trf_persona_store_set_notes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_birthday_data_free (gpointer _data);
void _trf_persona_store_set_birthday (TrfPersonaStore* self, FolksPersona* persona, GDateTime* bday, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_birthday_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_birthday_co (TrfPersonaStoreSetBirthdayData* data);
static void _trf_persona_store_set_birthday_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_gender_data_free (gpointer _data);
void _trf_persona_store_set_gender (TrfPersonaStore* self, FolksPersona* persona, FolksGender gender, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_gender_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_gender_co (TrfPersonaStoreSetGenderData* data);
static void _trf_persona_store_set_gender_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_avatar_data_free (gpointer _data);
void _trf_persona_store_set_avatar (TrfPersonaStore* self, FolksPersona* persona, GFile* avatar, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_avatar_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_avatar_co (TrfPersonaStoreSetAvatarData* data);
#define TRF_ONTOLOGY_DEFS_NIE_DATAOBJECT "nie:DataObject"
static void _trf_persona_store_set_avatar_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_structured_name_data_free (gpointer _data);
void _trf_persona_store_set_structured_name (TrfPersonaStore* self, FolksPersona* persona, FolksStructuredName* sname, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_structured_name_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_structured_name_co (TrfPersonaStoreSetStructuredNameData* data);
static void _trf_persona_store_set_structured_name_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_full_name_data_free (gpointer _data);
void _trf_persona_store_set_full_name (TrfPersonaStore* self, FolksPersona* persona, const gchar* full_name, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _trf_persona_store_set_full_name_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_set_full_name_co (TrfPersonaStoreSetFullNameData* data);
static void _trf_persona_store_set_full_name_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_set_attrib_set_data_free (gpointer _data);
static gboolean _trf_persona_store_set_attrib_set_co (TrfPersonaStoreSetAttribSetData* data);
static void _trf_persona_store_set_attrib_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_tracker_update_data_free (gpointer _data);
static gboolean _trf_persona_store_tracker_update_co (TrfPersonaStoreTrackerUpdateData* data);
static void _trf_persona_store_tracker_update_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_affiliations_from_persona_data_free (gpointer _data);
static gboolean _trf_persona_store_affiliations_from_persona_co (TrfPersonaStoreAffiliationsFromPersonaData* data);
static void _trf_persona_store_linked_resources (TrfPersonaStore* self, const gchar* urn, const gchar* subject_type, const gchar* linking_predicate, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GeeHashSet* _trf_persona_store_linked_resources_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static void _trf_persona_store_affiliations_from_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_phones_from_affiliation_data_free (gpointer _data);
static gboolean _trf_persona_store_phones_from_affiliation_co (TrfPersonaStorePhonesFromAffiliationData* data);
static void _trf_persona_store_phones_from_affiliation_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_postals_from_affiliation_data_free (gpointer _data);
static gboolean _trf_persona_store_postals_from_affiliation_co (TrfPersonaStorePostalsFromAffiliationData* data);
static void _trf_persona_store_postals_from_affiliation_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_imaddrs_from_affiliation_data_free (gpointer _data);
static gboolean _trf_persona_store_imaddrs_from_affiliation_co (TrfPersonaStoreImaddrsFromAffiliationData* data);
static void _trf_persona_store_imaddrs_from_affiliation_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_emails_from_affiliation_data_free (gpointer _data);
static gboolean _trf_persona_store_emails_from_affiliation_co (TrfPersonaStoreEmailsFromAffiliationData* data);
static void _trf_persona_store_emails_from_affiliation_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_resource_usage_count_data_free (gpointer _data);
static void _trf_persona_store_resource_usage_count (TrfPersonaStore* self, const gchar* resource, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gint _trf_persona_store_resource_usage_count_finish (TrfPersonaStore* self, GAsyncResult* _res_);
static gboolean _trf_persona_store_resource_usage_count_co (TrfPersonaStoreResourceUsageCountData* data);
static void _trf_persona_store_resource_usage_count_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_delete_resource_data_free (gpointer _data);
static gboolean _trf_persona_store_delete_resource_co (TrfPersonaStoreDeleteResourceData* data);
static void _trf_persona_store_delete_resource_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_linked_resources_data_free (gpointer _data);
static gboolean _trf_persona_store_linked_resources_co (TrfPersonaStoreLinkedResourcesData* data);
static void _trf_persona_store_linked_resources_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_urn_from_persona_data_free (gpointer _data);
static gboolean _trf_persona_store_urn_from_persona_co (TrfPersonaStoreUrnFromPersonaData* data);
static void _trf_persona_store_urn_from_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _trf_persona_store_urn_from_property_data_free (gpointer _data);
static gboolean _trf_persona_store_urn_from_property_co (TrfPersonaStoreUrnFromPropertyData* data);
static void _trf_persona_store_urn_from_property_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void trf_persona_store_finalize (GObject* obj);
static void _vala_trf_persona_store_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


GType trf_fields_get_type (void) {
	static volatile gsize trf_fields_type_id__volatile = 0;
	if (g_once_init_enter (&trf_fields_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_FIELDS_TRACKER_ID, "TRF_FIELDS_TRACKER_ID", "tracker-id"}, {TRF_FIELDS_FULL_NAME, "TRF_FIELDS_FULL_NAME", "full-name"}, {TRF_FIELDS_FAMILY_NAME, "TRF_FIELDS_FAMILY_NAME", "family-name"}, {TRF_FIELDS_GIVEN_NAME, "TRF_FIELDS_GIVEN_NAME", "given-name"}, {TRF_FIELDS_ADDITIONAL_NAMES, "TRF_FIELDS_ADDITIONAL_NAMES", "additional-names"}, {TRF_FIELDS_PREFIXES, "TRF_FIELDS_PREFIXES", "prefixes"}, {TRF_FIELDS_SUFFIXES, "TRF_FIELDS_SUFFIXES", "suffixes"}, {TRF_FIELDS_ALIAS, "TRF_FIELDS_ALIAS", "alias"}, {TRF_FIELDS_BIRTHDAY, "TRF_FIELDS_BIRTHDAY", "birthday"}, {TRF_FIELDS_AVATAR_URL, "TRF_FIELDS_AVATAR_URL", "avatar-url"}, {TRF_FIELDS_IM_ADDRESSES, "TRF_FIELDS_IM_ADDRESSES", "im-addresses"}, {TRF_FIELDS_PHONES, "TRF_FIELDS_PHONES", "phones"}, {TRF_FIELDS_EMAILS, "TRF_FIELDS_EMAILS", "emails"}, {TRF_FIELDS_URLS, "TRF_FIELDS_URLS", "urls"}, {TRF_FIELDS_FAVOURITE, "TRF_FIELDS_FAVOURITE", "favourite"}, {TRF_FIELDS_CONTACT_URN, "TRF_FIELDS_CONTACT_URN", "contact-urn"}, {TRF_FIELDS_ROLES, "TRF_FIELDS_ROLES", "roles"}, {TRF_FIELDS_NOTE, "TRF_FIELDS_NOTE", "note"}, {TRF_FIELDS_GENDER, "TRF_FIELDS_GENDER", "gender"}, {TRF_FIELDS_POSTAL_ADDRESS, "TRF_FIELDS_POSTAL_ADDRESS", "postal-address"}, {TRF_FIELDS_LOCAL_IDS_PROPERTY, "TRF_FIELDS_LOCAL_IDS_PROPERTY", "local-ids-property"}, {0, NULL, NULL}};
		GType trf_fields_type_id;
		trf_fields_type_id = g_enum_register_static ("TrfFields", values);
		g_once_init_leave (&trf_fields_type_id__volatile, trf_fields_type_id);
	}
	return trf_fields_type_id__volatile;
}


GType trf_affl_info_fields_get_type (void) {
	static volatile gsize trf_affl_info_fields_type_id__volatile = 0;
	if (g_once_init_enter (&trf_affl_info_fields_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_AFFL_INFO_FIELDS_IM_TRACKER_ID, "TRF_AFFL_INFO_FIELDS_IM_TRACKER_ID", "im-tracker-id"}, {TRF_AFFL_INFO_FIELDS_IM_PROTOCOL, "TRF_AFFL_INFO_FIELDS_IM_PROTOCOL", "im-protocol"}, {TRF_AFFL_INFO_FIELDS_IM_ACCOUNT_ID, "TRF_AFFL_INFO_FIELDS_IM_ACCOUNT_ID", "im-account-id"}, {TRF_AFFL_INFO_FIELDS_AFFL_TRACKER_ID, "TRF_AFFL_INFO_FIELDS_AFFL_TRACKER_ID", "affl-tracker-id"}, {TRF_AFFL_INFO_FIELDS_AFFL_ROLE, "TRF_AFFL_INFO_FIELDS_AFFL_ROLE", "affl-role"}, {TRF_AFFL_INFO_FIELDS_AFFL_ORG, "TRF_AFFL_INFO_FIELDS_AFFL_ORG", "affl-org"}, {TRF_AFFL_INFO_FIELDS_AFFL_POBOX, "TRF_AFFL_INFO_FIELDS_AFFL_POBOX", "affl-pobox"}, {TRF_AFFL_INFO_FIELDS_AFFL_DISTRICT, "TRF_AFFL_INFO_FIELDS_AFFL_DISTRICT", "affl-district"}, {TRF_AFFL_INFO_FIELDS_AFFL_COUNTY, "TRF_AFFL_INFO_FIELDS_AFFL_COUNTY", "affl-county"}, {TRF_AFFL_INFO_FIELDS_AFFL_LOCALITY, "TRF_AFFL_INFO_FIELDS_AFFL_LOCALITY", "affl-locality"}, {TRF_AFFL_INFO_FIELDS_AFFL_POSTALCODE, "TRF_AFFL_INFO_FIELDS_AFFL_POSTALCODE", "affl-postalcode"}, {TRF_AFFL_INFO_FIELDS_AFFL_STREET_ADDRESS, "TRF_AFFL_INFO_FIELDS_AFFL_STREET_ADDRESS", "affl-street-address"}, {TRF_AFFL_INFO_FIELDS_AFFL_ADDRESS_LOCATION, "TRF_AFFL_INFO_FIELDS_AFFL_ADDRESS_LOCATION", "affl-address-location"}, {TRF_AFFL_INFO_FIELDS_AFFL_EXTENDED_ADDRESS, "TRF_AFFL_INFO_FIELDS_AFFL_EXTENDED_ADDRESS", "affl-extended-address"}, {TRF_AFFL_INFO_FIELDS_AFFL_COUNTRY, "TRF_AFFL_INFO_FIELDS_AFFL_COUNTRY", "affl-country"}, {TRF_AFFL_INFO_FIELDS_AFFL_REGION, "TRF_AFFL_INFO_FIELDS_AFFL_REGION", "affl-region"}, {TRF_AFFL_INFO_FIELDS_AFFL_EMAIL, "TRF_AFFL_INFO_FIELDS_AFFL_EMAIL", "affl-email"}, {TRF_AFFL_INFO_FIELDS_AFFL_PHONE, "TRF_AFFL_INFO_FIELDS_AFFL_PHONE", "affl-phone"}, {TRF_AFFL_INFO_FIELDS_AFFL_WEBSITE, "TRF_AFFL_INFO_FIELDS_AFFL_WEBSITE", "affl-website"}, {TRF_AFFL_INFO_FIELDS_AFFL_BLOG, "TRF_AFFL_INFO_FIELDS_AFFL_BLOG", "affl-blog"}, {TRF_AFFL_INFO_FIELDS_AFFL_URL, "TRF_AFFL_INFO_FIELDS_AFFL_URL", "affl-url"}, {TRF_AFFL_INFO_FIELDS_IM_NICKNAME, "TRF_AFFL_INFO_FIELDS_IM_NICKNAME", "im-nickname"}, {0, NULL, NULL}};
		GType trf_affl_info_fields_type_id;
		trf_affl_info_fields_type_id = g_enum_register_static ("TrfAfflInfoFields", values);
		g_once_init_leave (&trf_affl_info_fields_type_id__volatile, trf_affl_info_fields_type_id);
	}
	return trf_affl_info_fields_type_id__volatile;
}


GType trf_postal_address_fields_get_type (void) {
	static volatile gsize trf_postal_address_fields_type_id__volatile = 0;
	if (g_once_init_enter (&trf_postal_address_fields_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_POSTAL_ADDRESS_FIELDS_TRACKER_ID, "TRF_POSTAL_ADDRESS_FIELDS_TRACKER_ID", "tracker-id"}, {TRF_POSTAL_ADDRESS_FIELDS_POBOX, "TRF_POSTAL_ADDRESS_FIELDS_POBOX", "pobox"}, {TRF_POSTAL_ADDRESS_FIELDS_DISTRICT, "TRF_POSTAL_ADDRESS_FIELDS_DISTRICT", "district"}, {TRF_POSTAL_ADDRESS_FIELDS_COUNTY, "TRF_POSTAL_ADDRESS_FIELDS_COUNTY", "county"}, {TRF_POSTAL_ADDRESS_FIELDS_LOCALITY, "TRF_POSTAL_ADDRESS_FIELDS_LOCALITY", "locality"}, {TRF_POSTAL_ADDRESS_FIELDS_POSTALCODE, "TRF_POSTAL_ADDRESS_FIELDS_POSTALCODE", "postalcode"}, {TRF_POSTAL_ADDRESS_FIELDS_STREET_ADDRESS, "TRF_POSTAL_ADDRESS_FIELDS_STREET_ADDRESS", "street-address"}, {TRF_POSTAL_ADDRESS_FIELDS_ADDRESS_LOCATION, "TRF_POSTAL_ADDRESS_FIELDS_ADDRESS_LOCATION", "address-location"}, {TRF_POSTAL_ADDRESS_FIELDS_EXTENDED_ADDRESS, "TRF_POSTAL_ADDRESS_FIELDS_EXTENDED_ADDRESS", "extended-address"}, {TRF_POSTAL_ADDRESS_FIELDS_COUNTRY, "TRF_POSTAL_ADDRESS_FIELDS_COUNTRY", "country"}, {TRF_POSTAL_ADDRESS_FIELDS_REGION, "TRF_POSTAL_ADDRESS_FIELDS_REGION", "region"}, {0, NULL, NULL}};
		GType trf_postal_address_fields_type_id;
		trf_postal_address_fields_type_id = g_enum_register_static ("TrfPostalAddressFields", values);
		g_once_init_leave (&trf_postal_address_fields_type_id__volatile, trf_postal_address_fields_type_id);
	}
	return trf_postal_address_fields_type_id__volatile;
}


GType trf_urls_fields_get_type (void) {
	static volatile gsize trf_urls_fields_type_id__volatile = 0;
	if (g_once_init_enter (&trf_urls_fields_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_URLS_FIELDS_TRACKER_ID, "TRF_URLS_FIELDS_TRACKER_ID", "tracker-id"}, {TRF_URLS_FIELDS_BLOG, "TRF_URLS_FIELDS_BLOG", "blog"}, {TRF_URLS_FIELDS_WEBSITE, "TRF_URLS_FIELDS_WEBSITE", "website"}, {TRF_URLS_FIELDS_URL, "TRF_URLS_FIELDS_URL", "url"}, {0, NULL, NULL}};
		GType trf_urls_fields_type_id;
		trf_urls_fields_type_id = g_enum_register_static ("TrfUrlsFields", values);
		g_once_init_leave (&trf_urls_fields_type_id__volatile, trf_urls_fields_type_id);
	}
	return trf_urls_fields_type_id__volatile;
}


GType trf_role_fields_get_type (void) {
	static volatile gsize trf_role_fields_type_id__volatile = 0;
	if (g_once_init_enter (&trf_role_fields_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_ROLE_FIELDS_TRACKER_ID, "TRF_ROLE_FIELDS_TRACKER_ID", "tracker-id"}, {TRF_ROLE_FIELDS_ROLE, "TRF_ROLE_FIELDS_ROLE", "role"}, {TRF_ROLE_FIELDS_DEPARTMENT, "TRF_ROLE_FIELDS_DEPARTMENT", "department"}, {0, NULL, NULL}};
		GType trf_role_fields_type_id;
		trf_role_fields_type_id = g_enum_register_static ("TrfRoleFields", values);
		g_once_init_leave (&trf_role_fields_type_id__volatile, trf_role_fields_type_id);
	}
	return trf_role_fields_type_id__volatile;
}


GType trf_im_fields_get_type (void) {
	static volatile gsize trf_im_fields_type_id__volatile = 0;
	if (g_once_init_enter (&trf_im_fields_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_IM_FIELDS_TRACKER_ID, "TRF_IM_FIELDS_TRACKER_ID", "tracker-id"}, {TRF_IM_FIELDS_PROTO, "TRF_IM_FIELDS_PROTO", "proto"}, {TRF_IM_FIELDS_ID, "TRF_IM_FIELDS_ID", "id"}, {TRF_IM_FIELDS_IM_NICKNAME, "TRF_IM_FIELDS_IM_NICKNAME", "im-nickname"}, {0, NULL, NULL}};
		GType trf_im_fields_type_id;
		trf_im_fields_type_id = g_enum_register_static ("TrfIMFields", values);
		g_once_init_leave (&trf_im_fields_type_id__volatile, trf_im_fields_type_id);
	}
	return trf_im_fields_type_id__volatile;
}


GType trf_phone_fields_get_type (void) {
	static volatile gsize trf_phone_fields_type_id__volatile = 0;
	if (g_once_init_enter (&trf_phone_fields_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_PHONE_FIELDS_TRACKER_ID, "TRF_PHONE_FIELDS_TRACKER_ID", "tracker-id"}, {TRF_PHONE_FIELDS_PHONE, "TRF_PHONE_FIELDS_PHONE", "phone"}, {0, NULL, NULL}};
		GType trf_phone_fields_type_id;
		trf_phone_fields_type_id = g_enum_register_static ("TrfPhoneFields", values);
		g_once_init_leave (&trf_phone_fields_type_id__volatile, trf_phone_fields_type_id);
	}
	return trf_phone_fields_type_id__volatile;
}


GType trf_email_fields_get_type (void) {
	static volatile gsize trf_email_fields_type_id__volatile = 0;
	if (g_once_init_enter (&trf_email_fields_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_EMAIL_FIELDS_TRACKER_ID, "TRF_EMAIL_FIELDS_TRACKER_ID", "tracker-id"}, {TRF_EMAIL_FIELDS_EMAIL, "TRF_EMAIL_FIELDS_EMAIL", "email"}, {0, NULL, NULL}};
		GType trf_email_fields_type_id;
		trf_email_fields_type_id = g_enum_register_static ("TrfEmailFields", values);
		g_once_init_leave (&trf_email_fields_type_id__volatile, trf_email_fields_type_id);
	}
	return trf_email_fields_type_id__volatile;
}


GType trf_tag_fields_get_type (void) {
	static volatile gsize trf_tag_fields_type_id__volatile = 0;
	if (g_once_init_enter (&trf_tag_fields_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_TAG_FIELDS_TRACKER_ID, "TRF_TAG_FIELDS_TRACKER_ID", "tracker-id"}, {0, NULL, NULL}};
		GType trf_tag_fields_type_id;
		trf_tag_fields_type_id = g_enum_register_static ("TrfTagFields", values);
		g_once_init_leave (&trf_tag_fields_type_id__volatile, trf_tag_fields_type_id);
	}
	return trf_tag_fields_type_id__volatile;
}


GType trf_attrib_get_type (void) {
	static volatile gsize trf_attrib_type_id__volatile = 0;
	if (g_once_init_enter (&trf_attrib_type_id__volatile)) {
		static const GEnumValue values[] = {{TRF_ATTRIB_EMAILS, "TRF_ATTRIB_EMAILS", "emails"}, {TRF_ATTRIB_PHONES, "TRF_ATTRIB_PHONES", "phones"}, {TRF_ATTRIB_URLS, "TRF_ATTRIB_URLS", "urls"}, {TRF_ATTRIB_IM_ADDRESSES, "TRF_ATTRIB_IM_ADDRESSES", "im-addresses"}, {TRF_ATTRIB_POSTAL_ADDRESSES, "TRF_ATTRIB_POSTAL_ADDRESSES", "postal-addresses"}, {0, NULL, NULL}};
		GType trf_attrib_type_id;
		trf_attrib_type_id = g_enum_register_static ("TrfAttrib", values);
		g_once_init_leave (&trf_attrib_type_id__volatile, trf_attrib_type_id);
	}
	return trf_attrib_type_id__volatile;
}


/**
   * Create a new PersonaStore.
   *
   * Create a new persona store to store the {@link Persona}s for the contacts
   */
TrfPersonaStore* trf_persona_store_construct (GType object_type) {
	TrfPersonaStore * self = NULL;
	GeeHashMap* _tmp0_ = NULL;
	GeeMap* _tmp1_ = NULL;
	self = (TrfPersonaStore*) g_object_new (object_type, "id", BACKEND_NAME, "display-name", BACKEND_NAME, NULL);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, TRF_TYPE_PERSONA, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->_personas);
	self->priv->_personas = _tmp0_;
	_tmp1_ = gee_abstract_map_get_read_only_view ((GeeAbstractMap*) self->priv->_personas);
	_g_object_unref0 (self->priv->_personas_ro);
	self->priv->_personas_ro = _tmp1_;
	g_debug ("trf-persona-store.vala:375: Initial query : \n%s\n", TRF_PERSONA_STORE__INITIAL_QUERY);
	return self;
}


TrfPersonaStore* trf_persona_store_new (void) {
	return trf_persona_store_construct (TRF_TYPE_PERSONA_STORE);
}


static void trf_persona_store_real_add_persona_from_details_data_free (gpointer _data) {
	TrfPersonaStoreAddPersonaFromDetailsData* data;
	data = _data;
	_g_hash_table_unref0 (data->details);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreAddPersonaFromDetailsData, data);
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static gpointer _g_hash_table_ref0 (gpointer self) {
	return self ? g_hash_table_ref (self) : NULL;
}


static void trf_persona_store_real_add_persona_from_details (FolksPersonaStore* base, GHashTable* details, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStore * self;
	TrfPersonaStoreAddPersonaFromDetailsData* _data_;
	self = (TrfPersonaStore*) base;
	_data_ = g_slice_new0 (TrfPersonaStoreAddPersonaFromDetailsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, trf_persona_store_real_add_persona_from_details);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, trf_persona_store_real_add_persona_from_details_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->details = _g_hash_table_ref0 (details);
	trf_persona_store_real_add_persona_from_details_co (_data_);
}


static FolksPersona* trf_persona_store_real_add_persona_from_details_finish (FolksPersonaStore* base, GAsyncResult* _res_, GError** error) {
	FolksPersona* result;
	TrfPersonaStoreAddPersonaFromDetailsData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


/**
   * Add a new {@link Persona} to the PersonaStore.
   *
   * Accepted keys for `details` are:
   * - PersonaStore.detail_key (PersonaDetail.IM_ADDRESSES)
   * - PersonaStore.detail_key (PersonaDetail.ALIAS)
   * - PersonaStore.detail_key (PersonaDetail.FULL_NAME)
   * - PersonaStore.detail_key (PersonaDetail.IS_FAVOURITE)
   * - PersonaStore.detail_key (PersonaDetail.STRUCTURED_NAME)
   * - PersonaStore.detail_key (PersonaDetail.AVATAR)
   * - PersonaStore.detail_key (PersonaDetail.BIRTHDAY)
   * - PersonaStore.detail_key (PersonaDetail.GENDER)
   * - PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES)
   * - PersonaStore.detail_key (PersonaDetail.IM_ADDRESSES)
   * - PersonaStore.detail_key (PersonaDetail.NOTES)
   * - PersonaStore.detail_key (PersonaDetail.PHONE_NUMBERS)
   * - PersonaStore.detail_key (PersonaDetail.POSTAL_ADDRESSES)
   * - PersonaStore.detail_key (PersonaDetail.ROLES)
   * - PersonaStore.detail_key (PersonaDetail.URL)
   * - PersonaStore.detail_key (PersonaDetail.WEB_SERVICE_ADDRESSES)
   *
   * See {@link Folks.PersonaStore.add_persona_from_details}.
   */
static GValue* _g_value_dup (GValue* self) {
	return g_boxed_copy (G_TYPE_VALUE, self);
}


static gpointer __g_value_dup0 (gpointer self) {
	return self ? _g_value_dup (self) : NULL;
}


static gpointer _g_date_time_ref0 (gpointer self) {
	return self ? g_date_time_ref (self) : NULL;
}


static void trf_persona_store_add_persona_from_details_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreAddPersonaFromDetailsData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	trf_persona_store_real_add_persona_from_details_co (data);
}


static void _vala_GValue_free (GValue* self) {
	g_value_unset (self);
	g_free (self);
}


static gboolean trf_persona_store_real_add_persona_from_details_co (TrfPersonaStoreAddPersonaFromDetailsData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = tracker_sparql_builder_new_update ();
	data->builder = data->_tmp0_;
	tracker_sparql_builder_insert_open (data->builder, NULL);
	tracker_sparql_builder_subject (data->builder, "_:p");
	tracker_sparql_builder_predicate (data->builder, "a");
	tracker_sparql_builder_object (data->builder, "nco:PersonContact");
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_hash_table_get_keys (data->details);
	{
		data->k_collection = data->_tmp1_;
		for (data->k_it = data->k_collection; data->k_it != NULL; data->k_it = data->k_it->next) {
			data->k = (const gchar*) data->k_it->data;
			{
				data->_tmp2_ = NULL;
				data->_tmp2_ = g_hash_table_lookup (data->details, data->k);
				data->_tmp3_ = __g_value_dup0 ((GValue*) data->_tmp2_);
				data->v = data->_tmp3_;
				data->_tmp4_ = NULL;
				data->_tmp4_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_ALIAS);
				if (g_strcmp0 (data->k, data->_tmp4_) == 0) {
					tracker_sparql_builder_subject (data->builder, "_:p");
					tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_NICKNAME);
					data->_tmp5_ = NULL;
					data->_tmp5_ = g_value_get_string (data->v);
					tracker_sparql_builder_object_string (data->builder, data->_tmp5_);
				} else {
					data->_tmp6_ = NULL;
					data->_tmp6_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_FULL_NAME);
					if (g_strcmp0 (data->k, data->_tmp6_) == 0) {
						tracker_sparql_builder_subject (data->builder, "_:p");
						tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_FULLNAME);
						data->_tmp7_ = NULL;
						data->_tmp7_ = g_value_get_string (data->v);
						tracker_sparql_builder_object_string (data->builder, data->_tmp7_);
					} else {
						data->_tmp8_ = NULL;
						data->_tmp8_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_STRUCTURED_NAME);
						if (g_strcmp0 (data->k, data->_tmp8_) == 0) {
							data->_tmp9_ = NULL;
							data->_tmp9_ = g_value_get_object (data->v);
							data->_tmp10_ = _g_object_ref0 (FOLKS_STRUCTURED_NAME (data->_tmp9_));
							data->sname = data->_tmp10_;
							tracker_sparql_builder_subject (data->builder, "_:p");
							tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_FAMILY);
							data->_tmp11_ = NULL;
							data->_tmp11_ = folks_structured_name_get_family_name (data->sname);
							tracker_sparql_builder_object_string (data->builder, data->_tmp11_);
							tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_GIVEN);
							data->_tmp12_ = NULL;
							data->_tmp12_ = folks_structured_name_get_given_name (data->sname);
							tracker_sparql_builder_object_string (data->builder, data->_tmp12_);
							tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_ADDITIONAL);
							data->_tmp13_ = NULL;
							data->_tmp13_ = folks_structured_name_get_additional_names (data->sname);
							tracker_sparql_builder_object_string (data->builder, data->_tmp13_);
							tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_SUFFIX);
							data->_tmp14_ = NULL;
							data->_tmp14_ = folks_structured_name_get_suffixes (data->sname);
							tracker_sparql_builder_object_string (data->builder, data->_tmp14_);
							tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_PREFIX);
							data->_tmp15_ = NULL;
							data->_tmp15_ = folks_structured_name_get_prefixes (data->sname);
							tracker_sparql_builder_object_string (data->builder, data->_tmp15_);
							_g_object_unref0 (data->sname);
						} else {
							data->_tmp16_ = NULL;
							data->_tmp16_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_IS_FAVOURITE);
							if (g_strcmp0 (data->k, data->_tmp16_) == 0) {
								data->_tmp17_ = g_value_get_boolean (data->v);
								if (data->_tmp17_) {
									tracker_sparql_builder_subject (data->builder, "_:p");
									tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NAO_TAG);
									tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NAO_FAVORITE);
								}
							} else {
								data->_tmp18_ = NULL;
								data->_tmp18_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_AVATAR);
								if (g_strcmp0 (data->k, data->_tmp18_) == 0) {
									data->_tmp19_ = NULL;
									data->_tmp19_ = g_value_get_object (data->v);
									data->_tmp20_ = _g_object_ref0 (G_FILE (data->_tmp19_));
									data->avatar = data->_tmp20_;
									tracker_sparql_builder_subject (data->builder, "_:photo");
									tracker_sparql_builder_predicate (data->builder, "a");
									tracker_sparql_builder_object (data->builder, "nfo:Image, nie:DataObject");
									tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NIE_URL);
									data->_tmp21_ = NULL;
									data->_tmp21_ = g_file_get_uri (data->avatar);
									data->_tmp22_ = data->_tmp21_;
									tracker_sparql_builder_object_string (data->builder, data->_tmp22_);
									_g_free0 (data->_tmp22_);
									tracker_sparql_builder_subject (data->builder, "_:p");
									tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_PHOTO);
									tracker_sparql_builder_object (data->builder, "_:photo");
									_g_object_unref0 (data->avatar);
								} else {
									data->_tmp23_ = NULL;
									data->_tmp23_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_BIRTHDAY);
									if (g_strcmp0 (data->k, data->_tmp23_) == 0) {
										data->_tmp24_ = NULL;
										data->_tmp24_ = g_value_get_boxed (data->v);
										data->_tmp25_ = _g_date_time_ref0 ((GDateTime*) data->_tmp24_);
										data->birthday = data->_tmp25_;
										tracker_sparql_builder_subject (data->builder, "_:p");
										tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_BIRTHDAY);
										memset (&data->_tmp26_, 0, sizeof (GTimeVal));
										g_date_time_to_timeval (data->birthday, &data->_tmp26_);
										data->tv = data->_tmp26_;
										data->_tmp27_ = NULL;
										data->_tmp27_ = g_time_val_to_iso8601 (&data->tv);
										data->_tmp28_ = data->_tmp27_;
										tracker_sparql_builder_object_string (data->builder, data->_tmp28_);
										_g_free0 (data->_tmp28_);
										_g_date_time_unref0 (data->birthday);
									} else {
										data->_tmp29_ = NULL;
										data->_tmp29_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_GENDER);
										if (g_strcmp0 (data->k, data->_tmp29_) == 0) {
											data->_tmp30_ = g_value_get_enum (data->v);
											data->gender = (FolksGender) data->_tmp30_;
											if (data->gender != FOLKS_GENDER_UNSPECIFIED) {
												tracker_sparql_builder_subject (data->builder, "_:p");
												tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_GENDER);
												if (data->gender == FOLKS_GENDER_MALE) {
													tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_MALE);
												} else {
													tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_FEMALE);
												}
											}
										} else {
											data->_tmp31_ = NULL;
											data->_tmp31_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_EMAIL_ADDRESSES);
											if (g_strcmp0 (data->k, data->_tmp31_) == 0) {
												data->_tmp32_ = NULL;
												data->_tmp32_ = g_value_get_object (data->v);
												data->_tmp33_ = _g_object_ref0 (GEE_SET (data->_tmp32_));
												data->email_addresses = data->_tmp33_;
												data->_state_ = 1;
												_trf_persona_store_build_update_query_set (data->self, data->builder, data->email_addresses, "_:p", TRF_ATTRIB_EMAILS, trf_persona_store_add_persona_from_details_ready, data);
												return FALSE;
												_state_1:
												_trf_persona_store_build_update_query_set_finish (data->self, data->_res_);
												_g_object_unref0 (data->email_addresses);
											} else {
												data->_tmp34_ = NULL;
												data->_tmp34_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_IM_ADDRESSES);
												if (g_strcmp0 (data->k, data->_tmp34_) == 0) {
													data->_tmp35_ = NULL;
													data->_tmp35_ = g_value_get_object (data->v);
													data->_tmp36_ = _g_object_ref0 (GEE_MULTI_MAP (data->_tmp35_));
													data->im_addresses = data->_tmp36_;
													data->im_cnt = 0;
													{
														data->_tmp37_ = NULL;
														data->_tmp37_ = gee_multi_map_get_keys (data->im_addresses);
														data->_tmp38_ = data->_tmp37_;
														data->_tmp39_ = NULL;
														data->_tmp39_ = gee_iterable_iterator ((GeeIterable*) data->_tmp38_);
														data->_tmp40_ = data->_tmp39_;
														_g_object_unref0 (data->_tmp38_);
														data->_proto_it = data->_tmp40_;
														while (TRUE) {
															data->_tmp41_ = gee_iterator_next (data->_proto_it);
															if (!data->_tmp41_) {
																break;
															}
															data->_tmp42_ = NULL;
															data->_tmp42_ = gee_iterator_get (data->_proto_it);
															data->proto = (gchar*) data->_tmp42_;
															data->_tmp43_ = NULL;
															data->_tmp43_ = gee_multi_map_get (data->im_addresses, data->proto);
															data->addrs_a = data->_tmp43_;
															{
																data->_tmp44_ = NULL;
																data->_tmp44_ = gee_iterable_iterator ((GeeIterable*) data->addrs_a);
																data->_addr_it = data->_tmp44_;
																while (TRUE) {
																	data->_tmp45_ = gee_iterator_next (data->_addr_it);
																	if (!data->_tmp45_) {
																		break;
																	}
																	data->_tmp46_ = NULL;
																	data->_tmp46_ = gee_iterator_get (data->_addr_it);
																	data->addr = (gchar*) data->_tmp46_;
																	data->_tmp47_ = NULL;
																	data->_tmp47_ = g_strdup_printf ("_:im_affl%d", data->im_cnt);
																	data->im_affl = data->_tmp47_;
																	data->_tmp48_ = NULL;
																	data->_tmp48_ = g_strdup_printf ("_:im%d", data->im_cnt);
																	data->im = data->_tmp48_;
																	tracker_sparql_builder_subject (data->builder, data->im);
																	tracker_sparql_builder_predicate (data->builder, "a");
																	tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_IMADDRESS);
																	tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_IMID);
																	tracker_sparql_builder_object_string (data->builder, data->addr);
																	tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_IMPROTOCOL);
																	tracker_sparql_builder_object_string (data->builder, data->proto);
																	tracker_sparql_builder_subject (data->builder, data->im_affl);
																	tracker_sparql_builder_predicate (data->builder, "a");
																	tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION);
																	tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_HAS_IMADDRESS);
																	tracker_sparql_builder_object (data->builder, data->im);
																	tracker_sparql_builder_subject (data->builder, "_:p");
																	tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION);
																	tracker_sparql_builder_object (data->builder, data->im_affl);
																	data->im_cnt++;
																	_g_free0 (data->im);
																	_g_free0 (data->im_affl);
																	_g_free0 (data->addr);
																}
																_g_object_unref0 (data->_addr_it);
															}
															_g_object_unref0 (data->addrs_a);
															_g_free0 (data->proto);
														}
														_g_object_unref0 (data->_proto_it);
													}
													_g_object_unref0 (data->im_addresses);
												} else {
													data->_tmp49_ = NULL;
													data->_tmp49_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_NOTES);
													if (g_strcmp0 (data->k, data->_tmp49_) == 0) {
														data->_tmp50_ = NULL;
														data->_tmp50_ = g_value_get_object (data->v);
														data->_tmp51_ = _g_object_ref0 (GEE_HASH_SET (data->_tmp50_));
														data->notes = data->_tmp51_;
														{
															data->_tmp52_ = NULL;
															data->_tmp52_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) data->notes);
															data->_n_it = data->_tmp52_;
															while (TRUE) {
																data->_tmp53_ = gee_iterator_next (data->_n_it);
																if (!data->_tmp53_) {
																	break;
																}
																data->_tmp54_ = NULL;
																data->_tmp54_ = gee_iterator_get (data->_n_it);
																data->n = (FolksNote*) data->_tmp54_;
																tracker_sparql_builder_subject (data->builder, "_:p");
																tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_NOTE);
																data->_tmp55_ = NULL;
																data->_tmp55_ = folks_note_get_content (data->n);
																tracker_sparql_builder_object_string (data->builder, data->_tmp55_);
																_g_object_unref0 (data->n);
															}
															_g_object_unref0 (data->_n_it);
														}
														_g_object_unref0 (data->notes);
													} else {
														data->_tmp56_ = NULL;
														data->_tmp56_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_PHONE_NUMBERS);
														if (g_strcmp0 (data->k, data->_tmp56_) == 0) {
															data->_tmp57_ = NULL;
															data->_tmp57_ = g_value_get_object (data->v);
															data->_tmp58_ = _g_object_ref0 (GEE_SET (data->_tmp57_));
															data->phone_numbers = data->_tmp58_;
															data->_state_ = 2;
															_trf_persona_store_build_update_query_set (data->self, data->builder, data->phone_numbers, "_:p", TRF_ATTRIB_PHONES, trf_persona_store_add_persona_from_details_ready, data);
															return FALSE;
															_state_2:
															_trf_persona_store_build_update_query_set_finish (data->self, data->_res_);
															_g_object_unref0 (data->phone_numbers);
														} else {
															data->_tmp59_ = NULL;
															data->_tmp59_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_ROLES);
															if (g_strcmp0 (data->k, data->_tmp59_) == 0) {
																data->_tmp60_ = NULL;
																data->_tmp60_ = g_value_get_object (data->v);
																data->_tmp61_ = _g_object_ref0 (GEE_HASH_SET (data->_tmp60_));
																data->roles = data->_tmp61_;
																data->roles_cnt = 0;
																{
																	data->_tmp62_ = NULL;
																	data->_tmp62_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) data->roles);
																	data->_r_it = data->_tmp62_;
																	while (TRUE) {
																		data->_tmp63_ = gee_iterator_next (data->_r_it);
																		if (!data->_tmp63_) {
																			break;
																		}
																		data->_tmp64_ = NULL;
																		data->_tmp64_ = gee_iterator_get (data->_r_it);
																		data->r = (FolksRole*) data->_tmp64_;
																		data->_tmp65_ = NULL;
																		data->_tmp65_ = g_strdup_printf ("_:role_affl%d", data->roles_cnt);
																		data->role_affl = data->_tmp65_;
																		tracker_sparql_builder_subject (data->builder, data->role_affl);
																		tracker_sparql_builder_predicate (data->builder, "a");
																		tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION);
																		tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_ROLE);
																		data->_tmp66_ = NULL;
																		data->_tmp66_ = folks_role_get_title (data->r);
																		tracker_sparql_builder_object_string (data->builder, data->_tmp66_);
																		tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_ORG);
																		data->_tmp67_ = NULL;
																		data->_tmp67_ = folks_role_get_organisation_name (data->r);
																		tracker_sparql_builder_object_string (data->builder, data->_tmp67_);
																		tracker_sparql_builder_subject (data->builder, "_:p");
																		tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION);
																		tracker_sparql_builder_object (data->builder, data->role_affl);
																		data->roles_cnt++;
																		_g_free0 (data->role_affl);
																		_g_object_unref0 (data->r);
																	}
																	_g_object_unref0 (data->_r_it);
																}
																_g_object_unref0 (data->roles);
															} else {
																data->_tmp68_ = NULL;
																data->_tmp68_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_POSTAL_ADDRESSES);
																if (g_strcmp0 (data->k, data->_tmp68_) == 0) {
																	data->_tmp69_ = NULL;
																	data->_tmp69_ = g_value_get_object (data->v);
																	data->_tmp70_ = _g_object_ref0 (GEE_SET (data->_tmp69_));
																	data->postal_addresses = data->_tmp70_;
																	data->postal_cnt = 0;
																	{
																		data->_tmp71_ = NULL;
																		data->_tmp71_ = gee_iterable_iterator ((GeeIterable*) data->postal_addresses);
																		data->_pa_it = data->_tmp71_;
																		while (TRUE) {
																			data->_tmp72_ = gee_iterator_next (data->_pa_it);
																			if (!data->_tmp72_) {
																				break;
																			}
																			data->_tmp73_ = NULL;
																			data->_tmp73_ = gee_iterator_get (data->_pa_it);
																			data->pa = (FolksPostalAddress*) data->_tmp73_;
																			data->_tmp74_ = NULL;
																			data->_tmp74_ = g_strdup_printf ("_:postal_affl%d", data->postal_cnt);
																			data->postal_affl = data->_tmp74_;
																			data->_tmp75_ = NULL;
																			data->_tmp75_ = g_strdup_printf ("_:postal%d", data->postal_cnt);
																			data->postal = data->_tmp75_;
																			tracker_sparql_builder_subject (data->builder, data->postal);
																			tracker_sparql_builder_predicate (data->builder, "a");
																			tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_POSTAL_ADDRESS);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_POBOX);
																			data->_tmp76_ = NULL;
																			data->_tmp76_ = folks_postal_address_get_po_box (data->pa);
																			tracker_sparql_builder_object_string (data->builder, data->_tmp76_);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_LOCALITY);
																			data->_tmp77_ = NULL;
																			data->_tmp77_ = folks_postal_address_get_locality (data->pa);
																			tracker_sparql_builder_object_string (data->builder, data->_tmp77_);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_POSTALCODE);
																			data->_tmp78_ = NULL;
																			data->_tmp78_ = folks_postal_address_get_postal_code (data->pa);
																			tracker_sparql_builder_object_string (data->builder, data->_tmp78_);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_STREET_ADDRESS);
																			data->_tmp79_ = NULL;
																			data->_tmp79_ = folks_postal_address_get_street (data->pa);
																			tracker_sparql_builder_object_string (data->builder, data->_tmp79_);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_EXTENDED_ADDRESS);
																			data->_tmp80_ = NULL;
																			data->_tmp80_ = folks_postal_address_get_extension (data->pa);
																			tracker_sparql_builder_object_string (data->builder, data->_tmp80_);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_COUNTRY);
																			data->_tmp81_ = NULL;
																			data->_tmp81_ = folks_postal_address_get_country (data->pa);
																			tracker_sparql_builder_object_string (data->builder, data->_tmp81_);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_REGION);
																			data->_tmp82_ = NULL;
																			data->_tmp82_ = folks_postal_address_get_region (data->pa);
																			tracker_sparql_builder_object_string (data->builder, data->_tmp82_);
																			tracker_sparql_builder_subject (data->builder, data->postal_affl);
																			tracker_sparql_builder_predicate (data->builder, "a");
																			tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_HAS_POSTAL_ADDRESS);
																			tracker_sparql_builder_object (data->builder, data->postal);
																			tracker_sparql_builder_subject (data->builder, "_:p");
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION);
																			tracker_sparql_builder_object (data->builder, data->postal_affl);
																			data->postal_cnt++;
																			_g_free0 (data->postal);
																			_g_free0 (data->postal_affl);
																			_g_object_unref0 (data->pa);
																		}
																		_g_object_unref0 (data->_pa_it);
																	}
																	_g_object_unref0 (data->postal_addresses);
																} else {
																	data->_tmp83_ = NULL;
																	data->_tmp83_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_URLS);
																	if (g_strcmp0 (data->k, data->_tmp83_) == 0) {
																		data->_tmp84_ = NULL;
																		data->_tmp84_ = g_value_get_object (data->v);
																		data->_tmp85_ = _g_object_ref0 (GEE_SET (data->_tmp84_));
																		data->urls = data->_tmp85_;
																		data->url_cnt = 0;
																		{
																			data->_tmp86_ = NULL;
																			data->_tmp86_ = gee_iterable_iterator ((GeeIterable*) data->urls);
																			data->_u_it = data->_tmp86_;
																			while (TRUE) {
																				data->_tmp87_ = gee_iterator_next (data->_u_it);
																				if (!data->_tmp87_) {
																					break;
																				}
																				data->_tmp88_ = NULL;
																				data->_tmp88_ = gee_iterator_get (data->_u_it);
																				data->u = (FolksFieldDetails*) data->_tmp88_;
																				data->_tmp89_ = NULL;
																				data->_tmp89_ = g_strdup_printf ("_:url_affl%d", data->url_cnt);
																				data->url_affl = data->_tmp89_;
																				tracker_sparql_builder_subject (data->builder, data->url_affl);
																				tracker_sparql_builder_predicate (data->builder, "a");
																				tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION);
																				tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_URL);
																				data->_tmp90_ = NULL;
																				data->_tmp90_ = folks_field_details_get_value (data->u);
																				tracker_sparql_builder_object_string (data->builder, data->_tmp90_);
																				tracker_sparql_builder_subject (data->builder, "_:p");
																				tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION);
																				tracker_sparql_builder_object (data->builder, data->url_affl);
																				data->url_cnt++;
																				_g_free0 (data->url_affl);
																				_g_object_unref0 (data->u);
																			}
																			_g_object_unref0 (data->_u_it);
																		}
																		_g_object_unref0 (data->urls);
																	} else {
																		data->_tmp91_ = NULL;
																		data->_tmp91_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_LOCAL_IDS);
																		if (g_strcmp0 (data->k, data->_tmp91_) == 0) {
																			data->_tmp92_ = NULL;
																			data->_tmp92_ = g_value_get_object (data->v);
																			data->_tmp93_ = _g_object_ref0 (GEE_HASH_SET (data->_tmp92_));
																			data->local_ids = data->_tmp93_;
																			data->_tmp94_ = NULL;
																			data->_tmp94_ = trf_persona_store_serialize_local_ids ((GeeSet*) data->local_ids);
																			data->ids = data->_tmp94_;
																			tracker_sparql_builder_subject (data->builder, "_:folks_ids");
																			tracker_sparql_builder_predicate (data->builder, "a");
																			tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NAO_PROPERTY);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NAO_PROPERTY_NAME);
																			tracker_sparql_builder_object_string (data->builder, TRF_PERSONA_STORE__LOCAL_ID_PROPERTY_NAME);
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NAO_PROPERTY_VALUE);
																			tracker_sparql_builder_object_string (data->builder, data->ids);
																			tracker_sparql_builder_subject (data->builder, "_:p");
																			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NAO_HAS_PROPERTY);
																			tracker_sparql_builder_object (data->builder, "_:folks_ids");
																			_g_free0 (data->ids);
																			_g_object_unref0 (data->local_ids);
																		} else {
																			data->_tmp95_ = NULL;
																			data->_tmp95_ = folks_persona_store_detail_key (FOLKS_PERSONA_DETAIL_WEB_SERVICE_ADDRESSES);
																			if (g_strcmp0 (data->k, data->_tmp95_) == 0) {
																				data->_tmp96_ = NULL;
																				data->_tmp96_ = g_value_get_object (data->v);
																				data->_tmp97_ = _g_object_ref0 (GEE_MULTI_MAP (data->_tmp96_));
																				data->ws_obj = data->_tmp97_;
																				data->_tmp98_ = NULL;
																				data->_tmp98_ = trf_persona_store_serialize_web_services (data->ws_obj);
																				data->ws_addrs = data->_tmp98_;
																				tracker_sparql_builder_subject (data->builder, "_:folks_ws_ids");
																				tracker_sparql_builder_predicate (data->builder, "a");
																				tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NAO_PROPERTY);
																				tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NAO_PROPERTY_NAME);
																				tracker_sparql_builder_object_string (data->builder, TRF_PERSONA_STORE__WSD_PROPERTY_NAME);
																				tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NAO_PROPERTY_VALUE);
																				tracker_sparql_builder_object_string (data->builder, data->ws_addrs);
																				tracker_sparql_builder_subject (data->builder, "_:p");
																				tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NAO_HAS_PROPERTY);
																				tracker_sparql_builder_object (data->builder, "_:folks_ws_ids");
																				_g_free0 (data->ws_addrs);
																				_g_object_unref0 (data->ws_obj);
																			} else {
																				data->_tmp99_ = NULL;
																				data->_tmp99_ = _ ("Unrecognized paramter %s by the  %s PersonaStore:\n')");
																				data->_tmp100_ = NULL;
																				data->_tmp100_ = folks_persona_store_get_type_id ((FolksPersonaStore*) data->self);
																				data->_tmp101_ = NULL;
																				data->_tmp101_ = g_error_new (FOLKS_PERSONA_STORE_ERROR, FOLKS_PERSONA_STORE_ERROR_INVALID_ARGUMENT, data->_tmp99_, data->_tmp100_, data->k);
																				data->_inner_error_ = data->_tmp101_;
																				if (data->_inner_error_->domain == FOLKS_PERSONA_STORE_ERROR) {
																					g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
																					g_error_free (data->_inner_error_);
																					__vala_GValue_free0 (data->v);
																					_g_list_free0 (data->k_collection);
																					_g_object_unref0 (data->builder);
																					if (data->_state_ == 0) {
																						g_simple_async_result_complete_in_idle (data->_async_result);
																					} else {
																						g_simple_async_result_complete (data->_async_result);
																					}
																					g_object_unref (data->_async_result);
																					return FALSE;
																				} else {
																					__vala_GValue_free0 (data->v);
																					_g_list_free0 (data->k_collection);
																					_g_object_unref0 (data->builder);
																					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
																					g_clear_error (&data->_inner_error_);
																					return FALSE;
																				}
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
				__vala_GValue_free0 (data->v);
			}
		}
		_g_list_free0 (data->k_collection);
	}
	tracker_sparql_builder_insert_close (data->builder);
	data->ret = NULL;
	{
		g_static_rec_mutex_lock (&data->self->priv->__lock__personas);
		data->_tmp102_ = NULL;
		data->_tmp102_ = tracker_sparql_builder_get_result (data->builder);
		data->_state_ = 3;
		_trf_persona_store_insert_persona (data->self, data->_tmp102_, "p", trf_persona_store_add_persona_from_details_ready, data);
		return FALSE;
		_state_3:
		data->_tmp103_ = NULL;
		data->_tmp103_ = _trf_persona_store_insert_persona_finish (data->self, data->_res_);
		data->contact_urn = data->_tmp103_;
		if (data->contact_urn != NULL) {
			data->_tmp104_ = NULL;
			data->_tmp104_ = g_strdup_printf (" FILTER(?_contact = <%s>) ", data->contact_urn);
			data->filter = data->_tmp104_;
			data->_tmp105_ = NULL;
			data->_tmp105_ = g_strdup_printf (TRF_PERSONA_STORE__INITIAL_QUERY, data->filter);
			data->query = data->_tmp105_;
			data->_state_ = 4;
			_trf_persona_store_do_add_contacts (data->self, data->query, trf_persona_store_add_persona_from_details_ready, data);
			return FALSE;
			_state_4:
			data->_tmp106_ = NULL;
			data->_tmp106_ = _trf_persona_store_do_add_contacts_finish (data->self, data->_res_);
			data->ret_personas = data->_tmp106_;
			{
				data->_tmp107_ = NULL;
				data->_tmp107_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) data->ret_personas);
				data->_p_it = data->_tmp107_;
				while (TRUE) {
					data->_tmp108_ = gee_iterator_next (data->_p_it);
					if (!data->_tmp108_) {
						break;
					}
					data->_tmp109_ = NULL;
					data->_tmp109_ = gee_iterator_get (data->_p_it);
					data->p = (TrfPersona*) data->_tmp109_;
					data->_tmp110_ = _g_object_ref0 (data->p);
					_g_object_unref0 (data->ret);
					data->ret = data->_tmp110_;
					_g_object_unref0 (data->p);
					break;
				}
				_g_object_unref0 (data->_p_it);
			}
			_g_object_unref0 (data->ret_personas);
			_g_free0 (data->query);
			_g_free0 (data->filter);
		} else {
			g_debug ("trf-persona-store.vala:707: Failed to inserting the new persona  into " \
"Tracker.");
		}
		_g_free0 (data->contact_urn);
		__finally1:
		g_static_rec_mutex_unlock (&data->self->priv->__lock__personas);
		if (data->_inner_error_ != NULL) {
			if (data->_inner_error_->domain == FOLKS_PERSONA_STORE_ERROR) {
				g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
				g_error_free (data->_inner_error_);
				_g_object_unref0 (data->ret);
				_g_object_unref0 (data->builder);
				if (data->_state_ == 0) {
					g_simple_async_result_complete_in_idle (data->_async_result);
				} else {
					g_simple_async_result_complete (data->_async_result);
				}
				g_object_unref (data->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (data->ret);
				_g_object_unref0 (data->builder);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
				g_clear_error (&data->_inner_error_);
				return FALSE;
			}
		}
	}
	data->result = (FolksPersona*) data->ret;
	_g_object_unref0 (data->builder);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_object_unref0 (data->ret);
	_g_object_unref0 (data->builder);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


/**
   * Returns "service1:addr1,addr2;service2:addr3,.."
   *
   * @since 0.5.1
   */
gchar* trf_persona_store_serialize_web_services (GeeMultiMap* ws_obj) {
	gchar* result = NULL;
	gchar* _tmp0_;
	gchar* str;
	g_return_val_if_fail (ws_obj != NULL, NULL);
	_tmp0_ = g_strdup ("");
	str = _tmp0_;
	{
		GeeSet* _tmp1_ = NULL;
		GeeSet* _tmp2_;
		GeeIterator* _tmp3_ = NULL;
		GeeIterator* _tmp4_;
		GeeIterator* _service_it;
		_tmp1_ = gee_multi_map_get_keys (ws_obj);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_service_it = _tmp4_;
		while (TRUE) {
			gboolean _tmp5_;
			gpointer _tmp6_ = NULL;
			gchar* service;
			gchar* _tmp8_;
			gchar* _tmp9_;
			gchar* _tmp10_;
			GeeCollection* _tmp11_ = NULL;
			GeeCollection* addrs;
			gboolean first;
			_tmp5_ = gee_iterator_next (_service_it);
			if (!_tmp5_) {
				break;
			}
			_tmp6_ = gee_iterator_get (_service_it);
			service = (gchar*) _tmp6_;
			if (g_strcmp0 (str, "") != 0) {
				gchar* _tmp7_;
				_tmp7_ = g_strconcat (str, ";", NULL);
				_g_free0 (str);
				str = _tmp7_;
			}
			_tmp8_ = g_strconcat (service, ":", NULL);
			_tmp9_ = _tmp8_;
			_tmp10_ = g_strconcat (str, _tmp9_, NULL);
			_g_free0 (str);
			str = _tmp10_;
			_g_free0 (_tmp9_);
			_tmp11_ = gee_multi_map_get (ws_obj, service);
			addrs = _tmp11_;
			first = TRUE;
			{
				GeeIterator* _tmp12_ = NULL;
				GeeIterator* _addr_it;
				_tmp12_ = gee_iterable_iterator ((GeeIterable*) addrs);
				_addr_it = _tmp12_;
				while (TRUE) {
					gboolean _tmp13_;
					gpointer _tmp14_ = NULL;
					gchar* addr;
					gchar* _tmp16_;
					_tmp13_ = gee_iterator_next (_addr_it);
					if (!_tmp13_) {
						break;
					}
					_tmp14_ = gee_iterator_get (_addr_it);
					addr = (gchar*) _tmp14_;
					if (first == FALSE) {
						gchar* _tmp15_;
						_tmp15_ = g_strconcat (str, ",", NULL);
						_g_free0 (str);
						str = _tmp15_;
					}
					_tmp16_ = g_strconcat (str, addr, NULL);
					_g_free0 (str);
					str = _tmp16_;
					first = FALSE;
					_g_free0 (addr);
				}
				_g_object_unref0 (_addr_it);
			}
			_g_object_unref0 (addrs);
			_g_free0 (service);
		}
		_g_object_unref0 (_service_it);
	}
	result = str;
	return result;
}


/**
   * Transforms "service1:addr1,addr2;service2:addr3,.." to
   *   --->  HashMultiMap<string, string>
   *
   * @since 0.5.1
   */
GeeMultiMap* trf_persona_store_unserialize_web_services (const gchar* ws_addrs) {
	GeeMultiMap* result = NULL;
	GeeHashMultiMap* _tmp0_ = NULL;
	GeeHashMultiMap* ret;
	gchar** _tmp1_;
	gchar** _tmp2_ = NULL;
	gchar** services;
	gint services_length1;
	gint _services_size_;
	g_return_val_if_fail (ws_addrs != NULL, NULL);
	_tmp0_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL);
	ret = _tmp0_;
	_tmp2_ = _tmp1_ = g_strsplit (ws_addrs, ";", 0);
	services = _tmp2_;
	services_length1 = _vala_array_length (_tmp1_);
	_services_size_ = _vala_array_length (_tmp1_);
	{
		gchar** service_line_collection;
		int service_line_collection_length1;
		int service_line_it;
		service_line_collection = services;
		service_line_collection_length1 = services_length1;
		for (service_line_it = 0; service_line_it < services_length1; service_line_it = service_line_it + 1) {
			gchar* _tmp3_;
			gchar* service_line;
			_tmp3_ = g_strdup (service_line_collection[service_line_it]);
			service_line = _tmp3_;
			{
				gchar** _tmp4_;
				gchar** _tmp5_ = NULL;
				gchar** service_t;
				gint service_t_length1;
				gint _service_t_size_;
				gchar* _tmp6_;
				gchar* service_name;
				gchar** _tmp7_;
				gchar** _tmp8_ = NULL;
				gchar** addrs;
				gint addrs_length1;
				gint _addrs_size_;
				_tmp5_ = _tmp4_ = g_strsplit (service_line, ":", 0);
				service_t = _tmp5_;
				service_t_length1 = _vala_array_length (_tmp4_);
				_service_t_size_ = _vala_array_length (_tmp4_);
				_tmp6_ = g_strdup (service_t[0]);
				service_name = _tmp6_;
				_tmp8_ = _tmp7_ = g_strsplit (service_t[1], ",", 0);
				addrs = _tmp8_;
				addrs_length1 = _vala_array_length (_tmp7_);
				_addrs_size_ = _vala_array_length (_tmp7_);
				{
					gchar** a_collection;
					int a_collection_length1;
					int a_it;
					a_collection = addrs;
					a_collection_length1 = addrs_length1;
					for (a_it = 0; a_it < addrs_length1; a_it = a_it + 1) {
						gchar* _tmp9_;
						gchar* a;
						_tmp9_ = g_strdup (a_collection[a_it]);
						a = _tmp9_;
						{
							gee_multi_map_set ((GeeMultiMap*) ret, service_name, a);
							_g_free0 (a);
						}
					}
				}
				addrs = (_vala_array_free (addrs, addrs_length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (service_name);
				service_t = (_vala_array_free (service_t, service_t_length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (service_line);
			}
		}
	}
	result = (GeeMultiMap*) ret;
	services = (_vala_array_free (services, services_length1, (GDestroyNotify) g_free), NULL);
	return result;
}


/**
   * Transform HashSet<string> to "id1,id2,.."
   *
   * @since 0.5.1
   */
gchar* trf_persona_store_serialize_local_ids (GeeSet* local_ids) {
	gchar* result = NULL;
	gchar* _tmp0_;
	gchar* str;
	g_return_val_if_fail (local_ids != NULL, NULL);
	_tmp0_ = g_strdup ("");
	str = _tmp0_;
	{
		GeeIterator* _tmp1_ = NULL;
		GeeIterator* _id_it;
		_tmp1_ = gee_iterable_iterator ((GeeIterable*) local_ids);
		_id_it = _tmp1_;
		while (TRUE) {
			gboolean _tmp2_;
			gpointer _tmp3_ = NULL;
			gchar* id;
			gchar* _tmp5_;
			_tmp2_ = gee_iterator_next (_id_it);
			if (!_tmp2_) {
				break;
			}
			_tmp3_ = gee_iterator_get (_id_it);
			id = (gchar*) _tmp3_;
			if (g_strcmp0 (str, "") != 0) {
				gchar* _tmp4_;
				_tmp4_ = g_strconcat (str, ",", NULL);
				_g_free0 (str);
				str = _tmp4_;
			}
			_tmp5_ = g_strconcat (str, id, NULL);
			_g_free0 (str);
			str = _tmp5_;
			_g_free0 (id);
		}
		_g_object_unref0 (_id_it);
	}
	result = str;
	return result;
}


/**
   * Transform from id1,id2,.. to HashSet<string>
   *
   * @since 0.5.1
   */
GeeSet* trf_persona_store_unserialize_local_ids (const gchar* local_ids) {
	GeeSet* result = NULL;
	GeeHashSet* _tmp0_ = NULL;
	GeeHashSet* ids;
	g_return_val_if_fail (local_ids != NULL, NULL);
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
	ids = _tmp0_;
	if (g_strcmp0 (local_ids, "") != 0) {
		gchar** _tmp1_;
		gchar** _tmp2_ = NULL;
		gchar** ids_a;
		gint ids_a_length1;
		gint _ids_a_size_;
		_tmp2_ = _tmp1_ = g_strsplit (local_ids, ",", 0);
		ids_a = _tmp2_;
		ids_a_length1 = _vala_array_length (_tmp1_);
		_ids_a_size_ = _vala_array_length (_tmp1_);
		{
			gchar** id_collection;
			int id_collection_length1;
			int id_it;
			id_collection = ids_a;
			id_collection_length1 = ids_a_length1;
			for (id_it = 0; id_it < ids_a_length1; id_it = id_it + 1) {
				gchar* _tmp3_;
				gchar* id;
				_tmp3_ = g_strdup (id_collection[id_it]);
				id = _tmp3_;
				{
					gee_abstract_collection_add ((GeeAbstractCollection*) ids, id);
					_g_free0 (id);
				}
			}
		}
		ids_a = (_vala_array_free (ids_a, ids_a_length1, (GDestroyNotify) g_free), NULL);
	}
	result = (GeeSet*) ids;
	return result;
}


static void trf_persona_store_real_remove_persona_data_free (gpointer _data) {
	TrfPersonaStoreRemovePersonaData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreRemovePersonaData, data);
}


static void trf_persona_store_real_remove_persona (FolksPersonaStore* base, FolksPersona* persona, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStore * self;
	TrfPersonaStoreRemovePersonaData* _data_;
	self = (TrfPersonaStore*) base;
	_data_ = g_slice_new0 (TrfPersonaStoreRemovePersonaData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, trf_persona_store_real_remove_persona);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, trf_persona_store_real_remove_persona_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	trf_persona_store_real_remove_persona_co (_data_);
}


static void trf_persona_store_real_remove_persona_finish (FolksPersonaStore* base, GAsyncResult* _res_, GError** error) {
	TrfPersonaStoreRemovePersonaData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


/**
   * Remove a {@link Persona} from the PersonaStore.
   *
   * See {@link Folks.PersonaStore.remove_persona}.
   *
   */
static void trf_persona_store_remove_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreRemovePersonaData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	trf_persona_store_real_remove_persona_co (data);
}


static gboolean trf_persona_store_real_remove_persona_co (TrfPersonaStoreRemovePersonaData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_remove_attributes_from_persona (data->self, data->persona, _REMOVE_ALL_ATTRIBS, trf_persona_store_remove_persona_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = _trf_persona_store_remove_attributes_from_persona_finish (data->self, data->_res_);
	data->urn = data->_tmp0_;
	data->_tmp1_ = g_strdup (" DELETE { " " %s ?p ?o " "} " "WHERE { " " %s ?p ?o " "} ");
	data->q = data->_tmp1_;
	data->_tmp2_ = NULL;
	data->_tmp2_ = g_strdup_printf (data->q, data->urn, data->urn);
	data->_tmp3_ = data->_tmp2_;
	data->_state_ = 2;
	_trf_persona_store_tracker_update (data->self, data->_tmp3_, "remove_persona", trf_persona_store_remove_persona_ready, data);
	return FALSE;
	_state_2:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->_tmp3_);
	_g_free0 (data->q);
	_g_free0 (data->urn);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_remove_attributes_from_persona_data_free (gpointer _data) {
	TrfPersonaStoreRemoveAttributesFromPersonaData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_free0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreRemoveAttributesFromPersonaData, data);
}


static void _trf_persona_store_remove_attributes_from_persona (TrfPersonaStore* self, FolksPersona* persona, gchar remove_flag, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreRemoveAttributesFromPersonaData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreRemoveAttributesFromPersonaData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_remove_attributes_from_persona);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_remove_attributes_from_persona_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->remove_flag = remove_flag;
	_trf_persona_store_remove_attributes_from_persona_co (_data_);
}


static gchar* _trf_persona_store_remove_attributes_from_persona_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gchar* result;
	TrfPersonaStoreRemoveAttributesFromPersonaData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_remove_attributes_from_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreRemoveAttributesFromPersonaData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_remove_attributes_from_persona_co (data);
}


static gboolean _trf_persona_store_remove_attributes_from_persona_co (TrfPersonaStoreRemoveAttributesFromPersonaData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_urn_from_persona (data->self, data->persona, _trf_persona_store_remove_attributes_from_persona_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = _trf_persona_store_urn_from_persona_finish (data->self, data->_res_);
	data->urn = data->_tmp0_;
	data->_state_ = 2;
	_trf_persona_store_remove_attributes (data->self, data->urn, data->remove_flag, _trf_persona_store_remove_attributes_from_persona_ready, data);
	return FALSE;
	_state_2:
	_trf_persona_store_remove_attributes_finish (data->self, data->_res_);
	data->result = data->urn;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->urn);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_build_update_query_set_data_free (gpointer _data) {
	TrfPersonaStoreBuildUpdateQuerySetData* data;
	data = _data;
	_g_object_unref0 (data->builder);
	_g_object_unref0 (data->properties);
	_g_free0 (data->contact_var);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreBuildUpdateQuerySetData, data);
}


static void _trf_persona_store_build_update_query_set (TrfPersonaStore* self, TrackerSparqlBuilder* builder, GeeSet* properties, const gchar* contact_var, TrfAttrib attrib, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreBuildUpdateQuerySetData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreBuildUpdateQuerySetData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_build_update_query_set);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_build_update_query_set_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->builder = _g_object_ref0 (builder);
	_data_->properties = _g_object_ref0 (properties);
	_data_->contact_var = g_strdup (contact_var);
	_data_->attrib = attrib;
	_trf_persona_store_build_update_query_set_co (_data_);
}


static void _trf_persona_store_build_update_query_set_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreBuildUpdateQuerySetData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_build_update_query_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreBuildUpdateQuerySetData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_build_update_query_set_co (data);
}


static gboolean _trf_persona_store_build_update_query_set_co (TrfPersonaStoreBuildUpdateQuerySetData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->affl_var = NULL;
	data->obj_var = NULL;
	data->related_attrib = NULL;
	data->related_prop = NULL;
	data->related_connection = NULL;
	switch (data->attrib) {
		case TRF_ATTRIB_PHONES:
		{
			data->related_attrib = TRF_ONTOLOGY_DEFS_NCO_PHONE;
			data->related_prop = TRF_ONTOLOGY_DEFS_NCO_PHONE_PROP;
			data->related_connection = TRF_ONTOLOGY_DEFS_NCO_HAS_PHONE;
			data->_tmp0_ = g_strdup ("_:phone_affl%d");
			_g_free0 (data->affl_var);
			data->affl_var = data->_tmp0_;
			data->_tmp1_ = g_strdup ("_:phone%d");
			_g_free0 (data->obj_var);
			data->obj_var = data->_tmp1_;
			break;
		}
		case TRF_ATTRIB_EMAILS:
		{
			data->related_attrib = TRF_ONTOLOGY_DEFS_NCO_EMAIL;
			data->related_prop = TRF_ONTOLOGY_DEFS_NCO_EMAIL_PROP;
			data->related_connection = TRF_ONTOLOGY_DEFS_NCO_HAS_EMAIL;
			data->_tmp2_ = g_strdup ("_:email_affl%d");
			_g_free0 (data->affl_var);
			data->affl_var = data->_tmp2_;
			data->_tmp3_ = g_strdup ("_:email%d");
			_g_free0 (data->obj_var);
			data->obj_var = data->_tmp3_;
			break;
		}
		default:
		break;
	}
	data->cnt = 0;
	{
		data->_tmp4_ = NULL;
		data->_tmp4_ = gee_iterable_iterator ((GeeIterable*) data->properties);
		data->_p_it = data->_tmp4_;
		while (TRUE) {
			data->_tmp5_ = gee_iterator_next (data->_p_it);
			if (!data->_tmp5_) {
				break;
			}
			data->_tmp6_ = NULL;
			data->_tmp6_ = gee_iterator_get (data->_p_it);
			data->p = (FolksFieldDetails*) data->_tmp6_;
			data->_tmp7_ = NULL;
			data->_tmp7_ = g_strdup_printf (data->affl_var, data->cnt);
			data->affl = data->_tmp7_;
			data->_tmp8_ = NULL;
			data->_tmp8_ = folks_field_details_get_value (data->p);
			data->_state_ = 1;
			_trf_persona_store_urn_from_property (data->self, data->related_attrib, data->related_prop, data->_tmp8_, _trf_persona_store_build_update_query_set_ready, data);
			return FALSE;
			_state_1:
			data->_tmp9_ = NULL;
			data->_tmp9_ = _trf_persona_store_urn_from_property_finish (data->self, data->_res_);
			data->obj = data->_tmp9_;
			if (g_strcmp0 (data->obj, "") == 0) {
				data->_tmp10_ = NULL;
				data->_tmp10_ = g_strdup_printf (data->obj_var, data->cnt);
				_g_free0 (data->obj);
				data->obj = data->_tmp10_;
				tracker_sparql_builder_subject (data->builder, data->obj);
				tracker_sparql_builder_predicate (data->builder, "a");
				tracker_sparql_builder_object (data->builder, data->related_attrib);
				tracker_sparql_builder_predicate (data->builder, data->related_prop);
				data->_tmp11_ = NULL;
				data->_tmp11_ = folks_field_details_get_value (data->p);
				tracker_sparql_builder_object_string (data->builder, data->_tmp11_);
			}
			tracker_sparql_builder_subject (data->builder, data->affl);
			tracker_sparql_builder_predicate (data->builder, "a");
			tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION);
			tracker_sparql_builder_predicate (data->builder, data->related_connection);
			tracker_sparql_builder_object (data->builder, data->obj);
			tracker_sparql_builder_subject (data->builder, data->contact_var);
			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION);
			tracker_sparql_builder_object (data->builder, data->affl);
			data->cnt++;
			_g_free0 (data->obj);
			_g_free0 (data->affl);
			_g_object_unref0 (data->p);
		}
		_g_object_unref0 (data->_p_it);
	}
	_g_free0 (data->obj_var);
	_g_free0 (data->affl_var);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_remove_attributes_data_free (gpointer _data) {
	TrfPersonaStoreRemoveAttributesData* data;
	data = _data;
	_g_free0 (data->urn);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreRemoveAttributesData, data);
}


static void _trf_persona_store_remove_attributes (TrfPersonaStore* self, const gchar* urn, gchar remove_flag, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreRemoveAttributesData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreRemoveAttributesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_remove_attributes);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_remove_attributes_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->urn = g_strdup (urn);
	_data_->remove_flag = remove_flag;
	_trf_persona_store_remove_attributes_co (_data_);
}


static void _trf_persona_store_remove_attributes_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreRemoveAttributesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_remove_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreRemoveAttributesData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_remove_attributes_co (data);
}


static gboolean _trf_persona_store_remove_attributes_co (TrfPersonaStoreRemoveAttributesData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		case 6:
		goto _state_6;
		case 7:
		goto _state_7;
		case 8:
		goto _state_8;
		case 9:
		goto _state_9;
		case 10:
		goto _state_10;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_affiliations_from_persona (data->self, data->urn, _trf_persona_store_remove_attributes_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = _trf_persona_store_affiliations_from_persona_finish (data->self, data->_res_);
	data->affiliations = data->_tmp0_;
	{
		data->_tmp1_ = NULL;
		data->_tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) data->affiliations);
		data->_affl_it = data->_tmp1_;
		while (TRUE) {
			data->_tmp2_ = gee_iterator_next (data->_affl_it);
			if (!data->_tmp2_) {
				break;
			}
			data->_tmp3_ = NULL;
			data->_tmp3_ = gee_iterator_get (data->_affl_it);
			data->affl = (gchar*) data->_tmp3_;
			data->got_attrib = FALSE;
			if ((data->remove_flag & _REMOVE_ALL_ATTRIBS) == _REMOVE_ALL_ATTRIBS) {
				data->_tmp4_ = TRUE;
			} else {
				data->_tmp4_ = (data->remove_flag & _REMOVE_PHONES) == _REMOVE_PHONES;
			}
			if (data->_tmp4_) {
				data->_state_ = 2;
				_trf_persona_store_phones_from_affiliation (data->self, data->affl, _trf_persona_store_remove_attributes_ready, data);
				return FALSE;
				_state_2:
				data->_tmp5_ = NULL;
				data->_tmp5_ = _trf_persona_store_phones_from_affiliation_finish (data->self, data->_res_);
				data->phones = data->_tmp5_;
				{
					data->_tmp6_ = NULL;
					data->_tmp6_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) data->phones);
					data->_phone_it = data->_tmp6_;
					while (TRUE) {
						data->_tmp7_ = gee_iterator_next (data->_phone_it);
						if (!data->_tmp7_) {
							break;
						}
						data->_tmp8_ = NULL;
						data->_tmp8_ = gee_iterator_get (data->_phone_it);
						data->phone = (gchar*) data->_tmp8_;
						data->got_attrib = TRUE;
						data->_state_ = 3;
						_trf_persona_store_delete_resource (data->self, data->phone, TRUE, _trf_persona_store_remove_attributes_ready, data);
						return FALSE;
						_state_3:
						_trf_persona_store_delete_resource_finish (data->self, data->_res_);
						_g_free0 (data->phone);
					}
					_g_object_unref0 (data->_phone_it);
				}
				_g_object_unref0 (data->phones);
			}
			if ((data->remove_flag & _REMOVE_ALL_ATTRIBS) == _REMOVE_ALL_ATTRIBS) {
				data->_tmp9_ = TRUE;
			} else {
				data->_tmp9_ = (data->remove_flag & _REMOVE_POSTALS) == _REMOVE_POSTALS;
			}
			if (data->_tmp9_) {
				data->_state_ = 4;
				_trf_persona_store_postals_from_affiliation (data->self, data->affl, _trf_persona_store_remove_attributes_ready, data);
				return FALSE;
				_state_4:
				data->_tmp10_ = NULL;
				data->_tmp10_ = _trf_persona_store_postals_from_affiliation_finish (data->self, data->_res_);
				data->postals = data->_tmp10_;
				{
					data->_tmp11_ = NULL;
					data->_tmp11_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) data->postals);
					data->_postal_it = data->_tmp11_;
					while (TRUE) {
						data->_tmp12_ = gee_iterator_next (data->_postal_it);
						if (!data->_tmp12_) {
							break;
						}
						data->_tmp13_ = NULL;
						data->_tmp13_ = gee_iterator_get (data->_postal_it);
						data->postal = (gchar*) data->_tmp13_;
						data->got_attrib = TRUE;
						data->_state_ = 5;
						_trf_persona_store_delete_resource (data->self, data->postal, TRUE, _trf_persona_store_remove_attributes_ready, data);
						return FALSE;
						_state_5:
						_trf_persona_store_delete_resource_finish (data->self, data->_res_);
						_g_free0 (data->postal);
					}
					_g_object_unref0 (data->_postal_it);
				}
				_g_object_unref0 (data->postals);
			}
			if ((data->remove_flag & _REMOVE_ALL_ATTRIBS) == _REMOVE_ALL_ATTRIBS) {
				data->_tmp14_ = TRUE;
			} else {
				data->_tmp14_ = (data->remove_flag & _REMOVE_IM_ADDRS) == _REMOVE_IM_ADDRS;
			}
			if (data->_tmp14_) {
				data->_state_ = 6;
				_trf_persona_store_imaddrs_from_affiliation (data->self, data->affl, _trf_persona_store_remove_attributes_ready, data);
				return FALSE;
				_state_6:
				data->_tmp15_ = NULL;
				data->_tmp15_ = _trf_persona_store_imaddrs_from_affiliation_finish (data->self, data->_res_);
				data->im_addrs = data->_tmp15_;
				{
					data->_tmp16_ = NULL;
					data->_tmp16_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) data->im_addrs);
					data->_im_addr_it = data->_tmp16_;
					while (TRUE) {
						data->_tmp17_ = gee_iterator_next (data->_im_addr_it);
						if (!data->_tmp17_) {
							break;
						}
						data->_tmp18_ = NULL;
						data->_tmp18_ = gee_iterator_get (data->_im_addr_it);
						data->im_addr = (gchar*) data->_tmp18_;
						data->got_attrib = TRUE;
						data->_state_ = 7;
						_trf_persona_store_delete_resource (data->self, data->im_addr, TRUE, _trf_persona_store_remove_attributes_ready, data);
						return FALSE;
						_state_7:
						_trf_persona_store_delete_resource_finish (data->self, data->_res_);
						_g_free0 (data->im_addr);
					}
					_g_object_unref0 (data->_im_addr_it);
				}
				_g_object_unref0 (data->im_addrs);
			}
			if ((data->remove_flag & _REMOVE_ALL_ATTRIBS) == _REMOVE_ALL_ATTRIBS) {
				data->_tmp19_ = TRUE;
			} else {
				data->_tmp19_ = (data->remove_flag & _REMOVE_EMAILS) == _REMOVE_EMAILS;
			}
			if (data->_tmp19_) {
				data->_state_ = 8;
				_trf_persona_store_emails_from_affiliation (data->self, data->affl, _trf_persona_store_remove_attributes_ready, data);
				return FALSE;
				_state_8:
				data->_tmp20_ = NULL;
				data->_tmp20_ = _trf_persona_store_emails_from_affiliation_finish (data->self, data->_res_);
				data->emails = data->_tmp20_;
				{
					data->_tmp21_ = NULL;
					data->_tmp21_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) data->emails);
					data->_email_it = data->_tmp21_;
					while (TRUE) {
						data->_tmp22_ = gee_iterator_next (data->_email_it);
						if (!data->_tmp22_) {
							break;
						}
						data->_tmp23_ = NULL;
						data->_tmp23_ = gee_iterator_get (data->_email_it);
						data->email = (gchar*) data->_tmp23_;
						data->got_attrib = TRUE;
						data->_state_ = 9;
						_trf_persona_store_delete_resource (data->self, data->email, TRUE, _trf_persona_store_remove_attributes_ready, data);
						return FALSE;
						_state_9:
						_trf_persona_store_delete_resource_finish (data->self, data->_res_);
						_g_free0 (data->email);
					}
					_g_object_unref0 (data->_email_it);
				}
				_g_object_unref0 (data->emails);
			}
			if (data->got_attrib) {
				data->_tmp24_ = TRUE;
			} else {
				data->_tmp24_ = (data->remove_flag & _REMOVE_ALL_ATTRIBS) == _REMOVE_ALL_ATTRIBS;
			}
			if (data->_tmp24_) {
				data->_state_ = 10;
				_trf_persona_store_delete_resource (data->self, data->affl, TRUE, _trf_persona_store_remove_attributes_ready, data);
				return FALSE;
				_state_10:
				_trf_persona_store_delete_resource_finish (data->self, data->_res_);
			}
			_g_free0 (data->affl);
		}
		_g_object_unref0 (data->_affl_it);
	}
	_g_object_unref0 (data->affiliations);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void trf_persona_store_real_prepare_data_free (gpointer _data) {
	TrfPersonaStorePrepareData* data;
	data = _data;
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStorePrepareData, data);
}


static void trf_persona_store_real_prepare (FolksPersonaStore* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStore * self;
	TrfPersonaStorePrepareData* _data_;
	self = (TrfPersonaStore*) base;
	_data_ = g_slice_new0 (TrfPersonaStorePrepareData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, trf_persona_store_real_prepare);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, trf_persona_store_real_prepare_data_free);
	_data_->self = _g_object_ref0 (self);
	trf_persona_store_real_prepare_co (_data_);
}


static void trf_persona_store_real_prepare_finish (FolksPersonaStore* base, GAsyncResult* _res_, GError** error) {
	TrfPersonaStorePrepareData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


/**
   * Prepare the PersonaStore for use.
   *
   * TODO: we should throw different errors dependening on what went wrong
   *       when we were trying to setup the PersonaStore.
   *
   * See {@link Folks.PersonaStore.prepare}.
   */
static void trf_persona_store_prepare_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStorePrepareData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	trf_persona_store_real_prepare_co (data);
}


static void __trf_persona_store_graph_updated_cb_gd_bus_signal_callback (GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters, gpointer self) {
	_trf_persona_store_graph_updated_cb (self, connection, sender_name, object_path, interface_name, signal_name, parameters);
}


static gboolean trf_persona_store_real_prepare_co (TrfPersonaStorePrepareData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		g_static_rec_mutex_lock (&data->self->priv->__lock__is_prepared);
		if (!data->self->priv->_is_prepared) {
			data->_state_ = 1;
			tracker_sparql_connection_get_async (NULL, trf_persona_store_prepare_ready, data);
			return FALSE;
			_state_1:
			data->_tmp0_ = NULL;
			data->_tmp0_ = tracker_sparql_connection_get_finish (data->_res_, &data->_inner_error_);
			data->_tmp1_ = data->_tmp0_;
			if (data->_inner_error_ != NULL) {
				if (data->_inner_error_->domain == G_IO_ERROR) {
					goto __catch3_g_io_error;
				}
				if (data->_inner_error_->domain == TRACKER_SPARQL_ERROR) {
					goto __catch3_tracker_sparql_error;
				}
				if (data->_inner_error_->domain == G_DBUS_ERROR) {
					goto __catch3_g_dbus_error;
				}
				g_static_rec_mutex_unlock (&data->self->priv->__lock__is_prepared);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
				g_clear_error (&data->_inner_error_);
				return FALSE;
			}
			_g_object_unref0 (data->self->priv->_connection);
			data->self->priv->_connection = data->_tmp1_;
			data->_state_ = 2;
			_trf_persona_store_build_predicates_table (data->self, trf_persona_store_prepare_ready, data);
			return FALSE;
			_state_2:
			_trf_persona_store_build_predicates_table_finish (data->self, data->_res_);
			data->_tmp2_ = NULL;
			data->_tmp2_ = g_strdup_printf (TRF_PERSONA_STORE__INITIAL_QUERY, "");
			data->_tmp3_ = data->_tmp2_;
			data->_state_ = 3;
			_trf_persona_store_do_add_contacts (data->self, data->_tmp3_, trf_persona_store_prepare_ready, data);
			return FALSE;
			_state_3:
			data->_tmp4_ = NULL;
			data->_tmp4_ = _trf_persona_store_do_add_contacts_finish (data->self, data->_res_);
			data->_tmp5_ = data->_tmp4_;
			_g_object_unref0 (data->_tmp5_);
			_g_free0 (data->_tmp3_);
			data->_state_ = 4;
			g_async_initable_new_async (TYPE_RESOURCES_PROXY, 0, NULL, trf_persona_store_prepare_ready, data, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", TRF_PERSONA_STORE__OBJECT_NAME, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", TRF_PERSONA_STORE__OBJECT_PATH, "g-interface-name", "org.freedesktop.Tracker1.Resources", NULL);
			return FALSE;
			_state_4:
			data->_tmp6_ = NULL;
			data->_tmp6_ = g_async_initable_new_finish (data->_source_object_, data->_res_, &data->_inner_error_);
			data->_tmp7_ = (Resources*) data->_tmp6_;
			if (data->_inner_error_ != NULL) {
				if (data->_inner_error_->domain == G_IO_ERROR) {
					goto __catch3_g_io_error;
				}
				if (data->_inner_error_->domain == TRACKER_SPARQL_ERROR) {
					goto __catch3_tracker_sparql_error;
				}
				if (data->_inner_error_->domain == G_DBUS_ERROR) {
					goto __catch3_g_dbus_error;
				}
				g_static_rec_mutex_unlock (&data->self->priv->__lock__is_prepared);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
				g_clear_error (&data->_inner_error_);
				return FALSE;
			}
			_g_object_unref0 (data->self->priv->_resources_object);
			data->self->priv->_resources_object = data->_tmp7_;
			data->_tmp8_ = NULL;
			g_object_get ((GDBusProxy*) data->self->priv->_resources_object, "g-connection", &data->_tmp8_, NULL);
			data->_tmp9_ = data->_tmp8_;
			g_dbus_connection_signal_subscribe (data->_tmp9_, TRF_PERSONA_STORE__OBJECT_NAME, TRF_PERSONA_STORE__OBJECT_IFACE, "GraphUpdated", TRF_PERSONA_STORE__OBJECT_PATH, TRF_ONTOLOGY_DEFS_PERSON_CLASS, G_DBUS_SIGNAL_FLAGS_NONE, __trf_persona_store_graph_updated_cb_gd_bus_signal_callback, g_object_ref (data->self), g_object_unref);
			_g_object_unref0 (data->_tmp9_);
			data->self->priv->_is_prepared = TRUE;
			g_object_notify ((GObject*) data->self, "is-prepared");
			goto __finally3;
			__catch3_g_io_error:
			{
				data->e1 = data->_inner_error_;
				data->_inner_error_ = NULL;
				g_warning ("trf-persona-store.vala:1029: Could not connect to D-Bus service: %s", data->e1->message);
				data->_tmp10_ = NULL;
				data->_tmp10_ = g_error_new_literal (FOLKS_PERSONA_STORE_ERROR, FOLKS_PERSONA_STORE_ERROR_INVALID_ARGUMENT, data->e1->message);
				data->_inner_error_ = data->_tmp10_;
				_g_error_free0 (data->e1);
				goto __finally3;
			}
			goto __finally3;
			__catch3_tracker_sparql_error:
			{
				data->e2 = data->_inner_error_;
				data->_inner_error_ = NULL;
				g_warning ("trf-persona-store.vala:1035: Error fetching SPARQL connection handler:" \
" %s", data->e2->message);
				data->_tmp11_ = NULL;
				data->_tmp11_ = g_error_new_literal (FOLKS_PERSONA_STORE_ERROR, FOLKS_PERSONA_STORE_ERROR_INVALID_ARGUMENT, data->e2->message);
				data->_inner_error_ = data->_tmp11_;
				_g_error_free0 (data->e2);
				goto __finally3;
			}
			goto __finally3;
			__catch3_g_dbus_error:
			{
				data->e3 = data->_inner_error_;
				data->_inner_error_ = NULL;
				g_warning ("trf-persona-store.vala:1041: Could not connect to D-Bus service: %s", data->e3->message);
				data->_tmp12_ = NULL;
				data->_tmp12_ = g_error_new_literal (FOLKS_PERSONA_STORE_ERROR, FOLKS_PERSONA_STORE_ERROR_INVALID_ARGUMENT, data->e3->message);
				data->_inner_error_ = data->_tmp12_;
				_g_error_free0 (data->e3);
				goto __finally3;
			}
			__finally3:
			if (data->_inner_error_ != NULL) {
				goto __finally2;
			}
		}
		__finally2:
		g_static_rec_mutex_unlock (&data->self->priv->__lock__is_prepared);
		if (data->_inner_error_ != NULL) {
			g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
			g_error_free (data->_inner_error_);
			if (data->_state_ == 0) {
				g_simple_async_result_complete_in_idle (data->_async_result);
			} else {
				g_simple_async_result_complete (data->_async_result);
			}
			g_object_unref (data->_async_result);
			return FALSE;
		}
	}
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


gint trf_persona_store_get_favorite_id (TrfPersonaStore* self) {
	gint result = 0;
	gpointer _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NAO_FAVORITE);
	result = GPOINTER_TO_INT (_tmp0_);
	return result;
}


gint trf_persona_store_get_gender_male_id (TrfPersonaStore* self) {
	gint result = 0;
	gpointer _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_MALE);
	result = GPOINTER_TO_INT (_tmp0_);
	return result;
}


gint trf_persona_store_get_gender_female_id (TrfPersonaStore* self) {
	gint result = 0;
	gpointer _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_FEMALE);
	result = GPOINTER_TO_INT (_tmp0_);
	return result;
}


static void _trf_persona_store_build_predicates_table_data_free (gpointer _data) {
	TrfPersonaStoreBuildPredicatesTableData* data;
	data = _data;
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreBuildPredicatesTableData, data);
}


static void _trf_persona_store_build_predicates_table (TrfPersonaStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreBuildPredicatesTableData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreBuildPredicatesTableData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_build_predicates_table);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_build_predicates_table_data_free);
	_data_->self = _g_object_ref0 (self);
	_trf_persona_store_build_predicates_table_co (_data_);
}


static void _trf_persona_store_build_predicates_table_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreBuildPredicatesTableData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_build_predicates_table_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreBuildPredicatesTableData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_build_predicates_table_co (data);
}


static gboolean _trf_persona_store_build_predicates_table_co (TrfPersonaStoreBuildPredicatesTableData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (trf_persona_store__prefix_tracker_id != NULL) {
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	data->_state_ = 1;
	_trf_persona_store_build_urn_prefix_table (data->self, _trf_persona_store_build_predicates_table_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_build_urn_prefix_table_finish (data->self, data->_res_);
	data->_tmp0_ = NULL;
	data->_tmp0_ = gee_tree_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_INT, NULL, NULL, NULL, NULL);
	_g_object_unref0 (trf_persona_store__prefix_tracker_id);
	trf_persona_store__prefix_tracker_id = data->_tmp0_;
	data->_tmp1_ = g_strdup ("SELECT  ");
	data->query = data->_tmp1_;
	{
		data->_tmp2_ = NULL;
		data->_tmp2_ = gee_map_get_keys ((GeeMap*) trf_persona_store__urn_prefix);
		data->_tmp3_ = data->_tmp2_;
		data->_tmp4_ = NULL;
		data->_tmp4_ = gee_iterable_iterator ((GeeIterable*) data->_tmp3_);
		data->_tmp5_ = data->_tmp4_;
		_g_object_unref0 (data->_tmp3_);
		data->_urn_t_it = data->_tmp5_;
		while (TRUE) {
			data->_tmp6_ = gee_iterator_next (data->_urn_t_it);
			if (!data->_tmp6_) {
				break;
			}
			data->_tmp7_ = NULL;
			data->_tmp7_ = gee_iterator_get (data->_urn_t_it);
			data->urn_t = (gchar*) data->_tmp7_;
			data->_tmp8_ = g_strconcat (" tracker:id(", data->urn_t, NULL);
			data->_tmp9_ = data->_tmp8_;
			data->_tmp10_ = g_strconcat (data->_tmp9_, ")", NULL);
			data->_tmp11_ = data->_tmp10_;
			data->_tmp12_ = g_strconcat (data->query, data->_tmp11_, NULL);
			_g_free0 (data->query);
			data->query = data->_tmp12_;
			_g_free0 (data->_tmp11_);
			_g_free0 (data->_tmp9_);
			_g_free0 (data->urn_t);
		}
		_g_object_unref0 (data->_urn_t_it);
	}
	data->_tmp13_ = g_strconcat (data->query, " WHERE {} ", NULL);
	_g_free0 (data->query);
	data->query = data->_tmp13_;
	data->_state_ = 2;
	tracker_sparql_connection_query_async (data->self->priv->_connection, data->query, NULL, _trf_persona_store_build_predicates_table_ready, data);
	return FALSE;
	_state_2:
	data->_tmp14_ = NULL;
	data->_tmp14_ = tracker_sparql_connection_query_finish (data->self->priv->_connection, data->_res_, &data->_inner_error_);
	data->cursor = data->_tmp14_;
	if (data->_inner_error_ != NULL) {
		if (data->_inner_error_->domain == TRACKER_SPARQL_ERROR) {
			goto __catch4_tracker_sparql_error;
		}
		goto __catch4_g_error;
	}
	while (TRUE) {
		data->_tmp15_ = tracker_sparql_cursor_next (data->cursor, NULL, &data->_inner_error_);
		data->_tmp16_ = data->_tmp15_;
		if (data->_inner_error_ != NULL) {
			_g_object_unref0 (data->cursor);
			if (data->_inner_error_->domain == TRACKER_SPARQL_ERROR) {
				goto __catch4_tracker_sparql_error;
			}
			goto __catch4_g_error;
		}
		if (!data->_tmp16_) {
			break;
		}
		data->i = 0;
		{
			data->_tmp17_ = NULL;
			data->_tmp17_ = gee_map_get_keys ((GeeMap*) trf_persona_store__urn_prefix);
			data->_tmp18_ = data->_tmp17_;
			data->_tmp19_ = NULL;
			data->_tmp19_ = gee_iterable_iterator ((GeeIterable*) data->_tmp18_);
			data->_tmp20_ = data->_tmp19_;
			_g_object_unref0 (data->_tmp18_);
			data->_urn_it = data->_tmp20_;
			while (TRUE) {
				data->_tmp21_ = gee_iterator_next (data->_urn_it);
				if (!data->_tmp21_) {
					break;
				}
				data->_tmp22_ = NULL;
				data->_tmp22_ = gee_iterator_get (data->_urn_it);
				data->urn = (gchar*) data->_tmp22_;
				data->_tmp23_ = tracker_sparql_cursor_get_integer (data->cursor, data->i);
				data->tracker_id = (gint) data->_tmp23_;
				data->_tmp24_ = NULL;
				data->_tmp24_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__urn_prefix, data->urn);
				data->_tmp25_ = (gchar*) data->_tmp24_;
				data->_tmp26_ = NULL;
				data->_tmp26_ = g_strdup (data->_tmp25_);
				data->_tmp27_ = data->_tmp26_;
				_g_free0 (data->_tmp25_);
				data->prefix = data->_tmp27_;
				gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, data->prefix, GINT_TO_POINTER (data->tracker_id));
				data->i++;
				_g_free0 (data->prefix);
				_g_free0 (data->urn);
			}
			_g_object_unref0 (data->_urn_it);
		}
	}
	_g_object_unref0 (data->cursor);
	goto __finally4;
	__catch4_tracker_sparql_error:
	{
		data->e1 = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:1103: Couldn't build predicates table: %s %s", data->query, data->e1->message);
		_g_error_free0 (data->e1);
	}
	goto __finally4;
	__catch4_g_error:
	{
		data->e2 = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:1107: Couldn't build predicates table: %s %s", data->query, data->e2->message);
		_g_error_free0 (data->e2);
	}
	__finally4:
	if (data->_inner_error_ != NULL) {
		_g_free0 (data->query);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
		g_clear_error (&data->_inner_error_);
		return FALSE;
	}
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_build_urn_prefix_table_data_free (gpointer _data) {
	TrfPersonaStoreBuildUrnPrefixTableData* data;
	data = _data;
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreBuildUrnPrefixTableData, data);
}


static void _trf_persona_store_build_urn_prefix_table (TrfPersonaStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreBuildUrnPrefixTableData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreBuildUrnPrefixTableData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_build_urn_prefix_table);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_build_urn_prefix_table_data_free);
	_data_->self = _g_object_ref0 (self);
	_trf_persona_store_build_urn_prefix_table_co (_data_);
}


static void _trf_persona_store_build_urn_prefix_table_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreBuildUrnPrefixTableData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static gboolean _trf_persona_store_build_urn_prefix_table_co (TrfPersonaStoreBuildUrnPrefixTableData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (trf_persona_store__urn_prefix != NULL) {
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	data->_tmp0_ = NULL;
	data->_tmp0_ = gee_tree_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
	_g_object_unref0 (trf_persona_store__urn_prefix);
	trf_persona_store__urn_prefix = data->_tmp0_;
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#fullname>", TRF_ONTOLOGY_DEFS_NCO_FULLNAME);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#nameFamily>", TRF_ONTOLOGY_DEFS_NCO_FAMILY);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#nameGiven>", TRF_ONTOLOGY_DEFS_NCO_GIVEN);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#nameAdditional>", TRF_ONTOLOGY_DEFS_NCO_ADDITIONAL);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#nameHonorificSuffix>", TRF_ONTOLOGY_DEFS_NCO_SUFFIX);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#nameHonorificPrefix>", TRF_ONTOLOGY_DEFS_NCO_PREFIX);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#nickname>", TRF_ONTOLOGY_DEFS_NCO_NICKNAME);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_RDF_URL_PREFIX "22-rdf-syntax-ns#type>", TRF_ONTOLOGY_DEFS_RDF_TYPE);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#PersonContact>", TRF_ONTOLOGY_DEFS_NCO_PERSON);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#websiteUrl>", TRF_ONTOLOGY_DEFS_NCO_WEBSITE);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#blogUrl>", TRF_ONTOLOGY_DEFS_NCO_BLOG);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NAO_URL_PREFIX "nao#predefined-tag-favorite>", TRF_ONTOLOGY_DEFS_NAO_FAVORITE);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NAO_URL_PREFIX "nao#hasTag>", TRF_ONTOLOGY_DEFS_NAO_TAG);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#hasEmailAddress>", TRF_ONTOLOGY_DEFS_NCO_HAS_EMAIL);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#hasPhoneNumber>", TRF_ONTOLOGY_DEFS_NCO_HAS_PHONE);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#hasAffiliation>", TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#birthDate>", TRF_ONTOLOGY_DEFS_NCO_BIRTHDAY);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#note>", TRF_ONTOLOGY_DEFS_NCO_NOTE);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#gender>", TRF_ONTOLOGY_DEFS_NCO_GENDER);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#gender-male>", TRF_ONTOLOGY_DEFS_NCO_MALE);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#gender-female>", TRF_ONTOLOGY_DEFS_NCO_FEMALE);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#photo>", TRF_ONTOLOGY_DEFS_NCO_PHOTO);
	gee_abstract_map_set ((GeeAbstractMap*) trf_persona_store__urn_prefix, TRF_ONTOLOGY_DEFS_NAO_URL_PREFIX "nao#hasProperty>", TRF_ONTOLOGY_DEFS_NAO_PROPERTY);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_graph_updated_cb (TrfPersonaStore* self, GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters) {
	gchar* _tmp0_;
	gchar* class_name;
	GVariantIter* iter_del;
	GVariantIter* iter_ins;
	GVariantIter* _tmp1_;
	GVariantIter* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (connection != NULL);
	g_return_if_fail (sender_name != NULL);
	g_return_if_fail (object_path != NULL);
	g_return_if_fail (interface_name != NULL);
	g_return_if_fail (signal_name != NULL);
	g_return_if_fail (parameters != NULL);
	_tmp0_ = g_strdup ("");
	class_name = _tmp0_;
	iter_del = NULL;
	iter_ins = NULL;
	g_variant_get (parameters, "(sa(iiii)a(iiii))", &class_name, &iter_del, &iter_ins, NULL);
	if (g_strcmp0 (class_name, TRF_ONTOLOGY_DEFS_PERSON_CLASS) != 0) {
		_g_variant_iter_free0 (iter_ins);
		_g_variant_iter_free0 (iter_del);
		_g_free0 (class_name);
		return;
	}
	_tmp1_ = iter_del;
	iter_del = NULL;
	_tmp2_ = iter_ins;
	iter_ins = NULL;
	_trf_persona_store_handle_events (self, _tmp1_, _tmp2_, NULL, NULL);
	_g_variant_iter_free0 (iter_ins);
	_g_variant_iter_free0 (iter_del);
	_g_free0 (class_name);
}


static void _trf_persona_store_handle_events_data_free (gpointer _data) {
	TrfPersonaStoreHandleEventsData* data;
	data = _data;
	_g_variant_iter_free0 (data->iter_del);
	_g_variant_iter_free0 (data->iter_ins);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreHandleEventsData, data);
}


static void _trf_persona_store_handle_events (TrfPersonaStore* self, GVariantIter* iter_del, GVariantIter* iter_ins, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreHandleEventsData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreHandleEventsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_handle_events);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_handle_events_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->iter_del = iter_del;
	_data_->iter_ins = iter_ins;
	_trf_persona_store_handle_events_co (_data_);
}


static void _trf_persona_store_handle_events_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreHandleEventsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_handle_events_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreHandleEventsData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_handle_events_co (data);
}


static gboolean _trf_persona_store_handle_events_co (TrfPersonaStoreHandleEventsData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = data->iter_del;
	data->iter_del = NULL;
	data->_state_ = 1;
	_trf_persona_store_handle_delete_events (data->self, data->_tmp0_, _trf_persona_store_handle_events_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_handle_delete_events_finish (data->self, data->_res_);
	data->_tmp1_ = data->iter_ins;
	data->iter_ins = NULL;
	data->_state_ = 2;
	_trf_persona_store_handle_insert_events (data->self, data->_tmp1_, _trf_persona_store_handle_events_ready, data);
	return FALSE;
	_state_2:
	_trf_persona_store_handle_insert_events_finish (data->self, data->_res_);
	_g_variant_iter_free0 (data->iter_del);
	_g_variant_iter_free0 (data->iter_ins);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_handle_delete_events_data_free (gpointer _data) {
	TrfPersonaStoreHandleDeleteEventsData* data;
	data = _data;
	_g_variant_iter_free0 (data->iter_del);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreHandleDeleteEventsData, data);
}


static void _trf_persona_store_handle_delete_events (TrfPersonaStore* self, GVariantIter* iter_del, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreHandleDeleteEventsData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreHandleDeleteEventsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_handle_delete_events);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_handle_delete_events_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->iter_del = iter_del;
	_trf_persona_store_handle_delete_events_co (_data_);
}


static void _trf_persona_store_handle_delete_events_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreHandleDeleteEventsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_handle_delete_events_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreHandleDeleteEventsData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_handle_delete_events_co (data);
}


static gboolean _trf_persona_store_handle_delete_events_co (TrfPersonaStoreHandleDeleteEventsData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = gee_hash_set_new (TRF_TYPE_PERSONA, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL);
	data->removed_personas = data->_tmp0_;
	data->_tmp1_ = NULL;
	data->_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_PERSON);
	data->nco_person_id = GPOINTER_TO_INT (data->_tmp1_);
	data->_tmp2_ = NULL;
	data->_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_RDF_TYPE);
	data->rdf_type_id = GPOINTER_TO_INT (data->_tmp2_);
	memset (&data->e, 0, sizeof (Event));
	while (TRUE) {
		data->_tmp3_ = g_variant_iter_next (data->iter_del, "(iiii)", &data->e.graph_id, &data->e.subject_id, &data->e.pred_id, &data->e.object_id, NULL);
		if (!data->_tmp3_) {
			break;
		}
		data->_tmp4_ = NULL;
		data->_tmp4_ = folks_persona_store_get_id ((FolksPersonaStore*) data->self);
		data->_tmp5_ = NULL;
		data->_tmp5_ = g_strdup_printf ("%i", data->e.subject_id);
		data->_tmp6_ = data->_tmp5_;
		data->_tmp7_ = NULL;
		data->_tmp7_ = trf_persona_build_iid (data->_tmp4_, data->_tmp6_);
		data->_tmp8_ = data->_tmp7_;
		_g_free0 (data->_tmp6_);
		data->p_id = data->_tmp8_;
		if (data->e.pred_id == data->rdf_type_id) {
			data->_tmp9_ = data->e.object_id == data->nco_person_id;
		} else {
			data->_tmp9_ = FALSE;
		}
		if (data->_tmp9_) {
			{
				g_static_rec_mutex_lock (&data->self->priv->__lock__personas);
				data->_tmp10_ = NULL;
				data->_tmp10_ = gee_abstract_map_get ((GeeAbstractMap*) data->self->priv->_personas, data->p_id);
				data->removed_p = (TrfPersona*) data->_tmp10_;
				if (data->removed_p != NULL) {
					gee_abstract_collection_add ((GeeAbstractCollection*) data->removed_personas, data->removed_p);
					data->_tmp11_ = NULL;
					data->_tmp11_ = folks_persona_get_iid ((FolksPersona*) data->removed_p);
					gee_abstract_map_unset ((GeeAbstractMap*) data->self->priv->_personas, data->_tmp11_, NULL);
				}
				_g_object_unref0 (data->removed_p);
				__finally5:
				g_static_rec_mutex_unlock (&data->self->priv->__lock__personas);
				if (data->_inner_error_ != NULL) {
					_g_free0 (data->p_id);
					_g_object_unref0 (data->removed_personas);
					_g_variant_iter_free0 (data->iter_del);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
					g_clear_error (&data->_inner_error_);
					return FALSE;
				}
			}
		} else {
			data->_tmp12_ = NULL;
			data->_tmp12_ = gee_abstract_map_get ((GeeAbstractMap*) data->self->priv->_personas, data->p_id);
			data->persona = (TrfPersona*) data->_tmp12_;
			if (data->persona != NULL) {
				data->_state_ = 1;
				_trf_persona_store_do_update (data->self, data->persona, &data->e, FALSE, _trf_persona_store_handle_delete_events_ready, data);
				return FALSE;
				_state_1:
				_trf_persona_store_do_update_finish (data->self, data->_res_);
			}
			_g_object_unref0 (data->persona);
		}
		_g_free0 (data->p_id);
	}
	data->_tmp13_ = gee_collection_get_size ((GeeCollection*) data->removed_personas);
	if (data->_tmp13_ > 0) {
		_folks_persona_store_emit_personas_changed ((FolksPersonaStore*) data->self, NULL, (GeeSet*) data->removed_personas, NULL, NULL, FOLKS_GROUP_DETAILS_CHANGE_REASON_NONE);
	}
	_g_object_unref0 (data->removed_personas);
	_g_variant_iter_free0 (data->iter_del);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_handle_insert_events_data_free (gpointer _data) {
	TrfPersonaStoreHandleInsertEventsData* data;
	data = _data;
	_g_variant_iter_free0 (data->iter_ins);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreHandleInsertEventsData, data);
}


static void _trf_persona_store_handle_insert_events (TrfPersonaStore* self, GVariantIter* iter_ins, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreHandleInsertEventsData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreHandleInsertEventsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_handle_insert_events);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_handle_insert_events_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->iter_ins = iter_ins;
	_trf_persona_store_handle_insert_events_co (_data_);
}


static void _trf_persona_store_handle_insert_events_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreHandleInsertEventsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_handle_insert_events_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreHandleInsertEventsData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_handle_insert_events_co (data);
}


static gboolean _trf_persona_store_handle_insert_events_co (TrfPersonaStoreHandleInsertEventsData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = gee_hash_set_new (TRF_TYPE_PERSONA, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL);
	data->added_personas = data->_tmp0_;
	memset (&data->e, 0, sizeof (Event));
	while (TRUE) {
		data->_tmp1_ = g_variant_iter_next (data->iter_ins, "(iiii)", &data->e.graph_id, &data->e.subject_id, &data->e.pred_id, &data->e.object_id, NULL);
		if (!data->_tmp1_) {
			break;
		}
		data->_tmp2_ = NULL;
		data->_tmp2_ = g_strdup_printf ("%i", data->e.subject_id);
		data->subject_tracker_id = data->_tmp2_;
		data->_tmp3_ = NULL;
		data->_tmp3_ = folks_persona_store_get_id ((FolksPersonaStore*) data->self);
		data->_tmp4_ = NULL;
		data->_tmp4_ = trf_persona_build_iid (data->_tmp3_, data->subject_tracker_id);
		data->p_id = data->_tmp4_;
		{
			g_static_rec_mutex_lock (&data->self->priv->__lock__personas);
			data->_tmp5_ = NULL;
			data->_tmp5_ = gee_abstract_map_get ((GeeAbstractMap*) data->self->priv->_personas, data->p_id);
			_g_object_unref0 (data->persona);
			data->persona = (TrfPersona*) data->_tmp5_;
			if (data->persona == NULL) {
				data->_tmp6_ = NULL;
				data->_tmp6_ = trf_persona_new (data->self, data->subject_tracker_id, NULL);
				_g_object_unref0 (data->persona);
				data->persona = data->_tmp6_;
				data->_tmp7_ = NULL;
				data->_tmp7_ = folks_persona_get_iid ((FolksPersona*) data->persona);
				gee_abstract_map_set ((GeeAbstractMap*) data->self->priv->_personas, data->_tmp7_, data->persona);
				gee_abstract_collection_add ((GeeAbstractCollection*) data->added_personas, data->persona);
			}
			__finally6:
			g_static_rec_mutex_unlock (&data->self->priv->__lock__personas);
			if (data->_inner_error_ != NULL) {
				_g_object_unref0 (data->persona);
				_g_free0 (data->p_id);
				_g_free0 (data->subject_tracker_id);
				_g_object_unref0 (data->added_personas);
				_g_variant_iter_free0 (data->iter_ins);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
				g_clear_error (&data->_inner_error_);
				return FALSE;
			}
		}
		data->_state_ = 1;
		_trf_persona_store_do_update (data->self, data->persona, &data->e, TRUE, _trf_persona_store_handle_insert_events_ready, data);
		return FALSE;
		_state_1:
		_trf_persona_store_do_update_finish (data->self, data->_res_);
		_g_object_unref0 (data->persona);
		_g_free0 (data->p_id);
		_g_free0 (data->subject_tracker_id);
	}
	data->_tmp8_ = gee_collection_get_size ((GeeCollection*) data->added_personas);
	if (data->_tmp8_ > 0) {
		_folks_persona_store_emit_personas_changed ((FolksPersonaStore*) data->self, (GeeSet*) data->added_personas, NULL, NULL, NULL, FOLKS_GROUP_DETAILS_CHANGE_REASON_NONE);
	}
	_g_object_unref0 (data->added_personas);
	_g_variant_iter_free0 (data->iter_ins);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_do_add_contacts_data_free (gpointer _data) {
	TrfPersonaStoreDoAddContactsData* data;
	data = _data;
	_g_free0 (data->query);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreDoAddContactsData, data);
}


static void _trf_persona_store_do_add_contacts (TrfPersonaStore* self, const gchar* query, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreDoAddContactsData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreDoAddContactsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_do_add_contacts);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_do_add_contacts_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->query = g_strdup (query);
	_trf_persona_store_do_add_contacts_co (_data_);
}


static GeeHashSet* _trf_persona_store_do_add_contacts_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	GeeHashSet* result;
	TrfPersonaStoreDoAddContactsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_do_add_contacts_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreDoAddContactsData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_do_add_contacts_co (data);
}


static gboolean _trf_persona_store_do_add_contacts_co (TrfPersonaStoreDoAddContactsData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = gee_hash_set_new (TRF_TYPE_PERSONA, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL);
	data->added_personas = data->_tmp0_;
	data->_state_ = 1;
	tracker_sparql_connection_query_async (data->self->priv->_connection, data->query, NULL, _trf_persona_store_do_add_contacts_ready, data);
	return FALSE;
	_state_1:
	data->_tmp1_ = NULL;
	data->_tmp1_ = tracker_sparql_connection_query_finish (data->self->priv->_connection, data->_res_, &data->_inner_error_);
	data->cursor = data->_tmp1_;
	if (data->_inner_error_ != NULL) {
		goto __catch7_g_error;
	}
	while (TRUE) {
		data->_tmp2_ = tracker_sparql_cursor_next (data->cursor, NULL, &data->_inner_error_);
		data->_tmp3_ = data->_tmp2_;
		if (data->_inner_error_ != NULL) {
			_g_object_unref0 (data->cursor);
			goto __catch7_g_error;
		}
		if (!data->_tmp3_) {
			break;
		}
		data->_tmp4_ = tracker_sparql_cursor_get_integer (data->cursor, (gint) TRF_FIELDS_TRACKER_ID);
		data->tracker_id = (gint) data->_tmp4_;
		data->_tmp5_ = NULL;
		data->_tmp5_ = folks_persona_store_get_id ((FolksPersonaStore*) data->self);
		data->_tmp6_ = NULL;
		data->_tmp6_ = g_strdup_printf ("%i", data->tracker_id);
		data->_tmp7_ = data->_tmp6_;
		data->_tmp8_ = NULL;
		data->_tmp8_ = trf_persona_build_iid (data->_tmp5_, data->_tmp7_);
		data->_tmp9_ = data->_tmp8_;
		_g_free0 (data->_tmp7_);
		data->p_id = data->_tmp9_;
		data->_tmp10_ = NULL;
		data->_tmp10_ = gee_abstract_map_get ((GeeAbstractMap*) data->self->priv->_personas, data->p_id);
		data->_tmp11_ = (TrfPersona*) data->_tmp10_;
		data->_tmp12_ = data->_tmp11_ == NULL;
		_g_object_unref0 (data->_tmp11_);
		if (data->_tmp12_) {
			data->_tmp13_ = NULL;
			data->_tmp13_ = g_strdup_printf ("%i", data->tracker_id);
			data->_tmp14_ = data->_tmp13_;
			data->_tmp15_ = NULL;
			data->_tmp15_ = trf_persona_new (data->self, data->_tmp14_, data->cursor);
			data->_tmp16_ = data->_tmp15_;
			_g_free0 (data->_tmp14_);
			data->persona = data->_tmp16_;
			data->_tmp17_ = NULL;
			data->_tmp17_ = folks_persona_get_iid ((FolksPersona*) data->persona);
			gee_abstract_map_set ((GeeAbstractMap*) data->self->priv->_personas, data->_tmp17_, data->persona);
			gee_abstract_collection_add ((GeeAbstractCollection*) data->added_personas, data->persona);
			_g_object_unref0 (data->persona);
		}
		_g_free0 (data->p_id);
	}
	data->_tmp18_ = gee_collection_get_size ((GeeCollection*) data->added_personas);
	if (data->_tmp18_ > 0) {
		_folks_persona_store_emit_personas_changed ((FolksPersonaStore*) data->self, (GeeSet*) data->added_personas, NULL, NULL, NULL, FOLKS_GROUP_DETAILS_CHANGE_REASON_NONE);
	}
	_g_object_unref0 (data->cursor);
	goto __finally7;
	__catch7_g_error:
	{
		data->e = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:1299: Couldn't perform queries: %s %s", data->query, data->e->message);
		_g_error_free0 (data->e);
	}
	__finally7:
	if (data->_inner_error_ != NULL) {
		_g_object_unref0 (data->added_personas);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
		g_clear_error (&data->_inner_error_);
		return FALSE;
	}
	data->result = data->added_personas;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_object_unref0 (data->added_personas);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_do_update_data_free (gpointer _data) {
	TrfPersonaStoreDoUpdateData* data;
	data = _data;
	_g_object_unref0 (data->p);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreDoUpdateData, data);
}


static void _trf_persona_store_do_update (TrfPersonaStore* self, TrfPersona* p, Event* e, gboolean adding, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreDoUpdateData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreDoUpdateData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_do_update);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_do_update_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->p = _g_object_ref0 (p);
	_data_->e = *e;
	_data_->adding = adding;
	_trf_persona_store_do_update_co (_data_);
}


static void _trf_persona_store_do_update_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreDoUpdateData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_do_update_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreDoUpdateData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_do_update_co (data);
}


static gboolean _trf_persona_store_do_update_co (TrfPersonaStoreDoUpdateData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		case 6:
		goto _state_6;
		case 7:
		goto _state_7;
		case 8:
		goto _state_8;
		case 9:
		goto _state_9;
		case 10:
		goto _state_10;
		case 11:
		goto _state_11;
		case 12:
		goto _state_12;
		case 13:
		goto _state_13;
		case 14:
		goto _state_14;
		case 15:
		goto _state_15;
		case 16:
		goto _state_16;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_FULLNAME);
	if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp0_)) {
		data->_tmp1_ = g_strdup ("");
		data->fullname = data->_tmp1_;
		if (data->adding) {
			data->_state_ = 1;
			_trf_persona_store_get_property (data->self, data->e.subject_id, TRF_ONTOLOGY_DEFS_NCO_FULLNAME, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_do_update_ready, data);
			return FALSE;
			_state_1:
			data->_tmp2_ = NULL;
			data->_tmp2_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
			_g_free0 (data->fullname);
			data->fullname = data->_tmp2_;
		}
		_trf_persona_update_full_name (data->p, data->fullname);
		_g_free0 (data->fullname);
	} else {
		data->_tmp3_ = NULL;
		data->_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_NICKNAME);
		if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp3_)) {
			data->_tmp4_ = g_strdup ("");
			data->alias = data->_tmp4_;
			if (data->adding) {
				data->_state_ = 2;
				_trf_persona_store_get_property (data->self, data->e.subject_id, TRF_ONTOLOGY_DEFS_NCO_NICKNAME, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_do_update_ready, data);
				return FALSE;
				_state_2:
				data->_tmp5_ = NULL;
				data->_tmp5_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
				_g_free0 (data->alias);
				data->alias = data->_tmp5_;
			}
			_trf_persona_update_alias (data->p, data->alias);
			_g_free0 (data->alias);
		} else {
			data->_tmp6_ = NULL;
			data->_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_FAMILY);
			if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp6_)) {
				data->_tmp7_ = g_strdup ("");
				data->family_name = data->_tmp7_;
				if (data->adding) {
					data->_state_ = 3;
					_trf_persona_store_get_property (data->self, data->e.subject_id, TRF_ONTOLOGY_DEFS_NCO_FAMILY, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_do_update_ready, data);
					return FALSE;
					_state_3:
					data->_tmp8_ = NULL;
					data->_tmp8_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
					_g_free0 (data->family_name);
					data->family_name = data->_tmp8_;
				}
				_trf_persona_update_family_name (data->p, data->family_name);
				_g_free0 (data->family_name);
			} else {
				data->_tmp9_ = NULL;
				data->_tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_GIVEN);
				if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp9_)) {
					data->_tmp10_ = g_strdup ("");
					data->given_name = data->_tmp10_;
					if (data->adding) {
						data->_state_ = 4;
						_trf_persona_store_get_property (data->self, data->e.subject_id, TRF_ONTOLOGY_DEFS_NCO_GIVEN, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_do_update_ready, data);
						return FALSE;
						_state_4:
						data->_tmp11_ = NULL;
						data->_tmp11_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
						_g_free0 (data->given_name);
						data->given_name = data->_tmp11_;
					}
					_trf_persona_update_given_name (data->p, data->given_name);
					_g_free0 (data->given_name);
				} else {
					data->_tmp12_ = NULL;
					data->_tmp12_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_ADDITIONAL);
					if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp12_)) {
						data->_tmp13_ = g_strdup ("");
						data->additional_name = data->_tmp13_;
						if (data->adding) {
							data->_state_ = 5;
							_trf_persona_store_get_property (data->self, data->e.subject_id, TRF_ONTOLOGY_DEFS_NCO_ADDITIONAL, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_do_update_ready, data);
							return FALSE;
							_state_5:
							data->_tmp14_ = NULL;
							data->_tmp14_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
							_g_free0 (data->additional_name);
							data->additional_name = data->_tmp14_;
						}
						_trf_persona_update_additional_names (data->p, data->additional_name);
						_g_free0 (data->additional_name);
					} else {
						data->_tmp15_ = NULL;
						data->_tmp15_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_SUFFIX);
						if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp15_)) {
							data->_tmp16_ = g_strdup ("");
							data->suffix_name = data->_tmp16_;
							if (data->adding) {
								data->_state_ = 6;
								_trf_persona_store_get_property (data->self, data->e.subject_id, TRF_ONTOLOGY_DEFS_NCO_SUFFIX, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_do_update_ready, data);
								return FALSE;
								_state_6:
								data->_tmp17_ = NULL;
								data->_tmp17_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
								_g_free0 (data->suffix_name);
								data->suffix_name = data->_tmp17_;
							}
							_trf_persona_update_suffixes (data->p, data->suffix_name);
							_g_free0 (data->suffix_name);
						} else {
							data->_tmp18_ = NULL;
							data->_tmp18_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_PREFIX);
							if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp18_)) {
								data->_tmp19_ = g_strdup ("");
								data->prefix_name = data->_tmp19_;
								if (data->adding) {
									data->_state_ = 7;
									_trf_persona_store_get_property (data->self, data->e.subject_id, TRF_ONTOLOGY_DEFS_NCO_PREFIX, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_do_update_ready, data);
									return FALSE;
									_state_7:
									data->_tmp20_ = NULL;
									data->_tmp20_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
									_g_free0 (data->prefix_name);
									data->prefix_name = data->_tmp20_;
								}
								_trf_persona_update_prefixes (data->p, data->prefix_name);
								_g_free0 (data->prefix_name);
							} else {
								data->_tmp21_ = NULL;
								data->_tmp21_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NAO_TAG);
								if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp21_)) {
									data->_tmp22_ = trf_persona_store_get_favorite_id (data->self);
									if (data->e.object_id == data->_tmp22_) {
										if (data->adding) {
											_trf_persona_set_favourite (data->p, TRUE);
										} else {
											_trf_persona_set_favourite (data->p, FALSE);
										}
									}
								} else {
									data->_tmp23_ = NULL;
									data->_tmp23_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_HAS_EMAIL);
									if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp23_)) {
										if (data->adding) {
											data->_state_ = 8;
											_trf_persona_store_get_property (data->self, data->e.object_id, TRF_ONTOLOGY_DEFS_NCO_EMAIL_PROP, TRF_ONTOLOGY_DEFS_NCO_EMAIL, _trf_persona_store_do_update_ready, data);
											return FALSE;
											_state_8:
											data->_tmp24_ = NULL;
											data->_tmp24_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
											data->email = data->_tmp24_;
											data->_tmp25_ = NULL;
											data->_tmp25_ = g_strdup_printf ("%i", data->e.object_id);
											data->_tmp26_ = data->_tmp25_;
											_trf_persona_add_email (data->p, data->email, data->_tmp26_);
											_g_free0 (data->_tmp26_);
											_g_free0 (data->email);
										} else {
											data->_tmp27_ = NULL;
											data->_tmp27_ = g_strdup_printf ("%i", data->e.object_id);
											data->_tmp28_ = data->_tmp27_;
											_trf_persona_remove_email (data->p, data->_tmp28_);
											_g_free0 (data->_tmp28_);
										}
									} else {
										data->_tmp29_ = NULL;
										data->_tmp29_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_HAS_PHONE);
										if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp29_)) {
											if (data->adding) {
												data->_state_ = 9;
												_trf_persona_store_get_property (data->self, data->e.object_id, TRF_ONTOLOGY_DEFS_NCO_PHONE_PROP, TRF_ONTOLOGY_DEFS_NCO_PHONE, _trf_persona_store_do_update_ready, data);
												return FALSE;
												_state_9:
												data->_tmp30_ = NULL;
												data->_tmp30_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
												data->phone = data->_tmp30_;
												data->_tmp31_ = NULL;
												data->_tmp31_ = g_strdup_printf ("%i", data->e.object_id);
												data->_tmp32_ = data->_tmp31_;
												_trf_persona_add_phone (data->p, data->phone, data->_tmp32_);
												_g_free0 (data->_tmp32_);
												_g_free0 (data->phone);
											} else {
												data->_tmp33_ = NULL;
												data->_tmp33_ = g_strdup_printf ("%i", data->e.object_id);
												data->_tmp34_ = data->_tmp33_;
												_trf_persona_remove_phone (data->p, data->_tmp34_);
												_g_free0 (data->_tmp34_);
											}
										} else {
											data->_tmp35_ = NULL;
											data->_tmp35_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION);
											if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp35_)) {
												if (data->adding) {
													data->_tmp36_ = NULL;
													data->_tmp36_ = g_strdup_printf ("%i", data->e.subject_id);
													data->_tmp37_ = data->_tmp36_;
													data->_tmp38_ = NULL;
													data->_tmp38_ = g_strdup_printf ("%i", data->e.object_id);
													data->_tmp39_ = data->_tmp38_;
													data->_state_ = 10;
													_trf_persona_store_get_affl_info (data->self, data->_tmp37_, data->_tmp39_, _trf_persona_store_do_update_ready, data);
													return FALSE;
													_state_10:
													data->_tmp40_ = NULL;
													data->_tmp40_ = _trf_persona_store_get_affl_info_finish (data->self, data->_res_);
													data->_tmp41_ = data->_tmp40_;
													_g_free0 (data->_tmp39_);
													_g_free0 (data->_tmp37_);
													data->affl_info = data->_tmp41_;
													data->_tmp42_ = NULL;
													data->_tmp42_ = trf_affl_info_to_string (data->affl_info);
													data->_tmp43_ = data->_tmp42_;
													g_debug ("trf-persona-store.vala:1441: affl_info : %s", data->_tmp43_);
													_g_free0 (data->_tmp43_);
													data->_tmp44_ = NULL;
													data->_tmp44_ = trf_affl_info_get_im_tracker_id (data->affl_info);
													if (data->_tmp44_ != NULL) {
														data->_tmp45_ = NULL;
														data->_tmp45_ = trf_affl_info_get_im_nickname (data->affl_info);
														_trf_persona_update_nickname (data->p, data->_tmp45_);
														data->_tmp46_ = NULL;
														data->_tmp46_ = trf_affl_info_get_im_proto (data->affl_info);
														if (data->_tmp46_ != NULL) {
															data->_tmp47_ = NULL;
															data->_tmp47_ = trf_affl_info_get_affl_tracker_id (data->affl_info);
															data->_tmp48_ = NULL;
															data->_tmp48_ = trf_affl_info_get_im_proto (data->affl_info);
															data->_tmp49_ = NULL;
															data->_tmp49_ = trf_affl_info_get_im_account_id (data->affl_info);
															_trf_persona_add_im_address (data->p, data->_tmp47_, data->_tmp48_, data->_tmp49_, TRUE);
														}
													}
													data->_tmp50_ = NULL;
													data->_tmp50_ = trf_affl_info_get_affl_tracker_id (data->affl_info);
													if (data->_tmp50_ != NULL) {
														data->_tmp52_ = NULL;
														data->_tmp52_ = trf_affl_info_get_title (data->affl_info);
														if (data->_tmp52_ != NULL) {
															data->_tmp51_ = TRUE;
														} else {
															data->_tmp53_ = NULL;
															data->_tmp53_ = trf_affl_info_get_org (data->affl_info);
															data->_tmp51_ = data->_tmp53_ != NULL;
														}
														if (data->_tmp51_) {
															data->_tmp54_ = NULL;
															data->_tmp54_ = trf_affl_info_get_affl_tracker_id (data->affl_info);
															data->_tmp55_ = NULL;
															data->_tmp55_ = trf_affl_info_get_title (data->affl_info);
															data->_tmp56_ = NULL;
															data->_tmp56_ = trf_affl_info_get_org (data->affl_info);
															_trf_persona_add_role (data->p, data->_tmp54_, data->_tmp55_, data->_tmp56_);
														}
													}
													if (data->affl_info->postal_address != NULL) {
														_trf_persona_add_postal_address (data->p, data->affl_info->postal_address);
													}
													data->_tmp57_ = NULL;
													data->_tmp57_ = trf_affl_info_get_phone (data->affl_info);
													if (data->_tmp57_ != NULL) {
														data->_tmp58_ = NULL;
														data->_tmp58_ = trf_affl_info_get_phone (data->affl_info);
														data->_tmp59_ = NULL;
														data->_tmp59_ = g_strdup_printf ("%i", data->e.object_id);
														data->_tmp60_ = data->_tmp59_;
														_trf_persona_add_phone (data->p, data->_tmp58_, data->_tmp60_);
														_g_free0 (data->_tmp60_);
													}
													data->_tmp61_ = NULL;
													data->_tmp61_ = trf_affl_info_get_email (data->affl_info);
													if (data->_tmp61_ != NULL) {
														data->_tmp62_ = NULL;
														data->_tmp62_ = trf_affl_info_get_email (data->affl_info);
														data->_tmp63_ = NULL;
														data->_tmp63_ = g_strdup_printf ("%i", data->e.object_id);
														data->_tmp64_ = data->_tmp63_;
														_trf_persona_add_email (data->p, data->_tmp62_, data->_tmp64_);
														_g_free0 (data->_tmp64_);
													}
													data->_tmp65_ = NULL;
													data->_tmp65_ = trf_affl_info_get_website (data->affl_info);
													if (data->_tmp65_ != NULL) {
														data->_tmp66_ = NULL;
														data->_tmp66_ = trf_affl_info_get_website (data->affl_info);
														data->_tmp67_ = NULL;
														data->_tmp67_ = trf_affl_info_get_affl_tracker_id (data->affl_info);
														_trf_persona_add_url (data->p, data->_tmp66_, data->_tmp67_, "website");
													}
													data->_tmp68_ = NULL;
													data->_tmp68_ = trf_affl_info_get_blog (data->affl_info);
													if (data->_tmp68_ != NULL) {
														data->_tmp69_ = NULL;
														data->_tmp69_ = trf_affl_info_get_blog (data->affl_info);
														data->_tmp70_ = NULL;
														data->_tmp70_ = trf_affl_info_get_affl_tracker_id (data->affl_info);
														_trf_persona_add_url (data->p, data->_tmp69_, data->_tmp70_, "blog");
													}
													data->_tmp71_ = NULL;
													data->_tmp71_ = trf_affl_info_get_url (data->affl_info);
													if (data->_tmp71_ != NULL) {
														data->_tmp72_ = NULL;
														data->_tmp72_ = trf_affl_info_get_url (data->affl_info);
														data->_tmp73_ = NULL;
														data->_tmp73_ = trf_affl_info_get_affl_tracker_id (data->affl_info);
														_trf_persona_add_url (data->p, data->_tmp72_, data->_tmp73_, "url");
													}
													_g_object_unref0 (data->affl_info);
												} else {
													data->_tmp74_ = NULL;
													data->_tmp74_ = g_strdup_printf ("%i", data->e.object_id);
													data->_tmp75_ = data->_tmp74_;
													_trf_persona_remove_im_address (data->p, data->_tmp75_, TRUE);
													_g_free0 (data->_tmp75_);
													data->_tmp76_ = NULL;
													data->_tmp76_ = g_strdup_printf ("%i", data->e.object_id);
													data->_tmp77_ = data->_tmp76_;
													_trf_persona_remove_role (data->p, data->_tmp77_);
													_g_free0 (data->_tmp77_);
													data->_tmp78_ = NULL;
													data->_tmp78_ = g_strdup_printf ("%i", data->e.object_id);
													data->_tmp79_ = data->_tmp78_;
													_trf_persona_remove_postal_address (data->p, data->_tmp79_);
													_g_free0 (data->_tmp79_);
													data->_tmp80_ = NULL;
													data->_tmp80_ = g_strdup_printf ("%i", data->e.object_id);
													data->_tmp81_ = data->_tmp80_;
													_trf_persona_remove_phone (data->p, data->_tmp81_);
													_g_free0 (data->_tmp81_);
													data->_tmp82_ = NULL;
													data->_tmp82_ = g_strdup_printf ("%i", data->e.object_id);
													data->_tmp83_ = data->_tmp82_;
													_trf_persona_remove_email (data->p, data->_tmp83_);
													_g_free0 (data->_tmp83_);
													data->_tmp84_ = NULL;
													data->_tmp84_ = g_strdup_printf ("%i", data->e.object_id);
													data->_tmp85_ = data->_tmp84_;
													_trf_persona_remove_url (data->p, data->_tmp85_);
													_g_free0 (data->_tmp85_);
												}
											} else {
												data->_tmp86_ = NULL;
												data->_tmp86_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_BIRTHDAY);
												if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp86_)) {
													data->_tmp87_ = g_strdup ("");
													data->bday = data->_tmp87_;
													if (data->adding) {
														data->_state_ = 11;
														_trf_persona_store_get_property (data->self, data->e.subject_id, TRF_ONTOLOGY_DEFS_NCO_BIRTHDAY, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_do_update_ready, data);
														return FALSE;
														_state_11:
														data->_tmp88_ = NULL;
														data->_tmp88_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
														_g_free0 (data->bday);
														data->bday = data->_tmp88_;
													}
													_trf_persona_set_birthday (data->p, data->bday);
													_g_free0 (data->bday);
												} else {
													data->_tmp89_ = NULL;
													data->_tmp89_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_NOTE);
													if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp89_)) {
														data->_tmp90_ = g_strdup ("");
														data->note = data->_tmp90_;
														if (data->adding) {
															data->_state_ = 12;
															_trf_persona_store_get_property (data->self, data->e.subject_id, TRF_ONTOLOGY_DEFS_NCO_NOTE, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_do_update_ready, data);
															return FALSE;
															_state_12:
															data->_tmp91_ = NULL;
															data->_tmp91_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
															_g_free0 (data->note);
															data->note = data->_tmp91_;
														}
														_trf_persona_set_note (data->p, data->note);
														_g_free0 (data->note);
													} else {
														data->_tmp92_ = NULL;
														data->_tmp92_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_GENDER);
														if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp92_)) {
															if (data->adding) {
																_trf_persona_set_gender (data->p, data->e.object_id);
															} else {
																_trf_persona_set_gender (data->p, 0);
															}
														} else {
															data->_tmp93_ = NULL;
															data->_tmp93_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NCO_PHOTO);
															if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp93_)) {
																data->_tmp94_ = g_strdup ("");
																data->avatar_url = data->_tmp94_;
																if (data->adding) {
																	data->_state_ = 13;
																	_trf_persona_store_get_property (data->self, data->e.object_id, TRF_ONTOLOGY_DEFS_NIE_URL, TRF_ONTOLOGY_DEFS_NFO_IMAGE, _trf_persona_store_do_update_ready, data);
																	return FALSE;
																	_state_13:
																	data->_tmp95_ = NULL;
																	data->_tmp95_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
																	_g_free0 (data->avatar_url);
																	data->avatar_url = data->_tmp95_;
																}
																_trf_persona_set_avatar (data->p, data->avatar_url);
																_g_free0 (data->avatar_url);
															} else {
																data->_tmp96_ = NULL;
																data->_tmp96_ = gee_abstract_map_get ((GeeAbstractMap*) trf_persona_store__prefix_tracker_id, TRF_ONTOLOGY_DEFS_NAO_PROPERTY);
																if (data->e.pred_id == GPOINTER_TO_INT (data->_tmp96_)) {
																	if (data->adding) {
																		data->_state_ = 14;
																		_trf_persona_store_get_nao_property_by_prop_id (data->self, data->e.object_id, _trf_persona_store_do_update_ready, data);
																		return FALSE;
																		_state_14:
																		data->_tmp98_ = NULL;
																		data->_tmp98_ = _trf_persona_store_get_nao_property_by_prop_id_finish (data->self, data->_res_, &data->_tmp97_);
																		data->prop_info = data->_tmp98_;
																		data->prop_info_length1 = data->_tmp97_;
																		data->_prop_info_size_ = data->_tmp97_;
																		if (g_strcmp0 (data->prop_info[0], TRF_PERSONA_STORE__LOCAL_ID_PROPERTY_NAME) == 0) {
																			_trf_persona_set_local_ids (data->p, data->prop_info[1]);
																		} else {
																			if (g_strcmp0 (data->prop_info[0], TRF_PERSONA_STORE__WSD_PROPERTY_NAME) == 0) {
																				_trf_persona_set_web_service_addrs (data->p, data->prop_info[1]);
																			}
																		}
																		data->prop_info = (_vala_array_free (data->prop_info, data->prop_info_length1, (GDestroyNotify) g_free), NULL);
																	} else {
																		data->_state_ = 15;
																		_trf_persona_store_get_nao_property_by_person_id (data->self, data->e.subject_id, TRF_PERSONA_STORE__LOCAL_ID_PROPERTY_NAME, _trf_persona_store_do_update_ready, data);
																		return FALSE;
																		_state_15:
																		data->_tmp99_ = NULL;
																		data->_tmp99_ = _trf_persona_store_get_nao_property_by_person_id_finish (data->self, data->_res_);
																		data->local_ids = data->_tmp99_;
																		data->_state_ = 16;
																		_trf_persona_store_get_nao_property_by_person_id (data->self, data->e.subject_id, TRF_PERSONA_STORE__WSD_PROPERTY_NAME, _trf_persona_store_do_update_ready, data);
																		return FALSE;
																		_state_16:
																		data->_tmp100_ = NULL;
																		data->_tmp100_ = _trf_persona_store_get_nao_property_by_person_id_finish (data->self, data->_res_);
																		data->ws_addrs = data->_tmp100_;
																		_trf_persona_set_local_ids (data->p, data->local_ids);
																		_trf_persona_set_web_service_addrs (data->p, data->ws_addrs);
																		_g_free0 (data->ws_addrs);
																		_g_free0 (data->local_ids);
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_get_property_data_free (gpointer _data) {
	TrfPersonaStoreGetPropertyData* data;
	data = _data;
	_g_free0 (data->property);
	_g_free0 (data->subject_type);
	_g_free0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreGetPropertyData, data);
}


static void _trf_persona_store_get_property (TrfPersonaStore* self, gint subject_tracker_id, const gchar* property, const gchar* subject_type, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreGetPropertyData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreGetPropertyData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_get_property);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_get_property_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->subject_tracker_id = subject_tracker_id;
	_data_->property = g_strdup (property);
	_data_->subject_type = g_strdup (subject_type);
	_trf_persona_store_get_property_co (_data_);
}


static gchar* _trf_persona_store_get_property_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gchar* result;
	TrfPersonaStoreGetPropertyData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_get_property_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreGetPropertyData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_get_property_co (data);
}


static gboolean _trf_persona_store_get_property_co (TrfPersonaStoreGetPropertyData* data) {
	static const char query_template[] = "SELECT ?property WHERE" " { ?p a %s ; " "   %s ?property " " . FILTER(tracker:id(?p) = %d ) }";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = g_strdup_printf (query_template, data->subject_type, data->property, data->subject_tracker_id);
	data->query = data->_tmp0_;
	data->_state_ = 1;
	_trf_persona_store_single_value_query (data->self, data->query, _trf_persona_store_get_property_ready, data);
	return FALSE;
	_state_1:
	data->_tmp1_ = NULL;
	data->_tmp1_ = _trf_persona_store_single_value_query_finish (data->self, data->_res_);
	data->result = data->_tmp1_;
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_get_nao_property_by_person_id_data_free (gpointer _data) {
	TrfPersonaStoreGetNaoPropertyByPersonIdData* data;
	data = _data;
	_g_free0 (data->prop_name);
	_g_free0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreGetNaoPropertyByPersonIdData, data);
}


static void _trf_persona_store_get_nao_property_by_person_id (TrfPersonaStore* self, gint nco_person_id, const gchar* prop_name, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreGetNaoPropertyByPersonIdData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreGetNaoPropertyByPersonIdData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_get_nao_property_by_person_id);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_get_nao_property_by_person_id_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->nco_person_id = nco_person_id;
	_data_->prop_name = g_strdup (prop_name);
	_trf_persona_store_get_nao_property_by_person_id_co (_data_);
}


static gchar* _trf_persona_store_get_nao_property_by_person_id_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gchar* result;
	TrfPersonaStoreGetNaoPropertyByPersonIdData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_get_nao_property_by_person_id_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreGetNaoPropertyByPersonIdData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_get_nao_property_by_person_id_co (data);
}


static gboolean _trf_persona_store_get_nao_property_by_person_id_co (TrfPersonaStoreGetNaoPropertyByPersonIdData* data) {
	static const char query_t[] = "SELECT " " ?prop_value " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " ; " TRF_ONTOLOGY_DEFS_NAO_HAS_PROPERTY " ?prop . " " ?prop " TRF_ONTOLOGY_DEFS_NAO_PROPERTY_NAME " ?prop_name . " " ?prop " TRF_ONTOLOGY_DEFS_NAO_PROPERTY_VALUE " ?prop_value . " " FILTER (tracker:id(?p) = %d && ?prop_name = '%s') } ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = g_strdup_printf (query_t, data->nco_person_id, data->prop_name);
	data->query = data->_tmp0_;
	data->_state_ = 1;
	_trf_persona_store_single_value_query (data->self, data->query, _trf_persona_store_get_nao_property_by_person_id_ready, data);
	return FALSE;
	_state_1:
	data->_tmp1_ = NULL;
	data->_tmp1_ = _trf_persona_store_single_value_query_finish (data->self, data->_res_);
	data->result = data->_tmp1_;
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_get_nao_property_by_prop_id_data_free (gpointer _data) {
	TrfPersonaStoreGetNaoPropertyByPropIdData* data;
	data = _data;
	data->result = (_vala_array_free (data->result, data->result_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreGetNaoPropertyByPropIdData, data);
}


static void _trf_persona_store_get_nao_property_by_prop_id (TrfPersonaStore* self, gint nao_prop_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreGetNaoPropertyByPropIdData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreGetNaoPropertyByPropIdData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_get_nao_property_by_prop_id);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_get_nao_property_by_prop_id_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->nao_prop_id = nao_prop_id;
	_trf_persona_store_get_nao_property_by_prop_id_co (_data_);
}


static gchar** _trf_persona_store_get_nao_property_by_prop_id_finish (TrfPersonaStore* self, GAsyncResult* _res_, int* result_length1) {
	gchar** result;
	TrfPersonaStoreGetNaoPropertyByPropIdData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_get_nao_property_by_prop_id_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreGetNaoPropertyByPropIdData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_get_nao_property_by_prop_id_co (data);
}


static gboolean _trf_persona_store_get_nao_property_by_prop_id_co (TrfPersonaStoreGetNaoPropertyByPropIdData* data) {
	static const char query_t[] = "SELECT " " fn:concat(?prop_name, '\t', ?prop_value)" "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " ; " TRF_ONTOLOGY_DEFS_NAO_HAS_PROPERTY " ?prop . " " ?prop " TRF_ONTOLOGY_DEFS_NAO_PROPERTY_NAME " ?prop_name . " " ?prop " TRF_ONTOLOGY_DEFS_NAO_PROPERTY_VALUE " ?prop_value . " " FILTER (tracker:id(?prop) = %d) } ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = g_strdup_printf (query_t, data->nao_prop_id);
	data->query = data->_tmp0_;
	data->_state_ = 1;
	_trf_persona_store_single_value_query (data->self, data->query, _trf_persona_store_get_nao_property_by_prop_id_ready, data);
	return FALSE;
	_state_1:
	data->_tmp1_ = NULL;
	data->_tmp1_ = _trf_persona_store_single_value_query_finish (data->self, data->_res_);
	data->ret = data->_tmp1_;
	data->_tmp3_ = NULL;
	data->_tmp3_ = data->_tmp2_ = g_strsplit (data->ret, "\t", 0);
	data->_tmp4_ = data->_tmp3_;
	data->result_length1 = _vala_array_length (data->_tmp2_);
	data->result = data->_tmp4_;
	_g_free0 (data->ret);
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->ret);
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_get_affl_info_data_free (gpointer _data) {
	TrfPersonaStoreGetAfflInfoData* data;
	data = _data;
	_g_free0 (data->person_id);
	_g_free0 (data->affiliation_id);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreGetAfflInfoData, data);
}


static void _trf_persona_store_get_affl_info (TrfPersonaStore* self, const gchar* person_id, const gchar* affiliation_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreGetAfflInfoData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreGetAfflInfoData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_get_affl_info);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_get_affl_info_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->person_id = g_strdup (person_id);
	_data_->affiliation_id = g_strdup (affiliation_id);
	_trf_persona_store_get_affl_info_co (_data_);
}


static TrfAfflInfo* _trf_persona_store_get_affl_info_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfAfflInfo* result;
	TrfPersonaStoreGetAfflInfoData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_get_affl_info_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreGetAfflInfoData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_get_affl_info_co (data);
}


static gboolean _trf_persona_store_get_affl_info_co (TrfPersonaStoreGetAfflInfoData* data) {
	static const char query_template[] = "SELECT " "tracker:id(?i) " TRF_ONTOLOGY_DEFS_NCO_IMPROTOCOL "(?i) " TRF_ONTOLOGY_DEFS_NCO_IMID "(?i) " "tracker:id(?a) " TRF_ONTOLOGY_DEFS_NCO_ROLE "(?a) " TRF_ONTOLOGY_DEFS_NCO_ORG "(?a) " TRF_ONTOLOGY_DEFS_NCO_POBOX "(?postal) " TRF_ONTOLOGY_DEFS_NCO_DISTRICT "(?postal) " TRF_ONTOLOGY_DEFS_NCO_COUNTY "(?postal) " TRF_ONTOLOGY_DEFS_NCO_LOCALITY "(?postal) " TRF_ONTOLOGY_DEFS_NCO_POSTALCODE "(?postal) " TRF_ONTOLOGY_DEFS_NCO_STREET_ADDRESS "(?postal) " TRF_ONTOLOGY_DEFS_NCO_ADDRESS_LOCATION "(?postal) " TRF_ONTOLOGY_DEFS_NCO_EXTENDED_ADDRESS "(?postal) " TRF_ONTOLOGY_DEFS_NCO_COUNTRY "(?postal) " TRF_ONTOLOGY_DEFS_NCO_REGION "(?postal) " TRF_ONTOLOGY_DEFS_NCO_EMAIL_PROP "(?e) " TRF_ONTOLOGY_DEFS_NCO_PHONE_PROP "(?number) " TRF_ONTOLOGY_DEFS_NCO_WEBSITE "(?a) " TRF_ONTOLOGY_DEFS_NCO_BLOG "(?a) " TRF_ONTOLOGY_DEFS_NCO_URL "(?a) " TRF_ONTOLOGY_DEFS_NCO_IM_NICKNAME "(?i) " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " ; " TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION " ?a . " " OPTIONAL { ?a " TRF_ONTOLOGY_DEFS_NCO_HAS_IMADDRESS " ?i } . " " OPTIONAL { ?a " TRF_ONTOLOGY_DEFS_NCO_HAS_POSTAL_ADDRESS "               ?postal } . " " OPTIONAL { ?a " TRF_ONTOLOGY_DEFS_NCO_HAS_EMAIL " ?e } . " " OPTIONAL { ?a " TRF_ONTOLOGY_DEFS_NCO_HAS_PHONE " ?number }  " " FILTER(tracker:id(?p) = %s" " && tracker:id(?a) = %s" " ) } ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_affl_info_new ();
	data->affl_info = data->_tmp0_;
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_strdup_printf (query_template, data->person_id, data->affiliation_id);
	data->query = data->_tmp1_;
	g_debug ("trf-persona-store.vala:1664: _get_affl_info: %s", data->query);
	data->_state_ = 1;
	tracker_sparql_connection_query_async (data->self->priv->_connection, data->query, NULL, _trf_persona_store_get_affl_info_ready, data);
	return FALSE;
	_state_1:
	data->_tmp2_ = NULL;
	data->_tmp2_ = tracker_sparql_connection_query_finish (data->self->priv->_connection, data->_res_, &data->_inner_error_);
	data->cursor = data->_tmp2_;
	if (data->_inner_error_ != NULL) {
		if (data->_inner_error_->domain == TRACKER_SPARQL_ERROR) {
			goto __catch8_tracker_sparql_error;
		}
		goto __catch8_g_error;
	}
	while (TRUE) {
		data->_state_ = 2;
		tracker_sparql_cursor_next_async (data->cursor, NULL, _trf_persona_store_get_affl_info_ready, data);
		return FALSE;
		_state_2:
		data->_tmp3_ = tracker_sparql_cursor_next_finish (data->cursor, data->_res_, &data->_inner_error_);
		data->_tmp4_ = data->_tmp3_;
		if (data->_inner_error_ != NULL) {
			_g_object_unref0 (data->cursor);
			if (data->_inner_error_->domain == TRACKER_SPARQL_ERROR) {
				goto __catch8_tracker_sparql_error;
			}
			goto __catch8_g_error;
		}
		if (!data->_tmp4_) {
			break;
		}
		data->_tmp5_ = NULL;
		data->_tmp5_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_IM_TRACKER_ID, NULL);
		data->_tmp6_ = NULL;
		data->_tmp6_ = g_strdup (data->_tmp5_);
		data->_tmp7_ = data->_tmp6_;
		trf_affl_info_set_im_tracker_id (data->affl_info, data->_tmp7_);
		_g_free0 (data->_tmp7_);
		data->_tmp8_ = NULL;
		data->_tmp8_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_IM_PROTOCOL, NULL);
		data->_tmp9_ = NULL;
		data->_tmp9_ = g_strdup (data->_tmp8_);
		data->_tmp10_ = data->_tmp9_;
		trf_affl_info_set_im_proto (data->affl_info, data->_tmp10_);
		_g_free0 (data->_tmp10_);
		data->_tmp11_ = NULL;
		data->_tmp11_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_IM_ACCOUNT_ID, NULL);
		data->_tmp12_ = NULL;
		data->_tmp12_ = g_strdup (data->_tmp11_);
		data->_tmp13_ = data->_tmp12_;
		trf_affl_info_set_im_account_id (data->affl_info, data->_tmp13_);
		_g_free0 (data->_tmp13_);
		data->_tmp14_ = NULL;
		data->_tmp14_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_IM_NICKNAME, NULL);
		data->_tmp15_ = NULL;
		data->_tmp15_ = g_strdup (data->_tmp14_);
		data->_tmp16_ = data->_tmp15_;
		trf_affl_info_set_im_nickname (data->affl_info, data->_tmp16_);
		_g_free0 (data->_tmp16_);
		data->_tmp17_ = NULL;
		data->_tmp17_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_TRACKER_ID, NULL);
		data->_tmp18_ = NULL;
		data->_tmp18_ = g_strdup (data->_tmp17_);
		data->_tmp19_ = data->_tmp18_;
		trf_affl_info_set_affl_tracker_id (data->affl_info, data->_tmp19_);
		_g_free0 (data->_tmp19_);
		data->_tmp20_ = NULL;
		data->_tmp20_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_ROLE, NULL);
		data->_tmp21_ = NULL;
		data->_tmp21_ = g_strdup (data->_tmp20_);
		data->_tmp22_ = data->_tmp21_;
		trf_affl_info_set_title (data->affl_info, data->_tmp22_);
		_g_free0 (data->_tmp22_);
		data->_tmp23_ = NULL;
		data->_tmp23_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_ORG, NULL);
		data->_tmp24_ = NULL;
		data->_tmp24_ = g_strdup (data->_tmp23_);
		data->_tmp25_ = data->_tmp24_;
		trf_affl_info_set_org (data->affl_info, data->_tmp25_);
		_g_free0 (data->_tmp25_);
		data->_tmp26_ = NULL;
		data->_tmp26_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_POBOX, NULL);
		data->_tmp27_ = NULL;
		data->_tmp27_ = g_strdup (data->_tmp26_);
		data->po_box = data->_tmp27_;
		data->_tmp28_ = NULL;
		data->_tmp28_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_EXTENDED_ADDRESS, NULL);
		data->_tmp29_ = NULL;
		data->_tmp29_ = g_strdup (data->_tmp28_);
		data->extension = data->_tmp29_;
		data->_tmp30_ = NULL;
		data->_tmp30_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_STREET_ADDRESS, NULL);
		data->_tmp31_ = NULL;
		data->_tmp31_ = g_strdup (data->_tmp30_);
		data->street = data->_tmp31_;
		data->_tmp32_ = NULL;
		data->_tmp32_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_LOCALITY, NULL);
		data->_tmp33_ = NULL;
		data->_tmp33_ = g_strdup (data->_tmp32_);
		data->locality = data->_tmp33_;
		data->_tmp34_ = NULL;
		data->_tmp34_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_REGION, NULL);
		data->_tmp35_ = NULL;
		data->_tmp35_ = g_strdup (data->_tmp34_);
		data->region = data->_tmp35_;
		data->_tmp36_ = NULL;
		data->_tmp36_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_POSTALCODE, NULL);
		data->_tmp37_ = NULL;
		data->_tmp37_ = g_strdup (data->_tmp36_);
		data->postal_code = data->_tmp37_;
		data->_tmp38_ = NULL;
		data->_tmp38_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_COUNTRY, NULL);
		data->_tmp39_ = NULL;
		data->_tmp39_ = g_strdup (data->_tmp38_);
		data->country = data->_tmp39_;
		data->_tmp40_ = NULL;
		data->_tmp40_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
		data->types = data->_tmp40_;
		data->_tmp41_ = NULL;
		data->_tmp41_ = trf_affl_info_get_affl_tracker_id (data->affl_info);
		data->_tmp42_ = NULL;
		data->_tmp42_ = folks_postal_address_new (data->po_box, data->extension, data->street, data->locality, data->region, data->postal_code, data->country, NULL, (GeeSet*) data->types, data->_tmp41_);
		_g_object_unref0 (data->affl_info->postal_address);
		data->affl_info->postal_address = data->_tmp42_;
		data->_tmp43_ = NULL;
		data->_tmp43_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_EMAIL, NULL);
		data->_tmp44_ = NULL;
		data->_tmp44_ = g_strdup (data->_tmp43_);
		data->_tmp45_ = data->_tmp44_;
		trf_affl_info_set_email (data->affl_info, data->_tmp45_);
		_g_free0 (data->_tmp45_);
		data->_tmp46_ = NULL;
		data->_tmp46_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_PHONE, NULL);
		data->_tmp47_ = NULL;
		data->_tmp47_ = g_strdup (data->_tmp46_);
		data->_tmp48_ = data->_tmp47_;
		trf_affl_info_set_phone (data->affl_info, data->_tmp48_);
		_g_free0 (data->_tmp48_);
		data->_tmp49_ = NULL;
		data->_tmp49_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_WEBSITE, NULL);
		data->_tmp50_ = NULL;
		data->_tmp50_ = g_strdup (data->_tmp49_);
		data->_tmp51_ = data->_tmp50_;
		trf_affl_info_set_website (data->affl_info, data->_tmp51_);
		_g_free0 (data->_tmp51_);
		data->_tmp52_ = NULL;
		data->_tmp52_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_BLOG, NULL);
		data->_tmp53_ = NULL;
		data->_tmp53_ = g_strdup (data->_tmp52_);
		data->_tmp54_ = data->_tmp53_;
		trf_affl_info_set_blog (data->affl_info, data->_tmp54_);
		_g_free0 (data->_tmp54_);
		data->_tmp55_ = NULL;
		data->_tmp55_ = tracker_sparql_cursor_get_string (data->cursor, (gint) TRF_AFFL_INFO_FIELDS_AFFL_URL, NULL);
		data->_tmp56_ = NULL;
		data->_tmp56_ = g_strdup (data->_tmp55_);
		data->_tmp57_ = data->_tmp56_;
		trf_affl_info_set_url (data->affl_info, data->_tmp57_);
		_g_free0 (data->_tmp57_);
		_g_object_unref0 (data->types);
		_g_free0 (data->country);
		_g_free0 (data->postal_code);
		_g_free0 (data->region);
		_g_free0 (data->locality);
		_g_free0 (data->street);
		_g_free0 (data->extension);
		_g_free0 (data->po_box);
	}
	_g_object_unref0 (data->cursor);
	goto __finally8;
	__catch8_tracker_sparql_error:
	{
		data->e1 = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:1723: Couldn't fetch affiliation info: %s %s", data->query, data->e1->message);
		_g_error_free0 (data->e1);
	}
	goto __finally8;
	__catch8_g_error:
	{
		data->e2 = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:1728: Couldn't fetch affiliation info: %s %s", data->query, data->e2->message);
		_g_error_free0 (data->e2);
	}
	__finally8:
	if (data->_inner_error_ != NULL) {
		_g_free0 (data->query);
		_g_object_unref0 (data->affl_info);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
		g_clear_error (&data->_inner_error_);
		return FALSE;
	}
	data->result = data->affl_info;
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->query);
	_g_object_unref0 (data->affl_info);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_insert_persona_data_free (gpointer _data) {
	TrfPersonaStoreInsertPersonaData* data;
	data = _data;
	_g_free0 (data->query);
	_g_free0 (data->persona_var);
	_g_free0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreInsertPersonaData, data);
}


static void _trf_persona_store_insert_persona (TrfPersonaStore* self, const gchar* query, const gchar* persona_var, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreInsertPersonaData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreInsertPersonaData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_insert_persona);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_insert_persona_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->query = g_strdup (query);
	_data_->persona_var = g_strdup (persona_var);
	_trf_persona_store_insert_persona_co (_data_);
}


static gchar* _trf_persona_store_insert_persona_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gchar* result;
	TrfPersonaStoreInsertPersonaData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_insert_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreInsertPersonaData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_insert_persona_co (data);
}


static gboolean _trf_persona_store_insert_persona_co (TrfPersonaStoreInsertPersonaData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->contact_urn = NULL;
	g_debug ("trf-persona-store.vala:1742: _insert_persona: %s", data->query);
	data->_state_ = 1;
	tracker_sparql_connection_update_blank_async (data->self->priv->_connection, data->query, G_PRIORITY_DEFAULT, NULL, _trf_persona_store_insert_persona_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = tracker_sparql_connection_update_blank_finish (data->self->priv->_connection, data->_res_, &data->_inner_error_);
	data->_tmp1_ = data->_tmp0_;
	if (data->_inner_error_ != NULL) {
		goto __catch9_g_error;
	}
	_g_variant_unref0 (data->variant);
	data->variant = data->_tmp1_;
	data->anon_var = NULL;
	data->_tmp2_ = NULL;
	data->_tmp2_ = g_variant_iter_new (data->variant);
	_g_variant_iter_free0 (data->iter1);
	data->iter1 = data->_tmp2_;
	while (TRUE) {
		data->_tmp3_ = g_variant_iter_next (data->iter1, "aa{ss}", &data->iter2, NULL);
		if (!data->_tmp3_) {
			break;
		}
		if (data->iter2 == NULL) {
			continue;
		}
		while (TRUE) {
			data->_tmp4_ = g_variant_iter_next (data->iter2, "a{ss}", &data->iter3, NULL);
			if (!data->_tmp4_) {
				break;
			}
			if (data->iter3 == NULL) {
				continue;
			}
			while (TRUE) {
				data->_tmp5_ = g_variant_iter_next (data->iter3, "{ss}", &data->anon_var, &data->contact_urn, NULL);
				if (!data->_tmp5_) {
					break;
				}
				if (g_strcmp0 (data->anon_var, data->persona_var) == 0) {
					data->result = data->contact_urn;
					_g_free0 (data->anon_var);
					_g_variant_iter_free0 (data->iter3);
					_g_variant_iter_free0 (data->iter2);
					_g_variant_iter_free0 (data->iter1);
					_g_variant_unref0 (data->variant);
					if (data->_state_ == 0) {
						g_simple_async_result_complete_in_idle (data->_async_result);
					} else {
						g_simple_async_result_complete (data->_async_result);
					}
					g_object_unref (data->_async_result);
					return FALSE;
				}
			}
		}
	}
	_g_free0 (data->anon_var);
	_g_variant_iter_free0 (data->iter3);
	_g_variant_iter_free0 (data->iter2);
	_g_variant_iter_free0 (data->iter1);
	goto __finally9;
	__catch9_g_error:
	{
		data->e = data->_inner_error_;
		data->_inner_error_ = NULL;
		_g_free0 (data->contact_urn);
		data->contact_urn = NULL;
		g_warning ("trf-persona-store.vala:1775: Couldn't insert nco:PersonContact: %s", data->e->message);
		_g_error_free0 (data->e);
	}
	__finally9:
	if (data->_inner_error_ != NULL) {
		_g_free0 (data->contact_urn);
		_g_variant_unref0 (data->variant);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
		g_clear_error (&data->_inner_error_);
		return FALSE;
	}
	data->result = NULL;
	_g_free0 (data->contact_urn);
	_g_variant_unref0 (data->variant);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->contact_urn);
	_g_variant_unref0 (data->variant);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_single_value_query_data_free (gpointer _data) {
	TrfPersonaStoreSingleValueQueryData* data;
	data = _data;
	_g_free0 (data->query);
	_g_free0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSingleValueQueryData, data);
}


static void _trf_persona_store_single_value_query (TrfPersonaStore* self, const gchar* query, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSingleValueQueryData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSingleValueQueryData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_single_value_query);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_single_value_query_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->query = g_strdup (query);
	_trf_persona_store_single_value_query_co (_data_);
}


static gchar* _trf_persona_store_single_value_query_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gchar* result;
	TrfPersonaStoreSingleValueQueryData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_single_value_query_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSingleValueQueryData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_single_value_query_co (data);
}


static gboolean _trf_persona_store_single_value_query_co (TrfPersonaStoreSingleValueQueryData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_multi_value_query (data->self, data->query, _trf_persona_store_single_value_query_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = _trf_persona_store_multi_value_query_finish (data->self, data->_res_);
	data->rows = data->_tmp0_;
	{
		data->_tmp1_ = NULL;
		data->_tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) data->rows);
		data->_r_it = data->_tmp1_;
		while (TRUE) {
			data->_tmp2_ = gee_iterator_next (data->_r_it);
			if (!data->_tmp2_) {
				break;
			}
			data->_tmp3_ = NULL;
			data->_tmp3_ = gee_iterator_get (data->_r_it);
			data->r = (gchar*) data->_tmp3_;
			data->result = data->r;
			_g_object_unref0 (data->_r_it);
			_g_object_unref0 (data->rows);
			if (data->_state_ == 0) {
				g_simple_async_result_complete_in_idle (data->_async_result);
			} else {
				g_simple_async_result_complete (data->_async_result);
			}
			g_object_unref (data->_async_result);
			return FALSE;
		}
		_g_object_unref0 (data->_r_it);
	}
	data->_tmp4_ = g_strdup ("");
	data->result = data->_tmp4_;
	_g_object_unref0 (data->rows);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_object_unref0 (data->rows);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_multi_value_query_data_free (gpointer _data) {
	TrfPersonaStoreMultiValueQueryData* data;
	data = _data;
	_g_free0 (data->query);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreMultiValueQueryData, data);
}


static void _trf_persona_store_multi_value_query (TrfPersonaStore* self, const gchar* query, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreMultiValueQueryData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreMultiValueQueryData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_multi_value_query);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_multi_value_query_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->query = g_strdup (query);
	_trf_persona_store_multi_value_query_co (_data_);
}


static GeeHashSet* _trf_persona_store_multi_value_query_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	GeeHashSet* result;
	TrfPersonaStoreMultiValueQueryData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_multi_value_query_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreMultiValueQueryData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_multi_value_query_co (data);
}


static gboolean _trf_persona_store_multi_value_query_co (TrfPersonaStoreMultiValueQueryData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
	data->ret = data->_tmp0_;
	g_debug ("trf-persona-store.vala:1795: [_multi_value_query] %s", data->query);
	data->_state_ = 1;
	tracker_sparql_connection_query_async (data->self->priv->_connection, data->query, NULL, _trf_persona_store_multi_value_query_ready, data);
	return FALSE;
	_state_1:
	data->_tmp1_ = NULL;
	data->_tmp1_ = tracker_sparql_connection_query_finish (data->self->priv->_connection, data->_res_, &data->_inner_error_);
	data->cursor = data->_tmp1_;
	if (data->_inner_error_ != NULL) {
		if (data->_inner_error_->domain == TRACKER_SPARQL_ERROR) {
			goto __catch10_tracker_sparql_error;
		}
		goto __catch10_g_error;
	}
	while (TRUE) {
		data->_tmp2_ = tracker_sparql_cursor_next (data->cursor, NULL, &data->_inner_error_);
		data->_tmp3_ = data->_tmp2_;
		if (data->_inner_error_ != NULL) {
			_g_object_unref0 (data->cursor);
			if (data->_inner_error_->domain == TRACKER_SPARQL_ERROR) {
				goto __catch10_tracker_sparql_error;
			}
			goto __catch10_g_error;
		}
		if (!data->_tmp3_) {
			break;
		}
		data->_tmp4_ = NULL;
		data->_tmp4_ = tracker_sparql_cursor_get_string (data->cursor, 0, NULL);
		data->_tmp5_ = g_strdup (data->_tmp4_);
		data->prop = data->_tmp5_;
		if (data->prop != NULL) {
			gee_abstract_collection_add ((GeeAbstractCollection*) data->ret, data->prop);
		}
		_g_free0 (data->prop);
	}
	_g_object_unref0 (data->cursor);
	goto __finally10;
	__catch10_tracker_sparql_error:
	{
		data->e1 = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:1809: Couldn't run query: %s %s", data->query, data->e1->message);
		_g_error_free0 (data->e1);
	}
	goto __finally10;
	__catch10_g_error:
	{
		data->e2 = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:1813: Couldn't run query: %s %s", data->query, data->e2->message);
		_g_error_free0 (data->e2);
	}
	__finally10:
	if (data->_inner_error_ != NULL) {
		_g_object_unref0 (data->ret);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
		g_clear_error (&data->_inner_error_);
		return FALSE;
	}
	data->result = data->ret;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_object_unref0 (data->ret);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_urn_from_tracker_id_data_free (gpointer _data) {
	TrfPersonaStoreUrnFromTrackerIdData* data;
	data = _data;
	_g_free0 (data->tracker_id);
	_g_free0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreUrnFromTrackerIdData, data);
}


static void _trf_persona_store_urn_from_tracker_id (TrfPersonaStore* self, const gchar* tracker_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreUrnFromTrackerIdData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreUrnFromTrackerIdData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_urn_from_tracker_id);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_urn_from_tracker_id_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->tracker_id = g_strdup (tracker_id);
	_trf_persona_store_urn_from_tracker_id_co (_data_);
}


static gchar* _trf_persona_store_urn_from_tracker_id_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gchar* result;
	TrfPersonaStoreUrnFromTrackerIdData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_urn_from_tracker_id_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreUrnFromTrackerIdData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_urn_from_tracker_id_co (data);
}


static gboolean _trf_persona_store_urn_from_tracker_id_co (TrfPersonaStoreUrnFromTrackerIdData* data) {
	static const char query[] = "SELECT fn:concat('<', tracker:uri(%s), '>') " "WHERE {}";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = g_strdup_printf (query, data->tracker_id);
	data->_tmp1_ = data->_tmp0_;
	data->_state_ = 1;
	_trf_persona_store_single_value_query (data->self, data->_tmp1_, _trf_persona_store_urn_from_tracker_id_ready, data);
	return FALSE;
	_state_1:
	data->_tmp2_ = NULL;
	data->_tmp2_ = _trf_persona_store_single_value_query_finish (data->self, data->_res_);
	data->_tmp3_ = data->_tmp2_;
	_g_free0 (data->_tmp1_);
	data->result = data->_tmp3_;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_alias_data_free (gpointer _data) {
	TrfPersonaStoreSetAliasData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_free0 (data->alias);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetAliasData, data);
}


void _trf_persona_store_set_alias (TrfPersonaStore* self, TrfPersona* persona, const gchar* alias, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetAliasData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetAliasData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_alias);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_alias_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->alias = g_strdup (alias);
	_trf_persona_store_set_alias_co (_data_);
}


void _trf_persona_store_set_alias_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetAliasData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_alias_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetAliasData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_alias_co (data);
}


static gboolean _trf_persona_store_set_alias_co (TrfPersonaStoreSetAliasData* data) {
	static const char query_t[] = "DELETE { " " ?p " TRF_ONTOLOGY_DEFS_NCO_NICKNAME " ?n  " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " ; " TRF_ONTOLOGY_DEFS_NCO_NICKNAME " ?n . " " FILTER(tracker:id(?p) = %s) " "} " "INSERT { " " ?p " TRF_ONTOLOGY_DEFS_NCO_NICKNAME " '%s' " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " . " "FILTER (tracker:id(?p) = %s) " "} ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (data->persona);
	data->_tmp1_ = data->_tmp0_;
	data->_tmp2_ = NULL;
	data->_tmp2_ = trf_persona_tracker_id (data->persona);
	data->_tmp3_ = data->_tmp2_;
	data->_tmp4_ = NULL;
	data->_tmp4_ = g_strdup_printf (query_t, data->_tmp1_, data->alias, data->_tmp3_);
	data->_tmp5_ = data->_tmp4_;
	_g_free0 (data->_tmp3_);
	_g_free0 (data->_tmp1_);
	data->query = data->_tmp5_;
	data->_state_ = 1;
	_trf_persona_store_tracker_update (data->self, data->query, "change_alias", _trf_persona_store_set_alias_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_local_ids_data_free (gpointer _data) {
	TrfPersonaStoreSetLocalIdsData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->local_ids);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetLocalIdsData, data);
}


void _trf_persona_store_set_local_ids (TrfPersonaStore* self, TrfPersona* persona, GeeSet* local_ids, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetLocalIdsData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetLocalIdsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_local_ids);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_local_ids_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->local_ids = _g_object_ref0 (local_ids);
	_trf_persona_store_set_local_ids_co (_data_);
}


void _trf_persona_store_set_local_ids_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetLocalIdsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_local_ids_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetLocalIdsData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_local_ids_co (data);
}


static gboolean _trf_persona_store_set_local_ids_co (TrfPersonaStoreSetLocalIdsData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_store_serialize_local_ids (data->local_ids);
	data->ids = data->_tmp0_;
	data->_state_ = 1;
	_trf_persona_store_set_tracker_property (data->self, data->persona, TRF_PERSONA_STORE__LOCAL_ID_PROPERTY_NAME, data->ids, "_set_local_ids", _trf_persona_store_set_local_ids_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_set_tracker_property_finish (data->self, data->_res_);
	_g_free0 (data->ids);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_web_service_addrs_data_free (gpointer _data) {
	TrfPersonaStoreSetWebServiceAddrsData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->ws_obj);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetWebServiceAddrsData, data);
}


void _trf_persona_store_set_web_service_addrs (TrfPersonaStore* self, TrfPersona* persona, GeeMultiMap* ws_obj, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetWebServiceAddrsData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetWebServiceAddrsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_web_service_addrs);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_web_service_addrs_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->ws_obj = _g_object_ref0 (ws_obj);
	_trf_persona_store_set_web_service_addrs_co (_data_);
}


void _trf_persona_store_set_web_service_addrs_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetWebServiceAddrsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_web_service_addrs_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetWebServiceAddrsData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_web_service_addrs_co (data);
}


static gboolean _trf_persona_store_set_web_service_addrs_co (TrfPersonaStoreSetWebServiceAddrsData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_store_serialize_web_services (data->ws_obj);
	data->ws_addrs = data->_tmp0_;
	data->_state_ = 1;
	_trf_persona_store_set_tracker_property (data->self, data->persona, TRF_PERSONA_STORE__WSD_PROPERTY_NAME, data->ws_addrs, "_set_web_service_addrs", _trf_persona_store_set_web_service_addrs_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_set_tracker_property_finish (data->self, data->_res_);
	_g_free0 (data->ws_addrs);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_tracker_property_data_free (gpointer _data) {
	TrfPersonaStoreSetTrackerPropertyData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_free0 (data->prop_name);
	_g_free0 (data->prop_value);
	_g_free0 (data->callers_name);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetTrackerPropertyData, data);
}


static void _trf_persona_store_set_tracker_property (TrfPersonaStore* self, TrfPersona* persona, const gchar* prop_name, const gchar* prop_value, const gchar* callers_name, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetTrackerPropertyData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetTrackerPropertyData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_tracker_property);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_tracker_property_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->prop_name = g_strdup (prop_name);
	_data_->prop_value = g_strdup (prop_value);
	_data_->callers_name = g_strdup (callers_name);
	_trf_persona_store_set_tracker_property_co (_data_);
}


static void _trf_persona_store_set_tracker_property_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetTrackerPropertyData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_tracker_property_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetTrackerPropertyData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_tracker_property_co (data);
}


static gboolean _trf_persona_store_set_tracker_property_co (TrfPersonaStoreSetTrackerPropertyData* data) {
	static const char query_t[] = "DELETE " " { ?p " TRF_ONTOLOGY_DEFS_NAO_HAS_PROPERTY " ?prop } " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " ; " TRF_ONTOLOGY_DEFS_NAO_HAS_PROPERTY " ?prop . " " ?prop " TRF_ONTOLOGY_DEFS_NAO_PROPERTY_NAME " ?prop_name . " " FILTER (tracker:id(?p) = %s && ?name = '%s' ) } " "INSERT { " " _:prop a " TRF_ONTOLOGY_DEFS_NAO_PROPERTY " ; " TRF_ONTOLOGY_DEFS_NAO_PROPERTY_NAME " '%s' ; " TRF_ONTOLOGY_DEFS_NAO_PROPERTY_VALUE " '%s' . " " ?p " TRF_ONTOLOGY_DEFS_NAO_HAS_PROPERTY " _:prop " "} " "WHERE { " " ?p a nco:PersonContact . " "FILTER (tracker:id(?p) = %s) } ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (data->persona);
	data->_tmp1_ = data->_tmp0_;
	data->_tmp2_ = NULL;
	data->_tmp2_ = trf_persona_tracker_id (data->persona);
	data->_tmp3_ = data->_tmp2_;
	data->_tmp4_ = NULL;
	data->_tmp4_ = g_strdup_printf (query_t, data->_tmp1_, data->prop_name, data->prop_name, data->prop_value, data->_tmp3_);
	data->_tmp5_ = data->_tmp4_;
	_g_free0 (data->_tmp3_);
	_g_free0 (data->_tmp1_);
	data->query = data->_tmp5_;
	data->_state_ = 1;
	_trf_persona_store_tracker_update (data->self, data->query, data->callers_name, _trf_persona_store_set_tracker_property_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_is_favourite_data_free (gpointer _data) {
	TrfPersonaStoreSetIsFavouriteData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetIsFavouriteData, data);
}


void _trf_persona_store_set_is_favourite (TrfPersonaStore* self, FolksPersona* persona, gboolean is_favourite, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetIsFavouriteData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetIsFavouriteData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_is_favourite);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_is_favourite_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->is_favourite = is_favourite;
	_trf_persona_store_set_is_favourite_co (_data_);
}


void _trf_persona_store_set_is_favourite_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetIsFavouriteData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_is_favourite_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetIsFavouriteData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_is_favourite_co (data);
}


static gboolean _trf_persona_store_set_is_favourite_co (TrfPersonaStoreSetIsFavouriteData* data) {
	static const char ins_q[] = "INSERT { " " ?p " TRF_ONTOLOGY_DEFS_NAO_TAG " " TRF_ONTOLOGY_DEFS_NAO_FAVORITE "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " FILTER (tracker:id(?p) = %s) " "} ";
	static const char del_q[] = "DELETE { " " ?p " TRF_ONTOLOGY_DEFS_NAO_TAG " " TRF_ONTOLOGY_DEFS_NAO_FAVORITE " " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " FILTER (tracker:id(?p) = %s) " "} ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (data->is_favourite) {
		data->_tmp0_ = NULL;
		data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
		data->_tmp1_ = data->_tmp0_;
		data->_tmp2_ = NULL;
		data->_tmp2_ = g_strdup_printf (ins_q, data->_tmp1_);
		_g_free0 (data->query);
		data->query = data->_tmp2_;
		_g_free0 (data->_tmp1_);
	} else {
		data->_tmp3_ = NULL;
		data->_tmp3_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
		data->_tmp4_ = data->_tmp3_;
		data->_tmp5_ = NULL;
		data->_tmp5_ = g_strdup_printf (del_q, data->_tmp4_);
		_g_free0 (data->query);
		data->query = data->_tmp5_;
		_g_free0 (data->_tmp4_);
	}
	data->_state_ = 1;
	_trf_persona_store_tracker_update (data->self, data->query, "change_is_favourite", _trf_persona_store_set_is_favourite_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_emails_data_free (gpointer _data) {
	TrfPersonaStoreSetEmailsData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->emails);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetEmailsData, data);
}


void _trf_persona_store_set_emails (TrfPersonaStore* self, FolksPersona* persona, GeeSet* emails, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetEmailsData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetEmailsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_emails);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_emails_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->emails = _g_object_ref0 (emails);
	_trf_persona_store_set_emails_co (_data_);
}


void _trf_persona_store_set_emails_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetEmailsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_emails_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetEmailsData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_emails_co (data);
}


static gboolean _trf_persona_store_set_emails_co (TrfPersonaStoreSetEmailsData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_set_unique_attrib_set (data->self, data->persona, data->emails, TRF_ATTRIB_EMAILS, _trf_persona_store_set_emails_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_set_unique_attrib_set_finish (data->self, data->_res_);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_phones_data_free (gpointer _data) {
	TrfPersonaStoreSetPhonesData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->phone_numbers);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetPhonesData, data);
}


void _trf_persona_store_set_phones (TrfPersonaStore* self, FolksPersona* persona, GeeSet* phone_numbers, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetPhonesData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetPhonesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_phones);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_phones_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->phone_numbers = _g_object_ref0 (phone_numbers);
	_trf_persona_store_set_phones_co (_data_);
}


void _trf_persona_store_set_phones_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetPhonesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_phones_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetPhonesData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_phones_co (data);
}


static gboolean _trf_persona_store_set_phones_co (TrfPersonaStoreSetPhonesData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_set_unique_attrib_set (data->self, data->persona, data->phone_numbers, TRF_ATTRIB_PHONES, _trf_persona_store_set_phones_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_set_unique_attrib_set_finish (data->self, data->_res_);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_unique_attrib_set_data_free (gpointer _data) {
	TrfPersonaStoreSetUniqueAttribSetData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->properties);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetUniqueAttribSetData, data);
}


void _trf_persona_store_set_unique_attrib_set (TrfPersonaStore* self, FolksPersona* persona, GeeSet* properties, TrfAttrib attrib, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetUniqueAttribSetData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetUniqueAttribSetData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_unique_attrib_set);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_unique_attrib_set_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->properties = _g_object_ref0 (properties);
	_data_->attrib = attrib;
	_trf_persona_store_set_unique_attrib_set_co (_data_);
}


void _trf_persona_store_set_unique_attrib_set_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetUniqueAttribSetData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_unique_attrib_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetUniqueAttribSetData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_unique_attrib_set_co (data);
}


static gboolean _trf_persona_store_set_unique_attrib_set_co (TrfPersonaStoreSetUniqueAttribSetData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->query_name = NULL;
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->p_id = data->_tmp0_;
	data->_tmp1_ = NULL;
	data->_tmp1_ = tracker_sparql_builder_new_update ();
	data->builder = data->_tmp1_;
	tracker_sparql_builder_insert_open (data->builder, NULL);
	switch (data->attrib) {
		case TRF_ATTRIB_PHONES:
		{
			data->_tmp2_ = g_strdup ("_set_phones");
			_g_free0 (data->query_name);
			data->query_name = data->_tmp2_;
			data->_state_ = 1;
			_trf_persona_store_remove_attributes_from_persona (data->self, data->persona, _REMOVE_PHONES, _trf_persona_store_set_unique_attrib_set_ready, data);
			return FALSE;
			_state_1:
			data->_tmp3_ = NULL;
			data->_tmp3_ = _trf_persona_store_remove_attributes_from_persona_finish (data->self, data->_res_);
			data->_tmp4_ = data->_tmp3_;
			_g_free0 (data->_tmp4_);
			data->_state_ = 2;
			_trf_persona_store_build_update_query_set (data->self, data->builder, data->properties, "?contact", TRF_ATTRIB_PHONES, _trf_persona_store_set_unique_attrib_set_ready, data);
			return FALSE;
			_state_2:
			_trf_persona_store_build_update_query_set_finish (data->self, data->_res_);
			break;
		}
		case TRF_ATTRIB_EMAILS:
		{
			data->_tmp5_ = g_strdup ("_set_emailss");
			_g_free0 (data->query_name);
			data->query_name = data->_tmp5_;
			data->_state_ = 3;
			_trf_persona_store_remove_attributes_from_persona (data->self, data->persona, _REMOVE_EMAILS, _trf_persona_store_set_unique_attrib_set_ready, data);
			return FALSE;
			_state_3:
			data->_tmp6_ = NULL;
			data->_tmp6_ = _trf_persona_store_remove_attributes_from_persona_finish (data->self, data->_res_);
			data->_tmp7_ = data->_tmp6_;
			_g_free0 (data->_tmp7_);
			data->_state_ = 4;
			_trf_persona_store_build_update_query_set (data->self, data->builder, data->properties, "?contact", TRF_ATTRIB_EMAILS, _trf_persona_store_set_unique_attrib_set_ready, data);
			return FALSE;
			_state_4:
			_trf_persona_store_build_update_query_set_finish (data->self, data->_res_);
			break;
		}
		default:
		break;
	}
	tracker_sparql_builder_insert_close (data->builder);
	tracker_sparql_builder_where_open (data->builder);
	tracker_sparql_builder_subject (data->builder, "?contact");
	tracker_sparql_builder_predicate (data->builder, "a");
	tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_PERSON);
	data->_tmp8_ = NULL;
	data->_tmp8_ = g_strdup_printf (" FILTER(tracker:id(?contact) = %s) ", data->p_id);
	data->filter = data->_tmp8_;
	tracker_sparql_builder_append (data->builder, data->filter);
	tracker_sparql_builder_where_close (data->builder);
	data->_tmp9_ = NULL;
	data->_tmp9_ = tracker_sparql_builder_get_result (data->builder);
	data->_state_ = 5;
	_trf_persona_store_tracker_update (data->self, data->_tmp9_, data->query_name, _trf_persona_store_set_unique_attrib_set_ready, data);
	return FALSE;
	_state_5:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->filter);
	_g_object_unref0 (data->builder);
	_g_free0 (data->p_id);
	_g_free0 (data->query_name);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_urls_data_free (gpointer _data) {
	TrfPersonaStoreSetUrlsData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->urls);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetUrlsData, data);
}


void _trf_persona_store_set_urls (TrfPersonaStore* self, FolksPersona* persona, GeeSet* urls, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetUrlsData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetUrlsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_urls);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_urls_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->urls = _g_object_ref0 (urls);
	_trf_persona_store_set_urls_co (_data_);
}


void _trf_persona_store_set_urls_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetUrlsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_urls_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetUrlsData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_urls_co (data);
}


static gboolean _trf_persona_store_set_urls_co (TrfPersonaStoreSetUrlsData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_set_attrib_set (data->self, data->persona, data->urls, TRF_ATTRIB_URLS, _trf_persona_store_set_urls_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_set_attrib_set_finish (data->self, data->_res_);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_im_addresses_data_free (gpointer _data) {
	TrfPersonaStoreSetImAddressesData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->im_addresses);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetImAddressesData, data);
}


void _trf_persona_store_set_im_addresses (TrfPersonaStore* self, FolksPersona* persona, GeeMultiMap* im_addresses, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetImAddressesData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetImAddressesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_im_addresses);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_im_addresses_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->im_addresses = _g_object_ref0 (im_addresses);
	_trf_persona_store_set_im_addresses_co (_data_);
}


void _trf_persona_store_set_im_addresses_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetImAddressesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_im_addresses_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetImAddressesData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_im_addresses_co (data);
}


static gboolean _trf_persona_store_set_im_addresses_co (TrfPersonaStoreSetImAddressesData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = gee_hash_set_new (FOLKS_TYPE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL);
	data->ims = data->_tmp0_;
	{
		data->_tmp1_ = NULL;
		data->_tmp1_ = gee_multi_map_get_keys (data->im_addresses);
		data->_tmp2_ = data->_tmp1_;
		data->_tmp3_ = NULL;
		data->_tmp3_ = gee_iterable_iterator ((GeeIterable*) data->_tmp2_);
		data->_tmp4_ = data->_tmp3_;
		_g_object_unref0 (data->_tmp2_);
		data->_proto_it = data->_tmp4_;
		while (TRUE) {
			data->_tmp5_ = gee_iterator_next (data->_proto_it);
			if (!data->_tmp5_) {
				break;
			}
			data->_tmp6_ = NULL;
			data->_tmp6_ = gee_iterator_get (data->_proto_it);
			data->proto = (gchar*) data->_tmp6_;
			data->_tmp7_ = NULL;
			data->_tmp7_ = gee_multi_map_get (data->im_addresses, data->proto);
			data->addrs = data->_tmp7_;
			{
				data->_tmp8_ = NULL;
				data->_tmp8_ = gee_iterable_iterator ((GeeIterable*) data->addrs);
				data->_a_it = data->_tmp8_;
				while (TRUE) {
					data->_tmp9_ = gee_iterator_next (data->_a_it);
					if (!data->_tmp9_) {
						break;
					}
					data->_tmp10_ = NULL;
					data->_tmp10_ = gee_iterator_get (data->_a_it);
					data->a = (gchar*) data->_tmp10_;
					data->_tmp11_ = NULL;
					data->_tmp11_ = folks_field_details_new (data->a);
					data->fd = data->_tmp11_;
					folks_field_details_set_parameter (data->fd, "proto", data->proto);
					gee_abstract_collection_add ((GeeAbstractCollection*) data->ims, data->fd);
					_g_object_unref0 (data->fd);
					_g_free0 (data->a);
				}
				_g_object_unref0 (data->_a_it);
			}
			_g_object_unref0 (data->addrs);
			_g_free0 (data->proto);
		}
		_g_object_unref0 (data->_proto_it);
	}
	data->_state_ = 1;
	_trf_persona_store_set_attrib_set (data->self, data->persona, (GeeSet*) data->ims, TRF_ATTRIB_IM_ADDRESSES, _trf_persona_store_set_im_addresses_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_set_attrib_set_finish (data->self, data->_res_);
	_g_object_unref0 (data->ims);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_postal_addresses_data_free (gpointer _data) {
	TrfPersonaStoreSetPostalAddressesData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->postal_addresses);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetPostalAddressesData, data);
}


void _trf_persona_store_set_postal_addresses (TrfPersonaStore* self, FolksPersona* persona, GeeSet* postal_addresses, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetPostalAddressesData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetPostalAddressesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_postal_addresses);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_postal_addresses_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->postal_addresses = _g_object_ref0 (postal_addresses);
	_trf_persona_store_set_postal_addresses_co (_data_);
}


void _trf_persona_store_set_postal_addresses_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetPostalAddressesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_postal_addresses_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetPostalAddressesData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_postal_addresses_co (data);
}


static gboolean _trf_persona_store_set_postal_addresses_co (TrfPersonaStoreSetPostalAddressesData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_set_attrib_set (data->self, data->persona, data->postal_addresses, TRF_ATTRIB_POSTAL_ADDRESSES, _trf_persona_store_set_postal_addresses_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_set_attrib_set_finish (data->self, data->_res_);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_roles_data_free (gpointer _data) {
	TrfPersonaStoreSetRolesData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->roles);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetRolesData, data);
}


void _trf_persona_store_set_roles (TrfPersonaStore* self, FolksPersona* persona, GeeSet* roles, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetRolesData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetRolesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_roles);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_roles_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->roles = _g_object_ref0 (roles);
	_trf_persona_store_set_roles_co (_data_);
}


void _trf_persona_store_set_roles_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetRolesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_roles_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetRolesData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_roles_co (data);
}


static gboolean _trf_persona_store_set_roles_co (TrfPersonaStoreSetRolesData* data) {
	static const char del_t[] = "DELETE { " " ?p " TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION " ?a " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON "; " " " TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION " ?a . " " OPTIONAL { ?a " TRF_ONTOLOGY_DEFS_NCO_ORG " ?o } . " " OPTIONAL { ?a " TRF_ONTOLOGY_DEFS_NCO_ROLE " ?r } . " " FILTER(tracker:id(?p) = %s) " "} ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->p_id = data->_tmp0_;
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_strdup_printf (del_t, data->p_id);
	data->del_q = data->_tmp1_;
	data->_tmp2_ = NULL;
	data->_tmp2_ = tracker_sparql_builder_new_update ();
	data->builder = data->_tmp2_;
	tracker_sparql_builder_insert_open (data->builder, NULL);
	data->i = 0;
	{
		data->_tmp3_ = NULL;
		data->_tmp3_ = gee_iterable_iterator ((GeeIterable*) data->roles);
		data->_r_it = data->_tmp3_;
		while (TRUE) {
			data->_tmp4_ = gee_iterator_next (data->_r_it);
			if (!data->_tmp4_) {
				break;
			}
			data->_tmp5_ = NULL;
			data->_tmp5_ = gee_iterator_get (data->_r_it);
			data->r = (FolksRole*) data->_tmp5_;
			data->_tmp6_ = NULL;
			data->_tmp6_ = g_strdup_printf ("_:a%d", data->i);
			data->affl = data->_tmp6_;
			tracker_sparql_builder_subject (data->builder, data->affl);
			tracker_sparql_builder_predicate (data->builder, "a");
			tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION);
			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_ROLE);
			data->_tmp7_ = NULL;
			data->_tmp7_ = folks_role_get_title (data->r);
			tracker_sparql_builder_object_string (data->builder, data->_tmp7_);
			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_ORG);
			data->_tmp8_ = NULL;
			data->_tmp8_ = folks_role_get_organisation_name (data->r);
			tracker_sparql_builder_object_string (data->builder, data->_tmp8_);
			tracker_sparql_builder_subject (data->builder, "?contact");
			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION);
			tracker_sparql_builder_object (data->builder, data->affl);
			_g_free0 (data->affl);
			_g_object_unref0 (data->r);
		}
		_g_object_unref0 (data->_r_it);
	}
	tracker_sparql_builder_insert_close (data->builder);
	tracker_sparql_builder_where_open (data->builder);
	tracker_sparql_builder_subject (data->builder, "?contact");
	tracker_sparql_builder_predicate (data->builder, "a");
	tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_PERSON);
	data->_tmp9_ = NULL;
	data->_tmp9_ = g_strdup_printf (" FILTER(tracker:id(?contact) = %s) ", data->p_id);
	data->filter = data->_tmp9_;
	tracker_sparql_builder_append (data->builder, data->filter);
	tracker_sparql_builder_where_close (data->builder);
	data->_tmp10_ = NULL;
	data->_tmp10_ = tracker_sparql_builder_get_result (data->builder);
	data->_tmp11_ = g_strconcat (data->del_q, data->_tmp10_, NULL);
	data->_tmp12_ = data->_tmp11_;
	data->_state_ = 1;
	_trf_persona_store_tracker_update (data->self, data->_tmp12_, "_set_roles", _trf_persona_store_set_roles_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->_tmp12_);
	_g_free0 (data->filter);
	_g_object_unref0 (data->builder);
	_g_free0 (data->del_q);
	_g_free0 (data->p_id);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_notes_data_free (gpointer _data) {
	TrfPersonaStoreSetNotesData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->notes);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetNotesData, data);
}


void _trf_persona_store_set_notes (TrfPersonaStore* self, FolksPersona* persona, GeeSet* notes, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetNotesData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetNotesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_notes);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_notes_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->notes = _g_object_ref0 (notes);
	_trf_persona_store_set_notes_co (_data_);
}


void _trf_persona_store_set_notes_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetNotesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_notes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetNotesData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_notes_co (data);
}


static gboolean _trf_persona_store_set_notes_co (TrfPersonaStoreSetNotesData* data) {
	static const char del_t[] = "DELETE { " "?p " TRF_ONTOLOGY_DEFS_NCO_NOTE " ?n " "} " "WHERE {" " ?p a nco:PersonContact ; " TRF_ONTOLOGY_DEFS_NCO_NOTE " ?n . " " FILTER(tracker:id(?p) = %s)" "}";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->p_id = data->_tmp0_;
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_strdup_printf (del_t, data->p_id);
	data->del_q = data->_tmp1_;
	data->_tmp2_ = NULL;
	data->_tmp2_ = tracker_sparql_builder_new_update ();
	data->builder = data->_tmp2_;
	tracker_sparql_builder_insert_open (data->builder, NULL);
	{
		data->_tmp3_ = NULL;
		data->_tmp3_ = gee_iterable_iterator ((GeeIterable*) data->notes);
		data->_n_it = data->_tmp3_;
		while (TRUE) {
			data->_tmp4_ = gee_iterator_next (data->_n_it);
			if (!data->_tmp4_) {
				break;
			}
			data->_tmp5_ = NULL;
			data->_tmp5_ = gee_iterator_get (data->_n_it);
			data->n = (FolksNote*) data->_tmp5_;
			tracker_sparql_builder_subject (data->builder, "?contact");
			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_NOTE);
			data->_tmp6_ = NULL;
			data->_tmp6_ = folks_note_get_content (data->n);
			tracker_sparql_builder_object_string (data->builder, data->_tmp6_);
			_g_object_unref0 (data->n);
		}
		_g_object_unref0 (data->_n_it);
	}
	tracker_sparql_builder_insert_close (data->builder);
	tracker_sparql_builder_where_open (data->builder);
	tracker_sparql_builder_subject (data->builder, "?contact");
	tracker_sparql_builder_predicate (data->builder, "a");
	tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_PERSON);
	data->_tmp7_ = NULL;
	data->_tmp7_ = g_strdup_printf (" FILTER(tracker:id(?contact) = %s) ", data->p_id);
	data->filter = data->_tmp7_;
	tracker_sparql_builder_append (data->builder, data->filter);
	tracker_sparql_builder_where_close (data->builder);
	data->_tmp8_ = NULL;
	data->_tmp8_ = tracker_sparql_builder_get_result (data->builder);
	data->_tmp9_ = g_strconcat (data->del_q, data->_tmp8_, NULL);
	data->_tmp10_ = data->_tmp9_;
	data->_state_ = 1;
	_trf_persona_store_tracker_update (data->self, data->_tmp10_, "_set_notes", _trf_persona_store_set_notes_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->_tmp10_);
	_g_free0 (data->filter);
	_g_object_unref0 (data->builder);
	_g_free0 (data->del_q);
	_g_free0 (data->p_id);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_birthday_data_free (gpointer _data) {
	TrfPersonaStoreSetBirthdayData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_date_time_unref0 (data->bday);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetBirthdayData, data);
}


void _trf_persona_store_set_birthday (TrfPersonaStore* self, FolksPersona* persona, GDateTime* bday, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetBirthdayData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetBirthdayData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_birthday);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_birthday_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->bday = bday;
	_trf_persona_store_set_birthday_co (_data_);
}


void _trf_persona_store_set_birthday_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetBirthdayData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_birthday_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetBirthdayData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_birthday_co (data);
}


static gboolean _trf_persona_store_set_birthday_co (TrfPersonaStoreSetBirthdayData* data) {
	static const char q_t[] = "DELETE { " " ?p " TRF_ONTOLOGY_DEFS_NCO_BIRTHDAY " ?b " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON "; " TRF_ONTOLOGY_DEFS_NCO_BIRTHDAY " ?b . " " FILTER (tracker:id(?p) = %s ) " "} " "INSERT { " " ?p " TRF_ONTOLOGY_DEFS_NCO_BIRTHDAY " '%s' " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " . " " FILTER (tracker:id(?p) = %s) " "} ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->p_id = data->_tmp0_;
	memset (&data->_tmp1_, 0, sizeof (GTimeVal));
	g_date_time_to_timeval (data->bday, &data->_tmp1_);
	data->tv = data->_tmp1_;
	data->_tmp2_ = NULL;
	data->_tmp2_ = g_time_val_to_iso8601 (&data->tv);
	data->_tmp3_ = data->_tmp2_;
	data->_tmp4_ = NULL;
	data->_tmp4_ = g_strdup_printf (q_t, data->p_id, data->_tmp3_, data->p_id);
	data->_tmp5_ = data->_tmp4_;
	_g_free0 (data->_tmp3_);
	data->query = data->_tmp5_;
	data->_state_ = 1;
	_trf_persona_store_tracker_update (data->self, data->query, "_set_birthday", _trf_persona_store_set_birthday_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->query);
	_g_free0 (data->p_id);
	_g_date_time_unref0 (data->bday);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_gender_data_free (gpointer _data) {
	TrfPersonaStoreSetGenderData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetGenderData, data);
}


void _trf_persona_store_set_gender (TrfPersonaStore* self, FolksPersona* persona, FolksGender gender, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetGenderData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetGenderData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_gender);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_gender_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->gender = gender;
	_trf_persona_store_set_gender_co (_data_);
}


void _trf_persona_store_set_gender_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetGenderData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_gender_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetGenderData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_gender_co (data);
}


static gboolean _trf_persona_store_set_gender_co (TrfPersonaStoreSetGenderData* data) {
	static const char del_t[] = "DELETE { " " ?p " TRF_ONTOLOGY_DEFS_NCO_GENDER " ?g " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " ; " TRF_ONTOLOGY_DEFS_NCO_GENDER " ?g . " " FILTER (tracker:id(?p) = %s) " "} ";
	static const char ins_t[] = "INSERT { " " ?p " TRF_ONTOLOGY_DEFS_NCO_GENDER " %s " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " . " " FILTER (tracker:id(?p) = %s) " "} ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->p_id = data->_tmp0_;
	if (data->gender == FOLKS_GENDER_UNSPECIFIED) {
		data->_tmp1_ = NULL;
		data->_tmp1_ = g_strdup_printf (del_t, data->p_id);
		_g_free0 (data->query);
		data->query = data->_tmp1_;
	} else {
		if (data->gender == FOLKS_GENDER_MALE) {
			data->_tmp2_ = g_strdup (TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#gender-male>");
			_g_free0 (data->gender_urn);
			data->gender_urn = data->_tmp2_;
		} else {
			data->_tmp3_ = g_strdup (TRF_ONTOLOGY_DEFS_NCO_URL_PREFIX "nco#gender-female>");
			_g_free0 (data->gender_urn);
			data->gender_urn = data->_tmp3_;
		}
		data->_tmp4_ = NULL;
		data->_tmp4_ = g_strdup_printf (del_t, data->p_id);
		data->_tmp5_ = data->_tmp4_;
		data->_tmp6_ = NULL;
		data->_tmp6_ = g_strdup_printf (ins_t, data->gender_urn, data->p_id);
		data->_tmp7_ = data->_tmp6_;
		data->_tmp8_ = g_strconcat (data->_tmp5_, data->_tmp7_, NULL);
		_g_free0 (data->query);
		data->query = data->_tmp8_;
		_g_free0 (data->_tmp7_);
		_g_free0 (data->_tmp5_);
		_g_free0 (data->gender_urn);
	}
	data->_state_ = 1;
	_trf_persona_store_tracker_update (data->self, data->query, "_set_gender", _trf_persona_store_set_gender_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->query);
	_g_free0 (data->p_id);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_avatar_data_free (gpointer _data) {
	TrfPersonaStoreSetAvatarData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->avatar);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetAvatarData, data);
}


void _trf_persona_store_set_avatar (TrfPersonaStore* self, FolksPersona* persona, GFile* avatar, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetAvatarData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetAvatarData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_avatar);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_avatar_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->avatar = _g_object_ref0 (avatar);
	_trf_persona_store_set_avatar_co (_data_);
}


void _trf_persona_store_set_avatar_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetAvatarData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_avatar_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetAvatarData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_avatar_co (data);
}


static gboolean _trf_persona_store_set_avatar_co (TrfPersonaStoreSetAvatarData* data) {
	static const char query_d[] = "DELETE {" " ?c " TRF_ONTOLOGY_DEFS_NCO_PHOTO " ?p " " } " "WHERE { " " ?c a " TRF_ONTOLOGY_DEFS_NCO_PERSON " ; " TRF_ONTOLOGY_DEFS_NCO_PHOTO " ?p . " " FILTER(tracker:id(?c) = %s) " "} ";
	static const char query_i[] = "INSERT { " " _:i a " TRF_ONTOLOGY_DEFS_NFO_IMAGE ", " TRF_ONTOLOGY_DEFS_NIE_DATAOBJECT " ; " TRF_ONTOLOGY_DEFS_NIE_URL " '%s' . " " ?c " TRF_ONTOLOGY_DEFS_NCO_PHOTO " _:i " "} " "WHERE { " " ?c a nco:PersonContact . " " FILTER(tracker:id(?c) = %s) " "}";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->p_id = data->_tmp0_;
	data->_tmp1_ = atoi (data->p_id);
	data->_state_ = 1;
	_trf_persona_store_get_property (data->self, data->_tmp1_, TRF_ONTOLOGY_DEFS_NCO_PHOTO, TRF_ONTOLOGY_DEFS_NCO_PERSON, _trf_persona_store_set_avatar_ready, data);
	return FALSE;
	_state_1:
	data->_tmp2_ = NULL;
	data->_tmp2_ = _trf_persona_store_get_property_finish (data->self, data->_res_);
	data->image_urn = data->_tmp2_;
	if (g_strcmp0 (data->image_urn, "") != 0) {
		data->_tmp3_ = NULL;
		data->_tmp3_ = g_strdup_printf ("<%s>", data->image_urn);
		data->_tmp4_ = data->_tmp3_;
		_trf_persona_store_delete_resource (data->self, data->_tmp4_, TRUE, NULL, NULL);
		_g_free0 (data->_tmp4_);
	}
	data->_tmp5_ = NULL;
	data->_tmp5_ = g_strdup_printf (query_d, data->p_id);
	data->query = data->_tmp5_;
	if (data->avatar != NULL) {
		data->_tmp6_ = NULL;
		data->_tmp6_ = g_file_get_uri (data->avatar);
		data->_tmp7_ = data->_tmp6_;
		data->_tmp8_ = NULL;
		data->_tmp8_ = g_strdup_printf (query_i, data->_tmp7_, data->p_id);
		data->_tmp9_ = data->_tmp8_;
		data->_tmp10_ = g_strconcat (data->query, data->_tmp9_, NULL);
		_g_free0 (data->query);
		data->query = data->_tmp10_;
		_g_free0 (data->_tmp9_);
		_g_free0 (data->_tmp7_);
	}
	data->_state_ = 2;
	_trf_persona_store_tracker_update (data->self, data->query, "_set_avatar", _trf_persona_store_set_avatar_ready, data);
	return FALSE;
	_state_2:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->query);
	_g_free0 (data->image_urn);
	_g_free0 (data->p_id);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_structured_name_data_free (gpointer _data) {
	TrfPersonaStoreSetStructuredNameData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->sname);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetStructuredNameData, data);
}


void _trf_persona_store_set_structured_name (TrfPersonaStore* self, FolksPersona* persona, FolksStructuredName* sname, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetStructuredNameData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetStructuredNameData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_structured_name);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_structured_name_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->sname = _g_object_ref0 (sname);
	_trf_persona_store_set_structured_name_co (_data_);
}


void _trf_persona_store_set_structured_name_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetStructuredNameData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_structured_name_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetStructuredNameData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_structured_name_co (data);
}


static gboolean _trf_persona_store_set_structured_name_co (TrfPersonaStoreSetStructuredNameData* data) {
	static const char query_t[] = "DELETE { " " ?p " TRF_ONTOLOGY_DEFS_NCO_FAMILY " ?family . " " ?p " TRF_ONTOLOGY_DEFS_NCO_GIVEN " ?given . " " ?p " TRF_ONTOLOGY_DEFS_NCO_ADDITIONAL " ?adi . " " ?p " TRF_ONTOLOGY_DEFS_NCO_PREFIX " ?prefix . " " ?p " TRF_ONTOLOGY_DEFS_NCO_SUFFIX " ?suffix " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " .  " " OPTIONAL { ?p " TRF_ONTOLOGY_DEFS_NCO_FAMILY " ?family } . " " OPTIONAL { ?p " TRF_ONTOLOGY_DEFS_NCO_GIVEN " ?given } . " " OPTIONAL { ?p " TRF_ONTOLOGY_DEFS_NCO_ADDITIONAL " ?adi } . " " OPTIONAL { ?p " TRF_ONTOLOGY_DEFS_NCO_PREFIX " ?prefix } . " " OPTIONAL { ?p " TRF_ONTOLOGY_DEFS_NCO_SUFFIX " ?suffix } . " " FILTER (tracker:id(?p) = %s) " "} " "INSERT { " " ?p " TRF_ONTOLOGY_DEFS_NCO_FAMILY " '%s'; " " " TRF_ONTOLOGY_DEFS_NCO_GIVEN " '%s'; " " " TRF_ONTOLOGY_DEFS_NCO_ADDITIONAL " '%s'; " " " TRF_ONTOLOGY_DEFS_NCO_PREFIX " '%s'; " " " TRF_ONTOLOGY_DEFS_NCO_SUFFIX " '%s' " " } " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " . " " FILTER (tracker:id(?p) = %s) " "} ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->p_id = data->_tmp0_;
	data->_tmp1_ = NULL;
	data->_tmp1_ = folks_structured_name_get_family_name (data->sname);
	data->_tmp2_ = NULL;
	data->_tmp2_ = folks_structured_name_get_given_name (data->sname);
	data->_tmp3_ = NULL;
	data->_tmp3_ = folks_structured_name_get_additional_names (data->sname);
	data->_tmp4_ = NULL;
	data->_tmp4_ = folks_structured_name_get_prefixes (data->sname);
	data->_tmp5_ = NULL;
	data->_tmp5_ = folks_structured_name_get_suffixes (data->sname);
	data->_tmp6_ = NULL;
	data->_tmp6_ = g_strdup_printf (query_t, data->p_id, data->_tmp1_, data->_tmp2_, data->_tmp3_, data->_tmp4_, data->_tmp5_, data->p_id);
	data->query = data->_tmp6_;
	data->_state_ = 1;
	_trf_persona_store_tracker_update (data->self, data->query, "_set_structured_name", _trf_persona_store_set_structured_name_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->query);
	_g_free0 (data->p_id);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_full_name_data_free (gpointer _data) {
	TrfPersonaStoreSetFullNameData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_free0 (data->full_name);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetFullNameData, data);
}


void _trf_persona_store_set_full_name (TrfPersonaStore* self, FolksPersona* persona, const gchar* full_name, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetFullNameData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetFullNameData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_full_name);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_full_name_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->full_name = g_strdup (full_name);
	_trf_persona_store_set_full_name_co (_data_);
}


void _trf_persona_store_set_full_name_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetFullNameData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_full_name_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetFullNameData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_full_name_co (data);
}


static gboolean _trf_persona_store_set_full_name_co (TrfPersonaStoreSetFullNameData* data) {
	static const char query_t[] = "DELETE { " " ?p " TRF_ONTOLOGY_DEFS_NCO_FULLNAME " ?fn " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " .  " " OPTIONAL { ?p " TRF_ONTOLOGY_DEFS_NCO_FULLNAME " ?fn } . " " FILTER (tracker:id(?p) = %s) " "} " "INSERT { " " ?p " TRF_ONTOLOGY_DEFS_NCO_FULLNAME " '%s' " "} " "WHERE { " " ?p a " TRF_ONTOLOGY_DEFS_NCO_PERSON " . " " FILTER (tracker:id(?p) = %s) " "} ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->p_id = data->_tmp0_;
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_strdup_printf (query_t, data->p_id, data->full_name, data->p_id);
	data->query = data->_tmp1_;
	data->_state_ = 1;
	_trf_persona_store_tracker_update (data->self, data->query, "_set_full_name", _trf_persona_store_set_full_name_ready, data);
	return FALSE;
	_state_1:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->query);
	_g_free0 (data->p_id);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_set_attrib_set_data_free (gpointer _data) {
	TrfPersonaStoreSetAttribSetData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_object_unref0 (data->attribs);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreSetAttribSetData, data);
}


static void _trf_persona_store_set_attrib_set (TrfPersonaStore* self, FolksPersona* persona, GeeSet* attribs, TrfAttrib what, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreSetAttribSetData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreSetAttribSetData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_set_attrib_set);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_set_attrib_set_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_data_->attribs = _g_object_ref0 (attribs);
	_data_->what = what;
	_trf_persona_store_set_attrib_set_co (_data_);
}


static void _trf_persona_store_set_attrib_set_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	TrfPersonaStoreSetAttribSetData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _trf_persona_store_set_attrib_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreSetAttribSetData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_set_attrib_set_co (data);
}


static gboolean _trf_persona_store_set_attrib_set_co (TrfPersonaStoreSetAttribSetData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->p_id = data->_tmp0_;
	data->related_attrib = NULL;
	data->related_prop = NULL;
	data->related_prop_2 = NULL;
	data->related_connection = NULL;
	switch (data->what) {
		case TRF_ATTRIB_IM_ADDRESSES:
		{
			data->related_attrib = TRF_ONTOLOGY_DEFS_NCO_IMADDRESS;
			data->related_prop = TRF_ONTOLOGY_DEFS_NCO_IMID;
			data->related_prop_2 = TRF_ONTOLOGY_DEFS_NCO_IMPROTOCOL;
			data->related_connection = TRF_ONTOLOGY_DEFS_NCO_HAS_IMADDRESS;
			data->_state_ = 1;
			_trf_persona_store_remove_attributes_from_persona (data->self, data->persona, _REMOVE_IM_ADDRS, _trf_persona_store_set_attrib_set_ready, data);
			return FALSE;
			_state_1:
			data->_tmp1_ = NULL;
			data->_tmp1_ = _trf_persona_store_remove_attributes_from_persona_finish (data->self, data->_res_);
			data->_tmp2_ = data->_tmp1_;
			_g_free0 (data->_tmp2_);
			break;
		}
		case TRF_ATTRIB_POSTAL_ADDRESSES:
		{
			data->related_attrib = TRF_ONTOLOGY_DEFS_NCO_POSTAL_ADDRESS;
			data->related_connection = TRF_ONTOLOGY_DEFS_NCO_HAS_POSTAL_ADDRESS;
			data->_state_ = 2;
			_trf_persona_store_remove_attributes_from_persona (data->self, data->persona, _REMOVE_POSTALS, _trf_persona_store_set_attrib_set_ready, data);
			return FALSE;
			_state_2:
			data->_tmp3_ = NULL;
			data->_tmp3_ = _trf_persona_store_remove_attributes_from_persona_finish (data->self, data->_res_);
			data->_tmp4_ = data->_tmp3_;
			_g_free0 (data->_tmp4_);
			break;
		}
		case TRF_ATTRIB_URLS:
		{
			data->related_attrib = TRF_ONTOLOGY_DEFS_NCO_URL;
			data->related_connection = TRF_ONTOLOGY_DEFS_NCO_URL;
			break;
		}
		default:
		break;
	}
	data->_tmp5_ = NULL;
	data->_tmp5_ = tracker_sparql_builder_new_update ();
	data->builder = data->_tmp5_;
	tracker_sparql_builder_insert_open (data->builder, NULL);
	data->i = 0;
	{
		data->_tmp6_ = NULL;
		data->_tmp6_ = gee_iterable_iterator ((GeeIterable*) data->attribs);
		data->_p_it = data->_tmp6_;
		while (TRUE) {
			data->_tmp7_ = gee_iterator_next (data->_p_it);
			if (!data->_tmp7_) {
				break;
			}
			data->_tmp8_ = NULL;
			data->_tmp8_ = gee_iterator_get (data->_p_it);
			data->p = (GObject*) data->_tmp8_;
			data->fd = NULL;
			data->pa = NULL;
			data->_tmp9_ = NULL;
			data->_tmp9_ = g_strdup_printf ("_:a%d", data->i);
			data->affl = data->_tmp9_;
			data->attr = NULL;
			switch (data->what) {
				case TRF_ATTRIB_POSTAL_ADDRESSES:
				{
					data->_tmp10_ = _g_object_ref0 (FOLKS_POSTAL_ADDRESS (data->p));
					_g_object_unref0 (data->pa);
					data->pa = data->_tmp10_;
					data->_tmp11_ = NULL;
					data->_tmp11_ = g_strdup_printf ("_:p%d", data->i);
					_g_free0 (data->attr);
					data->attr = data->_tmp11_;
					tracker_sparql_builder_subject (data->builder, data->attr);
					tracker_sparql_builder_predicate (data->builder, "a");
					tracker_sparql_builder_object (data->builder, data->related_attrib);
					tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_POBOX);
					data->_tmp12_ = NULL;
					data->_tmp12_ = folks_postal_address_get_po_box (data->pa);
					tracker_sparql_builder_object_string (data->builder, data->_tmp12_);
					tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_LOCALITY);
					data->_tmp13_ = NULL;
					data->_tmp13_ = folks_postal_address_get_locality (data->pa);
					tracker_sparql_builder_object_string (data->builder, data->_tmp13_);
					tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_POSTALCODE);
					data->_tmp14_ = NULL;
					data->_tmp14_ = folks_postal_address_get_postal_code (data->pa);
					tracker_sparql_builder_object_string (data->builder, data->_tmp14_);
					tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_STREET_ADDRESS);
					data->_tmp15_ = NULL;
					data->_tmp15_ = folks_postal_address_get_street (data->pa);
					tracker_sparql_builder_object_string (data->builder, data->_tmp15_);
					tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_EXTENDED_ADDRESS);
					data->_tmp16_ = NULL;
					data->_tmp16_ = folks_postal_address_get_extension (data->pa);
					tracker_sparql_builder_object_string (data->builder, data->_tmp16_);
					tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_COUNTRY);
					data->_tmp17_ = NULL;
					data->_tmp17_ = folks_postal_address_get_country (data->pa);
					tracker_sparql_builder_object_string (data->builder, data->_tmp17_);
					tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_REGION);
					data->_tmp18_ = NULL;
					data->_tmp18_ = folks_postal_address_get_region (data->pa);
					tracker_sparql_builder_object_string (data->builder, data->_tmp18_);
					break;
				}
				case TRF_ATTRIB_URLS:
				{
					data->_tmp19_ = _g_object_ref0 (FOLKS_FIELD_DETAILS (data->p));
					_g_object_unref0 (data->fd);
					data->fd = data->_tmp19_;
					data->_tmp20_ = NULL;
					data->_tmp20_ = folks_field_details_get_parameter_values (data->fd, "type");
					data->type_p = data->_tmp20_;
					data->_tmp21_ = gee_collection_contains (data->type_p, "blog");
					if (data->_tmp21_) {
						data->related_connection = TRF_ONTOLOGY_DEFS_NCO_BLOG;
					} else {
						data->_tmp22_ = gee_collection_contains (data->type_p, "website");
						if (data->_tmp22_) {
							data->related_connection = TRF_ONTOLOGY_DEFS_NCO_WEBSITE;
						}
					}
					data->_tmp23_ = NULL;
					data->_tmp23_ = folks_field_details_get_value (data->fd);
					data->_tmp24_ = NULL;
					data->_tmp24_ = g_strdup_printf ("'%s'", data->_tmp23_);
					_g_free0 (data->attr);
					data->attr = data->_tmp24_;
					_g_object_unref0 (data->type_p);
					break;
				}
				default:
				case TRF_ATTRIB_IM_ADDRESSES:
				{
					data->_tmp25_ = _g_object_ref0 (FOLKS_FIELD_DETAILS (data->p));
					_g_object_unref0 (data->fd);
					data->fd = data->_tmp25_;
					data->_tmp26_ = NULL;
					data->_tmp26_ = g_strdup_printf ("_:p%d", data->i);
					_g_free0 (data->attr);
					data->attr = data->_tmp26_;
					tracker_sparql_builder_subject (data->builder, data->attr);
					tracker_sparql_builder_predicate (data->builder, "a");
					tracker_sparql_builder_object (data->builder, data->related_attrib);
					tracker_sparql_builder_predicate (data->builder, data->related_prop);
					data->_tmp27_ = NULL;
					data->_tmp27_ = folks_field_details_get_value (data->fd);
					tracker_sparql_builder_object_string (data->builder, data->_tmp27_);
					if (data->what == TRF_ATTRIB_IM_ADDRESSES) {
						tracker_sparql_builder_predicate (data->builder, data->related_prop_2);
						data->_tmp28_ = NULL;
						data->_tmp28_ = folks_field_details_get_parameter_values (data->fd, "proto");
						data->_tmp29_ = data->_tmp28_;
						data->_tmp31_ = NULL;
						data->_tmp31_ = gee_collection_to_array (data->_tmp29_, &data->_tmp30_);
						data->_tmp32_ = data->_tmp31_;
						_g_object_unref0 (data->_tmp29_);
						data->im_params = data->_tmp32_;
						data->im_params_length1 = data->_tmp30_;
						data->_im_params_size_ = data->_tmp30_;
						tracker_sparql_builder_object_string (data->builder, data->im_params[0]);
						data->im_params = (_vala_array_free (data->im_params, data->im_params_length1, (GDestroyNotify) g_free), NULL);
					}
					break;
				}
			}
			tracker_sparql_builder_subject (data->builder, data->affl);
			tracker_sparql_builder_predicate (data->builder, "a");
			tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION);
			tracker_sparql_builder_predicate (data->builder, data->related_connection);
			tracker_sparql_builder_object (data->builder, data->attr);
			tracker_sparql_builder_subject (data->builder, "?contact");
			tracker_sparql_builder_predicate (data->builder, TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION);
			tracker_sparql_builder_object (data->builder, data->affl);
			data->i++;
			_g_free0 (data->attr);
			_g_free0 (data->affl);
			_g_object_unref0 (data->pa);
			_g_object_unref0 (data->fd);
			_g_object_unref0 (data->p);
		}
		_g_object_unref0 (data->_p_it);
	}
	tracker_sparql_builder_insert_close (data->builder);
	tracker_sparql_builder_where_open (data->builder);
	tracker_sparql_builder_subject (data->builder, "?contact");
	tracker_sparql_builder_predicate (data->builder, "a");
	tracker_sparql_builder_object (data->builder, TRF_ONTOLOGY_DEFS_NCO_PERSON);
	data->_tmp33_ = NULL;
	data->_tmp33_ = g_strdup_printf (" FILTER(tracker:id(?contact) = %s) ", data->p_id);
	data->filter = data->_tmp33_;
	tracker_sparql_builder_append (data->builder, data->filter);
	tracker_sparql_builder_where_close (data->builder);
	data->_tmp34_ = NULL;
	data->_tmp34_ = tracker_sparql_builder_get_result (data->builder);
	data->_state_ = 3;
	_trf_persona_store_tracker_update (data->self, data->_tmp34_, "set_attrib", _trf_persona_store_set_attrib_set_ready, data);
	return FALSE;
	_state_3:
	_trf_persona_store_tracker_update_finish (data->self, data->_res_);
	_g_free0 (data->filter);
	_g_object_unref0 (data->builder);
	_g_free0 (data->p_id);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_tracker_update_data_free (gpointer _data) {
	TrfPersonaStoreTrackerUpdateData* data;
	data = _data;
	_g_free0 (data->query);
	_g_free0 (data->caller);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreTrackerUpdateData, data);
}


static void _trf_persona_store_tracker_update (TrfPersonaStore* self, const gchar* query, const gchar* caller, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreTrackerUpdateData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreTrackerUpdateData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_tracker_update);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_tracker_update_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->query = g_strdup (query);
	_data_->caller = g_strdup (caller);
	_trf_persona_store_tracker_update_co (_data_);
}


static gboolean _trf_persona_store_tracker_update_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gboolean result;
	TrfPersonaStoreTrackerUpdateData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


static void _trf_persona_store_tracker_update_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreTrackerUpdateData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_tracker_update_co (data);
}


static gboolean _trf_persona_store_tracker_update_co (TrfPersonaStoreTrackerUpdateData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->ret = FALSE;
	g_debug ("trf-persona-store.vala:2398: %s: %s", data->caller, data->query);
	data->_state_ = 1;
	tracker_sparql_connection_update_async (data->self->priv->_connection, data->query, G_PRIORITY_DEFAULT, NULL, _trf_persona_store_tracker_update_ready, data);
	return FALSE;
	_state_1:
	tracker_sparql_connection_update_finish (data->self->priv->_connection, data->_res_, &data->_inner_error_);
	if (data->_inner_error_ != NULL) {
		if (data->_inner_error_->domain == TRACKER_SPARQL_ERROR) {
			goto __catch11_tracker_sparql_error;
		}
		if (data->_inner_error_->domain == G_IO_ERROR) {
			goto __catch11_g_io_error;
		}
		if (data->_inner_error_->domain == G_DBUS_ERROR) {
			goto __catch11_g_dbus_error;
		}
		g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
		g_clear_error (&data->_inner_error_);
		return FALSE;
	}
	data->ret = TRUE;
	goto __finally11;
	__catch11_tracker_sparql_error:
	{
		data->e1 = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:2407: [%s] SPARQL syntax error: %s. Query: %s", data->caller, data->e1->message, data->query);
		_g_error_free0 (data->e1);
	}
	goto __finally11;
	__catch11_g_io_error:
	{
		data->e2 = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:2412: [%s] IO error: %s", data->caller, data->e2->message);
		_g_error_free0 (data->e2);
	}
	goto __finally11;
	__catch11_g_dbus_error:
	{
		data->e3 = data->_inner_error_;
		data->_inner_error_ = NULL;
		g_warning ("trf-persona-store.vala:2417: [%s] DBus error: %s", data->caller, data->e3->message);
		_g_error_free0 (data->e3);
	}
	__finally11:
	if (data->_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
		g_clear_error (&data->_inner_error_);
		return FALSE;
	}
	data->result = data->ret;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_affiliations_from_persona_data_free (gpointer _data) {
	TrfPersonaStoreAffiliationsFromPersonaData* data;
	data = _data;
	_g_free0 (data->urn);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreAffiliationsFromPersonaData, data);
}


static void _trf_persona_store_affiliations_from_persona (TrfPersonaStore* self, const gchar* urn, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreAffiliationsFromPersonaData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreAffiliationsFromPersonaData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_affiliations_from_persona);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_affiliations_from_persona_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->urn = g_strdup (urn);
	_trf_persona_store_affiliations_from_persona_co (_data_);
}


static GeeHashSet* _trf_persona_store_affiliations_from_persona_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	GeeHashSet* result;
	TrfPersonaStoreAffiliationsFromPersonaData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_affiliations_from_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreAffiliationsFromPersonaData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_affiliations_from_persona_co (data);
}


static gboolean _trf_persona_store_affiliations_from_persona_co (TrfPersonaStoreAffiliationsFromPersonaData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_linked_resources (data->self, data->urn, TRF_ONTOLOGY_DEFS_NCO_PERSON, TRF_ONTOLOGY_DEFS_NCO_HAS_AFFILIATION, _trf_persona_store_affiliations_from_persona_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = _trf_persona_store_linked_resources_finish (data->self, data->_res_);
	data->result = data->_tmp0_;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_phones_from_affiliation_data_free (gpointer _data) {
	TrfPersonaStorePhonesFromAffiliationData* data;
	data = _data;
	_g_free0 (data->affl);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStorePhonesFromAffiliationData, data);
}


static void _trf_persona_store_phones_from_affiliation (TrfPersonaStore* self, const gchar* affl, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStorePhonesFromAffiliationData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStorePhonesFromAffiliationData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_phones_from_affiliation);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_phones_from_affiliation_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->affl = g_strdup (affl);
	_trf_persona_store_phones_from_affiliation_co (_data_);
}


static GeeHashSet* _trf_persona_store_phones_from_affiliation_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	GeeHashSet* result;
	TrfPersonaStorePhonesFromAffiliationData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_phones_from_affiliation_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStorePhonesFromAffiliationData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_phones_from_affiliation_co (data);
}


static gboolean _trf_persona_store_phones_from_affiliation_co (TrfPersonaStorePhonesFromAffiliationData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_linked_resources (data->self, data->affl, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION, TRF_ONTOLOGY_DEFS_NCO_HAS_PHONE, _trf_persona_store_phones_from_affiliation_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = _trf_persona_store_linked_resources_finish (data->self, data->_res_);
	data->result = data->_tmp0_;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_postals_from_affiliation_data_free (gpointer _data) {
	TrfPersonaStorePostalsFromAffiliationData* data;
	data = _data;
	_g_free0 (data->affl);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStorePostalsFromAffiliationData, data);
}


static void _trf_persona_store_postals_from_affiliation (TrfPersonaStore* self, const gchar* affl, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStorePostalsFromAffiliationData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStorePostalsFromAffiliationData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_postals_from_affiliation);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_postals_from_affiliation_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->affl = g_strdup (affl);
	_trf_persona_store_postals_from_affiliation_co (_data_);
}


static GeeHashSet* _trf_persona_store_postals_from_affiliation_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	GeeHashSet* result;
	TrfPersonaStorePostalsFromAffiliationData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_postals_from_affiliation_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStorePostalsFromAffiliationData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_postals_from_affiliation_co (data);
}


static gboolean _trf_persona_store_postals_from_affiliation_co (TrfPersonaStorePostalsFromAffiliationData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_linked_resources (data->self, data->affl, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION, TRF_ONTOLOGY_DEFS_NCO_HAS_POSTAL_ADDRESS, _trf_persona_store_postals_from_affiliation_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = _trf_persona_store_linked_resources_finish (data->self, data->_res_);
	data->result = data->_tmp0_;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_imaddrs_from_affiliation_data_free (gpointer _data) {
	TrfPersonaStoreImaddrsFromAffiliationData* data;
	data = _data;
	_g_free0 (data->affl);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreImaddrsFromAffiliationData, data);
}


static void _trf_persona_store_imaddrs_from_affiliation (TrfPersonaStore* self, const gchar* affl, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreImaddrsFromAffiliationData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreImaddrsFromAffiliationData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_imaddrs_from_affiliation);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_imaddrs_from_affiliation_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->affl = g_strdup (affl);
	_trf_persona_store_imaddrs_from_affiliation_co (_data_);
}


static GeeHashSet* _trf_persona_store_imaddrs_from_affiliation_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	GeeHashSet* result;
	TrfPersonaStoreImaddrsFromAffiliationData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_imaddrs_from_affiliation_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreImaddrsFromAffiliationData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_imaddrs_from_affiliation_co (data);
}


static gboolean _trf_persona_store_imaddrs_from_affiliation_co (TrfPersonaStoreImaddrsFromAffiliationData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_linked_resources (data->self, data->affl, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION, TRF_ONTOLOGY_DEFS_NCO_HAS_IMADDRESS, _trf_persona_store_imaddrs_from_affiliation_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = _trf_persona_store_linked_resources_finish (data->self, data->_res_);
	data->result = data->_tmp0_;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_emails_from_affiliation_data_free (gpointer _data) {
	TrfPersonaStoreEmailsFromAffiliationData* data;
	data = _data;
	_g_free0 (data->affl);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreEmailsFromAffiliationData, data);
}


static void _trf_persona_store_emails_from_affiliation (TrfPersonaStore* self, const gchar* affl, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreEmailsFromAffiliationData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreEmailsFromAffiliationData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_emails_from_affiliation);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_emails_from_affiliation_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->affl = g_strdup (affl);
	_trf_persona_store_emails_from_affiliation_co (_data_);
}


static GeeHashSet* _trf_persona_store_emails_from_affiliation_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	GeeHashSet* result;
	TrfPersonaStoreEmailsFromAffiliationData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_emails_from_affiliation_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreEmailsFromAffiliationData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_emails_from_affiliation_co (data);
}


static gboolean _trf_persona_store_emails_from_affiliation_co (TrfPersonaStoreEmailsFromAffiliationData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_state_ = 1;
	_trf_persona_store_linked_resources (data->self, data->affl, TRF_ONTOLOGY_DEFS_NCO_AFFILIATION, TRF_ONTOLOGY_DEFS_NCO_HAS_EMAIL, _trf_persona_store_emails_from_affiliation_ready, data);
	return FALSE;
	_state_1:
	data->_tmp0_ = NULL;
	data->_tmp0_ = _trf_persona_store_linked_resources_finish (data->self, data->_res_);
	data->result = data->_tmp0_;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_resource_usage_count_data_free (gpointer _data) {
	TrfPersonaStoreResourceUsageCountData* data;
	data = _data;
	_g_free0 (data->resource);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreResourceUsageCountData, data);
}


static void _trf_persona_store_resource_usage_count (TrfPersonaStore* self, const gchar* resource, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreResourceUsageCountData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreResourceUsageCountData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_resource_usage_count);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_resource_usage_count_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->resource = g_strdup (resource);
	_trf_persona_store_resource_usage_count_co (_data_);
}


static gint _trf_persona_store_resource_usage_count_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gint result;
	TrfPersonaStoreResourceUsageCountData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


/**
   * Retrieve the list of linked resources of a given subject
   *
   * @param resource          the urn of the resource in <urn> format
   * @return number of resources linking to this resource
   */
static void _trf_persona_store_resource_usage_count_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreResourceUsageCountData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_resource_usage_count_co (data);
}


static gboolean _trf_persona_store_resource_usage_count_co (TrfPersonaStoreResourceUsageCountData* data) {
	static const char query_t[] = "SELECT " " count(?s) " "WHERE { " " %s a rdfs:Resource . " " ?s ?p %s } ";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = g_strdup_printf (query_t, data->resource, data->resource);
	data->query = data->_tmp0_;
	data->_state_ = 1;
	_trf_persona_store_single_value_query (data->self, data->query, _trf_persona_store_resource_usage_count_ready, data);
	return FALSE;
	_state_1:
	data->_tmp1_ = NULL;
	data->_tmp1_ = _trf_persona_store_single_value_query_finish (data->self, data->_res_);
	data->_result_ = data->_tmp1_;
	data->_tmp2_ = atoi (data->_result_);
	data->result = data->_tmp2_;
	_g_free0 (data->_result_);
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->_result_);
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_delete_resource_data_free (gpointer _data) {
	TrfPersonaStoreDeleteResourceData* data;
	data = _data;
	_g_free0 (data->resource_urn);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreDeleteResourceData, data);
}


static void _trf_persona_store_delete_resource (TrfPersonaStore* self, const gchar* resource_urn, gboolean check_count, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreDeleteResourceData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreDeleteResourceData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_delete_resource);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_delete_resource_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->resource_urn = g_strdup (resource_urn);
	_data_->check_count = check_count;
	_trf_persona_store_delete_resource_co (_data_);
}


static gboolean _trf_persona_store_delete_resource_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gboolean result;
	TrfPersonaStoreDeleteResourceData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


static void _trf_persona_store_delete_resource_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreDeleteResourceData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_delete_resource_co (data);
}


static gboolean _trf_persona_store_delete_resource_co (TrfPersonaStoreDeleteResourceData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->deleted = FALSE;
	data->_tmp0_ = g_strdup (" DELETE { " " %s a rdfs:Resource " "} " "WHERE { " " %s a rdfs:Resource " "} ");
	data->query_t = data->_tmp0_;
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_strdup_printf (data->query_t, data->resource_urn, data->resource_urn);
	data->query = data->_tmp1_;
	if (data->check_count) {
		data->_state_ = 1;
		_trf_persona_store_resource_usage_count (data->self, data->resource_urn, _trf_persona_store_delete_resource_ready, data);
		return FALSE;
		_state_1:
		data->_tmp2_ = _trf_persona_store_resource_usage_count_finish (data->self, data->_res_);
		data->count = data->_tmp2_;
		if (data->count == 1) {
			data->_state_ = 2;
			_trf_persona_store_tracker_update (data->self, data->query, "_delete_resource", _trf_persona_store_delete_resource_ready, data);
			return FALSE;
			_state_2:
			data->_tmp3_ = _trf_persona_store_tracker_update_finish (data->self, data->_res_);
			data->deleted = data->_tmp3_;
		}
	} else {
		data->_state_ = 3;
		_trf_persona_store_tracker_update (data->self, data->query, "_delete_resource", _trf_persona_store_delete_resource_ready, data);
		return FALSE;
		_state_3:
		data->_tmp4_ = _trf_persona_store_tracker_update_finish (data->self, data->_res_);
		data->deleted = data->_tmp4_;
	}
	data->result = data->deleted;
	_g_free0 (data->query);
	_g_free0 (data->query_t);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->query);
	_g_free0 (data->query_t);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_linked_resources_data_free (gpointer _data) {
	TrfPersonaStoreLinkedResourcesData* data;
	data = _data;
	_g_free0 (data->urn);
	_g_free0 (data->subject_type);
	_g_free0 (data->linking_predicate);
	_g_object_unref0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreLinkedResourcesData, data);
}


static void _trf_persona_store_linked_resources (TrfPersonaStore* self, const gchar* urn, const gchar* subject_type, const gchar* linking_predicate, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreLinkedResourcesData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreLinkedResourcesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_linked_resources);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_linked_resources_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->urn = g_strdup (urn);
	_data_->subject_type = g_strdup (subject_type);
	_data_->linking_predicate = g_strdup (linking_predicate);
	_trf_persona_store_linked_resources_co (_data_);
}


static GeeHashSet* _trf_persona_store_linked_resources_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	GeeHashSet* result;
	TrfPersonaStoreLinkedResourcesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


/**
   * Retrieve the list of linked resources of a given subject
   *
   * @param urn               the urn of the subject in <urn> format
   * @param subject_type      i.e: nco:Person, nco:Affiliation, etc
   * @param linking_predicate i.e.: nco:hasAffiliation
   * @return a list of linked resources (in <urn> format)
   */
static void _trf_persona_store_linked_resources_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreLinkedResourcesData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_linked_resources_co (data);
}


static gboolean _trf_persona_store_linked_resources_co (TrfPersonaStoreLinkedResourcesData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = g_strdup ("SELECT " " fn:concat('<',?linkedr,'>')  " "WHERE { " " %s a %s; " " %s ?linkedr " "} ");
	data->query_t = data->_tmp0_;
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_strdup_printf (data->query_t, data->urn, data->subject_type, data->linking_predicate);
	data->query = data->_tmp1_;
	data->_state_ = 1;
	_trf_persona_store_multi_value_query (data->self, data->query, _trf_persona_store_linked_resources_ready, data);
	return FALSE;
	_state_1:
	data->_tmp2_ = NULL;
	data->_tmp2_ = _trf_persona_store_multi_value_query_finish (data->self, data->_res_);
	data->result = data->_tmp2_;
	_g_free0 (data->query);
	_g_free0 (data->query_t);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->query);
	_g_free0 (data->query_t);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_urn_from_persona_data_free (gpointer _data) {
	TrfPersonaStoreUrnFromPersonaData* data;
	data = _data;
	_g_object_unref0 (data->persona);
	_g_free0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreUrnFromPersonaData, data);
}


static void _trf_persona_store_urn_from_persona (TrfPersonaStore* self, FolksPersona* persona, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreUrnFromPersonaData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreUrnFromPersonaData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_urn_from_persona);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_urn_from_persona_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->persona = _g_object_ref0 (persona);
	_trf_persona_store_urn_from_persona_co (_data_);
}


static gchar* _trf_persona_store_urn_from_persona_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gchar* result;
	TrfPersonaStoreUrnFromPersonaData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _trf_persona_store_urn_from_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreUrnFromPersonaData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_urn_from_persona_co (data);
}


static gboolean _trf_persona_store_urn_from_persona_co (TrfPersonaStoreUrnFromPersonaData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = trf_persona_tracker_id (TRF_PERSONA (data->persona));
	data->id = data->_tmp0_;
	data->_state_ = 1;
	_trf_persona_store_urn_from_tracker_id (data->self, data->id, _trf_persona_store_urn_from_persona_ready, data);
	return FALSE;
	_state_1:
	data->_tmp1_ = NULL;
	data->_tmp1_ = _trf_persona_store_urn_from_tracker_id_finish (data->self, data->_res_);
	data->result = data->_tmp1_;
	_g_free0 (data->id);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->id);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _trf_persona_store_urn_from_property_data_free (gpointer _data) {
	TrfPersonaStoreUrnFromPropertyData* data;
	data = _data;
	_g_free0 (data->class_name);
	_g_free0 (data->property_name);
	_g_free0 (data->property_value);
	_g_free0 (data->result);
	_g_object_unref0 (data->self);
	g_slice_free (TrfPersonaStoreUrnFromPropertyData, data);
}


static void _trf_persona_store_urn_from_property (TrfPersonaStore* self, const gchar* class_name, const gchar* property_name, const gchar* property_value, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrfPersonaStoreUrnFromPropertyData* _data_;
	_data_ = g_slice_new0 (TrfPersonaStoreUrnFromPropertyData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _trf_persona_store_urn_from_property);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _trf_persona_store_urn_from_property_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->class_name = g_strdup (class_name);
	_data_->property_name = g_strdup (property_name);
	_data_->property_value = g_strdup (property_value);
	_trf_persona_store_urn_from_property_co (_data_);
}


static gchar* _trf_persona_store_urn_from_property_finish (TrfPersonaStore* self, GAsyncResult* _res_) {
	gchar* result;
	TrfPersonaStoreUrnFromPropertyData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


/**
   * Helper method to figure out if a constrained property
   * already exists.
   */
static void _trf_persona_store_urn_from_property_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrfPersonaStoreUrnFromPropertyData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	_trf_persona_store_urn_from_property_co (data);
}


static gboolean _trf_persona_store_urn_from_property_co (TrfPersonaStoreUrnFromPropertyData* data) {
	static const char query_template[] = "SELECT " " fn:concat('<', ?o, '>') " "WHERE { " " ?o a %s ; " " %s ?prop_val . " "FILTER (?prop_val = '%s') " "}";
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = g_strdup_printf (query_template, data->class_name, data->property_name, data->property_value);
	data->query = data->_tmp0_;
	data->_state_ = 1;
	_trf_persona_store_single_value_query (data->self, data->query, _trf_persona_store_urn_from_property_ready, data);
	return FALSE;
	_state_1:
	data->_tmp1_ = NULL;
	data->_tmp1_ = _trf_persona_store_single_value_query_finish (data->self, data->_res_);
	data->result = data->_tmp1_;
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_g_free0 (data->query);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static const gchar* trf_persona_store_real_get_type_id (FolksPersonaStore* base) {
	const gchar* result;
	TrfPersonaStore* self;
	self = (TrfPersonaStore*) base;
	result = BACKEND_NAME;
	return result;
}


static FolksMaybeBool trf_persona_store_real_get_can_add_personas (FolksPersonaStore* base) {
	FolksMaybeBool result;
	TrfPersonaStore* self;
	self = (TrfPersonaStore*) base;
	result = FOLKS_MAYBE_BOOL_TRUE;
	return result;
}


static FolksMaybeBool trf_persona_store_real_get_can_alias_personas (FolksPersonaStore* base) {
	FolksMaybeBool result;
	TrfPersonaStore* self;
	self = (TrfPersonaStore*) base;
	result = FOLKS_MAYBE_BOOL_FALSE;
	return result;
}


static FolksMaybeBool trf_persona_store_real_get_can_group_personas (FolksPersonaStore* base) {
	FolksMaybeBool result;
	TrfPersonaStore* self;
	self = (TrfPersonaStore*) base;
	result = FOLKS_MAYBE_BOOL_FALSE;
	return result;
}


static FolksMaybeBool trf_persona_store_real_get_can_remove_personas (FolksPersonaStore* base) {
	FolksMaybeBool result;
	TrfPersonaStore* self;
	self = (TrfPersonaStore*) base;
	result = FOLKS_MAYBE_BOOL_TRUE;
	return result;
}


static gboolean trf_persona_store_real_get_is_prepared (FolksPersonaStore* base) {
	gboolean result;
	TrfPersonaStore* self;
	self = (TrfPersonaStore*) base;
	result = self->priv->_is_prepared;
	return result;
}


static GeeMap* trf_persona_store_real_get_personas (FolksPersonaStore* base) {
	GeeMap* result;
	TrfPersonaStore* self;
	self = (TrfPersonaStore*) base;
	result = self->priv->_personas_ro;
	return result;
}


static void trf_persona_store_class_init (TrfPersonaStoreClass * klass) {
	trf_persona_store_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (TrfPersonaStorePrivate));
	FOLKS_PERSONA_STORE_CLASS (klass)->add_persona_from_details = trf_persona_store_real_add_persona_from_details;
	FOLKS_PERSONA_STORE_CLASS (klass)->add_persona_from_details_finish = trf_persona_store_real_add_persona_from_details_finish;
	FOLKS_PERSONA_STORE_CLASS (klass)->remove_persona = trf_persona_store_real_remove_persona;
	FOLKS_PERSONA_STORE_CLASS (klass)->remove_persona_finish = trf_persona_store_real_remove_persona_finish;
	FOLKS_PERSONA_STORE_CLASS (klass)->prepare = trf_persona_store_real_prepare;
	FOLKS_PERSONA_STORE_CLASS (klass)->prepare_finish = trf_persona_store_real_prepare_finish;
	FOLKS_PERSONA_STORE_CLASS (klass)->get_type_id = trf_persona_store_real_get_type_id;
	FOLKS_PERSONA_STORE_CLASS (klass)->get_can_add_personas = trf_persona_store_real_get_can_add_personas;
	FOLKS_PERSONA_STORE_CLASS (klass)->get_can_alias_personas = trf_persona_store_real_get_can_alias_personas;
	FOLKS_PERSONA_STORE_CLASS (klass)->get_can_group_personas = trf_persona_store_real_get_can_group_personas;
	FOLKS_PERSONA_STORE_CLASS (klass)->get_can_remove_personas = trf_persona_store_real_get_can_remove_personas;
	FOLKS_PERSONA_STORE_CLASS (klass)->get_is_prepared = trf_persona_store_real_get_is_prepared;
	FOLKS_PERSONA_STORE_CLASS (klass)->get_personas = trf_persona_store_real_get_personas;
	G_OBJECT_CLASS (klass)->get_property = _vala_trf_persona_store_get_property;
	G_OBJECT_CLASS (klass)->finalize = trf_persona_store_finalize;
	/**
	   * The type of persona store this is.
	   *
	   * See {@link Folks.PersonaStore.type_id}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TRF_PERSONA_STORE_TYPE_ID, "type-id");
	/**
	   * Whether this PersonaStore can add {@link Folks.Persona}s.
	   *
	   * See {@link Folks.PersonaStore.can_add_personas}.
	   *
	   * @since 0.5.0
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TRF_PERSONA_STORE_CAN_ADD_PERSONAS, "can-add-personas");
	/**
	   * Whether this PersonaStore can set the alias of {@link Folks.Persona}s.
	   *
	   * See {@link Folks.PersonaStore.can_alias_personas}.
	   *
	   * @since 0.5.0
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TRF_PERSONA_STORE_CAN_ALIAS_PERSONAS, "can-alias-personas");
	/**
	   * Whether this PersonaStore can set the groups of {@link Folks.Persona}s.
	   *
	   * See {@link Folks.PersonaStore.can_group_personas}.
	   *
	   * @since 0.5.0
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TRF_PERSONA_STORE_CAN_GROUP_PERSONAS, "can-group-personas");
	/**
	   * Whether this PersonaStore can remove {@link Folks.Persona}s.
	   *
	   * See {@link Folks.PersonaStore.can_remove_personas}.
	   *
	   * @since 0.5.0
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TRF_PERSONA_STORE_CAN_REMOVE_PERSONAS, "can-remove-personas");
	/**
	   * Whether this PersonaStore has been prepared.
	   *
	   * See {@link Folks.PersonaStore.is_prepared}.
	   *
	   * @since 0.5.0
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TRF_PERSONA_STORE_IS_PREPARED, "is-prepared");
	/**
	   * The {@link Persona}s exposed by this PersonaStore.
	   *
	   * See {@link Folks.PersonaStore.personas}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TRF_PERSONA_STORE_PERSONAS, "personas");
}


static void trf_persona_store_instance_init (TrfPersonaStore * self) {
	self->priv = TRF_PERSONA_STORE_GET_PRIVATE (self);
	g_static_rec_mutex_init (&self->priv->__lock__personas);
	g_static_rec_mutex_init (&self->priv->__lock__is_prepared);
	self->priv->_is_prepared = FALSE;
}


static void trf_persona_store_finalize (GObject* obj) {
	TrfPersonaStore * self;
	self = TRF_PERSONA_STORE (obj);
	g_static_rec_mutex_free (&self->priv->__lock__personas);
	_g_object_unref0 (self->priv->_personas);
	_g_object_unref0 (self->priv->_personas_ro);
	g_static_rec_mutex_free (&self->priv->__lock__is_prepared);
	_g_object_unref0 (self->priv->_resources_object);
	_g_object_unref0 (self->priv->_connection);
	G_OBJECT_CLASS (trf_persona_store_parent_class)->finalize (obj);
}


/**
 * A persona store.
 * It will create {@link Persona}s for each contacts on the main addressbook.
 */
GType trf_persona_store_get_type (void) {
	static volatile gsize trf_persona_store_type_id__volatile = 0;
	if (g_once_init_enter (&trf_persona_store_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TrfPersonaStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) trf_persona_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrfPersonaStore), 0, (GInstanceInitFunc) trf_persona_store_instance_init, NULL };
		GType trf_persona_store_type_id;
		trf_persona_store_type_id = g_type_register_static (FOLKS_TYPE_PERSONA_STORE, "TrfPersonaStore", &g_define_type_info, 0);
		g_once_init_leave (&trf_persona_store_type_id__volatile, trf_persona_store_type_id);
	}
	return trf_persona_store_type_id__volatile;
}


static void _vala_trf_persona_store_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	TrfPersonaStore * self;
	self = TRF_PERSONA_STORE (object);
	switch (property_id) {
		case TRF_PERSONA_STORE_TYPE_ID:
		g_value_set_string (value, folks_persona_store_get_type_id ((FolksPersonaStore*) self));
		break;
		case TRF_PERSONA_STORE_CAN_ADD_PERSONAS:
		g_value_set_enum (value, folks_persona_store_get_can_add_personas ((FolksPersonaStore*) self));
		break;
		case TRF_PERSONA_STORE_CAN_ALIAS_PERSONAS:
		g_value_set_enum (value, folks_persona_store_get_can_alias_personas ((FolksPersonaStore*) self));
		break;
		case TRF_PERSONA_STORE_CAN_GROUP_PERSONAS:
		g_value_set_enum (value, folks_persona_store_get_can_group_personas ((FolksPersonaStore*) self));
		break;
		case TRF_PERSONA_STORE_CAN_REMOVE_PERSONAS:
		g_value_set_enum (value, folks_persona_store_get_can_remove_personas ((FolksPersonaStore*) self));
		break;
		case TRF_PERSONA_STORE_IS_PREPARED:
		g_value_set_boolean (value, folks_persona_store_get_is_prepared ((FolksPersonaStore*) self));
		break;
		case TRF_PERSONA_STORE_PERSONAS:
		g_value_set_object (value, folks_persona_store_get_personas ((FolksPersonaStore*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



