asami

2022-07-05T15:12:28.685939Z

So… I’m trying to wrap my head around how to put stuff into Asami. My first usecase is medical ontologies/classifications/etc (ICD, Snomed, Loinc, and friends), fwiw. These are typically distributed as large XML files with their own internal logic using IDs for creating references.

2022-07-05T15:14:42.233459Z

So, my first thought is doing it lazily. Not sure if that means using transact? Or should I be first converting the master files into Asami-compatible EDN/Json/etc and then loading these? Appreciate anyones mental model on how to approach this. (I’ve been a developer for long enough but new in the Clojure world and haven’t used Asami-like databases before.)

quoll 2022-07-05T15:16:32.886209Z

It’s going to be easier as triples, but it can be done lazily

quoll 2022-07-05T15:17:37.392029Z

Transacting a map containing :tx-data, with a lazy seq of triples will work

quoll 2022-07-05T15:17:55.542169Z

Or… SHOULD work

quoll 2022-07-05T15:18:23.166159Z

ICD, SNOMED and LOINC are exactly the datasets I’m working with right now

2022-07-05T15:39:30.061159Z

Any chance you can share your approach, somehow? Not sure what the question should be, really, but any inspiration is appreciated 😋

quoll 2022-07-05T15:40:17.014379Z

I’m writing a ttl parser at the moment. n-triples is easy to convert, but I can’t generate the data with that

quoll 2022-07-05T15:41:13.720769Z

Otherwise, I’d just use the RIOT parsers from Jena and pull them in that way. But I’m writing my own parser because I want it to be pure Clojure

quoll 2022-07-05T15:18:42.000569Z

But I’ve converted them all to .ttl

2022-07-05T15:38:16.381849Z

Oh, wow. Thanks for the replies. Do you happen to know any code samples using Asami you can point me to? (My GitHub-code-search-fu isn't what it should be…)

Bart Kleijngeld 2022-07-05T16:24:28.832789Z

I'm using Asami and transact with :tx-data to load triples I've read from a ttl file. It's nothing fancy (I'm still a relative beginner too 😉) but it might help you out just enough

Bart Kleijngeld 2022-07-05T16:25:58.816349Z

It's an open-source project too, so I can share it with you. Again, it's proof-of-concept maturity level code by a beginner, so take it with a grain of salt

Bart Kleijngeld 2022-07-05T16:30:16.877549Z

In short: • I read triples from TTL files using RDF4j and convert this to Clojure vectors of size 3 (that's the triples) • I use transact with :tx-data to load them • The "marking as entity" logic takes care of marking entities as top-level, which is necessary if you want to recursively fetch tree structures using d/entity . You may not need that at all

Bart Kleijngeld 2022-07-05T16:30:45.183739Z

Hope that's helpful

2022-07-05T18:38:39.026409Z

Fantastic, many thanks! Enough to get me going, for sure.

🙂 1
quoll 2022-07-05T15:38:36.905189Z

oh… not for this, no

quoll 2022-07-05T15:38:49.606939Z

Anything I do related to work isn’t allowed to be online

quoll 2022-07-05T15:39:00.485509Z

(I have to use another computer entirely for my work)

2022-07-05T15:39:52.830709Z

Secret agent level code. Cool 😎👍