athensresearch / athens

Athens is no longer maintainted. Athens was an open-source, collaborative knowledge graph, backed by YC W21
https://athensresearch.github.io/athens
Other
6.32k stars 397 forks source link

Datascript Explorer #67

Closed tangjeff0 closed 4 years ago

tangjeff0 commented 4 years ago

132 https://athensresearch.github.io/athens/cards.html#!/athens.devcards.db_boxes

91 https://athensresearch.github.io/athens/cards.html#!/athens.devcards.sci_boxes

Using sci, allow users to query their database in the browser. Datalog is a very powerful language and could one day be as common knowledge as SQL.

ticean commented 4 years ago

:heart: Is this in progress now? This would be a great feature to keep around in the final version!

The sci.web interface is :100:. Is there a reason that we need sci itself or could we use the datascript client in CLJS for the eval?

tangjeff0 commented 4 years ago

Good question @ticean. We are interested in sci.web beyond pure datascript because we expect that there may be use cases where users want to import arbitrary npm packages. For instance, if they wanted to use other graph visualization libraries.

*Edit: Another reason is that sci provides a safe sandbox for code execution.

jelmerderonde commented 4 years ago

I'm working on something, not much code yet, but I do have an idea that might work. Current progress can be seen here: https://jelmerderonde.github.io/athens/cards.html#!/athens.devcards.db_boxes.

The code I have builds on the work done earlier by @tomisme in #91.

General idea:

Executing queries

Browser

Navigation

Feedback to this idea is appreciated.

tangjeff0 commented 4 years ago

@jelmerderonde great start!


Values that indicate a "next step" like a unique id or a reference ... should be clickable

Love this idea!


Keep a history of previous queries/result-sets so users can navigate backwards.

Keep in mind that we get history and time travel for free with DevCards:

It would be nice to have this a developer tool outside of DevCards too. You get this with Elm, Redux DevTools, and re-frame-10x, but posh/re-posh doesn't have this unfortunately.


If you haven't already, try doing datascript queries in Roam. Things to note about Roam's queries:

jelmerderonde commented 4 years ago

@tangjeff0 thanks!


Keep in mind that we get history and time travel for free with DevCards:

Good point, I will enable this next time I work on it.


they eagerly evaluate, which is sometimes annoying

I will have to figure out how to do this, I will also take a look at Roam queries.

jelmerderonde commented 4 years ago

Small update, I've managed to get some minimal browsing going. You can now click on cells that we know contains a :db/id and it will generate some new code for you.

Also, the code is a mess and in need of some cleaning up, I will do that later.

jelmerderonde commented 4 years ago

Another update, see the latest state at: https://jelmerderonde.github.io/athens/cards.html#!/athens.devcards.db_boxes

I think I'm now at a stage where it would be helpful to have some discussion about which direction we should take this in. When is it "good enough" for developers? What questions should they be able to answer with it? How can it be further improved?

I'm looking forward to hearing more ideas and opinions!

tomisme commented 4 years ago

@jelmerderonde I'm definitely finding it useful for exploring our attributes. I added this to my devcards css:

.com-rigsomelight-devcards_rendered-card {
  display: flex;
  flex-direction: column-reverse;
}

I'm sure it breaks other cards somewhere but it moves the history control bar up above the text box.

tomisme commented 4 years ago

Some ideas for where we could go:

tangjeff0 commented 4 years ago

I'm sure it breaks other cards somewhere but it moves the history control bar up above the text box.

@tomisme we can override CSS on each individual Devcard namespace. No worries!


Agree with datafy and nav. Let's get inspired by REBL and Datomic On-Prem Console for what other interactions and UI we could build!


Can't wait to have #31 so people can begin querying their own DBs to learn datascript!!

jelmerderonde commented 4 years ago

I've added some minor improvements in #138:

For now I think this is as far as we should go with this. It should be suitable for experimenting with datascript and exploring the database. When we have a firmer idea on how we will work with datascript and how we want to implement similar functionality in Athens we can pick this up again.

Do you agree @tangjeff0 ?

tangjeff0 commented 4 years ago

Looks great @jelmerderonde , approved and merged.

Eventually, when parser is further along, we can implement exploration for [[links]]s and ((block))s.

jelmerderonde commented 4 years ago

Eventually, when parser is further along, we can implement exploration for [[links]]s and ((block))s.

This shouldn't be hard to implement (I think). Let's revisit it when @roryokane deems it ready :-).

tangjeff0 commented 4 years ago

Moving this to the "Done" column because doesn't require any immediate action

tangjeff0 commented 4 years ago

This has mainly been superseded by #139. Closing!