Exemple #1
0
    def cargo_municipio(query, municipio) -> str:
        # municipio = municipio.upper()  # En el campo esta en mayusculas el municipio

        query += (Constants.id_membresia() + " org:organization " +
                  Constants.municipio() + " . ")

        query += (Constants.municipio() + " ei2a:organizationName " +
                  Constants.etiqueta())

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")
        return query
Exemple #2
0
    def superficie_secano(query, municipio) -> str:
        query += (Constants.municipio() + " aragopedia:hasObservation " +
                  Constants.observacion() + " . ")
        query += Constants.municipio() + " rdfs:label " + Constants.etiqueta()

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        query += (Constants.observacion() +
                  " aragopedia:hectareasCultivosSecano " +
                  Constants.answer0() + " . ")
        return query
Exemple #3
0
    def comarca_del_municipio(query, municipio) -> str:
        query += (Constants.municipio() + " aragopedia:enComarca " +
                  Constants.comarca() + " . ")

        query += Constants.municipio() + " rdfs:label " + Constants.etiqueta()

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        query += Constants.comarca() + " rdfs:label " + Constants.answer0(
        ) + " . "
        return query
Exemple #4
0
    def poblacion(query, municipio) -> str:

        query += (
            Constants.municipio() +
            " <http://purl.org/linked-data/sdmx/2009/dimension#refArea> " +
            Constants.etiqueta() + " . ")

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        query += (Constants.municipio() +
                  " <http://opendata.aragon.es/def/iaest/medida#poblacion> " +
                  Constants.answer0() + " . ")
        return query
Exemple #5
0
    def email_ayuntamiento(query, municipio) -> str:
        # municipio = municipio.upper()  # En el campo esta en mayusculas el municipio

        query += (Constants.municipio() + " " + Constants.aux0() +
                  " ei2a:Ayuntamiento . ")

        query += (Constants.municipio() + " ei2a:organizationName " +
                  Constants.etiqueta())

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        query += Constants.municipio() + " foaf:mbox " + Constants.answer0(
        ) + " . "
        return query
Exemple #6
0
    def habitantes_municipio(query, municipio) -> str:
        query = query.replace(Constants.answer0(),
                              Constants.answer0() + " " + Constants.answer1())

        query += (Constants.municipio() + " aragopedia:menPopulation " +
                  Constants.answer0() + " . ")

        query += (Constants.municipio() + " aragopedia:womenPopulation " +
                  Constants.answer1() + " . ")

        query += Constants.municipio() + " rdfs:label " + Constants.etiqueta()

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")
        return query
Exemple #7
0
    def selecting_max_year(grafo: str, answerpart: str) -> str:

        query = " { SELECT DISTINCT MAX(xsd:integer(?max)) as " + Constants.year_max(
        )

        query += " FROM " + grafo

        query += " WHERE { "

        query += (
            Constants.municipio() +
            " <http://purl.org/linked-data/sdmx/2009/dimension#refArea> " +
            Constants.etiqueta() + " . ")

        query += (
            Constants.municipio() +
            " <http://purl.org/linked-data/sdmx/2009/dimension#refPeriod> " +
            Constants.fecha() + " . ")

        query += ("BIND(SUBSTR(STRDT(" + Constants.fecha() +
                  ", xsd:string),38,4) as ?max) . ")

        query += answerpart

        query += " }}"
        return query
Exemple #8
0
 def base_query() -> str:
     base = (Config.prefix() + "SELECT DISTINCT " + Constants.answer0() +
             " " + Constants.etiqueta())
     if Config.graph() != "":
         base += " FROM <" + Config.graph() + ">"
     base += " WHERE { "
     return base
Exemple #9
0
    def num_parados(query, municipio) -> str:

        query = query.replace("WHERE",
                              " FROM " + Constants.grafo_parados() + " WHERE")

        query += (
            Constants.municipio() +
            " <http://purl.org/linked-data/sdmx/2009/dimension#refArea> " +
            Constants.etiqueta() + " . ")

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        query += (Constants.municipio() +
                  " <http://opendata.aragon.es/def/iaest/medida#n-parados> " +
                  Constants.answer0() + " . ")
        return query
