summaryrefslogtreecommitdiff
path: root/utils/data-generators/cc/slo.py
blob: d6e197bbd88653b8818731ad9c3ca58350ef6076 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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() )