Hacker News new | ask | show | jobs
by avinassh 1149 days ago
hey I did check the wiki, but I didn't clearly understand and how it connects with a relational database, hence I asked here.

one more benefit of asking here, is people also share their practical experiences and how it is out there in the wild. Such stuff is usually missing from the wiki.

1 comments

It's a different way of expressing queries. The smallest example I can think of is a simple navigation, like this:

  Find: ?friend-name, given: ?person
  
  [[?person :person/friends ?friend]
   [?friend :person/name ?friend-name]]
Given a person, get a set of the names of that person's friends.

Incidentally, all variables (prefixed with ? by convention, not requirement) are valid inputs or outputs from the query. So for the same query, you could give `?friend-name` and extract `?person`, to get the IDs of the people who are friends with a person of a particular name. This just requires a change in the inputs and outputs, not in the query itself.

The format is [ID field value]. If `value` happens to be an ID, you can navigate by it.

There's a lot more to it than this, of course.