Skip to main content

Read and query HDT document with ease in Python

Project description

pyHDT

Build Status Documentation Status PyPI version

Read and query HDT document with ease in Python

Online Documentation

Requirements

  • pip

  • gcc/clang with c++11 support

  • Python Development headers > You should have the Python.h header available on your system. > For example, for Python 3.6, install the python3.6-dev package on Debian/Ubuntu systems.

Installation

Installation in a virtualenv is strongly advised!

Pip install (recommanded)

pip install hdt

Manual installation

git clone https://github.com/Callidon/pyHDT
cd pyHDT/
./install.sh

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


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.4rc0.tar.gz (179.3 kB view details)

Uploaded Source

Built Distribution

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

hdt-1.0.4rc0-py3.6-linux-x86_64.egg (4.1 MB view details)

Uploaded Egg

File details

Details for the file hdt-1.0.4rc0.tar.gz.

File metadata

  • Download URL: hdt-1.0.4rc0.tar.gz
  • Upload date:
  • Size: 179.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for hdt-1.0.4rc0.tar.gz
Algorithm Hash digest
SHA256 efe0df7aed09be08f216af415612f486506374df74739dfedc160ec9a51322d1
MD5 69edcdabab7b5bce3f03d99747c8ea2d
BLAKE2b-256 cdbee99111e3da802701a1caf09b8158e8c53adb806bb4adb0a6f9cdfaefe631

See more details on using hashes here.

File details

Details for the file hdt-1.0.4rc0-py3.6-linux-x86_64.egg.

File metadata

File hashes

Hashes for hdt-1.0.4rc0-py3.6-linux-x86_64.egg
Algorithm Hash digest
SHA256 b8bf0750fe5952cddde0931c13afca229180a2d447912090f0415966e6083fb1
MD5 87d6c2a0f3c74e1d563948f201405ced
BLAKE2b-256 9bdf8787b314bcd7030eb86d9f8350c0361945e301dcbd8dcd8e68ba37245c4e

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