01: /******************************************************************
02: * File: BackwardRuleInfGraphI.java
03: * Created by: Dave Reynolds
04: * Created on: 28-May-2003
05: *
06: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
07: * [See end of file]
08: * $Id: BackwardRuleInfGraphI.java,v 1.13 2008/01/02 12:07:47 andy_seaborne Exp $
09: *****************************************************************/package com.hp.hpl.jena.reasoner.rulesys;
10:
11: import com.hp.hpl.jena.graph.Node;
12: import com.hp.hpl.jena.graph.Triple;
13: import com.hp.hpl.jena.reasoner.InfGraph;
14: import com.hp.hpl.jena.reasoner.TriplePattern;
15: import com.hp.hpl.jena.util.iterator.ExtendedIterator;
16:
17: /**
18: * This interface collects together those operations that the backchaining
19: * engine needs to invoke in the parent InfGraph. This allows different inf graphs
20: * to exploit the same core backchaining engine.
21: *
22: * @author <a href="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
23: * @version $Revision: 1.13 $ on $Date: 2008/01/02 12:07:47 $
24: */
25: public interface BackwardRuleInfGraphI extends SilentAddI, InfGraph {
26:
27: /**
28: * Process a call to a builtin predicate
29: * @param clause the term representing the call
30: * @param env the BindingEnvironment for this call
31: * @param rule the rule which is invoking this call
32: * @return true if the predicate succeeds
33: */
34: public boolean processBuiltin(ClauseEntry clause, Rule rule,
35: BindingEnvironment env);
36:
37: /**
38: * Match a pattern just against the stored data (raw data, schema,
39: * axioms) but no backchaining derivation.
40: */
41: public ExtendedIterator findDataMatches(TriplePattern pattern);
42:
43: /**
44: * Log a dervivation record against the given triple.
45: */
46: public void logDerivation(Triple t, Object derivation);
47:
48: /**
49: * Retrieve or create a bNode representing an inferred property value.
50: * @param instance the base instance node to which the property applies
51: * @param prop the property node whose value is being inferred
52: * @param pclass the (optional, can be null) class for the inferred value.
53: * @return the bNode representing the property value
54: */
55: public Node getTemp(Node instance, Node prop, Node pclass);
56:
57: /**
58: * Return a version stamp for this graph which can be
59: * used to fast-fail concurrent modification exceptions.
60: */
61: public int getVersion();
62:
63: }
64:
65: /*
66: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
67: All rights reserved.
68:
69: Redistribution and use in source and binary forms, with or without
70: modification, are permitted provided that the following conditions
71: are met:
72:
73: 1. Redistributions of source code must retain the above copyright
74: notice, this list of conditions and the following disclaimer.
75:
76: 2. Redistributions in binary form must reproduce the above copyright
77: notice, this list of conditions and the following disclaimer in the
78: documentation and/or other materials provided with the distribution.
79:
80: 3. The name of the author may not be used to endorse or promote products
81: derived from this software without specific prior written permission.
82:
83: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
84: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
85: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
86: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
87: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
88: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
89: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
90: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
91: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
92: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
93: */
|