From 33818076ff553510b5e4a4d0295388d07ece2ec4 Mon Sep 17 00:00:00 2001 From: krangelov Date: Wed, 8 Jul 2020 21:12:01 +0200 Subject: drop the SG library completely. --- .../java/org/grammaticalframework/sg/SG.java | 56 ---------------------- .../java/org/grammaticalframework/sg/SGError.java | 11 ----- .../org/grammaticalframework/sg/TripleResult.java | 53 -------------------- 3 files changed, 120 deletions(-) delete mode 100644 src/runtime/java/org/grammaticalframework/sg/SG.java delete mode 100644 src/runtime/java/org/grammaticalframework/sg/SGError.java delete mode 100644 src/runtime/java/org/grammaticalframework/sg/TripleResult.java (limited to 'src/runtime/java/org') 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; - } -} -- cgit v1.2.3