# Temporal index support

**URL:** <https://community.stardog.com/t/temporal-index-support/2371>\
**Category:** Support\
**Created:** [April 10, 2020, 12:27pm UTC](https://community.stardog.com/t/temporal-index-support/2371 "2020-04-10T12:27:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [April 10, 2020, 12:27pm UTC](https://community.stardog.com/t/temporal-index-support/2371/1 "2020-04-10T12:27:28Z")

</div>

Is there any chance that Stardog is considering adding support for temporal indexes? I know someone mentioned they were looking into bitemporal modeling but I've always thought it would be really nice to have an index over temporal literals similar to what Waldo offers for text.

I've looked into doing it myself and I know that it's theoretically possible but I think it's a bit too much for me to be able to glean all the mechanics of it from the outside.

In looking around I came across this excellent APL licensed library [GitHub - questdb/questdb: An open source time-series database for fast ingest and SQL queries](https://github.com/questdb/questdb) which I'll just casually drop here. 🙂

Another route I was thinking of that wouldn't be as closely integrated but might be simpler would be to write a transaction listener that wrote to a kafka topic and then loading it into an external datastore from there and using a virtual graph. Stardog doesn't specifically support QuestDB but it supports SQL and the Postgres wireline protocol so I'm guessing I could use the postgres jdbc driver. Any thoughts on doing something like that?

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [April 10, 2020, 12:33pm UTC](https://community.stardog.com/t/temporal-index-support/2371/2 "2020-04-10T12:33:23Z")

</div>

Hi Zach,

Coincidentally I'm working on a prototype for something like that for numerical datatypes so if that goes well, we may consider temporal literals next. Yes, architecturally it may work along the lines that you described but it's possible to experiment with an in-memory index first.

Thanks,  
Pavel

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [April 10, 2020, 1:38pm UTC](https://community.stardog.com/t/temporal-index-support/2371/3 "2020-04-10T13:38:45Z")

</div>

Awesome. I really wish I understood what was required because I'd also like to integrate an approximate nearest neighbor search index [GitHub - jelmerk/hnswlib: Java library for approximate nearest neighbors search using Hierarchical Navigable Small World graphs](https://github.com/jelmerk/hnswlib) so that you could load images with BITES and add a bites extractor to compute feature vectors. Then you could use Stardog to do image retrieval. Stardog would also make a great backend for an image annotation service.

I get how the predicate function is transformed into a service call but complex part seems to be ConnectableConnection and the transaction handling. I'm also not sure how the connection gets registered so that it can listen for changes.

I remember someone saying something about expanding the user api, are you guys still working on that because I'm all over that when you do.

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [April 10, 2020, 1:54pm UTC](https://community.stardog.com/t/temporal-index-support/2371/4 "2020-04-10T13:54:49Z")

</div>

Right, there're two big parts:

- The connectable stuff as in this example: [stardog-examples/examples/connectable/main/resources/META-INF/services at develop · stardog-union/stardog-examples · GitHub](https://github.com/stardog-union/stardog-examples/tree/develop/examples/connectable/main/resources/META-INF/services)  
So you create a module which is loaded through the Service loader and registers the custom connectable and the new database options (to enable/disable your custom service). After that all tx payload starts going through your connection so your code can update whatever it needs.
- The magic predicate to be used in queries and the corresponding custom service: [stardog-examples/examples/service at develop · stardog-union/stardog-examples · GitHub](https://github.com/stardog-union/stardog-examples/tree/develop/examples/service)

Alternatively you can do a custom HTTP service and access your stuff via an HTTP API rather than queries.

Happy to explain in more details,  
Pavel

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [April 10, 2020, 2:06pm UTC](https://community.stardog.com/t/temporal-index-support/2371/5 "2020-04-10T14:06:17Z")

</div>

Thanks. I'd love to understand it well enough to implement something like this. I keep forgetting that transaction listeners are implemented by registering a connectable. I'll give it a go and see if I can come up with more specific questions. I guess I'll start with getting more familiar with the transaction listener example and work out from there.

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [April 24, 2020, 2:20pm UTC](https://community.stardog.com/t/temporal-index-support/2371/6 "2020-04-24T14:20:02Z")

</div>

Closed on April 24, 2020, 2:20pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
