[tracker/tracker-0.10] data-generators:Add slo scripts to data generators



commit 5750f752f54b158457e64a48913b26c9ae8c36fe
Author: Mikael Ottela <mikael ottela ixonos com>
Date:   Fri Feb 18 02:37:19 2011 +0200

    data-generators:Add slo scripts to data generators

 tests/functional-tests/ttl/Makefile.am        |    6 ++-
 utils/data-generators/cc/Makefile.am          |    1 +
 utils/data-generators/cc/generate             |   14 ++++-
 utils/data-generators/cc/ontology_prefixes.py |    1 +
 utils/data-generators/cc/slo.py               |   73 +++++++++++++++++++++++++
 5 files changed, 91 insertions(+), 4 deletions(-)
---
diff --git a/tests/functional-tests/ttl/Makefile.am b/tests/functional-tests/ttl/Makefile.am
index f236258..7628368 100644
--- a/tests/functional-tests/ttl/Makefile.am
+++ b/tests/functional-tests/ttl/Makefile.am
@@ -20,8 +20,10 @@ ttl_DATA =                                             \
 	015-nco_ContactCall.ttl                        \
 	016-nco_ContactIM.ttl                          \
 	018-nco_PersonContact.ttl                      \
-	020-mlo_GeoPoint.ttl                           \
-	021-mlo_LocationBoundingBox.ttl                \
+	020-slo_GeoLocation.ttl                        \
+	021-slo_Landmark.ttl                           \
+	026-mlo_GeoPoint.ttl                           \
+	027-mlo_LocationBoundingBox.ttl                \
 	028-mlo_GeoLocation.ttl                        \
 	029-mlo_Landmark.ttl                           \
 	030-nmo_MailAccount.ttl                        \
diff --git a/utils/data-generators/cc/Makefile.am b/utils/data-generators/cc/Makefile.am
index 39607f0..c41494c 100644
--- a/utils/data-generators/cc/Makefile.am
+++ b/utils/data-generators/cc/Makefile.am
@@ -14,6 +14,7 @@ EXTRA_DIST =                                           \
 	nfo.py                                         \
 	nmm.py                                         \
 	nmo.py                                         \
+	slo.py                                         \
 	ontology_prefixes.py                           \
 	tools.py                                       \
 	tracker.py                                     \
diff --git a/utils/data-generators/cc/generate b/utils/data-generators/cc/generate
index 134d3b4..03bfc57 100755
--- a/utils/data-generators/cc/generate
+++ b/utils/data-generators/cc/generate
@@ -19,6 +19,7 @@ import mfo
 import mto
 import nmo
 import mlo
+import slo
 import tracker
 
 def recent_enough_python ():
@@ -66,8 +67,10 @@ 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 )
+tools.addType( 'slo#GeoLocation', 20 )
+tools.addType( 'slo#Landmark', 21 )
+tools.addType( 'mlo#GeoPoint', 26 )
+tools.addType( 'mlo#LocationBoundingBox', 27 )
 tools.addType( 'mlo#GeoLocation', 28 )
 tools.addType( 'mlo#Landmark', 29 )
 tools.addType( 'nmo#MailAccount', 30 )
@@ -120,6 +123,13 @@ for location in xrange(1, count_locations+1):
   if (location % 10 == 0):
     sys.stdout.write('.')
     sys.stdout.flush()
+  slo.generateGeoLocation( location )
+  slo.generateLandmark( location )
+count_locations = get_counter('counts','locations')
+for location in xrange(1, count_locations+1):
+  if (location % 10 == 0):
+    sys.stdout.write('.')
+    sys.stdout.flush()
   mlo.generateGeoPoint( location )
   mlo.generateLocationBoundingBox( location )
   mlo.generateGeoLocation( location )
