Skip to main content

HDT Format

Read RDF HDT (Header Dictionary Triples) compact stores as subject/predicate/object records.

Overview​

PropertyValue
Format idhdt
ClassHDTIterable
Extensions.hdt
ReadYes
WriteNo
Extrardf (requires the hdt package)
Maturityexperimental

Record shape​

{"subject": "...", "predicate": "...", "object": "..."}

Parameters​

ParameterDescription
subjectTriple pattern filter (default "" = all)
predicateTriple pattern filter
objectTriple pattern filter

Requires a filename path. Streaming via HDTDocument.search_triples().

Usage​

from iterable import open_iterable

with open_iterable("graph.hdt", format="hdt") as source:
for triple in source:
print(triple["subject"], triple["predicate"], triple["object"])

with open_iterable(
"graph.hdt",
format="hdt",
iterableargs={"predicate": "http://xmlns.com/foaf/0.1/name"},
) as source:
for triple in source:
print(triple["subject"], triple["object"])

Install the hdt package (see pip install iterabledata[rdf] for related RDF extras).

Error Handling​

  • Missing dependency: optional libraries raise ImportError with an install hint (pip install 'iterabledata[<extra>]' when an extra exists).
  • Read-only: opening with mode="w" raises WriteNotSupportedError or ValueError.
  • Bad or unsupported input: may raise ValueError, OSError, or library-specific errors.
  • See Troubleshooting for decoding, detection, and engine issues.

See also​