Header Dictionary Triples (HDT) for SWI-Prolog

This repository is work in progress to provide access to HDT files from SWI-Prolog based on the C++ library for these files.

HDT files form a natural addition to SWI-Prolog's memory based RDF store to access large amounts of static background knowledge without enlarging the memory footprint.

This repository is organised as a SWI-Prolog pack. To install it, perform the steps below. Installation and usage is tested on Ubuntu and Fedora. This should work on most Unix-like machines. Installation on Windows requires more creativity though.

Installation

  1. Install a recent version of Serd:
    curl -s http://download.drobilla.net/serd-0.26.0.tar.bz2 | tar -xj && \
      cd serd-0.26.0 && \
      ./waf configure && \
      ./waf && \
      sudo ./waf install;
  2. Install Raptor2. On Fedora: `sudo dnf install raptor2-devel`

    On Ubuntu: `sudo apt-get install libraptor2-dev`

  3. After the prerequisites are installed, the HDT library can be installed from within Prolog using the following command:
    ?- pack_install(hdt).

Usage

If the installation went well, you can load the HDT library with the following command:

?- [library(hdt)].

Status

Usable, but still experimental.

Prolog files

pack.plShow source
prolog/hdt.plShow source
hdt_create_from_file/3Create a HDT file from an RDF file.
hdt_header/4True if <S,P,O> is a triple in the header of HDT.Source
hdt_node/2Enumerate possible values for the individual components of the triples represented in the HDT.Source
hdt_object/2Enumerate possible values for the individual components of the triples represented in the HDT.Source
hdt_object_id/3True if String is mapped to Id in the given role.Source
hdt_open/2Open an existing HDT file and unify HDT with a handle to it.Source
hdt_open/3Open an existing HDT file and unify HDT with a handle to it.
hdt_post_triple/3Perform term->id and id->term translation for triples.Source
hdt_pre_triple/3Perform term->id and id->term translation for triples.Source
hdt_predicate/2Enumerate possible values for the individual components of the triples represented in the HDT.Source
hdt_predicate_id/3True if String is mapped to Id in the given role.Source
hdt_property/2True if Property is a property of HTD.Source
hdt_search/4True if <S,P,O> is a triple in HDT.Source
hdt_search_cost/5Source
hdt_search_id/4True if a triple with the indicated identifiers exists.
hdt_shared/2Enumerate possible values for the individual components of the triples represented in the HDT.Source
hdt_subject/2Enumerate possible values for the individual components of the triples represented in the HDT.Source
hdt_subject_id/3True if String is mapped to Id in the given role.Source
hdt_suggestions/5True when Results is a list of suggestions for Base in the triple role Role.
test/test.plShow source