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
0
votes
0 answers

How can I create a data log, see every addition I made to my stock table, am using netbeans and xampp, and have 1 table. Which is stock

This is just part of the code as am new here and don't know exactly what to do. Just need to add data logs to my panel in netbeans so I can see all new updates I made going to product table that have column "stock". Will need to include data if…
0
votes
0 answers

what is the item followed by square bracket in prolog? A relation, a variable, or a function...?

I am new to prolog, and I was trying to write rules for shortest path finding, I tried many times writing rules like path(X, Y) := ... and they never work as intented, until I find these rules (path[X,Y]==P) <= ((path[X,Z]==P2) & nextTo(Z,Y) …
0
votes
1 answer

Souffle datalog: Stop execution when one record of a relation exists

Is there a way to make souffle stop execution when one record of a relation is found (for example, say I have .decl relationA(x:number), and we find one record relationA(some number) then execution stops). Otherwise, is it not possible to make…
AMRO
  • 51
  • 1
  • 6
0
votes
1 answer

large table warning for (declare-relation)

$ z3 sat.smt2 WARNING: creating large table of size 16777216 for relation match1 The raw sat.smt file: ; (set-option :fixedpoint.engine datalog) ; sorts (define-sort s () (_ BitVec 24)) (define-sort t () (_ BitVec 8)) ; Relations (declare-rel f (t…
Wenhom
  • 3
  • 3
0
votes
2 answers

Why logical "and" predicates do not work?

Tested on datascript 1.3.0 datoms: [{:db/id -1 :name "Smith" :firstname "Oliver" :age 20} {:db/id -2 :name "Jones" :firstname "Oliver" :age 20} {:db/id -3 :name "Smith" :firstname "Amelia" :age 16} {:db/id -4 :name "Jones" :firstname "Amelia"…
sof
  • 9,113
  • 16
  • 57
  • 83
0
votes
1 answer

How to query against attributes of multiple values?

Tested on datascript 1.3.0 datoms: [{:db/id -1 :name "Oliver Smith" :hobbies ["reading" "sports" "music"]}] tried to run the query below to find who like sports, but the empty set returned. '[:find ?name :where [?p :name ?name] [?p :hobbies…
sof
  • 9,113
  • 16
  • 57
  • 83
0
votes
1 answer

Query values for more than one entity in a single datomic query (Roam Alpha Api)

I'd like to in a single datomic/datalog query get output relating to multiple entities E.g. In my db (querying Roam graph via RoamAlphaApi) for one value ("YjpbFUsTx") I can do this: [:find ?e ?stri :where [?e :block/uid "YjpbFUsTx"][?e…
Rbc
  • 1
  • 1
0
votes
0 answers

Handle existential variable in the head of rules

I want to translate and query the anonymous super classes of ontology into datalog rules. For instance I have an axiom like "Chair subclassOf (headOf some Department)" and I have translated this axiom like this Chair(x) <- headOf(x,y) Deaprtment(y)…
fairyjee
  • 75
  • 1
  • 5
0
votes
1 answer

Wrapping Datascript query in a function?

Getting a seemingly bizarre problem with Datascript. For some reason when I run this query without it being wrapped in a function, everything works. But once I wrap it in a function, it returns the value for :block/content for every entity in the…
TomLisankie
  • 3,785
  • 7
  • 28
  • 32
0
votes
1 answer

In Datascript, how can I create a new attribute from the value of another?

Trying to create a new attribute where the value is the result of a transformation on a different attribute for the same entity. So, say I have a database where every entity has attribute :content. I want to have an additional attribute for every…
TomLisankie
  • 3,785
  • 7
  • 28
  • 32
0
votes
1 answer

Propagating recursive property if all predecessors satisfy it

I am working on a directed acyclic graph where a node can satisfy a property. I want to propagate this property recursively on other nodes. The rule is that a node satisfies this property if and only if all of its direct predecessors satisfy it as…
karlosss
  • 2,816
  • 7
  • 26
  • 42
0
votes
0 answers

Datomic cardinality many attribute (vs. sql pivot table) - no downsides?

Is it an issue in any way that a card many attribute may have a huge number of values? (say 10^6) I think the intuition/concern here is that we definitely don't want equivalent of a select * on the entity creeping in anywhere. Of course, the datoms…
mwal
  • 2,803
  • 26
  • 34
0
votes
1 answer

How to represent pivot table (with extra data on it) in datomic?

I realise that we don't need ordinary pivot tables in datomic because we can just pick one side of the relationship and put a :db.cardinality/many attribute on there (being sure to model the relationship in one direction only). The next thing I…
mwal
  • 2,803
  • 26
  • 34
0
votes
1 answer

What is the execution order of recursive datalog?

Q(a, b) :- Edge(a, b). Q(a, b) :- Q(a, x), Edge(x, b). The function of this code is to search all pair of nodes which are reachable. How is that recursive?
xunmiw
  • 21
  • 3
0
votes
2 answers

Not-safe expression in datalog

Why is this goal not considered safe? MANAGER(Name) :- WORKER(Name, Age, _ ), ¬ SUBORDINATE (_, Name), Age <= 40 Our teacher says that it is because SUBORDINATE is negate, and so it can not have undefined (_) spaces, but it seems to be logic for me…
Bob Rob
  • 164
  • 2
  • 10