logician_query: Query a database

Description Usage Arguments Examples

View source: R/query.R

Description

Query a database

Usage

1
2
3
4
5
6
7
8
9
logician_query(database, question)

logician_query_(database, question)

## S3 method for class 'logician_clause'
logician_query_(database, question)

## S3 method for class 'logician_r_expr'
logician_query_(database, question)

Arguments

database

a list of rules and facts

question

a clause of type logician_clause or an R expression of type logician_r_expr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
database <- logician_database(
  connected(berlin, hamburg),
  connected(hamburg, chicago),
  connected(chicago, london),
  connected(aachen, berlin),
  connected(chicago, portland),
  connected(portland, munich),
  path(A, B) := connected(A, B),
  path(A, B) := connected(A, Z) && path(Z, B)
)
iter <- logician_query(database, path(berlin, hamburg))
iter$next_value()

iter <- logician_query(database, path(berlin, X))
iter$next_value()
iter$next_value()
iter$next_value()

dirkschumacher/logician documentation built on June 13, 2020, 5:11 p.m.