Source Code Cross Referenced for DBReifier.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 2002, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003:          [See end of file]
004:          $Id: DBReifier.java,v 1.22 2008/01/02 12:08:25 andy_seaborne Exp $
005:         */
006:
007:        package com.hp.hpl.jena.db.impl;
008:
009:        import com.hp.hpl.jena.db.*;
010:
011:        /**
012:         *  Implementation of Reifier for graphs stored in a database.
013:         * 
014:         * @author csayers based in part on SimpleReifier by kers.
015:         */
016:
017:        import java.util.List;
018:
019:        import com.hp.hpl.jena.graph.*;
020:        import com.hp.hpl.jena.util.iterator.*;
021:        import com.hp.hpl.jena.shared.*;
022:
023:        public class DBReifier implements  Reifier {
024:            protected GraphRDB m_parent = null;
025:            protected Graph m_hiddenTriples = null;
026:            protected List m_reifiers = null;
027:            protected List m_hidden_reifiers = null;
028:
029:            // For now, we just deal with a single specializedGraphReifier,
030:            // but in the future we could replace this with a list of
031:            // those and operate much as the GraphRDB implementation
032:            // does with it's list of SpecializedGraphs.
033:            protected SpecializedGraphReifier m_reifier = null;
034:
035:            protected ReificationStyle m_style;
036:
037:            /** 
038:             *  Construct a reifier for GraphRDB's.
039:             *  
040:             *  @param parent the Graph for which we will expose reified triples.
041:             *  @param allReifiers a List of SpecializedGraphReifiers which reifiy triples in that graph.
042:             *  @param hiddenReifiers the subset of allReifiers whose triples are hidden when querying the parent graph.
043:             */
044:            public DBReifier(GraphRDB parent, ReificationStyle style,
045:                    List allReifiers, List hiddenReifiers) {
046:                m_parent = parent;
047:                m_reifiers = allReifiers;
048:                m_hidden_reifiers = hiddenReifiers;
049:                m_style = style;
050:
051:                // For now, just take the first specializedGraphReifier
052:                if (m_reifiers.size() != 1)
053:                    throw new BrokenException(
054:                            "Internal error - DBReifier requires exactly one SpecializedGraphReifier");
055:                m_reifier = (SpecializedGraphReifier) m_reifiers.get(0);
056:            }
057:
058:            /* (non-Javadoc)
059:             * @see com.hp.hpl.jena.graph.Reifier#getParentGraph()
060:             */
061:            public Graph getParentGraph() {
062:                return m_parent;
063:            }
064:
065:            public ReificationStyle getStyle() {
066:                return m_style;
067:            }
068:
069:            /* (non-Javadoc)
070:             * @see com.hp.hpl.jena.graph.Reifier#getHiddenTriples()
071:             */
072:            private Graph getReificationTriples() {
073:                if (m_hiddenTriples == null)
074:                    m_hiddenTriples = new DBReifierGraph(m_parent,
075:                            m_hidden_reifiers);
076:                return m_hiddenTriples;
077:            }
078:
079:            public ExtendedIterator find(TripleMatch m) {
080:                return getReificationTriples().find(m);
081:            }
082:
083:            public ExtendedIterator findExposed(TripleMatch m) {
084:                return getReificationTriples().find(m);
085:            }
086:
087:            public ExtendedIterator findEither(TripleMatch m, boolean showHidden) {
088:                return showHidden == m_style.conceals() ? getReificationTriples()
089:                        .find(m)
090:                        : NullIterator.instance;
091:            }
092:
093:            public int size() {
094:                return m_style.conceals() ? 0 : getReificationTriples().size();
095:            }
096:
097:            /**
098:                Utility method useful for its short name: answer a new CompletionFlag
099:                initialised to false.
100:             */
101:            protected static SpecializedGraph.CompletionFlag newComplete() {
102:                return new SpecializedGraph.CompletionFlag();
103:            }
104:
105:            /* (non-Javadoc)
106:             * @see com.hp.hpl.jena.graph.Reifier#reifyAs(com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Triple)
107:             */
108:            public Node reifyAs(Node n, Triple t) {
109:                m_reifier.add(n, t, newComplete());
110:                return n;
111:            }
112:
113:            /* (non-Javadoc)
114:             * @see com.hp.hpl.jena.graph.Reifier#hasTriple(com.hp.hpl.jena.graph.Node)
115:             */
116:            public boolean hasTriple(Node n) {
117:                return m_reifier.findReifiedTriple(n, newComplete()) != null;
118:            }
119:
120:            /* (non-Javadoc)
121:             * @see com.hp.hpl.jena.graph.Reifier#hasTriple(com.hp.hpl.jena.graph.Triple)
122:             */
123:            public boolean hasTriple(Triple t) {
124:                return m_reifier.findReifiedNodes(t, newComplete()).hasNext();
125:            }
126:
127:            /* (non-Javadoc)
128:             * @see com.hp.hpl.jena.graph.Reifier#allNodes()
129:             */
130:            public ExtendedIterator allNodes() {
131:                return m_reifier.findReifiedNodes(null, newComplete());
132:            }
133:
134:            /**
135:                All the nodes reifying triple <code>t</code>, using the matching code
136:                from SimpleReifier.
137:             */
138:            public ExtendedIterator allNodes(Triple t) {
139:                return m_reifier.findReifiedNodes(t, newComplete());
140:            }
141:
142:            /* (non-Javadoc)
143:             * @see com.hp.hpl.jena.graph.Reifier#remove(com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Triple)
144:             */
145:            public void remove(Node n, Triple t) {
146:                m_reifier.delete(n, t, newComplete());
147:            }
148:
149:            /* (non-Javadoc)
150:             * @see com.hp.hpl.jena.graph.Reifier#remove(com.hp.hpl.jena.graph.Triple)
151:             */
152:            public void remove(Triple t) {
153:                m_reifier.delete(null, t, newComplete());
154:            }
155:
156:            /* (non-Javadoc)
157:             * @see com.hp.hpl.jena.graph.Reifier#handledAdd(com.hp.hpl.jena.graph.Triple)
158:             */
159:            public boolean handledAdd(Triple t) {
160:                SpecializedGraph.CompletionFlag complete = newComplete();
161:                m_reifier.add(t, complete);
162:                return complete.isDone();
163:            }
164:
165:            /* (non-Javadoc)
166:             * @see com.hp.hpl.jena.graph.Reifier#handledRemove(com.hp.hpl.jena.graph.Triple)
167:             */
168:            public boolean handledRemove(Triple t) {
169:                SpecializedGraph.CompletionFlag complete = newComplete();
170:                m_reifier.delete(t, complete);
171:                return complete.isDone();
172:            }
173:
174:            /* (non-Javadoc)
175:             * @see com.hp.hpl.jena.graph.GetTriple#getTriple(com.hp.hpl.jena.graph.Node)
176:             */
177:            public Triple getTriple(Node n) {
178:                return m_reifier.findReifiedTriple(n, newComplete());
179:            }
180:
181:            public void close() {
182:                // TODO anything useful for a close operation
183:            }
184:
185:        }
186:
187:        /*
188:         (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
189:         All rights reserved.
190:
191:         Redistribution and use in source and binary forms, with or without
192:         modification, are permitted provided that the following conditions
193:         are met:
194:
195:         1. Redistributions of source code must retain the above copyright
196:         notice, this list of conditions and the following disclaimer.
197:
198:         2. Redistributions in binary form must reproduce the above copyright
199:         notice, this list of conditions and the following disclaimer in the
200:         documentation and/or other materials provided with the distribution.
201:
202:         3. The name of the author may not be used to endorse or promote products
203:         derived from this software without specific prior written permission.
204:
205:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
206:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
207:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
208:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
209:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
210:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
211:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
212:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
213:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
214:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
215:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.