LogicBlox, Inc.

Simple examples of using the lb.ExecuteLogiQL task to execute inactive blocks installed in a workspace or to send static LogiQL code.

Execute a single inactive block.

workflow exec_block() {
  lb.ExecuteLogiQL(
    service = "/exec-inactive",
    block = "sample:add_foo"
  )
}

Execute static LogiQL to update a predicate.

workflow exec_query() {
  lb.ExecuteLogiQL(
    service = "/exec",
    query = "+sample:model:record("query_data")."
  )
}

Execute LogiQL file to update a predicate.

workflow exec_file() {
  lb.ExecuteLogiQL(
    service = "/exec",
    file = "connectblox/execute.logic"
  )
}

Execute multiple inactive blocks in the same transaction.

workflow exec_multiple_blocks() {
  lb.ExecuteLogiQL(
    service = "/exec-inactive",
    blocks = {
      "sample:add_bar",
      "sample:add_baz"
    }
  )
}

Execute the previous workflows in parallel.

workflow exec_par() {
  (
    exec_block()
  ) || (
    exec_query()
  ) || (
    exec_multiple_blocks()
  )
}

Attempt to execute an inactive block that does not exist. Fail.

workflow exec_fail() {
  lb.ExecuteLogiQL(
    service = "/exec-inactive",
    block = "sample:does_not_exist"
  )
}