Exemple #10
0
    def hectareas_quemadas(query, municipio) -> str:

        query = query.replace(
            "WHERE", " FROM " + Constants.grafo_incendios() + " WHERE")

        query += (
            Constants.municipio() +
            " <http://purl.org/linked-data/sdmx/2009/dimension#refArea> " +
            Constants.etiqueta() + " . ")

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        query += (
            Constants.municipio() +
            " <http://opendata.aragon.es/def/iaest/medida#superficie-forestal-afectada> "
            + Constants.answer0() + " . ")
        return query
Exemple #11
0
    def renta_per_capita(query, municipio) -> str:

        query = query.replace("WHERE",
                              " FROM " + Constants.grafo_renta() + " WHERE")

        query += (
            Constants.municipio() +
            " <http://purl.org/linked-data/sdmx/2009/dimension#refArea> " +
            Constants.etiqueta() + " . ")

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        query += (
            Constants.municipio() +
            " <http://opendata.aragon.es/def/iaest/medida#renta-disponible-bruta-per-capita> "
            + Constants.answer0() + " . ")
        return query
Exemple #12
0
    def year_max_one_paramater(query) -> str:

        Log.log_debug("QUERIES_: Entrando a year_dataset_max()")
        Log.log_debug("QUERIES_: query: {0} ".format(query))

        query = query.replace(
            Constants.etiqueta() + "  FROM",
            Constants.etiqueta() + " " + Constants.fecha() + " FROM",
        )

        query += (
            Constants.municipio() +
            " <http://purl.org/linked-data/sdmx/2009/dimension#refPeriod> " +
            Constants.fecha() + " . ")

        query += (TemplatesAragon.create_filter_regex_var(
            "STRDT(" + Constants.year_max() + ", xsd:string)",
            Constants.fecha()) + " . ")
        return query
Exemple #13
0
    def empresasActivas(query: str, location: str) -> str:

        query += (
            '''
            ?emp rdf:type org:Organization .

            ?emp ei2a:organizationName ''' + Constants.answer0() + ' . ' +
            '''?emp dc:type ?tipo .
    
            FILTER regex(?tipo, "empresa_turismo_activo") .
    
            ?emp geo:location ?loc .
    
            ?loc ?b ''' + Constants.etiqueta() + ''' FILTER regex(''' +
            Constants.etiqueta() + ''', "''' +
            TemplatesAragon.create_bif_contains_only_change_cadena(location) +
            '") .')

        return query
