Changes: QB unit test/data: Use "grouped" SPARQL syntax
[qtcontacts-tracker:hasselmms-qtcontacts-tracker.git] / tests / ut_qtcontacts_trackerplugin_querybuilder / data / 100-Group.rq
1 SELECT
2   ?_contact tracker:id(?_contact)
3   ?_context rdfs:label(?_context)
4
5  (SELECT
6     GROUP_CONCAT(fn:concat(?_postalAddress, "\u001f",
7                            tracker:coalesce(nco:country(?_postalAddress, "\u002c", "\u001c"), ""), "\u001f",
8                            tracker:coalesce(nco:locality(?_postalAddress, "\u002c", "\u001c"), ""), "\u001f",
9                            tracker:coalesce(nco:pobox(?_postalAddress, "\u002c", "\u001c"), ""), "\u001f",
10                            tracker:coalesce(nco:postalcode(?_postalAddress, "\u002c", "\u001c"), ""), "\u001f",
11                            tracker:coalesce(nco:region(?_postalAddress, "\u002c", "\u001c"), ""), "\u001f",
12                            tracker:coalesce(nco:streetAddress(?_postalAddress, "\u002c", "\u001c"), ""), "\u001f",
13                            tracker:coalesce((SELECT GROUP_CONCAT(tracker:id(?_t), "\u001d")
14                                              WHERE { ?_postalAddress rdf:type ?_t }), ""), "\u001f",
15                            tracker:coalesce((SELECT GROUP_CONCAT(fn:concat(nao:propertyValue(?_p), "\u001c",
16                                                                            tracker:coalesce((SELECT ?g0 WHERE { GRAPH ?g0 { ?_postalAddress nao:hasProperty ?_p } }),  "")),
17                                                                  "\u001d")
18                                              WHERE { ?_postalAddress nao:hasProperty ?_p . ?_p nao:propertyName "SubTypes" }), "")),
19                  "\u001e")
20   WHERE { ?_contact nco:hasPostalAddress ?_postalAddress })
21
22  (SELECT
23     GROUP_CONCAT(fn:concat(tracker:coalesce(ncal:uid(?_anniversary, "\u002c", "\u001c"), ""), "\u001f",
24                            tracker:coalesce(ncal:dateTime(ncal:dtstart(?_anniversary), "\u002c", "\u001c"), ""), "\u001f",
25                            tracker:coalesce(ncal:description(?_anniversary, "\u002c", "\u001c"), ""), "\u001f",
26                            tracker:coalesce(ncal:categories(?_anniversary, "\u001d", "\u001c"), "")),
27                  "\u001e")
28   WHERE { ?_contact ncal:anniversary ?_anniversary })
29
30   nco:birthDate(?_contact, "\u002c", "\u001c")
31
32  (SELECT ncal:uid(?_birthday, "\u002c", "\u001c")
33   WHERE {?_contact ncal:birthday ?_birthday})
34
35  (SELECT GROUP_CONCAT(fn:concat(?_emailAddress, "\u001f",
36                                 fn:concat(
37                                     nco:emailAddress(?_emailAddress),"\u001c",
38                                     tracker:coalesce((SELECT ?g11 WHERE { GRAPH ?g11 { ?_contact nco:hasEmailAddress ?_emailAddress } }),""))), "\u001e")
39   WHERE { ?_contact nco:hasEmailAddress ?_emailAddress })
40
41   nie:title(nco:hasLocation(?_contact), "\u002c", "\u001c")
42   slo:latitude(nco:hasLocation(?_contact), "\u002c", "\u001c")
43   slo:longitude(nco:hasLocation(?_contact), "\u002c", "\u001c")
44   slo:altitude(nco:hasLocation(?_contact), "\u002c", "\u001c")
45   slo:timestamp(nco:hasLocation(?_contact), "\u002c", "\u001c")
46
47   nco:contactUID(?_contact, "\u002c", "\u001c")
48
49   nco:contactGroupName(?_contact, "\u002c", "\u001c")
50
51   nco:note(?_contact, "\u001e", "\u001c")
52
53  (SELECT
54     GROUP_CONCAT(fn:concat(?_onlineAccount, "\u001f",
55                            tracker:coalesce(nco:imID(?_onlineAccount, "\u002c", "\u001c"), ""), "\u001f",
56                            tracker:coalesce(nco:imProtocol(?_onlineAccount, "\u002c", "\u001c"), ""), "\u001f",
57                            tracker:coalesce((SELECT GROUP_CONCAT(fn:concat(tracker:id(?_capability), "\u001c",
58                                                                            tracker:coalesce((SELECT ?g7 WHERE { GRAPH ?g7 { ?_onlineAccount nco:imCapability ?_capability } }), "")),
59                                                                  "\u001d")
60                                              WHERE { ?_onlineAccount nco:imCapability ?_capability }), ""), "\u001f",
61                            tracker:coalesce((SELECT GROUP_CONCAT(fn:concat(nao:propertyValue(?_p), "\u001c",
62                                                                            tracker:coalesce((SELECT ?g2 WHERE { GRAPH ?g2 { ?_onlineAccount nao:hasProperty ?_p } }), "")),
63                                                                  "\u001d")
64                                              WHERE { ?_onlineAccount nao:hasProperty ?_p . ?_p nao:propertyName "Capabilities" }), ""), "\u001f",
65                            tracker:coalesce((SELECT GROUP_CONCAT(fn:concat(nao:propertyValue(?_p), "\u001c",
66                                                                            tracker:coalesce((SELECT ?g3 WHERE { GRAPH ?g3 { ?_onlineAccount nao:hasProperty ?_p } }), "")),
67                                                                  "\u001d")
68                                              WHERE { ?_onlineAccount nao:hasProperty ?_p . ?_p nao:propertyName "SubTypes" }), ""), "\u001f",
69                            tracker:coalesce((SELECT fn:concat(fn:concat(?_account, "\u001c",
70                                                                         tracker:coalesce((SELECT ?g4 WHERE { GRAPH ?g4 { ?_account nco:hasIMContact ?_onlineAccount } }), "")),
71                                                                         "\u001f", tracker:coalesce(nco:imDisplayName(?_account, "\u002c", "\u001c"), ""))
72                                              WHERE { ?_account nco:hasIMContact ?_onlineAccount }), "\u001f")),
73                  "\u001e")
74   WHERE { ?_contact nco:hasIMAddress ?_onlineAccount })
75
76  (SELECT GROUP_CONCAT(fn:concat(tracker:coalesce((SELECT fn:concat(nie:url(?_imAvatar), "\u001c",
77                                                                    tracker:coalesce((SELECT ?g12 WHERE { GRAPH ?g12 { ?_imAddress nco:imAvatar ?_imAvatar } }), ""))
78                                                   WHERE {?_imAddress nco:imAvatar ?_imAvatar} ), ""), "\u001f",
79                                 fn:concat(?_imAddress, "\u001c",
80                                           tracker:coalesce((SELECT ?g5 WHERE { GRAPH ?g5 { ?_contact nco:hasIMAddress ?_imAddress } }), ""))),
81                       "\u001e")
82   WHERE { ?_contact nco:hasIMAddress ?_imAddress })
83
84  (SELECT
85   fn:concat(nie:url(?_photo), "\u001c",
86                          tracker:coalesce((SELECT ?g18 WHERE { GRAPH ?g18 { ?_contact nco:photo ?_photo } }),
87                                           ""))
88   WHERE {?_contact nco:photo ?_photo} )
89  (SELECT
90   fn:concat(nie:url(?_video), "\u001c",
91                          tracker:coalesce((SELECT ?g19 WHERE { GRAPH ?g19 { ?_contact nco:video ?_video } }),
92                                           ""))
93   WHERE {?_contact nco:video ?_video} )
94
95  (SELECT
96     GROUP_CONCAT(fn:concat(?_phoneNumber, "\u001f",
97                            fn:concat(nco:phoneNumber(?_phoneNumber),
98                                      "\u001c",
99                                      tracker:coalesce((SELECT ?g13 WHERE { GRAPH ?g13 { ?_contact nco:hasPhoneNumber ?_phoneNumber } }),
100                                                  "")), "\u001f",
101                            tracker:coalesce((SELECT GROUP_CONCAT(tracker:id(?_t), "\u001d")
102                                              WHERE {?_phoneNumber rdf:type ?_t}), ""), "\u001f",
103                            tracker:coalesce((SELECT GROUP_CONCAT(fn:concat(nao:propertyValue(?_p), "\u001c",
104                                                                            tracker:coalesce((SELECT ?g6 WHERE { GRAPH ?g6 { ?_phoneNumber nao:hasProperty ?_p } }), "")),
105                                                                  "\u001d")
106                                              WHERE {?_phoneNumber nao:hasProperty ?_p . ?_p nao:propertyName "SubTypes"}), "")),
107                  "\u001e")
108   WHERE { ?_contact nco:hasPhoneNumber ?_phoneNumber })
109
110  (SELECT
111     GROUP_CONCAT(fn:concat(?_onlinePresence, "\u001f",
112                            tracker:coalesce(nco:imNickname(?_onlinePresence, "\u002c", "\u001c"), ""), "\u001f",
113                            tracker:coalesce(nco:imStatusMessage(?_onlinePresence, "\u002c", "\u001c"), ""), "\u001f",
114                            tracker:coalesce(nco:presenceLastModified(?_onlinePresence, "\u002c", "\u001c"), ""), "\u001f",
115                            tracker:coalesce((SELECT
116                                                GROUP_CONCAT(fn:concat(tracker:id(?_presenceStatus), "\u001c",
117                                                                       tracker:coalesce((SELECT ?g8 WHERE { GRAPH ?g8 { ?_onlinePresence nco:imPresence ?_presenceStatus } }), "")),
118                                                             "\u001d")
119                                              WHERE {
120                                                ?_onlinePresence nco:imPresence ?_presenceStatus
121                                              }), ""), "\u001f",
122                            tracker:coalesce((SELECT
123                                                GROUP_CONCAT(fn:concat(tracker:id(?_authStatusFrom), "\u001c",
124                                                                       tracker:coalesce((SELECT ?g9 WHERE { GRAPH ?g9 { ?_onlinePresence nco:imAddressAuthStatusFrom ?_authStatusFrom } }), "")),
125                                                             "\u001d")
126                                              WHERE {
127                                                ?_onlinePresence nco:imAddressAuthStatusFrom ?_authStatusFrom
128                                              }), ""), "\u001f",
129                            tracker:coalesce((SELECT
130                                                GROUP_CONCAT(fn:concat(tracker:id(?_authStatusTo), "\u001c",
131                                                                       tracker:coalesce((SELECT ?g10 WHERE { GRAPH ?g10 { ?_onlinePresence nco:imAddressAuthStatusTo ?_authStatusTo } }), "")),
132                                                             "\u001d")
133                                              WHERE {
134                                                ?_onlinePresence nco:imAddressAuthStatusTo ?_authStatusTo
135                                              }), "")),
136                  "\u001e")
137   WHERE { ?_contact nco:hasIMAddress ?_onlinePresence })
138
139   maemo:relevance(?_contact, "\u002c", "\u001c")
140
141   (SELECT
142   fn:concat(nie:url(?_audioRingtone), "\u001c",
143                          tracker:coalesce((SELECT ?g15 WHERE { GRAPH ?g15 { ?_contact maemo:contactGroupAudioRingtone ?_audioRingtone } }),
144                                           ""))
145   WHERE {?_contact maemo:contactGroupAudioRingtone ?_audioRingtone} )
146   (SELECT
147   fn:concat(nie:url(?_videoRingtone), "\u001c",
148                          tracker:coalesce((SELECT ?g16 WHERE { GRAPH ?g16 { ?_contact maemo:contactGroupVideoRingtone ?_videoRingtone } }),
149                                           ""))
150   WHERE {?_contact maemo:contactGroupVideoRingtone ?_videoRingtone} )
151   (SELECT
152   fn:concat(nie:url(?_vibrationRingtone), "\u001c",
153                          tracker:coalesce((SELECT ?g17 WHERE { GRAPH ?g17 { ?_contact maemo:contactGroupVibrationRingtone ?_vibrationRingtone } }),
154                                           ""))
155   WHERE {?_contact maemo:contactGroupVibrationRingtone ?_vibrationRingtone} )
156
157   nie:generator(?_contact, "\u002c", "\u001c")
158
159  (SELECT GROUP_CONCAT(fn:concat(nao:prefLabel(?_tag), "\u001c",
160                            tracker:coalesce((SELECT ?g14 WHERE { GRAPH ?g14 { ?_contact nao:hasTag ?_tag } }), "")), "\u001e")
161   WHERE {?_contact nao:hasTag ?_tag})
162
163   nie:contentCreated(?_contact, "\u002c", "\u001c")
164   nie:contentLastModified(?_contact, "\u002c", "\u001c")
165   nie:contentAccessed(?_contact, "\u002c", "\u001c")
166
167  (SELECT GROUP_CONCAT(fn:concat(?_url, "\u001c",
168                                 tracker:coalesce((SELECT ?g WHERE { GRAPH ?g { ?_contact nco:url ?_url } }), "")), "\u001e")
169   WHERE { ?_contact nco:url ?_url })
170
171  nco:websiteUrl(?_contact, "\u001e", "\u001c")
172  nco:blogUrl(?_contact, "\u001e", "\u001c")
173
174  (SELECT
175     GROUP_CONCAT(fn:concat(nao:propertyName(?_customDetail), "\u001f",
176                            (SELECT
177                               GROUP_CONCAT(fn:concat(nao:propertyName(?_customField), "\u001f",
178                                                      (SELECT GROUP_CONCAT(fn:concat(tracker:id(?_customField), ":", ?_value), "\u001d")
179                                                       WHERE {?_customField nao:propertyValue ?_value})), "\u001f")
180                             WHERE {
181                               ?_customDetail nao:hasProperty ?_customField
182                             })),
183                  "\u001e")
184   WHERE {
185     ?_contact nao:hasProperty ?_customDetail
186   })
187
188 WHERE {
189   ?_contact rdf:type nco:ContactGroup, nco:Contact
190
191   OPTIONAL {?_contact nco:hasAffiliation ?_context}
192 }