diff options
| author | John J. Camilleri <john@digitalgrammars.com> | 2020-07-08 22:07:08 +0200 |
|---|---|---|
| committer | John J. Camilleri <john@digitalgrammars.com> | 2020-07-08 22:07:08 +0200 |
| commit | f54e54123c41750510f856d596724db739239123 (patch) | |
| tree | 1205948e34dcf7e6b14200a7da8f1755d0cbb201 /src/runtime/java/org | |
| parent | 2ac796dbbc8f210132665a580d1ad55145c21fea (diff) | |
| parent | 33818076ff553510b5e4a4d0295388d07ece2ec4 (diff) | |
Merge remote-tracking branch 'origin/master' into pgf2-hackage
# Conflicts:
# src/runtime/haskell-bind/pgf2.cabal
Diffstat (limited to 'src/runtime/java/org')
3 files changed, 0 insertions, 120 deletions
diff --git a/src/runtime/java/org/grammaticalframework/sg/SG.java b/src/runtime/java/org/grammaticalframework/sg/SG.java deleted file mode 100644 index 64dd6b511..000000000 --- a/src/runtime/java/org/grammaticalframework/sg/SG.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.grammaticalframework.sg; - -import java.io.Closeable; -import org.grammaticalframework.pgf.*; - -/** This class represents a connection to a semantic graph database. - * The semantic graph is a graph represented as a set of tripples - * of abstract expressions. The graph can be used for instance to store - * semantic information for entities in a GF grammar. - */ -public class SG implements Closeable { - /** 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. - * A null 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; - - /** Starts 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 - private long ref; - - private SG(long ref) { - this.ref = ref; - } - - static { - System.loadLibrary("jpgf"); - } -} diff --git a/src/runtime/java/org/grammaticalframework/sg/SGError.java b/src/runtime/java/org/grammaticalframework/sg/SGError.java deleted file mode 100644 index 8b03caab7..000000000 --- a/src/runtime/java/org/grammaticalframework/sg/SGError.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.grammaticalframework.sg; - -/** This exception is thrown if an error occurs in the semantic graph. - */ -public class SGError extends RuntimeException { - private static final long serialVersionUID = -6098784400143861939L; - - public SGError(String message) { - super(message); - } -} diff --git a/src/runtime/java/org/grammaticalframework/sg/TripleResult.java b/src/runtime/java/org/grammaticalframework/sg/TripleResult.java deleted file mode 100644 index 5570fd93b..000000000 --- a/src/runtime/java/org/grammaticalframework/sg/TripleResult.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.grammaticalframework.sg; - -import java.io.Closeable; -import org.grammaticalframework.pgf.Expr; - -/** This class is used to iterate over a list of triples. - * To move to the next triple, call {@link TripleResult#hasNext}. - * When you do not need the iterator anymore then call {@link TripleResult#close} - * to release the allocated resources. - */ -public class TripleResult implements Closeable { - public native boolean hasNext(); - - /** Closes the iterator and releases the allocated resources. */ - public native void close(); - - /** Each triple has an unique integer key. You can get the key for - * the current triple by calling {@link TripleResult#getKey}. - */ - public long getKey() { - return key; - } - - /** This is the first element of the current triple. */ - public Expr getSubject() { - return subj; - } - - /** This is the second element of the current triple. */ - public Expr getPredicate() { - return pred; - } - - /** This is the third element of the current triple. */ - public Expr getObject() { - return obj; - } - - ////////////////////////////////////////////////////////////////// - // private stuff - private long ref; - private long key; - private Expr subj; - private Expr pred; - private Expr obj; - - private TripleResult(long ref, Expr subj, Expr pred, Expr obj) { - this.ref = ref; - this.subj = subj; - this.pred = pred; - this.obj = obj; - } -} |
