[tracker] Fix to the message related generator scripts to use simple contacts for each message instead of link



commit d951346afaf429e9faa3b1510dad325c3ffcf121
Author: Mikael Ottela <mikael ottela ixonos com>
Date:   Tue Jun 1 19:11:38 2010 +0300

    Fix to the message related generator scripts to use simple contacts for each
    message instead of linking directly to personContacts.
    
    Small fix to music pieces to not randomize artists and albums.

 utils/data-generators/cc/generate |    8 +++++-
 utils/data-generators/cc/nco.py   |   54 +++++++++++++++++++++++++++++++++++++
 utils/data-generators/cc/nmm.py   |    4 +-
 utils/data-generators/cc/nmo.py   |   26 +++++++++--------
 4 files changed, 77 insertions(+), 15 deletions(-)
---
diff --git a/utils/data-generators/cc/generate b/utils/data-generators/cc/generate
index 8776d06..45500f2 100755
--- a/utils/data-generators/cc/generate
+++ b/utils/data-generators/cc/generate
@@ -44,6 +44,9 @@ tools.addType( 'nco#EmailAddress', 10 )
 tools.addType( 'nco#PostalAddress', 11 )
 tools.addType( 'nco#PhoneNumber', 12 )
 tools.addType( 'nco#IMAddress', 13 )
+tools.addType( 'nco#ContactEmail', 14 )
+tools.addType( 'nco#ContactCall', 15 )
+tools.addType( 'nco#ContactIM', 16 )
 tools.addType( 'nco#PersonContact', 18 )
 tools.addType( 'mlo#GeoPoint', 20 )
 tools.addType( 'mlo#LocationBoundingBox', 21 )
@@ -82,9 +85,12 @@ for contact in xrange(1, count_contacts+1):
     sys.stdout.write('.')
     sys.stdout.flush()
   nco.generateEmailAddress( contact )
+  nco.generateContactEmail( contact )
   nco.generatePostalAddress( contact )
   nco.generatePhoneNumber( contact )
-  nco.generateIMAddress ( contact )
+  nco.generateContactCall( contact )
+  nco.generateIMAddress( contact )
+  nco.generateContactIM( contact )
   nco.generatePersonContact( contact )
 print "Done"
 
diff --git a/utils/data-generators/cc/nco.py b/utils/data-generators/cc/nco.py
index 0a6b09f..0d0dbad 100644
--- a/utils/data-generators/cc/nco.py
+++ b/utils/data-generators/cc/nco.py
@@ -15,6 +15,23 @@ def generateEmailAddress(index):
   tools.addItem( me, email_address_uri, nco_EmailAddress % locals() )
 
 ####################################################################################
+nco_Contact_Email = '''
+<%(emailcontact_uri)s> a nco:Contact;
+    nco:fullname            "%(emailcontact_name_given)s %(emailcontact_name_family)s";
+    nco:nickname            "%(emailcontact_nickname)s" ;
+    nco:hasEmailAddress      %(emailcontact_email_address_uri)s .
+'''
+def generateContactEmail(index):
+  me = 'nco#ContactEmail'
+  emailcontact_uri              = 'urn:contact:email%d' % index
+  emailcontact_name_given       = 'Given%d' % (index % 1000)
+  emailcontact_name_family      = 'Family%d' % (index % 1000)
+  emailcontact_nickname         = 'Nickname%d' % (index % 1000)
+  emailcontact_email_address_uri= '<%s>' % tools.getLastUri( 'nco#EmailAddress' )
+
+  tools.addItem( me, emailcontact_uri, nco_Contact_Email % locals() )
+
+####################################################################################
 nco_PhoneNumber = '''
 <%(phonenumber_uri)s> a nco:CellPhoneNumber;
     nco:phoneNumber "%(phonenumber)s".
@@ -27,6 +44,25 @@ def generatePhoneNumber(index):
   tools.addItem( me, phonenumber_uri, nco_PhoneNumber % locals() )
 
 ####################################################################################
+
+nco_Contact_Call = '''
+<%(callcontact_uri)s> a nco:Contact;
+    nco:fullname            "%(callcontact_name_given)s %(callcontact_name_family)s";
+    nco:nickname            "%(callcontact_nickname)s" ;
+    nco:hasPhoneNumber       %(callcontact_phonenumber_uri)s .
+'''
+def generateContactCall(index):
+  me = 'nco#ContactCall'
+  callcontact_uri              = 'urn:contact:call%d' % index
+  callcontact_name_given       = 'Given%d' % (index % 1000)
+  callcontact_name_family      = 'Family%d' % (index % 1000)
+  callcontact_nickname         = 'Nickname%d' % (index % 1000)
+  callcontact_phonenumber_uri  = '<%s>' % tools.getLastUri( 'nco#PhoneNumber' )
+
+  tools.addItem( me, callcontact_uri, nco_Contact_Call % locals() )
+
+####################################################################################
+
 nco_PostalAddress = '''
 <%(postal_address_uri)s> a nco:PostalAddress;
     nco:country         "%(postal_address_country)s" ;
