Object mapping library for manipulating RDF graphs that are compliant with the OpenCitations datamodel.
Project description
oc_ocdm
Documentation can be found here: https://oc-ocdm.readthedocs.io.
oc_ocdm is a Python ≥3.7 library that enables the user to import, produce, modify and export RDF data structures which are compliant with the OCDM v2.0.1 specification.
User's guide
This package can be simply installed with pip:
pip install oc_ocdm
Please, have a look at the quick start guide which is available here.
Developer's guide
First steps
- Install Poetry:
pip install poetry
- Clone this repository:
git clone https://github.com/iosonopersia/oc_ocdm
cd ./oc_ocdm
- Install all the dependencies:
poetry install
- Build the package (output dir:
dist
):
poetry build
- Globally install the package (alternatively, you can also install it inside a virtual-env, by providing the full path to the .tar.gz archive):
pip install ./dist/oc_ocdm-<VERSION>.tar.gz
- If everything went the right way, than you should be able to use the
oc_ocdm
library in your Python modules as follows:
from oc_ocdm.graph import GraphSet
from oc_ocdm.graph.entities.bibliographic import AgentRole
# ...
How to run the tests
Just run the following command inside the root project folder:
poetry run test
How to manage the project using Poetry
See Poetry commands documentation.
AAA: when adding a non-dev dependency via poetry add
, always remember to add
that same dependency to the autodoc_mock_imports
list in docs/source/conf.py
(otherwise "Read the Docs" won't be able to compile the documentation correctly!).
How to publish the package onto Pypi
poetry publish --build
How to generate the documentation
rm ./docs/source/modules/*
sphinx-apidoc -o ./docs/source/modules oc_ocdm *test*
How to build the documentation
Warning! In order to avoid getting the following WARNING: html_static_path entry '_static' does not exist
, you'll
need to manually create an empty _static
folder with the command:
mkdir docs/source/_static
- Always remember to move inside the
docs
folder:
cd docs
- Use the Makefile provided to build the docs:
- on Windows
make.bat html
- on Linux and MacOs
make html
- on Windows
- Open the
build/html/index.html
file with a web browser of your choice!
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.