Skip to main content

No project description provided

Reason this release was yanked:

incoplete build

Project description

About:

  • Parses CIM RDF/XML data to pandas dataframe with 4 columns [ID, KEY, VALUE, INSTANCE_ID] (triplestore like)
  • The solution does not care about CIM version nor namespaces
  • Input files can be xml or zip files (containing one or mutiple xml files)
  • All files are parsed into one and same Pandas DataFrame, thus if you want single file or single data model, you need to filter on INSTANCE_ID column

Documentation:

https://haigutus.github.io/triplets

To get started:

# Core (python_lxml_pandas engine, no extra deps)
pip install triplets

# With pyarrow (enables python_lxml_arrow + cython_pugixml_arrow engines, ~12x faster)
pip install triplets[arrow]
import pandas
import triplets

path = "CGMES_v2.4.15_RealGridTestConfiguration_v2.zip"
data = pandas.read_RDF([path])

Result:

image

You can then query a dataframe of all same type elements and its parameters across all [EQ, SSH, TP, SV etc.] instance files, where parameters are columns and index is object ID-s

data.type_tableview("ACLineSegment")

image

Export:

data.export_to_cimxml(
    rdf_map=schemas.ENTSOE_CGMES_2_4_15_552_ED1,
    export_type=ExportType.XML_PER_INSTANCE_ZIP_PER_XML,
)

Look into examples folders for more

Parser engines

Three parser engines with automatic fallback (fastest available):

Engine Install Speed
python_lxml_pandas pip install triplets 1x baseline, always works
python_lxml_arrow pip install triplets[arrow] ~1x, better interop
cython_pugixml_arrow pip install triplets[arrow] (included in wheels) 12x faster

The cython_pugixml_arrow engine is a compiled C++ extension included in published wheels. It requires pyarrow at runtime, so install with triplets[arrow] to enable it.

The cython engine is pre-built in published wheels — no compilation needed.

Polars

import polars
import triplets

data = polars.read_rdf(["grid_EQ.xml", "data.zip"])   # returns polars DataFrame

data.triplets.types_dict()
data.triplets.type_tableview("ACLineSegment")
data.triplets.filter_triplets(KEY="Type", VALUE=".*Generator.*", regex=True)
data.triplets.export_to_csv(export_to_memory=True)
data.triplets.export_to_nquads("/tmp/output.nq")

DuckDB

import duckdb
import triplets

data = duckdb.connect()                              # in-memory
data = duckdb.connect("grid.duckdb")                 # persistent (no re-parsing next session)

data.read_rdf(["grid_EQ.xml", "data.zip"])           # parse via Arrow (zero-copy into DuckDB)
data.types_dict()                                     # → dict
data.type_tableview("ACLineSegment").df()             # → pandas DataFrame
data.type_tableview("ACLineSegment").pl()             # → polars DataFrame
data.filter_triplets(KEY="Type", VALUE=".*Sub.*", regex=True).df()
data.filter_by_type("Terminal").df()
data.references_to("some-uuid").df()
data.export_to_nquads("/tmp/output.nq")

# Direct SQL (full DuckDB SQL on the triplets table)
data.sql("SELECT VALUE, COUNT(*) FROM triplets WHERE KEY = 'Type' GROUP BY VALUE").df()

Accessor namespace

All engines share the same df.triplets.* accessor:

data.triplets.type_tableview("ACLineSegment")
data.triplets.types_dict()
data.triplets.filter_triplets(KEY="Type")
data.triplets.export_to_excel(export_to_memory=True)
data.triplets.export_to_nquads("/tmp/output.nq")

CLI tools

cim-spreadsheet -i model.xml -o output.xlsx
cim-diff original.xml modified.xml

Performance (RealGrid, 1.14M rows)

Operation pandas polars DuckDB
Parse (cython engine) 128ms 156ms 283ms
type_tableview 72ms 21ms 53ms
filter_by_type 103ms 9ms 50ms
types_dict 21ms 11ms 18ms

The old rdf_parser.py functions still work but emit deprecation warnings.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

triplets-0.1.0rc2-cp313-cp313-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.13Windows x86-64

triplets-0.1.0rc2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

