4 ms·
Or you could just use prolog and then you wouldn't need to invent yet another graph query language.
by dreamcompiler 9y ago
Or you could just use prolog and then you wouldn't need to invent yet another graph query language.
- rspeer 9y agoI don't see how Prolog would suffice as a database.
- dreamcompiler 9y agoProlog is simultaneously a terrible database and the best database query language ever invented.
- zmonx 9y agoProlog indeed seems eminently suitable for this use case. For example, let us consider the first use case shown on the page: graql>> match $x isa movie; $y isa person; $z isa movie value "Avatar"; ($x, $y) isa directorship; ($y, $z) isa directorship; select $x; This finds movies directed by the director of Avatar. Here are a few relations in Prolog that we can use for this example: movie('Avatar'). movie('Titanic'). movie('Aliens'). movie('Terminator 2: Judgement Day'). person('James Cameron'). directorship(X, Y) :- movie_director(X, Y). directorship(X, Y) :- movie_director(Y, X). movie_director('Avatar', 'James Cameron'). movie_director('Titanic', 'James Cameron'). movie_director('Aliens', 'James Cameron'). movie_director('Terminator 2: Judgement Day', 'James Cameron'). These are Prolog facts and rules that suffice to illustrate this use case. In Prolog, we can query this database as follows: ?- findall(X, (movie(X), person(Y), movie(Z), Z = 'Avatar', directorship(X, Y), directorship(Y, Z)), Xs). Note how closely this query corresponds to the initial example! Prolog answers with: Xs = ['Avatar', 'Titanic', 'Aliens', 'Terminator 2: Judgement Day']. Note that this is in fact more complete than what the example shows: results>> [ {"isa": "movie", "value": "Titanic"}, {"isa": "movie", "value": "Aliens"}, {"isa": "movie", "value": "Terminator 2: Judgement Day"} ] Interestingly, this misses Avatar!
- doctormiko 9y agoHi, Grakn developer here. In fact you have just caught a mistake in our website! If you run that query on a live system, it will return Avatar: we missed a line in the example query specifying that we want movies different from Avatar. We will fix the website asap
- domenico_c 9y agoYou could use a subset of Prolog to query Grakn. The language itself is not what motivates the development of Grakn, it's rather a tool that fits the model more naturally.