Skip to content

A python library binding of the c++ library tada-hdt-entity

License

Notifications You must be signed in to change notification settings

oeg-upm/pytada-hdt-entity

Repository files navigation

pytada-hdt-entity

Build Status codecov DOI Python 3.6

A python library binding of the c++ library tada-hdt-entity

Install

Not that to install pytada-hdt-entity, you don't need to perform the swig build as this is already done by the authors. All you need is the files in this repository and the depedencies.

Prerequisites to install

  1. hdt-cpp
  2. tabular_parser
  3. easy_logger
  4. tada_hdt_entity

Install via pip

pip install git+https://github.com/oeg-upm/pytada-hdt-entity.git

Build and Compile

sh scripts/compile.sh  

Install prerequisites via a script

These are included in compile.sh

  • For debian and ubuntu: install-script
  • For other linux distro and macOS: use the debian script but update it with the equivalent command to install prerequisite packages

To update the python library (from the updated c++ source code library)

  1. You need to setup the following environment variables: You might not need this in the newer versions
    • export project_dir='.' (or the directory of the c++ source code)
    • export LC_ALL=en_US.UTF-8 (needed for mac)
    • export LANG=en_US.UTF-8 (needed for mac)
  2. Generate the interface files:
    • invoke copyc (only if you need to copy the source files to the current folder. If you copy the c++ files to this directory, you do not need to do it). Note that you need to setup the environment variable project_dir to point to the tada-hdt-entity directory.
  3. Copy the python files into the package:
    • invoke copypy Copy the generated python files to tada_hdt_entity
  1. Update setup.py with the new version of the library

Prerequisites to build (from source)

  1. SWIG (to handle .i files)
  2. HDT lib
  3. tabular_parser lib
  4. easy_logger lib
  5. tada_hdt_entity lib

Install SWIG

MacOS via brew

brew install swig

To cite

@software{alobaid_ahmad_2020_3764190,
  author       = {Alobaid, Ahmad and
                  Corcho, Oscar},
  title        = {pytada-hdt-entity},
  month        = apr,
  year         = 2020,
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.3764190},
  url          = {https://doi.org/10.5281/zenodo.3764190}
}

Run tests

  1. Generate test.hdt.
    1. cd pytada-hdt-entity/test_files
    2. ~/hdt-cpp/libhdt/tools/rdf2hdt test.ttl test.hdt (change the location to point to the hdt-cpp).
  2. Run test cases.
    1. Return back to the pytada-hdt-entity folder cd ...
    2. python -m unittest discover.

Known Issues

  • library not found. ld: library not found for -ltabularparser (on Mac) when running python setup.py build_ext --inplace.

Solution: Run export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib before running python setup.py build_ext --inplace.

  • library linking error
In file included from graph.cpp:1:
./graph.h:8:10: fatal error: 'easy_logger/easy_logger.h' file not found
#include <easy_logger/easy_logger.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
``` (Mac)

About

A python library binding of the c++ library tada-hdt-entity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages