asami

Asami, the graph database https://github.com/threatgrid/asami
quoll 2021-05-04T16:22:18.325300Z

Question for people who use Naga… Do you only use Naga with Asami? Is there any desire to use it with any other systems?

dominicm 2021-05-06T19:59:27.326700Z

I'm on the fence. I have considered trying to rig up naga and crux, but I'm not actually doing it. I wanted to react to incoming data, and insert additional derived data as a result of that. I'm not even sure if it's really possible.

dominicm 2021-05-06T19:59:35.326900Z

I like the sound of doing more with rules though too.

quoll 2021-05-06T20:09:15.327100Z

Yes, Naga is about inferring from existing data. What you’re talking about is very possible, but it needs a more integrated approach.

dominicm 2021-05-06T20:10:27.327300Z

oh, I meant the whole pipeline with Crux. Crux is a special-case because I can do it transactionally as data comes in. With datomic, etc. it was less appealing because the information would be sometimes out of date. But that's just the kind of application I build.

quoll 2021-05-06T20:14:18.327500Z

Doing a RETE engine over Datomic would be painful, because you need to be in the transaction pipeline, but there is no hook for that.

quoll 2021-05-06T20:14:56.327700Z

There seems to be a desire to do rule processing on the input stream for Asami, so I may need to integrate there too

2021-05-07T15:28:43.330600Z

👋 Not actually doing this yet; but I was considering running naga over some RDF stores, e.g. rdf4j’s native store, and possibly arbitrary sparql repositories

quoll 2021-05-07T15:31:06.330900Z

That’s an adapter that I always intended to write. It’s where all of this started, after all

quoll 2021-05-07T15:32:50.331100Z

Let me know if I should put some time into it 🙂

2021-05-07T15:33:16.331300Z

yeah, it looked like it would be relatively easy to add to what is there already. I think the bulk of it would be coercing the naga keywords into URIs via a registry of prefixes

quoll 2021-05-07T15:34:32.331500Z

If using the rule language, then yes. But if using the API, then it’s not needed, since URIs can be provided directly

2021-05-07T15:34:53.331700Z

yeah, agreed, I was meaning via pabu

quoll 2021-05-07T15:35:21.331900Z

The rule language (Pabu) was literally a 30 minute hack just so I had a quick way to write and modify rules :rolling_on_the_floor_laughing:

quoll 2021-05-07T15:35:37.332100Z

Somehow, it stayed with us! 😳

2021-05-07T15:36:09.332300Z

I guess, it’s almost good enough 😆

quoll 2021-05-07T15:36:36.332500Z

Pabu was also a good opportunity to learn about parser combinators! (I used to work with Nate Young who wrote the Parsatron)

2021-05-07T15:36:38.332700Z

I just like that it’s so similar to prolog

2021-05-07T15:37:04.332900Z

though it probably does cause me more grief than using the API

quoll 2021-05-07T15:37:31.333100Z

The syntax is specifically taking the same format as QNames, intentionally

2021-05-07T15:38:20.333300Z

yeah, which again is nice for me because I’m using RDF 🙂

2021-05-07T15:39:08.333500Z

though if I were to actually use any of the rules I’ve written I’ll need to coerce them into URIs on whatever backend I use (Jena/RDF4j)

quoll 2021-05-07T15:39:09.333700Z

It’s missing the PREFIX part, so I should add that

2021-05-07T15:39:46.333900Z

yeah I was going to mention that; though you’ll need a way to register / hook in URI constructors

2021-05-07T15:40:05.334100Z

though that sort of thing might be better bolted on rather built in

quoll 2021-05-07T15:41:20.334300Z

I was thinking of the @prefix syntax, to distinguish it from rules

2021-05-10T07:08:28.336900Z

That would work, though would break it being a subset of prolog. You could also represent it as a special predicate: pabu:prefix(qb,"<http://www.w3.org/2000/01/rdf-schema#>").

2021-05-10T07:09:35.337300Z

Or I guess put the prefix blocks in another file.

quoll 2021-05-10T11:49:57.339800Z

I thought I already broke the subset of Prolog part by accepting QNames? Or does Prolog already allow : characters in its atoms?

2021-05-11T21:22:40.340300Z

Yeah, you can have : in prolog atoms and predicates too. At least it’s supported in SWI prolog, I suspect most other prologs too.

2021-05-11T21:24:00.340600Z

I tried finding a canonical reference for you, but most descriptions of the syntax are informally specified. Unfortunately the ISO standard is paywalled.

2021-05-11T21:25:20.340800Z

ISO prolog was I believe largely derived from Edinburgh prolog… but I can’t find any good references their either. I think most implementers don’t care much for ISO prolog tbh

