Read and query HDT document with ease in Python
Project description
pyHDT
Read and query HDT document with ease in Python
Requirements
Installation
Installation in a virtualenv is strongly advised!
Pip install (recommanded)
pip install hdt
Quick install
curl https://github.com/Callidon/pyHDT/blob/master/install.sh -sSf | sh
Manual installation
git clone --recursive https://github.com/Callidon/pyHDT cd pyHDT/ pip install -r requirements.txt python setup.py install
Getting started
from hdt import HDTDocument
# Load an HDT file. Missing indexes are generated automatically
document = HDTDocument("test.hdt")
# Display some metadata about the HDT document itself
print("nb triples: %i" % document.get_total_triples())
print("nb subjects: %i" % document.get_nb_subjects())
print("nb predicates: %i" % document.get_nb_predicates())
print("nb objects: %i" % document.get_nb_objets())
print("nb shared subject-object: %i" % document.get_nb_shared())
# Fetch all triples that matches { ?s ?p ?o }
# Use empty strings ("") to indicates variables
(triples, cardinality) = document.search_triples("", "", "")
print("cardinality of { ?s ?p ?o }: %i" % cardinality)
for triple in triples:
print(triple)
# Search also support limit and offset
(triples, cardinality) = document.search_triples("", "", "", limit=10, offset=100)
# etc ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hdt-1.0.4.tar.gz
(179.5 kB
view hashes)
Built Distributions
Close
Hashes for hdt-1.0.4-py3.6-linux-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c497f7bfd2fd39b96a86cae99eb251e15e6df440e341f782a354f5c17a7d43c |
|
MD5 | b7037b413cd09792e36af3c486fa05a6 |
|
BLAKE2b-256 | 1d49fc38f4b17361e60394974cd8c58d30eb866bfce974c94b9a6ab17192fdfe |
Close
Hashes for hdt-1.0.4-py2.7-linux-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0f5e6b16b7e177f003619e0db3dadd4ff268aa0c38fed3c890f755b9dffb3e8 |
|
MD5 | bc01db42fadd7f1b6505a107ada5f67b |
|
BLAKE2b-256 | 69e3c8da67721218f08a3db0df0d390064873cb7f4090b3f568be005e005341b |