@@ -63,6 +99,24 @@ def generateIMAddress(index):
   tools.addItem( me, im_address_uri, nco_IMAddress % locals() )
 
 ####################################################################################
+
+nco_Contact_IM = '''
+<%(imcontact_uri)s> a nco:Contact;
+    nco:fullname            "%(imcontact_name_given)s %(imcontact_name_family)s";
+    nco:nickname            "%(imcontact_nickname)s" ;
+    nco:hasIMAddress         %(imcontact_imaddress_uri)s .
+'''
+def generateContactIM(index):
+  me = 'nco#ContactIM'
+  imcontact_uri              = 'urn:contact:im%d' % index
+  imcontact_name_given       = 'Given%d' % (index % 1000)
+  imcontact_name_family      = 'Family%d' % (index % 1000)
+  imcontact_nickname         = 'Nickname%d' % (index % 1000)
+  imcontact_imaddress_uri    = '<%s>' % tools.getLastUri( 'nco#IMAddress' )
+
+  tools.addItem( me, imcontact_uri, nco_Contact_IM % locals() )
+
+####################################################################################
 nco_PersonContact = '''
 <%(contact_uri)s> a nco:PersonContact;
     nco:fullname            "%(contact_name_given)s %(contact_name_family)s";
diff --git a/utils/data-generators/cc/nmm.py b/utils/data-generators/cc/nmm.py
index cf2baf1..3f20edb 100644
--- a/utils/data-generators/cc/nmm.py
+++ b/utils/data-generators/cc/nmm.py
@@ -138,8 +138,8 @@ def generateMusicPiece(index):
   music_piece_genre         = 'Genre %d' % (index % 1000)
   music_piece_channels      = '2'
   music_piece_sample_rate   = '44100.0'
-  music_piece_album         = tools.getRandomUri( 'nmm#MusicAlbum' )
-  music_piece_artist        = tools.getRandomUri( 'nmm#Artist' )
+  music_piece_album         = tools.getLastUri( 'nmm#MusicAlbum' )
+  music_piece_artist        = tools.getLastUri( 'nmm#Artist' )
   music_piece_length        = '%d' % (1 + (index % 1000))
   music_piece_track         = '%d' % (1 + (index % 100))
 
diff --git a/utils/data-generators/cc/nmo.py b/utils/data-generators/cc/nmo.py
index f80c23b..aacc6bc 100644
--- a/utils/data-generators/cc/nmo.py
+++ b/utils/data-generators/cc/nmo.py
@@ -42,12 +42,13 @@ nmo_Email = '''
     nie:isLogicalPartOf  <%(email_folder)s> ;
     nie:contentSize      "%(email_size)s" ;
     nie:plainTextContent "%(email_content)s" ;
