[tracker/rss-enclosures] Added updated contacts-related performance queries.



commit 866d4c211690be3896edada5afbc3a4b4021d914
Author: Mikael Ottela <mikael ottela ixonos com>
Date:   Wed Apr 28 07:29:10 2010 +0300

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

 tests/functional-tests/performance-tc.py |  527 ++++++++++++++++++++++++++++++
 utils/data-generators/cc/generate        |    4 +-
 utils/data-generators/cc/nco.py          |   74 +++-
 3 files changed, 585 insertions(+), 20 deletions(-)
---
diff --git a/tests/functional-tests/performance-tc.py b/tests/functional-tests/performance-tc.py
index 4dc6593..9da88d6 100644
--- a/tests/functional-tests/performance-tc.py
+++ b/tests/functional-tests/performance-tc.py
@@ -1354,6 +1354,533 @@ class content_manager (TestUpdate) :
 		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)
+
 if __name__ == "__main__":
         unittest.main()
 
diff --git a/utils/data-generators/cc/generate b/utils/data-generators/cc/generate
index de87599..92ab7a4 100755
--- a/utils/data-generators/cc/generate
+++ b/utils/data-generators/cc/generate
@@ -37,7 +37,8 @@ except:
 tools.addType( 'nco#EmailAddress', 10 )
 tools.addType( 'nco#PostalAddress', 11 )
 tools.addType( 'nco#PhoneNumber', 12 )
-tools.addType( 'nco#PersonContact', 13 )
+tools.addType( 'nco#IMAddress', 13 )
+tools.addType( 'nco#PersonContact', 18 )
 tools.addType( 'nmm#Photo', 20 )
 tools.addType( 'nmm#Video', 21 )
 tools.addType( 'nmo#MailAccount', 30 )
@@ -73,6 +74,7 @@ for contact in xrange(1, count_contacts+1):
   nco.generateEmailAddress( contact )
   nco.generatePostalAddress( contact )
   nco.generatePhoneNumber( contact )
+  nco.generateIMAddress ( contact )
   nco.generatePersonContact( contact )
 print "Done"
 
diff --git a/utils/data-generators/cc/nco.py b/utils/data-generators/cc/nco.py
index 6e2cd29..0a6b09f 100644
--- a/utils/data-generators/cc/nco.py
+++ b/utils/data-generators/cc/nco.py
@@ -29,16 +29,19 @@ def generatePhoneNumber(index):
 ####################################################################################
 nco_PostalAddress = '''
 <%(postal_address_uri)s> a nco:PostalAddress;
-    nco:country "%(postal_address_country)s" ;
-    nco:region "%(postal_address_region)s" ;
-    nco:postalcode "%(postal_address_postal_code)s" ;
-    nco:locality "%(postal_address_city)s" ;
-    nco:streetAddress "%(postal_address_street)s" .
+    nco:country         "%(postal_address_country)s" ;
+    nco:pobox           "%(postal_address_pobox)s" ;
+    nco:region          "%(postal_address_region)s" ;
+    nco:postalcode      "%(postal_address_postal_code)s" ;
+    nco:locality        "%(postal_address_city)s" ;
+    nco:streetAddress   "%(postal_address_street)s" .
 '''
 def generatePostalAddress(index):
   me = 'nco#PostalAddress'
   postal_address_uri         = 'urn:pa:%d' % index
   postal_address_country     = 'Country %d' % (index % 1000)
+  postal_address_locality    = 'Locality %d' % (index % 1000)
+  postal_address_pobox       = str(index)
   postal_address_region      = 'Region %d' % (index % 1000)
   postal_address_postal_code = '%05d' % (index % 100000)
   postal_address_city        = 'City %d' % (index % 1000)
@@ -47,24 +50,57 @@ def generatePostalAddress(index):
   tools.addItem( me, postal_address_uri, nco_PostalAddress % locals() )
 
 ####################################################################################
