1 6 7 package com.hp.hpl.jena.db.impl; 8 9 import java.util.List ; 10 11 import com.hp.hpl.jena.graph.*; 12 import com.hp.hpl.jena.util.iterator.ExtendedIterator; 13 14 23 public abstract class SpecializedGraph_TripleStore extends SpecializedGraphBase { 24 25 28 public IPSet m_pset; 29 30 33 public DBPropLSet m_dbPropLSet; 34 35 38 public IDBID my_GID = null; 39 40 42 46 SpecializedGraph_TripleStore(DBPropLSet lProp, IPSet pSet, Integer dbGraphID) { 47 m_pset = pSet; 48 m_dbPropLSet = lProp; 49 my_GID = new DBIDInt(dbGraphID); 50 } 51 52 58 public SpecializedGraph_TripleStore(IPSet pSet, Integer dbGraphID) { 59 m_pset = pSet; 60 my_GID = new DBIDInt(dbGraphID); 61 } 62 63 81 public void add(Graph g, CompletionFlag complete) { 82 ExtendedIterator it = GraphUtil.findAll( g ); 83 while (it.hasNext()) add( (Triple)it.next(), complete ); 84 complete.setDone(); 85 } 86 87 88 91 public void add(Triple t, CompletionFlag complete) { 92 m_pset.storeTriple(t, my_GID); 93 complete.setDone(); 94 } 95 96 97 100 public void add(List triples, CompletionFlag complete) { 101 m_pset.storeTripleList(triples,my_GID); 102 complete.setDone(); 103 } 104 105 108 public void delete(Triple t, CompletionFlag complete) { 109 m_pset.deleteTriple(t, my_GID); 110 complete.setDone(); 111 } 112 113 116 public void delete(List triples, CompletionFlag complete) { 117 m_pset.deleteTripleList(triples,my_GID); 118 complete.setDone(); 119 } 120 121 124 public int tripleCount() { 125 return(m_pset.tripleCount()); 126 } 127 128 131 public boolean contains(Triple t, CompletionFlag complete) { 132 complete.setDone(); 133 return (m_pset.statementTableContains(my_GID, t)); 134 } 135 136 139 public ExtendedIterator find(TripleMatch t, CompletionFlag complete) { 140 complete.setDone(); 141 return (ExtendedIterator)m_pset.find(t, my_GID); 142 } 143 144 147 public void close() { 148 m_pset.close(); 149 } 150 151 154 public void clear() { 155 m_pset.removeStatementsFromDB(my_GID); 156 } 157 158 161 public int getGraphId() { 162 return ((DBIDInt)my_GID).getIntID(); 163 } 164 165 168 public IPSet getPSet() { 169 return m_pset; 170 } 171 172 175 public DBPropLSet getDBPropLSet() { 176 return m_dbPropLSet; 177 } 178 179 } 180 181 207 | Popular Tags |