# SemMedDB and Prolog

**URL:** <https://swi-prolog.discourse.group/t/semmeddb-and-prolog/5507>\
**Category:** Discussion\
**Tags:** on-topic-only\
**Created:** [June 17, 2022, 6:50am UTC](https://swi-prolog.discourse.group/t/semmeddb-and-prolog/5507 "2022-06-17T06:50:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [June 17, 2022, 7:48am UTC](https://swi-prolog.discourse.group/t/semmeddb-and-prolog/5507/2 "2022-06-17T07:48:56Z")

</div>

There are various ways accessing such repositories.

- Using the new [RocksDB](https://www.swi-prolog.org/pack/list?p=rocksdb) clauses would quite likely do the job. Access performance will be limited to about 30k-300k lookups/second (depending on data structure, indexes and further enhancements).
- Use an external database, either using [ODBC](https://swi-prolog.discourse.group/t/swi-prolog-connecting-to-postgresql-via-odbc/2404) or the embedded [sqlite](https://www.swi-prolog.org/pack/list?p=prosqlite) or my recent prototyped access to embedded MonetDB. Lookup for single rows is slower than above (probably), but if you can make the database do interesting joins that do not perform well in Prolog the end may be quite ok. Although setting it up can be hard, the bundled [CQL](https://www.swi-prolog.org/pldoc/man?section=cql) package can translate Prolog conjunctions to SQL joins (and a lot more).
- Translate the data to [RDF](https://www.w3.org/RDF/) and compile that to an [HDT](https://www.swi-prolog.org/pack/list?p=hdt). Then use SWI-Prolog’s HDT add-on to gain access. That scales fine. Triple access times should be about 500K/second.
- Similar, using [TerminusDB](https://terminusdb.com/). You can use their query language and I think you can also access the triples from Prolog.

---

_[View the full topic](https://swi-prolog.discourse.group/t/semmeddb-and-prolog/5507)._
