Preskoči na glavno vsebino

Objave

Prikaz objav, dodanih na november, 2021

Off Topic: Exploring the Cayley Graph Database (part 1)

I am trying to integrate Cayley's , a graph database's query language Gizmo, into Rye . To do this, I need to get to know it well enough. Not just the exact query language, but I need a better understanding of how to solve problems with graph databases.  Since outside of the official documentation and tutorial, I couldn't find many resources about Gizmo, I decided to write this down. I am using the 30kmoviedata graph, that you can find on Cayley's Github repository. AFAIK the graph includes at least a network of movies, directors and actors. I will try to compare the Gizmo to SQL where applicable.  I am just learning, take it all with a grain of salt and let me know if I made any mistakes. Very basics Let's start with the basics and get a title of a film based on ID . In SQL this would be something like: select name from film where id = "/en/alien_1979" ; and in Cayley's Gizmo: g.V().Is( "</en/alien_1979>" ).Out( "

Second argument op- and pipe-words

For a very long time I haven't changed or added anything to the interpreter itself. So it seems that language is in this regard quite feature complete. But there was one thing that on my mind for more than a year. I wasn't sure if it's really needed, but it seems it is. Op and Pipe-words take fist function argument from the left. But there are cases when you want a second argument of a function taken from the left. Especially since generic methods in Rye dispatch on the first argument, and sometimes the active value (which is usually part of the information flow - not function parametrization) is exactly not that value. Well this works now, for generic and normal builtin functions. I haven't added it to user functions yet, but I guess it shouldn't be any harder than this was. Examples will explain it better:   And the code from the last blogpost becomes a little cleaner.

Less variables, more flows example vs Python

In the last blogpost ( Less variables, more flows ) I wrote a quick practical script I needed. It was an uncommon combination of CGI, two GET requests with Cookies and a POST request with Authorization header. I really like practical random/dirty problems, rather than ideal - made up problems to test the language. To get a sense of comparison I rewrote the example 2 times while removing specific Rye features. But that comparison is meaningless to a person that doesn't know Rye or at least Rebol already. So I went on fiverr and made a request for a Python script with these requirements. I got a nicely written Python script that uses functions for each step. To be more comparable, I rewrote the Rye code to a similar structure. Below is the result ... For a next step, it would be interesting, to extract a little simpler example out and add error handling. With Rye-s specific failure handling, I think the difference would become even greater. You can find Rye on github .

Less variables, more flows ...

This is an intermezzo between work on graph database integration . I needed some quick and dirty temporary script, that makes two calls to the web API and then calls a web-hook uri.  It's very easy to create standalone web-servers in Rye, but I wanted to just pluck this script into an existing structure as a CGI. To not have another process running for this to work. So I integrated CGI support, more complex HTTP request creation and some other things. I know CGI is not all the rage right now :) Below on the left is my script. On the right I tried to remove some of the Rye-s features, to see how it would look ...

Working on a graph database integration (Cayley)

It didn't occur to me at first, but if I have a graph based UI , the app data-structures are also more graph-like, where it makes sense. So it would be best to store data in a graph database.  I think I have been casually searching for an embedded graph database (SQLite of graph databases) for multiple times per year for at least 10 years. Well, lucky for me it seems I now found one. Meet Graph database Cayley ... It can use multiple backends, some of them are single file/dir based, like Bolt or SQLite. And it's written in Go and can be used as a library in Go, which also means in Rye . Code below is where I want to arrive once I integrate it. For optimal comfort it will need to have a mini dialect for StartPath. I will keep you posted ...

Experimenting with graph based UI-s #1

  If you imagine user interfaces becoming more and more capable, and on the other side programming languages becoming more and more human friendly, at some point they would just become one. That was the idea of Spruce, Rye's "co-language", about which I haven't blogged here yet. It's a tree/graph based programming language idea still in it's infancy. It could (potentially) be seen as a programming language, or a text-based user interface and also as a graphical user interface. Only not of a "seek-aim-click-type" persuasion, that we are all so used to. It's all just an experiment, but 2 weeks ago I decided to try something similar from the UI side. To try making what I imagined could be a graph based UI in the form of a keyboard-only task manager. It consists of nodes inside nodes. One kind of a node is also a list of nodes which produces the tabs, the main list ans the "drop-downs". Relative navigation, as I call it uses four keys, each