triplets-0.1.0rc2-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (4.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

triplets-0.1.0rc2-cp313-cp313-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

triplets-0.1.0rc2-cp312-cp312-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.12Windows x86-64

triplets-0.1.0rc2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

triplets-0.1.0rc2-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (4.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

triplets-0.1.0rc2-cp312-cp312-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

triplets-0.1.0rc2-cp311-cp311-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.11Windows x86-64

triplets-0.1.0rc2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

triplets-0.1.0rc2-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (4.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

triplets-0.1.0rc2-cp311-cp311-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file triplets-0.1.0rc2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 54839078354eb5c7239b61b10b712f23b76afd8b557405e2a5fea6b90c8bc84c
MD5 fd4f68103a1c6029ae43e5bb8f8ef225
BLAKE2b-256 e46b2199a4e7956819a96c7544cad81e1a31c907bc28b4793633ba4985b32340

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp313-cp313-win_amd64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3e480729d6da5f154b4dfeb910b671af040a8c4611d89d11ea446ad9e226cb7
MD5 e00ce2f695263bae7a11af493bb3af51
BLAKE2b-256 ddaf937964d694e56153c531f762316e9b993f8ee6fa5ce08eaf8aab06a09f24

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6a1459c227cd5593d17e6d105690ab7f4fb6cc8107f558f5c71421618eb8aff3
MD5 c0d76620b4e3c22e59f76a49f8a25da2
BLAKE2b-256 0d74277e33e7e8ac55d8f0d719e111ffcbc2564d9cbbb0995c1597e5c2ec9dd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6d198d0b4fe3b8de205896fb72a1c7580fdb9d5562742ad7e02146fa5b78fe6b
MD5 b8881e11c28a931a06d97c3fcd5a0475
BLAKE2b-256 5173b91e7e878ad5899daa519d95520c4dd61c0c492fe98436e215a788ef67ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 beb33856bea5fcf83ea2fe4277e6a671f6409ea978e8b91f7c4b53ff7015a2fc
MD5 d8d8e0f898076f9e144f3ae2231afdea
BLAKE2b-256 0a130eedd5b23483a4b16f635dfcf12212c642192d519fa0754f31652f19bfc1

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp312-cp312-win_amd64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 55ae821adf36406225296bbeba0bc4bb8169c7d151e10ecc39467df073aecf09
MD5 f970aed5416d03b43a7f7e21576a665e
BLAKE2b-256 4ee5cc0c84b3c9316962514ad680eb818e7f78e1bf7cbedf279ac44d15889e81

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 68e95c21038b49bf4f4a4d3c61cba50b7b35021af77ddc4fcf2c5d0b9dbba3b0
MD5 b7c8556c59fec77b00a6178a467bd46b
BLAKE2b-256 bc8b18e8f0bee5ae5ca37dc4c6ecbc549617fec543006c0ba34d38ad0e5fb7ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efb50b875c609dfb6ff82d25546601f468f9ca0d59156612e017972385aeb47f
MD5 826586374804d7b533dd9b2540f24803
BLAKE2b-256 9e2147aa2797d83412ed177ad6564016eb9fa824e71e09a40c47f34a8bd89fd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7cae48e507584d1581e08b35a718d75b142d814ac9e76c6da16b994e69a91c9e
MD5 a25fa46c003e845baee60590579f7ed5
BLAKE2b-256 88642f6fa590204c286867850bfeadbf040166d7a9cc89c807b32251358e185f

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp311-cp311-win_amd64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 27c535123eb5899aaa82709ceaddd8705ade04c2008d00c29c2d9c84aa92fe7a
MD5 e568bbe512b35d57ac8cc11022a7c35c
BLAKE2b-256 921bc7c38ae3d1fa679fa771f209e58ad9f1c9fe3922a5f1b5f9b99f1219f9f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 03607359b273e5f82814c3c2d53ec359a11b63d46dd5ef828fdb6b11e1c39055
MD5 228360932707abd589d5b215f83060cf
BLAKE2b-256 83f5ff3b69fdd4aa6ff04a1993163d6e2bfc87480b98ce4e7629aeaed36d5ca3

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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

File details

Details for the file triplets-0.1.0rc2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for triplets-0.1.0rc2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41a930c712df8106a5c217e0c4fdbcb464f84d3dc18171da575fc22e9782c043
MD5 fb1608829af751b27da2413d737145c2
BLAKE2b-256 14ab24e920115c7253cbff1ee14a71fa437659b42deb742784abc662500b3182

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplets-0.1.0rc2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build-wheels.yml on Haigutus/triplets

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