Exemple #14
0
    def fax_municipio(query, municipio) -> str:
        # municipio = municipio.upper()  # En el campo esta en mayusculas el municipio

        query += (Constants.municipio() + " " + Constants.aux0() +
                  " ei2a:Ayuntamiento . ")

        query += (Constants.municipio() + " ei2a:organizationName " +
                  Constants.etiqueta())

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        query += Constants.municipio() + " org:hasSite " + Constants.sede(
        ) + " . "

        query += Constants.sede() + " org:siteAddress " + Constants.aux1(
        ) + " . "

        query += Constants.aux1() + " vcard:Fax " + Constants.answer0() + " . "
        return query
    def info_villa(query, villa) -> str:

        query = query.replace(
            Constants.answer0(),
            Constants.answer0() + " " + Constants.answer1() + " " +
            Constants.answer2() + " " + Constants.answer3(),
        )

        query += (Constants.comarca() + " " + Constants.aux0() +
                  " ei2a:villas_y_tierras . ")

        query += (Constants.comarca() + " ei2a:organizationName " +
                  Constants.etiqueta() + " . ")

        query += (TemplatesAgriculture.create_bif_contains(
            villa, Constants.etiqueta()) + " . ")

        query += (Constants.comarca() +
                  " <http://www.w3.org/2003/01/geo/wgs84_pos#location> " +
                  Constants.location() + " . ")

        query += (Constants.location() +
                  " <http://www.w3.org/2003/01/geo/wgs84_pos#location> " +
                  Constants.aux1() + " . ")

        query += (Constants.aux1() + " ei2a:organizationName " +
                  Constants.answer0() + " . ")

        query += (Constants.comarca() +
                  " <http://opendata.aragon.es/def/ei2a#phone> " +
                  Constants.answer1() + " . ")

        query += (Constants.comarca() + " <http://xmlns.com/foaf/0.1/mbox> " +
                  Constants.answer2() + " . ")

        query += (Constants.comarca() +
                  " <http://opendata.aragon.es/def/ei2a#CIF> " +
                  Constants.answer3() + " . ")
        return query
    def municipio_comarca_agraria(query, comarca_agraria) -> str:

        query += (Constants.comarca() + " " + Constants.aux0() +
                  " ei2a:comarca_agraria . ")

        query += (Constants.comarca() + " ei2a:organizationName " +
                  Constants.etiqueta() + " . ")

        query += (TemplatesAgriculture.create_bif_contains(
            comarca_agraria, Constants.etiqueta()) + " . ")

        query += (Constants.comarca() +
                  " <http://www.w3.org/2003/01/geo/wgs84_pos#location> " +
                  Constants.location() + " . ")

        query += (Constants.location() +
                  " <http://www.w3.org/2003/01/geo/wgs84_pos#location> " +
                  Constants.aux1() + " . ")

        query += (Constants.aux1() + " ei2a:organizationName " +
                  Constants.answer0() + " . ")
        return query
    def villas_municipio(query, municipio) -> str:

        query += (Constants.comarca() + " " + Constants.aux0() +
                  " ei2a:villas_y_tierras . ")

        query += (Constants.comarca() + " ei2a:organizationName " +
                  Constants.answer0() + " . ")

        query += (Constants.comarca() +
                  " <http://www.w3.org/2003/01/geo/wgs84_pos#location> " +
                  Constants.location() + " . ")

        query += (Constants.location() +
                  " <http://www.w3.org/2003/01/geo/wgs84_pos#location> " +
                  Constants.aux1() + " . ")

        query += (Constants.aux1() + " ei2a:organizationName " +
                  Constants.etiqueta() + " . ")

        query += (TemplatesAgriculture.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")
        return query
Exemple #18
0
    def empresas_por_trabajadores(query, municipio) -> str:

        query = query.replace("SELECT DISTINCT ?answer0",
                              "SELECT DISTINCT SUM(?answer0) as ?answer0")

        query = query.replace(
            "WHERE",
            " FROM " + Constants.grafo_trabajadores_empresa() + " WHERE")

        query += (
            Constants.municipio() +
            " <http://purl.org/linked-data/sdmx/2009/dimension#refArea> " +
            Constants.etiqueta() + " . ")

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        query += (
            Constants.municipio() +
            " <http://opendata.aragon.es/def/iaest/medida#numero-empresas> " +
            Constants.answer0() + " . ")
        return query
    def fincas_cultivo_lenoso_municipio(query, municipio) -> str:

        query += (Constants.comarca() + " " + Constants.aux0() +
                  " ei2a:cultivo_lenoso . ")

        query += (Constants.comarca() +
                  " <http://purl.org/dc/elements/1.1/title> " +
                  Constants.answer0() + " . ")

        query += (Constants.comarca() +
                  " <http://www.w3.org/2003/01/geo/wgs84_pos#location> " +
                  Constants.location() + " . ")

        query += (Constants.location() +
                  " <http://www.w3.org/2003/01/geo/wgs84_pos#location> " +
                  Constants.aux1() + " . ")

        query += (Constants.aux1() + " ei2a:organizationName " +
                  Constants.etiqueta() + " . ")

        query += (TemplatesAgriculture.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")
        return query
Exemple #20
0
    def hectareas_zona(query, municipio) -> str:

        query = query.replace(
            "WHERE", " FROM " + Constants.grafo_hectareas_zona() + " WHERE")

        query += (
            Constants.municipio() +
            " <http://purl.org/linked-data/sdmx/2009/dimension#refArea> " +
            Constants.etiqueta() + " . ")

        query += (TemplatesAragon.create_bif_contains(
            municipio, Constants.etiqueta()) + " . ")

        answerpart = (
            Constants.municipio() +
            " <http://opendata.aragon.es/def/iaest/medida#superficie-has> " +
            Constants.answer0() + " . ")

        query += answerpart

        query += TemplatesAragon.selecting_max_year(
            Constants.grafo_contenedores_vidrio(), answerpart)
        return query