001: /*
002: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: [See end of file]
004: */
005:
006: package com.hp.hpl.jena.db.impl;
007:
008: import java.util.List;
009:
010: import com.hp.hpl.jena.db.RDFRDBException;
011: import com.hp.hpl.jena.graph.Triple;
012: import com.hp.hpl.jena.graph.TripleMatch;
013: import com.hp.hpl.jena.util.iterator.ExtendedIterator;
014:
015: /**
016: * Generic database interface used for implementing PStore
017: * Different database table layouts and different SQL dialects should all
018: * be supportable via this generic interface.
019: *
020: * Based on the Jena1 version of IRDBDriver by Dave Reynolds
021: *
022: * @author hkuno
023: * @version $Revision: 1.15 $
024: */
025:
026: public interface IPSet {
027:
028: /**
029: * Link an existing instance of the IPSet to a specific driver
030: */
031: public void setDriver(IRDBDriver driver) throws RDFRDBException;
032:
033: /**
034: * Pass the SQL cache to the IPSet
035: */
036: public void setSQLCache(SQLCache cache);
037:
038: public SQLCache getSQLCache();
039:
040: public void setSQLType(String value);
041:
042: public void setSkipDuplicateCheck(boolean value);
043:
044: public void setCachePreparedStatements(boolean value);
045:
046: /**
047: * Close this PSet
048: */
049: public void close();
050:
051: /**
052: * Remove all RDF information associated with this PSet
053: * from a database.
054: */
055: public void cleanDB();
056:
057: /**
058: * Return boolean indicating whether or not statement
059: * table for specified statement table contains
060: * the specified triple for the specified graph.
061: */
062: public boolean statementTableContains(IDBID graphID, Triple t);
063:
064: /**
065: * @param t the triple to be added
066: * @param gid the id of the graph
067: */
068: public void storeTriple(Triple t, IDBID gid);
069:
070: /**
071: * Attempt to add a list of triples to the specialized graph.
072: *
073: * As each triple is successfully added it is removed from the List.
074: * If complete is true then the entire List was added and the List will
075: * be empty upon return. if complete is false, then at least one triple
076: * remains in the List.
077: *
078: * If a triple can't be stored for any reason other than incompatability
079: * (for example, a lack of disk space) then the implemenation should throw
080: * a runtime exception.
081: *
082: * @param triples List of triples to be added. This is modified by the call.
083: * @param my_GID ID of the graph.
084: */
085: public void storeTripleList(List triples, IDBID my_GID);
086:
087: /**
088: * @param t the triple to be added
089: * @param gid the id of the graph
090: */
091: public void deleteTriple(Triple t, IDBID gid);
092:
093: /**
094: * @param t the triple to be added
095: * @param gid the id of the graph
096: */
097: public void deleteTripleList(List triples, IDBID gid);
098:
099: /**
100: * Method extractTripleFromRowData.
101: * @param subjURI
102: * @param predURI
103: * @param objURI may be null
104: * @param objVal may be null
105: * @param objRef may be null
106: * @return Triple
107: */
108: Triple extractTripleFromRowData(String subj, String pred, String obj);
109:
110: /**
111: * Method find matching entries
112: * @param t tripleMatch pattern
113: * @param graphID of the graph to search
114: * @return ExtendedIterator holding results
115: */
116: public ExtendedIterator find(TripleMatch t, IDBID graphID);
117:
118: /**
119: * Return a count of the rows in a given table
120: *
121: * @param tName
122: * @return int
123: */
124: public int rowCount(int graphId);
125:
126: /**
127: * Remove the statements associated with this PStore
128: * from the database tables. Leave Literals.
129: * @param pProp properties
130: */
131: public void removeStatementsFromDB(IDBID graphID);
132:
133: /**
134: * @param graphId TODO
135: * @return number of triples in AssertedStatement table
136: */
137: public int tripleCount(IDBID graphId);
138:
139: /**
140: * @param tblName
141: */
142: public void setTblName(String tblName);
143:
144: /**
145: * @return String the name of the table that stores the PSet.
146: */
147: public String getTblName();
148:
149: /**
150: * @return the driver for the PSet
151: */
152: public IRDBDriver driver();
153:
154: }
155:
156: /*
157: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
158: * All rights reserved.
159: *
160: * Redistribution and use in source and binary forms, with or without
161: * modification, are permitted provided that the following conditions
162: * are met:
163: * 1. Redistributions of source code must retain the above copyright
164: * notice, this list of conditions and the following disclaimer.
165: * 2. Redistributions in binary form must reproduce the above copyright
166: * notice, this list of conditions and the following disclaimer in the
167: * documentation and/or other materials provided with the distribution.
168: * 3. The name of the author may not be used to endorse or promote products
169: * derived from this software without specific prior written permission.
170:
171: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
172: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
173: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
174: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
175: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
176: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
177: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
178: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
179: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
180: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
181: */
|