Edit on Github

Rule Methods

[tab:Java]

Retrieve label (Local)

rule.getLabel();

Retrieves the unique label of the rule.

Returns

String

Get a Remote version of the rule.

rule.asRemote(tx);

The remote version uses the given transaction to execute every method call.

Accepts

Param Description Type Required Default

tx

The transaction to be used to make method calls.

Transaction

true

N/A

Returns

Rule.Remote

Retrieve the when body (Local)

rule.getWhen();

Retrieves the statements that constructs the when body of the rule.

Returns

string

Retrieve the then body (Local)

rule.getThen();

Retrieves the single statement that constructs the then body of the rule.

Returns

string

Rename label

rule.setLabel(String label);

Renames the label of the rule. The new label must remain unqiue.

Accepts

Param Description Type Required Default

label

The new label to be given to the rule.

String

true

N/A

Returns

void

Delete rule

rule.delete();

Returns

null

Check if the rule has been deleted

rule.isDeleted();

Returns

boolean

LogicManager

Retrieve a Rule

transaction.logic().getRule(String label);

Retrieves the Rule that has the given label.

Accepts

Param Description Type Required Default

label

The label of the Rule to create or retrive.

String

true

N/A

Returns

Create or retrieve a Rule

transaction.logic().putRule(String label, Pattern when, Pattern then);

Creates a new Rule if none exists with the given label, or retrieves the existing one.

Accepts

Param Description Type Required Default

label

The label of the Rule to create or retrive.

String

true

N/A

when

The pattern describing the when body of the rule.

com.vaticle.typeql.lang.pattern.Pattern

true

N/A

then

The pattern describing the then body of the rule.

com.vaticle.typeql.lang.pattern.Pattern

true

N/A

Returns

[tab:end] [tab:Javascript]

Retrieve label (Local)

rule.label;

Retrieves the unique label of the rule.

Returns

String

Get a Remote version of the rule.

rule.asRemote(tx);

The remote version uses the given transaction to execute every method call.

Accepts

Param Description Type Required Default

tx

The transaction to be used to make method calls.

Transaction

true

N/A

Returns

RemoteRule

Retrieve the when body (Local)

rule.when;

Retrieves the statements that constructs the when body of the rule.

Returns

string

Retrieve the then body (Local)

rule.then;

Retrieves the single statement that constructs the then body of the rule.

Returns

string

Rename label

await rule.setLabel(label);

Renames the label of the rule. The new label must remain unqiue.

Accepts

Param Description Type Required Default

label

The new label to be given to the rule.

String

true

N/A

Returns

void

Delete rule

await rule.delete();

Returns

void

Check if the rule has been deleted

await rule.isDeleted();

Returns

boolean

LogicManager

Retrieve a Rule

await transaction.logic().getRule(label);

Retrieves the Rule that has the given label.

Accepts

Param Description Type Required Default

label

The label of the Rule to create or retrive.

String

true

N/A

Returns

Create or retrieve a Rule

await transaction.logic().putRule(label, when, then);

Creates a new Rule if none exists with the given label, or retrieves the existing one.

Accepts

Param Description Type Required Default

label

The label of the Rule to create or retrive.

String

true

N/A

when

The when body of the rule to create.

String

true

N/A

then

The then body of the rule to create.

String

true

N/A

Returns

[tab:end] [tab:Python]

Retrieve label (Local)

rule.get_label()

Retrieves the unique label of the rule.

Returns

String

Get a Remote version of the rule.

rule.as_remote(tx)

The remote version uses the given transaction to execute every method call.

Accepts

Param Description Type Required Default

tx

The transaction to be used to make method calls.

Transaction

true

N/A

Returns

RemoteRule

Retrieve the when body (Local)

rule.get_when()

Retrieves the statements that constructs the when body of the rule.

Returns

string

Retrieve the then body (Local)

rule.get_then()

Retrieves the single statement that constructs the then body of the rule.

Returns

string

Rename label

rule.set_label(label)

Renames the label of the rule. The new label must remain unqiue.

Accepts

Param Description Type Required Default

label

The new label to be given to the rule.

String

true

N/A

Returns

None

Delete rule

rule.delete();

Returns

None

Check if the rule has been deleted

rule.is_deleted()

Returns

boolean

LogicManager

Retrieve a Rule

transaction.logic().get_rule(label)

Retrieves the Rule that has the given label.

Accepts

Param Description Type Required Default

label

The label of the Rule to create or retrive.

String

true

N/A

Returns

Create or retrieve a Rule

transaction.logic().put_rule(label, when, then)

Creates a new Rule if none exists with the given label, or retrieves the existing one.

Accepts

Param Description Type Required Default

label

The label of the Rule to create or retrive.

String

true

N/A

when

The when body of the rule to create.

String

true

N/A

then

The then body of the rule to create.

String

true

N/A

Returns

[tab:end]