summaryrefslogtreecommitdiff
path: root/src/runtime/java/org/grammaticalframework
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/java/org/grammaticalframework')
-rw-r--r--src/runtime/java/org/grammaticalframework/sg/SG.java36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/runtime/java/org/grammaticalframework/sg/SG.java b/src/runtime/java/org/grammaticalframework/sg/SG.java
index 631b38ff7..278dd8117 100644
--- a/src/runtime/java/org/grammaticalframework/sg/SG.java
+++ b/src/runtime/java/org/grammaticalframework/sg/SG.java
@@ -1,12 +1,40 @@
package org.grammaticalframework.sg;
import java.io.Closeable;
-import org.grammaticalframework.pgf.Expr;
+import org.grammaticalframework.pgf.*;
public class SG implements Closeable {
- public static native SG openSG(String path);
- public native void close();
- public native TripleResult queryTriple(Expr subj, Expr pred, Expr obj);
+ /** Opens a new database file */
+ public static native SG openSG(String path) throws SGError;
+
+ /** Closes an already opened database */
+ public native void close() throws SGError;
+
+ /** Reads a triple in the format <expr,expr,expr> and returns it as an array */
+ public static native Expr[] readTriple(String s) throws PGFError;
+
+ /** Simple triple queries. Each of the arguments subj, pred and obj
+ * could be null. In that case the argument is interpreted as a wild card.
+ * If one of the arguments is not null then only triples with matching values
+ * will be retrieved.
+ *
+ * @return An iterator over the matching triples
+ */
+ public native TripleResult queryTriple(Expr subj, Expr pred, Expr obj) throws SGError;
+
+ /** Start a new transaction */
+ public native void beginTrans() throws SGError;
+
+ /** Commits the transaction */
+ public native void commit() throws SGError;
+
+ /** Rollbacks all changes made in the current transaction */
+ public native void rollback() throws SGError;
+
+ /** Inserts a new triple.
+ * @return an unique id that identifies this triple in the database
+ */
+ public native long insertTriple(Expr subj, Expr pred, Expr obj) throws SGError;
//////////////////////////////////////////////////////////////////
// private stuff