Source Code Cross Referenced for SpecializedGraph_TripleStore.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » db » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.db.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  (c) Copyright 2003  Hewlett-Packard Development Company, LP
003:         *  All rights reserved.
004:         *
005:         */
006:
007:        package com.hp.hpl.jena.db.impl;
008:
009:        import java.util.List;
010:
011:        import com.hp.hpl.jena.graph.*;
012:        import com.hp.hpl.jena.util.iterator.ExtendedIterator;
013:
014:        /**
015:         * @author hkuno
016:         * @version $Version$
017:         *
018:         * TripleStoreGraph is an abstract superclass for TripleStoreGraph
019:         * implementations.  By "triple store," we mean that the subjects, predicate
020:         * and object URI's are stored in a single collection (denormalized).
021:         * 
022:         */
023:        public abstract class SpecializedGraph_TripleStore extends
024:                SpecializedGraphBase {
025:
026:            /**
027:             * holds PSet
028:             */
029:            public IPSet m_pset;
030:
031:            /**
032:             * caches a copy of LSet properties
033:             */
034:            public DBPropLSet m_dbPropLSet;
035:
036:            /**
037:             * holds ID of graph in database (defaults to "0")
038:             */
039:            public IDBID my_GID = null;
040:
041:            // constructors
042:
043:            /** 
044:             * Constructor
045:             * Create a new instance of a TripleStore graph.
046:             */
047:            SpecializedGraph_TripleStore(DBPropLSet lProp, IPSet pSet,
048:                    Integer dbGraphID) {
049:                m_pset = pSet;
050:                m_dbPropLSet = lProp;
051:                my_GID = new DBIDInt(dbGraphID);
052:            }
053:
054:            /** 
055:             *  Constructor
056:             * 
057:             *  Create a new instance of a TripleStore graph, taking
058:             *  DBPropLSet and a PSet as arguments
059:             */
060:            public SpecializedGraph_TripleStore(IPSet pSet, Integer dbGraphID) {
061:                m_pset = pSet;
062:                my_GID = new DBIDInt(dbGraphID);
063:            }
064:
065:            /** 
066:             * Attempt to add all the triples from a graph to the specialized graph
067:             * 
068:             * Caution - this call changes the graph passed in, deleting from 
069:             * it each triple that is successfully added.
070:             * 
071:             * Node that when calling add, if complete is true, then the entire
072:             * graph was added successfully and the graph g will be empty upon
073:             * return.  If complete is false, then some triples in the graph could 
074:             * not be added.  Those triples remain in g after the call returns.
075:             * 
076:             * If the triple can't be stored for any reason other than incompatability
077:             * (for example, a lack of disk space) then the implemenation should throw
078:             * a runtime exception.
079:             * 
080:             * @param g is a graph containing triples to be added
081:             * @param complete is true if a subsequent call to contains(triple) will return true for any triple in g.
082:             */
083:            public void add(Graph g, CompletionFlag complete) {
084:                ExtendedIterator it = GraphUtil.findAll(g);
085:                while (it.hasNext())
086:                    add((Triple) it.next(), complete);
087:                complete.setDone();
088:            }
089:
090:            /* (non-Javadoc)
091:             * @see com.hp.hpl.jena.db.impl.SpecializedGraph#add(com.hp.hpl.jena.graph.Triple, com.hp.hpl.jena.db.impl.SpecializedGraph.CompletionFlag)
092:             */
093:            public void add(Triple t, CompletionFlag complete) {
094:                m_pset.storeTriple(t, my_GID);
095:                complete.setDone();
096:            }
097:
098:            /* (non-Javadoc)
099:             * @see com.hp.hpl.jena.db.impl.SpecializedGraph#add(java.util.List, com.hp.hpl.jena.db.impl.SpecializedGraph.CompletionFlag)
100:             */
101:            public void add(List triples, CompletionFlag complete) {
102:                m_pset.storeTripleList(triples, my_GID);
103:                complete.setDone();
104:            }
105:
106:            /* (non-Javadoc)
107:             * @see com.hp.hpl.jena.db.impl.SpecializedGraph#delete(com.hp.hpl.jena.graph.Triple, com.hp.hpl.jena.db.impl.SpecializedGraph.CompletionFlag)
108:             */
109:            public void delete(Triple t, CompletionFlag complete) {
110:                m_pset.deleteTriple(t, my_GID);
111:                complete.setDone();
112:            }
113:
114:            /* (non-Javadoc)
115:             * @see com.hp.hpl.jena.db.impl.SpecializedGraph#delete(java.util.List, com.hp.hpl.jena.db.impl.SpecializedGraph.CompletionFlag)
116:             */
117:            public void delete(List triples, CompletionFlag complete) {
118:                m_pset.deleteTripleList(triples, my_GID);
119:                complete.setDone();
120:            }
121:
122:            /* (non-Javadoc)
123:             * @see com.hp.hpl.jena.db.impl.SpecializedGraph#tripleCount()
124:             */
125:            public int tripleCount() {
126:                return (m_pset.tripleCount(my_GID));
127:            }
128:
129:            /* (non-Javadoc)
130:             * @see com.hp.hpl.jena.db.impl.SpecializedGraph#contains(com.hp.hpl.jena.graph.Triple, com.hp.hpl.jena.db.impl.SpecializedGraph.CompletionFlag)
131:             */
132:            public boolean contains(Triple t, CompletionFlag complete) {
133:                complete.setDone();
134:                return (m_pset.statementTableContains(my_GID, t));
135:            }
136:
137:            /* (non-Javadoc)
138:             * @see com.hp.hpl.jena.db.impl.SpecializedGraph#find(com.hp.hpl.jena.graph.TripleMatch, com.hp.hpl.jena.db.impl.SpecializedGraph.CompletionFlag)
139:             */
140:            public ExtendedIterator find(TripleMatch t, CompletionFlag complete) {
141:                complete.setDone();
142:                return (ExtendedIterator) m_pset.find(t, my_GID);
143:            }
144:
145:            /*
146:             * @see com.hp.hpl.jena.db.impl.SpecializedGraph#close()
147:             */
148:            public void close() {
149:                m_pset.close();
150:            }
151:
152:            /*
153:             * @see com.hp.hpl.jena.db.impl.SpecializedGraph#clear()
154:             */
155:            public void clear() {
156:                m_pset.removeStatementsFromDB(my_GID);
157:            }
158:
159:            /* (non-Javadoc)
160:             * @see com.hp.hpl.jena.db.impl.SpecializedGraphReifier#graphIdGet()
161:             */
162:            public int getGraphId() {
163:                return ((DBIDInt) my_GID).getIntID();
164:            }
165:
166:            /* (non-Javadoc)
167:             * @see com.hp.hpl.jena.db.impl.SpecializedGraphReifier#PSetGet()
168:             */
169:            public IPSet getPSet() {
170:                return m_pset;
171:            }
172:
173:            /* (non-Javadoc)
174:             * @see com.hp.hpl.jena.db.impl.SpecializedGraphReifier#DBPropLSetGet()
175:             */
176:            public DBPropLSet getDBPropLSet() {
177:                return m_dbPropLSet;
178:            }
179:
180:        }
181:
182:        /*
183:         *  (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
184:         *  All rights reserved.
185:         *
186:         * Redistribution and use in source and binary forms, with or without
187:         * modification, are permitted provided that the following conditions
188:         * are met:
189:         * 1. Redistributions of source code must retain the above copyright
190:         *    notice, this list of conditions and the following disclaimer.
191:         * 2. Redistributions in binary form must reproduce the above copyright
192:         *    notice, this list of conditions and the following disclaimer in the
193:         *    documentation and/or other materials provided with the distribution.
194:         * 3. The name of the author may not be used to endorse or promote products
195:         *    derived from this software without specific prior written permission.
196:
197:         * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
198:         * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
199:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
200:         * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
201:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
202:         * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
203:         * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
204:         * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
205:         * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
206:         * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
207:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.