1 6 7 package com.hp.hpl.jena.mem; 8 9 import com.hp.hpl.jena.graph.*; 10 import com.hp.hpl.jena.graph.impl.TripleStore; 11 import com.hp.hpl.jena.graph.query.*; 12 import com.hp.hpl.jena.shared.*; 13 import com.hp.hpl.jena.util.iterator.*; 14 15 19 public class GraphMem extends GraphMemBase implements Graph 20 { 21 protected TripleStore store = new GraphTripleStore( this ); 22 23 26 public GraphMem() 27 { this( ReificationStyle.Minimal ); } 28 29 32 public GraphMem( ReificationStyle style ) 33 { super( style ); } 34 35 protected void destroy() 36 { store.close(); } 37 38 public void performAdd( Triple t ) 39 { if (!getReifier().handledAdd( t )) store.add( t ); } 40 41 public void performDelete( Triple t ) 42 { if (!getReifier().handledRemove( t )) store.delete( t ); } 43 44 public int graphBaseSize() 45 { return store.size(); } 46 47 public QueryHandler queryHandler() 48 { 49 if (queryHandler == null) queryHandler = new GraphMemQueryHandler( this ); 50 return queryHandler; 51 } 52 53 public BulkUpdateHandler getBulkUpdateHandler() 54 { 55 if (bulkHandler == null) bulkHandler = new GraphMemBulkUpdateHandler( this ); 56 return bulkHandler; 57 } 58 59 63 public ExtendedIterator graphBaseFind( TripleMatch m ) 64 { return store.find( m.asTriple() ); } 65 66 71 public boolean graphBaseContains( Triple t ) 72 { return t.isConcrete() ? store.contains( t ) : super.graphBaseContains( t ); } 73 74 77 public void clear() 78 { store.clear(); } 79 } 80 81 | Popular Tags |