KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > db > impl > SpecializedGraphReifier


1 /*
2  * (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * All rights reserved.
4  *
5  */

6
7
8 package com.hp.hpl.jena.db.impl;
9
10 import com.hp.hpl.jena.graph.*;
11 import com.hp.hpl.jena.shared.*;
12 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
13
14 /**
15  * Interface for a specialized graphs that are optimized for reification.
16  *
17  * @author csayers
18  * @version $Revision: 1.5 $
19  *
20  */

21 public interface SpecializedGraphReifier extends SpecializedGraph {
22         
23     /**
24      * Add a reified triple to the specialized graph.
25      *
26      * Note that when calling add, the call will either fail (complete=false)
27      * indicating the graph can not store the quad, or succeed (complete=true)
28      * indicating that a subsequent call to contains(node, triple) will return true
29      * and that the add operation is complete.
30      * Adding the same triple twice is not an error. However adding the same
31      * node twice is an error and should throw a Reifier.AlreadyReifiedException.
32      *
33      * @param n is the Node to be added
34      * @param t is the triple to be added
35      * @param complete is true if a subsequent call to contains(triple) will return true.
36      * @throws Reifier.AlreadyReifiedException if the node already reifies a triple
37      */

38     public void add(Node n, Triple t, CompletionFlag complete) throws AlreadyReifiedException;
39         
40     /**
41      * Attempt to delete a reified triple from the specialized graph.
42      *
43      * @param t is the triple to be deleted
44      * @param complete is true if either (i) the triple was in the graph and was deleted, or
45      * (ii) the triple was not in the graph the graph can guarantee that a call to add(Triple)
46      * would have succeeded, had it been made for that same triple.
47      */

48     public void delete(Node n, Triple t, CompletionFlag complete);
49     
50     /**
51      * Tests if a reified triple is contained in the specialized graph.
52      * @param n is the node to be tested - may be null to indicate any node
53      * @param t is the triple to be tested
54      * @param complete is true if the graph can guarantee that no other specialized graph
55      * could hold any matching triples.
56      * @return boolean result to indicte if the tripple was contained
57      */

58     public boolean contains(Node n, Triple t, CompletionFlag complete);
59                         
60     /**
61      * Finds matching reified triples in the specialized graph and returns their nodes.
62 // * @param t the TripleMatch
63      * @param t the Triple
64      * @param complete is true if the graph can guarantee that no other specialized graph
65      * could hold any matching triples.
66      * @return ExtendedIterator which iterates over any matching nodes
67      */

68 // public ExtendedIterator findReifiedNodes(TripleMatch t, CompletionFlag complete);
69
public ExtendedIterator findReifiedNodes(Triple t, CompletionFlag complete);
70
71
72     /**
73      * Finds the reified triple corresponding to a particular node in the specialized graph.
74      * @param t the TripleMatch
75      * @param complete is true if the graph can guarantee that no other specialized graph
76      * could hold any matching triples.
77      * @return ExtendedIterator which iterates over any matching nodes
78      */

79     public Triple findReifiedTriple(Node n, CompletionFlag complete);
80 }
81
82 /*
83     (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
84     All rights reserved.
85
86     Redistribution and use in source and binary forms, with or without
87     modification, are permitted provided that the following conditions
88     are met:
89
90     1. Redistributions of source code must retain the above copyright
91        notice, this list of conditions and the following disclaimer.
92
93     2. Redistributions in binary form must reproduce the above copyright
94        notice, this list of conditions and the following disclaimer in the
95        documentation and/or other materials provided with the distribution.
96
97     3. The name of the author may not be used to endorse or promote products
98        derived from this software without specific prior written permission.
99
100     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
101     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
102     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
103     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
104     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
105     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
106     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
107     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
108     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
109     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
110 */

111
Popular Tags