-    nmo:recipient        <%(email_recipient)s> ;
+    nmo:recipient        <%(email_to)s> ;
+    nmo:to               <%(email_to)s> ;
     nmo:messageId        "%(email_id)s" ;
     nmo:messageSubject   "%(email_subject)s" ;
     nmo:receivedDate     "%(email_received)s" ;
-    nmo:sender           <%(email_sender)s> ;
-    nmo:from             <%(email_sender)s> ;
+    nmo:sender           <%(email_from)s> ;
+    nmo:from             <%(email_from)s> ;
     nmo:isDraft          "%(email_draft)s" ;
     nmo:isDeleted        "%(email_deleted)s" ;
     nmo:sentDate         "%(email_sent)s" .
@@ -60,11 +61,11 @@ def generateEmail(index):
   email_account   = tools.getRandomUri( 'nmo#MailAccount' )
   email_folder    = tools.getRandomUri( 'nmo#MailFolder' )
   email_size      = str(index)
-  email_recipient = tools.getRandomUri( 'nco#PersonContact' )
+  email_to        = tools.getRandomUri( 'nco#ContactEmail' )
   email_id        = str(index)
   email_subject   = 'Subject %d' % (index % 1000)
   email_received  = '%d-%02d-%02dT01:01:01Z' % (2000 + (index % 10), (index % 12) + 1, (index % 25) + 1)
-  email_sender    = tools.getRandomUri( 'nco#PersonContact' )
+  email_from      = tools.getRandomUri( 'nco#ContactEmail' )
   email_sent      = '%d-%02d-%02dT01:01:02Z' % (2000 + (index % 10), (index % 12) + 1, (index % 25) + 1)
   email_content   = gen.create_text(2,30)
   email_draft     = 'false'
@@ -79,7 +80,7 @@ nmo_CommunicationChannel = '''
   nie:informationElementDate "%(channel_date)s";
   nie:contentLastModified    "%(channel_modified)s";
   nmo:lastMessageDate        "%(channel_last_message)s";
-  nmo:hasParticipant         <%(channel_participiant)s> .
+  nmo:hasParticipant         <%(channel_participant)s> .
 '''
 def generateCommunicationChannel(index):
   me = 'nmo#CommunicationChannel'
@@ -88,11 +89,12 @@ def generateCommunicationChannel(index):
   channel_date         = tools.now
   channel_modified     = channel_date
   channel_last_message = channel_date
-  channel_participiant = tools.getRandomUri( 'nco#PersonContact' )
+  channel_participant  = tools.getRandomUri( 'nco#PersonContact' )
 
   tools.addItem( me, channel_uri, nmo_CommunicationChannel % locals() )
 
-####################################################################################
+##################################################################
+
 nmo_IMMessage = '''
 <%(immessage_uri)s> a nmo:IMMessage;
   nie:plainTextContent       "%(immessage_content)s" ;
@@ -116,8 +118,8 @@ def generateIMMessage(index):
   immessage_content     = 'Lorem IM Ipsum %d' % index
   immessage_date        = tools.now
   immessage_modified    = tools.now
-  immessage_from        = tools.getRandomUri( 'nco#PersonContact' )
-  immessage_to          = tools.getRandomUri( 'nco#PersonContact' )
+  immessage_from        = tools.getRandomUri( 'nco#ContactIM' )
+  immessage_to          = tools.getRandomUri( 'nco#ContactIM' )
   immessage_draft       = ('false', 'true')[index % 2]
   immessage_read        = ('false', 'true')[index % 2]
   immessage_sent        = 'true'
@@ -190,8 +192,8 @@ def generateCall(index):
   call_subject     = 'Subject %d' % index
   call_date        = tools.now
   call_modified    = tools.now
-  call_from        = tools.getRandomUri( 'nco#PersonContact' )
-  call_to          = tools.getRandomUri( 'nco#PersonContact' )
+  call_from        = tools.getRandomUri( 'nco#ContactCall' )
+  call_to          = tools.getRandomUri( 'nco#ContactCall' )
   call_read        = 'true'
   call_sent        = 'true'
   call_received    = tools.now



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