quoll 2021-05-11T21:54:43.341200Z

It looks like adding an extra tag would be appropriate

quoll 2021-05-11T21:56:14.341400Z

A familiar syntax would be to add a tag like this to the comments:

@prefix rdf: &lt;<http://www.w3.org/1999/02/22-rdf-syntax-ns#>&gt; .

2021-05-11T22:13:31.341600Z

Do you mean literally that? Or putting it in a pabu comment? e.g.

%@prefix rdf: &lt;<http://www.w3.org/1999/02/22-rdf-syntax-ns#>&gt; .

quoll 2021-05-11T22:15:29.341900Z

in a comment

quoll 2021-05-11T22:15:50.342100Z

That way it would look like a SWI-Prolog structured comment

quoll 2021-05-11T22:16:39.342300Z

It would just be a new tag https://www.swi-prolog.org/pldoc/man?section=tags

2021-05-11T22:19:04.342500Z

Incidentally the standards body added to turtle 1.1 SPARQL like prefix support in addition to @prefix So arguably because of SPARQL PREFIX rdf: &lt;<http://www.w3.org/1999/02/22-rdf-syntax-ns#>&gt; is more well known. Obviously that won’t align with a swipl comment tag

2021-05-11T22:22:27.342700Z

Incidentally I think those tagged comments might only be expected inside /** comment blocks */

quoll 2021-05-11T22:22:40.342900Z

honestly, I always forgot which syntax did which. I copy/pasted and focused either on data or on queries.

2021-05-11T22:23:36.343100Z

Yeah me too… it’s just frustrating when you copy/paste a turtle @style one into a SPARQL query 😩 or you skip the @ but leave the .

quoll 2021-05-11T22:25:41.343400Z

Go to the SPARQL query doc, and the first appearance of a prefix syntax is section https://www.w3.org/TR/sparql11-query/#docDataDesc: > This document uses the http://www.w3.org/TR/turtle/ [https://www.w3.org/TR/sparql11-query/#TURTLE] data format to show each triple explicitly. Turtle allows IRIs to be abbreviated with prefixes:

@prefix dc:   &lt;<http://purl.org/dc/elements/1.1/>&gt; .
@prefix :     &lt;<http://example.org/book/>&gt; .
:book1  dc:title  "SPARQL Tutorial" .

quoll 2021-05-11T22:26:45.343600Z

The query form is almost identical except: • no @ • no trailing .

2021-05-11T22:27:08.343800Z

IKR 😩

quoll 2021-05-11T22:27:12.344Z

I do like SPARQL, but some parts of it frustrate me no end

2021-05-11T22:27:16.344200Z

yeah

quoll 2021-05-11T22:27:55.344400Z

I’m hoping to put a SPARQL front-end over Asami. If I ever get the time

2021-05-11T22:29:00.344600Z

TBH I might mention that on the SPARQL 1.2 issues…. they should really axe that @prefix dc: .... stuff from the document and use the turtle 1.1 style to help prevent confusion.

quoll 2021-05-11T22:32:17.344900Z

If you recall the https://youtu.be/oyLBGkS5ICk?list=PLZdCLR02grLofiMKo0bCeLHZC0_2rpqsz from the 2016 Conj, he said that you shouldn’t axe anything 🙂

quoll 2021-05-11T22:32:28.345100Z

But I’d be all for accepting both forms

2021-05-11T22:35:55.345300Z

Yeah I’m definitely not suggesting axing support for it all, it should remain standardised in turtle. I’m just suggesting that the SPARQL 1.2 sample data should be updated to use the turtle 1.1 feature (of SPARQL style PREFIX: blocks; i.e. a small step to preventing the confusion.

2021-05-11T22:37:47.345600Z

Granted it might further add to that confusion; but it will at least mean people copy/pasting example data in that document into sparql etc won’t trip up.

2021-05-11T22:38:14.345800Z

Anyway this is an irrelevance 🙂

quoll 2021-05-04T16:23:00.325400Z

Naga was originally built to be database agnostic. The first iteration ran on Datomic, though I planned to expand it to SPARQL, OrientDB, and more

quoll 2021-05-04T16:23:34.325600Z

But then I was asked to make my own open source DB to use, which is how Asami came to be.

quoll 2021-05-04T16:24:36.325800Z

But the only people who I know use Naga are doing it with Asami.

quoll 2021-05-04T16:26:06.326Z

I’ve reached a point where I could do more with rules if I know that I can use internal features of Asami. It’s also annoying having to keep Naga in sync with Asami (an Asami release means a trivial new Naga release with the new dependency)

quoll 2021-05-04T16:26:24.326200Z

So I’m considering merging them again.

quoll 2021-05-04T16:26:34.326400Z

But I’m open to feedback!