[tracker/crawling-interval] Added updated message-related performance queries.



commit aa4168dda89533a52c78561fb08fa090d15db834
Author: Mikael Ottela <mikael ottela ixonos com>
Date:   Tue Apr 27 16:54:21 2010 +0300

    Added updated message-related performance queries.
    
    Added queries and fixed some issues in the data-generators.

 tests/functional-tests/performance-tc.py |  192 +++++++++++++++++++++++++++++-
 utils/data-generators/cc/nmo.py          |    8 ++
 2 files changed, 196 insertions(+), 4 deletions(-)
---
diff --git a/tests/functional-tests/performance-tc.py b/tests/functional-tests/performance-tc.py
index 19e43aa..4dc6593 100644
--- a/tests/functional-tests/performance-tc.py
+++ b/tests/functional-tests/performance-tc.py
@@ -259,11 +259,11 @@ class rtcom(TestUpdate):
 		result=self.resources.SparqlQuery(query)
 
         	elapse =time.time()-start
-        	print "Time taken for querying conversation list view  = %s " %elapse
+        	print "Time taken for querying (old) conversation list view  = %s " %elapse
 		print "no. of items retrieved: %d" %len(result)
 
 
-        def test_rtcom_02(self):
+        def p_test_rtcom_02(self):
 
 		# A version of the next one that skips the contact parts that are not generated properly
 
@@ -291,10 +291,10 @@ class rtcom(TestUpdate):
 		result=self.resources.SparqlQuery(query)
 
         	elapse =time.time()-start
-        	print "Time taken for querying conversation view (without contact info)  = %s " %elapse
+        	print "Time taken for querying (old) conversation view (without contact info)  = %s " %elapse
 		print "no. of items retrieved: %d" %len(result)
 
-        def test_rtcom_03(self):
+        def p_test_rtcom_03(self):
 
 		query = "SELECT ?msg ?date ?text ?contact \
 			WHERE { \
@@ -322,9 +322,193 @@ class rtcom(TestUpdate):
 		result=self.resources.SparqlQuery(query)
 
         	elapse =time.time()-start
+        	print "Time taken for querying (old) conversation view  = %s " %elapse
+		print "no. of items retrieved: %d" %len(result)
+
+        def p_test_rtcom_04(self):
+
+#
+# Current rtcom queries, please do not "quietly optimize".
+#
+
+		query = " \
+SELECT ?message ?date ?from ?to \
+     rdf:type(?message) \
+     tracker:coalesce(fn:concat(nco:nameGiven(?contact), ' ', nco:nameFamily(?contact)), nco:nickname(?contact)) \
+     nco:contactUID(?contact) \
+     nmo:communicationChannel(?message) \
+     nmo:isSent(?message) \
+     nmo:isDraft(?message) \
+     nmo:isRead(?message) \
+     nmo:isAnswered(?message) \
+     nmo:isDeleted(?message) \
+     nmo:messageId(?message) \
+     nmo:smsId(?message) \
+     nmo:sentDate(?message) \
+     nmo:receivedDate(?message) \
+     nie:contentLastModified(?message) \
+     nmo:messageSubject(?message) \
+     nie:plainTextContent(?message) \
+     nmo:deliveryStatus(?message) \
+     nmo:reportDelivery(?message) \
+     nie:url(?message) \
+     nfo:fileName(nmo:fromVCard(?message)) \
+     rdfs:label(nmo:fromVCard(?message)) \
+     nfo:fileName(nmo:toVCard(?message)) \
+     rdfs:label(nmo:toVCard(?message)) \
+     nmo:encoding(?message) \
+     nie:characterSet(?message) \
+     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 \
+      { \
+        ?contact a nco:PersonContact . \
+          { \
+            ?participant nco:hasIMAddress ?imaddress . \
+            ?contact nco:hasIMAddress ?imaddress . \
+          } \
+          UNION \
+          { \
+            ?participant nco:hasPhoneNumber ?participantNumber . \
+            ?participantNumber maemo:localPhoneNumber ?number . \
+            ?contact nco:hasPhoneNumber ?contactNumber . \
+            ?contactNumber maemo:localPhoneNumber ?number . \
+          } \
+      } \
+  } \
+} \
+ORDER BY DESC(?date) LIMIT 50\
+"
+
+        	start=time.time()
+
+		result=self.resources.SparqlQuery(query)
+
+        	elapse =time.time()-start
         	print "Time taken for querying conversation view  = %s " %elapse
 		print "no. of items retrieved: %d" %len(result)
 
