Source Code Cross Referenced for InfModelImpl.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » rdf » model » 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.rdf.model.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /******************************************************************
002:         * File:        InfModelImpl.java
003:         * Created by:  Dave Reynolds
004:         * Created on:  08-May-2003
005:         * 
006:         * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
007:         * [See end of file]
008:         * $Id: InfModelImpl.java,v 1.12 2008/01/02 12:05:00 andy_seaborne Exp $
009:         *****************************************************************/package com.hp.hpl.jena.rdf.model.impl;
010:
011:        import com.hp.hpl.jena.graph.Graph;
012:        import com.hp.hpl.jena.rdf.model.*;
013:        import com.hp.hpl.jena.reasoner.*;
014:        import java.util.Iterator;
015:
016:        /**
017:         * Default implementation of the InfModel interface which simply wraps up
018:         * an InfGraph.
019:
020:         * @author <a href="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
021:         * @version $Revision: 1.12 $ on $Date: 2008/01/02 12:05:00 $
022:         */
023:        public class InfModelImpl extends ModelCom implements  InfModel {
024:
025:            /**
026:             * Constructor.
027:             * @param infgraph the InfGraph, as generated by a reasoner.bind operation, to be packaged up.
028:             */
029:            public InfModelImpl(InfGraph infgraph) {
030:                super (infgraph);
031:            }
032:
033:            /**
034:             * Return the underlying inference graph for this model.
035:             */
036:            public InfGraph getInfGraph() {
037:                return (InfGraph) getGraph();
038:            }
039:
040:            /**
041:             * Return the raw RDF model being processed (i.e. the argument
042:             * to the Reasonder.bind call that created this InfModel).
043:             */
044:            public Model getRawModel() {
045:                return new ModelCom(getInfGraph().getRawGraph());
046:            }
047:
048:            /**
049:             * Return the Reasoner which is being used to answer queries to this graph.
050:             */
051:            public Reasoner getReasoner() {
052:                return getInfGraph().getReasoner();
053:            }
054:
055:            /**
056:             * Cause the inference model  to reconsult the underlying data to take
057:             * into account changes. Normally changes are made through the InfModel's add and
058:             * remove calls are will be handled appropriately. However, in some cases changes
059:             * are made "behind the InfModels's back" and this forces a full reconsult of
060:             * the changed data. 
061:             */
062:            public void rebind() {
063:                getInfGraph().rebind();
064:            }
065:
066:            /**
067:             * Perform any initial processing and caching. This call is optional. Most
068:             * engines either have negligable set up work or will perform an implicit
069:             * "prepare" if necessary. The call is provided for those occasions where
070:             * substantial preparation work is possible (e.g. running a forward chaining
071:             * rule system) and where an application might wish greater control over when
072:             * this prepration is done rather than just leaving to be done at first query time.
073:             */
074:            public void prepare() {
075:                getInfGraph().prepare();
076:            }
077:
078:            /**
079:             * Reset any internal caches. Some systems, such as the tabled backchainer, 
080:             * retain information after each query. A reset will wipe this information preventing
081:             * unbounded memory use at the expense of more expensive future queries. A reset
082:             * does not cause the raw data to be reconsulted and so is less expensive than a rebind.
083:             */
084:            public void reset() {
085:                getInfGraph().reset();
086:            }
087:
088:            /**
089:             * Test the consistency of the underlying data. This normally tests
090:             * the validity of the bound instance data against the bound
091:             * schema data. 
092:             * @return a ValidityReport structure
093:             */
094:            public ValidityReport validate() {
095:                return getInfGraph().validate();
096:            }
097:
098:            /** Find all the statements matching a pattern.
099:             * <p>Return an iterator over all the statements in a model
100:             *  that match a pattern.  The statements selected are those
101:             *  whose subject matches the <code>subject</code> argument,
102:             *  whose predicate matches the <code>predicate</code> argument
103:             *  and whose object matchesthe <code>object</code> argument.
104:             *  If an argument is <code>null</code> it matches anything.</p>
105:             * <p>
106:             * The s/p/o terms may refer to resources which are temporarily defined in the "posit" model.
107:             * This allows one, for example, to query what resources are of type CE where CE is a
108:             * class expression rather than a named class - put CE in the posit arg.</p>
109:             * 
110:             * @return an iterator over the subjects
111:             * @param subject   The subject sought
112:             * @param predicate The predicate sought
113:             * @param object    The value sought
114:             */
115:            public StmtIterator listStatements(Resource subject,
116:                    Property predicate, RDFNode object, Model posit) {
117:                Iterator iter = getInfGraph().find(asNode(subject),
118:                        asNode(predicate), asNode(object), posit.getGraph());
119:                return IteratorFactory.asStmtIterator(iter, this );
120:            }
121:
122:            /**
123:             * Switch on/off drivation logging. If this is switched on then every time an inference
124:             * is a made that fact is recorded and the resulting record can be access through a later
125:             * getDerivation call. This may consume a lot of space!
126:             */
127:            public void setDerivationLogging(boolean logOn) {
128:                getInfGraph().setDerivationLogging(logOn);
129:            }
130:
131:            /**
132:             * Return the derivation of the given statement (which should be the result of
133:             * some previous list operation).
134:             * Not all reasoneers will support derivations.
135:             * @return an iterator over Derivation records or null if there is no derivation information
136:             * available for this triple.
137:             */
138:            public Iterator getDerivation(Statement statement) {
139:                return getInfGraph().getDerivation(statement.asTriple());
140:            }
141:
142:            /**
143:             * Returns a derivations model. The rule reasoners typically create a 
144:             * graph containing those triples added to the base graph due to rule firings.
145:             * In some applications it can useful to be able to access those deductions
146:             * directly, without seeing the raw data which triggered them. In particular,
147:             * this allows the forward rules to be used as if they were rewrite transformation
148:             * rules.
149:             * @return the deductions model, if relevant for this class of inference
150:             * engine or null if not.
151:             */
152:            public Model getDeductionsModel() {
153:                Graph deductionsGraph = getInfGraph().getDeductionsGraph();
154:                if (deductionsGraph != null) {
155:                    if (deductionsModel == null
156:                            || (deductionsModel.getGraph() != deductionsGraph)) {
157:                        deductionsModel = new ModelCom(deductionsGraph);
158:                    }
159:                }
160:                return deductionsModel;
161:            }
162:
163:            /** Cached deductions model */
164:            private Model deductionsModel = null;
165:        }
166:
167:        /*
168:         (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
169:         All rights reserved.
170:
171:         Redistribution and use in source and binary forms, with or without
172:         modification, are permitted provided that the following conditions
173:         are met:
174:
175:         1. Redistributions of source code must retain the above copyright
176:         notice, this list of conditions and the following disclaimer.
177:
178:         2. Redistributions in binary form must reproduce the above copyright
179:         notice, this list of conditions and the following disclaimer in the
180:         documentation and/or other materials provided with the distribution.
181:
182:         3. The name of the author may not be used to endorse or promote products
183:         derived from this software without specific prior written permission.
184:
185:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
186:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
187:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
188:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
189:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
190:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
191:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
192:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
193:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
194:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
195:         */
www___._ja_va2s_.___c__o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.