public class InProgressBuilder extends Object
InProgressBuilder
provides a programmatic interface to performing assertions for entities.
It provides functions for adding and retracting values for attributes for an entity within
an in progress transaction.
The `transact` function will transact the assertions that have been added to the InProgressBuilder
and pass back the TxReport
that was generated by this transact and the InProgress
that was
used to perform the transact. This enables you to perform further transacts on the same InProgress
before committing.
long aEntid = txReport.getEntidForTempId("a");
long bEntid = txReport.getEntidForTempId("b");
InProgressBuilder builder = mentat.getEntityBuilder();
builder.add(aEntid, ":foo/boolean", true);
builder.add(bEntid, ":foo/instant", newDate);
InProgress inProgress = builder.transact().getInProgress();
inProgress.transact("[[:db/add \(aEntid) :foo/long 22]]");
inProgress.commit();
The `commit` function will transact and commit the assertions that have been added to the
InProgressBuilder
.
It will consume the InProgress
used to perform the transact. It returns the TxReport
generated by the transact. After calling `commit`, a new transaction must be started by calling
Mentat.beginTransaction()in order to perform further actions.
long aEntid = txReport.getEntidForTempId("a");
long bEntid = txReport.getEntidForTempId("b");
InProgressBuilder builder = mentat.getEntityBuilder();
builder.add(aEntid, ":foo/boolean", true);
builder.add(bEntid, ":foo/instant", newDate);
builder.commit();
Constructor and Description |
---|
InProgressBuilder(com.sun.jna.Pointer pointer) |
Modifier and Type | Method and Description |
---|---|
void |
add(long entid,
String keyword,
boolean value)
Asserts the value of attribute `keyword` to be the provided `value`.
|
void |
add(long entid,
String keyword,
Date value)
Asserts the value of attribute `keyword` to be the provided `value`.
|
void |
add(long entid,
String keyword,
double value)
Asserts the value of attribute `keyword` to be the provided `value`.
|
void |
add(long entid,
String keyword,
long value)
Asserts the value of attribute `keyword` to be the provided `value`.
|
void |
add(long entid,
String keyword,
String value)
Asserts the value of attribute `keyword` to be the provided `value`.
|
void |
add(long entid,
String keyword,
UUID value)
Asserts the value of attribute `keyword` to be the provided `value`.
|
void |
addKeyword(long entid,
String keyword,
String value)
Asserts the value of attribute `keyword` to be the provided `value`.
|
void |
addRef(long entid,
String keyword,
long value)
Asserts the value of attribute `keyword` to be the provided `value`.
|
void |
close() |
TxReport |
commit()
Transacts the added assertions and commits.
|
com.sun.jna.Pointer |
getPointerForUUID(UUID uuid) |
UUID |
getUUIDFromPointer(com.sun.jna.Pointer uuidPtr) |
void |
retract(long entid,
String keyword,
boolean value)
Retracts the value of attribute `keyword` from the provided `value`.
|
void |
retract(long entid,
String keyword,
Date value)
Retracts the value of attribute `keyword` from the provided `value`.
|
void |
retract(long entid,
String keyword,
double value)
Retracts the value of attribute `keyword` from the provided `value`.
|
void |
retract(long entid,
String keyword,
long value)
Retracts the value of attribute `keyword` from the provided `value`.
|
void |
retract(long entid,
String keyword,
String value)
Retracts the value of attribute `keyword` from the provided `value`.
|
void |
retract(long entid,
String keyword,
UUID value)
Retracts the value of attribute `keyword` from the provided `value`.
|
void |
retractKeyword(long entid,
String keyword,
String value)
Retracts the value of attribute `keyword` from the provided `value`.
|
void |
retractRef(long entid,
String keyword,
long value)
Retracts the value of attribute `keyword` from the provided `value`.
|
InProgressTransactionResult |
transact()
Transacts the added assertions.
|
public void add(long entid, String keyword, long value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be assertedpublic void addRef(long entid, String keyword, long value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be assertedpublic void addKeyword(long entid, String keyword, String value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be assertedpublic void add(long entid, String keyword, boolean value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be assertedpublic void add(long entid, String keyword, double value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be assertedpublic void add(long entid, String keyword, Date value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be assertedpublic void add(long entid, String keyword, String value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be assertedpublic void add(long entid, String keyword, UUID value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be assertedpublic void retract(long entid, String keyword, long value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be retractedpublic void retractRef(long entid, String keyword, long value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be retractedpublic void retractKeyword(long entid, String keyword, String value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be retractedpublic void retract(long entid, String keyword, boolean value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be retractedpublic void retract(long entid, String keyword, double value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be retractedpublic void retract(long entid, String keyword, Date value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be retractedpublic void retract(long entid, String keyword, String value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be retractedpublic void retract(long entid, String keyword, UUID value)
entid
- The `Entid` of the entity to be touched.keyword
- The name of the attribute in the format `:namespace/name`.value
- The value to be retractedpublic InProgressTransactionResult transact()
InProgressBuilder
such that no further assertions can be added after the `transact` has completed. To perform
further assertions, use the InProgress
inside the InProgressTransactionResult
returned from this function.
This does not commit the transaction. In order to do so, `commit` can be called on the
InProgress
inside the InProgressTransactionResult
returned from this function.
TODO throw exception if error occursInProgressTransactionResult
containing the current InProgress
and
the TxReport
generated by the transact.public TxReport commit()
InProgressBuilder
and the associated InProgress
such that no further assertions
can be added after the `commit` has completed.
To perform further assertions, a new `InProgress
or InProgressBuilder
should be
created.
TODO throw exception if error occursTxReport
generated by the commit.public void close() throws IOException
IOException
public com.sun.jna.Pointer getPointerForUUID(UUID uuid)
public UUID getUUIDFromPointer(com.sun.jna.Pointer uuidPtr)