You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2013/08/15 14:48:14 UTC
svn commit: r1514247 - in
/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store:
DatasetGraphTDB.java GraphTDB.java
Author: andy
Date: Thu Aug 15 12:48:13 2013
New Revision: 1514247
URL: http://svn.apache.org/r1514247
Log:
Reformat
Modified:
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/GraphTDB.java
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java?rev=1514247&r1=1514246&r2=1514247&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java Thu Aug 15 12:48:13 2013
@@ -67,8 +67,7 @@ public class DatasetGraphTDB extends Dat
private boolean closed = false ;
public DatasetGraphTDB(TripleTable tripleTable, QuadTable quadTable, DatasetPrefixesTDB prefixes,
- ReorderTransformation transform, StorageConfig config)
- {
+ ReorderTransformation transform, StorageConfig config) {
this.tripleTable = tripleTable ;
this.quadTable = quadTable ;
this.prefixes = prefixes ;
@@ -77,47 +76,25 @@ public class DatasetGraphTDB extends Dat
this.effectiveDefaultGraph = getDefaultGraphTDB() ;
}
- @Deprecated
- protected DatasetGraphTDB(DatasetGraphTDB other)
- {
- this(other.tripleTable, other.quadTable, other.prefixes, other.transform, other.config) ;
- getContext().putAll(other.getContext()) ;
- }
-
- @Deprecated
- public DatasetGraphTDB duplicate()
- {
- DatasetGraphTDB dsg = new DatasetGraphTDB(tripleTable, quadTable, prefixes, transform, config) ;
- dsg.getContext().putAll(getContext()) ;
- return dsg ;
- }
-
public QuadTable getQuadTable() { return quadTable ; }
public TripleTable getTripleTable() { return tripleTable ; }
@Override
- protected Iterator<Quad> findInDftGraph(Node s, Node p, Node o)
- {
+ protected Iterator<Quad> findInDftGraph(Node s, Node p, Node o) {
return triples2quadsDftGraph(getTripleTable().find(s, p, o)) ;
}
@Override
protected Iterator<Quad> findInSpecificNamedGraph(Node g, Node s, Node p, Node o)
- {
- return getQuadTable().find(g, s, p, o) ;
- }
+ { return getQuadTable().find(g, s, p, o) ; }
@Override
protected Iterator<Quad> findInAnyNamedGraphs(Node s, Node p, Node o)
- {
- return getQuadTable().find(Node.ANY, s, p, o) ;
- }
+ { return getQuadTable().find(Node.ANY, s, p, o) ; }
protected static Iterator<Quad> triples2quadsDftGraph(Iterator<Triple> iter)
- {
- return triples2quads(Quad.defaultGraphIRI, iter) ;
- }
-
+ { return triples2quads(Quad.defaultGraphIRI, iter) ; }
+
@Override
protected void addToDftGraph(Node s, Node p, Node o)
{ getTripleTable().add(s,p,o) ; }
@@ -134,21 +111,16 @@ public class DatasetGraphTDB extends Dat
protected void deleteFromNamedGraph(Node g, Node s, Node p, Node o)
{ getQuadTable().delete(g, s, p, o) ; }
- public GraphTDB getDefaultGraphTDB()
- {
- return (GraphTDB)getDefaultGraph() ;
- }
+ public GraphTDB getDefaultGraphTDB()
+ { return (GraphTDB)getDefaultGraph() ; }
public GraphTDB getGraphTDB(Node graphNode)
- {
- return (GraphTDB)getGraph(graphNode) ;
- }
+ { return (GraphTDB)getGraph(graphNode) ; }
// The effective graph may not be the concrete storage one (e.g. union)
@Override
- protected void _close()
- {
+ protected void _close() {
if ( closed )
return ;
closed = true ;
@@ -164,16 +136,14 @@ public class DatasetGraphTDB extends Dat
@Override
// Empty graphs don't "exist"
- public boolean containsGraph(Node graphNode)
- {
+ public boolean containsGraph(Node graphNode) {
if ( Quad.isDefaultGraphExplicit(graphNode) || Quad.isUnionGraph(graphNode) )
return true ;
return _containsGraph(graphNode) ;
}
@Override
- protected boolean _containsGraph(Node graphNode)
- {
+ protected boolean _containsGraph(Node graphNode) {
// Have to look explicitly, which is a bit of a nuisance.
// But does not normally happen for GRAPH <g> because that's rewritten to quads.
// Only pattern with complex paths go via GRAPH.
@@ -190,15 +160,11 @@ public class DatasetGraphTDB extends Dat
@Override
protected Graph _createDefaultGraph()
- {
- return new GraphTDB(this, null) ;
- }
+ { return new GraphTDB(this, null) ; }
@Override
protected Graph _createNamedGraph(Node graphNode)
- {
- return new GraphTDB(this, graphNode) ;
- }
+ { return new GraphTDB(this, graphNode) ; }
public void setEffectiveDefaultGraph(GraphTDB g) { effectiveDefaultGraph = g ; }
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/GraphTDB.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/GraphTDB.java?rev=1514247&r1=1514246&r2=1514247&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/GraphTDB.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/GraphTDB.java Thu Aug 15 12:48:13 2013
@@ -47,8 +47,7 @@ public class GraphTDB extends GraphView
// Switch this to DatasetGraphTransaction
private final DatasetGraphTDB dataset ;
- public GraphTDB(DatasetGraphTDB dataset, Node graphName)
- {
+ public GraphTDB(DatasetGraphTDB dataset, Node graphName) {
super(dataset, graphName) ;
this.dataset = dataset ;
}
@@ -58,8 +57,7 @@ public class GraphTDB extends GraphView
{ return dataset ; }
/** The NodeTupleTable for this graph */
- public NodeTupleTable getNodeTupleTable()
- {
+ public NodeTupleTable getNodeTupleTable() {
return getDSG().chooseNodeTupleTable(getGraphName()) ;
}
@@ -67,14 +65,12 @@ public class GraphTDB extends GraphView
* @deprecated Use DatasetGraphTDB.chooseNodeTupleTable
*/
@Deprecated
- public static NodeTupleTable chooseNodeTupleTable(DatasetGraphTDB dsg, Node graphNode)
- {
+ public static NodeTupleTable chooseNodeTupleTable(DatasetGraphTDB dsg, Node graphNode) {
return dsg.chooseNodeTupleTable(graphNode) ;
}
@Override
- protected PrefixMapping createPrefixMapping()
- {
+ protected PrefixMapping createPrefixMapping() {
if ( isDefaultGraph() )
return getDSG().getPrefixes().getPrefixMapping() ;
if ( isUnionGraph() )
@@ -83,16 +79,14 @@ public class GraphTDB extends GraphView
}
@Override
- public final void performAdd(Triple triple)
- {
+ public final void performAdd(Triple triple) {
startUpdate() ;
super.performAdd(triple) ;
finishUpdate() ;
}
@Override
- public final void performDelete(Triple triple)
- {
+ public final void performDelete(Triple triple) {
startUpdate() ;
super.performDelete(triple) ;
finishUpdate() ;
@@ -114,8 +108,7 @@ public class GraphTDB extends GraphView
return WrappedIterator.createNoRemove(iterTriples) ;
}
- protected static ExtendedIterator<Triple> graphBaseFindNG(DatasetGraphTDB dataset, Node graphNode, TripleMatch m)
- {
+ protected static ExtendedIterator<Triple> graphBaseFindNG(DatasetGraphTDB dataset, Node graphNode, TripleMatch m) {
Node gn = graphNode ;
// Explicitly named union graph.
if ( isUnionGraph(gn) )
@@ -133,8 +126,7 @@ public class GraphTDB extends GraphView
}
@Override
- protected ExtendedIterator<Triple> graphUnionFind(Node s, Node p, Node o)
- {
+ protected ExtendedIterator<Triple> graphUnionFind(Node s, Node p, Node o) {
Node g = Quad.unionGraph ;
Iterator<Quad> iterQuads = getDSG().find(g, s, p, o) ;
Iterator<Triple> iter = GLib.quads2triples(iterQuads) ;
@@ -152,8 +144,7 @@ public class GraphTDB extends GraphView
public final void finishUpdate() { getDSG().finishUpdate() ; }
@Override
- protected final int graphBaseSize()
- {
+ protected final int graphBaseSize() {
if ( isDefaultGraph() )
return (int)getNodeTupleTable().size() ;
@@ -161,8 +152,7 @@ public class GraphTDB extends GraphView
boolean unionGraph = isUnionGraph(gn) ;
gn = unionGraph ? Node.ANY : gn ;
Iterator<Tuple<NodeId>> iter = getDSG().getQuadTable().getNodeTupleTable().findAsNodeIds(gn, null, null, null) ;
- if ( unionGraph )
- {
+ if ( unionGraph ) {
iter = Iter.map(iter, project4TupleTo3Tuple) ;
iter = Iter.distinctAdjacent(iter) ;
}
@@ -171,16 +161,14 @@ public class GraphTDB extends GraphView
private static Transform<Tuple<NodeId>, Tuple<NodeId>> project4TupleTo3Tuple = new Transform<Tuple<NodeId>, Tuple<NodeId>>(){
@Override
- public Tuple<NodeId> convert(Tuple<NodeId> item)
- {
+ public Tuple<NodeId> convert(Tuple<NodeId> item) {
if ( item.size() != 4 )
throw new TDBException("Expected a Tuple of 4, got: "+item) ;
return Tuple.create(item.get(1), item.get(2), item.get(3)) ;
}} ;
// Convert from Iterator<Quad> to Iterator<Triple>
- static class ProjectQuadsToTriples implements Iterator<Triple>
- {
+ static class ProjectQuadsToTriples implements Iterator<Triple> {
private final Iterator<Quad> iter ;
private final Node graphNode ;
/** Project quads to triples - check the graphNode is as expected if not null */
@@ -189,8 +177,7 @@ public class GraphTDB extends GraphView
public boolean hasNext() { return iter.hasNext() ; }
@Override
- public Triple next()
- {
+ public Triple next() {
Quad q = iter.next();
if ( graphNode != null && ! q.getGraph().equals(graphNode))
throw new InternalError("ProjectQuadsToTriples: Quads from unexpected graph (expected="+graphNode+", got="+q.getGraph()+")") ;
@@ -201,8 +188,7 @@ public class GraphTDB extends GraphView
}
@Override
- public Capabilities getCapabilities()
- {
+ public Capabilities getCapabilities() {
if ( capabilities == null )
capabilities = new Capabilities(){
@Override
@@ -238,15 +224,13 @@ public class GraphTDB extends GraphView
{ return transactionHandler ; }
@Override
- public void clear()
- {
+ public void clear() {
dataset.deleteAny(getGraphName(), Node.ANY, Node.ANY, Node.ANY) ;
getEventManager().notifyEvent(this, GraphEvents.removeAll ) ;
}
@Override
- public void remove( Node s, Node p, Node o )
- {
+ public void remove( Node s, Node p, Node o ) {
if ( getEventManager().listening() )
{
// Have to do it the hard way so that triple events happen.