summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2015-10-11 09:55:58 +0200
committerSam Thursfield <sam@afuera.me.uk>2015-10-11 09:59:57 +0200
commitba611fdcf2cfa19e5753fcb8e515e82b11e1825b (patch)
tree6de01192ec863c69c4838039bbc339e72b24b6c2
parent6631708134d0e0066cd775ee2000a56002c3e503 (diff)
downloadtracker-ba611fdcf2cfa19e5753fcb8e515e82b11e1825b.tar.gz
functional-tests Remove some outdated and unused tests
Also, the test-runner.sh now runs all .py files, instead of just those marked executable.
-rw-r--r--tests/functional-tests/Makefile.am5
-rw-r--r--tests/functional-tests/fts-tc.py728
-rw-r--r--tests/functional-tests/mass-storage-mode.py783
-rw-r--r--tests/functional-tests/performance-tc-modified.py3506
-rw-r--r--tests/functional-tests/performance-tc.py2426
-rwxr-xr-xtests/functional-tests/test-runner.sh5
-rw-r--r--tests/functional-tests/virtual-files-tc.py167
7 files changed, 1 insertions, 7619 deletions
diff --git a/tests/functional-tests/Makefile.am b/tests/functional-tests/Makefile.am
index 947745eef..edd91be63 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -52,10 +52,7 @@ standard_tests += \
500-writeback.py \
501-writeback-details.py \
600-applications-camera.py \
- 601-applications-sync.py \
- mass-storage-mode.py \
- performance-tc-modified.py \
- virtual-files-tc.py
+ 601-applications-sync.py
slow_tests = \
10-sqlite-misused.py \
diff --git a/tests/functional-tests/fts-tc.py b/tests/functional-tests/fts-tc.py
deleted file mode 100644
index 4e36e7a8d..000000000
--- a/tests/functional-tests/fts-tc.py
+++ /dev/null
@@ -1,728 +0,0 @@
-#!/usr/bin/env python
-#-*- coding: latin-1 -*-
-
-
-# Copyright (C) 2008, Nokia (urho.konttori@nokia.com)
-#
-# 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, write to the
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-
-import sys,os,dbus
-import unittest
-import time
-import random
-import commands
-import configuration
-from dbus.mainloop.glib import DBusGMainLoop
-from gi.repository import GObject
-import shutil
-from subprocess import Popen,PIPE
-
-TRACKER = 'org.freedesktop.Tracker1'
-
-TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources'
-RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
-
-
-MINER="org.freedesktop.Tracker1.Miner.Files"
-MINER_OBJ="/org/freedesktop/Tracker1/Miner/Files"
-MINER_IFACE="org.freedesktop.Tracker1.Miner"
-
-TEST_IMAGE = "test-image-1.jpg"
-TEST_MUSIC = "tracker-mp3-test.mp3"
-TEST_VIDEO = "test-video.mp4"
-TEST_TEXT = "test-text-01.txt"
-TEST_TEXT_02 = "test-text-02.txt"
-TEST_TEXT_03 = "test-text-03.txt"
-TEXT_DB = "/home/user/.cache/tracker/fulltext.db"
-
-MOUNT_DUMMY = '/root/dummy/'
-MYDOCS = configuration.MYDOCS
-MOUNT_PARTITION = '/dev/mmcblk0p1'
-
-"""create two test directories in miner monitored path """
-target = configuration.check_target()
-
-if target == configuration.MAEMO6_HW:
- """target is device """
- TEST_DIR_1 = configuration.MYDOCS + "tracker_test_op_1"
- TEST_DIR_2 = configuration.MYDOCS + "tracker_test_op_2"
- """create a test directory in miner un-monitored path """
- #TEST_DIR_3 = configuration.TEST_DIR + "tracker_test_op_3"
- TEST_DIR_3 = configuration.MYDOCS + "core-dumps/" + "tracker_test_op_3"
- SRC_IMAGE_DIR = configuration.TEST_DATA_IMAGES
- SRC_MUSIC_DIR = configuration.TEST_DATA_MUSIC
- SRC_VIDEO_DIR = configuration.TEST_DATA_VIDEO
- SRC_TEXT_DIR = configuration.TEST_DATA_TEXT
- MYDOCS_SUB = configuration.MYDOCS + 's1/s2/s3/s4/s5/'
-
-elif target == configuration.DESKTOP:
- """target is DESKTOP """
- TEST_DIR_1 = os.path.expanduser("~") + '/' + "tracker_test_op_1"
- TEST_DIR_2 = os.path.expanduser("~") + '/' + "tracker_test_op_2"
- TEST_DIR_3 = os.path.expanduser("~") + '/' + "core-dumps/" + "tracker_test_op_3"
- SRC_IMAGE_DIR = configuration.VCS_TEST_DATA_IMAGES
- SRC_MUSIC_DIR = configuration.VCS_TEST_DATA_MUSIC
- SRC_VIDEO_DIR = configuration.VCS_TEST_DATA_VIDEO
- MYDOCS_SUB = os.path.expanduser("~") + 's1/s2/s3/s4/s5/'
-
-commands.getoutput('mkdir ' + TEST_DIR_1)
-
-"""creating hidden directory """
-HIDDEN_DIR = configuration.MYDOCS + '.test_hidden'
-commands.getoutput('mkdir -p ' + HIDDEN_DIR)
-
-tdcpy = configuration.TDCopy()
-tdcpy.set_test_data(target)
-
-"""creating text file"""
-
-print SRC_TEXT_DIR+TEST_TEXT
-f1=open(SRC_TEXT_DIR+TEST_TEXT,'w')
-
-lines = "The Content framework subsystem provides data and metadata storage and retrieval for the platform. Its stack contains\
- * A store of information (tracker) based on the triplet-store concept including a specific query language (SparQL, W3C standard)\
- * A convenience library (libQtTracker) with common functionality for all client applications \
- * A set of widgets for tagging and content browsing (subject of its own architecture document) \
- * A daemon to create thumbnails (Tumbler) \
- * A library (libthumbnailer) for a convenient access to the thumbnail daemon \
- "
-f1.write(lines)
-f1.close()
-
-class TestUpdate (unittest.TestCase):
-
- def setUp(self):
- bus = dbus.SessionBus()
- tracker = bus.get_object(TRACKER, TRACKER_OBJ)
- self.resources = dbus.Interface (tracker,
- dbus_interface=RESOURCES_IFACE)
-
- miner_obj= bus.get_object(MINER,MINER_OBJ)
- self.miner=dbus.Interface (miner_obj,dbus_interface=MINER_IFACE)
-
-
- self.loop = GObject.MainLoop()
- self.dbus_loop = DBusGMainLoop(set_as_default=True)
- self.bus = dbus.SessionBus (self.dbus_loop)
-
- self.bus.add_signal_receiver (self.miner_processing_cb,
- signal_name="Progress",
- dbus_interface=MINER_IFACE,
- path=MINER_OBJ)
-
- def miner_processing_cb (self,status,handle):
- print "GOT PROGRESS FROM MINER"
-
- if (status == "Processing Files") :
- print "Miner started"
- elif (status == "Idle" ):
- """if the string is "Idle" quit the loop """
- print "Miner Idle"
- self.loop.quit()
- else :
- print "No specific Signal"
-
- def wait_for_fileop (self, cmd, src, dst=''):
- if (cmd == "rm"):
- os.remove(src)
- elif (cmd == "cp"):
- shutil.copy2(src, dst)
- else:
- shutil.move(src,dst)
- self.loop.run()
-
- def edit_text (self, file,word) :
- test_file = file
- f=open(test_file,"w")
- f.writelines(word)
- f.close()
-
-class basic (TestUpdate) :
-
- def test_text_01 (self) :
-
- """ To check if tracker search for a long word gives results """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- time.sleep(1)
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
-
- word = "fsfsfsdfskfweeqrewqkmnbbvkdasdjefjewriqjfnc"
-
- self.edit_text(file_path,word)
-
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + word + '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the word is not giving results')
- os.remove(file_path)
-
- def test_text_02 (self) :
-
- """ To check if tracker search for a word gives results """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- word = "this is a meego file "
- search_word = "meego"
-
- self.edit_text(file_path,word)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + search_word+ '|grep '+file_path+ '|wc -l ' )
- print result
- self.assert_(result=='1','search for the word is not giving results')
-
- os.remove (file_path)
-
- def test_text_03 (self) :
-
- """ To check if tracker search for a non existing word gives results """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- word = "trick "
- search_word = "trikc"
-
- self.edit_text(file_path,word)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + search_word + '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='0','search for the non existing word is giving results')
-
- os.remove (file_path)
-
- def test_text_04 (self) :
-
- """ To check if tracker search for a word gives results (File contains same word multiple times)"""
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence= "this is a crazy day. i m feeling crazy. rnt u crazy. everyone is crazy."
- search_word = "crazy"
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + search_word + '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the word not giving results')
-
- os.remove (file_path)
-
- def test_text_05 (self) :
-
- """ To check if tracker search for sentence gives results """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence= " 'this is a lazy fox. '"
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' +sentence+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the sentence is not giving results')
-
- os.remove (file_path)
-
-
- def test_text_06 (self) :
-
- """ To check if tracker search for part of sentenece gives results """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence= " 'this is a lazy fox. '"
- search_sentence = " 'this is a lazy '"
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + search_sentence+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the sentence is not giving results')
-
- os.remove (file_path)
-
-
- def test_text_07 (self) :
-
- """ To check if tracker search for sentenece gives results """
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence= " 'summer.time '"
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + sentence+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the sentence is not giving results')
-
- os.remove (file_path)
-
-
- def test_text_08 (self) :
-
- """ To check if tracker search for sentenece gives results """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence= " 'summer.time '"
- search_word = '.'
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + search_word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='0','search for the word is not giving results')
-
- os.remove (file_path)
-
- def test_text_09 (self) :
-
- """ To check if tracker search for a word (combination of alphabets and numbers) gives results """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- word = "abc123"
-
- self.edit_text(file_path,word)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the word is not giving results')
-
- os.remove (file_path)
-
- def test_text_10 (self) :
- """ To check if tracker search for a number (from a combination of alphabets and numbers) gives results """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence = "abc 123"
- search_word = "123"
-
- self.edit_text(file_path,search_word)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + search_word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='0','search for the word is not giving results')
-
- os.remove (file_path)
-
- def test_text_12 (self) :
-
- """ To check if tracker search for a word(file which contains this file is removed) gives result"""
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- word = "abc"
- self.edit_text(file_path,word)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' + word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the word is not giving results')
-
- self.wait_for_fileop('rm' , file_path)
-
- result=commands.getoutput ('tracker search ' + word+ '|grep '+file_path+ '|wc -l ')
-
- result1=commands.getoutput ('tracker search ' + word+ '|grep '+file_path)
- print result1
- print result
- self.assert_(result=='0','search for the non existing files giving results')
-
- def test_text_13 (self) :
-
- """ To check if tracker search for a word in different text files with similar 3 letter words and search for the word gives result """
-
- file_path = configuration.MYDOCS + TEST_TEXT
- file_path_02 = configuration.MYDOCS + TEST_TEXT_02
- file_path_03 = configuration.MYDOCS + TEST_TEXT_03
-
- """copy the test files """
-
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence= " 'feet '"
- self.edit_text(file_path,sentence)
- self.loop.run()
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path_02)
- sentence= " 'feel '"
- self.edit_text(file_path_02,sentence)
- self.loop.run()
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path_03)
- sentence= " 'fee '"
- self.edit_text(file_path_03,sentence)
- self.loop.run()
-
- search_word = 'feet'
- result=commands.getoutput ('tracker search ' + search_word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the word is not giving results')
-
- os.remove (file_path)
- os.remove (file_path_02)
- os.remove (file_path_03)
-
- def test_text_14 (self) :
-
- """ To check if tracker search for a word in unwatched directory and gives result"""
-
- file_path = "/root/" + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- word = "framework"
-
- result=commands.getoutput ('tracker search ' + word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='0','search for the word is not giving results')
-
- os.remove (file_path)
-
- def test_text_15 (self) :
-
- """ To check if tracker search for a word(file which is copied from no watch directories to watched directories) gives results """
-
- FILE_NAME = "/root/" + TEST_TEXT
- file_path = configuration.MYDOCS + TEST_TEXT
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- word= "The Content framework subsystem provides data"
-
- self.edit_text(FILE_NAME,word)
-
- """copy the test files """
- self.wait_for_fileop('cp', FILE_NAME, file_path)
-
- word = "framework"
-
- result=commands.getoutput ('tracker search ' + word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the word is giving results')
-
- os.remove (file_path)
-
- def test_text_16 (self) :
-
- """ To check if tracker search for a word(file which is in hidden directory) gives result"""
- file_path = HIDDEN_DIR+TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT , file_path)
- word = "framework"
-
- result=commands.getoutput ('tracker search ' + word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='0','search for the word is giving results')
-
- os.remove (file_path)
-
-
-class stopwords (TestUpdate):
-
- def test_sw_01 (self) :
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- test_file='/usr/share/tracker/stop-words/stopwords.en'
- f1=open(test_file,'r')
- lines = f1.readlines()
- f1.close()
- list = []
- for word in lines:
- result=Popen(['tracker-search',word],stdout=PIPE).stdout.read().split()
- if result[1] == '1':
- list.append(word)
- self.assert_(len(list) == 0 , 'tracker search is giving results for stopwords %s '%list)
-
- def test_sw_02 (self) :
-
- word= "AND"
- result=Popen(['tracker-search',word],stdout=PIPE).stdout.read().split()
- self.assert_(result[1] == '0' , 'tracker search is giving results for stopwords')
-
-class db_text ( TestUpdate ) :
-
- def test_db_01 (self):
- file_path = configuration.MYDOCS + TEST_TEXT
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- word = "summer"
- self.edit_text(file_path,word)
- time.sleep(2)
- result=commands.getoutput ('tracker search ' + word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the word is not giving results')
- commands.getoutput('cp '+SRC_IMAGE_DIR+TEST_IMAGE+ ' '+TEXT_DB)
- time.sleep(1)
- result=commands.getoutput ('tracker search ' + word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the word is not giving results')
-
-
-
-
-class msm (TestUpdate) :
-
- def test_msm_01 (self) :
-
- """ To check if tracker search gives results for the word search which is copied in mass storage mode """
-
- commands.getoutput ('umount ' + MOUNT_PARTITION )
- commands.getoutput ('mount -t vfat -o rw ' +MOUNT_PARTITION+' '+MOUNT_DUMMY)
-
- dummy_path = MOUNT_DUMMY + TEST_TEXT
- file_path = configuration.MYDOCS+TEST_TEXT
- commands.getoutput('cp '+SRC_TEXT_DIR + TEST_TEXT +' '+ dummy_path)
-
- commands.getoutput ('umount ' + MOUNT_PARTITION )
- commands.getoutput ('mount -t vfat -o rw ' +MOUNT_PARTITION+' '+MYDOCS)
- time.sleep(10)
- search_word = "information"
- result=commands.getoutput ('tracker search ' + search_word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the word is not giving results')
-
-class specialchar (TestUpdate) :
-
- def test_sc_01 (self):
- """ To check if tracker search for non English characters """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence= " 'andaübÃc' Ã"
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' +sentence+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the sentence is not giving results')
-
- os.remove (file_path)
-
- def test_cs_02 (self):
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
-
- sentence = "выйшщхжюб"
-
- self.edit_text(file_path,sentence)
-
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' +sentence+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the sentence is not giving results')
-
- os.remove (file_path)
-
- def test_cs_03 (self) :
-
- """ To check if tracker search for non English characters """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence = " 'кÑ<80>аÑ<81>Ð' "
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' +sentence+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the sentence is not giving results')
-
- os.remove (file_path)
-
- def test_cs_04 (self) :
-
- """ To check if tracker search for non English accented characters """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence = " 'aüéâbc äàç xêëèïyz üéâäàçêëèï and aübêcëdçeï' "
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' +sentence+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the sentence is not giving results')
-
- os.remove (file_path)
-
- def test_cs_05 (self) :
-
- """ To check if tracker search for combination of English characters and accented characters"""
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence = " 'beautiful and xêëèïyz üéâäàçêëèï and aübêcëdçeï' "
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' +sentence+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the sentence is not giving results')
-
- os.remove (file_path)
-
- def test_cs_06 (self):
-
- """ To check if tracker search for normalisation """
-
- file_path = configuration.MYDOCS + TEST_TEXT
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)
- sentence = "école"
- word = " 'ecole' "
-
- self.edit_text(file_path,sentence)
- self.loop.run()
-
- result=commands.getoutput ('tracker search ' +word+ '|grep '+file_path+ '|wc -l ')
- print result
- self.assert_(result=='1','search for the sentence is not giving results')
-
- os.remove (file_path)
-
-class applications (TestUpdate) :
-
- def test_app_Images (self) :
-
- result= commands.getoutput ('tracker search -i ' + TEST_IMAGE+ '|wc -l')
- self.assert_(result!=0 , 'tracker search for images is not giving results')
-
-
- def test_app_Music (self) :
-
- result= commands.getoutput ('tracker search -m ' + TEST_MUSIC+ '|wc -l')
- self.assert_(result!=0 , 'tracker search for music is not giving results')
-
- def test_app_Vidoes (self) :
-
- result= commands.getoutput ('tracker search -v ' + TEST_VIDEO+ '|wc -l')
- self.assert_(result!=0 , 'tracker search for Videos is not giving results')
-
-
- def test_app_music_albums (self) :
-
- result= commands.getoutput ('tracker search --music-albums SinCos | wc -l')
- self.assert_(result!=0 , 'tracker search for music albums is not giving results')
-
-
- def test_app_music_artists (self) :
-
- result= commands.getoutput ('tracker search --music-artists AbBaby | wc -l')
- self.assert_(result!=0 , 'tracker search for music artists is not giving results')
-
- def test_app_folders (self) :
-
- result= commands.getoutput ('tracker search -s '+TEST_DIR_1 + '| wc -l')
- self.assert_(result!=0 , 'tracker search for folders is not giving results')
-
-
- def test_app_email (self) :
-
- INSERT = """ INSERT {<qmf://fenix.nokia.com/email#3333> a nmo:Email ;
- nmo:receivedDate '2010-05-24T15:17:26Z' ;
- nmo:messageSubject 'searching_for_Email' }
- """
- self.resources_new.SparqlUpdate (INSERT)
-
- result = commands.getoutput ('tracker search -ea searching_for_Email |wc -l ')
- self.assert_(result!=0 , 'tracker search for files is not giving results')
-
- def test_app_email (self) :
-
- INSERT = """ INSERT {<qmf://fenix.nokia.com/email#3333> a nmo:Email ;
- nmo:receivedDate '2010-05-24T15:17:26Z' ;
- nmo:messageSubject 'searching_for_Email' }
- """
- #self.resources.SparqlUpdate (INSERT)
- self.resources.SparqlUpdate (INSERT)
-
- result = commands.getoutput ('tracker search -ea searching_for_Email |wc -l ')
- self.assert_(result!=0 , 'tracker search for files is not giving results')
-
-
-if __name__ == "__main__":
- unittest.main()
- """
- basic_tcs_list=unittest.TestLoader().getTestCaseNames(basic)
- basic_testsuite=unittest.TestSuite(map(basic, basic_tcs_list))
-
- db_text_tcs_list=unittest.TestLoader().getTestCaseNames(db_text)
- db_text_testsuite=unittest.TestSuite(map(db_text, db_text_tcs_list))
- msm_tcs_list=unittest.TestLoader().getTestCaseNames(msm)
- msm_testsuite=unittest.TestSuite(map(msm, msm_tcs_list))
-
- stopwords_tcs_list=unittest.TestLoader().getTestCaseNames(stopwords)
- stopwords_testsuite=unittest.TestSuite(map(stopwords, stopwords_tcs_list))
-
- applications_tcs_list=unittest.TestLoader().getTestCaseNames(applications)
- applications_testsuite=unittest.TestSuite(map(applications, applications_tcs_list))
-
- specialchar_tcs_list=unittest.TestLoader().getTestCaseNames(specialchar)
- specialchar_testsuite=unittest.TestSuite(map(specialchar, specialchar_tcs_list))
-
- all_testsuites = unittest.TestSuite(specialchar_testsuite)
- unittest.TextTestRunner(verbosity=2).run(all_testsuites)
- """
diff --git a/tests/functional-tests/mass-storage-mode.py b/tests/functional-tests/mass-storage-mode.py
deleted file mode 100644
index 9e8316c9a..000000000
--- a/tests/functional-tests/mass-storage-mode.py
+++ /dev/null
@@ -1,783 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2008, Nokia (urho.konttori@nokia.com)
-#
-# 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, write to the
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-
-import sys,os,dbus
-import unittest
-import time
-import random
-import commands
-import configuration
-from dbus.mainloop.glib import DBusGMainLoop
-from gi.repository import GObject
-import shutil
-
-TRACKER = 'org.freedesktop.Tracker1'
-TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources/Classes'
-RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources.Class"
-
-MINER="org.freedesktop.Tracker1.Miner.Files"
-MINER_OBJ="/org/freedesktop/Tracker1/Miner/Files"
-MINER_IFACE="org.freedesktop.Tracker1.Miner"
-
-
-
-TEST_IMAGE = "test-image-1.jpg"
-TEST_MUSIC = "tracker-mp3-test.mp3"
-TEST_VIDEO = "test-video.mp4"
-TEST_TEXT = "test-text-01.txt"
-
-MOUNT_DUMMY = '/root/dummy/'
-MYDOCS = configuration.MYDOCS
-MOUNT_PARTITION = '/dev/mmcblk0p1'
-
-SUB_FOLDER_DUMMY = MOUNT_DUMMY + '/' + 's1/s2/s3/s4/s5/'
-SUB_FOLDER_MYDOCS = MYDOCS + 's1/s2/s3/s4/s5/'
-
-
-DUMMY_DIR = '/root/dummy/TEST_DIR/'
-MYDOCS_DIR = '/home/user/MyDocs/TEST_DIR/'
-
-RENAME_IMAGE = 'rename_image.jpg'
-RENAME_MUSIC = 'rename_song.mp3'
-RENAME_VIDEO = 'rename_video.mp4'
-"""create two test directories in miner monitored path """
-target = configuration.check_target()
-
-def check_mount() :
- if not os.path.exists (MOUNT_DUMMY) :
- commands.getoutput ('mkdir ' + MOUNT_DUMMY)
-
- commands.getoutput ('umount ' + MOUNT_PARTITION )
-
- if commands.getoutput('df').find('/home/user/MyDocs') == -1 and commands.getoutput('df').find('/dev/mmcblk0p1') == -1 :
- print 'in else if'
- commands.getoutput ('mount ' + MOUNT_PARTITION + ' ' + MYDOCS )
- else :
- print "in else else"
- commands.getoutput ('umount ' + MOUNT_PARTITION )
- commands.getoutput ('mount ' + MOUNT_PARTITION + ' ' + MYDOCS )
-
-
-if target == configuration.MAEMO6_HW:
- """target is device """
- SRC_IMAGE_DIR = configuration.TEST_DATA_IMAGES
- SRC_MUSIC_DIR = configuration.TEST_DATA_MUSIC
- SRC_VIDEO_DIR = configuration.TEST_DATA_VIDEO
- MYDOCS_SUB = configuration.MYDOCS + 's1/s2/s3/s4/s5/'
-
-
-class TestUpdate (unittest.TestCase):
-
- def setUp(self):
- bus = dbus.SessionBus()
- tracker = bus.get_object(TRACKER, TRACKER_OBJ)
- self.resources = dbus.Interface (tracker,
- dbus_interface=RESOURCES_IFACE)
-
- miner_obj= bus.get_object(MINER,MINER_OBJ)
- self.miner=dbus.Interface (miner_obj,dbus_interface=MINER_IFACE)
-
-
- self.loop = GObject.MainLoop()
- self.dbus_loop = DBusGMainLoop(set_as_default=True)
- self.bus = dbus.SessionBus (self.dbus_loop)
-
- self.bus.add_signal_receiver (self.miner_processing_cb,
- signal_name="Progress",
- dbus_interface=MINER_IFACE,
- path=MINER_OBJ)
-
-
-
- def miner_processing_cb (self,status,handle):
- print "GOT PROGRESS FROM MINER"
- if (status == "Idle" ):
- print "Miner is in idle status "
- self.loop.quit ()
- else :
- print "Miner not in Idle "
-
- def wait_for_fileop (self, cmd, src, dst=''):
-
- if (cmd == "rm"):
- os.remove(src)
- elif (cmd == "cp"):
- shutil.copy2(src, dst)
- else:
- shutil.move(src,dst)
- self.loop.run()
-
- def edit_text (self, file) :
- test_file = MOUNT_DUMMY + file
- f=open(test_file,"w")
- lines = "Editing this file to test massstorage mode"
- f.writelines(lines)
- f.close()
-
-""" copy in mass storage mode test cases """
-class copy (TestUpdate):
-
- def test_image_01 (self):
-
- """ To check if tracker indexes image file copied in massstorage mode """
-
- file_path = MYDOCS + TEST_IMAGE
-
- check_mount()
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
-
- """copy the test file """
- shutil.copy2(SRC_IMAGE_DIR + TEST_IMAGE, MOUNT_DUMMY)
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
-
- print commands.getoutput ( 'ls ' + MYDOCS)
-
- self.loop.run ()
-
- """ verify if miner indexed these file. """
- result = commands.getoutput ('tracker search --limit=10000 -i | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '1' , 'copied image file is not shown as indexed')
-
- os.remove(file_path)
-
- def test_music_02 (self):
-
- """ To check if tracker indexes audio file copied in massstorage mode """
-
- file_path = MYDOCS + TEST_MUSIC
-
- check_mount()
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- """copy the test files """
- shutil.copy2(SRC_MUSIC_DIR + TEST_MUSIC, MOUNT_DUMMY)
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
- print commands.getoutput ( 'ls ' + MYDOCS)
-
- self.loop.run ()
-
- """ verify if miner indexed these file. """
- result = commands.getoutput ('tracker search --limit=10000 -m | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '1' , 'copied music file is not shown as indexed')
-
- os.remove(file_path)
-
- def test_video_03 (self):
-
- """ To check if tracker indexes video file copied in massstorage mode """
-
- file_path = MYDOCS + TEST_VIDEO
-
- check_mount()
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- """copy the test files """
- shutil.copy2(SRC_VIDEO_DIR + TEST_VIDEO, MOUNT_DUMMY)
-
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
-
- print commands.getoutput ( 'ls ' + MYDOCS)
-
- self.loop.run ()
-
- """ verify if miner indexed these file. """
- result = commands.getoutput ('tracker search --limit=10000 -v | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '1' , 'copied video file is not shown as indexed')
-
- os.remove(file_path)
-
-
-""" move in mass storage mode"""
-class move (TestUpdate):
-
-
- def test_image_01 (self):
-
- """ To check if tracker indexes moved image file in massstorage mode """
-
- file_path_dst = MYDOCS_DIR + TEST_IMAGE
- file_path_src = MYDOCS + TEST_IMAGE
-
- check_mount()
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_IMAGE_DIR + TEST_IMAGE, file_path_src)
-
- result = commands.getoutput(' tracker search -i -l 10000 | grep ' + file_path_src + ' |wc -l' )
- self.assert_(result == '1' , 'copied image file is not shown as indexed')
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- shutil.move( MOUNT_DUMMY + TEST_IMAGE , DUMMY_DIR)
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
- print commands.getoutput ( 'ls ' + MYDOCS)
- self.loop.run()
-
- """ verify if miner indexed these file. """
- result = commands.getoutput(' tracker search -i -l 10000 | grep ' + file_path_dst + ' |wc -l' )
-
- self.assert_(result == '1' , 'moved file is not listed in tracker search')
- result1 = commands.getoutput ('tracker search --limit=10000 -i | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' and result1 == '0' , 'Both the original and moved files are listed in tracker search')
-
- os.remove(file_path_dst)
-
-
- def test_music_01 (self):
-
- """ To check if tracker indexes moved audio files in massstorage mode """
-
-
- file_path_dst = MYDOCS_DIR + TEST_MUSIC
- file_path_src = MYDOCS + TEST_MUSIC
-
- check_mount()
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_MUSIC_DIR + TEST_MUSIC, file_path_src)
-
- result = commands.getoutput ('tracker search --limit=10000 -m | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' , 'copied music file is not shown as indexed')
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- shutil.move( MOUNT_DUMMY + TEST_MUSIC , DUMMY_DIR)
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
- print commands.getoutput ( 'ls ' + MYDOCS)
-
- self.loop.run()
-
- """ verify if miner indexed these file. """
-
- result = commands.getoutput ('tracker search --limit=10000 -m | grep ' + file_path_dst + ' | wc -l')
- print result
- self.assert_(result == '1' , 'moved music file is not shown as indexed')
-
- result1 = commands.getoutput ('tracker search --limit=10000 -m | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' and result1 == '0' , 'Both original and moved files are listed in tracker search ')
-
- os.remove(file_path_dst)
-
-
- def test_video_01 (self):
-
- """ To check if tracker indexes moved video files in massstorage mode """
-
- file_path_dst = MYDOCS_DIR + TEST_VIDEO
- file_path_src = MYDOCS + TEST_VIDEO
-
- check_mount()
- """copy the test files """
- self.wait_for_fileop('cp', SRC_VIDEO_DIR + TEST_VIDEO, file_path_src)
-
- result = commands.getoutput ('tracker search --limit=10000 -v | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' , 'copied video file is not shown as indexed')
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- shutil.move(MOUNT_DUMMY + TEST_VIDEO , DUMMY_DIR)
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
- print commands.getoutput ( 'ls ' + MYDOCS)
- self.loop.run()
- """ verify if miner indexed these file. """
-
- result = commands.getoutput ('tracker search --limit=10000 -v | grep ' + file_path_dst + ' | wc -l')
-
- self.assert_(result == '1' , 'moved file is not listed in tracker search ')
-
- result1 = commands.getoutput ('tracker search --limit=10000 -v | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' and result1 == '0' , 'Both original and moved files are listed in tracker search ')
-
- os.remove(file_path_dst)
-
-
-class rename (TestUpdate):
-
-
- def test_image_01 (self):
-
- """ To check if tracker indexes renamed image file in massstorage mode """
-
- file_path_dst = MYDOCS + RENAME_IMAGE
- file_path_src = MYDOCS + TEST_IMAGE
-
- check_mount()
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_IMAGE_DIR + TEST_IMAGE, file_path_src)
-
- result = commands.getoutput(' tracker search -i -l 10000 | grep ' + file_path_src + ' |wc -l' )
- self.assert_(result == '1' , 'copied image file is not shown as indexed')
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- shutil.move( MOUNT_DUMMY + TEST_IMAGE , MOUNT_DUMMY+RENAME_IMAGE)
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
- print commands.getoutput ( 'ls ' + MYDOCS)
- self.loop.run()
-
- """ verify if miner indexed these file. """
- result = commands.getoutput(' tracker search -i -l 10000 | grep ' + file_path_dst + ' |wc -l' )
-
- self.assert_(result == '1' , 'renamed file s not listed in tracker search')
- result1 = commands.getoutput ('tracker search --limit=10000 -i | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' and result1 == '0' , 'Both the original and renamed files are listed in tracker search')
-
- os.remove(file_path_dst)
-
-
- def test_music_01 (self):
-
- """ To check if tracker indexes renamed audio files in massstorage mode """
-
- file_path_dst = MYDOCS + RENAME_MUSIC
- file_path_src = MYDOCS + TEST_MUSIC
-
- check_mount()
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_MUSIC_DIR + TEST_MUSIC, file_path_src)
-
- result = commands.getoutput ('tracker search --limit=10000 -m | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' , 'copied music file is not shown as indexed')
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- shutil.move( MOUNT_DUMMY + TEST_MUSIC , MOUNT_DUMMY+RENAME_MUSIC)
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
- print commands.getoutput ( 'ls ' + MYDOCS)
-
- self.loop.run()
-
- """ verify if miner indexed these file. """
-
- result = commands.getoutput ('tracker search --limit=10000 -m | grep ' + file_path_dst + ' | wc -l')
- print result
- self.assert_(result == '1' , 'renamed music file is not shown as indexed')
-
- result1 = commands.getoutput ('tracker search --limit=10000 -m | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' and result1 == '0' , 'Both original and renamed files are listed in tracker search ')
-
- os.remove(file_path_dst)
-
-
- def test_video_01 (self):
-
- """ To check if tracker indexes renamed video files in massstorage mode """
-
- file_path_dst = MYDOCS + RENAME_VIDEO
- file_path_src = MYDOCS + TEST_VIDEO
-
- check_mount()
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_VIDEO_DIR + TEST_VIDEO, file_path_src)
-
- result = commands.getoutput ('tracker search --limit=10000 -v | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' , 'copied video file is not shown as indexed')
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- shutil.move(MOUNT_DUMMY + TEST_VIDEO , MOUNT_DUMMY+RENAME_VIDEO)
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
- print commands.getoutput ( 'ls ' + MYDOCS)
- self.loop.run()
- """ verify if miner indexed these file. """
-
- result = commands.getoutput ('tracker search --limit=10000 -v | grep ' + file_path_dst + ' | wc -l')
-
- self.assert_(result == '1' , 'renamed file is not listed in tracker search ')
-
- result1 = commands.getoutput ('tracker search --limit=10000 -v | grep ' + file_path_src + ' | wc -l')
- self.assert_(result == '1' and result1 == '0' , 'Both original and renamed files are listed in tracker search ')
-
- os.remove(file_path_dst)
-
-
-""" subfolder operations in mass storage mode """
-class subfolder (TestUpdate):
-
- def test_create_01 (self):
-
- """ To check if tracker indexes image file copied to a
- newly created subfolder in massstorage mode """
-
- file_path = SUB_FOLDER_MYDOCS + TEST_IMAGE
-
- check_mount()
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
-
- """create a subfolder """
- commands.getoutput('mkdir -p '+ SUB_FOLDER_DUMMY)
-
- """copy the test file """
- shutil.copy2(SRC_IMAGE_DIR + TEST_IMAGE, SUB_FOLDER_DUMMY)
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
-
- print commands.getoutput ( 'ls ' + SUB_FOLDER_MYDOCS)
-
-
- self.loop.run ()
-
- """ verify if miner indexed these file. """
- result = commands.getoutput ('tracker search --limit=10000 -i | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '1' , 'copied image file is not shown as indexed')
-
- shutil.rmtree(MYDOCS + 's1')
-
-
- def test_delete_02 (self):
- """ To check if tracker un-indexes image file in a
-
- subfolder if subfolder is deleted in massstorage mode """
-
- file_path = SUB_FOLDER_MYDOCS + TEST_IMAGE
-
- """create a subfolder """
- commands.getoutput('mkdir -p '+ SUB_FOLDER_MYDOCS)
-
- """copy the test file """
- shutil.copy2(SRC_IMAGE_DIR + TEST_IMAGE, SUB_FOLDER_MYDOCS)
- self.loop.run ()
-
- """ 2. verify if miner indexed this file. """
- result = commands.getoutput ('tracker search --limit=10000 -i | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '1' , 'copied file is not shown as indexed')
-
- check_mount()
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
-
- shutil.rmtree(MOUNT_DUMMY + '/' + 's1')
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
-
- print commands.getoutput ( 'ls ' + SUB_FOLDER_MYDOCS)
-
-
- self.loop.run ()
-
- """ verify if miner un-indexed these file. """
- result = commands.getoutput ('tracker search --limit=10000 -i | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '0' , 'deleted image file is shown as indexed')
-
-
-""" delete files in mass storage mode """
-class delete (TestUpdate):
-
- def test_image_01 (self):
-
- """ To check if tracker indexes image if its deleted in massstorage mode """
-
- file_path = MYDOCS + TEST_IMAGE
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_IMAGE_DIR + TEST_IMAGE, file_path)
-
- """ 2. verify if miner indexed this file. """
- result = commands.getoutput ('tracker search --limit=10000 -i | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '1' , 'copied file is not shown as indexed')
-
- check_mount()
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- """remove the test files """
- os.remove(MOUNT_DUMMY + '/' + TEST_IMAGE)
-
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
-
- print commands.getoutput ( 'ls ' + MYDOCS)
-
-
- self.loop.run ()
-
- """ verify if miner un-indexed this file. """
- result = commands.getoutput ('tracker search --limit=10000 -i | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '0' , 'deleted image file is shown as indexed')
-
- def test_music_02 (self):
-
- """ To check if tracker indexes music if its deleted in massstorage mode """
-
- file_path = MYDOCS + TEST_MUSIC
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_MUSIC_DIR + TEST_MUSIC, file_path)
-
- """ 2. verify if miner indexed this file. """
- result = commands.getoutput ('tracker search --limit=10000 -m | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '1' , 'copied file is not shown as indexed')
-
- check_mount()
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- """remove the test files """
- os.remove(MOUNT_DUMMY + '/' + TEST_MUSIC)
-
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
-
- print commands.getoutput ( 'ls ' + MYDOCS)
-
-
- self.loop.run ()
-
- """ verify if miner un-indexed this file. """
- result = commands.getoutput ('tracker search --limit=10000 -m | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '0' , 'deleted music file is shown as indexed')
-
- def test_video_03 (self):
-
- """ To check if tracker indexes video if its deleted in massstorage mode """
-
- file_path = MYDOCS + TEST_VIDEO
-
- """copy the test files """
- self.wait_for_fileop('cp', SRC_VIDEO_DIR + TEST_VIDEO, file_path)
-
- """ 2. verify if miner indexed this file. """
- result = commands.getoutput ('tracker search --limit=10000 -v | grep ' + file_path + ' | wc -l')
-
- print result
- self.assert_(result == '1' , 'copied file is not shown as indexed')
-
- check_mount()
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
-
- """remove the test files """
- os.remove(MOUNT_DUMMY + '/' + TEST_VIDEO)
-
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
-
- print commands.getoutput ( 'ls ' + MYDOCS)
-
-
- self.loop.run ()
-
- """ verify if miner un-indexed this file. """
- result = commands.getoutput ('tracker search --limit=10000 -v | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '0' , 'deleted video file is shown as indexed')
-
-class text (TestUpdate) :
-
- def test_text_01 (self):
-
- """ To check if tracker indexes changes made to a text file in massstorage mode """
-
- file_path = MYDOCS + TEST_TEXT
-
- """ Creating text file """
- f1=open(file_path,"w")
- f1.writelines("This is a new text file")
- f1.close()
-
-
- check_mount()
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount ' + MOUNT_PARTITION + ' ' + MOUNT_DUMMY)
-
- self.edit_text(TEST_TEXT)
-
- commands.getoutput ( 'umount ' + MOUNT_PARTITION )
-
- commands.getoutput ( 'mount -t vfat -o rw ' + MOUNT_PARTITION + ' ' + MYDOCS)
-
-
- print commands.getoutput ( 'ls ' + MYDOCS)
- self.loop.run()
-
- """ verify if miner indexed these file. """
-
- result = commands.getoutput ('tracker search -t massstorage | grep ' + file_path + ' | wc -l')
- print result
- self.assert_(result == '1' , 'copied text file is not shown as indexed')
-
- os.remove(file_path)
-
-
-class no_file_op(TestUpdate):
-
- def test_msm_01(self):
-
- """1. check if tracker is idle. wait till it gets to idle state. """
-
- check_mount()
- commands.getoutput ('umount /dev/mmcblk0p1')
-
- result = self.miner.GetStatus ()
- self.assert_(result == 'Idle' , 'Tracker is not in idle state')
-
- def test_msm_02(self):
-
- """
- 1. unmount the MyDocs
-
- 2. check if tracker search -i is retrieving result """
-
- check_mount()
- commands.getoutput ('umount /dev/mmcblk0p1')
-
- result = commands.getoutput ('tracker search -f -l 10000 | grep ' + MYDOCS + ' |wc -l ')
- print result
- self.assert_(result == '0' , 'Tracker is listing the files when the device is connected in mass storage mode')
-
-
- def test_msm_03(self):
-
- """1. unmount the MyDocs
-
- 2. check if tracker search -ia is retrieving result """
-
- check_mount()
- commands.getoutput ('umount /dev/mmcblk0p1')
-
- result = commands.getoutput ('tracker search -f -l 10000 |wc -l ')
- self.assert_(result != 0 , 'Tracker(checked with -a) is not listing the files when the device is connected in mass storage mode')
-
-if __name__ == "__main__":
-
- #unittest.main()
- copy_tcs_list=unittest.TestLoader().getTestCaseNames(copy)
- copy_testsuite=unittest.TestSuite(map(copy, copy_tcs_list))
-
-
- move_tcs_list=unittest.TestLoader().getTestCaseNames(move)
- move_testsuite=unittest.TestSuite(map(move, move_tcs_list))
-
-
- rename_tcs_list=unittest.TestLoader().getTestCaseNames(rename)
- rename_testsuite=unittest.TestSuite(map(rename, rename_tcs_list))
-
- delete_tcs_list=unittest.TestLoader().getTestCaseNames(delete)
- delete_testsuite=unittest.TestSuite(map(delete, delete_tcs_list))
-
-
- subfolder_tcs_list=unittest.TestLoader().getTestCaseNames(subfolder)
- subfolder_testsuite=unittest.TestSuite(map(subfolder, subfolder_tcs_list))
-
-
- text_tcs_list=unittest.TestLoader().getTestCaseNames(text)
- text_testsuite=unittest.TestSuite(map(text, text_tcs_list))
-
- file_tcs_list=unittest.TestLoader().getTestCaseNames(no_file_op)
- file_testsuite=unittest.TestSuite(map(no_file_op, file_tcs_list))
-
- all_testsuites = unittest.TestSuite((rename_testsuite,move_testsuite,copy_testsuite,subfolder_testsuite,text_testsuite))
-
- unittest.TextTestRunner(verbosity=2).run(all_testsuites)
-
-
-
-
-
diff --git a/tests/functional-tests/performance-tc-modified.py b/tests/functional-tests/performance-tc-modified.py
deleted file mode 100644
index 62071aa91..000000000
--- a/tests/functional-tests/performance-tc-modified.py
+++ /dev/null
@@ -1,3506 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-
-import sys,os
-import dbus
-import commands, signal
-import unittest
-import time
-import random
-import datetime
-import htmldoc as hd
-
-TRACKER = 'org.freedesktop.Tracker1'
-TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources'
-RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
-
-
-
-"""import .ttl files """
-"""
-def stats() :
- a1=commands.getoutput("tracker status --stat |grep %s " %(stats[i]))
- b1=a1.split()
- after=b1[2]
- return after
-
-def import_ttl (music_ttl):
- 1. Checking the tracker stats before importing the ttl file .
- 2. Importing the ttl file .
- 3. Check the tracker status --stat after importing the ttl file.
- 4. Check if the stats got changed.
- bus= dbus.SessionBus()
- imp_obj = bus.get_object('org.freedesktop.Tracker1','/org/freedesktop/Tracker1/Resources')
- imp_iface = dbus.Interface(imp_obj, 'org.freedesktop.Tracker1.Resources')
- #stats_obj = bus.get_object('org.freedesktop.Tracker1','/org/freedesktop/Tracker1/Statistics')
- #stats_iface = dbus.Interface(stats_obj, 'org.freedesktop.Tracker1.Statistics')
-
- ttl=['040-nmm_Artist.ttl']
- stats=['nmm:Artist','nmm:MusicAlbum']
- for i in range(len(ttl)) :
- file_ttl='file://' +music_ttl+'/'+ttl[i]
- a=commands.getoutput("tracker status --stat | grep %s " %(stats[i]))
- b=a.split()
- imp_iface.Load(file_ttl)
- a1=commands.getoutput("tracker status --stat |grep %s " %(stats[i]))
- b1=a1.split()
- after=b1[2]
- while (t < 2):
- t=stats()
- time.sleep(2)
-
-"""
-
-
-
-
-
-
-class TestUpdate (unittest.TestCase):
-
- def setUp(self):
- bus = dbus.SessionBus()
- tracker = bus.get_object(TRACKER, TRACKER_OBJ)
- self.resources = dbus.Interface (tracker,
- dbus_interface=RESOURCES_IFACE)
-
- def parsing(self, method, query):
- f=open("./report/"+method.__name__+"_query.html", "w")
- f.write(query)
- f.close()
- value=hd.parseDoc(method)
- l=hd.Link(method.__name__+"_query", "report/"+method.__name__+"_query.html")
- return value, l
-
-
-""" email performance test cases """
-class email(TestUpdate):
-
-
- def test_email_01(self):
-
- """
- Time taken for querying the emails.
- @param description: Time taken for querying the emails
- @param expected_value:
- @param querytype:
- """
-
- query = "SELECT ?m ?From ?date ?email1 WHERE { \
- ?m a nmo:Email ; \
- nmo:receivedDate ?date ;\
- nmo:from ?From . ?from nco:hasEmailAddress ?email1 } LIMIT 10000"
-
- list=[]
- for i in range ( 0, iterations ):
- """Query for emails """
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
-
- print "Time taken for querying emails = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(email.test_email_01, query)
- t.rows.append(hd.TableRow([email.test_email_01.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
-""" calls performance test cases """
-class calls(TestUpdate):
-
-
- def test_calls_01(self):
-
- """
- Time taken for querying duration of calls from phonenumbers.
- @param description: Time taken for querying duration of calls from phonenumbers
- @param expected_value:
- @param querytype:
- """
-
- query = "SELECT ?duration ?phonenumber WHERE {\
- ?call a nmo:Call ;\
- nmo:duration ?duration ;\
- nmo:from [a nco:Contact ; nco:hasPhoneNumber ?phonenumber] }LIMIT 10000"
- list=[]
- for i in range ( 0, iterations ):
-
- """Querying the duration of calls of contacts """
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying duration of calls from phonenumbers = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(calls.test_calls_01, query)
- t.rows.append(hd.TableRow([calls.test_calls_01.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_calls_02(self):
-
- """
- Time taken for querying dialed calls.
- @param description: Time taken for querying dialed calls
- @param expected_value:
- @param querytype:
- """
-
- query = "SELECT ?name ?date ?number ?duration \
- WHERE {?m a nmo:Call; \
- nmo:sentDate ?date ; \
- nmo:duration ?duration; \
- nmo:to ?contact . \
- ?contact a nco:PersonContact; \
- nco:hasPhoneNumber ?number . \
- OPTIONAL { \
- ?contact a nco:PersonContact ; \
- nco:nameFamily ?name} \
- FILTER (?duration > 0) .} \
- ORDER BY desc(?date) LIMIT 1000"
-
- list=[]
- for i in range ( 0, iterations ):
- """Querying the dialed calls"""
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying dialed calls = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(calls.test_calls_02, query)
- t.rows.append(hd.TableRow([calls.test_calls_02.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_calls_03(self):
-
- """
- Time taken for querying received calls
- @param description: Time taken for querying received calls
- @param expected_value:
- @param querytype:
- """
-
- query = "SELECT ?name ?date ?number ?duration \
- WHERE {?m a nmo:Call; \
- nmo:receivedDate ?date ; \
- nmo:duration ?duration; \
- nmo:from ?contact . \
- ?contact a nco:PersonContact; \
- nco:hasPhoneNumber ?number . \
- OPTIONAL { ?contact a nco:PersonContact ; nco:nameFamily ?name} \
- FILTER (?duration > 0) .} \
- ORDER BY desc(?date) LIMIT 1000"
-
- list=[]
- for i in range ( 0, iterations ):
- """Querying the received calls"""
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying received calls = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(calls.test_calls_03, query)
- t.rows.append(hd.TableRow([calls.test_calls_03.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_calls_04(self):
-
- """
- Time taken for querying missed calls.
- @param description: Time taken for querying missed calls
- @param expected_value:
- @param querytype:
- """
-
- query = "SELECT ?name ?date ?number ?duration \
- WHERE {?m a nmo:Call; \
- nmo:receivedDate ?date ; \
- nmo:duration ?duration; \
- nmo:from ?contact . \
- ?contact a nco:PersonContact; \
- nco:hasPhoneNumber ?number . \
- OPTIONAL { ?contact a nco:PersonContact ; nco:nameFamily ?name}\
- FILTER (?duration > 0) .} \
- ORDER BY desc(?date) LIMIT 1000"
-
-
- list=[]
- for i in range ( 0, iterations ):
- """Querying the missed calls"""
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying missed calls = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(calls.test_calls_04, query)
- t.rows.append(hd.TableRow([calls.test_calls_04.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
-""" IM performance test cases """
-class instant_messages(TestUpdate):
-
-
- def test_im_01(self):
-
- """
- Time taken for querying messages.
- @param description: Time taken for querying messages
- @param expected_value:
- @param querytype:
- """
-
-
- query = "SELECT ?message ?from ?date ?content WHERE { \
- ?message a nmo:IMMessage ; \
- nmo:from ?from ; \
- nmo:receivedDate ?date ; \
- nie:plainTextContent ?content} LIMIT 10000"
-
- list=[]
- for i in range ( 0, iterations ):
- """Querying the messages """
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying messages = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(instant_messages.test_im_01, query)
- t.rows.append(hd.TableRow([instant_messages.test_im_01.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_im_02(self):
-
- """
- Time taken for querying status of contacts.
- @param description: Time taken for querying status of contacts
- @param expected_value:
- @param querytype:
- """
-
- query = "SELECT ?contact ?status WHERE{\
- ?contact a nco:IMAccount; \
- nco:imPresence ?status }LIMIT 10000"
-
- list=[]
- for i in range ( 0, iterations ):
- """Querying the status of contacts every sec"""
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying status of contacts = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(instant_messages.test_im_02, query)
- t.rows.append(hd.TableRow([instant_messages.test_im_02.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
-""" rtcom performance test cases """
-class rtcom(TestUpdate):
-
-
- def test_rtcom_01(self):
-
- """
- Time taken for querying (old) conversation view (without contact info).
- @param description: Time taken for querying (old) conversation view (without contact info)
- @param expected_value: 0.5 sec
- @param querytype:
- """
-
- # A version of the next one that skips the contact parts that are not generated properly
-
- query = "SELECT ?msg ?date ?text ?contact \
- WHERE { \
- ?msg nmo:communicationChannel <urn:channel:1> ; \
- nmo:receivedDate ?date ; \
- nie:plainTextContent ?text . \
- <urn:channel:1> nmo:hasParticipant ?contact . \
- } ORDER BY DESC(?date) LIMIT 50"
-
- #query = "SELECT ?msg ?date ?text ?contact \
- # WHERE { \
- # ?msg nmo:communicationChannel <urn:uuid:7585395544138154780> ; \
- # nmo:receivedDate ?date ; \
- # nie:plainTextContent ?text ; \
- # nmo:from [ nco:hasIMAddress ?fromAddress ] . \
- # <urn:uuid:7585395544138154780> nmo:hasParticipant ?contact . \
- # ?contact nco:hasIMAddress ?fromAddress . \
- # } ORDER BY DESC(?date) LIMIT 50"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying (old) conversation view (without contact info) = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(rtcom.test_rtcom_01, query)
- t.rows.append(hd.TableRow([rtcom.test_rtcom_01.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
- def test_rtcom_02(self):
-
- """
- Time taken for querying conversation view.
- @param description: Time taken for querying conversation view
- @param expected_value: 0.5 sec
- @param querytype:
- """
-
- #
- # Current rtcom queries, please do not "quietly optimize".
- #
-
- # requires secondary index support to be fast
-
- 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:phoneMessageId(?message) \
- nmo:receivedDate(?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 \
- { \
- SELECT \
- ?message ?date ?from ?to \
- (SELECT ?contact \
- WHERE \
- { \
- { \
- <urn:channel:1> nmo:hasParticipant ?participant . \
- ?contact a nco:PersonContact . \
- ?participant nco:hasIMAddress ?imaddress . \
- ?contact nco:hasIMAddress ?imaddress . \
- } \
- UNION \
- { \
- <urn:channel:1> nmo:hasParticipant ?participant . \
- ?contact a nco:PersonContact . \
- ?participant nco:hasPhoneNumber ?participantNumber . \
- ?participantNumber maemo:localPhoneNumber ?number . \
- ?contact nco:hasPhoneNumber ?contactNumber . \
- ?contactNumber maemo:localPhoneNumber ?number . \
- } \
- } \
- ) AS ?contact \
- 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> . \
- } \
- ORDER BY DESC(?date) \
- } \
- LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying conversation view = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(rtcom.test_rtcom_02, query)
- t.rows.append(hd.TableRow([rtcom.test_rtcom_02.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
- def test_rtcom_03(self):
-
- """
- Time taken for querying call history.
- @param description: Time taken for querying call history
- @param expected_value: 0.5 sec
- @param querytype:
- """
-
- #
- # Current rtcom queries, please do not "quietly optimize".
- #
-
- query = " \
- SELECT ?call ?date ?from ?to \
- rdf:type(?call) \
- nmo:isSent(?call) \
- nmo:isAnswered(?call) \
- nmo:isRead(?call) \
- nmo:sentDate(?call) \
- nmo:receivedDate(?call) \
- nmo:duration(?call) \
- nie:contentLastModified(?call) \
- (SELECT ?contact \
- WHERE \
- { \
- { \
- ?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 \
- { \
- ?contact a nco:PersonContact . \
- ?contact nco:contactUID ?contactId . \
- { \
- ?call nmo:to ?address . \
- } \
- UNION \
- { \
- ?call nmo:from ?address . \
- } \
- ?address nco:hasPhoneNumber ?addressNumber . \
- ?addressNumber maemo:localPhoneNumber ?number . \
- ?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\
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying call history = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(rtcom.test_rtcom_03, query)
- t.rows.append(hd.TableRow([rtcom.test_rtcom_03.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
- def test_rtcom_04(self):
-
- """
- Time taken for querying (old) conversation list view.
- @param description: Time taken for querying (old) conversation list view
- @param expected_value:
- @param querytype:
- """
-
- query = "SELECT ?channel ?participant nco:fullname(?participant) ?last_date nie:plainTextContent(?last_message) \
- (SELECT COUNT(?message) AS ?message_count \
- WHERE { ?message nmo:communicationChannel ?channel }) \
- (SELECT COUNT(?message) AS ?message_count \
- WHERE { ?message nmo:communicationChannel ?channel ; nmo:isRead true }) \
- WHERE { SELECT ?channel ?participant ?last_date \
- (SELECT ?message WHERE { ?message nmo:communicationChannel ?channel ; nmo:receivedDate ?date } ORDER BY DESC(?date) LIMIT 1) AS ?last_message \
- WHERE { \
- ?channel a nmo:CommunicationChannel ; \
- nmo:lastMessageDate ?last_date ; \
- nmo:hasParticipant ?participant . \
- FILTER (?participant != nco:default-contact-me ) \
- } ORDER BY DESC(?last_date) LIMIT 50 }"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying (old) conversation list view = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(rtcom.test_rtcom_04, query)
- t.rows.append(hd.TableRow([rtcom.test_rtcom_04.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_rtcom_05(self):
-
- """
- Time taken for querying (old) conversation view.
- @param description: Time taken for querying (old) conversation view
- @param expected_value:
- @param querytype:
- """
-
- query = "SELECT ?msg ?date ?text ?contact \
- WHERE { \
- ?msg nmo:communicationChannel <urn:channel:1> ; \
- nmo:receivedDate ?date ; \
- nie:plainTextContent ?text ; \
- nmo:from [ nco:hasIMAddress ?fromAddress ] . \
- <urn:channel:1> nmo:hasParticipant ?contact . \
- ?contact nco:hasIMAddress ?fromAddress . \
- } ORDER BY DESC(?date) LIMIT 50"
-
- #query = "SELECT ?msg ?date ?text ?contact \
- # WHERE { \
- # ?msg nmo:communicationChannel <urn:uuid:7585395544138154780> ; \
- # nmo:receivedDate ?date ; \
- # nie:plainTextContent ?text ; \
- # nmo:from [ nco:hasIMAddress ?fromAddress ] . \
- # <urn:uuid:7585395544138154780> nmo:hasParticipant ?contact . \
- # ?contact nco:hasIMAddress ?fromAddress . \
- # } ORDER BY DESC(?date) LIMIT 50"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying (old) conversation view = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(rtcom.test_rtcom_05, query)
- t.rows.append(hd.TableRow([rtcom.test_rtcom_05.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_rtcom_06(self):
-
- """
- Time taken for querying conversation list.
- @param description: Time taken for querying conversation list
- @param expected_value:
- @param querytype:
- """
-
- #
- # Current rtcom queries, please do not "quietly optimize".
- #
-
- query = " \
- 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 ?subject ?lastDate \
- \
- ( SELECT ?message WHERE {?message nmo:communicationChannel ?channel . ?message nmo:receivedDate ?receivedDate .} ORDER BY DESC(?receivedDate) LIMIT 1) AS ?lastMessage \
- (SELECT ?contact \
- WHERE { \
- { \
- ?channel nmo:hasParticipant ?participant . \
- ?contact a nco:PersonContact . \
- ?participant nco:hasIMAddress ?imaddress . \
- ?contact nco:hasIMAddress ?imaddress . \
- } \
- UNION \
- { \
- ?channel nmo:hasParticipant ?participant . \
- ?contact a nco:PersonContact . \
- ?participant nco:hasPhoneNumber ?participantNumber . \
- ?number maemo:localPhoneNumber ?localNumber . \
- ?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\
- "
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying conversation list = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(rtcom.test_rtcom_06, query)
- t.rows.append(hd.TableRow([rtcom.test_rtcom_06.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-""" Audio, Video, Images performance test cases """
-class audio(TestUpdate):
-
- def test_audio_01(self):
-
- """
- Time taken for querying all songs.
- @param description: Time taken for querying all songs
- @param expected_value: First 20 clips in 0.2 sec and the rest up to 10000 in 2 sec
- @param querytype:
- """
-
- """Query all songs """
-
- query = "SELECT ?title ?artist nmm:albumTitle (nmm:musicAlbum (?song))\
- WHERE { { \
- ?song a nmm:MusicPiece . \
- ?song nie:title ?title .\
- ?song nmm:performer ?perf . \
- ?perf nmm:artistName ?artist .}} \
- ORDER BY ?title "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result = self.resources.SparqlQuery(query,timeout = 1000)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all songs = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_01, query)
- t.rows.append(hd.TableRow([audio.test_audio_01.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
- def test_audio_02 (self) :
-
- """
- Time taken for querying 5000 albums.
- @param description: Time taken for querying 5000 albums
- @param expected_value: First 20 albums in 0.2sec rest up to 1000 in 2 sec
- @param querytype:
- """
-
- """Query all albums """
-
- query = "SELECT nmm:albumTitle(?album) AS ?Album nmm:artistName (nmm:performer (?Songs)) COUNT(?Songs) AS ?Songs ?album \
- WHERE { { ?Songs a nmm:MusicPiece .\
- ?Songs nmm:musicAlbum ?album . \
- }}GROUP BY ?album ORDER BY ?album LIMIT 5000"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result = self.resources.SparqlQuery(query,timeout = 1000)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 5000 albums = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_02, query)
- t.rows.append(hd.TableRow([audio.test_audio_02.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
- def test_audio_03 (self):
-
- """
- Time taken for querying 5000 artists.
- @param description: Time taken for querying 5000 artists
- @param expected_value: First 20 artists in 0.2 secrst up to 100 in 0.5sec
- @param querytype:
- """
-
- """ Query all artists """
- """simplified version of test_audio_08 """
- query = "SELECT nmm:artistName(?artist) nmm:albumTitle(?album) COUNT(?album) ?artist WHERE { \
- ?song a nmm:MusicPiece . \
- ?song nmm:performer ?artist . \
- OPTIONAL { ?song nmm:musicAlbum ?album . } } \
- GROUP BY ?artist ORDER BY ?artist LIMIT 5000"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
- print query
- result = self.resources.SparqlQuery(query,timeout= 600)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 5000 artists = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_03, query)
- t.rows.append(hd.TableRow([audio.test_audio_03.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
-
- def test_audio_04(self):
-
- """
- Time taken for querying Artist and finding the no.of albums in each artist.
- @param description: Time taken for querying Artist and finding the no.of albums in each artist
- @param expected_value: First 20 albums in 0.2sec and the rest up to 100 in 0.5 sec
- @param querytype:
- """
-
- """ Querying for Artist and finding the no.of albums in each artist. """
-
- query = "SELECT ?artist ?name COUNT(?album) COUNT (?song) \
- WHERE { \
- ?song a nmm:MusicPiece ; \
- nmm:musicAlbum ?album; \
- nmm:performer ?artist . \
- ?artist nmm:artistName ?name. \
- } GROUP BY ?artist"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying Artist and finding the no.of albums in each artist = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_04, query)
- t.rows.append(hd.TableRow([audio.test_audio_04.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
- def test_audio_05(self):
-
- """
- Time taken for querying all artists and count their songs.
- @param description: Time taken for querying all artists and count their songs
- @param expected_value: First 20 clips in 0.2 sec and the rest up to 1000 in 2sec
- @param querytype:
- """
-
- """Query all aritists also count of songs in each artists """
-
- query= "SELECT nmm:artistName(?artist) COUNT(?songs) WHERE { \
- ?mp a nmm:MusicPiece . \
- ?mp nmm:performer ?artist ; \
- nie:title ?songs . } \
- GROUP BY ?artist ORDER BY DESC(nmm:artistName(?artist))"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result = self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all artists and count their songs = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_05, query)
- t.rows.append(hd.TableRow([audio.test_audio_05.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
- def test_audio_06(self):
-
- """
- Time taken for querying all albums and count their songs.
- @param description: Time taken for querying all albums and count their songs
- @param expected_value: First 20 clips in 0.2 sec
- @param querytype:
- """
-
- """Query all albums also count of songs in each album """
-
- query= "SELECT nie:title(?a) COUNT(?songs) WHERE { \
- ?a a nmm:MusicAlbum . \
- ?mp nmm:musicAlbum ?a ; \
- nie:title ?songs . } \
- GROUP BY ?a ORDER BY DESC(nie:title(?a))"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result = self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all albums and count their songs = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_06, query)
- t.rows.append(hd.TableRow([audio.test_audio_06.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
- def test_audio_07(self):
-
- """
- Time taken for querying all albums and count their songs.
- @param description: Time taken for querying all albums and count their songs
- @param expected_value:
- @param querytype:
- """
-
- """Query all albums also count of songs in each album """
-
- query= "SELECT ?album COUNT(?songs) AS ?count WHERE { \
- ?a a nmm:MusicAlbum; \
- nie:title ?album. \
- ?mp nmm:musicAlbum ?a;\
- nie:title ?songs.\
- }GROUP BY ?album ORDER BY DESC(?album)"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result = self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all albums and count their songs = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_07, query)
- t.rows.append(hd.TableRow([audio.test_audio_07.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_audio_08 (self):
-
- """
- Time taken for querying 5000 artists.
- @param description: Time taken for querying 5000 artists
- @param expected_value: 1.5
- @param querytype:
- """
-
- """ Query all artists """
- query = " SELECT nmm:artistName(?artist) AS ?artistTitle (nmm:musicAlbum (?song)) (nmm:albumTitle (?album))COUNT(?album) AS ?album ?artist \
- WHERE { \
- ?song a nmm:MusicPiece .\
- ?song nmm:performer ?artist . \
- } GROUP BY ?artist ORDER BY ?artist LIMIT 5000"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
- print query
- result = self.resources.SparqlQuery(query,timeout= 600)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 5000 artists = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_08, query)
- t.rows.append(hd.TableRow([audio.test_audio_08.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_audio_09 (self) :
-
- """
- Time taken for querying 100 albums.
- @param description: Time taken for querying 100 albums
- @param expected_value:
- @param querytype:
- """
-
- """Query 100 albums """
-
- query = "SELECT nmm:albumTitle(?album) AS ?Album (nmm:performer(?Songs)) nmm:artistName COUNT(?Songs) AS ?Songs ?album \
- WHERE { { ?Songs a nmm:MusicPiece .\
- ?Songs nmm:musicAlbum ?album .\
- }}GROUP BY ?album ORDER BY ?album LIMIT 100"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result = self.resources.SparqlQuery(query,timeout = 1000)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 100 albums = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_09, query)
- t.rows.append(hd.TableRow([audio.test_audio_09.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_audio_10 (self):
-
- """
- Time taken for querying 100 artist.
- @param description: Time taken for querying 100 artist
- @param expected_value:
- @param querytype:
- """
-
- """ Query 100 artists """
-
- query = "SELECT nmm:artistName(?artist) AS ?artistTitle (nmm:musicAlbum (?song)) nmm:albumTitle COUNT(?album) AS\
- ?album ?artist \
- WHERE { \
- ?song a nmm:MusicPiece .\
- ?song nmm:performer ?artist . \
- } GROUP BY ?artist ORDER BY ?artist LIMIT 100"""
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
- print query
- result = self.resources.SparqlQuery(query,timeout=600)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 100 artist = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(audio.test_audio_10, query)
- t.rows.append(hd.TableRow([audio.test_audio_10.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
- def test_audio_11 (self):
-
- """
- Time taken for querying 100 artist.
- @param description: Time taken for querying 100 artist
- @param expected_value:
- @param querytype:
- """
-
- """ Query 100 artists """
- """simplified version of test_audio_10 """
-
- query = "SELECT nmm:artistName(?artist) nmm:albumTitle(?album) COUNT(?album) ?artist WHERE { \
- ?song a nmm:MusicPiece . \
- ?song nmm:performer ?artist . \
- OPTIONAL { ?song nmm:musicAlbum ?album . } } \
- GROUP BY ?artist ORDER BY ?artist LIMIT 100"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
- print query
- result = self.resources.SparqlQuery(query,timeout=600)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 100 artist = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
- value, l=self.parsing(audio.test_audio_11, query)
- t.rows.append(hd.TableRow([audio.test_audio_11.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-class gallery(TestUpdate):
-
-
- def test_gallery_01(self):
-
- """
- Time taken for querying all images and videos.
- @param description: Time taken for querying all images and videos
- @param expected_value: Use streaming mode, get first 500 results in 0.1 second, all results in 2 second.
- @param querytype:
- """
-
- """ Querying for all Images and Videos """
-
- query = "SELECT ?url \
- WHERE { \
- ?media a nfo:Visual; \
- nie:url ?url;\
- nfo:fileName ?filename ;\
- nfo:fileLastModified ?modified .\
- OPTIONAL {?media nfo:width ?_width. } \
- OPTIONAL { ?media nfo:height ?_height .} } \
- ORDER BY ?modified LIMIT 10000"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query, timeout=25)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all images and videos = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_01, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_01.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
-
- def test_gallery_02(self):
-
- """
- Time taken for querying all images and videos taken with phone's camera.
- @param description: Time taken for querying all images and videos taken with phone's camera
- @param expected_value: Use streaming mode, get first 500 results in 0.1 second, all results in 1.0 second.
- @param querytype:
- """
-
- """Querying all images and videos taken with phone's camera """
-
- query = "SELECT ?media WHERE { \
- ?media a nfo:Visual; \
- nfo:equipment [ a nfo:Equipment; nfo:make 'NOKIA' ] }"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all images and videos taken with phone's camera = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_02, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_02.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
- def test_gallery_03(self):
-
- """
- Time taken for querying all images and videos with a tag.
- @param description: Time taken for querying all images and videos with a tag
- @param expected_value: Use streaming mode, get first 500 results in 0.1 second, all results in 2 second.
- @param querytype:
- """
-
- """ Querying for images, videos which have tag TEST """
-
- query = "SELECT ?media \
- WHERE { \
- ?media a nfo:Visual; \
- nao:hasTag ?tag . \
- ?tag nao:prefLabel 'TEST' }"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all images and videos with a tag = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_03, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_03.__name__, value[0], value[1], list, value[2], len(result), l], bgcolor="#C3FDB8"))
-
-
- def test_gallery_04(self):
-
- """
- Time taken for querying all images and videos without OPTIONALS.
- @param description: Time taken for querying all images and videos without OPTIONALS
- @param expected_value:
- @param querytype:
- """
-
- """ Querying for all Images and Videos without OPTIONALS"""
-
- query = "SELECT ?url \
- WHERE { \
- ?media a nfo:Visual; \
- nie:url ?url;\
- nfo:fileName ?filename ;\
- nfo:fileLastModified ?modified .}\
- ORDER BY ?modified LIMIT 10000"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query, timeout=25)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all images and videos without OPTIONALS = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_04, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_04.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_gallery_05(self):
-
- """
- Time taken for querying 500 images and videos.
- @param description: Time taken for querying 500 images and videos
- @param expected_value:
- @param querytype:
- """
-
- """ Querying for 500 Images and Videos """
-
- query = "SELECT ?url \
- WHERE { \
- ?media a nfo:Visual; \
- nie:url ?url;\
- nfo:fileName ?filename ;\
- nfo:fileLastModified ?modified .\
- OPTIONAL {?media nfo:width ?_width. } \
- OPTIONAL { ?media nfo:height ?_height .} } \
- ORDER BY ?modified LIMIT 500"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query, timeout=25)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 500 images and videos = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_05, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_05.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
- def test_gallery_06(self):
-
- """
- Time taken for querying 100 images and videos without OPTIONALS.
- @param description: Time taken for querying 100 images and videos without OPTIONALS
- @param expected_value:
- @param querytype:
- """
-
- """ Querying for 500 Images and Videos without OPTIONALS"""
-
- query = "SELECT ?url \
- WHERE { \
- ?media a nfo:Visual; \
- nie:url ?url;\
- nfo:fileName ?filename ;\
- nfo:fileLastModified ?modified .} \
- ORDER BY ?modified LIMIT 500"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query, timeout=25)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 100 images and videos without OPTIONALS = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_06, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_06.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
- def test_gallery_07(self):
-
- """
- Time taken for querying 500 images and videos with a tag.
- @param description: Time taken for querying 500 images and videos with a tag
- @param expected_value: Use streaming mode, get first 500 results in 0.1 second, all results in 2 second.
- @param querytype:
- """
-
- """ Querying for 500 images, videos which have tag TEST """
- query = "SELECT ?media \
- WHERE { \
- ?media a nfo:Visual; \
- nao:hasTag ?tag . \
- ?tag nao:prefLabel 'TEST' } LIMIT 500"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 500 images and videos with a tag = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_07, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_07.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
- def test_gallery_08(self):
-
- """
- Time taken for querying 500 images and videos taken with phone's camera.
- @param description: Time taken for querying 500 images and videos taken with phone's camera
- @param expected_value: Use streaming mode, get first 500 results in 0.1 second, all results in 1.0 second.
- @param querytype:
- """
-
- """Querying 500 images and videos taken with phone's camera """
-
- query = "SELECT ?media WHERE { \
- ?media a nfo:Visual; \
- nfo:equipment [ a nfo:Equipment; nfo:make 'NOKIA' ] } LIMIT 500"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 500 images and videos taken with phone's camera = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_08, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_08.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_gallery_09(self):
-
- """
- Time taken for querying all images.
- @param description: Time taken for querying all images
- @param expected_value: Use streaming mode, get first 500 results in 0.1 second, all results in 1.0 second.
- @param querytype:
- """
-
- """Querying all images """
-
- query = " SELECT ?url ?mime ?camera ?exposuretime ?fnumber ?focallength \
- WHERE {\
- ?image a nmm:Photo; \
- nie:url ?url; \
- nie:mimeType ?mime. \
- OPTIONAL { ?image nfo:height ?height .}\
- OPTIONAL { ?image nfo:width ?width .}\
- OPTIONAL { ?image nfo:equipment [ nfo:model ?camera ] .}\
- OPTIONAL { ?image nmm:exposureTime ?exposuretime .}\
- OPTIONAL { ?image nmm:fnumber ?fnumber .}\
- OPTIONAL { ?image nmm:focalLength ?focallength .}} LIMIT 10000"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all images = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_09, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_09.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
-
- def test_gallery_10(self):
-
- """
- Time taken for querying 500 images.
- @param description: Time taken for querying 500 images
- @param expected_value:
- @param querytype:
- """
-
- """Querying 500 images """
-
- query = " SELECT ?url ?mime ?camera ?exposuretime ?fnumber ?focallength \
- WHERE {\
- ?image a nmm:Photo; \
- nie:url ?url; \
- nie:mimeType ?mime. \
- OPTIONAL { ?image nfo:height ?height .}\
- OPTIONAL { ?image nfo:width ?width .}\
- OPTIONAL { ?image nfo:equipment [ nfo:model ?camera ] .}\
- OPTIONAL { ?image nmm:exposureTime ?exposuretime .}\
- OPTIONAL { ?image nmm:fnumber ?fnumber .}\
- OPTIONAL { ?image nmm:focalLength ?focallength .}} LIMIT 500"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 500 images = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_10, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_10.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
- def test_gallery_11(self):
-
- """
- Time taken for querying 500 images and videos.
- @param description: Time taken for querying 500 images and videos
- @param expected_value:
- @param querytype:
- """
-
- """ Querying for 500 Images and Videos with UNION for them """
-
- query = "SELECT ?url \
- WHERE { \
- {?media a nmm:Photo.} UNION {?media a nmm:Video.} \
- ?media nie:url ?url.\
- ?media nfo:fileName ?filename .\
- ?media nfo:fileLastModified ?modified .\
- OPTIONAL {?media nfo:width ?_width. } \
- OPTIONAL { ?media nfo:height ?_height .} } \
- ORDER BY ?modified LIMIT 500"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query,timeout=1000)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 500 images and videos = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_11, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_11.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_gallery_12(self):
-
- """
- Time taken for querying all images.
- @param description: TTime taken for querying all images
- @param expected_value:
- @param querytype:
- """
-
- """Querying all images """
- """simplified version of test_gallery_09 """
-
- query = "SELECT nie:url(?image) nie:mimeType(?image) nfo:model (nfo:equipment (?image)) nmm:exposureTime(?image) nmm:fnumber(?image) nmm:focalLength(?image) WHERE { ?image a nmm:Photo . } limit 10000"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying all images = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_12, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_12.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_gallery_13(self):
-
- """
- Time taken for querying 500 images.
- @param description: Time taken for querying 500 images
- @param expected_value:
- @param querytype:
- """
-
- """Querying 500 images """
- """simplified version of test_gallery_10 """
-
- query = "SELECT nie:url(?image) nie:mimeType(?image) nfo:model (nfo:equipment (?image)) nmm:exposureTime(?image) nmm:fnumber(?image) nmm:focalLength(?image) WHERE { ?image a nmm:Photo . } limit 500"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for querying 500 images = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(gallery.test_gallery_13, query)
- t.rows.append(hd.TableRow([gallery.test_gallery_13.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
-class ftsmatch (TestUpdate) :
-
- def test_fts_01 (self):
-
- """
- Time taken for searching an artist in 10000 music files.
- @param description: Time taken for searching an artist in 10000 music files
- @param expected_value:
- @param querytype:
- """
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'ArtistName' }"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for searching an artist in 10000 music files %s" %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(ftsmatch.test_fts_01, query)
- t.rows.append(hd.TableRow([ftsmatch.test_fts_01.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_fts_02 (self) :
-
- """
- Time taken for searching a word.
- @param description: Time taken for searching a word
- @param expected_value:
- @param querytype:
- """
-
- """ Searching for a word """
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'WordInPlainText' . } "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for searching a word = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(ftsmatch.test_fts_02, query)
- t.rows.append(hd.TableRow([ftsmatch.test_fts_02.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_fts_03 (self):
-
- """
- Time taken for searching an artist in 10000 music files.
- @param description: Time taken for searching an artist in 10000 music files
- @param expected_value:
- @param querytype:
- """
-
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'ArtistNa*'}"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for searching an artist in 10000 music files %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(ftsmatch.test_fts_03, query)
- t.rows.append(hd.TableRow([ftsmatch.test_fts_03.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_fts_04 (self):
-
- """
- Time taken for searching an artist in 10000 music files.
- @param description: Time taken for searching an artist in 10000 music files
- @param expected_value:
- @param querytype:
- """
-
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'Art*' }"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for searching an artist in 10000 music files %s" %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(ftsmatch.test_fts_04, query)
- t.rows.append(hd.TableRow([ftsmatch.test_fts_04.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_fts_05 (self):
-
- """
- Time taken for searching an artist in 10000 music files.
- @param description: Time taken for searching an artist in 10000 music files
- @param expected_value:
- @param querytype:
- """
-
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'Ar*'}"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for searching an artist in 10000 music files %s" %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(ftsmatch.test_fts_05, query)
- t.rows.append(hd.TableRow([ftsmatch.test_fts_05.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_fts_06 (self):
-
- """
- Time taken for searching an artist in 10000 music files.
- @param description: Time taken for searching an artist in 10000 music files
- @param expected_value:
- @param querytype:
- """
-
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'A*' }"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for searching an artist in 10000 music files %s" %elapse
- print "no.of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(ftsmatch.test_fts_06, query)
- t.rows.append(hd.TableRow([ftsmatch.test_fts_06.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_fts_07 (self):
-
- """
- Time taken for searching an artist in 10000 music files.
- @param description: Time taken for searching an artist in 10000 music files
- @param expected_value:
- @param querytype:
- """
-
-
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'A* p*' }"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for searching an artist in 10000 music files %s" %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(ftsmatch.test_fts_07, query)
- t.rows.append(hd.TableRow([ftsmatch.test_fts_07.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_fts_08 (self):
-
- """
- Time taken for searching an artist in 10000 music files.
- @param description: Time taken for searching an artist in 10000 music files
- @param expected_value:
- @param querytype:
- """
-
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'A* p* k*' }"
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken for searching an artist in 10000 music files %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(ftsmatch.test_fts_08, query)
- t.rows.append(hd.TableRow([ftsmatch.test_fts_08.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-
-
-class content_manager (TestUpdate) :
-
- def test_cm_01 (self):
-
- """
- Time taken to get 100 contacts that match fts and get relevant UI info for them.
- @param description: Time taken to get 100 contacts that match fts and get relevant UI info for them
- @param expected_value:
- @param querytype:
- """
-
-
- """Get all the contacts that match fts and get relevant UI info for them"""
-
- query = "SELECT ?url ?photourl ?imstatus tracker:coalesce(?family, ?given, ?orgname, ?nick, ?email, ?phone, ?blog) \
- WHERE { { ?url a nco:PersonContact.?url fts:match 'fami*'. } \
- UNION { ?url a nco:PersonContact. ?url nco:hasEmailAddress ?add.?add fts:match 'fami*'. } \
- UNION { ?url a nco:PersonContact. ?url nco:hasPostalAddress ?post.?post fts:match 'fami*'. } \
- OPTIONAL { ?url maemo:relevance ?relevance.} \
- OPTIONAL { ?url nco:photo ?photo. ?photo nie:url ?photourl.} \
- OPTIONAL { ?url nco:imContactStatusMessage ?imstatus.} \
- OPTIONAL { ?url nco:nameFamily ?family.} \
- OPTIONAL { ?url nco:nameFamily ?given.} \
- OPTIONAL { ?url nco:org ?org. ?org nco:nameGiven ?orgname.} \
- OPTIONAL { ?url nco:hasIMAccount ?acc. ?acc nco:imNickname ?nick.} \
- OPTIONAL { ?url nco:hasEmailAddress ?hasemail. ?hasemail nco:emailAddress ?email.} \
- OPTIONAL { ?url nco:hasPhoneNumber ?hasphone. ?hasphone nco:phoneNumber ?phone.} \
- OPTIONAL { ?url nco:blogUrl ?blog.}} \
- ORDER BY ?relevance \
- LIMIT 100"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 100 contacts that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(content_manager.test_cm_01, query)
- t.rows.append(hd.TableRow([content_manager.test_cm_01.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_cm_02 (self):
-
- """
- Time taken to get 100 contacts that match fts and get relevant UI info for them.
- @param description: Time taken to get 100 contacts that match fts and get relevant UI info for them
- @param expected_value: 6.13
- @param querytype:
- """
-
-
- """Get all the contacts that match fts and get relevant UI info for them"""
-
- query = "SELECT ?url tracker:coalesce(nco:nameFamily(?url), nco:nameGiven(?url), 'unknown') \
- WHERE { \
- { ?url a nco:PersonContact.?url fts:match 'fami*'. } \
- UNION { ?url a nco:PersonContact. ?url nco:hasEmailAddress ?add.?add fts:match 'fami*'. } \
- UNION { ?url a nco:PersonContact. ?url nco:hasPostalAddress ?post.?post fts:match 'fami*'. } \
- } LIMIT 100"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 100 contacts that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(content_manager.test_cm_02, query)
- t.rows.append(hd.TableRow([content_manager.test_cm_02.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_cm_03 (self):
-
- """
- Time taken to get 100 contacts that match fts and get relevant UI info for them.
- @param description: Time taken to get 100 contacts that match fts and get relevant UI info for them
- @param expected_value:
- @param querytype:
- """
-
-
- """Get all the messages """
-
- query = "SELECT ?url nie:title(?url) \
- WHERE { \
- { ?url a nmo:Message. ?url fts:match 'fami*'. } \
- UNION { ?url a nmo:Message. ?url nmo:from ?from . ?from fts:match 'fami*'. } \
- UNION { ?url a nmo:Message. ?url nmo:recipient ?to . ?to fts:match 'fami*'. } \
- } LIMIT 100"
-
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 100 contacts that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(content_manager.test_cm_03, query)
- t.rows.append(hd.TableRow([content_manager.test_cm_03.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_cm_04 (self):
-
- """
- Time taken to get 100 contacts that match fts and get relevant UI info for them.
- @param description: Time taken to get 100 contacts that match fts and get relevant UI info for them
- @param expected_value: 8.77
- @param querytype:
- """
-
- """Get all the messages """
-
- query = "SELECT ?url ?fileLastModified ?relevance ?fileName ?mimeType ?url2 \
- WHERE { \
- ?url a nfo:Image .\
- ?url nfo:fileLastModified ?fileLastModified. \
- ?url nfo:fileName ?fileName .\
- ?url nie:mimeType ?mimeType .\
- ?url nie:url ?url2 . \
- OPTIONAL { ?url maemo:relevance ?relevance. } \
- } ORDER BY ?_fileName"
-
- list=[]
- for i in range ( 0, iterations ):
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 100 contacts that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(content_manager.test_cm_04, query)
- t.rows.append(hd.TableRow([content_manager.test_cm_04.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_cm_05 (self):
-
- """
- Time taken to get 100 content items that match fts without UI info for them.
- @param description: Time taken to get 100 content items that match fts without UI info for them
- @param expected_value:
- @param querytype:
- """
-
- """Get all the matching data """
-
- query = "SELECT ?glob_url \
- WHERE \
- { \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmo:Message . \
- ?url fts:match 'fami*' . \
- ?url nmo:from ?from . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmo:Message . \
- ?url nmo:from ?from . \
- ?from fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmo:Message . \
- ?url nmo:to ?to . \
- ?to fts:match 'fami*' . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmo:Message. \
- ?url nmo:communicationChannel ?cha . \
- ?cha fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nco:PersonContact . \
- ?url fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nco:PersonContact . \
- ?url nco:hasEmailAddress ?email . \
- ?email fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nco:PersonContact . \
- ?url nco:hasPostalAddress ?post . \
- ?post fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmm:MusicPiece . \
- ?url nmm:performer ?artist . \
- ?artist fts:match 'fami*' . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmm:MusicPiece . \
- ?url nmm:musicAlbum ?album . \
- ?album fts:match 'fami*' . } } \
- } \
- LIMIT 100"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 100 content items that match fts without UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(content_manager.test_cm_05, query)
- t.rows.append(hd.TableRow([content_manager.test_cm_05.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_cm_06 (self):
-
- """
- Time taken to get 100 content items that match fts and get relevant UI info for them.
- @param description: Time taken to get 100 content items that match fts and get relevant UI info for them
- @param expected_value:
- @param querytype:
- """
-
- """Get all the matching data """
-
- query = "SELECT ?glob_url ?first ?second \
- WHERE \
- { \
- { SELECT ?url as ?glob_url \
- nmo:messageSubject(?url) as ?first \
- tracker:coalesce(nco:fullname(?from), nco:nameGiven(?from), nco:nameFamily(?from), nco:org(?from),'unknown') as ?second \
- WHERE { ?url a nmo:Message . \
- ?url fts:match 'fami*' . \
- ?url nmo:from ?from . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nmo:messageSubject(?url) as ?first \
- tracker:coalesce(nco:fullname(?from), nco:nameGiven(?from), nco:nameFamily(?from), nco:org(?from),'unknown') as ?second \
- WHERE { ?url a nmo:Message . \
- ?url nmo:from ?from . \
- ?from fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nmo:messageSubject(?url) as ?first \
- tracker:coalesce(nco:fullname(?from), nco:nameGiven(?from), nco:nameFamily(?from), nco:org(?from),'unknown') as ?second \
- WHERE { ?url a nmo:Message . \
- ?url nmo:to ?to . \
- ?to fts:match 'fami*' . \
- ?url nmo:from ?from . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nmo:messageSubject(?url) as ?first \
- tracker:coalesce(nco:fullname(?from), nco:nameGiven(?from), nco:nameFamily(?from), nco:org(?from),'unknown') as ?second \
- WHERE { ?url a nmo:Message. \
- ?url nmo:communicationChannel ?cha . \
- ?cha fts:match 'fami*'. \
- ?url nmo:from ?from . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- tracker:coalesce(nco:fullname(?url), nco:nameGiven(?url), nco:nameFamily(?url), nco:org(?url),'unknown') as ?first \
- tracker:coalesce(nco:emailAddress(?email), nco:imNickname(?im), 'unknown') as ?second \
- WHERE { ?url a nco:PersonContact . \
- ?url fts:match 'fami*'. \
- { SELECT ?em as ?email WHERE { ?url nco:hasEmailAddress ?em } LIMIT 1 } \
- { SELECT ?imadd as ?im WHERE { ?url nco:hasIMAddress ?imadd } LIMIT 1 } } } \
- UNION \
- { SELECT ?url as ?glob_url \
- tracker:coalesce(nco:fullname(?url), nco:nameGiven(?url), nco:nameFamily(?url), nco:org(?url),'unknown') as ?first \
- tracker:coalesce(nco:emailAddress(?email), nco:imNickname(?im), 'unknown') as ?second \
- WHERE { ?url a nco:PersonContact . \
- ?url nco:hasEmailAddress ?email . \
- ?email fts:match 'fami*'. \
- { SELECT ?imadd as ?im WHERE { ?url nco:hasIMAddress ?imadd } LIMIT 1 } } } \
- UNION \
- { SELECT ?url as ?glob_url \
- tracker:coalesce(nco:fullname(?url), nco:nameGiven(?url), nco:nameFamily(?url), nco:org(?url),'unknown') as ?first \
- tracker:coalesce(nco:emailAddress(?email), nco:imNickname(?im), 'unknown') as ?second \
- WHERE { ?url a nco:PersonContact . \
- ?url nco:hasPostalAddress ?post . \
- ?post fts:match 'fami*'. \
- { SELECT ?em as ?email WHERE { ?url nco:hasEmailAddress ?em } LIMIT 1 } \
- { SELECT ?imadd as ?im WHERE { ?url nco:hasIMAddress ?imadd } LIMIT 1 } } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nie:title(?url) as ?first \
- fn:concat(nmm:artistName(?artist),'-',nmm:albumTitle(?album)) \
- WHERE { ?url a nmm:MusicPiece . \
- ?url nmm:performer ?artist . \
- ?artist fts:match 'fami*' . \
- OPTIONAL { ?url nmm:musicAlbum ?album . } } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nie:title(?url) as ?first \
- fn:concat(nmm:artistName(?artist),'-',nmm:albumTitle(?album)) \
- WHERE { ?url a nmm:MusicPiece . \
- ?url nmm:musicAlbum ?album . \
- ?album fts:match 'fami*' . \
- OPTIONAL { ?url nmm:performer ?artist }} } \
- } \
- LIMIT 100"
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 100 content items that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(content_manager.test_cm_06, query)
- t.rows.append(hd.TableRow([content_manager.test_cm_06.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-class contacts (TestUpdate) :
-
- def test_contacts_01 (self):
-
- """
- Time taken to get 50 contacts basic information (original).
- @param description: Time taken to get 50 contacts basic information (original)(Bug : 176170)
- @param expected_value:
- @param querytype: Original
- """
-
- query = " \
- SELECT \
- ?_contact \
- ?_Avatar_ImageUrl \
- ?_Birthday_Birthday \
- bound(?_Gender_Gender) AS ?_Gender_Gender_IsBound \
- (?_Gender_Gender = nco:gender-female) AS ?_Gender_Gender_IsEqual_Female \
- (?_Gender_Gender = nco:gender-male) AS ?_Gender_Gender_IsEqual_Male \
- ?_Guid_Guid \
- ?_Name_Prefix \
- ?_Name_FirstName \
- ?_Name_MiddleName \
- ?_Name_LastName \
- ?_Name_Suffix \
- ?_Nickname_Nickname \
- ?_Note_Note \
- ?_Timestamp_CreationTimestamp \
- ?_Timestamp_ModificationTimestamp \
- WHERE \
- { \
- { \
- ?_contact rdf:type nco:PersonContact . \
- OPTIONAL { ?_contact nco:photo ?__1 . ?__1 nfo:fileUrl ?_Avatar_ImageUrl . } \
- OPTIONAL { ?_contact nco:birthDate ?_Birthday_Birthday . } \
- OPTIONAL { ?_contact nco:gender ?_Gender_Gender . } \
- OPTIONAL { ?_contact nco:contactUID ?_Guid_Guid . } \
- OPTIONAL { ?_contact nco:nameHonorificPrefix ?_Name_Prefix . } \
- OPTIONAL { ?_contact nco:nameGiven ?_Name_FirstName . } \
- OPTIONAL { ?_contact nco:nameAdditional ?_Name_MiddleName . } \
- OPTIONAL { ?_contact nco:nameFamily ?_Name_LastName . } \
- OPTIONAL { ?_contact nco:nameHonorificSuffix ?_Name_Suffix . } \
- OPTIONAL { ?_contact nco:nickname ?_Nickname_Nickname . } \
- OPTIONAL { ?_contact nco:note ?_Note_Note . } \
- OPTIONAL { ?_contact nie:contentCreated ?_Timestamp_CreationTimestamp . } \
- OPTIONAL { ?_contact nie:contentLastModified ?_Timestamp_ModificationTimestamp . } \
- } \
- } \
- ORDER BY ?_contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts basic information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_01, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_01.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_contacts_02 (self):
-
- """
- Time taken to get 50 contacts basic information (modified)
- @param description: Time taken to get 50 contacts basic information (modified)
- @param expected_value:
- @param querytype: Modified
- """
-
- query = " \
- SELECT \
- ?_contact \
- ?_Avatar_ImageUrl \
- nco:birthDate(?_contact) \
- bound(?_Gender_Gender) \
- (?_Gender_Gender = nco:gender-female) \
- (?_Gender_Gender = nco:gender-male) \
- nco:contactUID(?_contact) \
- nco:nameHonorificPrefix(?_contact) \
- nco:nameGiven(?_contact) \
- nco:nameAdditional(?_contact) \
- nco:nameFamily(?_contact) \
- nco:nameHonorificSuffix(?_contact) \
- nco:nickname(?_contact) \
- nco:note(?_contact) \
- nie:contentCreated(?_contact) \
- nie:contentLastModified(?_contact) \
- WHERE \
- { \
- { \
- ?_contact rdf:type nco:PersonContact . \
- OPTIONAL { ?_contact nco:photo ?__1 . ?__1 nfo:fileUrl ?_Avatar_ImageUrl . } \
- OPTIONAL { ?_contact nco:gender ?_Gender_Gender . } \
- } \
- } \
- ORDER BY ?_contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts basic information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_02, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_02.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_contacts_03 (self):
-
- """
- Time taken to get 50 contacts address information (original)
- @param description: Time taken to get 50 contacts address information (original)
- @param expected_value:
- @param querytype: Original
- """
-
- query = " \
- SELECT \
- ?_contact \
- ?_Address_Country \
- ?_Address_Locality \
- ?_Address_PostOfficeBox \
- ?_Address_Postcode \
- ?_Address_Region \
- ?_Address_Street \
- bound(?_Address_SubTypes_Domestic) AS ?_Address_SubTypes_Domestic_IsBound \
- bound(?_Address_SubTypes_International) AS ?_Address_SubTypes_International_IsBound \
- bound(?_Address_SubTypes_Parcel) AS ?_Address_SubTypes_Parcel_IsBound \
- bound(?_Address_SubTypes_Postal) AS ?_Address_SubTypes_Postal_IsBound \
- bound(?_Address_Context_Work) AS ?_Address_Context_Work_IsBound \
- WHERE \
- { \
- { \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasPostalAddress ?__1 . \
- ?__1 nco:country ?_Address_Country . \
- ?__1 nco:locality ?_Address_Locality . \
- ?__1 nco:pobox ?_Address_PostOfficeBox . \
- ?__1 nco:postalcode ?_Address_Postcode . \
- ?__1 nco:region ?_Address_Region . \
- ?__1 nco:streetAddress ?_Address_Street . \
- OPTIONAL { \
- ?__1 rdf:type ?_Address_SubTypes_Domestic . \
- FILTER((?_Address_SubTypes_Domestic = nco:DomesticDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__1 rdf:type ?_Address_SubTypes_International . \
- FILTER((?_Address_SubTypes_International = nco:InternationalDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__1 rdf:type ?_Address_SubTypes_Parcel . \
- FILTER((?_Address_SubTypes_Parcel = nco:ParcelDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__1 rdf:type ?_Address_SubTypes_Postal . \
- FILTER((?_Address_SubTypes_Postal = nco:PostalAddress)) . \
- } \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_Address_Context_Work . \
- ?_Address_Context_Work nco:hasPostalAddress ?__2 . \
- ?__2 nco:country ?_Address_Country . \
- ?__2 nco:locality ?_Address_Locality . \
- ?__2 nco:pobox ?_Address_PostOfficeBox . \
- ?__2 nco:postalcode ?_Address_Postcode . \
- ?__2 nco:region ?_Address_Region . \
- ?__2 nco:streetAddress ?_Address_Street . \
- OPTIONAL { \
- ?__2 rdf:type ?_Address_SubTypes_Domestic . \
- FILTER((?_Address_SubTypes_Domestic = nco:DomesticDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__2 rdf:type ?_Address_SubTypes_International . \
- FILTER((?_Address_SubTypes_International = nco:InternationalDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__2 rdf:type ?_Address_SubTypes_Parcel . \
- FILTER((?_Address_SubTypes_Parcel = nco:ParcelDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__2 rdf:type ?_Address_SubTypes_Postal . \
- FILTER((?_Address_SubTypes_Postal = nco:PostalAddress)) . \
- } \
- } \
- } \
- } \
- ORDER BY ?_contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts address information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_03, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_03.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_contacts_04 (self):
-
- """
- Time taken to get 50 contacts address information (modified)
- @param description: Time taken to get 50 contacts address information (modified)
- @param expected_value:
- @param querytype: Modified
- """
-
- query = " \
- SELECT \
- ?contact \
- nco:country(?postal) \
- nco:locality(?postal) \
- nco:pobox(?postal) \
- nco:postalcode(?postal) \
- nco:region(?postal) \
- nco:streetAddress(?postal) \
- bound(?work) \
- WHERE \
- { \
- ?contact rdf:type nco:PersonContact . \
- { ?contact nco:hasPostalAddress ?postal . } \
- UNION \
- { ?contact nco:hasAffiliation ?work . \
- ?work nco:hasPostalAddress ?postal . \
- } \
- } \
- ORDER BY ?contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts address information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_04, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_04.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_contacts_05 (self):
-
- """
- Time taken to get 50 contacts email information (original)
- @param description: Time taken to get 50 contacts email information (original)
- @param expected_value:
- @param querytype: Original
- """
-
-
- query = " \
- SELECT \
- ?_contact ?_EmailAddress ?_EmailAddress_EmailAddress \
- bound(?_EmailAddress_Context_Work) AS ?_EmailAddress_Context_Work_IsBound \
- WHERE \
- { \
- { \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasEmailAddress ?_EmailAddress . \
- ?_EmailAddress nco:emailAddress ?_EmailAddress_EmailAddress . \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_EmailAddress_Context_Work . \
- ?_EmailAddress_Context_Work nco:hasEmailAddress ?_EmailAddress . \
- ?_EmailAddress nco:emailAddress ?_EmailAddress_EmailAddress . \
- } \
- } \
- } \
- ORDER BY ?_contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts email information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_05, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_05.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_contacts_06 (self):
-
- """
- Time taken to get 50 contacts email information (modified).
- @param description: Time taken to get 50 contacts email information (modified)
- @param expected_value:
- @param querytype: Modified
- """
-
- query = " \
- SELECT \
- ?contact \
- ?email \
- nco:emailAddress(?email) \
- bound(?work) \
- WHERE \
- { \
- { \
- ?contact rdf:type nco:PersonContact . \
- { \
- ?contact nco:hasEmailAddress ?email . \
- } \
- UNION \
- { \
- ?contact nco:hasAffiliation ?work . \
- ?work nco:hasEmailAddress ?email . \
- } \
- } \
- } \
- ORDER BY ?_contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts email information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_06, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_06.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_contacts_07 (self):
-
- """
- Time taken to get 50 contacts online information (original)
- @param description: Time taken to get 50 contacts online information (original)
- @param expected_value:
- @param querytype: Original
- """
-
- query = " \
- SELECT \
- ?_contact \
- ?_OnlineAccount \
- ?_OnlineAccount_AccountUri \
- ?_OnlineAccount_ServiceProvider \
- bound(?_OnlineAccount_Capabilities) \
- AS ?_OnlineAccount_Capabilities_IsBound \
- (?_OnlineAccount_Capabilities = nco:im-capability-text-chat) \
- AS ?_OnlineAccount_Capabilities_IsEqual_TextChat \
- (?_OnlineAccount_Capabilities = nco:im-capability-media-calls) \
- AS ?_OnlineAccount_Capabilities_IsEqual_MediaCalls \
- (?_OnlineAccount_Capabilities = nco:im-capability-audio-calls) \
- AS ?_OnlineAccount_Capabilities_IsEqual_AudioCalls \
- (?_OnlineAccount_Capabilities = nco:im-capability-video-calls) \
- AS ?_OnlineAccount_Capabilities_IsEqual_VideoCalls \
- (?_OnlineAccount_Capabilities = nco:im-capability-upgrading-calls) \
- AS ?_OnlineAccount_Capabilities_IsEqual_UpgradingCalls \
- (?_OnlineAccount_Capabilities = nco:im-capability-file-transfers) \
- AS ?_OnlineAccount_Capabilities_IsEqual_FileTransfers \
- (?_OnlineAccount_Capabilities = nco:im-capability-stream-tubes) \
- AS ?_OnlineAccount_Capabilities_IsEqual_StreamTubes \
- (?_OnlineAccount_Capabilities = nco:im-capability-dbus-tubes) \
- AS ?_OnlineAccount_Capabilities_IsEqual_DBusTubes \
- bound(?_OnlineAccount_Context_Work) \
- AS ?_OnlineAccount_Context_Work_IsBound \
- WHERE \
- { \
- { \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasIMAddress ?_OnlineAccount . \
- ?_OnlineAccount nco:imID ?_OnlineAccount_AccountUri . \
- ?_OnlineAccount nco:imCapability ?_OnlineAccount_Capabilities . \
- OPTIONAL { ?_OnlineAccount_ServiceProvider nco:hasIMContact ?_OnlineAccount . } \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_OnlineAccount_Context_Work . \
- ?_OnlineAccount_Context_Work nco:hasIMAddress ?_OnlineAccount .\
- ?_OnlineAccount nco:imID ?_OnlineAccount_AccountUri . \
- ?_OnlineAccount nco:imCapability ?_OnlineAccount_Capabilities . \
- OPTIONAL { ?_OnlineAccount_ServiceProvider nco:hasIMContact ?_OnlineAccount . } \
- } \
- } \
- } \
- ORDER BY ?_contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts online information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_07, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_07.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_contacts_08 (self):
-
- """
- Time taken to get 50 contacts online information (modified)
- @param description: Time taken to get 50 contacts online information (modified)
- @param expected_value:
- @param querytype: Modified
- """
-
- query = " \
- SELECT \
- ?_contact \
- ?_OnlineAccount \
- ?_OnlineAccount_AccountUri \
- ?_OnlineAccount_ServiceProvider \
- bound(?ork) \
- WHERE \
- { \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasIMAddress ?_OnlineAccount . \
- ?_OnlineAccount nco:imID ?_OnlineAccount_AccountUri . \
- OPTIONAL { ?_OnlineAccount_ServiceProvider nco:hasIMContact ?_OnlineAccount . } \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_OnlineAccount_Context_Work . \
- ?_OnlineAccount_Context_Work nco:hasIMAddress ?_OnlineAccount . \
- ?_OnlineAccount nco:imID ?_OnlineAccount_AccountUri . \
- OPTIONAL { ?_OnlineAccount_ServiceProvider nco:hasIMContact ?_OnlineAccount . } \
- } \
- } \
- ORDER BY ?_contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts online information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_08, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_08.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_contacts_09 (self):
-
- """
- Time taken to get 50 contacts phone number information (original)
- @param description: Time taken to get 50 contacts phone number information (original)
- @param expected_value:
- @param querytype: Original
- """
-
- query = " \
- SELECT \
- ?_contact ?_PhoneNumber ?_PhoneNumber_PhoneNumber \
- bound(?_PhoneNumber_SubTypes_BulletinBoardSystem) AS ?_PhoneNumber_SubTypes_BulletinBoardSystem_IsBound \
- bound(?_PhoneNumber_SubTypes_Car) AS ?_PhoneNumber_SubTypes_Car_IsBound \
- bound(?_PhoneNumber_SubTypes_Fax) AS ?_PhoneNumber_SubTypes_Fax_IsBound \
- bound(?_PhoneNumber_SubTypes_MessagingCapable) AS ?_PhoneNumber_SubTypes_MessagingCapable_IsBound \
- bound(?_PhoneNumber_SubTypes_Mobile) AS ?_PhoneNumber_SubTypes_Mobile_IsBound \
- bound(?_PhoneNumber_SubTypes_Modem) AS ?_PhoneNumber_SubTypes_Modem_IsBound \
- bound(?_PhoneNumber_SubTypes_Pager) AS ?_PhoneNumber_SubTypes_Pager_IsBound \
- bound(?_PhoneNumber_SubTypes_Video) AS ?_PhoneNumber_SubTypes_Video_IsBound \
- bound(?_PhoneNumber_SubTypes_Voice) AS ?_PhoneNumber_SubTypes_Voice_IsBound \
- bound(?_PhoneNumber_Context_Work) AS ?_PhoneNumber_Context_Work_IsBound \
- WHERE \
- { \
- { \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasPhoneNumber ?_PhoneNumber . \
- ?_PhoneNumber nco:phoneNumber ?_PhoneNumber_PhoneNumber . \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_BulletinBoardSystem . \
- FILTER((?_PhoneNumber_SubTypes_BulletinBoardSystem = nco:BbsNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Car . \
- FILTER((?_PhoneNumber_SubTypes_Car = nco:CarPhoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Fax . \
- FILTER((?_PhoneNumber_SubTypes_Fax = nco:FaxNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_MessagingCapable . \
- FILTER((?_PhoneNumber_SubTypes_MessagingCapable = nco:MessagingNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Mobile . \
- FILTER((?_PhoneNumber_SubTypes_Mobile = nco:CellPhoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Modem . \
- FILTER((?_PhoneNumber_SubTypes_Modem = nco:ModemNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Pager . \
- FILTER((?_PhoneNumber_SubTypes_Pager = nco:PagerNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Video . \
- FILTER((?_PhoneNumber_SubTypes_Video = nco:VideoTelephoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Voice . \
- FILTER((?_PhoneNumber_SubTypes_Voice = nco:VoicePhoneNumber)) . \
- } \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_PhoneNumber_Context_Work . \
- ?_PhoneNumber_Context_Work nco:hasPhoneNumber ?_PhoneNumber . \
- ?_PhoneNumber nco:phoneNumber ?_PhoneNumber_PhoneNumber . \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_BulletinBoardSystem . \
- FILTER((?_PhoneNumber_SubTypes_BulletinBoardSystem = nco:BbsNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Car . \
- FILTER((?_PhoneNumber_SubTypes_Car = nco:CarPhoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Fax . \
- FILTER((?_PhoneNumber_SubTypes_Fax = nco:FaxNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_MessagingCapable . \
- FILTER((?_PhoneNumber_SubTypes_MessagingCapable = nco:MessagingNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Mobile . \
- FILTER((?_PhoneNumber_SubTypes_Mobile = nco:CellPhoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Modem . \
- FILTER((?_PhoneNumber_SubTypes_Modem = nco:ModemNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Pager . \
- FILTER((?_PhoneNumber_SubTypes_Pager = nco:PagerNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Video . \
- FILTER((?_PhoneNumber_SubTypes_Video = nco:VideoTelephoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Voice . \
- FILTER((?_PhoneNumber_SubTypes_Voice = nco:VoicePhoneNumber)) . \
- } \
- } \
- } \
- } \
- ORDER BY ?_contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts phone number information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_09, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_09.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_contacts_10 (self):
-
- """
- Time taken to get 50 contacts phone number information (modified)
- @param description: Time taken to get 50 contacts phone number information (modified)
- @param expected_value:
- @param querytype: Modified
- """
-
- query = " \
- SELECT \
- ?contact \
- ?phoneNumber \
- nco:phoneNumber(?phoneNumber) \
- bound(?work) \
- WHERE \
- { \
- ?contact rdf:type nco:PersonContact . \
- { \
- ?contact nco:hasPhoneNumber ?phoneNumber . \
- } \
- UNION \
- { \
- ?contact nco:hasAffiliation ?work . \
- ?work nco:hasPhoneNumber ?phoneNumber . \
- } \
- } \
- ORDER BY ?_contact LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts phone number information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_10, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_10.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_contacts_11 (self):
-
- """
- Time taken to get 50 contacts phone number information (modified)
- @param description: Time taken to get 50 contacts phone number information (modified)
- @param expected_value:
- @param querytype:
- """
-
- query = " \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 contacts phone number information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(contacts.test_contacts_10, query)
- t.rows.append(hd.TableRow([contacts.test_contacts_10.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-class location (TestUpdate) :
-
- def test_location_01 (self):
-
- """
- Time taken to get 50 landmarks (original).
- @param description: Time taken to get 50 landmarks (original)
- @param expected_value:
- @param querytype: Original
- """
-
- query = " \
- SELECT \
- ?urn \
- ?cLat ?cLon ?cAlt ?cRad \
- ?nwLat ?nwLon ?nwAlt \
- ?seLat ?seLon ?seAlt \
- ?country ?district ?city ?street ?postalcode \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- WHERE { \
- ?urn a mlo:Landmark . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asPostalAddress \
- [ \
- a nco:PostalAddress ; \
- nco:country ?country ; \
- nco:region ?district ; \
- nco:locality ?city ; \
- nco:streetAddress ?street ; \
- nco:postalcode ?postalcode \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asBoundingBox \
- [ \
- a mlo:GeoBoundingBox ; \
- mlo:bbNorthWest \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?nwLat ; \
- mlo:longitude ?nwLon ; \
- mlo:altitude ?nwAlt \
- ] ; \
- mlo:bbSouthEast \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?seLat ; \
- mlo:longitude ?seLon ; \
- mlo:altitude ?seAlt \
- ] \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?cLat ; \
- mlo:longitude ?cLon \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:altitude ?cAlt \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:radius ?cRad \
- ] \
- ] \
- } \
- } ORDER BY ASC(?name) LIMIT 50 \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 landmarks (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(location.test_location_01, query)
- t.rows.append(hd.TableRow([location.test_location_01.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_location_02 (self):
-
- """
- Time taken to get 50 landmarks within coords (original)
- @param description: Time taken to get 50 landmarks within coords (original)
- @param expected_value:
- @param querytype: Original
- """
-
- query = " \
- SELECT \
- ?urn \
- ?cLat ?cLon ?cAlt ?cRad \
- ?nwLat ?nwLon ?nwAlt \
- ?seLat ?seLon ?seAlt \
- ?country ?district ?city ?street ?postalcode \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- WHERE { \
- ?urn a mlo:Landmark . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asPostalAddress \
- [ \
- a nco:PostalAddress ; \
- nco:country ?country ; \
- nco:region ?district ; \
- nco:locality ?city ; \
- nco:streetAddress ?street ; \
- nco:postalcode ?postalcode \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asBoundingBox \
- [ \
- a mlo:GeoBoundingBox ; \
- mlo:bbNorthWest \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?nwLat ; \
- mlo:longitude ?nwLon ; \
- mlo:altitude ?nwAlt \
- ] ; \
- mlo:bbSouthEast \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?seLat ; \
- mlo:longitude ?seLon ; \
- mlo:altitude ?seAlt \
- ] \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?cLat ; \
- mlo:longitude ?cLon \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:altitude ?cAlt \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:radius ?cRad \
- ] \
- ] \
- } \
- FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && ?cLon >= 63.94 && ?cLon <= 64.96) \
- } ORDER BY ASC(?name) LIMIT \
- "
-
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 landmarks within coords (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(location.test_location_02, query)
- t.rows.append(hd.TableRow([location.test_location_02.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_location_03 (self):
-
- """
- Time taken to get max 50 landmarks within certain range with bounding box (original).
- @param description: Time taken to get max 50 landmarks within certain range with bounding box (original)
- @param expected_value:
- @param querytype: Original
- """
-
- query = " \
- SELECT \
- ?urn \
- ?cLat ?cLon ?cAlt ?cRad \
- ?nwLat ?nwLon ?nwAlt \
- ?seLat ?seLon ?seAlt \
- ?country ?district ?city ?street ?postalcode \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
- WHERE { \
- ?urn a mlo:Landmark . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asPostalAddress \
- [ \
- a nco:PostalAddress ; \
- nco:country ?country ; \
- nco:region ?district ; \
- nco:locality ?city ; \
- nco:streetAddress ?street ; \
- nco:postalcode ?postalcode \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asBoundingBox \
- [ \
- a mlo:GeoBoundingBox ; \
- mlo:bbNorthWest \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?nwLat ; \
- mlo:longitude ?nwLon ; \
- mlo:altitude ?nwAlt \
- ] ; \
- mlo:bbSouthEast \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?seLat ; \
- mlo:longitude ?seLon ; \
- mlo:altitude ?seAlt \
- ] \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?cLat ; \
- mlo:longitude ?cLon \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:altitude ?cAlt \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:radius ?cRad \
- ] \
- ] \
- } \
- FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && \
- ?cLon >= 63.94 && ?cLon <= 64.96 && \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
- } ORDER BY ASC(?distance) LIMIT 50 \
- "
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get max 50 landmarks within certain range with bounding box (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(location.test_location_03, query)
- t.rows.append(hd.TableRow([location.test_location_03.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_location_04 (self):
-
- """
- Time taken to get max 50 landmarks within certain range without bounding box (original).
- @param description: Time taken to get max 50 landmarks within certain range without bounding box (original)
- @param expected_value:
- @param querytype: Original
- """
-
- query = " \
- SELECT \
- ?urn \
- ?cLat ?cLon ?cAlt ?cRad \
- ?nwLat ?nwLon ?nwAlt \
- ?seLat ?seLon ?seAlt \
- ?country ?district ?city ?street ?postalcode \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
- WHERE { \
- ?urn a mlo:Landmark . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asPostalAddress \
- [ \
- a nco:PostalAddress ; \
- nco:country ?country ; \
- nco:region ?district ; \
- nco:locality ?city ; \
- nco:streetAddress ?street ; \
- nco:postalcode ?postalcode \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asBoundingBox \
- [ \
- a mlo:GeoBoundingBox ; \
- mlo:bbNorthWest \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?nwLat ; \
- mlo:longitude ?nwLon ; \
- mlo:altitude ?nwAlt \
- ] ; \
- mlo:bbSouthEast \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?seLat ; \
- mlo:longitude ?seLon ; \
- mlo:altitude ?seAlt \
- ] \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?cLat ; \
- mlo:longitude ?cLon \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:altitude ?cAlt \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:radius ?cRad \
- ] \
- ] \
- } \
- FILTER(tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
- } ORDER BY ASC(?distance) LIMIT 50 \
- "
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get max 50 landmarks within certain range without bounding box (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(location.test_location_04, query)
- t.rows.append(hd.TableRow([location.test_location_04.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_location_05 (self):
-
- """
- Time taken to get 50 landmarks (simplified).
- @param description: Time taken to get 50 landmarks (simplified)
- @param expected_value: 6.42
- @param querytype:
- """
-
- query = " \
- SELECT \
- ?urn \
- mlo:latitude(?point) mlo:longitude(?point) mlo:altitude(?point) mlo:radius(?point) \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- WHERE { \
- ?urn a mlo:Landmark . \
- ?urn mlo:location ?location . \
- ?location mlo:asGeoPoint ?point . \
- } ORDER BY ASC(?name) LIMIT 50 \
- "
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get 50 landmarks (simplified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(location.test_location_05, query)
- t.rows.append(hd.TableRow([location.test_location_05.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
- def test_location_06 (self):
-
- """
- Time taken to get max 50 landmarks within coords (simplified).
- @param description: Time taken to get max 50 landmarks within coords (simplified)
- @param expected_value: 0.43
- @param querytype:
- """
-
- query = " \
- SELECT \
- ?urn \
- ?cLat ?cLon mlo:altitude(?point) mlo:radius(?point) \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- WHERE { \
- ?urn a mlo:Landmark . \
- ?urn mlo:location ?location . \
- ?location mlo:asGeoPoint ?point . \
- ?point mlo:latitude ?cLat . \
- ?point mlo:longitude ?cLon . \
- FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && ?cLon >= 63.42 && ?cLon <= 64.96) \
- } ORDER BY ASC(?name) LIMIT 50 \
- "
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get max 50 landmarks within coords (simplified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(location.test_location_06, query)
- t.rows.append(hd.TableRow([location.test_location_06.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_location_07 (self):
-
- """
- Time taken to get max 50 landmarks within range with bounding box (simplified).
- @param description: Time taken to get max 50 landmarks within range with bounding box (simplified)
- @param expected_value: 0.44
- @param querytype:
- """
-
- query = " \
- SELECT \
- ?urn \
- ?cLat ?cLon mlo:altitude(?point) mlo:radius(?point) \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
- WHERE { \
- ?urn a mlo:Landmark . \
- ?urn mlo:location ?location . \
- ?location mlo:asGeoPoint ?point . \
- ?point mlo:latitude ?cLat . \
- ?point mlo:longitude ?cLon . \
- FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && \
- ?cLon >= 63.94 && ?cLon <= 64.96 && \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
- } ORDER BY ASC(?distance) LIMIT 50 \
- "
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get max 50 landmarks within range with bounding box (simplified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(location.test_location_07, query)
- t.rows.append(hd.TableRow([location.test_location_07.__name__, value[0], value[1], list, value[2], len(result), l]))
-
- def test_location_08 (self):
-
- """
- Time taken to get max 50 landmarks within range without bounding box (simplified).
- @param description: Time taken to get max 50 landmarks within range without bounding box (simplified)
- @param expected_value: 0.63
- @param querytype:
- """
-
- query = " \
- SELECT \
- ?urn \
- ?cLat ?cLon mlo:altitude(?point) mlo:radius(?point) \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
- WHERE { \
- ?urn a mlo:Landmark . \
- ?urn mlo:location ?location . \
- ?location mlo:asGeoPoint ?point . \
- ?point mlo:latitude ?cLat . \
- ?point mlo:longitude ?cLon . \
- FILTER(tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
- } ORDER BY ASC(?distance) LIMIT 50 \
- "
- list=[]
- for i in range ( 0, iterations ):
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- elapse = "%.3f" %elapse
- print "Time taken to get max 50 landmarks within range without bounding box (simplified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
- list.append(elapse)
-
- value, l=self.parsing(location.test_location_08, query)
- t.rows.append(hd.TableRow([location.test_location_08.__name__, value[0], value[1], list, value[2], len(result), l]))
-
-
-def header(title):
- global t
- t=hd.Table(width='100%', col_width=('12%', '20%', '5%', '30%', '10%', '10%', '20%'))
- doc.nodes.append(hd.Heading(size='2', heading=title))
- t.rows.append(hd.TableRow(['Test', 'Description', 'ExpectedValue (sec)', 'ActualValue (sec)', 'Query type', 'No of items retrived', 'Query'], header=True))
-
-if __name__ == "__main__":
-
- if not os.path.isdir("report"):
- os.mkdir("report")
- global iterations
- iterations=10
- doc=hd.HtmlDoc()
- doc.nodes.append(hd.Heading(size='1', heading="Tracker Performance Test"))
-
- dict={}
- base={"email" : email, "calls": calls, "instant_messages": instant_messages, "rtcom":rtcom, "audio":audio, "gallery":gallery, "ftsmatch":ftsmatch, "content_manager":content_manager, "contacts":contacts, "location":location }
- if len(sys.argv)==1:
- dict=base
- else:
- for arg in range(1,len(sys.argv)):
- print sys.argv[arg]
- dict[sys.argv[arg]]=base[sys.argv[arg]]
-
- for k, v in dict.items():
- header(k)
- unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(v))
- doc.nodes.append(t)
-
- report=open("./perf_report.html", "a")
- doc.toHtml(report)
- report.close()
-
- #unittest.main()
-
diff --git a/tests/functional-tests/performance-tc.py b/tests/functional-tests/performance-tc.py
deleted file mode 100644
index 6abe38a9d..000000000
--- a/tests/functional-tests/performance-tc.py
+++ /dev/null
@@ -1,2426 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-
-import sys,os,dbus,commands, signal
-import unittest
-import time
-import random
-import datetime
-
-TRACKER = 'org.freedesktop.Tracker1'
-TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources'
-RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
-
-
-
-"""import .ttl files """
-"""
-def stats() :
- a1=commands.getoutput("tracker status --stat |grep %s " %(stats[i]))
- b1=a1.split()
- after=b1[2]
- return after
-
-def import_ttl (music_ttl):
- 1. Checking the tracker stats before importing the ttl file .
- 2. Importing the ttl file .
- 3. Check the tracker status --stat after importing the ttl file.
- 4. Check if the stats got changed.
- bus= dbus.SessionBus()
- imp_obj = bus.get_object('org.freedesktop.Tracker1','/org/freedesktop/Tracker1/Resources')
- imp_iface = dbus.Interface(imp_obj, 'org.freedesktop.Tracker1.Resources')
- #stats_obj = bus.get_object('org.freedesktop.Tracker1','/org/freedesktop/Tracker1/Statistics')
- #stats_iface = dbus.Interface(stats_obj, 'org.freedesktop.Tracker1.Statistics')
-
- ttl=['040-nmm_Artist.ttl']
- stats=['nmm:Artist','nmm:MusicAlbum']
- for i in range(len(ttl)) :
- file_ttl='file://' +music_ttl+'/'+ttl[i]
- a=commands.getoutput("tracker status --stat | grep %s " %(stats[i]) )
- b=a.split()
- imp_iface.Load(file_ttl)
- a1=commands.getoutput("tracker status --stat |grep %s " %(stats[i]))
- b1=a1.split()
- after=b1[2]
- while (t < 2):
- t=stats()
- time.sleep(2)
-
-"""
-
-
-
-
-
-
-class TestUpdate (unittest.TestCase):
-
- def setUp(self):
- bus = dbus.SessionBus()
- tracker = bus.get_object(TRACKER, TRACKER_OBJ)
- self.resources = dbus.Interface (tracker,
- dbus_interface=RESOURCES_IFACE)
-
-
-""" email performance test cases """
-class email(TestUpdate):
-
-
- def p_test_email_01(self):
-
- query = "SELECT ?m ?From ?date ?email1 WHERE { \
- ?m a nmo:Email ; \
- nmo:receivedDate ?date ;\
- nmo:from ?From . ?from nco:hasEmailAddress ?email1 } LIMIT 10000"
-
- """Query for emails """
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying emails = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
-
-
-""" calls performance test cases """
-class calls(TestUpdate):
-
-
- def p_test_calls_01(self):
-
- query = "SELECT ?duration ?phonenumber WHERE {\
- ?call a nmo:Call ;\
- nmo:duration ?duration ;\
- nmo:from [a nco:Contact ; nco:hasPhoneNumber ?phonenumber] }LIMIT 10000"
-
- """Querying the duration of calls of contacts """
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying duration of calls from phonenumbers = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_calls_02(self):
-
- query = "SELECT ?name ?date ?number ?duration \
- WHERE {?m a nmo:Call; \
- nmo:sentDate ?date ; \
- nmo:duration ?duration; \
- nmo:to ?contact . \
- ?contact a nco:PersonContact; \
- nco:hasPhoneNumber ?number . \
- OPTIONAL { \
- ?contact a nco:PersonContact ; \
- nco:nameFamily ?name} \
- FILTER (?duration > 0) .} \
- ORDER BY desc(?date) LIMIT 1000"
-
- """Querying the dialed calls"""
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying dialed calls = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_calls_03(self):
-
- query = "SELECT ?name ?date ?number ?duration \
- WHERE {?m a nmo:Call; \
- nmo:receivedDate ?date ; \
- nmo:duration ?duration; \
- nmo:from ?contact . \
- ?contact a nco:PersonContact; \
- nco:hasPhoneNumber ?number . \
- OPTIONAL { ?contact a nco:PersonContact ; nco:nameFamily ?name} \
- FILTER (?duration > 0) .} \
- ORDER BY desc(?date) LIMIT 1000"
-
- """Querying the received calls"""
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying received calls = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_calls_04(self):
-
- query = "SELECT ?name ?date ?number ?duration \
- WHERE {?m a nmo:Call; \
- nmo:receivedDate ?date ; \
- nmo:duration ?duration; \
- nmo:from ?contact . \
- ?contact a nco:PersonContact; \
- nco:hasPhoneNumber ?number . \
- OPTIONAL { ?contact a nco:PersonContact ; nco:nameFamily ?name}\
- FILTER (?duration > 0) .} \
- ORDER BY desc(?date) LIMIT 1000"
-
-
- """Querying the missed calls"""
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying missed calls = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
-
-""" IM performance test cases """
-class instant_messages(TestUpdate):
-
-
- def p_test_im_01(self):
-
-
- query = "SELECT ?message ?from ?date ?content WHERE { \
- ?message a nmo:IMMessage ; \
- nmo:from ?from ; \
- nmo:receivedDate ?date ; \
- nie:plainTextContent ?content} LIMIT 10000"
-
- """Querying the messages """
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying messages = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_im_02(self):
-
- query = "SELECT ?contact ?status WHERE{\
- ?contact a nco:IMAccount; \
- nco:imPresence ?status }LIMIT 10000"
-
- """Querying the status of contacts every sec"""
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying status of contacts = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
-
-""" rtcom performance test cases """
-class rtcom(TestUpdate):
-
-
- def p_test_rtcom_01(self):
-
- query = "SELECT ?channel ?participant nco:fullname(?participant) ?last_date nie:plainTextContent(?last_message) \
- (SELECT COUNT(?message) AS ?message_count \
- WHERE { ?message nmo:communicationChannel ?channel }) \
- (SELECT COUNT(?message) AS ?message_count \
- WHERE { ?message nmo:communicationChannel ?channel ; nmo:isRead true }) \
- WHERE { SELECT ?channel ?participant ?last_date \
- (SELECT ?message WHERE { ?message nmo:communicationChannel ?channel ; nmo:receivedDate ?date } ORDER BY DESC(?date) LIMIT 1) AS ?last_message \
- WHERE { \
- ?channel a nmo:CommunicationChannel ; \
- nmo:lastMessageDate ?last_date ; \
- nmo:hasParticipant ?participant . \
- FILTER (?participant != nco:default-contact-me ) \
- } ORDER BY DESC(?last_date) LIMIT 50 }"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying (old) conversation list view = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_rtcom_02(self):
-
- # A version of the next one that skips the contact parts that are not generated properly
-
- query = "SELECT ?msg ?date ?text ?contact \
- WHERE { \
- ?msg nmo:communicationChannel <urn:channel:1> ; \
- nmo:receivedDate ?date ; \
- nie:plainTextContent ?text . \
- <urn:channel:1> nmo:hasParticipant ?contact . \
- } ORDER BY DESC(?date) LIMIT 50"
-
- #query = "SELECT ?msg ?date ?text ?contact \
- # WHERE { \
- # ?msg nmo:communicationChannel <urn:uuid:7585395544138154780> ; \
- # nmo:receivedDate ?date ; \
- # nie:plainTextContent ?text ; \
- # nmo:from [ nco:hasIMAddress ?fromAddress ] . \
- # <urn:uuid:7585395544138154780> nmo:hasParticipant ?contact . \
- # ?contact nco:hasIMAddress ?fromAddress . \
- # } ORDER BY DESC(?date) LIMIT 50"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying (old) conversation view (without contact info) = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_rtcom_03(self):
-
- query = "SELECT ?msg ?date ?text ?contact \
- WHERE { \
- ?msg nmo:communicationChannel <urn:channel:1> ; \
- nmo:receivedDate ?date ; \
- nie:plainTextContent ?text ; \
- nmo:from [ nco:hasIMAddress ?fromAddress ] . \
- <urn:channel:1> nmo:hasParticipant ?contact . \
- ?contact nco:hasIMAddress ?fromAddress . \
- } ORDER BY DESC(?date) LIMIT 50"
-
- #query = "SELECT ?msg ?date ?text ?contact \
- # WHERE { \
- # ?msg nmo:communicationChannel <urn:uuid:7585395544138154780> ; \
- # nmo:receivedDate ?date ; \
- # nie:plainTextContent ?text ; \
- # nmo:from [ nco:hasIMAddress ?fromAddress ] . \
- # <urn:uuid:7585395544138154780> nmo:hasParticipant ?contact . \
- # ?contact nco:hasIMAddress ?fromAddress . \
- # } ORDER BY DESC(?date) LIMIT 50"
-
-
- start=time.time()
-
- 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".
-#
-
-# requires secondary index support to be fast
-
- 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:phoneMessageId(?message) \
- nmo:receivedDate(?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 \
-{ \
- SELECT \
- ?message ?date ?from ?to \
- (SELECT ?contact \
- WHERE \
- { \
- { \
- <urn:channel:1> nmo:hasParticipant ?participant . \
- ?contact a nco:PersonContact . \
- ?participant nco:hasIMAddress ?imaddress . \
- ?contact nco:hasIMAddress ?imaddress . \
- } \
- UNION \
- { \
- <urn:channel:1> nmo:hasParticipant ?participant . \
- ?contact a nco:PersonContact . \
- ?participant nco:hasPhoneNumber ?participantNumber . \
- ?participantNumber maemo:localPhoneNumber ?number . \
- ?contact nco:hasPhoneNumber ?contactNumber . \
- ?contactNumber maemo:localPhoneNumber ?number . \
- } \
- } \
- ) AS ?contact \
- 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> . \
- } \
- 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 ?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 ?subject ?lastDate \
- \
- ( SELECT ?message WHERE {?message nmo:communicationChannel ?channel . ?message nmo:receivedDate ?receivedDate .} ORDER BY DESC(?receivedDate) LIMIT 1) AS ?lastMessage \
- (SELECT ?contact \
- WHERE { \
- { \
- ?channel nmo:hasParticipant ?participant . \
- ?contact a nco:PersonContact . \
- ?participant nco:hasIMAddress ?imaddress . \
- ?contact nco:hasIMAddress ?imaddress . \
- } \
- UNION \
- { \
- ?channel nmo:hasParticipant ?participant . \
- ?contact a nco:PersonContact . \
- ?participant nco:hasPhoneNumber ?participantNumber . \
- ?number maemo:localPhoneNumber ?localNumber . \
- ?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\
-"
-
-
- 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) \
- nmo:isSent(?call) \
- nmo:isAnswered(?call) \
- nmo:isRead(?call) \
- nmo:sentDate(?call) \
- nmo:receivedDate(?call) \
- nmo:duration(?call) \
- nie:contentLastModified(?call) \
- (SELECT ?contact \
- WHERE \
- { \
- { \
- ?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 \
- { \
- ?contact a nco:PersonContact . \
- ?contact nco:contactUID ?contactId . \
- { \
- ?call nmo:to ?address . \
- } \
- UNION \
- { \
- ?call nmo:from ?address . \
- } \
- ?address nco:hasPhoneNumber ?addressNumber . \
- ?addressNumber maemo:localPhoneNumber ?number . \
- ?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)
-
- 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):
-
-
- def p_test_audio_01(self):
-
- """ Querying for Artist and finding the no.of albums in each artist. """
-
- query = "SELECT ?artist ?name COUNT(DISTINCT ?album) COUNT (?song) \
- WHERE { \
- ?song a nmm:MusicPiece ; \
- nmm:musicAlbum ?album; \
- nmm:performer ?artist . \
- ?artist nmm:artistName ?name. \
- } GROUP BY ?artist"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying Artist and finding the no.of albums in each artist = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_audio_02(self):
-
- """Query all albums also count of songs in each album """
-
- query= "SELECT ?album COUNT(?songs) AS ?count WHERE { \
- ?a a nmm:MusicAlbum; \
- nie:title ?album. \
- ?mp nmm:musicAlbum ?a;\
- nie:title ?songs.\
- }GROUP BY ?album ORDER BY DESC(?album)"
-
- start=time.time()
-
- result = self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying all albums and count their songs = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_audio_03(self):
-
- """Query all songs """
-
- query = "SELECT DISTINCT ?title ?album ?artist \
- WHERE { { \
- ?song a nmm:MusicPiece . \
- ?song nie:title ?title .\
- ?song nmm:performer ?perf . \
- ?perf nmm:artistName ?artist . \
- OPTIONAL{ ?song nmm:musicAlbum ?alb . \
- ?alb nmm:albumTitle ?album .}}} \
- ORDER BY ?title "
-
- start=time.time()
-
- result = self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying all songs = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_audio_04 (self) :
- """Query all albums """
-
- query = "SELECT DISTINCT nmm:albumTitle(?album) AS ?Album ?Artist COUNT(?Songs) AS ?Songs ?album \
- WHERE { { ?Songs a nmm:MusicPiece .\
- ?Songs nmm:musicAlbum ?album . \
- OPTIONAL{ \
- ?Songs nmm:performer ?perf .\
- OPTIONAL{?perf nmm:artistName ?Artist .\
- }}}}GROUP BY ?album ORDER BY ?album LIMIT 5000"
-
- start=time.time()
-
- result = self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying 15000 albums = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_audio_05 (self):
-
- """ Query all artists """
- query = " SELECT nmm:artistName(?artist) AS ?artistTitle ?albumTitle COUNT(?album) AS ?album ?artist \
- WHERE { \
- ?song a nmm:MusicPiece .\
- ?song nmm:performer ?artist . \
- OPTIONAL { ?song nmm:musicAlbum ?album .\
- OPTIONAL {?album nmm:albumTitle ?albumTitle .\
- } } } GROUP BY ?artist ORDER BY ?artist LIMIT 5000"
-
- start=time.time()
- print query
- result = self.resources.SparqlQuery(query,timeout= 600)
-
- elapse =time.time()-start
- print "Time taken for querying 5000 artists = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_audio_06 (self) :
- """Query 100 albums """
-
- query = "SELECT DISTINCT nmm:albumTitle(?album) AS ?Album ?Artist COUNT(?Songs) AS ?Songs ?album \
- WHERE { { ?Songs a nmm:MusicPiece .\
- ?Songs nmm:musicAlbum ?album .\
- OPTIONAL{ \
- ?Songs nmm:performer ?perf .\
- OPTIONAL{?perf nmm:artistName ?Artist .\
- }}}}GROUP BY ?album ORDER BY ?album LIMIT 100"
-
- start=time.time()
-
- result = self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying 100 albums = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_audio_07 (self):
-
- """ Query 100 artists """
-
- query = "SELECT nmm:artistName(?artist) AS ?artistTitle ?albumTitle COUNT(?album) AS\
- ?album ?artist \
- WHERE { \
- ?song a nmm:MusicPiece .\
- ?song nmm:performer ?artist . \
- OPTIONAL { ?song nmm:musicAlbum ?album.\
- OPTIONAL {?album nmm:albumTitle ?albumTitle .\
- }}} GROUP BY ?artist ORDER BY ?artist LIMIT 100"""
-
- start=time.time()
- print query
- result = self.resources.SparqlQuery(query,timeout=600)
-
- elapse =time.time()-start
- print "Time taken for querying 100 artist = %s " %elapse
-
- def p_test_audio_08(self):
-
- """Query all albums also count of songs in each album """
- """simplified version of test_audio_02 """
-
- query= "SELECT nie:title(?a) COUNT(?songs) WHERE { \
- ?a a nmm:MusicAlbum . \
- ?mp nmm:musicAlbum ?a ; \
- nie:title ?songs . } \
- GROUP BY ?a ORDER BY DESC(nie:title(?a))"
-
- start=time.time()
-
- result = self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying all albums and count their songs = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_audio_09 (self):
-
- """ Query all artists """
- """simplified version of test_audio_05 """
- query = "SELECT nmm:artistName(?artist) nmm:albumTitle(?album) COUNT(?album) ?artist WHERE { \
- ?song a nmm:MusicPiece . \
- ?song nmm:performer ?artist . \
- OPTIONAL { ?song nmm:musicAlbum ?album . } } \
- GROUP BY ?artist ORDER BY ?artist LIMIT 5000"
-
- start=time.time()
- print query
- result = self.resources.SparqlQuery(query,timeout= 600)
-
- elapse =time.time()-start
- print "Time taken for querying 5000 artists = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_audio_10 (self):
-
- """ Query 100 artists """
- """simplified version of test_audio_07 """
-
- query = "SELECT nmm:artistName(?artist) nmm:albumTitle(?album) COUNT(?album) ?artist WHERE { \
- ?song a nmm:MusicPiece . \
- ?song nmm:performer ?artist . \
- OPTIONAL { ?song nmm:musicAlbum ?album . } } \
- GROUP BY ?artist ORDER BY ?artist LIMIT 100"
-
- start=time.time()
- print query
- result = self.resources.SparqlQuery(query,timeout=600)
-
- elapse =time.time()-start
- print "Time taken for querying 100 artist = %s " %elapse
-
-
-class gallery(TestUpdate):
-
-
- def p_test_gallery_01(self):
-
- """ Querying for all Images and Videos """
-
- query = "SELECT ?url ?filename ?modified ?_width ?_height \
- WHERE { \
- ?media a nfo:Visual; \
- nie:url ?url;\
- nfo:fileName ?filename ;\
- nfo:fileLastModified ?modified .\
- OPTIONAL {?media nfo:width ?_width. } \
- OPTIONAL { ?media nfo:height ?_height .} } \
- ORDER BY ?modified LIMIT 10000"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query, timeout=25)
-
- elapse =time.time()-start
- print "Time taken for querying all images and videos = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_gallery_02(self):
-
- """ Querying for all Images and Videos without OPTIONALS"""
-
- query = "SELECT ?url ?filename ?modified \
- WHERE { \
- ?media a nfo:Visual; \
- nie:url ?url;\
- nfo:fileName ?filename ;\
- nfo:fileLastModified ?modified .}\
- ORDER BY ?modified LIMIT 10000"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query, timeout=25)
-
- elapse =time.time()-start
- print "Time taken for querying all images and videos without OPTIONALS = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_gallery_03(self):
-
- """ Querying for 500 Images and Videos """
-
- query = "SELECT ?url ?filename ?modified ?_width ?_height \
- WHERE { \
- ?media a nfo:Visual; \
- nie:url ?url;\
- nfo:fileName ?filename ;\
- nfo:fileLastModified ?modified .\
- OPTIONAL {?media nfo:width ?_width. } \
- OPTIONAL { ?media nfo:height ?_height .} } \
- ORDER BY ?modified LIMIT 500"
- start=time.time()
-
- result=self.resources.SparqlQuery(query, timeout=25)
-
- elapse =time.time()-start
- print "Time taken for querying 500 images and videos = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_gallery_04(self):
-
- """ Querying for 500 Images and Videos without OPTIONALS"""
-
- query = "SELECT ?url ?filename ?modified \
- WHERE { \
- ?media a nfo:Visual; \
- nie:url ?url;\
- nfo:fileName ?filename ;\
- nfo:fileLastModified ?modified .} \
- ORDER BY ?modified LIMIT 500"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query, timeout=25)
-
- elapse =time.time()-start
- print "Time taken for querying 100 images and videos without OPTIONALS = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
-
- def p_test_gallery_05(self):
-
- """ Querying for images, videos which have tag TEST """
-
- query = "SELECT ?media \
- WHERE { \
- ?media a nfo:Visual; \
- nao:hasTag ?tag . \
- ?tag nao:prefLabel 'TEST' }"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying all images and videos with a tag = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_gallery_06(self):
-
- """ Querying for 500 images, videos which have tag TEST """
- query = "SELECT ?media \
- WHERE { \
- ?media a nfo:Visual; \
- nao:hasTag ?tag . \
- ?tag nao:prefLabel 'TEST' } LIMIT 500"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying 500 images and videos with a tag = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_gallery_07(self):
-
- """Querying all images and videos taken with phone's camera """
-
- query = "SELECT ?media WHERE { \
- ?media a nfo:Visual; \
- nfo:equipment [ a nfo:Equipment; nfo:make 'NOKIA' ] }"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying all images and videos taken with phone's camera = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_gallery_08(self):
-
- """Querying 500 images and videos taken with phone's camera """
-
- query = "SELECT ?media WHERE { \
- ?media a nfo:Visual; \
- nfo:equipment [ a nfo:Equipment; nfo:make 'NOKIA' ] } LIMIT 500"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying 500 images and videos taken with phone's camera = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_gallery_09(self):
-
- """Querying all images """
-
- query = " SELECT ?url ?height ?width ?mime ?camera ?exposuretime ?fnumber ?focallength \
- WHERE {\
- ?image a nmm:Photo; \
- nie:url ?url; \
- nie:mimeType ?mime. \
- OPTIONAL { ?image nfo:height ?height .}\
- OPTIONAL { ?image nfo:width ?width .}\
- OPTIONAL { ?image nfo:equipment [ nfo:model ?camera ] .}\
- OPTIONAL { ?image nmm:exposureTime ?exposuretime .}\
- OPTIONAL { ?image nmm:fnumber ?fnumber .}\
- OPTIONAL { ?image nmm:focalLength ?focallength .}} LIMIT 10000"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying all images = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
-
- def p_test_gallery_10(self):
-
- """Querying 500 images """
-
- query = " SELECT ?url ?height ?width ?mime ?camera ?exposuretime ?fnumber ?focallength \
- WHERE {\
- ?image a nmm:Photo; \
- nie:url ?url; \
- nie:mimeType ?mime. \
- OPTIONAL { ?image nfo:height ?height .}\
- OPTIONAL { ?image nfo:width ?width .}\
- OPTIONAL { ?image nfo:equipment [ nfo:model ?camera ] .}\
- OPTIONAL { ?image nmm:exposureTime ?exposuretime .}\
- OPTIONAL { ?image nmm:fnumber ?fnumber .}\
- OPTIONAL { ?image nmm:focalLength ?focallength .}} LIMIT 500"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying 500 images = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_gallery_11(self):
-
- """ Querying for 500 Images and Videos with UNION for them """
-
- query = "SELECT ?url ?filename ?modified ?_width ?_height \
- WHERE { \
- {?media a nmm:Photo.} UNION {?media a nmm:Video.} \
- ?media nie:url ?url.\
- ?media nfo:fileName ?filename .\
- ?media nfo:fileLastModified ?modified .\
- OPTIONAL {?media nfo:width ?_width. } \
- OPTIONAL { ?media nfo:height ?_height .} } \
- ORDER BY ?modified LIMIT 500"
- start=time.time()
-
- result=self.resources.SparqlQuery(query,timeout=1000)
-
- elapse =time.time()-start
- print "Time taken for querying 500 images and videos = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_gallery_12(self):
-
- """Querying all images """
- """simplified version of test_gallery_09 """
-
- query = "SELECT nie:url(?image) nfo:height(?image) nfo:width(?image) nie:mimeType(?image) nfo:model (nfo:equipment (?image)) nmm:exposureTime(?image) nmm:fnumber(?image) nmm:focalLength(?image) WHERE { ?image a nmm:Photo . } limit 10000"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying all images = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_gallery_13(self):
-
- """Querying 500 images """
- """simplified version of test_gallery_10 """
-
- query = "SELECT nie:url(?image) nfo:height(?image) nfo:width(?image) nie:mimeType(?image) nfo:model (nfo:equipment (?image)) nmm:exposureTime(?image) nmm:fnumber(?image) nmm:focalLength(?image) WHERE { ?image a nmm:Photo . } limit 500"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for querying 500 images = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
-
-
-
-class ftsmatch (TestUpdate) :
-
- def p_test_fts_01 (self):
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'ArtistName' }"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for searching an artist in 10000 music files " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_fts_02 (self) :
- """ Searching for a word """
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'WordInPlainText' . } "
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for searching a word = %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_fts_03 (self):
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'ArtistNa*'}"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for searching an artist in 10000 music files " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_fts_04 (self):
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'Art*' }"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for searching an artist in 10000 music files " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_fts_05 (self):
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'Ar*'}"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for searching an artist in 10000 music files " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_fts_06 (self):
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'A*' }"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for searching an artist in 10000 music files " %elapse
- print "no.of items retrieved: %d" %len(result)
-
- def p_test_fts_07 (self):
-
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'A* p*' }"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for searching an artist in 10000 music files " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_fts_08 (self):
- """Making a search for artist"""
-
- query = " SELECT ?uri WHERE { \
- ?uri a nie:InformationElement ; \
- fts:match 'A* p* k*' }"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken for searching an artist in 10000 music files %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
-
-
-class content_manager (TestUpdate) :
-
- def p_test_cm_01 (self):
-
-
- """Get all the contacts that match fts and get relevant UI info for them"""
-
- query = "SELECT DISTINCT ?url ?photourl ?imstatus tracker:coalesce(?family, ?given, ?orgname, ?nick, ?email, ?phone, ?blog) \
- WHERE { { ?url a nco:PersonContact.?url fts:match 'fami*'. } \
- UNION { ?url a nco:PersonContact. ?url nco:hasEmailAddress ?add.?add fts:match 'fami*'. } \
- UNION { ?url a nco:PersonContact. ?url nco:hasPostalAddress ?post.?post fts:match 'fami*'. } \
- OPTIONAL { ?url maemo:relevance ?relevance.} \
- OPTIONAL { ?url nco:photo ?photo. ?photo nie:url ?photourl.} \
- OPTIONAL { ?url nco:imContactStatusMessage ?imstatus.} \
- OPTIONAL { ?url nco:nameFamily ?family.} \
- OPTIONAL { ?url nco:nameFamily ?given.} \
- OPTIONAL { ?url nco:org ?org. ?org nco:nameGiven ?orgname.} \
- OPTIONAL { ?url nco:hasIMAccount ?acc. ?acc nco:imNickname ?nick.} \
- OPTIONAL { ?url nco:hasEmailAddress ?hasemail. ?hasemail nco:emailAddress ?email.} \
- OPTIONAL { ?url nco:hasPhoneNumber ?hasphone. ?hasphone nco:phoneNumber ?phone.} \
- OPTIONAL { ?url nco:blogUrl ?blog.}} \
- ORDER BY ?relevance \
- LIMIT 100"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 100 contacts that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_cm_02 (self):
-
-
- """Get all the contacts that match fts and get relevant UI info for them"""
-
- query = "SELECT DISTINCT ?url tracker:coalesce(nco:nameFamily(?url), nco:nameGiven(?url), 'unknown') \
- WHERE { \
- { ?url a nco:PersonContact.?url fts:match 'fami*'. } \
- UNION { ?url a nco:PersonContact. ?url nco:hasEmailAddress ?add.?add fts:match 'fami*'. } \
- UNION { ?url a nco:PersonContact. ?url nco:hasPostalAddress ?post.?post fts:match 'fami*'. } \
- } LIMIT 100"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 100 contacts that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_cm_03 (self):
-
-
- """Get all the messages """
-
- query = "SELECT DISTINCT ?url nie:title(?url) \
- WHERE { \
- { ?url a nmo:Message. ?url fts:match 'fami*'. } \
- UNION { ?url a nmo:Message. ?url nmo:from ?from . ?from fts:match 'fami*'. } \
- UNION { ?url a nmo:Message. ?url nmo:recipient ?to . ?to fts:match 'fami*'. } \
- } LIMIT 100"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 100 contacts that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_cm_04 (self):
-
- """Get all the messages """
-
- query = "SELECT ?url ?fileLastModified ?relevance ?fileName ?mimeType ?url2 \
- WHERE { \
- ?url a nfo:Image .\
- ?url nfo:fileLastModified ?fileLastModified. \
- ?url nfo:fileName ?fileName .\
- ?url nie:mimeType ?mimeType .\
- ?url nie:url ?url2 . \
- OPTIONAL { ?url maemo:relevance ?relevance. } \
- } ORDER BY ?_fileName"
-
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 100 contacts that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_cm_05 (self):
-
- """Get all the matching data """
-
- query = "SELECT DISTINCT ?glob_url \
- WHERE \
- { \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmo:Message . \
- ?url fts:match 'fami*' . \
- ?url nmo:from ?from . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmo:Message . \
- ?url nmo:from ?from . \
- ?from fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmo:Message . \
- ?url nmo:to ?to . \
- ?to fts:match 'fami*' . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmo:Message. \
- ?url nmo:communicationChannel ?cha . \
- ?cha fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nco:PersonContact . \
- ?url fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nco:PersonContact . \
- ?url nco:hasEmailAddress ?email . \
- ?email fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nco:PersonContact . \
- ?url nco:hasPostalAddress ?post . \
- ?post fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmm:MusicPiece . \
- ?url nmm:performer ?artist . \
- ?artist fts:match 'fami*' . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- WHERE { ?url a nmm:MusicPiece . \
- ?url nmm:musicAlbum ?album . \
- ?album fts:match 'fami*' . } } \
- } \
- LIMIT 100"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 100 content items that match fts without UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_cm_06 (self):
-
- """Get all the matching data """
-
- query = "SELECT DISTINCT ?glob_url ?first ?second \
- WHERE \
- { \
- { SELECT ?url as ?glob_url \
- nmo:messageSubject(?url) as ?first \
- tracker:coalesce(nco:fullname(?from), nco:nameGiven(?from), nco:nameFamily(?from), nco:org(?from),'unknown') as ?second \
- WHERE { ?url a nmo:Message . \
- ?url fts:match 'fami*' . \
- ?url nmo:from ?from . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nmo:messageSubject(?url) as ?first \
- tracker:coalesce(nco:fullname(?from), nco:nameGiven(?from), nco:nameFamily(?from), nco:org(?from),'unknown') as ?second \
- WHERE { ?url a nmo:Message . \
- ?url nmo:from ?from . \
- ?from fts:match 'fami*'. } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nmo:messageSubject(?url) as ?first \
- tracker:coalesce(nco:fullname(?from), nco:nameGiven(?from), nco:nameFamily(?from), nco:org(?from),'unknown') as ?second \
- WHERE { ?url a nmo:Message . \
- ?url nmo:to ?to . \
- ?to fts:match 'fami*' . \
- ?url nmo:from ?from . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nmo:messageSubject(?url) as ?first \
- tracker:coalesce(nco:fullname(?from), nco:nameGiven(?from), nco:nameFamily(?from), nco:org(?from),'unknown') as ?second \
- WHERE { ?url a nmo:Message. \
- ?url nmo:communicationChannel ?cha . \
- ?cha fts:match 'fami*'. \
- ?url nmo:from ?from . } } \
- UNION \
- { SELECT ?url as ?glob_url \
- tracker:coalesce(nco:fullname(?url), nco:nameGiven(?url), nco:nameFamily(?url), nco:org(?url),'unknown') as ?first \
- tracker:coalesce(nco:emailAddress(?email), nco:imNickname(?im), 'unknown') as ?second \
- WHERE { ?url a nco:PersonContact . \
- ?url fts:match 'fami*'. \
- { SELECT ?em as ?email WHERE { ?url nco:hasEmailAddress ?em } LIMIT 1 } \
- { SELECT ?imadd as ?im WHERE { ?url nco:hasIMAddress ?imadd } LIMIT 1 } } } \
- UNION \
- { SELECT ?url as ?glob_url \
- tracker:coalesce(nco:fullname(?url), nco:nameGiven(?url), nco:nameFamily(?url), nco:org(?url),'unknown') as ?first \
- tracker:coalesce(nco:emailAddress(?email), nco:imNickname(?im), 'unknown') as ?second \
- WHERE { ?url a nco:PersonContact . \
- ?url nco:hasEmailAddress ?email . \
- ?email fts:match 'fami*'. \
- { SELECT ?imadd as ?im WHERE { ?url nco:hasIMAddress ?imadd } LIMIT 1 } } } \
- UNION \
- { SELECT ?url as ?glob_url \
- tracker:coalesce(nco:fullname(?url), nco:nameGiven(?url), nco:nameFamily(?url), nco:org(?url),'unknown') as ?first \
- tracker:coalesce(nco:emailAddress(?email), nco:imNickname(?im), 'unknown') as ?second \
- WHERE { ?url a nco:PersonContact . \
- ?url nco:hasPostalAddress ?post . \
- ?post fts:match 'fami*'. \
- { SELECT ?em as ?email WHERE { ?url nco:hasEmailAddress ?em } LIMIT 1 } \
- { SELECT ?imadd as ?im WHERE { ?url nco:hasIMAddress ?imadd } LIMIT 1 } } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nie:title(?url) as ?first \
- fn:concat(nmm:artistName(?artist),'-',nmm:albumTitle(?album)) \
- WHERE { ?url a nmm:MusicPiece . \
- ?url nmm:performer ?artist . \
- ?artist fts:match 'fami*' . \
- OPTIONAL { ?url nmm:musicAlbum ?album . } } } \
- UNION \
- { SELECT ?url as ?glob_url \
- nie:title(?url) as ?first \
- fn:concat(nmm:artistName(?artist),'-',nmm:albumTitle(?album)) \
- WHERE { ?url a nmm:MusicPiece . \
- ?url nmm:musicAlbum ?album . \
- ?album fts:match 'fami*' . \
- OPTIONAL { ?url nmm:performer ?artist }} } \
- } \
- LIMIT 100"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 100 content items that match fts and get relevant UI info for them %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
-class contacts (TestUpdate) :
-
- def p_test_contacts_01 (self):
-
- query = " \
-SELECT DISTINCT \
- ?_contact \
- ?_Avatar_ImageUrl \
- ?_Birthday_Birthday \
- bound(?_Gender_Gender) AS ?_Gender_Gender_IsBound \
- (?_Gender_Gender = nco:gender-female) AS ?_Gender_Gender_IsEqual_Female \
- (?_Gender_Gender = nco:gender-male) AS ?_Gender_Gender_IsEqual_Male \
- ?_Guid_Guid \
- ?_Name_Prefix \
- ?_Name_FirstName \
- ?_Name_MiddleName \
- ?_Name_LastName \
- ?_Name_Suffix \
- ?_Nickname_Nickname \
- ?_Note_Note \
- ?_Timestamp_CreationTimestamp \
- ?_Timestamp_ModificationTimestamp \
-WHERE \
-{ \
- { \
- ?_contact rdf:type nco:PersonContact . \
- OPTIONAL { ?_contact nco:photo ?__1 . ?__1 nfo:fileUrl ?_Avatar_ImageUrl . } \
- OPTIONAL { ?_contact nco:birthDate ?_Birthday_Birthday . } \
- OPTIONAL { ?_contact nco:gender ?_Gender_Gender . } \
- OPTIONAL { ?_contact nco:contactUID ?_Guid_Guid . } \
- OPTIONAL { ?_contact nco:nameHonorificPrefix ?_Name_Prefix . } \
- OPTIONAL { ?_contact nco:nameGiven ?_Name_FirstName . } \
- OPTIONAL { ?_contact nco:nameAdditional ?_Name_MiddleName . } \
- OPTIONAL { ?_contact nco:nameFamily ?_Name_LastName . } \
- OPTIONAL { ?_contact nco:nameHonorificSuffix ?_Name_Suffix . } \
- OPTIONAL { ?_contact nco:nickname ?_Nickname_Nickname . } \
- OPTIONAL { ?_contact nco:note ?_Note_Note . } \
- OPTIONAL { ?_contact nie:contentCreated ?_Timestamp_CreationTimestamp . } \
- OPTIONAL { ?_contact nie:contentLastModified ?_Timestamp_ModificationTimestamp . } \
- } \
-} \
-ORDER BY ?_contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts basic information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_contacts_02 (self):
- query = " \
-SELECT DISTINCT \
- ?_contact \
- ?_Avatar_ImageUrl \
- nco:birthDate(?_contact) \
- bound(?_Gender_Gender) \
- (?_Gender_Gender = nco:gender-female) \
- (?_Gender_Gender = nco:gender-male) \
- nco:contactUID(?_contact) \
- nco:nameHonorificPrefix(?_contact) \
- nco:nameGiven(?_contact) \
- nco:nameAdditional(?_contact) \
- nco:nameFamily(?_contact) \
- nco:nameHonorificSuffix(?_contact) \
- nco:nickname(?_contact) \
- nco:note(?_contact) \
- nie:contentCreated(?_contact) \
- nie:contentLastModified(?_contact) \
-WHERE \
-{ \
- { \
- ?_contact rdf:type nco:PersonContact . \
- OPTIONAL { ?_contact nco:photo ?__1 . ?__1 nfo:fileUrl ?_Avatar_ImageUrl . } \
- OPTIONAL { ?_contact nco:gender ?_Gender_Gender . } \
- } \
-} \
-ORDER BY ?_contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts basic information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_contacts_03 (self):
- query = " \
-SELECT DISTINCT \
- ?_contact \
- ?_Address_Country \
- ?_Address_Locality \
- ?_Address_PostOfficeBox \
- ?_Address_Postcode \
- ?_Address_Region \
- ?_Address_Street \
- bound(?_Address_SubTypes_Domestic) AS ?_Address_SubTypes_Domestic_IsBound \
- bound(?_Address_SubTypes_International) AS ?_Address_SubTypes_International_IsBound \
- bound(?_Address_SubTypes_Parcel) AS ?_Address_SubTypes_Parcel_IsBound \
- bound(?_Address_SubTypes_Postal) AS ?_Address_SubTypes_Postal_IsBound \
- bound(?_Address_Context_Work) AS ?_Address_Context_Work_IsBound \
-WHERE \
-{ \
- { \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasPostalAddress ?__1 . \
- ?__1 nco:country ?_Address_Country . \
- ?__1 nco:locality ?_Address_Locality . \
- ?__1 nco:pobox ?_Address_PostOfficeBox . \
- ?__1 nco:postalcode ?_Address_Postcode . \
- ?__1 nco:region ?_Address_Region . \
- ?__1 nco:streetAddress ?_Address_Street . \
- OPTIONAL { \
- ?__1 rdf:type ?_Address_SubTypes_Domestic . \
- FILTER((?_Address_SubTypes_Domestic = nco:DomesticDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__1 rdf:type ?_Address_SubTypes_International . \
- FILTER((?_Address_SubTypes_International = nco:InternationalDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__1 rdf:type ?_Address_SubTypes_Parcel . \
- FILTER((?_Address_SubTypes_Parcel = nco:ParcelDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__1 rdf:type ?_Address_SubTypes_Postal . \
- FILTER((?_Address_SubTypes_Postal = nco:PostalAddress)) . \
- } \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_Address_Context_Work . \
- ?_Address_Context_Work nco:hasPostalAddress ?__2 . \
- ?__2 nco:country ?_Address_Country . \
- ?__2 nco:locality ?_Address_Locality . \
- ?__2 nco:pobox ?_Address_PostOfficeBox . \
- ?__2 nco:postalcode ?_Address_Postcode . \
- ?__2 nco:region ?_Address_Region . \
- ?__2 nco:streetAddress ?_Address_Street . \
- OPTIONAL { \
- ?__2 rdf:type ?_Address_SubTypes_Domestic . \
- FILTER((?_Address_SubTypes_Domestic = nco:DomesticDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__2 rdf:type ?_Address_SubTypes_International . \
- FILTER((?_Address_SubTypes_International = nco:InternationalDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__2 rdf:type ?_Address_SubTypes_Parcel . \
- FILTER((?_Address_SubTypes_Parcel = nco:ParcelDeliveryAddress)) . \
- } \
- OPTIONAL { \
- ?__2 rdf:type ?_Address_SubTypes_Postal . \
- FILTER((?_Address_SubTypes_Postal = nco:PostalAddress)) . \
- } \
- } \
- } \
-} \
-ORDER BY ?_contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts address information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_contacts_04 (self):
- query = " \
-SELECT \
- ?contact \
- nco:country(?postal) \
- nco:locality(?postal) \
- nco:pobox(?postal) \
- nco:postalcode(?postal) \
- nco:region(?postal) \
- nco:streetAddress(?postal) \
- bound(?work) \
-WHERE \
-{ \
- ?contact rdf:type nco:PersonContact . \
- { ?contact nco:hasPostalAddress ?postal . } \
- UNION \
- { ?contact nco:hasAffiliation ?work . \
- ?work nco:hasPostalAddress ?postal . \
- } \
-} \
-ORDER BY ?contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts address information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_contacts_05 (self):
- query = " \
-SELECT DISTINCT \
- ?_contact ?_EmailAddress ?_EmailAddress_EmailAddress \
- bound(?_EmailAddress_Context_Work) AS ?_EmailAddress_Context_Work_IsBound \
-WHERE \
-{ \
- { \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasEmailAddress ?_EmailAddress . \
- ?_EmailAddress nco:emailAddress ?_EmailAddress_EmailAddress . \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_EmailAddress_Context_Work . \
- ?_EmailAddress_Context_Work nco:hasEmailAddress ?_EmailAddress . \
- ?_EmailAddress nco:emailAddress ?_EmailAddress_EmailAddress . \
- } \
- } \
-} \
-ORDER BY ?_contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts email information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_contacts_06 (self):
- query = " \
-SELECT \
- ?contact \
- ?email \
- nco:emailAddress(?email) \
- bound(?work) \
-WHERE \
-{ \
- { \
- ?contact rdf:type nco:PersonContact . \
- { \
- ?contact nco:hasEmailAddress ?email . \
- } \
- UNION \
- { \
- ?contact nco:hasAffiliation ?work . \
- ?work nco:hasEmailAddress ?email . \
- } \
- } \
-} \
-ORDER BY ?_contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts email information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_contacts_07 (self):
- query = " \
-SELECT DISTINCT \
- ?_contact \
- ?_OnlineAccount \
- ?_OnlineAccount_AccountUri \
- ?_OnlineAccount_ServiceProvider \
- bound(?_OnlineAccount_Capabilities) \
- AS ?_OnlineAccount_Capabilities_IsBound \
- (?_OnlineAccount_Capabilities = nco:im-capability-text-chat) \
- AS ?_OnlineAccount_Capabilities_IsEqual_TextChat \
- (?_OnlineAccount_Capabilities = nco:im-capability-media-calls) \
- AS ?_OnlineAccount_Capabilities_IsEqual_MediaCalls \
- (?_OnlineAccount_Capabilities = nco:im-capability-audio-calls) \
- AS ?_OnlineAccount_Capabilities_IsEqual_AudioCalls \
- (?_OnlineAccount_Capabilities = nco:im-capability-video-calls) \
- AS ?_OnlineAccount_Capabilities_IsEqual_VideoCalls \
- (?_OnlineAccount_Capabilities = nco:im-capability-upgrading-calls) \
- AS ?_OnlineAccount_Capabilities_IsEqual_UpgradingCalls \
- (?_OnlineAccount_Capabilities = nco:im-capability-file-transfers) \
- AS ?_OnlineAccount_Capabilities_IsEqual_FileTransfers \
- (?_OnlineAccount_Capabilities = nco:im-capability-stream-tubes) \
- AS ?_OnlineAccount_Capabilities_IsEqual_StreamTubes \
- (?_OnlineAccount_Capabilities = nco:im-capability-dbus-tubes) \
- AS ?_OnlineAccount_Capabilities_IsEqual_DBusTubes \
- bound(?_OnlineAccount_Context_Work) \
- AS ?_OnlineAccount_Context_Work_IsBound \
-WHERE \
-{ \
- { \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasIMAddress ?_OnlineAccount . \
- ?_OnlineAccount nco:imID ?_OnlineAccount_AccountUri . \
- ?_OnlineAccount nco:imCapability ?_OnlineAccount_Capabilities . \
- OPTIONAL { ?_OnlineAccount_ServiceProvider nco:hasIMContact ?_OnlineAccount . } \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_OnlineAccount_Context_Work . \
- ?_OnlineAccount_Context_Work nco:hasIMAddress ?_OnlineAccount .\
- ?_OnlineAccount nco:imID ?_OnlineAccount_AccountUri . \
- ?_OnlineAccount nco:imCapability ?_OnlineAccount_Capabilities . \
- OPTIONAL { ?_OnlineAccount_ServiceProvider nco:hasIMContact ?_OnlineAccount . } \
- } \
- } \
-} \
-ORDER BY ?_contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts online information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_contacts_08 (self):
- query = " \
-SELECT DISTINCT \
- ?_contact \
- ?_OnlineAccount \
- ?_OnlineAccount_AccountUri \
- ?_OnlineAccount_ServiceProvider \
- bound(?ork) \
-WHERE \
-{ \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasIMAddress ?_OnlineAccount . \
- ?_OnlineAccount nco:imID ?_OnlineAccount_AccountUri . \
- OPTIONAL { ?_OnlineAccount_ServiceProvider nco:hasIMContact ?_OnlineAccount . } \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_OnlineAccount_Context_Work . \
- ?_OnlineAccount_Context_Work nco:hasIMAddress ?_OnlineAccount . \
- ?_OnlineAccount nco:imID ?_OnlineAccount_AccountUri . \
- OPTIONAL { ?_OnlineAccount_ServiceProvider nco:hasIMContact ?_OnlineAccount . } \
- } \
-} \
-ORDER BY ?_contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts online information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_contacts_09 (self):
- query = " \
-SELECT DISTINCT \
- ?_contact ?_PhoneNumber ?_PhoneNumber_PhoneNumber \
- bound(?_PhoneNumber_SubTypes_BulletinBoardSystem) AS ?_PhoneNumber_SubTypes_BulletinBoardSystem_IsBound \
- bound(?_PhoneNumber_SubTypes_Car) AS ?_PhoneNumber_SubTypes_Car_IsBound \
- bound(?_PhoneNumber_SubTypes_Fax) AS ?_PhoneNumber_SubTypes_Fax_IsBound \
- bound(?_PhoneNumber_SubTypes_MessagingCapable) AS ?_PhoneNumber_SubTypes_MessagingCapable_IsBound \
- bound(?_PhoneNumber_SubTypes_Mobile) AS ?_PhoneNumber_SubTypes_Mobile_IsBound \
- bound(?_PhoneNumber_SubTypes_Modem) AS ?_PhoneNumber_SubTypes_Modem_IsBound \
- bound(?_PhoneNumber_SubTypes_Pager) AS ?_PhoneNumber_SubTypes_Pager_IsBound \
- bound(?_PhoneNumber_SubTypes_Video) AS ?_PhoneNumber_SubTypes_Video_IsBound \
- bound(?_PhoneNumber_SubTypes_Voice) AS ?_PhoneNumber_SubTypes_Voice_IsBound \
- bound(?_PhoneNumber_Context_Work) AS ?_PhoneNumber_Context_Work_IsBound \
-WHERE \
-{ \
- { \
- ?_contact rdf:type nco:PersonContact . \
- { \
- ?_contact nco:hasPhoneNumber ?_PhoneNumber . \
- ?_PhoneNumber nco:phoneNumber ?_PhoneNumber_PhoneNumber . \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_BulletinBoardSystem . \
- FILTER((?_PhoneNumber_SubTypes_BulletinBoardSystem = nco:BbsNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Car . \
- FILTER((?_PhoneNumber_SubTypes_Car = nco:CarPhoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Fax . \
- FILTER((?_PhoneNumber_SubTypes_Fax = nco:FaxNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_MessagingCapable . \
- FILTER((?_PhoneNumber_SubTypes_MessagingCapable = nco:MessagingNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Mobile . \
- FILTER((?_PhoneNumber_SubTypes_Mobile = nco:CellPhoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Modem . \
- FILTER((?_PhoneNumber_SubTypes_Modem = nco:ModemNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Pager . \
- FILTER((?_PhoneNumber_SubTypes_Pager = nco:PagerNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Video . \
- FILTER((?_PhoneNumber_SubTypes_Video = nco:VideoTelephoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Voice . \
- FILTER((?_PhoneNumber_SubTypes_Voice = nco:VoicePhoneNumber)) . \
- } \
- } \
- UNION \
- { \
- ?_contact nco:hasAffiliation ?_PhoneNumber_Context_Work . \
- ?_PhoneNumber_Context_Work nco:hasPhoneNumber ?_PhoneNumber . \
- ?_PhoneNumber nco:phoneNumber ?_PhoneNumber_PhoneNumber . \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_BulletinBoardSystem . \
- FILTER((?_PhoneNumber_SubTypes_BulletinBoardSystem = nco:BbsNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Car . \
- FILTER((?_PhoneNumber_SubTypes_Car = nco:CarPhoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Fax . \
- FILTER((?_PhoneNumber_SubTypes_Fax = nco:FaxNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_MessagingCapable . \
- FILTER((?_PhoneNumber_SubTypes_MessagingCapable = nco:MessagingNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Mobile . \
- FILTER((?_PhoneNumber_SubTypes_Mobile = nco:CellPhoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Modem . \
- FILTER((?_PhoneNumber_SubTypes_Modem = nco:ModemNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Pager . \
- FILTER((?_PhoneNumber_SubTypes_Pager = nco:PagerNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Video . \
- FILTER((?_PhoneNumber_SubTypes_Video = nco:VideoTelephoneNumber)) . \
- } \
- OPTIONAL \
- { \
- ?_PhoneNumber rdf:type ?_PhoneNumber_SubTypes_Voice . \
- FILTER((?_PhoneNumber_SubTypes_Voice = nco:VoicePhoneNumber)) . \
- } \
- } \
- } \
-} \
-ORDER BY ?_contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts phone number information (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_contacts_10 (self):
- query = " \
-SELECT DISTINCT \
- ?contact \
- ?phoneNumber \
- nco:phoneNumber(?phoneNumber) \
- bound(?work) \
-WHERE \
-{ \
- ?contact rdf:type nco:PersonContact . \
- { \
- ?contact nco:hasPhoneNumber ?phoneNumber . \
- } \
- UNION \
- { \
- ?contact nco:hasAffiliation ?work . \
- ?work nco:hasPhoneNumber ?phoneNumber . \
- } \
-} \
-ORDER BY ?_contact LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 contacts phone number information (modified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-class location (TestUpdate) :
-
- def p_test_location_01 (self):
- query = " \
-SELECT \
- ?urn \
- ?cLat ?cLon ?cAlt ?cRad \
- ?nwLat ?nwLon ?nwAlt \
- ?seLat ?seLon ?seAlt \
- ?country ?district ?city ?street ?postalcode \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
-WHERE { \
- ?urn a mlo:Landmark . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asPostalAddress \
- [ \
- a nco:PostalAddress ; \
- nco:country ?country ; \
- nco:region ?district ; \
- nco:locality ?city ; \
- nco:streetAddress ?street ; \
- nco:postalcode ?postalcode \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asBoundingBox \
- [ \
- a mlo:GeoBoundingBox ; \
- mlo:bbNorthWest \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?nwLat ; \
- mlo:longitude ?nwLon ; \
- mlo:altitude ?nwAlt \
- ] ; \
- mlo:bbSouthEast \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?seLat ; \
- mlo:longitude ?seLon ; \
- mlo:altitude ?seAlt \
- ] \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?cLat ; \
- mlo:longitude ?cLon \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:altitude ?cAlt \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:radius ?cRad \
- ] \
- ] \
- } \
-} ORDER BY ASC(?name) LIMIT 50 \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 landmarks (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_location_02 (self):
- query = " \
-SELECT \
- ?urn \
- ?cLat ?cLon ?cAlt ?cRad \
- ?nwLat ?nwLon ?nwAlt \
- ?seLat ?seLon ?seAlt \
- ?country ?district ?city ?street ?postalcode \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
-WHERE { \
- ?urn a mlo:Landmark . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asPostalAddress \
- [ \
- a nco:PostalAddress ; \
- nco:country ?country ; \
- nco:region ?district ; \
- nco:locality ?city ; \
- nco:streetAddress ?street ; \
- nco:postalcode ?postalcode \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asBoundingBox \
- [ \
- a mlo:GeoBoundingBox ; \
- mlo:bbNorthWest \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?nwLat ; \
- mlo:longitude ?nwLon ; \
- mlo:altitude ?nwAlt \
- ] ; \
- mlo:bbSouthEast \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?seLat ; \
- mlo:longitude ?seLon ; \
- mlo:altitude ?seAlt \
- ] \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?cLat ; \
- mlo:longitude ?cLon \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:altitude ?cAlt \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:radius ?cRad \
- ] \
- ] \
- } \
- FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && ?cLon >= 63.94 && ?cLon <= 64.96) \
-} ORDER BY ASC(?name) LIMIT \
-"
-
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 landmarks within coords (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_location_03 (self):
- query = " \
-SELECT \
- ?urn \
- ?cLat ?cLon ?cAlt ?cRad \
- ?nwLat ?nwLon ?nwAlt \
- ?seLat ?seLon ?seAlt \
- ?country ?district ?city ?street ?postalcode \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
-WHERE { \
- ?urn a mlo:Landmark . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asPostalAddress \
- [ \
- a nco:PostalAddress ; \
- nco:country ?country ; \
- nco:region ?district ; \
- nco:locality ?city ; \
- nco:streetAddress ?street ; \
- nco:postalcode ?postalcode \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asBoundingBox \
- [ \
- a mlo:GeoBoundingBox ; \
- mlo:bbNorthWest \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?nwLat ; \
- mlo:longitude ?nwLon ; \
- mlo:altitude ?nwAlt \
- ] ; \
- mlo:bbSouthEast \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?seLat ; \
- mlo:longitude ?seLon ; \
- mlo:altitude ?seAlt \
- ] \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?cLat ; \
- mlo:longitude ?cLon \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:altitude ?cAlt \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:radius ?cRad \
- ] \
- ] \
- } \
- FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && \
- ?cLon >= 63.94 && ?cLon <= 64.96 && \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
-} ORDER BY ASC(?distance) LIMIT 50 \
-"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get max 50 landmarks within certain range with bounding box (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_location_04 (self):
- query = " \
-SELECT \
- ?urn \
- ?cLat ?cLon ?cAlt ?cRad \
- ?nwLat ?nwLon ?nwAlt \
- ?seLat ?seLon ?seAlt \
- ?country ?district ?city ?street ?postalcode \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
-WHERE { \
- ?urn a mlo:Landmark . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asPostalAddress \
- [ \
- a nco:PostalAddress ; \
- nco:country ?country ; \
- nco:region ?district ; \
- nco:locality ?city ; \
- nco:streetAddress ?street ; \
- nco:postalcode ?postalcode \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asBoundingBox \
- [ \
- a mlo:GeoBoundingBox ; \
- mlo:bbNorthWest \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?nwLat ; \
- mlo:longitude ?nwLon ; \
- mlo:altitude ?nwAlt \
- ] ; \
- mlo:bbSouthEast \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?seLat ; \
- mlo:longitude ?seLon ; \
- mlo:altitude ?seAlt \
- ] \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:latitude ?cLat ; \
- mlo:longitude ?cLon \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:altitude ?cAlt \
- ] \
- ] \
- } . \
- OPTIONAL \
- { \
- ?urn mlo:location \
- [ \
- a mlo:GeoLocation ; \
- mlo:asGeoPoint \
- [ \
- a mlo:GeoPoint ; \
- mlo:radius ?cRad \
- ] \
- ] \
- } \
- FILTER(tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
-} ORDER BY ASC(?distance) LIMIT 50 \
-"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get max 50 landmarks within certain range without bounding box (original) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_location_05 (self):
- query = " \
-SELECT \
- ?urn \
- mlo:latitude(?point) mlo:longitude(?point) mlo:altitude(?point) mlo:radius(?point) \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
-WHERE { \
- ?urn a mlo:Landmark . \
- ?urn mlo:location ?location . \
- ?location mlo:asGeoPoint ?point . \
-} ORDER BY ASC(?name) LIMIT 50 \
-"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get 50 landmarks (simplified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-
- def p_test_location_06 (self):
- query = " \
-SELECT \
- ?urn \
- ?cLat ?cLon mlo:altitude(?point) mlo:radius(?point) \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
-WHERE { \
- ?urn a mlo:Landmark . \
- ?urn mlo:location ?location . \
- ?location mlo:asGeoPoint ?point . \
- ?point mlo:latitude ?cLat . \
- ?point mlo:longitude ?cLon . \
- FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && ?cLon >= 63.42 && ?cLon <= 64.96) \
-} ORDER BY ASC(?name) LIMIT 50 \
-"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get max 50 landmarks within coords (simplified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_location_07 (self):
- query = " \
-SELECT \
- ?urn \
- ?cLat ?cLon mlo:altitude(?point) mlo:radius(?point) \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
-WHERE { \
- ?urn a mlo:Landmark . \
- ?urn mlo:location ?location . \
- ?location mlo:asGeoPoint ?point . \
- ?point mlo:latitude ?cLat . \
- ?point mlo:longitude ?cLon . \
- FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && \
- ?cLon >= 63.94 && ?cLon <= 64.96 && \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
-} ORDER BY ASC(?distance) LIMIT 50 \
-"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get max 50 landmarks within range with bounding box (simplified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
- def p_test_location_08 (self):
- query = " \
-SELECT \
- ?urn \
- ?cLat ?cLon mlo:altitude(?point) mlo:radius(?point) \
- nie:title(?urn) \
- nie:description(?urn) \
- mlo:belongsToCategory(?urn) \
- tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
-WHERE { \
- ?urn a mlo:Landmark . \
- ?urn mlo:location ?location . \
- ?location mlo:asGeoPoint ?point . \
- ?point mlo:latitude ?cLat . \
- ?point mlo:longitude ?cLon . \
- FILTER(tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
-} ORDER BY ASC(?distance) LIMIT 50 \
-"
- start=time.time()
-
- result=self.resources.SparqlQuery(query)
-
- elapse =time.time()-start
- print "Time taken to get max 50 landmarks within range without bounding box (simplified) %s " %elapse
- print "no. of items retrieved: %d" %len(result)
-
-if __name__ == "__main__":
- unittest.main()
-
diff --git a/tests/functional-tests/test-runner.sh b/tests/functional-tests/test-runner.sh
index 24c0e4290..f429a3005 100755
--- a/tests/functional-tests/test-runner.sh
+++ b/tests/functional-tests/test-runner.sh
@@ -3,11 +3,6 @@
# Test runner script for Tracker's functional tests
SCRIPT=$1
-if test "$SCRIPT" = "python" ; then SCRIPT=$2 ; fi
-if ! test -x $SCRIPT ; then
- echo "(Skipping $@ - not executable)"
- exit
-fi
DBUS_SESSION_BUS_PID=
diff --git a/tests/functional-tests/virtual-files-tc.py b/tests/functional-tests/virtual-files-tc.py
deleted file mode 100644
index e6290b66e..000000000
--- a/tests/functional-tests/virtual-files-tc.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-
-import sys,os,dbus
-import unittest
-import time
-import random
-import configuration
-import commands
-import signal
-import string
-
-TRACKER = "org.freedesktop.Tracker1"
-TRACKER_OBJ = "/org/freedesktop/Tracker1/Resources"
-RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
-MINER="org.freedesktop.Tracker1.Miner.Files"
-MINER_OBJ="/org/freedesktop/Tracker1/Miner/Files"
-MINER_IFACE="org.freedesktop.Tracker1.Miner"
-
-
-target = configuration.check_target()
-
-if target == configuration.MAEMO6_HW:
- """target is device """
- dir_path = configuration.MYDOCS
- dir_path_parent = '/home/user'
- src = configuration.TEST_DATA_IMAGES + 'test-image-1.jpg'
-
-elif target == configuration.DESKTOP:
- dir_path = os.path.expanduser("~")
- dir_path_parent = os.path.expanduser("~") + "/" + "tmp"
- if (not (os.path.exists(dir_path_parent) and os.path.isdir(dir_path_parent))):
- os.mkdir (dir_path_parent)
- src = configuration.VCS_TEST_DATA_IMAGES + 'test-image-1.jpg'
-
-print dir_path
-
-""" copy the test data to proper location. """
-def copy_file():
-
- dest = dir_path
- print 'Copying '+src+' to '+dest
- commands.getoutput('cp '+src+ ' '+dest)
-
-copy_file()
-
-class TestVirtualFiles (unittest.TestCase):
- def setUp(self):
- bus = dbus.SessionBus()
- tracker = bus.get_object(TRACKER, TRACKER_OBJ)
- self.resources = dbus.Interface (tracker, dbus_interface=RESOURCES_IFACE)
- miner_obj= bus.get_object(MINER,MINER_OBJ)
- self.miner=dbus.Interface (miner_obj,dbus_interface=MINER_IFACE)
-
- def sparql_update(self,query):
- return self.resources.SparqlUpdate(query)
- def query(self,query):
- return self.resources.SparqlQuery(query)
- def ignore(self,uri):
- return self.miner.IgnoreNextUpdate(uri)
-
-
-class virtual_files(TestVirtualFiles):
-
- def test_Virttual_01(self):
- """
- Test if the update is ignored until the creation of the file is completed.
- 1. Move the file to some other location.
- 2. Create resource in tracker , by making instance of nie:DataObject.
- 3. IgnoreNextUpdate on the files.
- 4. Copy the original file to the present directory.
- 5. Query for the title of the file.
- """
-
- test_file = 'test-image-1.jpg'
- file= dir_path + '/' + test_file
- uri='file://' + file
- print uri
-
- commands.getoutput('mv ' + file + ' ' + dir_path_parent)
-
- Insert = """
- INSERT { _:x a nfo:Image, nie:DataObject ;
- nie:url <%s> ;
- nie:title 'title_test'. }""" %(uri)
- print Insert
-
- self.sparql_update(Insert)
- time.sleep(10)
-
- self.miner.IgnoreNextUpdate([uri])
-
- commands.getoutput('cp ' + dir_path_parent + '/'+ test_file + ' ' + dir_path)
-
- QUERY = """
- SELECT ?t WHERE { ?file a nfo:FileDataObject ;
- nie:title ?t ;
- nie:url <%s> .}
- """ %(uri)
- print QUERY
-
- result=self.query(QUERY)
- print result
-
- self.assert_(result[0][0].find('title_test')!=-1 , "File is not ignored")
-
-
- def test_Virtual_02(self):
-
- """
- 1) Insert in tracker a "virtual" file (can be a text file) tagged as Favourite
- 2) Start writing the file (with some sleep to make the process long)
- 3) Close the file, wait for tracker to discover it
- 4) Check the metadata of the file AND that the tag (favourite) is there
- """
-
- test_file = 'testfilename.txt'
- file= dir_path + '/' + test_file
- url='file://' + file
- print url
-
- insert="""
- INSERT { _:x a nfo:Image, nie:DataObject ; \
- nie:url <%s> ; \
- nie:title 'title_test';
- nao:hasTag [a nao:Tag ; nao:prefLabel "Favorite"] ;
- nie:plainTextContent 'This is script to test virtual file support'.
- }
- """ %url
- self.sparql_update(insert)
-
- time.sleep(3)
-
- QUERY="""
- SELECT ?label ?content WHERE { ?file a nie:DataObject ;nao:hasTag[a nao:Tag ;nao:prefLabel ?label]; nie:url <%s> ;
- nie:plainTextContent ?content.
- }
- """ %url
-
- result=self.query(QUERY)
-
- self.assert_(result[0][0].find('Favorite')!=-1 and result[1][1].find("This is script to test virtual file support")!=-1, "File is not monitored by tracker")
-
-
-
-if __name__ == "__main__":
-
- unittest.main()
- if (os.path.exists(dir_path_parent) and os.path.isdir(dir_path_parent)):
- os.rmdir (dir_path_parent)