asami 2022-07-05

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.

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

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

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

Or… SHOULD work

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

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

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

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

But I’ve converted them all to .ttl

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

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

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

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

Hope that's helpful

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

🙂 1

oh… not for this, no

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

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

Secret agent level code. Cool 😎👍