diff --git a/utils/data-generators/cc/ontology_prefixes.py b/utils/data-generators/cc/ontology_prefixes.py
index 94862fa..1e0294b 100644
--- a/utils/data-generators/cc/ontology_prefixes.py
+++ b/utils/data-generators/cc/ontology_prefixes.py
@@ -17,5 +17,6 @@ ontology_prefixes = """
 @prefix mfo:     <http://www.tracker-project.org/temp/mfo#> .
 @prefix mto:     <http://www.tracker-project.org/temp/mto#> .
 @prefix mlo:     <http://www.tracker-project.org/temp/mlo#> .
+ prefix slo:     <http://www.tracker-project.org/temp/slo#> .
 """
 
diff --git a/utils/data-generators/cc/slo.py b/utils/data-generators/cc/slo.py
new file mode 100644
index 0000000..d6e197b
--- /dev/null
+++ b/utils/data-generators/cc/slo.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+
+import tools
+import gen_data as gen
+
+####################################################################################
+slo_GeoLocation = '''
+<%(geolocation_uri)s> a slo:GeoLocation;
+  %(geolocation_saveas)s
+  slo:altitude                  "%(geolocation_altitude)s" ;
+  nie:comment                   "%(geolocation_comment)s" .
+'''
+
+slo_GeoLocation_saveas_point         = '''
+  slo:longitude                 "%(geolocation_longitude)s" ;
+  slo:latitude                  "%(geolocation_latitude)s" ;
+  slo:horizontalAccuracy        "%(geolocation_hacc)s" ;
+  slo:verticalAccuracy          "%(geolocation_vacc)s" ;
+  slo:radius                    "%(geolocation_radius)s" ;
+'''
+
+slo_GeoLocation_saveas_boundingbox   = '''
+  slo:boundingLongitudeMax      "%(geolocation_longitudemax)s" ;
+  slo:boundingLongitudeMin      "%(geolocation_longitudemin)s" ;
+  slo:boundingLatitudeMax       "%(geolocation_latitudemax)s" ;
+  slo:boundingLatitudeMin       "%(geolocation_latitudemin)s" ;
+'''
+
+slo_GeoLocation_saveas_postaladdress = '''
+  slo:postalAddress             <%(geolocation_postaladdress)s> ;
+
+'''
+
+def generateGeoLocation(index):
+  me = 'slo#GeoLocation'
+  geolocation_uri                     = 'urn:slogeoloc:%d' % index
+  geolocation_comment                 = 'Comment geolocation %d' % index
+  geolocation_altitude                = '%f' % (index % 1000)
+
+  geolocation_latitude                = '%f' % (((index % 360) - 180)/2.0)
+  geolocation_longitude               = '%f' % ((index % 720)/4.0)
+  geolocation_hacc                    = '3'
+  geolocation_vacc                    = '3'
+  geolocation_radius                  = '10'
+
+  geolocation_latitudemax             = '%f' % (((index % 700) - 340)/4.0)
+  geolocation_latitudemin             = '%f' % (((index % 700) - 350)/4.0)
+  geolocation_longitudemax            = '%f' % (((index % 350) + 10) /2.0)
+  geolocation_longitudemin            = '%f' % (((index % 350))/2.0)
+
+  geolocation_postaladdress           = tools.getRandomUri( 'nco#PostalAddress' )
+
+  geolocation_saveas                  = (slo_GeoLocation_saveas_boundingbox % locals(),slo_GeoLocation_saveas_point % locals(),slo_GeoLocation_saveas_postaladdress % locals()) [ index %3 ]
+
+  tools.addItem( me, geolocation_uri, slo_GeoLocation % locals() )
+
+####################################################################################
+slo_Landmark = '''
+<%(landmark_uri)s> a slo:Landmark ;
+  nie:title              "%(landmark_title)s" ;
+  nie:description        "%(landmark_description)s" ;
+  slo:location           <%(landmark_location)s> .
+
+'''
+def generateLandmark(index):
+  me = 'slo#Landmark'
+  landmark_uri             = 'urn:slolandmark:%d' % index
+  landmark_title           = 'Landmark %d' % index
+  landmark_description     = 'Landmark %d description' % index
+  landmark_location        = tools.getLastUri( 'slo#GeoLocation' )
+
+  tools.addItem( me, landmark_uri, slo_Landmark % locals() )
+



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