Source Code Cross Referenced for DBReifierGraph.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, 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 com.hp.hpl.jena.db.GraphRDB;
009:        import com.hp.hpl.jena.graph.*;
010:        import com.hp.hpl.jena.graph.impl.*;
011:        import com.hp.hpl.jena.graph.query.*;
012:        import com.hp.hpl.jena.shared.*;
013:        import com.hp.hpl.jena.util.iterator.*;
014:
015:        import java.util.*;
016:
017:        /**
018:         *
019:         * Implementation of a "hidden triples" graph for reified statements in GraphRDB.
020:         * 
021:         * This makes the list of specializedGraphReifers in the GraphRDB into a read-only
022:         * Graph - suitable to be returned by Reifier.getHiddenTriples() )
023:         * 
024:         * @since Jena 2.0
025:         * 
026:         * @author csayers 
027:         * @version $Revision: 1.23 $
028:         */
029:        public class DBReifierGraph implements  Graph {
030:
031:            protected List m_specializedGraphs = null; // list of SpecializedGraphReifiers
032:            protected GraphRDB m_parent = null; // parent graph;
033:
034:            /**
035:             * Construct a new DBReifierGraph
036:             * 
037:             * @param reifiers List of SpecializedGraphReifers which holds the reified triples.  This
038:             * list may be empty and, in that case, the DBReifierGraph just appears to hold no triples.
039:             */
040:            public DBReifierGraph(GraphRDB parent, List reifiers) {
041:
042:                m_parent = parent;
043:                m_specializedGraphs = reifiers;
044:
045:            }
046:
047:            /* (non-Javadoc)
048:             * @see com.hp.hpl.jena.graph.Graph#add(com.hp.hpl.jena.graph.Triple)
049:             */
050:            public void add(Triple t) {
051:                throw new AddDeniedException("cannot add to DB reifier", t);
052:            }
053:
054:            /* (non-Javadoc)
055:             * @see com.hp.hpl.jena.graph.Graph#delete(com.hp.hpl.jena.graph.Triple)
056:             */
057:            public void delete(Triple t) {
058:                throw new DeleteDeniedException(
059:                        "cannot delete from a DB reifier", t);
060:            }
061:
062:            /* (non-Javadoc)
063:             * @see com.hp.hpl.jena.graph.Graph#size()
064:             */
065:            public int size() {
066:                checkUnclosed();
067:                int result = 0;
068:                Iterator it = m_specializedGraphs.iterator();
069:                while (it.hasNext()) {
070:                    SpecializedGraph sg = (SpecializedGraph) it.next();
071:                    result += sg.tripleCount();
072:                }
073:                return result;
074:            }
075:
076:            public boolean isEmpty() {
077:                return size() == 0;
078:            }
079:
080:            /* (non-Javadoc)
081:             * @see com.hp.hpl.jena.graph.Graph#contains(com.hp.hpl.jena.graph.Triple)
082:             */
083:            public boolean contains(Triple t) {
084:                checkUnclosed();
085:                SpecializedGraph.CompletionFlag complete = newComplete();
086:                Iterator it = m_specializedGraphs.iterator();
087:                while (it.hasNext()) {
088:                    SpecializedGraph sg = (SpecializedGraph) it.next();
089:                    boolean result = sg.contains(t, newComplete());
090:                    if (result || complete.isDone())
091:                        return result;
092:                }
093:                return false;
094:            }
095:
096:            protected SpecializedGraph.CompletionFlag newComplete() {
097:                return new SpecializedGraph.CompletionFlag();
098:            }
099:
100:            /* (non-Javadoc)
101:             * @see com.hp.hpl.jena.graph.Graph#contains(com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Node)
102:             */
103:            public boolean contains(Node s, Node p, Node o) {
104:                return contains(Triple.create(s, p, o));
105:            }
106:
107:            public GraphStatisticsHandler getStatisticsHandler() {
108:                return null;
109:            }
110:
111:            /* (non-Javadoc)
112:             * @see com.hp.hpl.jena.graph.Graph#find(com.hp.hpl.jena.graph.TripleMatch)
113:             */
114:            public ExtendedIterator find(TripleMatch m) {
115:                checkUnclosed();
116:                ExtendedIterator result = new NiceIterator();
117:                SpecializedGraph.CompletionFlag complete = newComplete();
118:                Iterator it = m_specializedGraphs.iterator();
119:                while (it.hasNext()) {
120:                    SpecializedGraph sg = (SpecializedGraph) it.next();
121:                    ExtendedIterator partialResult = sg.find(m, complete);
122:                    result = result.andThen(partialResult);
123:                    if (complete.isDone())
124:                        break;
125:                }
126:                return result;
127:            }
128:
129:            /* (non-Javadoc)
130:             * @see com.hp.hpl.jena.graph.Graph#getPrefixMapping()
131:             */
132:            public PrefixMapping getPrefixMapping() {
133:                return m_parent.getPrefixMapping();
134:            }
135:
136:            /* (non-Javadoc)
137:             * @see com.hp.hpl.jena.graph.Graph#getTransactionHandler()
138:             */
139:            public TransactionHandler getTransactionHandler() {
140:                return m_parent.getTransactionHandler();
141:            }
142:
143:            /* (non-Javadoc)
144:             * @see com.hp.hpl.jena.graph.Graph#close()
145:             */
146:            public void close() {
147:                m_specializedGraphs = null;
148:                m_parent = null;
149:            }
150:
151:            public boolean isClosed() {
152:                return m_specializedGraphs == null;
153:            }
154:
155:            private void checkUnclosed() {
156:                if (isClosed())
157:                    throw new ClosedException(
158:                            "this DB Reifier has been closed", this );
159:            }
160:
161:            public GraphEventManager getEventManager() {
162:                throw new BrokenException(
163:                        "DB reifiers do not yet implement getEventManager");
164:            }
165:
166:            /* (non-Javadoc)
167:             * @see com.hp.hpl.jena.graph.Graph#dependsOn(com.hp.hpl.jena.graph.Graph)
168:             */
169:            public boolean dependsOn(Graph other) {
170:                return m_parent.dependsOn(other);
171:            }
172:
173:            /* (non-Javadoc)
174:             * @see com.hp.hpl.jena.graph.Graph#queryHandler()
175:             */
176:            public QueryHandler queryHandler() {
177:                return new SimpleQueryHandler(this );
178:            }
179:
180:            /* (non-Javadoc)
181:             * @see com.hp.hpl.jena.graph.Graph#getBulkUpdateHandler()
182:             */
183:            public BulkUpdateHandler getBulkUpdateHandler() {
184:                return m_parent.getBulkUpdateHandler();
185:            }
186:
187:            /* (non-Javadoc)
188:             * @see com.hp.hpl.jena.graph.Graph#getCapabilities()
189:             */
190:            public Capabilities getCapabilities() {
191:                return null;
192:            }
193:
194:            /* (non-Javadoc)
195:             * @see com.hp.hpl.jena.graph.Graph#getReifier()
196:             */
197:            public Reifier getReifier() {
198:                throw new JenaException("DB Reifier graphs have no reifiers");
199:            }
200:
201:            /* (non-Javadoc)
202:             * @see com.hp.hpl.jena.graph.Graph#find(com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Node)
203:             */
204:            public ExtendedIterator find(Node s, Node p, Node o) {
205:                return find(Triple.createMatch(s, p, o));
206:            }
207:
208:            /* (non-Javadoc)
209:             * @see com.hp.hpl.jena.graph.Graph#isIsomorphicWith(com.hp.hpl.jena.graph.Graph)
210:             */
211:            public boolean isIsomorphicWith(Graph g) {
212:                return g != null && GraphMatcher.equals(this , g);
213:            }
214:
215:            /* (non-Javadoc)
216:             * @see com.hp.hpl.jena.graph.Graph#capabilities()
217:             */
218:            public int capabilities() {
219:                return 0;
220:            }
221:
222:            public String toString() {
223:                return GraphBase.toString("DBReifier ", this );
224:            }
225:        }
226:
227:        /*
228:         *  (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
229:         *  All rights reserved.
230:         *
231:         * Redistribution and use in source and binary forms, with or without
232:         * modification, are permitted provided that the following conditions
233:         * are met:
234:         * 1. Redistributions of source code must retain the above copyright
235:         *    notice, this list of conditions and the following disclaimer.
236:         * 2. Redistributions in binary form must reproduce the above copyright
237:         *    notice, this list of conditions and the following disclaimer in the
238:         *    documentation and/or other materials provided with the distribution.
239:         * 3. The name of the author may not be used to endorse or promote products
240:         *    derived from this software without specific prior written permission.
241:
242:         * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
243:         * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
244:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
245:         * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
246:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
247:         * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
248:         * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
249:         * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
250:         * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
251:         * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
252:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.