Skip to main content

A Python tool for converting CSV data into RDF using the DSV ontology

Project description

🚀 pyDSV: A Python tool for converting CSV data into RDF using the DSV ontology 🚀

pyDSV is a lightweight Python package that transforms CSV files into RDF (JSON-LD format) using the DSV (DataSet-Variable Ontology) ontology. It enables structured and semantic representation of restricted access tabular data, making it more interoperable and machine-readable.


🧠 About the DataSet-Variable Ontology

This package creates RDF graphs following the DataSetVariable Ontology, a formal vocabulary designed for representing restricted access datasets and their metadata. The ontology was introduced in a peer-reviewed research publication:

Publication: Advancing data sharing and reusability for restricted access data on the Web: introducing the DataSet-Variable Ontology
GitHub Repository: github.com/ritamargherita/DataSet-Variable-Ontology


🔧 Features

  • ✅ Validates and loads CSV files into pandas DataFrames
  • ✅ Checks for malformed headers or inconsistent rows
  • ✅ Converts tabular data into RDF triples using rdflib
  • ✅ Outputs RDF data in JSON-LD format
  • ✅ Easy-to-use Python API

📦 Installation

Install via pip:

pip install pyDSV

Or install directly from source:

git clone https://github.com/ritamargherita/pyDSV
cd pyDSV
pip install .

🐍 Python API Usage

```python
from pyDSV.csvLoader import CSVLoader
from pyDSV.dsvTransformer import DSVTransformer

# Load CSV
loader = CSVLoader("data/example.csv")

# Transform to RDF
transformer = DSVTransformer(loader.df, "Covid19Dataset", "Public Health", output_file="output.jsonld")
```

You can also access the RDF graph directly:

```python
graph = transformer.get_graph()
print(graph.serialize(format="turtle"))
```

📁 Project Structure

pyDSV/ ├── pyDSV/ │ ├── init.py │ ├── csvLoader.py │ └── dsvTransformer.py ├── tests/ ├── LICENSE ├── pyproject.toml ├── README.md └── workflow.yml


👩‍💻 Author

Created by Margherita Martorana — feedback and contributions are welcome!


📚 How to Cite

If you use pyDSV in your research or project, please cite the following:

Margherita Martorana. pyDSV: A Python tool for converting CSV data into RDF using the DSV ontology. Version 0.1.0. GitHub Repository: https://github.com/ritamargherita/pyDSV

```bibtex
@misc{martorana2025pydsv,
  author       = {Margherita Martorana},
  title        = {pyDSV: A Python tool for converting CSV data into RDF using the DSV ontology},
  year         = {2025},
  howpublished = {\url{https://github.com/ritamargherita/pyDSV}},
  note         = {Version 0.1.0}
}
```

Related Publication
If your work is based on or contributes to the DSV Ontology, also cite the following paper:

M. Martorana et al. Advancing data sharing and reusability for restricted access data on the Web: introducing the DataSet-Variable Ontology. K-CAP ’23, December 05–07, 2023, Pensacola, FL, USA. DOI

```bibtex
@inproceedings{martorana2023advancing,
  title={Advancing data sharing and reusability for restricted access data on the Web: introducing the DataSet-Variable Ontology},
  author={Martorana, Margherita and Kuhn, Tobias and Siebes, Ronald and Van Ossenbruggen, Jacco},
  booktitle={Proceedings of the 12th Knowledge Capture Conference 2023},
  pages={83--91},
  year={2023}
}
```

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

pyDSV-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

pyDSV-0.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file pyDSV-0.1.0.tar.gz.

File metadata

  • Download URL: pyDSV-0.1.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pyDSV-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c4537afa66293069e57a5f1d68d223af3207d67bc0cf6ca250351849f23f1cf7
MD5 e86b02cb96612fb4b9b8f334ebaf52ad
BLAKE2b-256 0bca7f36215fb3c6111eb2076734d1cafac5b61a31d2a2f9342b2a68489569f9

See more details on using hashes here.

File details

Details for the file pyDSV-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyDSV-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pyDSV-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 113872c564ca8e381b6a0895925618a5d76bd9382f003e7a0b4706a4b2fc940a
MD5 c3944adbb3699b2bca59b1c56ba0f192
BLAKE2b-256 ac8b39c33873b8164cb3566a7ede8227d4c9cb0e9a2dff70df702a2dd6d52dcb

See more details on using hashes here.

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