Questions tagged [datalog]

Datalog is a query and rule language for (deductive) databases that syntactically is a subset of Prolog.

Datalog is a query and rule language for (deductive) databases that syntactically is a subset of Prolog. Compared to Prolog, Datalog has certain restrictions on the syntax of allowable predicates, which mean that any bottom-up calculation is guaranteed to terminate. These restrictions also guarantee that the order of Datalog statements within a program does not affect its functioning. However, unlike Prolog, it is not Turing Complete, and so cannot be used for general purpose programming.

164 questions
2
votes
3 answers

Undefined predicate error in datalog

So I'm currently learning datalog. I booted it up and typed in the following: parent(john, michael). and was promptly given an undefined predicate error. From what I understand this should be a correct way to define a relationship in the mock…
2
votes
0 answers

How count in Datalog?

I have this DB: LABORATORY(LabNumber, SeatsNumber) RESERVATION(LabNumber, ProfName, Date) PROF(ProfName, Subject ,#Reservation) How can I do this query in PROLOG(DATALOG)? Find PROFessor's name who made more reservations
Pascal NoPascensor
  • 171
  • 1
  • 1
  • 14
2
votes
1 answer

How to use / in a Datomic query?

This query [:find ?p ?af :where [?p :person/age ?pa] [?p :person/father ?f] [?f :person/age ?fa] [(/ ?pa ?fa) ?af]] returns only rounded (to 0 decimal places) values for ?af, so I can't add sth. like [(< 0.25 ?af)] [(<…
Leon Grapenthin
  • 9,246
  • 24
  • 37
2
votes
1 answer

How to expose a huge semantic graph (linked data) with a Datalog query interface

I have a huge semantic network, which has its specific Java API for querying the data (data stored in several Lucene indices). I want something more interactive (than Java programming) for querying it, like a Datalog interface (or something else you…
fferri
  • 18,285
  • 5
  • 46
  • 95
2
votes
1 answer

Z3 muZ + uninterpreted functions?

Are uninterpreted functions supported in muZ? I'd like to do something like the following: (declare-fun f (Int) Int) (declare-rel r (Int)) (declare-var X Int) (rule (=> (= (f X) X) (r X))) (query (r X) :default-relation smt_relation2 :engine…
jnfoster
  • 31
  • 3
1
vote
1 answer

datalog for finding same value of attributes from a model

I am new to datalog and want to solve the following: I have a student model student(name, rollno, city) Now I want to write a datalog program for finding the pair of students that are from the same city. Is it correct if I write the program as…
Sadiksha Gautam
  • 5,032
  • 6
  • 40
  • 71
1
vote
1 answer

Souffle query returning zero results

I am writing a Souffle query that operates on family relationships: .decl Parent(x: symbol, y: symbol) .input Parent .decl Descendant(x: symbol, y: symbol) .output Descendant .printsize Descendant Descendant(x, y) :- Parent(x, y). Descendant(x, y)…
tekknolagi
  • 10,663
  • 24
  • 75
  • 119
1
vote
1 answer

datalevin, concurrency, transactions

I am using latest Datalevin version 0.7.8 and wrote the following small program: (ns datalevintest.core (:require [datalevin.core :as dc])) (def store (System/getenv "DBSTORE")) (def conn (datalevin.core/get-conn store {} {:auto-entity-time?…
erdos
  • 3,135
  • 2
  • 16
  • 27
1
vote
0 answers

Datalog: Find entity pairs that have an exact match on a collection

IF I have the following set of entities in my xtdb/datomic database {:name "1" :likes [:a :b :c]} {:name "2" :likes [:a :b]} {:name "3" :likes [:a :b :c]} I want to write a query that returns pairs of entites that have exact match on :likes…
ffff
  • 2,853
  • 1
  • 25
  • 44
1
vote
1 answer

how to turn off debug transaction logging in datahike?

on every transaction datahike logs whole transaction 2022-05-24T15:25:00.999Z BB-8 DEBUG [datahike.connector:142] - Using config {:keep-history? true, :index :datahike.index/hitchhiker-tree, :store {:path "/home/user/.Fennec/Deep-Thought",…
1
vote
1 answer

How to sum values including entities with missing attributes on Datalog/DataScript/Datomic

I'm learning Datalog/DataScript/Datomic. For this I've setup a simple ledger database on DataScript to play with. By now it basically consists of a set of accounts and a list of records with the attributes :entry.record/account and…
Peluko
  • 35
  • 3
1
vote
0 answers

What is a Deductive Database?

I am reading some papers on databases and stumbled upon deductive databases. It seems that information on them is somewhat limited. The Wikipedia article states A deductive database is a database system that can make deductions (i.e. conclude…
David Prifti
  • 621
  • 2
  • 8
  • 17
1
vote
1 answer

Is single sided unification sufficient for Datalog?

Datalog is easily identified with a subset of Prolog that doesn't use function symbols, but only constants and variables. But pure Datalog that doesn't use negation has a further constraint(*): Every fact is ground. Every variable in the head of a…
user502187
1
vote
1 answer

Symmetry breaking edges of a line graph on a coordinate grid

A classic trick for optimizing Datalog programs is symmetry-breaking. Symmetry breaking can halve the number of facts you must compute in your database, since you only need to compute edge(0, 1) and not also edge(1, 0). Consider an n x m coordinate…
Edward Z. Yang
  • 26,325
  • 16
  • 80
  • 110
1
vote
1 answer

Import a Datalog knowledge base in Racket

Is it possible in Datalog Racket to import and use a knowledge base defined in a file x declared as "#lang datalog" into another file y declared as "#lang racket"? ex: ;; x.rkt #lang datalog parent(john, douglas). ;; y.rkt #lang…
koteth
  • 35
  • 4