Skip to main content

Tools for converting, merging, persisting and reading RDF data in different formats.

Project description

rdfx

A small Python utility to convert, merge, and read/persist RDF data in different formats, across different "persistence systems".

How to Use

The command line utility covers merge and conversion functionality, and simplifies certain aspects of this. The

Python

Run the rdfx.py script with Python having installed the packages required by requirements.txt.

BASH (Linux, Mac etc)

To utilise the command line util run: python rdfx.py *args

To convert a file:
python rdfx.py convert myfile.ttl -f nt -o output_dir
For multiple files:
python rdfx.py convert myfile1.ttl myfile2.ttl -f nt -o output_dir
A directory of files:
python rdfx.py convert files_dir -f nt -o output_dir
To merge multiple files:
python rdfx.py merge myfile1.ttl myfile2.ttl -f nt -o output_dir
To merge a directory of files:
python rdfx.py merge files_dir -f nt -o output_dir
To remove sort and remove unused prefixes in a turtle file: python rdfx.py clean myfile.ttl

To simplify usage of the command line utility at present, the following behaviour has been set:

Type Output Filenames
Merge merged.{format}
Convert file1.{format} file2.{format} ...

That is, when merging, the output filename will be "merged", with the correct file format. When converting, the output filename will be the same as the input filename, with the correct file format. This behaviour simplifies input to the command line util, allowing multiple files and directories to be input without confusion as to which specified filenames are for input or output, and mappings between input and output, especially directories or multiple files are converted/merged.

The python utilities behind the command line tool can be configured to set user specified filenames, for these cases use Python.

Command line tool documentation

These usage notes come from running the help command in the tool, e.g. python rdfx.ph -h:

usage: rdfx.py [-h] [--format {ttl,turtle,json,json-ld,jsonld,owl,xml,rdf,nt,n3}] [-o OUTPUT] [--comments COMMENTS] {convert,merge} data [data ...]

positional arguments:
  {convert,merge}
  data                  Path to the RDF file or directory of files for merging or conversion.

optional arguments:
  -h, --help            show this help message and exit
  --format {ttl,turtle,json,json-ld,jsonld,owl,xml,rdf,nt,n3}, -f {ttl,turtle,json,json-ld,jsonld,owl,xml,rdf,nt,n3}
                        The RDFlib token for the RDF format you want to convert the RDF file to.
  -o OUTPUT, --output OUTPUT
                        if set, the output location for merged or converted files, defaults to the current working directory
  --comments COMMENTS   Comments to prepend to the RDF, turtle only.

License

LGPL - see the LICENSE file for details

Dependencies

This uses RDFlib.

Contact

Original library:
Nicholas J. Car
Data Systems Architect
SURROUND Australia Pty Ltd
nicholas.car@surroundaustralia.com
GitHub: nicholascar
ORCID: https://orcid.org/0000-0002-8742-7730

Updates around persistence systems:
David Habgood
Application Architect
SURROUND Australia Pty Ltd
david.habgood@surroundaustrlaia.com
GitHub: nicholascar
https://orcid.org/0000-0002-3322-1868

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

rdfx-0.4.7.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

rdfx-0.4.7-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file rdfx-0.4.7.tar.gz.

File metadata

  • Download URL: rdfx-0.4.7.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.7.4 Linux/5.8.0-63-generic

File hashes

Hashes for rdfx-0.4.7.tar.gz
Algorithm Hash digest
SHA256 1515719add193364f88f8f88a7b1484499ea736f57bff6541bcc12f38dd94194
MD5 b236ddbd298a193d5549de8084e24327
BLAKE2b-256 ad74b4b8312cffe1f78a794b4d6f650afff6bdf0c4a9e375273f025556aeaf54

See more details on using hashes here.

Provenance

File details

Details for the file rdfx-0.4.7-py3-none-any.whl.

File metadata

  • Download URL: rdfx-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.7.4 Linux/5.8.0-63-generic

File hashes

Hashes for rdfx-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 19ffcb112c76e8af022e3034e24862a630d35bfbd6960c5137acd2abd1fc9f84
MD5 fa46c733388addc5905d38523c3133a9
BLAKE2b-256 4c42a6127cb2a5c975731a56b7f6bb90b70daf7e36bd1bc2aae36cc925db0cc2

See more details on using hashes here.

Provenance

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