{"id":23370121,"url":"https://github.com/maastrichtu-ids/knowledge-collaboratory-api","last_synced_at":"2026-04-26T22:31:53.607Z","repository":{"id":92532524,"uuid":"309723391","full_name":"MaastrichtU-IDS/knowledge-collaboratory-api","owner":"MaastrichtU-IDS","description":"💬 Translator Standard APIs for the Knowledge Collaboratory (nanopublications)","archived":false,"fork":false,"pushed_at":"2022-03-15T14:29:36.000Z","size":614,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T00:41:38.600Z","etag":null,"topics":["kgx","nanopublications","openapi","sparql-endpoints","translator"],"latest_commit_sha":null,"homepage":"https://api.collaboratory.semanticscience.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MaastrichtU-IDS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-03T15:09:00.000Z","updated_at":"2022-03-05T17:35:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"41ed82b1-0175-491a-9e9f-656537463332","html_url":"https://github.com/MaastrichtU-IDS/knowledge-collaboratory-api","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/MaastrichtU-IDS/knowledge-collaboratory-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaastrichtU-IDS%2Fknowledge-collaboratory-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaastrichtU-IDS%2Fknowledge-collaboratory-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaastrichtU-IDS%2Fknowledge-collaboratory-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaastrichtU-IDS%2Fknowledge-collaboratory-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaastrichtU-IDS","download_url":"https://codeload.github.com/MaastrichtU-IDS/knowledge-collaboratory-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaastrichtU-IDS%2Fknowledge-collaboratory-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32315711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T21:09:39.134Z","status":"ssl_error","status_checked_at":"2026-04-26T21:09:21.240Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kgx","nanopublications","openapi","sparql-endpoints","translator"],"created_at":"2024-12-21T15:33:57.694Z","updated_at":"2026-04-26T22:31:53.590Z","avatar_url":"https://github.com/MaastrichtU-IDS.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![TRAPI version](https://img.shields.io/badge/TRAPI-v1.1.0-blueviolet)](https://github.com/NCATSTranslator/ReasonerAPI) [![Test production API](https://github.com/MaastrichtU-IDS/knowledge-collaboratory-api/actions/workflows/run-tests-prod.yml/badge.svg)](https://github.com/MaastrichtU-IDS/knowledge-collaboratory-api/actions/workflows/run-tests-prod.yml)\n\nThis repository provides guidelines to publish Nanopublications as a user with the Nanobench, and query the published Nanopublications network as a researcher searching for answers 💬\n\nServices has been been deployed publicly to query the Nanopublications network using Translator standards to retrieve the Knowledge Collaboratory graph, a collection of drug indications annotated using preferred identifiers (usually from MONDO, CHEBI, DrugBank, etc).\n\nCheck the **Translator Reasoner API** to query the Nanopublications network SPARQL endpoint at\n\n**[🔗 https://api.collaboratory.semanticscience.org](https://api.collaboratory.semanticscience.org)**\n\n* Supports [Translator Reasoner API](https://github.com/NCATSTranslator/ReasonerAPI) `1.1.0`\n* Include operation to retrieve the Knowledge Collaboratory nanopublications in the [`kgx`](https://github.com/biolink/kgx) format\n\n## The Knowledge Collaboratory concept\n\n![PSKG](PSKG-knowledge_collaboratory.png)\n\n## Publish Nanopublications\n\n### Publish with the Nanobench UI\n\nRequirements: [Java 8+](https://openjdk.java.net/install/)\n\nUse the [Nanobench 🛋️](https://github.com/peta-pico/nanobench) to publish and explore nanopublications using a convenient web UI.\n\nDownload the latest release of the `nanobench.zip` file from GitHub: https://github.com/peta-pico/nanobench/releases/tag/nanobench-1.19\n\nUnzip the file, and put the jar file in a convenient folder (at `~/.nanopub/nanobench.jar` for example, to be able to call it from anywhere easily)\n\n\u003e Visit the [complete nanobench installation instructions](https://github.com/peta-pico/nanobench/blob/master/INSTALL.md) for more details.\n\nRun the Nanobench on http://localhost:37373. It will use the `ids_rsa` key in the `.nanopub` folder to authenticate, or guide you to generate one:\n\n```bash\njava -jar ~/.nanopub/nanobench.jar -httpPort 37373 -resetExtract\n```\n\nSee also:\n\n* Check the [vemonet/nanobench wiki](https://github.com/vemonet/nanobench/wiki/Add-an-evidence-to-an-association) to get a full tutorial to publish associations!\n* Templates for the Translator (e.g. \"Defining a biomedical association with its context\") can be seen and improved in [the MaastrichtU-IDS/nanobench-templates GitHub repository](https://github.com/MaastrichtU-IDS/nanobench-templates/tree/master/templates/translator).\n\n### Publish a spreadsheet as nanopublications\n\nCheck the [BioLink JSON-LD Context file](https://github.com/biolink/biolink-model/blob/master/context.jsonld) to find ontologies supported by the Translator (for better integrations with other Translator tools)\n\nCheckout the [`src/nanopubs/drug_indications_from_gdocs.py`](https://github.com/MaastrichtU-IDS/knowledge-collaboratory-api/blob/master/src/nanopubs/drug_indications_from_gdocs.py) file to see an example for publishing drug indications from a gdocs spreadsheet as Nanopublications using the BioLink model\n\n1. Clone this repository:\n\n```bash\ngit clone https://github.com/MaastrichtU-IDS/knowledge-collaboratory-api\ncd knowledge-collaboratory-api\n```\n\n2. Install the required dependencies:\n\n```bash\npip3 install -r requirements.txt\n```\n\n3. Test the script to generate nanopubs from the gdoc spreadsheet, and inspect the RDF generated:\n\n```bash\npython3 src/nanopubs/drug_indications_from_gdocs.py\n```\n\nWhen you are ready, you can run and publish each row of the spreadsheet as a nanopublication:\n\n```bash\npython3 src/nanopubs/drug_indications_from_gdocs.py --publish --count 10\n```\n\n## Query the Collaboratory API\n\nOverview of the different operations available in the Knowledge Collaboratory Translator Reasoner API (supporting `kgx`)\n\n### Query operation\n\nThe user sends a [ReasonerAPI](https://github.com/NCATSTranslator/ReasonerAPI) query to the Knowledge Collaboratory Nanopublications in the BioLink format (e.g. drug indications). The query is a graph with nodes and edges defined in JSON, and uses classes from the [BioLink model](https://biolink.github.io/biolink-model).\n\n### Predicates operation\n\nThe `/predicates` operation will return the entities and relations provided by this API in a JSON object (following the [ReasonerAPI](https://github.com/NCATSTranslator/ReasonerAPI) specifications).\n\n### Kgx operation\n\nExperimental, the `/kgx` operation will return the complete Knowledge Collaboratory drug indications in [KGX](https://github.com/biolink/kgx) TSV format (in a `.zip` file)\n\n## Current resources in the Collaboratory\n\n* Drugs indications from the [PREDICT publication](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3159979/)\n\n* Drugs indications from the [NeuroDKG](https://github.com/MaastrichtU-IDS/neuro_dkg/), and off-label drug indications\n\n## Deploy the Knowledge Collaboratory API 🚀\n\nStarts the **Translator Reasoner API to query the Nanopublications SPARQL endpoint**\n\n* Query the Knowledge Collaboratory Nanopublications (drug indications in the BioLink format) using the [ReasonerAPI](https://github.com/NCATSTranslator/ReasonerAPI) standards and [KGX](https://github.com/biolink/kgx)\n  * Supports [Translator Reasoner API](https://github.com/NCATSTranslator/ReasonerAPI) `1.1.0` \n  * Include operation to retrieve the Knowledge Collaboratory nanopublications in the `kgx` format\n  * The TRAPI-SPARQL interface and `kgx` transformer are implemented in Python in the `src/` folder\n* OpenAPI 3 with Swagger UI, built in Python using [zalando/connexion](https://github.com/zalando/connexion)\n\nAvailable at **[https://api.collaboratory.semanticscience.org 🔗](https://api.collaboratory.semanticscience.org)**\n\nStarts the **Translator Reasoner API to query the Nanopublications SPARQL endpoint**, supporting `kgx` and TRAPI `1.1.0` (defined in this repo in `src/`)\n\n\u003e Requires [Python 3.8+](https://www.python.org/downloads/) and [pip](https://pip.pypa.io/en/stable/installing/)\n\nClone the repository first\n\n```bash\ngit clone https://github.com/MaastrichtU-IDS/knowledge-collaboratory-api.git\ncd knowledge-collaboratory-api\n```\n\n### Start the API locally 🛩️\n\nInstall dependencies\n\n```bash\npip3 install -e .\n```\n\n\u003e If you are facing conflict with already installed packages, then you might want to use a [Virtual Environment](https://docs.python.org/3/tutorial/venv.html) to isolate the installation in the current folder before installing knowledge-collaboratory-api:\n\u003e\n\u003e ```bash\n\u003e # Create the virtual environment folder in your workspace\n\u003e python3.8 -m venv .venv\n\u003e # Activate it using a script in the created folder\n\u003e source .venv/bin/activate\n\u003e ```\n\nStart the API in **production** mode on http://localhost:8808:\n\n```bash\nuvicorn src.main:app --port 8808\n```\n\nOr start the API in **debug** mode (the API will be reloaded automatically at each change to the code):\n\n```bash\nuvicorn src.main:app --port 8808 --reload\n```\n\n\u003e  Check [CONTRIBUTING.md](/CONTRIBUTING.md) for more details on how to run the API locally and contribute.\n\n### Start with Docker 🐳\n\nRequirements: [Docker](https://docs.docker.com/get-docker/).\n\nBuild and start the container with [docker-compose 🐳](https://docs.docker.com/compose/)\n\n```bash\ndocker-compose up -d --build\n```\n\n\u003e Access the Swagger UI at [http://localhost:8808](http://localhost:8808)\n\n\u003e We use [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) and [docker-letsencrypt-nginx-proxy-companion](https://github.com/nginx-proxy/docker-letsencrypt-nginx-proxy-companion) as reverse proxy for HTTP and HTTPS in production. You can change the proxy URL and port via environment variables `VIRTUAL_HOST`, `VIRTUAL_PORT` and `LETSENCRYPT_HOST` in the [docker-compose.yml](https://github.com/MaastrichtU-IDS/knowledge-collaboratory-api/blob/master/docker-compose.yml) file.\n\nCheck the logs:\n\n```bash\ndocker-compose logs\n```\n\nStop the container:\n\n```bash\ndocker-compose down\n```\n\n### Test the Collaboratory API\n\nSee the [`TESTING.md`](/TESTING.md) file for more details on testing the API.\n\n# Acknowledgments\n\nService funded by the [NIH NCATS Translator project](https://ncats.nih.gov/translator/about). \n\n![Funded the the NIH NCATS Translator project](https://ncats.nih.gov/files/TranslatorGraphic2020_1100x420.jpg)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaastrichtu-ids%2Fknowledge-collaboratory-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaastrichtu-ids%2Fknowledge-collaboratory-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaastrichtu-ids%2Fknowledge-collaboratory-api/lists"}