Skip to main content

A SDMX in RDF Turtle 1.1 format parser to generate valid JSON-LD and send to FIWARE Context Brokers using ETSI NGSI-LD.

Project description

SDMX to JSON-LD Parser

Stable Version Issues Apache2.0 License Python Versions Package Status LinkedIn


Logo

SDMX (Turtle) to NGSI-LD (JSON-LD) converter

A SDMX to JSON-LD parser to communicate with FIWARE Context Brokers using ETSI NGSI-LD.
Explore the docs »

View Demo · Report Bug · Request Feature

About The Project

A SDMX in RDF Turtle 1.1 format parser to generate valid JSON-LD and send to FIWARE Context Brokers using ETSI NGSI-LD.

It is based on a EBNF LALR(1) grammar.

This project is part of INTERSTAT. For more information about the INTERSTAT Project, please check the url https://cef-interstat.eu.

(back to top)

Dependencies

The dependencies of the sdmx2jsonld python package are the following:

For more details about the versions of each library, please refer to requirements.txt.

(back to top)

Installing SDMX2JSON-LD and Supported Versions

SDMX2JSON-LD is available on PyPI:

$ python -m pip install sdmx2jsonld

SDMX2JSON-LD officially supports Python 3.10+.

(back to top)

Usage

To execute the python module you can follow the following code to parse the RDF Turtle file to generate the JSON-LD content to be sent to the FIWARE Context Broker:

from sdmx2jsonld.transform.parser import Parser
from sdmx2jsonld.exceptions import UnexpectedEOF, UnexpectedInput, UnexpectedToken

file_in = open("structures-accounts.ttl")
generate_files = True

# Start parsing the file
my_parser = Parser()

try:
    my_parser.parsing(content=file_in, out=generate_files)
except UnexpectedToken as e:
    print(e)
except UnexpectedInput as e:
    print(e)
except UnexpectedEOF as e:
    print(e)

Where:

  • file_in is the RDF Turtle content that can be a string in StringIO class or a read file in TextIOWrapper class.
  • file_out is a boolean variable to indicate if we want to save the JSON-LD parser content into files (True) or we want to show the content in the screen (False).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contact

Fernando López - @flopezaguilar - fernando.lopez@fiware.org

Project Link: https://github.com/flopezag/IoTAgent-Turtle

(back to top)

License

Distributed under the Apache2.0 License. See LICENSE for more information.

(back to top)

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

sdmx2json_ld-1.0.0.tar.gz (39.0 kB view hashes)

Uploaded Source

Built Distribution

sdmx2json_ld-1.0.0-py3-none-any.whl (89.4 kB view hashes)

Uploaded Python 3

Supported by

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