Fork me on GitHub
#asami
<
2022-07-05
>
Mattias15:07:28

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.

Mattias15:07:42

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.)

quoll15:07:32

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

quoll15:07:37

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

quoll15:07:55

Or… SHOULD work

quoll15:07:23

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

Mattias15:07:30

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

quoll15:07:17

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

quoll15:07:13

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

quoll15:07:42

But I’ve converted them all to .ttl

Mattias15:07:16

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 Kleijngeld16:07:28

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 Kleijngeld16:07:58

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 Kleijngeld16:07:16

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 Kleijngeld16:07:45

Hope that's helpful

Mattias18:07:39

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

🙂 1
quoll15:07:36

oh… not for this, no

quoll15:07:49

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

quoll15:07:00

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

Mattias15:07:52

Secret agent level code. Cool 😎👍