# openpredict-sparql-service
**Repository Path**: wangcl_deep/openpredict-sparql-service
## Basic Information
- **Project Name**: openpredict-sparql-service
- **Description**: No description available
- **Primary Language**: Python
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2023-10-25
- **Last Updated**: 2023-10-25
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# SPARQL endpoint for OpenPredict
A SPARQL endpoint to serve predictions generated using the OpenPredict classifier, using custom SPARQL functions. Built with [rdflib-endpoint](https://github.com/vemonet/rdflib-endpoint)
Access the SPARQL service endpoint at https://service.openpredict.137.120.31.102.nip.io/sparql
OpenAPI docs at https://service.openpredict.137.120.31.102.nip.io
## Available functions 🧪
**Try the queries on YASGUI**
### Get predictions
Query OpenPredict classifier to get drug/disease predictions
```SPARQL
PREFIX openpredict:
SELECT ?drugOrDisease ?predictedForTreatment ?predictedForTreatmentScore WHERE {
BIND("OMIM:246300" AS ?drugOrDisease)
BIND(openpredict:prediction(?drugOrDisease) AS ?predictedForTreatment)
```
### Try a federated query
Use this federated query to retrieve predicted treatments for a drug or disease (OMIM or DRUGBANK) from any other SPARQL endpoint supporting federated queries.
**From another SPARQL endpoint**
```SPARQL
PREFIX openpredict:
SELECT * WHERE
{
SERVICE {
SELECT ?drugOrDisease ?predictedForTreatment WHERE {
BIND("OMIM:246300" AS ?drugOrDisease)
BIND(openpredict:prediction(?drugOrDisease) AS ?predictedForTreatment)
}
}
}
```
## Install and run ✨️
1. Install dependencies
```bash
pip install -r requirements.txt
```
2. Run the server on http://localhost:8000
```bash
uvicorn main:app --reload --app-dir app
```
## Or run with docker 🐳
Checkout the `Dockerfile` to see how the image is built, and run it with the `docker-compose.yml`:
```bash
docker-compose up -d --build
```