1 6 7 package com.hp.hpl.jena.graph.compose; 8 9 import com.hp.hpl.jena.graph.*; 10 import com.hp.hpl.jena.util.iterator.*; 11 12 import com.hp.hpl.jena.mem.*; 13 14 15 22 23 public class Delta extends Dyadic implements Graph 24 { 25 private Graph base; 26 27 public Delta( Graph base ) 28 { 29 super( new GraphMem(), new GraphMem() ); 30 this.base = base; 31 } 32 33 36 public Graph getAdditions() 37 { return L; } 38 39 42 public Graph getDeletions() 43 { return R; } 44 45 48 public void performAdd( Triple t ) 49 { 50 L.add( t ); 51 R.delete( t ); 52 } 53 54 57 public void performDelete( Triple t ) 58 { 59 L.delete( t ); 60 R.add( t ); 61 } 62 63 67 public ExtendedIterator graphBaseFind( TripleMatch tm ) 68 { 69 return base.find( tm ) .filterDrop( ifIn( GraphUtil.findAll( R ) ) ) .andThen( L.find( tm ) ); 70 } 71 72 public void close() 73 { 74 super.close(); 75 base.close(); 76 } 77 78 public int graphBaseSize() 79 { return base.size() + L.size() - R.size(); } 80 } 81 82 111 | Popular Tags |