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
3
votes
1 answer

Datomic: How do I query across any number of database inside of a query?

I'm using Datomic and would like to pull entire entities from any number of points in time based on my query. The Datomic docs have some decent examples about how I can perform queries from two different database instances if I know those instances…
3
votes
1 answer

Parameterized and case insensitive query in datalog (datomic)

I want to compose a query that takes a firstname as input parameter and returns all matching records. A match should be case insensitive. As an example I'd like to extract all the people named Douglass. Parameterized, but case sensitive this would…
Peter
  • 47,963
  • 46
  • 132
  • 181
3
votes
1 answer

How does the not clause work in Datomic?

I am trying to find latitudes which fall between two inputs. My query: (defn- latlngs-within-new-bounds [db a w] (d/q '[:find ?lat :in $ ?a ?w :where [ ?e :location/lat ?lat] [(>= ?lat ?a)] (not …
tropicalmug
  • 225
  • 1
  • 2
  • 6
3
votes
1 answer

Datomic query for maximum of aggregated value

Assume I have entity author with many related book entities. What's the query to fetch author with biggest amount of books?
Boffin
  • 570
  • 2
  • 7
  • 21
3
votes
1 answer

Are n-ary predicates Datomic (n != 2) possible?

I try to match what I read about Datalog with the descriptions of Datomic. All predicats I see in Datomic are triples, i.e. [entity attribute value] or attribute(e,v) in a more prologian syntax. Datalog on the other hand supports n-ary predicates…
Falko
  • 1,028
  • 1
  • 12
  • 24
3
votes
2 answers

How do I prevent a Datalog rule from pruning nulls?

I have the following facts and rules: % frequents(D,P) % D=drinker, P=pub % serves(P,B) % B=beer % likes(D,B) frequents(janus, godthaab). frequents(janus, goldenekrone). frequents(yanai, goldenekrone). frequents(dimi, …
Janus Troelsen
  • 20,267
  • 14
  • 135
  • 196
2
votes
2 answers

Datalog rule on rdf graph changing the (boolean) value of the fact

I'm trying to write a simple datalog rule to manipulate boolean values in an RDF ontology. I'm trying to use RDFox as a reasoner for now. RDF ontology is something like this :citizenVaccinated rdfs:label "vaccinated"; a :citizen; …
Betafish
  • 1,212
  • 3
  • 20
  • 45
2
votes
1 answer

RDFox daemon port

I am using RDFox 3.0.1, and I cannot figure out how to specify the port the daemon should start on. I have tried: ./RDFox daemon . "set endpoint.port 8080" "endpoint start" This seems to work in v2.1.1, but not in 3.0.1.
Valerio Cocchi
  • 1,891
  • 1
  • 6
  • 18
2
votes
1 answer

RDFox: The prefix name in the local IRI ':born_in' has not been bound

I have imported the following triples into RDFox v3: @prefix : . :charlie_chaplin a :ComicActor; :name "Charlie Chaplin"; :born_in :uk . :douglas_adams a :ComicAuthor ; :name "Douglas Adams"; …
cjrb
  • 104
  • 5
2
votes
1 answer

Datalog Rule taking forever to compute

I'm using RDFox v3 and when I import the following rule it takes a long time to run. My datastore has CRM information and I'm trying to classify their origins using rules. [ ?customer, :referral, "true"] :- [ ?customer, :has, ?referralLink] . I…
cjrb
  • 104
  • 5
2
votes
0 answers

Looking for Datalog containment utility

Given two Datalog programs P1,P2 I am looking for a utility/library in any programming language that returns a boolean if the P1 contained in P2.
Shevach
  • 717
  • 9
  • 25
2
votes
1 answer

Racket macros not working

I've never used Racket's macro system before so forgive my ignorance. I'm trying to dynamically define rules in Racket's Datalog system, basically like this: (datalog rules (! (:- c a b))) If I put something like this into the code directly, all is…
Name McChange
  • 2,750
  • 5
  • 27
  • 46
2
votes
0 answers

How to create function symbols dynamically in pyDatalog?

For example I have this kind of rules in Datalog: How do I create these rules dynamically in pyDatalog using "load"? Thanks!
user2199630
  • 203
  • 1
  • 2
  • 12
2
votes
0 answers

Trouble implementing tagging in a datomic db

I'm trying to set up a tagging systems in my db, I have added two attrs to handle this: {:db/ident :metadata/tags :db/valueType :db.type/ref :db/cardinality :db.cardinality/many :db/isComponent true} {:db/ident …
fraxture
  • 5,113
  • 4
  • 43
  • 83
2
votes
0 answers

Translation from SQL to Datalog

I am thinking of translating SQL queries to Datalog. Are there any tools that could completely do that? If there are, may I know what tools may I refer?
1 2
3
10 11