[tracker/rtcom] Functional tests: Experimental rtcom query improvements
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/rtcom] Functional tests: Experimental rtcom query improvements
- Date: Sat, 15 May 2010 15:50:16 +0000 (UTC)
commit 8cd048f6b8109d5f0725844c90acdccd6039484c
Author: Jürg Billeter <j bitron ch>
Date: Sat May 15 17:49:05 2010 +0200
Functional tests: Experimental rtcom query improvements
tests/functional-tests/performance-tc.py | 85 +++++++++++++++++-------------
1 files changed, 49 insertions(+), 36 deletions(-)
---
diff --git a/tests/functional-tests/performance-tc.py b/tests/functional-tests/performance-tc.py
index dc01aca..3c4d103 100644
--- a/tests/functional-tests/performance-tc.py
+++ b/tests/functional-tests/performance-tc.py
@@ -331,6 +331,8 @@ class rtcom(TestUpdate):
# Current rtcom queries, please do not "quietly optimize".
#
+# requires secondary index support to be fast
+
query = " \
SELECT ?message ?date ?from ?to \
rdf:type(?message) \
@@ -361,19 +363,12 @@ SELECT ?message ?date ?from ?to \
nie:language(?message) \
WHERE \
{ \
- { \
- ?message a nmo:Message . \
- ?message nmo:isDraft false . \
- ?message nmo:isDeleted false . \
- ?message nmo:receivedDate ?date . \
- ?message nmo:from ?fromContact . \
- ?message nmo:to ?toContact . \
- ?fromContact nco:hasContactMedium ?from . \
- ?toContact nco:hasContactMedium ?to . \
- ?message nmo:communicationChannel <urn:channel:1> . \
- <urn:channel:1> nmo:hasParticipant ?participant . \
- OPTIONAL \
+ SELECT \
+ ?message \
+ (SELECT ?contact \
+ WHERE \
{ \
+ <urn:channel:1> nmo:hasParticipant ?participant . \
?contact a nco:PersonContact . \
{ \
?participant nco:hasIMAddress ?imaddress . \
@@ -387,9 +382,22 @@ WHERE \
?contactNumber maemo:localPhoneNumber ?number . \
} \
} \
+ ) AS ?contact \
+ WHERE \
+ { \
+ ?message a nmo:Message . \
+ ?message nmo:isDraft false . \
+ ?message nmo:isDeleted false . \
+ ?message nmo:sentDate ?date . \
+ ?message nmo:from ?fromContact . \
+ ?message nmo:to ?toContact . \
+ ?fromContact nco:hasContactMedium ?from . \
+ ?toContact nco:hasContactMedium ?to . \
+ ?message nmo:communicationChannel <urn:channel:1> . \
} \
+ ORDER BY DESC(?date) \
} \
-ORDER BY DESC(?date) LIMIT 50\
+LIMIT 50 \
"
start=time.time()
@@ -405,22 +413,22 @@ ORDER BY DESC(?date) LIMIT 50\
# Current rtcom queries, please do not "quietly optimize".
#
query = " \
-SELECT ?channel ?participant ?subject nie:generator(?channel) ?contactName ?contactUID ?lastDate ?lastMessage nie:plainTextContent(?lastMessage) \
+SELECT ?channel ?subject nie:generator(?channel) \
+ tracker:coalesce(fn:concat(nco:nameGiven(?contact), ' ', nco:nameFamily(?contact)), nco:nickname(?contact)) AS ?contactName \
+ nco:contactUID(?contact) AS ?contactUID \
+ ?lastDate ?lastMessage nie:plainTextContent(?lastMessage) \
nfo:fileName(nmo:fromVCard(?lastMessage)) \
rdfs:label(nmo:fromVCard(?lastMessage)) \
( SELECT COUNT(?message) AS ?total_messages WHERE { ?message nmo:communicationChannel ?channel . }) \
( SELECT COUNT(?message) AS ?total_unread WHERE { ?message nmo:communicationChannel ?channel . ?message nmo:isRead false .}) \
( SELECT COUNT(?message) AS ?_total_sent WHERE { ?message nmo:communicationChannel ?channel . ?message nmo:isSent true . }) \
WHERE { \
- SELECT ?channel ?participant nco:contactUID(?contact) AS ?contactUID ?subject ?lastDate \
- tracker:coalesce(fn:concat(nco:nameGiven(?contact), ' ', nco:nameFamily(?contact)), nco:nickname(?contact)) AS ?contactName \
+ SELECT ?channel ?subject ?lastDate \
+ \
( SELECT ?message WHERE {?message nmo:communicationChannel ?channel . ?message nmo:sentDate ?sentDate .} ORDER BY DESC(?sentDate) LIMIT 1) AS ?lastMessage \
- WHERE { \
- ?channel a nmo:CommunicationChannel . \
- ?channel nmo:hasParticipant ?participant . \
- ?channel nie:subject ?subject . \
- ?channel nmo:lastMessageDate ?lastDate . \
- OPTIONAL { \
+ (SELECT ?contact \
+ WHERE { \
+ ?channel nmo:hasParticipant ?participant . \
?contact a nco:PersonContact . \
{ \
?participant nco:hasIMAddress ?imaddress . \
@@ -433,7 +441,11 @@ WHERE { \
?contact nco:hasPhoneNumber ?contactNumber . \
?contactNumber maemo:localPhoneNumber ?localNumber . \
} \
- } \
+ }) AS ?contact \
+ WHERE { \
+ ?channel a nmo:CommunicationChannel . \
+ ?channel nie:subject ?subject . \
+ ?channel nmo:lastMessageDate ?lastDate . \
} \
} \
ORDER BY DESC(?lastDate) LIMIT 50\
@@ -455,8 +467,6 @@ ORDER BY DESC(?lastDate) LIMIT 50\
query = " \
SELECT ?call ?date ?from ?to \
rdf:type(?call) \
- tracker:coalesce(fn:concat(nco:nameGiven(?contact), ' ', nco:nameFamily(?contact)), nco:nickname(?contact)) \
- ?contactId \
nmo:isSent(?call) \
nmo:isAnswered(?call) \
nmo:isRead(?call) \
@@ -464,16 +474,8 @@ SELECT ?call ?date ?from ?to \
nmo:receivedDate(?call) \
nmo:duration(?call) \
nie:contentLastModified(?call) \
-WHERE \
-{ \
- { \
- ?call a nmo:Call . \
- ?call nmo:receivedDate ?date . \
- ?call nmo:from ?fromContact . \
- ?call nmo:to ?toContact . \
- ?fromContact nco:hasContactMedium ?from . \
- ?toContact nco:hasContactMedium ?to . \
- OPTIONAL \
+ (SELECT ?contact \
+ WHERE \
{ \
?contact a nco:PersonContact . \
?contact nco:contactUID ?contactId . \
@@ -495,13 +497,24 @@ WHERE \
?contact nco:hasPhoneNumber ?contactNumber . \
?contactNumber maemo:localPhoneNumber ?number . \
} \
- } \
+ }) \
+WHERE \
+{ \
+ { \
+ ?call a nmo:Call . \
+ ?call nmo:sentDate ?date . \
+ ?call nmo:from ?fromContact . \
+ ?call nmo:to ?toContact . \
+ ?fromContact nco:hasContactMedium ?from . \
+ ?toContact nco:hasContactMedium ?to . \
} \
} \
ORDER BY DESC(?date) LIMIT 50\
"
+
+
start=time.time()
result=self.resources.SparqlQuery(query)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]