Example #1
0
    def year_dataset_max(query, cadena) -> 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() + " . ")

        try:
            if int(cadena) > 1900:
                query += (TemplatesAragon.create_filter_regex_var(
                    "STRDT(" + str(cadena) + ", xsd:string)",
                    Constants.fecha()) + " . ")
        except:
            query += (TemplatesAragon.create_filter_regex_var(
                "STRDT(" + Constants.year_max() + ", xsd:string)",
                Constants.fecha()) + " . ")

        return query
Example #2
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