Skip to content

Instantly share code, notes, and snippets.

View michimau's full-sized avatar

Mauro Michielon michimau

  • European Food Safety Authority
  • Parma
View GitHub Profile
WITH ns AS (
select ARRAY[ARRAY['xlink', 'http://www.w3.org/1999/xlink'], ARRAY['gmd', 'http://www.isotc211.org/2005/gmd'], ARRAY['gco', 'http://www.isotc211.org/2005/gco']] AS n
)
SELECT
uuid,
array_to_string(theasurus, '') as theasurus,
translate(regexp_split_to_table(keyword::TEXT, E','), '{,},"', '') AS keyword
FROM (SELECT uuid,
@michimau
michimau / cdi query
Created July 31, 2019 07:40
cdi query
PREFIX dcterms: <http://purl.org/dc/terms/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf-syntax: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX Specification: <http://www.eea.europa.eu/portal_types/Specification#>
PREFIX Data: <http://www.eea.europa.eu/portal_types/Data#>
PREFIX DataFileLink: <http://www.eea.europa.eu/portal_types/DataFileLink#>
PREFIX portal_types: <http://www.eea.europa.eu/portal_types#>
PREFIX Obligations: <http://www.eea.europa.eu/portal_types/Obligations#>
PREFIX rod: <http://rod.eionet.europa.eu/schema.rdf#>
PREFIX schema: <http://schema.org/>
PREFIX sdi-internal: <http://rdfdata.eionet.europa.eu/sdi-internal/schema/>
@michimau
michimau / apache test
Last active August 1, 2019 09:21
apache test
<Location /datashare>
ProxyPreserveHost On
#Order deny,allow
Order allow,deny
#Deny from all
#Allow from 171.19.0.0/16
#Allow from 87.54.7.251
#Allow from FOO_API_INSTANCE=blablaXX
Require env FOO_API_INSTANCE
<VirtualHost *:80>
ServerName sdi.eea.europa.eu
ProxyPreserveHost On
RewriteEngine On
<Location /datashare>
RewriteEngine On
#RewriteCond %{HTTP:dummyentry} ^$
RewriteCond %{HTTP:dummyentry} "dummy" [NC]
@michimau
michimau / x fede
Created August 19, 2019 13:39
x fede
PREFIX clrtap_nec_unfccc: <http://reference.eionet.europa.eu/clrtap_nec_unfccc/schema/>
PREFIX country: <http://reference.eionet.europa.eu/clrtap_nec_unfccc/country/>
PREFIX sector: <http://reference.eionet.europa.eu/clrtap_nec_unfccc/clrtap_nec_nfr09_sector/>
SELECT
?year
?pollutant_name
xsd:double((round((sum(?emissions))/sum(?emissions_idx)*1000))/10.0) as ?index
sum(xsd:double(?emissions)) as ?emissions
@michimau
michimau / export_xml
Created August 19, 2019 18:58
export_xml
set blobs on;
sparql define output:format '"RDF/XML"'
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cr: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
PREFIX aqd: <http://rdfdata.eionet.europa.eu/airquality/ontology/>
PREFIX aq: <http://reference.eionet.europa.eu/aq/ontology/>
construct ?assessmentRegime ?inspireId ?localId ?inspireLabel ?assessmentMethods ?assessmentMetadata ?assessmentMetadataNamespace ?assessmentMetadataId ?samplingPointAssessmentMetadata ?metadataId ?metadataNamespace
WHERE {
?assessmentRegime a aqd:AQD_AssessmentRegime ;
input {
file {
path => "/tmp/redmine/*.csv"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
csv {
curl 'https://staging-eunis.eea.europa.eu/login.jsp' \
-H 'Origin: https://staging-eunis.eea.europa.eu' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3' \
-H 'Referer: https://staging-eunis.eea.europa.eu/login.jsp' \
-H 'Accept-Encoding: gzip, deflate, br' \
--data 'cmd=login&username=USERNAME&password=PASSWOED&Submit=EUNIS+Login' \
--compressed \
-c /tmp/eunis-cokie \
-o /tmp/login.html
This file has been truncated, but you can view the full file.
curl -s "http://cr7.eionet.europa.eu/ping?create=true&uri=http://cdr.eionet.europa.eu/de/eu/aqd/k/colxclcrq/envxclcxw/K_DE_BY_M01_Immissionschutzrechtlich_genehmigungsbeduerftige_Anlagen_2018_12_20_08_22_309.xml
curl -s "http://cr7.eionet.europa.eu/ping?create=true&uri=http://cdr.eionet.europa.eu/de/eu/aqd/k/colxclcrq/envxclcxw/K_DE_BY_M03_Immissionschutzrechtlich_nicht_genehmigungsbeduerftige_Anlagen_2018_12_20_08_27_830.xml
curl -s "http://cr7.eionet.europa.eu/ping?create=true&uri=http://cdr.eionet.europa.eu/de/eu/aqd/k/colxclcrq/envxclcxw/K_DE_BY_M06_Ausbau_von_Ausfall__Umgehungsstrassen_2018_12_20_08_29_738.xml
curl -s "http://cr7.eionet.europa.eu/ping?create=true&uri=http://cdr.eionet.europa.eu/de/eu/aqd/k/colxclcrq/envxclcxw/K_DE_BY_M09_Dynamische_Verkehrssteuerung_Informationssysteme_2018_12_20_08_53_559.xml
curl -s "http://cr7.eionet.europa.eu/ping?create=true&uri=http://cdr.eionet.europa.eu/de/eu/aqd/k/colxclcrq/envxclcxw/K_DE_BY_M11_Stellplatzbeschraenkungen_2018_12_20_08_51_755.xml
curl -s "http://
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cr: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
PREFIX aq: <http://rdfdata.eionet.europa.eu/airquality/ontology/>
PREFIX aqr: <http://reference.eionet.europa.eu/aq/ontology/>
PREFIX rod: <http://rod.eionet.europa.eu/schema.rdf#>
PREFIX obligations: <http://rod.eionet.europa.eu/obligations/>
PREFIX aqdd: <http://dd.eionet.europa.eu/property/>