+nco_IMAddress = '''
+<%(im_address_uri)s> a nco:IMAddress;
+    nco:imID         "%(im_address_imid)s" ;
+    nco:imCapability  %(im_address_capability)s .
+'''
+def generateIMAddress(index):
+  me = 'nco#IMAddress'
+  im_address_uri          = 'urn:ima:%d' % index
+  im_address_imid         = 'IM ID %d' % (index % 1000)
+  im_address_capability   = '<%s>' % ('nco:im-capability-text-chat', 'nco:im-capability-audio-calls') [ index %2 ]
+  tools.addItem( me, im_address_uri, nco_IMAddress % locals() )
+
+####################################################################################
 nco_PersonContact = '''
 <%(contact_uri)s> a nco:PersonContact;
-    nco:fullname         "%(contact_name_given)s %(contact_name_family)s";
-    nco:nameGiven        "%(contact_name_given)s";
-    nco:nameFamily       "%(contact_name_family)s";
-    nco:birthDate        "%(contact_birth_date)s";
-    nco:hasEmailAddress   %(email_address_uri)s;
-    nco:hasPhoneNumber    %(phonenumber_uri)s;
-    nco:hasPostalAddress  %(postal_address_uri)s .
+    nco:fullname            "%(contact_name_given)s %(contact_name_family)s";
+    nco:nameGiven           "%(contact_name_given)s";
+    nco:nameFamily          "%(contact_name_family)s";
+    nco:nameAdditional      "%(contact_name_additional)s" ;
+    nco:nickname            "%(contact_nickname)s" ;
+    nco:nameHonorificPrefix "%(contact_honorific_prefix)s" ;
+    nco:nameHonorificSuffix "%(contact_honorific_suffix)s" ;
+    nco:birthDate           "%(contact_birth_date)s" ;
+    nco:gender               %(contact_gender)s ;
+    nco:contactUID          "%(contact_uid)s" ;
+    nco:note                "%(contact_note)s" ;
+    nco:hasEmailAddress      %(email_address_uri)s ;
+    nco:hasPhoneNumber       %(phonenumber_uri)s ;
+    nco:hasPostalAddress     %(postal_address_uri)s ;
+    nco:hasIMAddress         %(im_address_uri)s ;
+    nie:contentCreated      "%(contact_created)s" ;
+    nie:contentLastModified "%(contact_modified)s"  .
 '''
 def generatePersonContact(index):
   me = 'nco#PersonContact'
-  contact_uri         = 'urn:uid:%d' % index
-  contact_name_given  = 'Given%d' % (index % 1000)
-  contact_name_family = 'Family%d' % (index % 1000)
-  contact_birth_date  = '%d-%02d-%02dT%02d:%02d:%02dZ' % (1900 + (index % 100), (index % 12) + 1, (index % 25) + 1, (index % 12) + 1, (index % 12) + 1, (index % 12) + 1)
-  email_address_uri   = '<%s>' % tools.getLastUri( 'nco#EmailAddress' )
-  phonenumber_uri     = '<%s>' % tools.getLastUri( 'nco#PhoneNumber' )
-  postal_address_uri  = '<%s>' % tools.getLastUri( 'nco#PostalAddress' )
+  contact_uri              = 'urn:uid:%d' % index
+  contact_name_given       = 'Given%d' % (index % 1000)
+  contact_name_family      = 'Family%d' % (index % 1000)
+  contact_name_additional  = 'Additional%d' % (index % 1000)
+  contact_nickname         = 'Nickname%d' % (index % 1000)
+  contact_honorific_prefix = ('Sir', 'Master') [index % 2]
+  contact_honorific_suffix = ('PhD', 'Deceased') [index % 2]
+  contact_birth_date       = '%d-%02d-%02dT%02d:%02d:%02dZ' % (1900 + (index % 100), (index % 12) + 1, (index % 25) + 1, (index % 12) + 1, (index % 12) + 1, (index % 12) + 1)
+  contact_gender           = '<%s>' % ('nco:gender-female', 'nco:gender-female') [index % 2]
+  contact_uid              = 'uid:contact:%d' % index
+  contact_note             = 'Note number %d' % index
+  email_address_uri        = '<%s>' % tools.getLastUri( 'nco#EmailAddress' )
+  phonenumber_uri          = '<%s>' % tools.getLastUri( 'nco#PhoneNumber' )
+  postal_address_uri       = '<%s>' % tools.getLastUri( 'nco#PostalAddress' )
+  im_address_uri           = '<%s>' % tools.getLastUri( 'nco#IMAddress' )
+  contact_created          = '%d-%02d-%02dT%02d:%02d:%02dZ' % (1950 + (index % 50), (index % 12) + 1, (index % 25) + 1, (index % 12) + 1, (index % 12) + 1, (index % 12) + 1)
+  contact_modified         = '%d-%02d-%02dT%02d:%02d:%02dZ' % (1960 + (index % 40), (index % 12) + 1, (index % 25) + 1, (index % 12) + 1, (index % 12) + 1, (index % 12) + 1)
 
   tools.addItem( me, contact_uri, nco_PersonContact % locals() )



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