linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Szatkowski <bulislaw@linux.com>
To: linux-bluetooth@vger.kernel.org
Cc: Bartosz Szatkowski <bulislaw@linux.com>
Subject: [PATCH 2/7] Fix proper type handling in missed_calls_query
Date: Wed, 10 Nov 2010 14:15:25 +0100	[thread overview]
Message-ID: <1289394930-6694-2-git-send-email-bulislaw@linux.com> (raw)
In-Reply-To: <1289394930-6694-1-git-send-email-bulislaw@linux.com>

Previously all phone numbers, addresses and emails was considered to be "work".
Now there are three working types for emails and addresses: "work", "home",
"other" and four for phone numbers - these three as well as "cell".
---
 plugins/phonebook-tracker.c |   84 +++++++++++++++++++++++++++++++++----------
 1 files changed, 65 insertions(+), 19 deletions(-)

diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 83327e0..e84c589 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -127,11 +127,11 @@
 	"} GROUP BY ?c"
 
 #define MISSED_CALLS_QUERY						\
-	"SELECT nco:phoneNumber(?h) nco:fullname(?c) "			\
+	"SELECT ?h nco:fullname(?c) "					\
 	"nco:nameFamily(?c) nco:nameGiven(?c) "				\
 	"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) "		\
 	"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) "		\
-	"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) "	\
+	"?w nco:pobox(?p) nco:extendedAddress(?p) "			\
 	"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) "	\
 	"nco:postalcode(?p) nco:country(?p) \"\" nco:emailAddress(?ew) "\
 	"nco:birthDate(?c) nco:nickname(?c) nco:url(?c) "		\
@@ -139,7 +139,11 @@
 	"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) "		\
 	"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) "	\
 	"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) "	\
-	"nco:title(?a) nco:phoneNumber(?t) nmo:receivedDate(?call) "	\
+	"nco:title(?a) nco:phoneNumber(?t) nco:pobox(?po) "		\
+	"nco:extendedAddress(?po) nco:streetAddress(?po) "		\
+	"nco:locality(?po) nco:region(?po) nco:postalcode(?po) "	\
+	"nco:country(?po) nco:emailAddress(?eo) ?vc "			\
+	"nmo:receivedDate(?call) "					\
 	"nmo:isSent(?call) nmo:isAnswered(?call) ?x "			\
 	"WHERE { "							\
 	"{ "								\
@@ -149,40 +153,82 @@
 		"nmo:from ?x ; "					\
 		"nmo:isSent false ; "					\
 		"nmo:isAnswered false . "				\
+		"?c a nco:PersonContact . "				\
+		"?c nco:hasPhoneNumber ?t . "				\
+		"OPTIONAL { "						\
+			"?t a nco:CellPhoneNumber ; "			\
+				"nco:phoneNumber ?vc . "		\
+		"} "							\
+		"OPTIONAL { ?c nco:hasPostalAddress ?po . } "		\
+		"OPTIONAL { ?c nco:hasEmailAddress ?eo . } "		\
+		"OPTIONAL { "						\
+			"?c nco:hasAffiliation ?a . "			\
+			"OPTIONAL { "					\
+			"?a rdfs:label \"Work\" . "			\
+			"OPTIONAL { ?a nco:hasEmailAddress ?ew . } "	\
+			"OPTIONAL { ?a nco:hasPostalAddress ?pw . } "	\
+			"}"						\
+			"OPTIONAL { "					\
+			"?a rdfs:label \"Home\" . "			\
+			"OPTIONAL { ?a nco:hasEmailAddress ?e . } "	\
+			"OPTIONAL { ?a nco:hasPostalAddress ?p . } "	\
+			"} "						\
+			"OPTIONAL { ?a nco:org ?o . } "			\
+		"} "							\
 	"} UNION { "							\
 		"?x a nco:Contact . "					\
-		"?x nco:hasPhoneNumber ?h . "				\
+		"?x nco:hasPhoneNumber ?tmp . "				\
 		"?call a nmo:Call ; "					\
 		"nmo:from ?x ; "					\
 		"nmo:isSent false ; "					\
 		"nmo:isAnswered false . "				\
 		"?c a nco:PersonContact . "				\
-		"?c nco:hasPhoneNumber ?h . "				\
-		"OPTIONAL { ?c nco:hasEmailAddress ?e . } "		\
-		"OPTIONAL { ?c nco:hasPostalAddress ?p . } "		\
+		"?c nco:hasAffiliation ?a . "				\
+		"?a nco:hasPhoneNumber ?tmp . "				\
 		"OPTIONAL { "						\
