Questions tagged [pydatalog]

A pure-python implementation of Datalog, a truly declarative language derived from Prolog.

A pure- implementation of , a truly declarative language derived from .

pyDatalog adds the logic programming paradigm to Python's extensive toolbox, in a pythonic way.

Logic programmers can now use the extensive standard library of Python, and Python programmers can now express complex algorithms quickly.

Datalog is a truly declarative language derived from Prolog, with strong academic foundations.

Datalog excels at managing complexity. Datalog programs are shorter than their Python equivalent, and Datalog statements can be specified in any order, as simply as formula in a spreadsheet.

In particular, Datalog can be used for: - simulating intelligent behavior (for games or expert systems), - querying complex sets of related information (e.g. in data integration or Natural Language Processing), - performing recursive algorithms (e.g. on hierarchical data structure)

pyDatalog is derived from previous work by John D. Ramsdell.

It is an open-source project (LGPL) lead by Pierre Carbonnelle (in Belgium). It is inspired by LogicBlox.

25 questions
0
votes
1 answer

Static typing in pyDatalog: Possible?

For instance, using the mypy library, one can specify that a function inputs a string and outputs a string, like this: def greeting(name: str) -> str: return 'Hello, {}'.format(name) In pyDatalog, one can define (say) a unary function a single…
Jeffrey Benjamin Brown
  • 3,427
  • 2
  • 28
  • 40
0
votes
1 answer

How to retract rules from pyDataLog

I'm implementing a FOIL-like algorithm in which I want to efficiently try different hypotheses (i.e., clauses) while I keep the rest of data untouched. I was wondering how without using clear() function, I could retract a rule?
0
votes
1 answer

Does pyDatalog have a "cut" operator like prolog?

This may be quite simple, but i can't find the answer anywhere. In Prolog, when you want to prevent it from searching for additional answers, once a variable has already been instantiated, you can use the ! sign (usually called the "cut" sign). You…
0
votes
0 answers

How to solve the equation in pyDatalog?

The pyDatalog page shows how to implement the factorial algorithm to calculate N! values. Is it possible to modify it (eg. using predicates) to solve for which N the N! will equal a given value (eg. 6) ? from pyDatalog import…
aoi
  • 21
  • 3
0
votes
2 answers

Datalog: Why does (X==False) & (Y==not(X)) not evaluate?

I'm using pyDatalog (in Python 2.7). Using an arithmetic function like +, I can refer to an earlier bound variable: >>> (X==1) & (Y==X+1) [(1, 2)] But I cannot use the boolean not operator the same way: >>> not(False) True >>> (X==False) &…
Jeffrey Benjamin Brown
  • 3,427
  • 2
  • 28
  • 40
0
votes
1 answer

Best way to practise Datalog?

What is the best way to practice Datalog? Should I practice in pyDatalog? Or should I go with Prolog? (but isnt the syntax different for Datalog and Prolog?) Thank you.
Susha Suresh
  • 65
  • 1
  • 1
  • 8
0
votes
1 answer

How to create arithmetic predicates in pyDatalog?

how do I translate this kind of arithmetic predicate to a legal pyDatalog predicate? add(X, Y, Z) ← X + Y = Z for example: ?add(5, 7, Z). the answer should be: add(5, 7, 12). Thanks!
user2199630
  • 203
  • 1
  • 2
  • 12
0
votes
1 answer

How to create dynamic arithmetic facts in pyDatalog?

I need to create a simple Datalog machine (Which means that my input are 2 files: 1. facts , 2. rules.) I'm currently using pyDatalog package. I need to parse the facts and create terms dynamically. from pyDatalog's tutorial I've found this example…
user2199630
  • 203
  • 1
  • 2
  • 12
0
votes
1 answer

Dealing with multiple Python versions?

I have a problem with my Pip version. I am trying out to install the pyDatalog package, which isn't supported by Anaconda. The following specifications were found to be in conflict: - pydatalog - python 3.5* In my Ubuntu, I have two versions…
Alex
  • 3,923
  • 3
  • 25
  • 43
0
votes
1 answer

Why does creating a relationship in pyDatalog seem to give me the wrong answer?

I'm new to the concepts of Datalog, and I am exploring it through pyDatalog. I am experimenting with a unit measurement converter. So, given facts about how many inches there are in a meter, for example, it should be able to tell me how many meters…
blippy
  • 1,490
  • 1
  • 13
  • 22
1
2