+        def p_test_rtcom_05(self):
+#
+# Current rtcom queries, please do not "quietly optimize".
+#
+		query = " \
+SELECT ?channel ?participant ?subject nie:generator(?channel) ?contactName ?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 ?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 { \
+            ?contact a nco:PersonContact . \
+            { \
+              ?participant nco:hasIMAddress ?imaddress . \
+              ?contact nco:hasIMAddress ?imaddress . \
+            } \
+            UNION \
+            { \
+              ?participant nco:hasPhoneNumber ?participantNumber . \
+              ?number maemo:localPhoneNumber ?localNumber . \
+              ?contact nco:hasPhoneNumber ?contactNumber . \
+              ?contactNumber maemo:localPhoneNumber ?localNumber . \
+            } \
+        } \
+    } \
+} \
+ORDER BY DESC(?lastDate) LIMIT 50\
+"
+
+
+        	start=time.time()
+
+		result=self.resources.SparqlQuery(query)
+
+        	elapse =time.time()-start
+        	print "Time taken for querying conversation list  = %s " %elapse
+		print "no. of items retrieved: %d" %len(result)
+
+        def p_test_rtcom_06(self):
+#
+# Current rtcom queries, please do not "quietly optimize".
+#
+		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) \
+     nmo:sentDate(?call) \
+     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 \
+      { \
+        ?contact a nco:PersonContact . \
+        ?contact nco:contactUID ?contactId . \
+          { \
+            ?call nmo:to ?address . \
+          } \
+          UNION \
+          { \
+            ?call nmo:from ?address . \
+          } \
+          { \
+            ?address nco:hasIMAddress ?imaddress . \
+            ?contact nco:hasIMAddress ?imaddress . \
+          } \
+          UNION \
+          { \
+            ?address nco:hasPhoneNumber ?addressNumber . \
+            ?addressNumber maemo:localPhoneNumber ?number . \
+            ?contact nco:hasPhoneNumber ?contactNumber . \
+            ?contactNumber maemo:localPhoneNumber ?number . \
+          } \
+      } \
+  } \
+} \
+ORDER BY DESC(?date) LIMIT 50\
+"
+
+
+        	start=time.time()
+
+		result=self.resources.SparqlQuery(query)
+
+        	elapse =time.time()-start
+        	print "Time taken for querying call history  = %s " %elapse
+		print "no. of items retrieved: %d" %len(result)
 
 """ Audio, Video, Images  performance  test cases """
 class audio(TestUpdate):
diff --git a/utils/data-generators/cc/nmo.py b/utils/data-generators/cc/nmo.py
index 8f3dbb1..f80c23b 100644
--- a/utils/data-generators/cc/nmo.py
+++ b/utils/data-generators/cc/nmo.py
@@ -48,6 +48,8 @@ nmo_Email = '''
     nmo:receivedDate     "%(email_received)s" ;
     nmo:sender           <%(email_sender)s> ;
     nmo:from             <%(email_sender)s> ;
+    nmo:isDraft          "%(email_draft)s" ;
+    nmo:isDeleted        "%(email_deleted)s" ;
     nmo:sentDate         "%(email_sent)s" .
 '''
 def generateEmail(index):
@@ -65,6 +67,8 @@ def generateEmail(index):
   email_sender    = tools.getRandomUri( 'nco#PersonContact' )
   email_sent      = '%d-%02d-%02dT01:01:02Z' % (2000 + (index % 10), (index % 12) + 1, (index % 25) + 1)
   email_content   = gen.create_text(2,30)
+  email_draft     = 'false'
+  email_deleted   = 'false'
 
   tools.addItem( me, email_uri, nmo_Email % locals() )
 
@@ -103,6 +107,7 @@ nmo_IMMessage = '''
   nmo:messageId              "%(immessage_message_id)s" ;
   nmo:receivedDate           "%(immessage_received)s" ;
   nmo:sentDate               "%(immessage_sent_date)s" ;
+  nmo:isDeleted              "%(immessage_deleted)s" ;
   nmo:communicationChannel   <%(immessage_channel_uri)s> .
 '''
 def generateIMMessage(index):
@@ -116,6 +121,7 @@ def generateIMMessage(index):
   immessage_draft       = ('false', 'true')[index % 2]
   immessage_read        = ('false', 'true')[index % 2]
   immessage_sent        = 'true'
+  immessage_deleted     = 'false'
   immessage_message_id  = '%d' % index
   immessage_received    = tools.now
   immessage_sent_date   = tools.now
@@ -140,6 +146,7 @@ nmo_SMSMessage = '''
   nmo:messageId              "%(smsmessage_message_id)s" ;
   nmo:receivedDate           "%(smsmessage_received)s" ;
   nmo:sentDate               "%(smsmessage_sent_date)s" ;
+  nmo:isDeleted              "%(smsmessage_deleted)s" ;
   nmo:communicationChannel   <%(smsmessage_channel_uri)s> .
 '''
 def generateSMSMessage(index):
@@ -154,6 +161,7 @@ def generateSMSMessage(index):
   smsmessage_draft       = ('false', 'true')[index % 2]
   smsmessage_read        = ('false', 'true')[index % 2]
   smsmessage_sent        = 'true'
+  smsmessage_deleted     = 'false'
   smsmessage_message_id  = '%d' % index
   smsmessage_received    = tools.now
   smsmessage_sent_date   = tools.now



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]