Skip to main content

A command line tool to convert XBRL taxonomies and instance documents into RDF.

Project description

xbrlld - XBRL to RDF

A Python library for converting XBRL taxonomies and instance documents to RDF (Resource Description Framework).

Installation

pip install xbrlld

Usage

from xbrlld.converter import XBRLtoRDFConverter

converter = XBRLtoRDFConverter()

# Convert taxonomy
converter.convert_taxonomy(
    "https://example.com/taxonomy.xsd",
    "taxonomy.trig"
)

# Convert instance document
converter.convert_instance(
    "https://example.com/report.html",
    "facts.trig",
    with_taxonomy=True
)

Or from the command line:

xbrlld convert taxonomy https://example.com/taxonomy.xsd -o taxonomy.trig
xbrlld convert instance https://example.com/report.html -o facts.trig --with-taxonomy

Output format

The converter produces RDF in TriG format, which supports named graphs. The output includes:

  • SKOS concepts and relationships for taxonomy elements
  • RDF Data Cube observations for facts
  • Dimensional relationships preserved as RDF properties
  • Context information (entity, period, units) as RDF properties

Once converted, a typical fact looks like:

_:Ne675618720094136a2caa1bdad2f6c86 a qb:Observation,
        xbrll:Fact ;
    qb:measureType <http://xbrl.frc.org.uk/fr/2023-01-01/core#Equity> ;
    <http://xbrl.frc.org.uk/fr/2023-01-01/core#Equity> 40288.0 ;
    xbrll:concept <http://xbrl.frc.org.uk/fr/2023-01-01/core#Equity> ;
    xbrll:decimals 0 ;
    xbrll:hasEntity <http://data.companieshouse.gov.uk/doc/company/03886530> ;
    xbrll:period "2024-04-01"^^xsd:date ;
    xbrll:unitRef <http://www.xbrl.org/2003/iso4217#GBP> ;
    xbrll:value 40288.0 .

License

This project is licensed under the MIT License.

References

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

xbrlld-0.1.0.tar.gz (46.4 kB view details)

Uploaded Source

Built Distribution

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

xbrlld-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xbrlld-0.1.0.tar.gz
Algorithm Hash digest
SHA256 559b3569a402f672d14055e0907265db4846c8c59e03feab423977ef8ad2b5ad
MD5 9c15603c3b82a5e59ff604f25ce3ca5f
BLAKE2b-256 43784a1bf514361281a09b324d7c278de9880a2dccd4f7a3f10c2abc51abd55c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for xbrlld-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae1bd432b27c27a81f25b863d4902b3a7adf0d4c047aebc5ce3bed654b397b3b
MD5 889769f9e745f79ace4bfaa32e096bd6
BLAKE2b-256 88d93aa7257c648e98dd19f98b459917f766b882ce3f31a1177ad00a3b3356e8

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