From 1a3c9995fb61a2459b4b0adcfcdbb0b76609899f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Bernard?= <stephan.bernard@irstea.fr> Date: Tue, 13 Aug 2019 11:03:31 +0200 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20de=20la=20branche=20weather2017?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 45 +++- {weather2017/py => py}/README.md | 22 +- {weather2017/py => py}/insertWeatherData.py | 0 {weather2017/py => py}/iwd_config.py | 0 {weather2017/py => py}/iwd_functions.py | 0 {weather2017/py => py}/sparqlDropAll.py | 0 ...tions.sparql => weather-definitions.sparql | 0 weather2017/README.md | 36 --- weather2018/README.md | 22 -- weather2018/py/README.md | 41 --- weather2018/py/p2r_config.py | 147 ----------- weather2018/py/p2r_functions.py | 237 ------------------ weather2018/py/pg2rdf.py | 82 ------ weather2018/py/updateTemporal.py | 40 --- weather2018/weather2018-definitions.sparql | 190 -------------- weather2018/weather2018-resource.sparql | 223 ---------------- 16 files changed, 57 insertions(+), 1028 deletions(-) rename {weather2017/py => py}/README.md (78%) rename {weather2017/py => py}/insertWeatherData.py (100%) rename {weather2017/py => py}/iwd_config.py (100%) rename {weather2017/py => py}/iwd_functions.py (100%) rename {weather2017/py => py}/sparqlDropAll.py (100%) rename weather2017/weather-definitions.sparql => weather-definitions.sparql (100%) delete mode 100644 weather2017/README.md delete mode 100644 weather2018/README.md delete mode 100644 weather2018/py/README.md delete mode 100644 weather2018/py/p2r_config.py delete mode 100644 weather2018/py/p2r_functions.py delete mode 100644 weather2018/py/pg2rdf.py delete mode 100644 weather2018/py/updateTemporal.py delete mode 100644 weather2018/weather2018-definitions.sparql delete mode 100644 weather2018/weather2018-resource.sparql diff --git a/README.md b/README.md index 9079f78..6f5a4d8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,48 @@ +# GitLab weather2017 The repertory weather2017 is about the transformation process from CSV files. The dataset contains weather measurements from August 2017 to December 2017. -The repertory weather2018 is about the transformation process from the PostgreSQL table wdonnees. -This dataset contains weather measurements from August 2018 up to now. +## Files +### society.ttl +#### *en* +Contains definitions about IRSTEA institute, as its localizations with addresses +and some peaple working in. -Society.ttl contains the definition of individuals that are generic: Orgnization, Person, Location. +`society*.ttl` has its own namespace : `<http://ontology.irstea.fr/society/>`. +For now, it only contains object used in our datasets : + +- Clermont-Ferrand and Montoldre IRSTEA centers, +- Catherine and Stéphan, who are authors of the datasets. + +#### *fr* +Contient des définitions propres à l'irstea (institut, centres avec leurs +adresses, …), et aussi quelques agents. + +Les données `society*.ttl` on leur propre namespace +(`<http://ontology.irstea.fr/society/>`). + +Pour le moment ne contient que les objets utilisés dans d'autres datasets +(centres de Clermont — Aubière et Montoldre — ainsi que Catherine et Stéphan +— auteurs). + +### weather-definitions.sparql +#### *en* +Definitions used in the dataset : + +- weather station description, +- sensors descriptions, +- feature of interest instances, +- ... and more. + +#### *fr* +Contient des définitions utilisées dans le dataset weather2017 : + +- description de la station météo, +- description des différents capteurs, +- instanciation des features of interest, +- … + +### py/ +Python sources. diff --git a/weather2017/py/README.md b/py/README.md similarity index 78% rename from weather2017/py/README.md rename to py/README.md index 652f76f..cdbe37b 100644 --- a/weather2017/py/README.md +++ b/py/README.md @@ -13,25 +13,33 @@ Contient des sources python. # insertWeatherData.py ## TODO + - Beaucoup de nettoyage. - Clarifier les préfixes de chaque élément. Actuellement, seul le BASE_PREFIX est renseigné, les autres sont directement renseignés dans les chaînes de caractères à l'intérieur des fonctions (néanmoins basés sur ce BASE_PREFIX). - Il serait intéressant de se baser sur un dictionnaire - prédicat/préfixe/élément. À creuser. + Il serait intéressant de se baser sur un dictionnaire + prédicat/préfixe/élément. À creuser. + - Les paramètres \*SPARQL\* dans config ne sont pas clairs. Le besoin est - - plusieurs petites requêtes INSERT si on est en TDB1, - - une seule requête INSERT si on est en TDB2, - - autre chose dans un autre cas ? (genre un gros fichier turtle) - Remarque : en TDB1 il faut envoyer les requêtes au serveur alors qu'en TDB2 - il faut créer un fichier. + * plusieurs petites requêtes INSERT si on est en TDB1, + * une seule requête INSERT si on est en TDB2, + * autre chose dans un autre cas ? (genre un gros fichier turtle) + +Remarque : en TDB1 il faut envoyer les requêtes au serveur, alors qu'en TDB2 +il faut créer un fichier. Il y a eu des gros mélanges entre les besoins +petits/gros INSERTS et turtle/sparql. Le code actuel fait mal ces deux +distinctions et nécessite des corrections dès qu'il faut passer d'un mode +à un autre. **Un nettoyage s'impose.** + ## Utilisation Avant de l'utiliser, éditer le fichier `iwd_config.py`. Il permet notamment : + - de choisir le mode de fonctionnement (création de fichier SPARQL ou envoi des requêtes directement), - de donner l'URL pour accéder au triplestore, diff --git a/weather2017/py/insertWeatherData.py b/py/insertWeatherData.py similarity index 100% rename from weather2017/py/insertWeatherData.py rename to py/insertWeatherData.py diff --git a/weather2017/py/iwd_config.py b/py/iwd_config.py similarity index 100% rename from weather2017/py/iwd_config.py rename to py/iwd_config.py diff --git a/weather2017/py/iwd_functions.py b/py/iwd_functions.py similarity index 100% rename from weather2017/py/iwd_functions.py rename to py/iwd_functions.py diff --git a/weather2017/py/sparqlDropAll.py b/py/sparqlDropAll.py similarity index 100% rename from weather2017/py/sparqlDropAll.py rename to py/sparqlDropAll.py diff --git a/weather2017/weather-definitions.sparql b/weather-definitions.sparql similarity index 100% rename from weather2017/weather-definitions.sparql rename to weather-definitions.sparql diff --git a/weather2017/README.md b/weather2017/README.md deleted file mode 100644 index 4c47da0..0000000 --- a/weather2017/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# GitLab weather2017 - -Fichiers et codes pour alimenter le triplestore -`<http://ontology.irstea.fr/weather2017/>`. - -À évolué vers `<http://ontology.irstea.fr/weather2018/>`, -mis à jour quotidiennement à partir des données de la BD -postgresql mise en place pour OPEROSE. - -## Fichiers de données -### Weather2017 -#### society.ttl -Contient des définitions propres à l'irstea (institut, centres avec leurs -adresses, …), et aussi des agents. - -Les données `society*.ttl` on leur propre namespace -(`<http://ontology.irstea.fr/society/>`). - -Pour le moment ne contient que les objets utilisés dans d'autres datasets -(centres de Clermont — Aubière et Montoldre — ainsi que Catherine et Stéphan -— auteurs). - -#### society-2018-12.ttl -C'est une copie de society.ttl de décembre 2018. Ceci permet de garder un lien -vers des éléments dont la définition pourrait être amenée à évoluer. - -#### weather-definitions.sparql -Contient des définitions utilisées dans le dataset weather2017 : -- description de la station météo, -- description des différents capteurs, -- instanciation des features of interest, -- … - -#### py/ - -Codes python diff --git a/weather2018/README.md b/weather2018/README.md deleted file mode 100644 index e259d40..0000000 --- a/weather2018/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# GitLab weather2017 - -Fichiers et codes pour alimenter le triplestore -`<http://ontology.irstea.fr/weather2017/>`. - -À évolué vers `<http://ontology.irstea.fr/weather2018/>`, -mis à jour quotidiennement à partir des données de la BD -postgresql mise en place pour OPEROSE. - - -### Weather2018 -Weather 2018 range les données dans un GRAPH par année. Il y a aussi un graphe -pour les métadonnées et un pour les resource. - -#### weather2018-definitions.sparql -Les métadonnées du dataset - -#### weather2018-resource.sparql -- description de la station météo, -- description des différents capteurs, -- instanciation des features of interest, -- … diff --git a/weather2018/py/README.md b/weather2018/py/README.md deleted file mode 100644 index 3cc7ede..0000000 --- a/weather2018/py/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Répertoire py/ -## pg2rdf.py - -Dans le cadre du projet OPEROSE, les données de la station météo sont stockées -jour par jour dans un BD relationnelle de type postgresql. -**pg2rdf** vise à être lancé une fois par jour (dans une tâche cron) -pour alimenter le triplestore. - -Le code de pg2rdf reprend celui de insertWeatherData, et principalement -celui de iwd_functions. Il aurait pû directement en appeler les fonctions, -mais les errements dûs au jonglage avec les différentes manières d'aborder -les triplestore en ont fait quelque chose d'instable et mal ficelé -(requêtes INSERT DATA pour chaque ligne du fichier csv afin d'éviter -les débordements mémoire d'une trop grosse requête INSERT, modifiées -en fichier turtle pour tester les fichiers TDB2 qui grossissent -exponentiellement avec le nombre de requêtes insert et qui acceptent en -revanche très bien les gros fichiers turtle, mais retour en arrière, …). -Au final, la version *actuelle* de insertWeatherData renvoie du pseudo-ttl -ou du pseudo-sparql selon les paramètres choisis, mais jamais du code -super propre. Du coup, l'écriture de pg2rdf est l'occasion de remettre -un peu tout ça au propre par réécriture. - -Les fichiers relatifs à pg2rdf sont préfixés **p2r_**. - -## Mise en Å“uvre -### La première fois - # Après avoir vidé le dataset - - $JENA_HOME/bin/s-update \ - --service 'http://cfs-sparql.clermont.cemagref.fr:3030/weather/update' \ - --update ../weather2018-definitions.sparql - - $JENA_HOME/bin/s-update \ - --service 'http://cfs-sparql.clermont.cemagref.fr:3030/weather/update' \ - --update ../weather2018-resource.sparql - -### Pour mettre à jour les données - #### À exécuter sur cfs-sparql - cd /home/administrateur/meteo/py - python3 pg2rdf.py - python3 updateTemporal.py diff --git a/weather2018/py/p2r_config.py b/weather2018/py/p2r_config.py deleted file mode 100644 index 49db890..0000000 --- a/weather2018/py/p2r_config.py +++ /dev/null @@ -1,147 +0,0 @@ - -WRITE_TO_TRIPLESTORE = True # If False, writes ttl to standard output -QUIET = False # If True, should be silent (only errors are reported). - -SPARQL_QUERY_ENDPOINT = "http://cfs-sparql.clermont.cemagref.fr:3030/weather/query" -SPARQL_UPDATE_ENDPOINT = "http://cfs-sparql.clermont.cemagref.fr:3030/weather/update" - - -PG_HOST = "cfs-capteurs.clermont.irstea.priv" -PG_DATABASE = "weatherlink_db" -PG_USER = "irstea" -#PG_PASSWORD = "xxxxxxx" - - -BASE_PREFIX = 'http://ontology.irstea.fr/weather/resource/' - -# The timezone is the timezone used by the weather station. -TIMEZONE = '+0100' # +0100 = heure d'hiver. 'Europe/Paris' = ajustement auto été/hiver - -OBSERVATION_PREFIX="""prefix sosa: <http://www.w3.org/ns/sosa/> -prefix xsd: <http://www.w3.org/2001/XMLSchema#> -prefix qudt: <http://qudt.org/1.1/schema/qudt#> -prefix qudt_unit: <http://qudt.org/1.1/vocab/unit#> -prefix cdt: <http://w3id.org/lindt/custom_datatypes#> -""" -TIME_PREFIX = """prefix time: <http://www.w3.org/2006/time#> -prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -prefix xsd: <http://www.w3.org/2001/XMLSchema#> -""" - -INTERVAL_MAX = 100 # If duration beween lines > INTERVAL_MAX minutes, - # don't consider it's a valid interval. - - -INDEX_OF = { - 'date': 0, - 'time': 1, - 'temperature': 2, - 'humidity': 5, - 'windSpeed': 7, - 'windDirection': 8, - 'airPressure': 16, - 'rainfallAmount': 17, - 'rainfallRate': 18, - 'solarRadiation': 19 -} - -CONTEXT = { -'temperature': - { 'observedProperty': 'air_temperature', - 'madeBySensor': 'VP2lesPalaquins01_outsideTemperatureSensor01', - 'featureOfInterest': 'air', - 'phenomenonTime': 'instant', - }, -'humidity': - { 'observedProperty': 'air_relativeHumidity', - 'madeBySensor': 'VP2lesPalaquins01_outsideHumiditySensor01', - 'featureOfInterest': 'air', - 'phenomenonTime': 'instant', - }, -'windSpeed': - { 'observedProperty': 'wind_speed', - 'madeBySensor': 'VP2lesPalaquins01_anemometer01', - 'featureOfInterest': 'wind', - 'phenomenonTime': 'interval', - }, -'windDirection': - { 'observedProperty': 'wind_direction', - 'madeBySensor': 'VP2lesPalaquins01_windDirectionSensor01', - 'featureOfInterest': 'wind', - 'phenomenonTime': 'interval', - }, -'airPressure': - { 'observedProperty': 'air_pressure', - 'madeBySensor': 'VP2lesPalaquins01_barometer01', - 'featureOfInterest': 'air', - 'phenomenonTime': 'instant', - }, -'rainfallAmount': - { 'observedProperty': 'precipitation_amount', - 'madeBySensor': 'VP2lesPalaquins01_rainCollectorSensor01', - 'featureOfInterest': 'precipitation', - 'phenomenonTime': 'interval', - }, -'rainfallRate': - { 'observedProperty': 'precipitation_rate', - 'madeBySensor': 'VP2lesPalaquins01_rainCollectorSensor01', - 'featureOfInterest': 'precipitation', - 'phenomenonTime': 'interval', - }, -'solarRadiation': - { 'observedProperty': 'solarFlux_density', - 'madeBySensor': 'VP2lesPalaquins01_solarRadiationSensor01', - 'featureOfInterest': 'solarFlux', - 'phenomenonTime': 'interval', - }, -} - -UNIT = { -'temperature': - { 'unit': 'http://qudt.org/1.1/vocab/unit#DegreeCelsius', - 'unit_txt': 'degreeCelcius', # For sosa:Results naming - 'unit_symbol': 'CEL', 'cdt_type': 'temperature', - }, -'humidity': - { 'unit': 'http://qudt.org/1.1/vocab/unit#Percent', - 'unit_txt': 'percent', - 'unit_symbol' : '%', 'cdt_type': 'ucum', - }, -'windSpeed': - { 'unit': 'http://qudt.org/1.1/vocab/unit#MeterPerSecond', - 'unit_txt': 'meterPerSecond', - 'unit_symbol' : 'm/s', 'cdt_type': 'ucum', - }, -'windDirection': - { 'unit': 'http://qudt.org/1.1/vocab/unit#DegreeAngle', - 'unit_txt': 'degreeAngle', - 'unit_symbol' : 'DEG', 'cdt_type': 'ucum', - }, -'airPressure': - { 'unit': 'http://qudt.org/1.1/vocab/unit#Millibar', - 'unit_txt': 'millibar', - 'unit_symbol' : 'HPAL', 'cdt_type': 'ucum', - }, -'rainfallAmount': - { 'unit': 'http://qudt.org/1.1/vocab/unit#Millimeter', - 'unit_txt': 'millimeter', - 'unit_symbol' : 'mm', 'cdt_type': 'length', - }, -'rainfallRate': - { 'unit': 'http://ontology.irstea.fr/weather2017/resource/unit/MillimeterPerHour', - 'unit_txt': 'millimeterPerHour', - 'unit_symbol' : 'mm/h', 'cdt_type': 'ucum', - }, -'solarRadiation': - { 'unit': 'http://qudt.org/1.1/vocab/unit#WattPerSquareMeter', - 'unit_txt': 'wattPerSquareMeter', - 'unit_symbol' : 'W/m2', 'cdt_type': 'ucum', - }, -} - -WIND_DIRECTIONS = { - 'N': 000.0, 'NNE': 022.5, 'NE': 045.0, 'ENE': 067.5, - 'E': 090.0, 'ESE': 112.5, 'SE': 135.0, 'SSE': 157.5, - 'S': 180.0, 'SSW': 202.5, 'SW': 225.0, 'WSW': 247.5, - 'W': 270.0, 'WNW': 292.5, 'NW': 315.0, 'NNW': 337.5, -} diff --git a/weather2018/py/p2r_functions.py b/weather2018/py/p2r_functions.py deleted file mode 100644 index a6a65c0..0000000 --- a/weather2018/py/p2r_functions.py +++ /dev/null @@ -1,237 +0,0 @@ -import sys -import re -from datetime import datetime -import arrow # For datetime timezones -import requests # HTTP protocol - -from p2r_config import BASE_PREFIX, TIMEZONE -from p2r_config import WIND_DIRECTIONS #, NO_VALUE -from p2r_config import INDEX_OF, CONTEXT, UNIT -from p2r_config import SPARQL_UPDATE_ENDPOINT - -# Prints to stderr. Copypasted from -# https://stackoverflow.com/questions/5574702/how-to-print-to-stderr-in-python -def eprint(*args, **kwargs): - print(*args, file=sys.stderr, **kwargs) - - -# Does an HTTP POST operation in order to do a sparql update request. -def do_sparql_update(sparql): - query = { 'update': sparql } - r = requests.post(SPARQL_UPDATE_ENDPOINT, data=query) - if (r.status_code != 200) : - eprint('>>>>>>> ERROR <<<<<<<') - eprint(r.text) - eprint('--- query:') - eprint(sparql) - eprint('----------') - - -# Converts "prefix dummy: <http://example/>" -# as "@prefix dummy: <http://example/> ." -# Works with multiline prefixes such as OBSERVATION_PREFIX. -# Simply replaces 'prefix ' with '@prefix ' and '>' with '> .'. -def sparqlPrefix_to_ttl(prefixes): - return re.sub('>', '> .',re.sub(r'prefix ', '@prefix ', prefixes)) - - -RESULT_STACK = [] -def feature_to_ttl(feature, value, time, interval): - if value is None: - return '' - - CTX = CONTEXT[feature] # To make code shorter - if (CTX['phenomenonTime'] == 'interval'): dt = interval - else: dt = time - - # The Result - rr = "%s%s" % (value, UNIT[feature]['unit_txt']) - try: - dummy = RESULT_STACK.index(rr) - result="""<%sresult/value_%s_%s> sosa:isResultOf <%sobservation/at_%s_of_%s_on_%s> . - -""" % (BASE_PREFIX, value, UNIT[feature]['unit_txt'], - BASE_PREFIX, dt, CTX['madeBySensor'], CTX['observedProperty']) - except: - RESULT_STACK.append(rr) - result = """<%sresult/value_%s_%s> a sosa:Result, - qudt:QuantityValue; - qudt:unit <%s> ; - qudt:numericValue "%s"^^xsd:double ; - sosa:isResultOf <%sobservation/at_%s_of_%s_on_%s> . - -""" % (BASE_PREFIX, value, UNIT[feature]['unit_txt'], - UNIT[feature]['unit'], value, - BASE_PREFIX, dt, CTX['madeBySensor'], CTX['observedProperty']) - - # The Observation - obs = """<%sobservation/at_%s_of_%s_on_%s> a sosa:Observation ; - sosa:observedProperty <%sobservableProperty/%s> ; - sosa:hasFeatureOfInterest <%sfeatureOfInterest/%s> ; - sosa:madeBySensor <%ssensor/%s> ; - sosa:hasResult <%sresult/value_%s_%s> ; - sosa:phenomenonTime <%s%s/%s> ; - sosa:resultTime "%s"^^xsd:dateTime ; - sosa:hasSimpleResult "%s %s"^^cdt:%s . - -""" % (BASE_PREFIX, dt, CTX['madeBySensor'], CTX['observedProperty'], - BASE_PREFIX, CTX['observedProperty'], # sosa:observedProperty - BASE_PREFIX, CTX['featureOfInterest'], # sosa:hasFeatureOfInterest - BASE_PREFIX, CTX['madeBySensor'], # sosa:madeBySensor - BASE_PREFIX, value, UNIT[feature]['unit_txt'], # sosa:hasResult - BASE_PREFIX, CTX['phenomenonTime'], dt, # sosa:phenomenonTime - time, # sosa:resultTime - value, UNIT[feature]['unit_symbol'], UNIT[feature]['cdt_type'], - ) - - mobs = """<%ssensor/%s> sosa:madeObservation - <%sobservation/at_%s_of_%s_on_%s> . - -""" % (BASE_PREFIX, CTX['madeBySensor'], - BASE_PREFIX, dt, CTX['madeBySensor'], feature.replace(' ','_')) - - return result + obs #+ mobs - - -# Three lists for stacking latest time objects created, to avoid -# multiple declaration of same time objects. -MAX_TIME_STACK_LENGTH = 10000 -INSTANT_STACK = [] -INTERVAL_STACK = [] -DURATION_STACK = [] - -def get_time_instant(dt): - dt_xsd = str(arrow.get(dt, TIMEZONE)) - return """<%sinstant/%s> a time:Instant ; - time:inXSDDateTimeStamp "%s"^^xsd:dateTimeStamp ; - time:inDateTime <%sdateTimeDescription/%s> . - -""" % (BASE_PREFIX, dt_xsd, dt_xsd, BASE_PREFIX, dt_xsd) - -def get_date_time_description(dt): - dt_xsd = str(arrow.get(dt, TIMEZONE)) - return """<%sdateTimeDescription/%s> a time:DateTimeDescription ; - time:unitType time:unitMinute ; - time:year "%s"^^xsd:gYear ; time:month "--%02d"^^xsd:gMonth ; - time:day "---%02d"^^xsd:gDay ; - time:hour "%s"^^xsd:nonNegativeInteger ; - time:minutes "%s"^^xsd:nonNegativeInteger . - -""" % (BASE_PREFIX, dt_xsd, dt.year, dt.month, - dt.day, dt.hour, dt.minute) - -def get_duration(dur): - return """<%sduration/PT%sM> a time:Duration ; - time:unitType time:unitMinute ; - time:numericDuration "%s"^^xsd:decimal . - -""" % (BASE_PREFIX, dur, dur) - - - -# Returns the ttl for date and time insertions. May be empty for -# elements (time:Instants/Intervals/Durations) already returned -# by a previous call to this function. -def insert_time_objects(begin_time, end_time): - duration_minutes = int((end_time - begin_time).total_seconds() / 60) - - # Begin time should be already in the database in most cases. - # Testing it before inserting would be more elegant but triples already - # in won't be inserted twice (tested on jena/fuseki) - begin_xsd = str(arrow.get(begin_time, TIMEZONE)) - try: - dummy = INSTANT_STACK.index(begin_xsd) - begin_str = '' - begin_desc = '' - except: - INSTANT_STACK.append(begin_xsd) - begin_str = get_time_instant(begin_time) - begin_desc = get_date_time_description(begin_time) - - # La sama faro, sed "begin" estas "end" ĉi tie. - end_xsd = str(arrow.get(end_time, TIMEZONE)) - try: - dummy = INSTANT_STACK.index(end_xsd) - end_str = '' - end_desc = '' - except: - INSTANT_STACK.append(end_xsd) - end_str = get_time_instant(end_time) - end_desc = get_date_time_description(end_time) - while (len(INSTANT_STACK) > MAX_TIME_STACK_LENGTH): - INSTANT_STACK.pop(0) - - dur_str = '' - try: - dummy = DURATION_STACK.index(duration_minutes) - except: - DURATION_STACK.append(duration_minutes) - dur_str = get_duration(duration_minutes) - # Rq : On ne vide pas la DURATION_STACK, qui ne bénéficie pas de l'ordre - # cronologique du fichier csv. Doit pas être très lourd de ttes façons. - - inter_str = "PT%dM_%s" % (duration_minutes, begin_xsd) - interval = '' - try: - dummy = INTERVAL_STACK.index(inter_str) - except: - INTERVAL_STACK.append(inter_str) - interval = """<%sinterval/%s> a time:Interval ; - time:hasDuration <%sduration/PT%sM> ; - time:hasBeginning <%sinstant/%s> ; - time:hasEnd <%sinstant/%s> . - -""" % (BASE_PREFIX, inter_str, BASE_PREFIX, duration_minutes, - BASE_PREFIX, begin_xsd, BASE_PREFIX, end_xsd) - - while (len(INTERVAL_STACK) > MAX_TIME_STACK_LENGTH): - INTERVAL_STACK.pop(0) - - return """%s%s%s%s%s%s -""" % (begin_str, begin_desc, end_str, end_desc, dur_str, interval) - - - -def get_ttl(line, duration): - # Get ttl for time objects - end_time = line[0] - begin_time = end_time - duration - ttl_time = insert_time_objects(begin_time, end_time) - - # Get time objects names (instant and interval) - end_xsd = str(arrow.get(end_time, TIMEZONE)) - inter_str = "PT%dM_%s" % (int(duration.total_seconds() / 60), - str(arrow.get(begin_time, TIMEZONE))) - - # Get ttl for each feature - temp = feature_to_ttl('temperature', line[1], end_xsd, inter_str) - pres = feature_to_ttl('airPressure', line[2], end_xsd, inter_str) - humi = feature_to_ttl('humidity', line[3], end_xsd, inter_str) - rain = feature_to_ttl('rainfallAmount', line[4], end_xsd, inter_str) - rate = feature_to_ttl('rainfallRate', line[5], end_xsd, inter_str) - wind = feature_to_ttl('windSpeed', line[6], end_xsd, inter_str) - solr = feature_to_ttl('solarRadiation', line[8], end_xsd, inter_str) - - if line[7] is not None: - wdir = feature_to_ttl('windDirection', WIND_DIRECTIONS[line[7].strip()], - end_xsd, inter_str) - else: - wdir = '' - - - return """%s -%s -%s -%s -%s -%s -%s -%s -%s -""" % (ttl_time, temp, pres, humi, rain, rate, wind, wdir, solr) - -def empty_stacks(): - RESULT_STACK = [] - INSTANT_STACK = [] - INTERVAL_STACK = [] - DURATION_STACK = [] diff --git a/weather2018/py/pg2rdf.py b/weather2018/py/pg2rdf.py deleted file mode 100644 index 3ae7107..0000000 --- a/weather2018/py/pg2rdf.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/python3 - -# Destiné à être exécuté périodiquement sur cfs-sparql. -# Extrait de la BD Operose les données de la station météo -# et les insère dans le sparql endpoint. - -import sys -import psycopg2 -import requests -import json - -from datetime import datetime - -from p2r_config import * -from p2r_functions import * - - - -conn = psycopg2.connect(host=PG_HOST, database=PG_DATABASE, - user=PG_USER, password=PG_PASSWORD) -cur = conn.cursor() - -query = {'query': 'SELECT (max(?time) AS ?t) WHERE { ?o <http://www.w3.org/ns/sosa/resultTime> ?time }'} -r = requests.get(SPARQL_QUERY_ENDPOINT, params=query) -j = json.loads(r.text) -if (len(j['results']['bindings'][0]) == 0): - cur.execute("SELECT jourheure, tabri, pmer, uabri, pluie, intenspluie, ventmoy, dirventmoy, raysolaire FROM wdonnees ORDER BY jourheure") -else: - dt_start = j['results']['bindings'][0]['t']['value'] - # then we retreive only fresher data from postgres. - cur.execute("SELECT jourheure, tabri, pmer, uabri, pluie, intenspluie, ventmoy, dirventmoy, raysolaire FROM wdonnees WHERE jourheure >= '%s' ORDER BY jourheure" % dt_start) - -first_pass = True -prev_row = cur.fetchone() -if (prev_row is None): - print("No data read.") - cur.close() - conn.close() - sys.exit(0) - -curr_row = cur.fetchone() -while curr_row is not None: - if (curr_row[0].year != prev_row[0].year): - empty_stacks() - duration = curr_row[0] - prev_row[0] - duration_minutes = int((curr_row[0] - prev_row[0]).total_seconds() / 60) - if first_pass and not WRITE_TO_TRIPLESTORE: - ttl = "%s %s" % (sparqlPrefix_to_ttl(OBSERVATION_PREFIX), - sparqlPrefix_to_ttl(TIME_PREFIX)) - else: - ttl = '' - if ((duration_minutes > 0) and (duration_minutes <= INTERVAL_MAX)): - if WRITE_TO_TRIPLESTORE: - print(curr_row[0]) - if (first_pass): - ttl = get_ttl(prev_row, duration) - ttl = "%s %s" % (ttl, get_ttl(curr_row, duration)) - else : - ttl = get_ttl(curr_row, duration) - - - if WRITE_TO_TRIPLESTORE: - - ttl = """%s -%s -INSERT DATA { -GRAPH <%sobservation/%s> { -%s -}} -""" % (OBSERVATION_PREFIX, TIME_PREFIX, BASE_PREFIX, curr_row[0].year, ttl) - do_sparql_update(ttl) - - else: - if not QUIET: - print(ttl) - - first_pass = False - prev_row = curr_row - curr_row = cur.fetchone() - -cur.close() -conn.close() diff --git a/weather2018/py/updateTemporal.py b/weather2018/py/updateTemporal.py deleted file mode 100644 index b58f91f..0000000 --- a/weather2018/py/updateTemporal.py +++ /dev/null @@ -1,40 +0,0 @@ -import json -import requests -from p2r_config import SPARQL_UPDATE_ENDPOINT -from p2r_config import SPARQL_QUERY_ENDPOINT - -query = {'update': """ -WITH <http://ontology.irstea.fr/weather/metadata> -DELETE { <http://ontology.irstea.fr/weather/metadata/from_2018-08-01T00:10:00+01:00> - <http://www.w3.org/2006/time#hasEnd> ?c } -WHERE { GRAPH <http://ontology.irstea.fr/weather/metadata> { - <http://ontology.irstea.fr/weather/metadata/from_2018-08-01T00:10:00+01:00> - <http://www.w3.org/2006/time#hasEnd> ?c } } -"""} - -r = requests.post(SPARQL_UPDATE_ENDPOINT, data=query) -if (r.status_code != 200) : - print(r.text) - exit(-1) - -query = {'query': """SELECT (MAX(?ts) AS ?last) WHERE { -[] a <http://www.w3.org/2006/time#Instant> ; -<http://www.w3.org/2006/time#inXSDDateTimeStamp> ?ts }"""} -r = requests.get(SPARQL_QUERY_ENDPOINT, params=query) -j = json.loads(r.text) - -print("Last instant : %s" % j['results']['bindings'][0]['last']['value']) - -query = {'update': """INSERT DATA { -GRAPH <http://ontology.irstea.fr/weather/metadata> { - <http://ontology.irstea.fr/weather/metadata/from_2018-08-01T00:10:00+01:00> - <http://www.w3.org/2006/time#hasEnd> - <http://ontology.irstea.fr/weather/resource/instant/%s> } -}""" % j['results']['bindings'][0]['last']['value']} - -r = requests.post(SPARQL_UPDATE_ENDPOINT, data=query) -if (r.status_code != 200) : - print(r.text) - exit(-1) -else: - print(">>>>> Succès <<<<<") diff --git a/weather2018/weather2018-definitions.sparql b/weather2018/weather2018-definitions.sparql deleted file mode 100644 index 6886842..0000000 --- a/weather2018/weather2018-definitions.sparql +++ /dev/null @@ -1,190 +0,0 @@ -prefix : <http://ontology.irstea.fr/weather/resource/> -prefix atpw_platform: <http://ontology.irstea.fr/weather/resource/platform/> -prefix atpw_obs: <http://ontology.irstea.fr/weather/resource/observation/> -prefix atpw_sens: <http://ontology.irstea.fr/weather/resource/sensor/> -prefix atpw_geom: <http://ontology.irstea.fr/weather/resource/geometry/> -prefix atpw_foi: <http://ontology.irstea.fr/weather/resource/featureOfInterest/> -prefix atpw_cp: <http://ontology.irstea.fr/weather/resource/classPartition/> -prefix atpw_pp: <http://ontology.irstea.fr/weather/resource/propertyPartition/> -prefix atpw_unit: <http://ontology.irstea.fr/weather/resource/unit/> -prefix atpw_prop: <http://ontology.irstea.fr/weather/resource/observableProperty/> - -prefix irstea: <http://ontology.irstea.fr/society/resource/> -prefix irstea_org: <http://ontology.irstea.fr/society/resource/organization/> -prefix irstea_person: <http://ontology.irstea.fr/society/resource/person/> - -prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> -prefix foaf: <http://xmlns.com/foaf/0.1/> -prefix geo: <http://www.opengis.net/ont/geosparql#> -prefix dcterms: <http://purl.org/dc/terms/> -prefix qudt: <http://qudt.org/1.1/schema/qudt#> -prefix qudt_unit: <http://qudt.org/1.1/vocab/unit#> -prefix aws: <http://purl.oclc.org/NET/ssnx/meteo/aws#> -prefix xsd: <http://www.w3.org/2001/XMLSchema#> -prefix owl: <http://www.w3.org/2002/07/owl#> -prefix skos: <http://www.w3.org/2004/02/skos/core#> -prefix void: <http://rdfs.org/ns/void#> -prefix ssn: <http://www.w3.org/ns/ssn/> -prefix sosa: <http://www.w3.org/ns/sosa/> -prefix time: <http://www.w3.org/2006/time#> - -INSERT DATA { -GRAPH <http://ontology.irstea.fr/weather/metadata> { -# -# Description du dayaset avec VoID -# https://www.w3.org/TR/void/ -# -# ATTENTION : on le définit deux fois : -# <http://ontology.irstea.fr/weather> -# et -# <http://ontology.irstea.fr/weather/metadata> -# -<http://ontology.irstea.fr/weather> - a void:Dataset ; - foaf:homepage <http://ontology.irstea.fr/pmwiki.php/Site/weather> ; - dcterms:title "IRSTEA Weather"^^xsd:string ; - dcterms:description "Weather data described using Sosa ontology"^^xsd:string ; - dcterms:contributor irstea_org:IRSTEA; - dcterms:contributor irstea_person:catherine_roussey; - dcterms:contributor irstea_person:stephan_bernard; - dcterms:modified "2018-12-21"^^xsd:date; - dcterms:license <https://www.etalab.gouv.fr/licence-ouverte-open-licence>; - dcterms:subject <http://dbpedia.org/resource/Weather>; - dcterms:temporal <http://ontology.irstea.fr/weather/metadata/from_2018-08-01T00:10:00+01:00> ; - void:sparqlEndpoint <http://ontology.irstea.fr/weather/sparql>; - void:exampleResource atpw_platform:VP2lesPalaquins01; - void:exampleResource <http://ontology.irstea.fr/weather/resource/observation/at_2019-05-11T10:50:00+01:00_of_VP2lesPalaquins01_outsideTemperatureSensor01_on_temperature>; - void:uriSpace "http://ontology.irstea.fr/weather/"^^xsd:string ; - void:vocabulary <http://vocab.nerc.ac.uk/collection/P07/current/>; - void:vocabulary <http://sweet.jpl.nasa.gov/>; - void:vocabulary <http://www.w3.org/ns/ssn>; - void:vocabulary <http://www.w3.org/ns/sosa>; - void:vocabulary <http://purl.oclc.org/NET/ssnx/meteo/aws>; - void:vocabulary <http://www.opengis.net/ont/geosparql>; - void:vocabulary <http://purl.org/dc/terms>; - void:vocabulary <http://www.w3.org/2006/time>; - void:vocabulary <http://w3id.org/lindt/custom_datatypes>; - void:vocabulary <http://qudt.org/1.1/schema/qudt>; - void:vocabulary <http://qudt.org/1.1/vocab/unit>; - - void:subset <http://ontology.irstea.fr/weather/resource/platform/>; - void:subset <http://ontology.irstea.fr/weather/resource/sensor/>; - void:subset <http://ontology.irstea.fr/weather/resource/geometry/>; - void:subset <http://ontology.irstea.fr/society/resource>; - void:subset <http://ontology.irstea.fr/weather/resource/unit/>; - - void:classPartition atpw_cp:platform ; - void:classPartition atpw_cp:geometry ; - void:classPartition atpw_cp:sensor ; - void:classPartition atpw_cp:observation ; - void:classPartition atpw_cp:timeInterval ; - void:classPartition atpw_cp:timeInstant ; - void:classPartition atpw_cp:timeDuration ; - void:classPartition atpw_cp:timeDateTimeDescription ; - void:classPartition atpw_cp:result ; - void:classPartition atpw_cp:quantityValue ; - - void:propertyPartition atpw_pp:hasGeometry ; - void:propertyPartition atpw_pp:hosts ; - void:propertyPartition atpw_pp:isHostedBy ; - void:propertyPartition atpw_pp:observes ; - void:propertyPartition atpw_pp:madeBySensor ; - void:propertyPartition atpw_pp:observedProperty ; - void:propertyPartition atpw_pp:hasFeatureOfInterest ; - void:propertyPartition atpw_pp:hasSimpleResult ; - void:propertyPartition atpw_pp:hasResult ; - void:propertyPartition atpw_pp:unit ; - void:propertyPartition atpw_pp:phenomenonTime ; - void:propertyPartition atpw_pp:resultTime ; - void:propertyPartition atpw_pp:timeHasBegin ; - void:propertyPartition atpw_pp:timeHasEnd ; - void:propertyPartition atpw_pp:timeInXSDDateTimeStamp ; - void:propertyPartition atpw_pp:geoSfWithin ; - - void:triples 26000000 ; # Précisément : 25907998 - void:classes 26 ; - void:properties 57 ; - void:distinctSubjects 3000000 ; - . - - -<http://ontology.irstea.fr/weather/metadata> - a void:Dataset; - foaf:homepage <http://ontology.irstea.fr/pmwiki.php/Site/weather> ; - dcterms:title "IRSTEA Weather"^^xsd:string ; - dcterms:description "Weather data described using Sosa ontology"^^xsd:string ; - dcterms:contributor irstea_org:IRSTEA; - dcterms:contributor irstea_person:catherine_roussey; - dcterms:contributor irstea_person:stephan_bernard; - dcterms:modified "2018-12-21"^^xsd:date; - dcterms:license <https://www.etalab.gouv.fr/licence-ouverte-open-licence>; - dcterms:subject <http://dbpedia.org/resource/weather>; - dcterms:temporal <http://ontology.irstea.fr/weather/metadata/from_2018-08-01T00:10:00+01:00> ; - void:sparqlEndpoint <http://ontology.irstea.fr/weather/sparql>; - void:exampleResource atpw_platform:VP2lesPalaquins01; - void:exampleResource <http://ontology.irstea.fr/weather/resource/observation/at_2019-05-11T10:50:00+01:00_of_VP2lesPalaquins01_outsideTemperatureSensor01_on_air_temperature>; - void:uriSpace "http://ontology.irstea.fr/weather/"^^xsd:string ; - void:vocabulary <http://vocab.nerc.ac.uk/collection/P07/current/>; - void:vocabulary <http://sweet.jpl.nasa.gov/>; - void:vocabulary <http://www.w3.org/ns/ssn>; - void:vocabulary <http://www.w3.org/ns/sosa>; - void:vocabulary <http://purl.oclc.org/NET/ssnx/meteo/aws>; - void:vocabulary <http://www.opengis.net/ont/geosparql>; - void:vocabulary <http://purl.org/dc/terms>; - void:vocabulary <http://www.w3.org/ns/locn>; - void:vocabulary <http://www.w3.org/2006/time>; - void:vocabulary <http://w3id.org/lindt/custom_datatypes>; - void:vocabulary <http://qudt.org/1.1/schema/qudt>; - void:vocabulary <http://qudt.org/1.1/vocab/unit>; - - void:subset <http://ontology.irstea.fr/weather/resource/platform/>; - void:subset <http://ontology.irstea.fr/weather/resource/sensor/>; - void:subset <http://ontology.irstea.fr/weather/resource/geometry/>; - void:subset <http://ontology.irstea.fr/society/resource>; - void:subset <http://ontology.irstea.fr/weather/resource/unit/>; - - void:classPartition atpw_cp:platform ; - void:classPartition atpw_cp:geometry ; - void:classPartition atpw_cp:sensor ; - void:classPartition atpw_cp:observation ; - void:classPartition atpw_cp:timeInterval ; - void:classPartition atpw_cp:timeInstant ; - void:classPartition atpw_cp:timeDuration ; - void:classPartition atpw_cp:timeDateTimeDescription ; - void:classPartition atpw_cp:result ; - void:classPartition atpw_cp:quantityValue ; - - void:propertyPartition atpw_pp:hasGeometry ; - void:propertyPartition atpw_pp:hosts ; - void:propertyPartition atpw_pp:isHostedBy ; - void:propertyPartition atpw_pp:observes ; - void:propertyPartition atpw_pp:madeBySensor ; - void:propertyPartition atpw_pp:observedProperty ; - void:propertyPartition atpw_pp:hasFeatureOfInterest ; - void:propertyPartition atpw_pp:hasSimpleResult ; - void:propertyPartition atpw_pp:hasResult ; - void:propertyPartition atpw_pp:unit ; - void:propertyPartition atpw_pp:phenomenonTime ; - void:propertyPartition atpw_pp:resultTime ; - void:propertyPartition atpw_pp:timeHasBegin ; - void:propertyPartition atpw_pp:timeHasEnd ; - void:propertyPartition atpw_pp:timeInXSDDateTimeStamp ; - void:propertyPartition atpw_pp:geoSfWithin ; - void:triples 26000000 ; - void:classes 26 ; - void:properties 57 ; - void:distinctSubjects 3000000 ; - . - - <http://ontology.irstea.fr/weather/metadata/from_2018-08-01T00:10:00+01:00> - a dcterms:PeriodOfTime, time:Interval ; - dcterms:description "A time:Interval updated every day to indicate \"since a given date\"."@en, - "Un time:Interval mis à jour quotidiennement pour désigner \"depuis une date donnée\"."@fr; - time:hasBeginning <http://ontology.irstea.fr/weather/resource/instant/2018-08-01T00:10:00+01:00> ; - time:hasEnd <http://ontology.irstea.fr/weather/resource/instant/2018-08-01T00:10:00+01:00> . - -} - - -} diff --git a/weather2018/weather2018-resource.sparql b/weather2018/weather2018-resource.sparql deleted file mode 100644 index 2f2f4dd..0000000 --- a/weather2018/weather2018-resource.sparql +++ /dev/null @@ -1,223 +0,0 @@ -prefix : <http://ontology.irstea.fr/weather/resource/> -prefix atpw_platform: <http://ontology.irstea.fr/weather/resource/platform/> -prefix atpw_obs: <http://ontology.irstea.fr/weather/resource/observation/> -prefix atpw_sens: <http://ontology.irstea.fr/weather/resource/sensor/> -prefix atpw_geom: <http://ontology.irstea.fr/weather/resource/geometry/> -prefix atpw_foi: <http://ontology.irstea.fr/weather/resource/featureOfInterest/> -prefix atpw_cp: <http://ontology.irstea.fr/weather/resource/classPartition/> -prefix atpw_pp: <http://ontology.irstea.fr/weather/resource/propertyPartition/> -prefix atpw_unit: <http://ontology.irstea.fr/weather/resource/unit/> -prefix atpw_prop: <http://ontology.irstea.fr/weather/resource/observableProperty/> - -prefix irstea: <http://ontology.irstea.fr/society/resource/> -prefix irstea_org: <http://ontology.irstea.fr/society/resource/organization/> -prefix irstea_person: <http://ontology.irstea.fr/society/resource/person/> - -prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> -prefix foaf: <http://xmlns.com/foaf/0.1/> -prefix geo: <http://www.opengis.net/ont/geosparql#> -prefix dcterms: <http://purl.org/dc/terms/> -prefix qudt: <http://qudt.org/1.1/schema/qudt#> -prefix qudt_unit: <http://qudt.org/1.1/vocab/unit#> -prefix aws: <http://purl.oclc.org/NET/ssnx/meteo/aws#> -prefix xsd: <http://www.w3.org/2001/XMLSchema#> -prefix owl: <http://www.w3.org/2002/07/owl#> -prefix skos: <http://www.w3.org/2004/02/skos/core#> -prefix void: <http://rdfs.org/ns/void#> -prefix ssn: <http://www.w3.org/ns/ssn/> -prefix sosa: <http://www.w3.org/ns/sosa/> - -INSERT DATA { -GRAPH <http://ontology.irstea.fr/weather/resource> { - -<http://ontology.irstea.fr/weather/resource/unit/> a void:Dataset; - dcterms:title "Physical units"^^xsd:string ; - dcterms:description "Local definition of physical units not found in qudt."^^xsd:string ; - dcterms:subject <http://dbpedia.org/resource/Units_of_measurement> . - -<http://ontology.irstea.fr/weather/resource/geometry/> a void:Dataset; - dcterms:title "Geometry"@en, "Représentation spatiale"@fr ; - dcterms:description "Set of geosparql:Geometry instances used in weather dataset."@en, - "Instances de geosparql:Geometry utilisées dans le dataset weather."@fr . - -<http://ontology.irstea.fr/weather/resource/feature_of_interest/> a void:Dataset; - dcterms:title "Features of interest"; - dcterms:description "Instances of sweet classes for observation features of interest."@en, - "Instances de classes sweet pour définir les «features of interest» des observations."@fr . - -<http://ontology.irstea.fr/weather/resource/sensor/> a void:Dataset; - dcterms:title "Sensors"; - dcterms:description "Sensors composing weather systems."@en; - dcterms:subject <http://dbpedia.org/resource/Sensor> . - -<http://ontology.irstea.fr/weather/resource/platform/> a void:Dataset; - dcterms:title "Weather station"@en , "Station météo"@fr; - dcterms:description "Description of weather station"@en, - "Description de la station météo"@fr; - dcterms:subject <http://dbpedia.org/resource/Weather_station> . - -# Les classPartition -atpw_cp:platform a void:Dataset ; void:class sosa:Platform . -atpw_cp:geometry a void:Dataset ; void:class geo:Geometry . -atpw_cp:sensor a void:Dataset ; void:class sosa:Sensor . -atpw_cp:observation a void:Dataset ; void:class sosa:Observation . -atpw_cp:timeInterval a void:Dataset ; void:class <http://www.w3.org/2006/time#Interval> . -atpw_cp:timeInstant a void:Dataset ; void:class <http://www.w3.org/2006/time#Instant> . -atpw_cp:timeDuration a void:Dataset ; void:class <http://www.w3.org/2006/time#Duration> . -atpw_cp:timeDateTimeDescription a void:Dataset ; void:class <http://www.w3.org/2006/time#DateTimeDescription> . -atpw_cp:result a void:Dataset ; void:class sosa:Result . -atpw_cp:quantityValue a void:Dataset ; void:class qudt:QuantityValue . -atpw_pp:hasGeometry a void:Dataset; void:property geo:hasGeometry . -atpw_pp:hosts a void:Dataset; void:property sosa:hosts . -atpw_pp:isHostedBy a void:Dataset; void:property sosa:isHostedBy . -atpw_pp:observes a void:Dataset; void:property sosa:observes . -atpw_pp:madeBySensor a void:Dataset; void:property sosa:madeBySensor . -atpw_pp:observedProperty a void:Dataset; void:property sosa:observedProperty . -atpw_pp:hasFeatureOfInterest a void:Dataset; void:property sosa:hasFeatureOfInterest . -atpw_pp:hasSimpleResult a void:Dataset; void:property sosa:hasSimpleResult . -atpw_pp:hasResult a void:Dataset; void:property sosa:hasResult . -atpw_pp:unit a void:Dataset; void:property qudt:unit . -atpw_pp:phenomenonTime a void:Dataset; void:property sosa:phenomenonTime . -atpw_pp:resultTime a void:Dataset; void:property sosa:resultTime . -atpw_pp:timeHasBegin a void:Dataset; void:property <http://www.w3.org/2006/time#hasBegin> . -atpw_pp:timeHasEnd a void:Dataset; void:property <http://www.w3.org/2006/time#hasEnd> . -atpw_pp:timeInXSDDateTimeStamp a void:Dataset; void:property <http://www.w3.org/2006/time#inXSDDateTimeStamp> . -atpw_pp:geoSfWithin a void:Dataset; void:property geo:sfWithin . - -# -# Ajout d'une unité : pas de mm/h (rainfall rate) dans qudt_unit. -# -atpw_unit:MillimeterPerHour a qudt:LinearVelocityUnit, qudt:SIDerivedUnit ; - qudt:abbreviation "mm/h"^^xsd:string ; - qudt:conversionMultiplier 0.000000277777778 ; - qudt:conversionOffset 0.0 ; - qudt:symbol "mm h^-1"^^xsd:string ; - rdfs:label "Millimeter per Hour"^^xsd:string . - -# -# Features of interest -# -atpw_foi:air a <http://sweetontology.net/matr/Air> , - sosa:FeatureOfInterest ; - ssn:hasProperty atpw_prop:air_temperature , atpw_prop:air_pressure , - atpw_prop:air_relativeHumidity . - -atpw_foi:precipitation - a <http://sweetontology.net/phenAtmoPrecipitation/AtmosphericPrecipitation>, - sosa:FeatureOfInterest ; - ssn:hasProperty atpw_prop:precipitation_amount , - atpw_prop:precipitation_rate . - -atpw_foi:wind a <http://sweetontology.net/phenAtmoWind/Wind> , - sosa:FeatureOfInterest ; - ssn:hasProperty atpw_prop:wind_direction , atpw_prop:wind_speed . - -atpw_foi:solarFlux - a <http://sweetontology.net/propEnergyFlux/SolarFlux> , - sosa:FeatureOfInterest ; - ssn:hasProperty atpw_prop:solarFlux_density . - - -# -# Observable properties -# -atpw_prop:precipitation_amount a sosa:ObservableProperty ; - skos:exactMatch <http://vocab.nerc.ac.uk/collection/P07/current/CFSN0452/>. - -atpw_prop:precipitation_rate a sosa:ObservableProperty ; - skos:closeMatch <http://vocab.nerc.ac.uk/collection/P07/current/CFSN0410/>. - -atpw_prop:wind_direction a sosa:ObservableProperty ; - skos:exactMatch <http://vocab.nerc.ac.uk/collection/P07/current/CFSN0036/>. - -atpw_prop:wind_speed a sosa:ObservableProperty ; - skos:exactMatch <http://vocab.nerc.ac.uk/collection/P07/current/CFSN0038/>. - -atpw_prop:air_temperature a sosa:ObservableProperty ; - skos:exactMatch <http://vocab.nerc.ac.uk/collection/P07/current/CFSN0023/>. - -atpw_prop:air_pressure a sosa:ObservableProperty ; - skos:exactMatch <http://vocab.nerc.ac.uk/collection/P07/current/CFSN0015/>; - rdfs:seeAlso <https://fr.wikipedia.org/wiki/Pression_atmosph%C3%A9rique>. - -atpw_prop:air_relativeHumidity a sosa:ObservableProperty ; - skos:exactMatch <http://vocab.nerc.ac.uk/collection/P07/current/CFSN0413/>; - rdfs:seeAlso <https://fr.wikipedia.org/wiki/Humidit%C3%A9_relative>. - -atpw_prop:solarFlux_density a sosa:ObservableProperty ; - skos:exactMatch <http://vocab.nerc.ac.uk/collection/P07/current/CFSN0689/>; - rdfs:seeAlso <https://en.wikipedia.org/wiki/Heat_flux>. - -# -# Station météo -# -atpw_platform:VP2lesPalaquins01 a sosa:Platform , geo:Feature ; - rdfs:label "Station météo du centre IRSTEA de Montoldre — Vantage Pro 2"@fr ; - rdfs:label "Weather station owned by the IRSTEA institute located at Montoldre (France)"@en ; - rdfs:label "Метеороложка Ñтаница од IRSTEA инÑтитут у Montoldre (ФранцуÑку)"@sr ; - sosa:hosts atpw_sens:VP2lesPalaquins01_barometer01 ; - sosa:hosts atpw_sens:VP2lesPalaquins01_windDirectionSensor01 ; - sosa:hosts atpw_sens:VP2lesPalaquins01_anemometer01 ; - sosa:hosts atpw_sens:VP2lesPalaquins01_outsideHumiditySensor01 ; - sosa:hosts atpw_sens:VP2lesPalaquins01_outsideTemperatureSensor01 ; - sosa:hosts atpw_sens:VP2lesPalaquins01_rainCollectorSensor01 ; - sosa:hosts atpw_sens:VP2lesPalaquins01_solarRadiationSensor01 ; - geo:hasGeometry atpw_geom:point_VP2lesPalaquins01 ; - geo:sfWithin irstea_org:irsteaCentreMontoldre ; - rdfs:comment """ -Station type : Vantage Pro 2 Wireless Weather Station -Construtor : Davis Instruments -Located in : IRSTEA, Les Palaquins, Montoldre, Allier (03), France. -""" . - -# Geometrie de la station -# sosa: ajout de l'heritage sosa:FeatureOfInterest et de geo:lat,long,alt. -atpw_geom:point_VP2lesPalaquins01 a geo:Geometry , sosa:FeatureOfInterest ; - geo:asWKT "POINT (3.434657 46.339351)"^^geo:wktLiteral ; - # <http://www.w3.org/2003/01/geo/wgs84_pos#lat> 46.339426 ; - # <http://www.w3.org/2003/01/geo/wgs84_pos#long> 3.434765 ; - # <http://www.w3.org/2003/01/geo/wgs84_pos#alt> 278 ; - rdfs:comment """+46° 20' 2 .66, +3° 26' 4.77""" . - - -# -# Sensing devices -# -atpw_sens:VP2lesPalaquins01_barometer01 - a aws:AtmosphericPressureSensor, sosa:Sensor ; - sosa:isHostedBy atpw_platform:VP2lesPalaquins01 ; - sosa:observes atpw_prop:air_pressure . - -atpw_sens:VP2lesPalaquins01_windDirectionSensor01 - a aws:WindVane, sosa:Sensor ; - sosa:isHostedBy atpw_platform:VP2lesPalaquins01 ; - sosa:observes atpw_prop:wind_direction . - -atpw_sens:VP2lesPalaquins01_anemometer01 - a aws:CupAnemometer, sosa:Sensor ; - sosa:isHostedBy atpw_platform:VP2lesPalaquins01 ; - sosa:observes atpw_prop:wind_speed . - -atpw_sens:VP2lesPalaquins01_outsideHumiditySensor01 - a aws:CapacitiveThinFilmPolymer, sosa:Sensor ; - sosa:isHostedBy atpw_platform:VP2lesPalaquins01 ; - sosa:observes atpw_prop:air_relativeHumidity . - -atpw_sens:VP2lesPalaquins01_outsideTemperatureSensor01 - a aws:Thermistor, sosa:Sensor ; - sosa:isHostedBy atpw_platform:VP2lesPalaquins01 ; - sosa:observes atpw_prop:air_temperature . - -atpw_sens:VP2lesPalaquins01_rainCollectorSensor01 - a aws:TippingBucketRainGaugeTbrgWithoutCorrection, sosa:Sensor ; - sosa:isHostedBy atpw_platform:VP2lesPalaquins01 ; - sosa:observes atpw_prop:precipitation_amount ; - sosa:observes atpw_prop:precipitation_rate . - -atpw_sens:VP2lesPalaquins01_solarRadiationSensor01 - a aws:Pyranometer, sosa:Sensor ; - sosa:isHostedBy atpw_platform:VP2lesPalaquins01 ; - sosa:observes atpw_prop:solarFlux_density . -} -} -- GitLab