Fork me on GitHub
#asami
<
2021-05-04
>
quoll16:05:18

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

quoll16:05:00

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

quoll16:05:34

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

quoll16:05:36

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

quoll16:05:06

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)

quoll16:05:24

So I’m considering merging them again.

quoll16:05:34

But I’m open to feedback!

dominicm19:05:27

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.

dominicm19:05:35

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

quoll20:05:15

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

dominicm20:05:27

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.

quoll20:05:18

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.

quoll20:05:56

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

rickmoynihan15:05:43

👋 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

quoll15:05:06

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

quoll15:05:50

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

rickmoynihan15:05:16

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

quoll15:05:32

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

rickmoynihan15:05:53

yeah, agreed, I was meaning via pabu

quoll15:05:21

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:

quoll15:05:37

Somehow, it stayed with us! 😳

rickmoynihan15:05:09

I guess, it’s almost good enough 😆

quoll15:05:36

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

rickmoynihan15:05:38

I just like that it’s so similar to prolog

rickmoynihan15:05:04

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

quoll15:05:31

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

rickmoynihan15:05:20

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

rickmoynihan15:05:08

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)

quoll15:05:09

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

rickmoynihan15:05:46

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

rickmoynihan15:05:05

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

quoll15:05:20

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

rickmoynihan07:05:28

That would work, though would break it being a subset of prolog. You could also represent it as a special predicate: pabu:prefix(qb,"").

rickmoynihan07:05:35

Or I guess put the prefix blocks in another file.

quoll11:05:57

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

rickmoynihan21:05:40

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

rickmoynihan21:05:00

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

rickmoynihan21:05:20

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

quoll21:05:43

It looks like adding an extra tag would be appropriate

quoll21:05:14

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

@prefix rdf: <> .

rickmoynihan22:05:31

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

%@prefix rdf: <> .

quoll22:05:29

in a comment

quoll22:05:50

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

rickmoynihan22:05:04

Incidentally the standards body added to turtle 1.1 SPARQL like prefix support in addition to @prefix So arguably because of SPARQL PREFIX rdf: <> is more well known. Obviously that won’t align with a swipl comment tag

rickmoynihan22:05:27

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

quoll22:05:40

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

rickmoynihan22:05:36

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 .

quoll22:05:41

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:   <> .
@prefix :     <> .
:book1  dc:title  "SPARQL Tutorial" .

quoll22:05:45

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

quoll22:05:12

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

quoll22:05:55

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

rickmoynihan22:05:00

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.

quoll22:05:17

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

quoll22:05:28

But I’d be all for accepting both forms

rickmoynihan22:05:55

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.

rickmoynihan22:05:47

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.

rickmoynihan22:05:14

Anyway this is an irrelevance 🙂