Skip to main content

Biblioteca para la migración de datos de GeoNames a vocabularios controlados en formato SKOS y texto etiquetado. Garantiza la generacion de archivos JSON, CSV con los datos completos de los lugares de geonames segun se le pase un txt con los datos en crudo que proprociona GeoNames. Tambien los puede exportar a formato de texto etuiquetado y rdf:skos para poder importar los loguares y sus nombres alternativos a un vocabulario controlado como por ejemplo TemaTres

Project description

GeoTesuario

GeoTesuario es una biblioteca de Python diseñada para facilitar la migración de datos geográficos desde los archivos de texto plano proporcionados por GeoNames a formatos estructurados como JSON, CSV, texto etiquetado y RDF SKOS. Esto permite integrar estos datos en vocabularios controlados como TemaTres.

Características

  • Exportación a JSON: Convierte los datos de GeoNames a un archivo JSON estructurado.
  • Exportación a CSV: Genera un archivo CSV con los datos organizados en columnas.
  • Exportación a texto etiquetado: Crea un archivo de texto etiquetado compatible con TemaTres.
  • Exportación a RDF SKOS: Genera un archivo RDF SKOS para vocabularios controlados, con soporte para términos y nombres alternativos.

Instalación

  1. Clona este repositorio:
    git clone https://github.com/tu_usuario/GeoTesuario.git
    
  2. Navega al directorio del proyecto:
    cd GeoTesuario
    
  3. Instala la biblioteca:
    pip install .
    

Uso

1. Clase Migration

La clase Migration permite transformar los datos de GeoNames a formatos JSON, CSV y texto etiquetado.

Ejemplo de uso:

from GeoTesuario import Migration

# Inicializa la migración
migration = Migration("geonames_data.txt")

# Exporta a JSON
migration.exportToJSON("output.json")

# Exporta a CSV
migration.exportToCSV("output.csv")

# Exporta a texto etiquetado
migration.exportToTaggedText("output.txt")

2. Clase SkosMigration

La clase SkosMigration extiende Migration y permite exportar los datos a un formato RDF SKOS.

Ejemplo de uso:

from GeoTesuario import SkosMigration

# Inicializa la migración SKOS
skos_migration = SkosMigration("geonames_data.txt", scheme_uri="http://example.org/vocab")

# Exporta a SKOS
skos_migration.exportToSKOS("Mi Vocabulario", "output.rdf")

Estructura del Proyecto

GeoTesuario/
├── GeoTesuario/
│   ├── __init__.py          # Inicialización del paquete
│   ├── Migration.py         # Clase base para la migración de datos
│   └── SkosMigration.py     # Clase para la exportación a RDF SKOS
├── LICENSE                  # Licencia MIT
├── README.md                # Documentación del proyecto
├── setup.py                 # Configuración para PyPI
└── .gitignore               # Archivos y carpetas ignorados por Git

Detalles Técnicos

Clase Migration

  • Métodos principales:

    • exportToJSON(path): Exporta los datos a un archivo JSON.
    • exportToCSV(path): Exporta los datos a un archivo CSV.
    • exportToTaggedText(path): Exporta los datos a un archivo de texto etiquetado.
  • Transformaciones:

    • Convierte nombres alternativos en listas.
    • Reemplaza comas en los datos por punto y coma para evitar conflictos en CSV.

Clase SkosMigration

  • Métodos principales:

    • createConceptScheme(scheme_name): Crea el esquema principal del vocabulario SKOS.
    • createConcept(geonameid, name, alternatenames, base_concept_uri): Crea un concepto SKOS con términos y nombres alternativos.
    • exportToSKOS(scheme_name, output_file): Exporta los datos a un archivo RDF SKOS.
  • Detalles:

    • Utiliza xml.etree.ElementTree para generar estructuras XML.
    • Formatea el XML con xml.dom.minidom para hacerlo legible.

Requisitos

  • Python 3.6 o superior.

Licencia

Este proyecto está licenciado bajo la Licencia MIT. Consulta el archivo LICENSE para más detalles.

Contribuciones

¡Las contribuciones son bienvenidas! Si deseas mejorar esta biblioteca, por favor abre un issue o envía un pull request.

Contacto

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geotesuario-1.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geotesuario-1.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file geotesuario-1.1.0.tar.gz.

File metadata

  • Download URL: geotesuario-1.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geotesuario-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9289653a7ccf2a8ced55a003d58dd5aca55785a7ff2f553a8b7247c51d1bb270
MD5 89e06262489860eadc01b68a86c28c47
BLAKE2b-256 e46d4765f48f879c70a2f72505fb5346dccfc827b4c0cb66d90c03bf48c24d7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for geotesuario-1.1.0.tar.gz:

Publisher: publish.yml on Yorjandy/geo_tesuario

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geotesuario-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: geotesuario-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geotesuario-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e1e90c5ec6e13097f4e4a54d17ec5bbe894657538fbe22c0fb964c237328f28
MD5 efa43b0adffd166d6fd1186fd43f3a22
BLAKE2b-256 120a6e6c25fce7112c5cc45e5be9d32c789137aae02a8bab1bbd099421e963c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for geotesuario-1.1.0-py3-none-any.whl:

Publisher: publish.yml on Yorjandy/geo_tesuario

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page