Skip to content

Commit

Permalink
JENA-926 : Deprecate GraphStore.
Browse files Browse the repository at this point in the history
In SDBFactory, add replacement operations.
  • Loading branch information
afs committed May 24, 2015
1 parent 575a2b4 commit dc19466
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.jena.sparql.core.DatasetGraphWrapper ;
import org.apache.jena.update.GraphStore ;

@SuppressWarnings("deprecation")
public class GraphStoreBasic extends DatasetGraphWrapper implements GraphStore
{
public GraphStoreBasic(Dataset ds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
/**
* A black hole for Quads, add as many as you want and it will forget them all. Useful for testing.
*/
@SuppressWarnings("deprecation")
public class GraphStoreNull extends DatasetGraphQuad implements GraphStore
{
public GraphStoreNull() {}

@Override
public Iterator<Quad> find(Node g, Node s, Node p, Node o)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class GraphStoreNullTransactional extends GraphStoreNull implements Trans
{
private final Transactional transaction = new TransactionalNull() ;

public GraphStoreNullTransactional() {}

@Override
public void begin(ReadWrite readWrite)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.jena.sparql.core.DatasetGraphWrapper ;
import org.apache.jena.update.GraphStore ;

@SuppressWarnings("deprecation")
public class GraphStoreWrapper extends DatasetGraphWrapper implements GraphStore
{
protected final GraphStore graphStore ;
Expand Down
14 changes: 2 additions & 12 deletions jena-arq/src/main/java/org/apache/jena/update/GraphStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@
/** A collection of graphs that an update can be applied to.
* The collection is one unnamed graph and zero or more named graphs, like
* a SPARQL dataset. */
@Deprecated
public interface GraphStore extends DatasetGraph
{
// /** Convert to a dataset (for query) */
// public Dataset toDataset() ;
//
// /** Signal start of a request being executed */
// public void startRequest() ;
// /** Signal end of a request being executed */
// public void finishRequest() ;

// public void sync() ;
// public void close() ;
}
{ }
67 changes: 63 additions & 4 deletions jena-sdb/src/main/java/org/apache/jena/sdb/SDBFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package org.apache.jena.sdb;

import java.sql.Connection;
import java.sql.Connection ;

import org.apache.jena.graph.Graph ;
import org.apache.jena.graph.Node ;
Expand All @@ -33,13 +33,16 @@
import org.apache.jena.sdb.store.DatasetGraphSDB ;
import org.apache.jena.sdb.store.DatasetStore ;
import org.apache.jena.sdb.store.StoreFactory ;
import org.apache.jena.sparql.core.DatasetGraph ;
import org.apache.jena.sparql.modify.GraphStoreBasic ;
import org.apache.jena.update.GraphStore ;

/** Various operations to create or connect objects to do with SDB:
* SDBConnections, Stores, Models, Graphs.
* Convenience calls.
*/

@SuppressWarnings("deprecation")
public class SDBFactory
{
// ---- Connections
Expand Down Expand Up @@ -184,21 +187,43 @@ public static Dataset connectDataset(String configFile)

// ---- GraphStore

/**
* Connect to the store as a DatasetGraph
* @param store
* @return DatasetGraph
*/
public static DatasetGraph connectDatasetGraph(Store store)
{ return new DatasetGraphSDB(store, SDB.getContext().copy()) ; }

// ---- GraphStore

/**
* Connect to the store as a GraphStore
* @param store
* @return GraphStore
* @deprecated Use connectDatasetGraph(Store)
*/
public static DatasetGraphSDB connectGraphStore(Store store)
@Deprecated
public static GraphStore connectGraphStore(Store store)
{
return new DatasetGraphSDB(store, SDB.getContext().copy()) ;
return new GraphStoreBasic(connectDatasetGraph(store)) ;
}

/**
* Connect to the store as a GraphStore.
* @param desc Store description
* @return DatasetGraph
*/
public static DatasetGraph connectDatasetGraph(StoreDesc desc)
{ return connectDatasetGraph(connectStore(desc)) ; }

/**
* Connect to the store as a GraphStore.
* @param desc Store description
* @return GraphStore
* @deprecated Use connectDataset(StoreDesc) or connectDatasetGraph(StoreDesc)
*/
@Deprecated
public static GraphStore connectGraphStore(StoreDesc desc)
{ return connectGraphStore(connectStore(desc)) ; }

Expand All @@ -208,26 +233,60 @@ public static GraphStore connectGraphStore(StoreDesc desc)
* @param desc Store description object
* @return GraphStore
*/
public static DatasetGraph connectDatasetGraph(SDBConnection sdbConnection, StoreDesc desc)
{ return connectDatasetGraph(connectStore(sdbConnection, desc)) ; }

/**
* Connect to the store as a GraphStore, using existing SDBConnection and a store description.
* @param sdbConnection SDB connection
* @param desc Store description object
* @return GraphStore
* @deprecated Use connectDatasetGraph(SDBConnection, StoreDesc)
*/
@Deprecated
public static GraphStore connectGraphStore(SDBConnection sdbConnection, StoreDesc desc)
{ return connectGraphStore(connectStore(sdbConnection, desc)) ; }

/**
* Connect to the store as a GraphStore, using existing JDBC connection and a store description.
* @param jdbcConnection JDBC connection
* @param desc Store description object
* @return DatasetGraph
*/
public static DatasetGraph connectDatasetGraph(Connection jdbcConnection, StoreDesc desc)
{ return connectDatasetGraph(connectStore(jdbcConnection, desc)) ; }

/**
* Connect to the store as a GraphStore, using existing JDBC connection and a store description.
* @param jdbcConnection JDBC connection
* @param desc Store description object
* @return GraphStore
* @deprected Use connectDatasetGraph(Connection, StoreDesc)
*/
@Deprecated
public static GraphStore connectGraphStore(Connection jdbcConnection, StoreDesc desc)
{ return connectGraphStore(connectStore(jdbcConnection, desc)) ; }

/**
* Connect to the store as a GraphStore, based on a Store assembler file.
* @param configFile
* @return GraphStore
*/
public static DatasetGraph connectDatasetGraph(String configFile)
{ return connectDatasetGraph(connectStore(configFile)) ; }

/**
* Connect to the store as a GraphStore, based on a Store assembler file.
* @param configFile
* @return GraphStore
* @deprecated use connectDatasetGraph(String)
*/
@Deprecated
public static GraphStore connectGraphStore(String configFile)
{ return connectGraphStore(connectStore(configFile)) ; }



// ---- Graph

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
import org.apache.jena.sparql.core.DatasetGraphCaching ;
import org.apache.jena.sparql.core.Quad ;
import org.apache.jena.sparql.util.Context ;
import org.apache.jena.update.GraphStore ;

public class DatasetGraphSDB extends DatasetGraphCaching
implements DatasetGraph, Closeable, GraphStore
implements DatasetGraph, Closeable
{
private final Store store ;
private Lock lock = new LockMRSW() ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.apache.jena.tdb.sys.Session ;
import org.apache.jena.tdb.transaction.DatasetGraphTransaction ;
import org.apache.jena.tdb.transaction.DatasetGraphTxn ;
import org.apache.jena.update.GraphStore ;

/** This is the class that creates a dataset over the storage via
* TripleTable, QuadTable and prefixes. These may be transactional.
Expand All @@ -49,7 +48,7 @@
*/
final
public class DatasetGraphTDB extends DatasetGraphCaching
implements /*DatasetGraph,*/ Sync, Closeable, GraphStore, Session
implements /*DatasetGraph,*/ Sync, Closeable, Session
{
private TripleTable tripleTable ;
private QuadTable quadTable ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@
import org.apache.jena.tdb.TDB ;
import org.apache.jena.tdb.base.file.Location ;
import org.apache.jena.tdb.store.DatasetGraphTDB ;
import org.apache.jena.update.GraphStore ;

/**
* Transactional DatasetGraph that allows one active transaction. For multiple
* read transactions, create multiple DatasetGraphTransaction objects. This is
* analogous to a "connection" in JDBC.
*/

public class DatasetGraphTransaction extends DatasetGraphTrackActive implements GraphStore, Sync {
public class DatasetGraphTransaction extends DatasetGraphTrackActive implements Sync {
/*
* Initially, the app can use this DatasetGraph non-transactionally. But as
* soon as it starts a transaction, the dataset can only be used inside
Expand Down

0 comments on commit dc19466

Please sign in to comment.