{"id":19710800,"url":"https://github.com/vemonet/translator-sparql-service","last_synced_at":"2026-05-11T13:33:24.333Z","repository":{"id":93871370,"uuid":"371511544","full_name":"vemonet/translator-sparql-service","owner":"vemonet","description":"A SPARQL endpoint to serve NCATS Translator services as SPARQL custom functions.","archived":false,"fork":false,"pushed_at":"2021-08-04T10:58:45.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-02T08:23:22.768Z","etag":null,"topics":["fastapi","rdflib","sparql","sparql-endpoints","translator"],"latest_commit_sha":null,"homepage":"https://service.translator.137.120.31.102.nip.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vemonet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-05-27T21:45:57.000Z","updated_at":"2021-08-04T10:58:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"26f0ba77-2972-4fe0-bf7c-85e8272e93a7","html_url":"https://github.com/vemonet/translator-sparql-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vemonet/translator-sparql-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vemonet%2Ftranslator-sparql-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vemonet%2Ftranslator-sparql-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vemonet%2Ftranslator-sparql-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vemonet%2Ftranslator-sparql-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vemonet","download_url":"https://codeload.github.com/vemonet/translator-sparql-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vemonet%2Ftranslator-sparql-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32896957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"online","status_checked_at":"2026-05-11T02:00:05.975Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["fastapi","rdflib","sparql","sparql-endpoints","translator"],"created_at":"2024-11-11T22:08:26.960Z","updated_at":"2026-05-11T13:33:24.301Z","avatar_url":"https://github.com/vemonet.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SPARQL endpoint for Translator services  \n\nA SPARQL endpoint to serve NCATS Translator services as SPARQL custom functions. Built with [rdflib-endpoint](https://github.com/vemonet/rdflib-endpoint)\n\nAccess the SPARQL service endpoint at https://service.translator.137.120.31.102.nip.io/sparql\n\nOpenAPI docs at https://service.translator.137.120.31.102.nip.io\n\nTranslator APIs integrated:\n\n* https://nodenormalization-sri.renci.org/docs\n\n## Available functions 📬\n\n**\u003ca href=\"https://yasgui.triply.cc/#query=PREFIX%20umtranslator%3A%20%3Chttps%3A%2F%2Fw3id.org%2Fum%2Ftranslator%2F%3E%0ASELECT%20%3Fentity%20%3Flabel%20WHERE%20%7B%0A%20%20%20%20BIND(%22MONDO%3A0005146%22%20AS%20%3Fentity)%0A%20%20%20%20BIND(umtranslator%3Alabel(%3Fentity)%20AS%20%3Flabel)%0A%7D\u0026endpoint=https%3A%2F%2Fservice.translator.137.120.31.102.nip.io%2Fsparql\u0026requestMethod=GET\u0026tabTitle=Query%209\u0026headers=%7B%7D\u0026contentTypeConstruct=application%2Fn-triples%2C*%2F*%3Bq%3D0.9\u0026contentTypeSelect=application%2Fsparql-results%2Bjson%2C*%2F*%3Bq%3D0.9\u0026outputFormat=table\"\u003eTry the queries on YASGUI\u003c/a\u003e**\n\n### Get label  for entity\n\nFrom a CURIE, or URI following this pattern: https://identifiers.org/NAMESPACE:ID\n\n```SPARQL\nPREFIX umtranslator: \u003chttps://w3id.org/um/translator/\u003e\nSELECT ?entity ?label WHERE {\n    BIND(\"MONDO:0005146\" AS ?entity)\n    BIND(umtranslator:get_label(?entity) AS ?label)\n}\n```\n\n### Get preferred ID\n\nFrom a CURIE, or URI following this pattern: https://identifiers.org/NAMESPACE:ID\n\n```SPARQL\nPREFIX umtranslator: \u003chttps://w3id.org/um/translator/\u003e\nSELECT ?entity ?pref_id WHERE {\n    BIND(\"MONDO:0005146\" AS ?entity)\n    BIND(umtranslator:pref_id(?entity) AS ?pref_id)\n}\n```\n\n### Try a federated query\n\nUse this federated query to retrieve labels from any other SPARQL endpoint supporting federated queries.\n\n**From another SPARQL endpoint**\n\n```SPARQL\nPREFIX umtranslator: \u003chttps://w3id.org/um/translator/\u003e\nSELECT * WHERE\n{\n  SERVICE \u003chttps://service.translator.137.120.31.102.nip.io/sparql\u003e {\n    SELECT ?entity ?label WHERE {\n        BIND(\"MONDO:0005146\" AS ?entity)\n        BIND(umtranslator:get_label(?entity) AS ?label)\n    }\n  }\n}\n```\n\n**From the RDFLib SPARQL endpoint**\n\n⚠️ RDFLib has a few limitation related to federated queries:\n\n* Unfortunately, the `PREFIX` keyword does not work with federated queries in RDFLib, so we need to write the full URIs\n\n* The latest version of RDFLib (`5.0.0 `) only recognize **lowercase `service`**. This will be fixed in the next versions.\n\nRun this federated query on this RDFLib endpoint to resolve drug/disease labels retrieved from the Nanopublication network:\n\n```SPARQL\nSELECT DISTINCT ?label ?subject ?object (\u003chttps://w3id.org/um/translator/get_label\u003e(str(?subject)) AS ?subjectLabel) (\u003chttps://w3id.org/um/translator/get_label\u003e(str(?object)) AS ?objectLabel)\nWHERE {\n  \tservice \u003chttp://virtuoso.np.dumontierlab.137.120.31.101.nip.io/sparql\u003e {\n        SELECT * WHERE {\n            GRAPH ?np_assertion {\n              ?association \u003chttp://www.w3.org/2000/01/rdf-schema#label\u003e ?label ;\n                \u003chttp://www.w3.org/1999/02/22-rdf-syntax-ns#subject\u003e ?subject ;\n                \u003chttp://www.w3.org/1999/02/22-rdf-syntax-ns#predicate\u003e ?predicate ;\n                \u003chttp://www.w3.org/1999/02/22-rdf-syntax-ns#object\u003e ?object .\n              optional {\n                ?association \u003chttps://w3id.org/biolink/vocab/relation\u003e ?relation .\n              }\n              optional {\n                ?association \u003chttps://w3id.org/biolink/vocab/provided_by\u003e ?provided_by .\n              }\n              optional {\n                ?association \u003chttps://w3id.org/biolink/vocab/association_type\u003e ?association_type .\n              }\n              ?subject \u003chttps://w3id.org/biolink/vocab/category\u003e ?subject_category .\n              ?object \u003chttps://w3id.org/biolink/vocab/category\u003e ?object_category .\n            }\n            filter ( ?subject_category = \u003chttps://w3id.org/biolink/vocab/Drug\u003e || ?subject_category = \u003chttps://w3id.org/biolink/vocab/ChemicalSubstance\u003e )\n            filter ( ?object_category = \u003chttps://w3id.org/biolink/vocab/Disease\u003e )\n            GRAPH ?np_head {\n                ?np_uri \u003chttp://www.nanopub.org/nschema#hasAssertion\u003e ?np_assertion .\n            }\n                ?np_uri \u003chttp://purl.org/dc/terms/creator\u003e \u003chttps://orcid.org/0000-0002-7641-6446\u003e .\n            \tfilter NOT EXISTS { ?creator \u003chttp://purl.org/nanopub/x/retracts\u003e ?np_uri }\n        } LIMIT 5\n  \t}\n}\n```\n\n\u003e Note: Adding this filter make the federated query crash in RDFLib (works with Fuseki functions):\n\u003e\n\u003e ```SPARQL\n\u003e             GRAPH \u003chttp://purl.org/nanopub/admin/graph\u003e {\n\u003e                 ?np_uri \u003chttp://purl.org/nanopub/admin/hasValidSignatureForPublicKey\u003e ?pubkey .\n\u003e             }\n\u003e ```\n\n## Install and run ✨️\n\n1. Install dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n2. Run the server on http://localhost:8000\n\n```bash\nuvicorn main:app --reload --app-dir app\n```\n\n## Or run with docker 🐳\n\nCheckout the `Dockerfile` to see how the image is built, and run it with the `docker-compose.yml`:\n\n```bash\ndocker-compose up -d --build\n```\n\nOr build and run with docker:\n\n```bash\ndocker build -t rdflib-endpoint .\n```\n\nRun on http://localhost:8080\n\n```bash\ndocker run -p 8080:80 rdflib-endpoint\n```\n\n## Or deploy on the DSRI\n\nBuild from the `Dockerfile` and deploy in a DSRI project with HTTPS enabled:\n\n```bash\noc new-build --name translator-sparql --binary\noc start-build translator-sparql --from-dir=. --follow --wait\noc new-app translator-sparql\noc patch deployment/translator-sparql --patch '{\"spec\":{\"template\": {\"spec\":{\"serviceAccountName\": \"anyuid\"}}}}'\noc expose svc/translator-sparql\noc patch route/translator-sparql --patch '{\"spec\":{\"tls\": {\"termination\": \"edge\", \"insecureEdgeTerminationPolicy\": \"Redirect\"}}}'\n```\n\nGet the routes exposed in your project:\n\n```bash\noc get route\n```\n\n\n\nDelete:\n\n```bash\noc delete build translator-sparql\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvemonet%2Ftranslator-sparql-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvemonet%2Ftranslator-sparql-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvemonet%2Ftranslator-sparql-service/lists"}