[tracker] Handle nfo:Equipment correctly in the data generators
- From: Mikael Ottela <mottela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] Handle nfo:Equipment correctly in the data generators
- Date: Wed, 1 Dec 2010 16:54:42 +0000 (UTC)
commit 37665765558b993559317f3340369676950e9c68
Author: Mikael Ottela <mikael ottela ixonos com>
Date: Mon Nov 1 12:49:48 2010 +0200
Handle nfo:Equipment correctly in the data generators
utils/data-generators/cc/convert_data.py | 3 +-
utils/data-generators/cc/default.cfg | 3 ++
utils/data-generators/cc/gen_data.py | 8 +++++
utils/data-generators/cc/generate | 11 ++++++
utils/data-generators/cc/max.cfg | 3 ++
utils/data-generators/cc/nmm.py | 34 +++++++++++++++++---
.../cc/source-data/equipment-manufacturers.txt | 6 +++
.../cc/source-data/equipment-models.txt | 8 +++++
8 files changed, 70 insertions(+), 6 deletions(-)
---
diff --git a/utils/data-generators/cc/convert_data.py b/utils/data-generators/cc/convert_data.py
index f6a88bc..37acbd2 100755
--- a/utils/data-generators/cc/convert_data.py
+++ b/utils/data-generators/cc/convert_data.py
@@ -31,7 +31,8 @@ import os
data_dir = os.path.join (os.path.dirname (__file__), "source-data")
simple_files_to_process = ['street-names.txt', 'street-types.txt', 'latin-words.txt',
'email-domains.txt', 'job-titles.txt', 'company-names.txt',
- 'company-types.txt']
+ 'company-types.txt',
+ 'equipment-manufacturers.txt','equipment-models.txt']
def load_files():
# Process Zip Codes
diff --git a/utils/data-generators/cc/default.cfg b/utils/data-generators/cc/default.cfg
index 1ee1e50..1f73115 100644
--- a/utils/data-generators/cc/default.cfg
+++ b/utils/data-generators/cc/default.cfg
@@ -31,6 +31,9 @@ fms : 100
softcats : 10
softapps : 100
+# Equipment
+equipment : 10
+
# FILE SYSTEM BASED CONTENT
# Volumes
diff --git a/utils/data-generators/cc/gen_data.py b/utils/data-generators/cc/gen_data.py
index 143ec2d..f1ca119 100755
--- a/utils/data-generators/cc/gen_data.py
+++ b/utils/data-generators/cc/gen_data.py
@@ -53,6 +53,8 @@ email_domains = pickle.load(source_file)
job_titles = pickle.load(source_file)
company_names = pickle.load(source_file)
company_types = pickle.load(source_file)
+equipment_manufacturers = pickle.load(source_file)
+equipment_models = pickle.load(source_file)
source_file.close()
@@ -160,6 +162,12 @@ def create_company_name(biz_type=None):
name.append(random.choice(company_names))
return " ".join(name)
+def create_equipment_manufacturer():
+ return random.choice(equipment_manufacturers)
+
+def create_equipment_model(manufacturer=create_equipment_manufacturer()):
+ return random.choice(equipment_models)
+
if __name__ == "__main__":
first, last = create_name()
add = create_street()
diff --git a/utils/data-generators/cc/generate b/utils/data-generators/cc/generate
index fcc46a2..af1d453 100755
--- a/utils/data-generators/cc/generate
+++ b/utils/data-generators/cc/generate
@@ -80,6 +80,7 @@ tools.addType( 'nmo#Call', 38 )
tools.addType( 'nmm#Artist', 40 )
tools.addType( 'nmm#MusicAlbum', 41 )
tools.addType( 'nmm#MusicPiece', 42 )
+tools.addType( 'nfo#Equipment', 44 )
tools.addType( 'nmm#Photo', 45 )
tools.addType( 'nmm#Video', 46 )
tools.addType( 'tracker#Volume', 50 )
@@ -191,6 +192,16 @@ for artist in xrange(1, count_artists+1):
nmm.generateMusicPiece( artist*count_albums*count_songs+album*count_songs+song )
print "Done"
+print "Generate Equipment",
+count_equipment = get_counter('counts','equipment')
+nmm.generateOwnEquipment ()
+for equipment in xrange(1, count_equipment):
+ if (equipment % 2 == 0):
+ sys.stdout.write('.')
+ sys.stdout.flush()
+ nmm.generateEquipment( equipment )
+print "Done"
+
print "Generate Photos",
count_images = get_counter('counts','images')
for photo in xrange(1, count_images+1):
diff --git a/utils/data-generators/cc/max.cfg b/utils/data-generators/cc/max.cfg
index e15f311..8c35b6b 100644
--- a/utils/data-generators/cc/max.cfg
+++ b/utils/data-generators/cc/max.cfg
@@ -31,6 +31,9 @@ fms : 1000
softcats : 10
softapps : 100
+# Equipment
+equipment : 10
+
# FILE SYSTEM BASED CONTENT
# Volumes
diff --git a/utils/data-generators/cc/nmm.py b/utils/data-generators/cc/nmm.py
index 6fa5c47..ca4247d 100644
--- a/utils/data-generators/cc/nmm.py
+++ b/utils/data-generators/cc/nmm.py
@@ -1,6 +1,31 @@
# -*- coding: utf-8 -*-
import tools
+import gen_data as gen
+
+####################################################################################
+nfo_Equipment = '''
+<%(equipment_uri)s> a nfo:Equipment;
+ nfo:manufacturer "%(equipment_manufacturer)s";
+ nfo:model "%(equipment_model)s".
+'''
+def generateEquipment(index):
+ me = 'nfo#Equipment'
+ equipment_manufacturer = gen.create_equipment_manufacturer()
+ equipment_model = gen.create_equipment_model(equipment_manufacturer)
+ equipment_uri = 'urn:equipment:%s:%s:' % (equipment_manufacturer,equipment_model)
+
+ tools.addItem( me, equipment_uri, nfo_Equipment % locals() )
+
+def generateOwnEquipment():
+ me = 'nfo#Equipment'
+ equipment_manufacturer = 'NOKIA'
+ equipment_model = ''
+ equipment_uri = 'urn:equipment:%s:%s:' % (equipment_manufacturer,equipment_model)
+
+ tools.addItem( me, equipment_uri, nfo_Equipment % locals() )
+
+
####################################################################################
nmm_Photo = '''
<%(photo_uri)s> a nie:DataObject, nfo:FileDataObject, nfo:Media, nfo:Visual, nfo:Image, nmm:Photo ;
@@ -15,7 +40,7 @@ nmm_Photo = '''
nfo:fileLastAccessed "%(photo_date)s";
nfo:fileSize "%(photo_size)s";
nfo:fileName "%(photo_filename)s" ;
- nfo:equipment [a nfo:Equipment ; nfo:model "%(photo_camera)s"];
+ nfo:equipment <%(photo_equipment)s> ;
nmm:exposureTime "%(photo_exposure)s";
nmm:fnumber "%(photo_fnumber)s";
nmm:focalLength "%(photo_focal_length)s";
@@ -30,10 +55,7 @@ def generatePhoto(index):
photo_filename = 'photo%d.jpg' % index
photo_url = 'file:///path/' + photo_filename
photo_size = str(1000000 + index)
- if (index % 10 == 0):
- photo_camera = "NOKIA"
- else:
- photo_camera = 'Canikon 1000 Ultra Mega'
+ photo_equipment = tools.getRandomUri( 'nfo#Equipment' )
photo_exposure = '0.%d' % index
photo_fnumber = '%d.0' % (1 + (index % 20))
photo_focal_length = '%d.0' % (1 + (index % 500))
@@ -55,6 +77,7 @@ nmm_Video = '''
nfo:fileLastAccessed "%(video_date)s";
nfo:fileSize "%(video_size)s";
nfo:fileName "%(video_filename)s" ;
+ nfo:equipment <%(video_equipment)s> ;
nfo:sampleRate "%(video_samplerate)s" ;
nfo:duration "%(video_duration)s" ;
nao:hasTag [a nao:Tag ; nao:prefLabel "%(video_tag)s"] .
@@ -66,6 +89,7 @@ def generateVideo(index):
video_url = 'file:///path/' + video_filename
video_size = str(1000000 + index)
video_date = '%d-%02d-%02dT01:01:01Z' % (2000 + (index % 10), (index % 12) + 1, (index % 25) + 1)
+ video_equipment = tools.getRandomUri( 'nfo#Equipment' )
video_samplerate = str(index)
video_duration = str(index)
video_tag = ('TEST', 'nomatch') [index %2]
diff --git a/utils/data-generators/cc/source-data/equipment-manufacturers.txt b/utils/data-generators/cc/source-data/equipment-manufacturers.txt
new file mode 100755
index 0000000..be3a8d0
--- /dev/null
+++ b/utils/data-generators/cc/source-data/equipment-manufacturers.txt
@@ -0,0 +1,6 @@
+Conan
+Sumsong
+Pictorial
+Photia
+Carl
+Zeuiss
diff --git a/utils/data-generators/cc/source-data/equipment-models.txt b/utils/data-generators/cc/source-data/equipment-models.txt
new file mode 100755
index 0000000..c72c58d
--- /dev/null
+++ b/utils/data-generators/cc/source-data/equipment-models.txt
@@ -0,0 +1,8 @@
+A10
+A11
+A12
+B10
+B11
+B12
+RTS-68
+JKL682
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]