-			"?c nco:hasAffiliation ?a . "			\
+			"?a rdfs:label \"Work\" . "			\
+			"?tmp nco:phoneNumber ?w . "			\
 			"OPTIONAL { ?a nco:hasEmailAddress ?ew . } "	\
 			"OPTIONAL { ?a nco:hasPostalAddress ?pw . } "	\
 			"OPTIONAL { ?a nco:org ?o . } "			\
-		"} "							\
+			"{ "						\
+			"SELECT ?p ?e ?c WHERE { "			\
+			"?c nco:hasAffiliation ?b . "			\
+			"?b rdfs:label \"Home\" . "			\
+			"OPTIONAL {?b nco:hasEmailAddress ?e . } "	\
+			"OPTIONAL {?b nco:hasPostalAddress ?p . }} "	\
+			"} "						\
+		"}"							\
+		"OPTIONAL { "						\
+			"?a rdfs:label \"Home\" . "			\
+			"?tmp nco:phoneNumber ?h . "			\
+			"OPTIONAL { ?a nco:hasEmailAddress ?e . } "	\
+			"OPTIONAL { ?a nco:hasPostalAddress ?p . } "	\
+			"OPTIONAL { ?a nco:org ?o . } "			\
+			"{ "						\
+			"SELECT ?pw ?ew ?c WHERE { "			\
+			"?c nco:hasAffiliation ?b . "			\
+			"?b rdfs:label \"Work\" . "			\
+			"OPTIONAL {?b nco:hasEmailAddress ?ew . } "	\
+			"OPTIONAL {?b nco:hasPostalAddress ?pw . }} "	\
+			"} "						\
+		"}"							\
 	"} UNION { "							\
 		"?x a nco:Contact . "					\
-		"?x nco:hasPhoneNumber ?w . "				\
+		"?x nco:hasPhoneNumber ?t . "				\
 		"?call a nmo:Call ; "					\
 		"nmo:from ?x ; "					\
 		"nmo:isSent false ; "					\
 		"nmo:isAnswered false . "				\
-		"?c a nco:PersonContact . "				\
-		"OPTIONAL { ?c nco:hasEmailAddress ?e . } "		\
-		"OPTIONAL { ?c nco:hasPostalAddress ?p . } "		\
-		"?c nco:hasAffiliation ?a . "				\
-		"?a nco:hasPhoneNumber ?w . "				\
-		"OPTIONAL { ?a nco:hasEmailAddress ?ew . } "		\
-		"OPTIONAL { ?a nco:hasPostalAddress ?pw . } "		\
-		"OPTIONAL { ?a nco:org ?o . } "				\
+		"OPTIONAL {?c a nco:PersonContact ; "			\
+			"nco:hasPhoneNumber ?t . } "			\
+		"OPTIONAL {?c a nco:PersonContact ; "			\
+			"nco:hasAffiliation ?a . "			\
+			"?a nco:hasPhoneNumber ?t . } "			\
+		"FILTER ( !bound(?c) && !bound(?a) ) . "		\
 	"} "								\
-	"} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call)) "
+	"} ORDER BY DESC(nmo:receivedDate(?call)) "
+
 
 #define MISSED_CALLS_LIST						\
 	"SELECT ?c nco:nameFamily(?c) "					\
-- 
1.7.0.4


  reply	other threads:[~2010-11-10 13:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10 13:15 [PATCH 1/7] Fix proper type handling in contacts_query_all Bartosz Szatkowski
2010-11-10 13:15 ` Bartosz Szatkowski [this message]
2010-11-10 13:15 ` [PATCH 3/7] Fix proper type handling in incoming_calls_query Bartosz Szatkowski
2010-11-10 13:15 ` [PATCH 4/7] Fix proper type handling in outgoing_calls_query Bartosz Szatkowski
2010-11-10 13:15 ` [PATCH 5/7] Fix proper type handling in combined_calls_query Bartosz Szatkowski
2010-11-10 13:15 ` [PATCH 6/7] Fix proper type handling in contact_query_from_uri Bartosz Szatkowski
2010-11-10 13:15 ` [PATCH 7/7] Changed number of fields selected via pbap queries Bartosz Szatkowski
2010-11-11  9:32 ` [PATCH 1/7] Fix proper type handling in contacts_query_all Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289394930-6694-2-git-send-email-bulislaw@linux.com \
    --to=bulislaw@linux.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).