[tracker/crawling-interval] Added updated location-related performance queries.
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/crawling-interval] Added updated location-related performance queries.
- Date: Tue, 1 Jun 2010 15:19:51 +0000 (UTC)
commit 3676865b2335f20d4bb6ee7897fad0fcbfa0326e
Author: Mikael Ottela <mikael ottela ixonos com>
Date: Thu Apr 29 06:06:11 2010 +0300
Added updated location-related performance queries.
Added queries and added support to the data-generators. Added appropriate indices.
data/ontologies/40-mlo.ontology | 5 +-
data/ontologies/Indices.list | 5 +
tests/functional-tests/performance-tc.py | 519 +++++++++++++++++++++++++
utils/data-generators/cc/default.cfg | 3 +
utils/data-generators/cc/generate | 21 +-
utils/data-generators/cc/max.cfg | 3 +
utils/data-generators/cc/mlo.py | 95 +++++
utils/data-generators/cc/ontology_prefixes.py | 1 +
8 files changed, 649 insertions(+), 3 deletions(-)
---
diff --git a/data/ontologies/40-mlo.ontology b/data/ontologies/40-mlo.ontology
index a77aa05..6bad5c4 100644
--- a/data/ontologies/40-mlo.ontology
+++ b/data/ontologies/40-mlo.ontology
@@ -10,7 +10,7 @@
mlo: a tracker:Namespace, tracker:Ontology ;
tracker:prefix "mlo" ;
- nao:lastModified "2010-02-16T11:00:00Z" .
+ nao:lastModified "2010-04-28T11:00:00Z" .
mlo:GeoLocation a rdfs:Class ;
rdfs:label "Location" ;
@@ -177,18 +177,21 @@ mlo:location a rdf:Property ;
mlo:asBoundingBox a rdf:Property ;
rdfs:label "As bounding box" ;
rdfs:comment "Representation of the location as bounding box" ;
+ tracker:indexed true ;
rdfs:domain mlo:GeoLocation ;
rdfs:range mlo:GeoBoundingBox .
mlo:asGeoPoint a rdf:Property ;
rdfs:label "As geo point" ;
rdfs:comment "Representation of the location as geo point" ;
+ tracker:indexed true ;
rdfs:domain mlo:GeoLocation ;
rdfs:range mlo:GeoPoint .
mlo:asPostalAddress a rdf:Property ;
rdfs:label "As postal address" ;
rdfs:comment "Representation of the location as text address" ;
+ tracker:indexed true ;
rdfs:domain mlo:GeoLocation ;
rdfs:range nco:PostalAddress .
diff --git a/data/ontologies/Indices.list b/data/ontologies/Indices.list
index d4ca401..9e8f0d4 100644
--- a/data/ontologies/Indices.list
+++ b/data/ontologies/Indices.list
@@ -70,3 +70,8 @@
40-mlo:
* mlo:location:
- Used for retrieving all content in some specific location
+
+* mlo:asPostalAddress:
+* mlo:asBoundingBox:
+* mlo:asGeoPoint:
+ - For matching location into coordinates
diff --git a/tests/functional-tests/performance-tc.py b/tests/functional-tests/performance-tc.py
index 9da88d6..6b8c9e0 100644
--- a/tests/functional-tests/performance-tc.py
+++ b/tests/functional-tests/performance-tc.py
@@ -1881,6 +1881,525 @@ ORDER BY ?_contact LIMIT 50 \
print "Time taken to get 50 contacts phone number information (modified) %s " %elapse
print "no. of items retrieved: %d" %len(result)
+class location (TestUpdate) :
+
+ def p_test_location_01 (self):
+ query = " \
+SELECT \
+ ?urn \
+ ?cLat ?cLon ?cAlt ?cRad \
+ ?nwLat ?nwLon ?nwAlt \
+ ?seLat ?seLon ?seAlt \
+ ?country ?district ?city ?street ?postalcode \
+ nie:title(?urn) \
+ nie:description(?urn) \
+ mlo:belongsToCategory(?urn) \
+WHERE { \
+ ?urn a mlo:Landmark . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asPostalAddress \
+ [ \
+ a nco:PostalAddress ; \
+ nco:country ?country ; \
+ nco:region ?district ; \
+ nco:locality ?city ; \
+ nco:streetAddress ?street ; \
+ nco:postalcode ?postalcode \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asBoundingBox \
+ [ \
+ a mlo:GeoBoundingBox ; \
+ mlo:bbNorthWest \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?nwLat ; \
+ mlo:longitude ?nwLon ; \
+ mlo:altitude ?nwAlt \
+ ] ; \
+ mlo:bbSouthEast \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?seLat ; \
+ mlo:longitude ?seLon ; \
+ mlo:altitude ?seAlt \
+ ] \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?cLat ; \
+ mlo:longitude ?cLon \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:altitude ?cAlt \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:radius ?cRad \
+ ] \
+ ] \
+ } \
+} ORDER BY ASC(?name) LIMIT 50 \
+"
+
+ start=time.time()
+
+ result=self.resources.SparqlQuery(query)
+
+ elapse =time.time()-start
+ print "Time taken to get 50 landmarks (original) %s " %elapse
+ print "no. of items retrieved: %d" %len(result)
+
+ def p_test_location_02 (self):
+ query = " \
+SELECT \
+ ?urn \
+ ?cLat ?cLon ?cAlt ?cRad \
+ ?nwLat ?nwLon ?nwAlt \
+ ?seLat ?seLon ?seAlt \
+ ?country ?district ?city ?street ?postalcode \
+ nie:title(?urn) \
+ nie:description(?urn) \
+ mlo:belongsToCategory(?urn) \
+WHERE { \
+ ?urn a mlo:Landmark . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asPostalAddress \
+ [ \
+ a nco:PostalAddress ; \
+ nco:country ?country ; \
+ nco:region ?district ; \
+ nco:locality ?city ; \
+ nco:streetAddress ?street ; \
+ nco:postalcode ?postalcode \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asBoundingBox \
+ [ \
+ a mlo:GeoBoundingBox ; \
+ mlo:bbNorthWest \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?nwLat ; \
+ mlo:longitude ?nwLon ; \
+ mlo:altitude ?nwAlt \
+ ] ; \
+ mlo:bbSouthEast \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?seLat ; \
+ mlo:longitude ?seLon ; \
+ mlo:altitude ?seAlt \
+ ] \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?cLat ; \
+ mlo:longitude ?cLon \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:altitude ?cAlt \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:radius ?cRad \
+ ] \
+ ] \
+ } \
+ FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && ?cLon >= 63.94 && ?cLon <= 64.96) \
+} ORDER BY ASC(?name) LIMIT \
+"
+
+ start=time.time()
+
+ result=self.resources.SparqlQuery(query)
+
+ elapse =time.time()-start
+ print "Time taken to get 50 landmarks within coords (original) %s " %elapse
+ print "no. of items retrieved: %d" %len(result)
+
+
+ def p_test_location_03 (self):
+ query = " \
+SELECT \
+ ?urn \
+ ?cLat ?cLon ?cAlt ?cRad \
+ ?nwLat ?nwLon ?nwAlt \
+ ?seLat ?seLon ?seAlt \
+ ?country ?district ?city ?street ?postalcode \
+ nie:title(?urn) \
+ nie:description(?urn) \
+ mlo:belongsToCategory(?urn) \
+ tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
+WHERE { \
+ ?urn a mlo:Landmark . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asPostalAddress \
+ [ \
+ a nco:PostalAddress ; \
+ nco:country ?country ; \
+ nco:region ?district ; \
+ nco:locality ?city ; \
+ nco:streetAddress ?street ; \
+ nco:postalcode ?postalcode \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asBoundingBox \
+ [ \
+ a mlo:GeoBoundingBox ; \
+ mlo:bbNorthWest \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?nwLat ; \
+ mlo:longitude ?nwLon ; \
+ mlo:altitude ?nwAlt \
+ ] ; \
+ mlo:bbSouthEast \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?seLat ; \
+ mlo:longitude ?seLon ; \
+ mlo:altitude ?seAlt \
+ ] \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?cLat ; \
+ mlo:longitude ?cLon \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:altitude ?cAlt \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:radius ?cRad \
+ ] \
+ ] \
+ } \
+ FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && \
+ ?cLon >= 63.94 && ?cLon <= 64.96 && \
+ tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
+} ORDER BY ASC(?distance) LIMIT 50 \
+"
+ start=time.time()
+
+ result=self.resources.SparqlQuery(query)
+
+ elapse =time.time()-start
+ print "Time taken to get max 50 landmarks within certain range with bounding box (original) %s " %elapse
+ print "no. of items retrieved: %d" %len(result)
+
+
+ def p_test_location_04 (self):
+ query = " \
+SELECT \
+ ?urn \
+ ?cLat ?cLon ?cAlt ?cRad \
+ ?nwLat ?nwLon ?nwAlt \
+ ?seLat ?seLon ?seAlt \
+ ?country ?district ?city ?street ?postalcode \
+ nie:title(?urn) \
+ nie:description(?urn) \
+ mlo:belongsToCategory(?urn) \
+ tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
+WHERE { \
+ ?urn a mlo:Landmark . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asPostalAddress \
+ [ \
+ a nco:PostalAddress ; \
+ nco:country ?country ; \
+ nco:region ?district ; \
+ nco:locality ?city ; \
+ nco:streetAddress ?street ; \
+ nco:postalcode ?postalcode \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asBoundingBox \
+ [ \
+ a mlo:GeoBoundingBox ; \
+ mlo:bbNorthWest \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?nwLat ; \
+ mlo:longitude ?nwLon ; \
+ mlo:altitude ?nwAlt \
+ ] ; \
+ mlo:bbSouthEast \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?seLat ; \
+ mlo:longitude ?seLon ; \
+ mlo:altitude ?seAlt \
+ ] \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:latitude ?cLat ; \
+ mlo:longitude ?cLon \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:altitude ?cAlt \
+ ] \
+ ] \
+ } . \
+ OPTIONAL \
+ { \
+ ?urn mlo:location \
+ [ \
+ a mlo:GeoLocation ; \
+ mlo:asGeoPoint \
+ [ \
+ a mlo:GeoPoint ; \
+ mlo:radius ?cRad \
+ ] \
+ ] \
+ } \
+ FILTER(tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
+} ORDER BY ASC(?distance) LIMIT 50 \
+"
+ start=time.time()
+
+ result=self.resources.SparqlQuery(query)
+
+ elapse =time.time()-start
+ print "Time taken to get max 50 landmarks within certain range without bounding box (original) %s " %elapse
+ print "no. of items retrieved: %d" %len(result)
+
+ def p_test_location_05 (self):
+ query = " \
+SELECT \
+ ?urn \
+ mlo:latitude(?point) mlo:longitude(?point) mlo:altitude(?point) mlo:radius(?point) \
+ nie:title(?urn) \
+ nie:description(?urn) \
+ mlo:belongsToCategory(?urn) \
+WHERE { \
+ ?urn a mlo:Landmark . \
+ ?urn mlo:location ?location . \
+ ?location mlo:asGeoPoint ?point . \
+} ORDER BY ASC(?name) LIMIT 50 \
+"
+ start=time.time()
+
+ result=self.resources.SparqlQuery(query)
+
+ elapse =time.time()-start
+ print "Time taken to get 50 landmarks (simplified) %s " %elapse
+ print "no. of items retrieved: %d" %len(result)
+
+
+ def p_test_location_06 (self):
+ query = " \
+SELECT \
+ ?urn \
+ ?cLat ?cLon mlo:altitude(?point) mlo:radius(?point) \
+ nie:title(?urn) \
+ nie:description(?urn) \
+ mlo:belongsToCategory(?urn) \
+WHERE { \
+ ?urn a mlo:Landmark . \
+ ?urn mlo:location ?location . \
+ ?location mlo:asGeoPoint ?point . \
+ ?point mlo:latitude ?cLat . \
+ ?point mlo:longitude ?cLon . \
+ FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && ?cLon >= 63.42 && ?cLon <= 64.96) \
+} ORDER BY ASC(?name) LIMIT 50 \
+"
+ start=time.time()
+
+ result=self.resources.SparqlQuery(query)
+
+ elapse =time.time()-start
+ print "Time taken to get max 50 landmarks within coords (simplified) %s " %elapse
+ print "no. of items retrieved: %d" %len(result)
+
+ def p_test_location_07 (self):
+ query = " \
+SELECT \
+ ?urn \
+ ?cLat ?cLon mlo:altitude(?point) mlo:radius(?point) \
+ nie:title(?urn) \
+ nie:description(?urn) \
+ mlo:belongsToCategory(?urn) \
+ tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
+WHERE { \
+ ?urn a mlo:Landmark . \
+ ?urn mlo:location ?location . \
+ ?location mlo:asGeoPoint ?point . \
+ ?point mlo:latitude ?cLat . \
+ ?point mlo:longitude ?cLon . \
+ FILTER(?cLat >= 39.16 && ?cLat <= 40.17 && \
+ ?cLon >= 63.94 && ?cLon <= 64.96 && \
+ tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
+} ORDER BY ASC(?distance) LIMIT 50 \
+"
+ start=time.time()
+
+ result=self.resources.SparqlQuery(query)
+
+ elapse =time.time()-start
+ print "Time taken to get max 50 landmarks within range with bounding box (simplified) %s " %elapse
+ print "no. of items retrieved: %d" %len(result)
+
+ def p_test_location_08 (self):
+ query = " \
+SELECT \
+ ?urn \
+ ?cLat ?cLon mlo:altitude(?point) mlo:radius(?point) \
+ nie:title(?urn) \
+ nie:description(?urn) \
+ mlo:belongsToCategory(?urn) \
+ tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) as ?distance \
+WHERE { \
+ ?urn a mlo:Landmark . \
+ ?urn mlo:location ?location . \
+ ?location mlo:asGeoPoint ?point . \
+ ?point mlo:latitude ?cLat . \
+ ?point mlo:longitude ?cLon . \
+ FILTER(tracker:haversine-distance(xsd:double(?cLat),xsd:double(39.50),xsd:double(?cLon),xsd:double(64.50)) <= 25000) \
+} ORDER BY ASC(?distance) LIMIT 50 \
+"
+ start=time.time()
+
+ result=self.resources.SparqlQuery(query)
+
+ elapse =time.time()-start
+ print "Time taken to get max 50 landmarks within range without bounding box (simplified) %s " %elapse
+ print "no. of items retrieved: %d" %len(result)
+
if __name__ == "__main__":
unittest.main()
diff --git a/utils/data-generators/cc/default.cfg b/utils/data-generators/cc/default.cfg
index 23ea993..1ee1e50 100644
--- a/utils/data-generators/cc/default.cfg
+++ b/utils/data-generators/cc/default.cfg
@@ -5,6 +5,9 @@
# Contacts
contacts : 1000
+# Locations
+locations : 1000
+
# Emails
accounts : 5
folders : 2
diff --git a/utils/data-generators/cc/generate b/utils/data-generators/cc/generate
index 92ab7a4..99e3ce0 100755
--- a/utils/data-generators/cc/generate
+++ b/utils/data-generators/cc/generate
@@ -17,6 +17,7 @@ import nfo
import mfo
import mto
import nmo
+import mlo
import tracker
@@ -39,8 +40,10 @@ tools.addType( 'nco#PostalAddress', 11 )
tools.addType( 'nco#PhoneNumber', 12 )
tools.addType( 'nco#IMAddress', 13 )
tools.addType( 'nco#PersonContact', 18 )
-tools.addType( 'nmm#Photo', 20 )
-tools.addType( 'nmm#Video', 21 )
+tools.addType( 'mlo#GeoPoint', 20 )
+tools.addType( 'mlo#LocationBoundingBox', 21 )
+tools.addType( 'mlo#GeoLocation', 28 )
+tools.addType( 'mlo#Landmark', 29 )
tools.addType( 'nmo#MailAccount', 30 )
tools.addType( 'nmo#MailFolder', 31 )
tools.addType( 'nmo#Email', 32 )
@@ -51,6 +54,8 @@ tools.addType( 'nmo#Call', 38 )
tools.addType( 'nmm#Artist', 40 )
tools.addType( 'nmm#MusicAlbum', 41 )
tools.addType( 'nmm#MusicPiece', 42 )
+tools.addType( 'nmm#Photo', 45 )
+tools.addType( 'nmm#Video', 46 )
tools.addType( 'tracker#Volume', 50 )
tools.addType( 'nfo#PlainTextDocument', 51 )
tools.addType( 'nfo#SoftwareCategory', 60 )
@@ -78,6 +83,18 @@ for contact in xrange(1, count_contacts+1):
nco.generatePersonContact( contact )
print "Done"
+print "Generating Locations and landmarks",
+count_locations = config.getint('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 )
+ mlo.generateLandmark( location )
+print "Done"
+
print "Generate Emails",
count_accounts = config.getint('counts','accounts')
count_folders = config.getint('counts','folders')
diff --git a/utils/data-generators/cc/max.cfg b/utils/data-generators/cc/max.cfg
index 9500edc..e15f311 100644
--- a/utils/data-generators/cc/max.cfg
+++ b/utils/data-generators/cc/max.cfg
@@ -5,6 +5,9 @@
# Contacts
contacts : 1000
+# Locations
+locations : 10000
+
# Emails
accounts : 5
folders : 2
diff --git a/utils/data-generators/cc/mlo.py b/utils/data-generators/cc/mlo.py
new file mode 100644
index 0000000..1bf9a77
--- /dev/null
+++ b/utils/data-generators/cc/mlo.py
@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+
+import tools
+import gen_data as gen
+
+####################################################################################
+mlo_GeoPoint = '''
+<%(geopoint_uri)s> a mlo:GeoPoint ;
+ mlo:latitude "%(geopoint_latitude)s" ;
+ mlo:longitude "%(geopoint_longitude)s" ;
+ mlo:altitude "%(geopoint_altitude)s" .
+'''
+def generateGeoPoint(index):
+ me = 'mlo#GeoPoint'
+ geopoint_uri = 'urn:geopoint:%d' % index
+ geopoint_latitude = '%f' % (((index % 360) - 180)/2.0)
+ geopoint_longitude = '%f' % ((index % 720)/4.0)
+ geopoint_altitude = '%f' % (index % 1000)
+
+ tools.addItem( me, geopoint_uri, mlo_GeoPoint % locals() )
+
+####################################################################################
+mlo_LocationBoundingBox = '''
+<%(boundingbox_geopoint_se_uri)s> a mlo:GeoPoint ;
+ mlo:latitude "%(boundingbox_geopoint_se_latitude)s" ;
+ mlo:longitude "%(boundingbox_geopoint_se_longitude)s" ;
+ mlo:altitude "%(boundingbox_geopoint_se_altitude)s" .
+
+<%(boundingbox_geopoint_nw_uri)s> a mlo:GeoPoint ;
+ mlo:latitude "%(boundingbox_geopoint_nw_latitude)s" ;
+ mlo:longitude "%(boundingbox_geopoint_nw_longitude)s" ;
+ mlo:altitude "%(boundingbox_geopoint_nw_altitude)s" .
+
+<%(boundingbox_uri)s> a mlo:LocationBoundingBox ;
+ mlo:bbSouthEast <%(boundingbox_geopoint_se_uri)s> ;
+ mlo:bbNorthWest <%(boundingbox_geopoint_nw_uri)s> .
+'''
+def generateLocationBoundingBox(index):
+ me = 'mlo#LocationBoundingBox'
+ boundingbox_uri = 'urn:boundingbox:%d' % index
+
+ boundingbox_geopoint_se_uri = 'urn:boundingbox:se:%d' % index
+ boundingbox_geopoint_se_latitude = '%f' % (((index % 700) - 350)/4.0)
+ boundingbox_geopoint_se_longitude = '%f' % (((index % 350) + 10) /2.0)
+ boundingbox_geopoint_se_altitude = '%f' % (index % 1000)
+
+ boundingbox_geopoint_nw_uri = 'urn:boundingbox:nw:%d' % index
+ boundingbox_geopoint_nw_latitude = '%f' % (((index % 700) - 340)/4.0)
+ boundingbox_geopoint_nw_longitude = '%f' % (((index % 350))/2.0)
+ boundingbox_geopoint_nw_altitude = '%f' % (index % 1000)
+
+ tools.addItem( me, boundingbox_uri, mlo_LocationBoundingBox % locals() )
+
+####################################################################################
+mlo_GeoLocation = '''
+<%(geolocation_uri)s> a mlo:GeoLocation;
+ %(geolocation_saveas)s ;
+ nie:comment "%(geolocation_comment)s" .
+'''
+mlo_GeoLocation_saveas_geopoint = '''mlo:asGeoPoint <%(geolocation_geopoint)s>'''
+mlo_GeoLocation_saveas_boundingbox = '''mlo:asBoundingBox <%(geolocation_boundingbox)s>'''
+mlo_GeoLocation_saveas_postaladdress = '''mlo:asPostalAddress <%(geolocation_postaladdress)s>'''
+
+def generateGeoLocation(index):
+ me = 'mlo#GeoLocation'
+ geolocation_uri = 'urn:geolocation:%d' % index
+
+ geolocation_geopoint = tools.getLastUri( 'mlo#GeoPoint' )
+ geolocation_boundingbox = tools.getLastUri( 'mlo#LocationBoundingBox' )
+ geolocation_postaladdress = tools.getRandomUri( 'nco#PostalAddress' )
+
+ geolocation_saveas = (mlo_GeoLocation_saveas_boundingbox % locals(), mlo_GeoLocation_saveas_geopoint % locals(), mlo_GeoLocation_saveas_postaladdress % locals()) [ index %3 ]
+
+ geolocation_comment = 'geolocation %d' % index
+
+ tools.addItem( me, geolocation_uri, mlo_GeoLocation % locals() )
+
+
+####################################################################################
+mlo_Landmark = '''
+<%(landmark_uri)s> a mlo:Landmark ;
+ nie:title "%(landmark_title)s" ;
+ nie:description "%(landmark_description)s" ;
+ mlo:location <%(landmark_location)s> .
+
+'''
+def generateLandmark(index):
+ me = 'mlo#Landmark'
+ landmark_uri = 'urn:landmark:%d' % index
+ landmark_title = 'Landmark %d' % index
+ landmark_description = 'Landmark %d description' % index
+ landmark_location = tools.getLastUri( 'mlo#GeoLocation' )
+
+ tools.addItem( me, landmark_uri, mlo_Landmark % locals() )
+
diff --git a/utils/data-generators/cc/ontology_prefixes.py b/utils/data-generators/cc/ontology_prefixes.py
index 38dbbbb..94862fa 100644
--- a/utils/data-generators/cc/ontology_prefixes.py
+++ b/utils/data-generators/cc/ontology_prefixes.py
@@ -16,5 +16,6 @@ ontology_prefixes = """
@prefix tracker: <http://www.tracker-project.org/ontologies/tracker#>.
@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#> .
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]