01: /*
02: (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: [See end of file]
04: $Id: Dyadic.java,v 1.12 2008/01/02 12:10:20 andy_seaborne Exp $
05: */
06:
07: package com.hp.hpl.jena.graph.compose;
08:
09: import com.hp.hpl.jena.graph.*;
10:
11: /**
12: Base class for the two-operand composition operations; has two graphs L and R
13: @author kers
14: @author Ian Dickinson - refactored most of the content to {@link CompositionBase}.
15: */
16:
17: public abstract class Dyadic extends CompositionBase {
18: protected Graph L;
19: protected Graph R;
20:
21: /**
22: When the graph is constructed, copy the prefix mappings of both components
23: into this prefix mapping. The prefix mapping doesn't change afterwards with the
24: components, which might be regarded as a bug.
25: */
26: public Dyadic(Graph L, Graph R) {
27: this .L = L;
28: this .R = R;
29: getPrefixMapping().setNsPrefixes(L.getPrefixMapping())
30: .setNsPrefixes(R.getPrefixMapping());
31: }
32:
33: public void close() {
34: L.close();
35: R.close();
36: }
37:
38: /**
39: Generic dependsOn, true iff it depends on either of the subgraphs.
40: */
41: public boolean dependsOn(Graph other) {
42: return other == this || L.dependsOn(other)
43: || R.dependsOn(other);
44: }
45:
46: public Union union(Graph X) {
47: return new Union(this , X);
48: }
49:
50: /**
51: Answer the left (first) operand of this Dyadic.
52: */
53: public Object getL() {
54: return L;
55: }
56:
57: /**
58: Answer the right (second) operand of this Dyadic.
59: */
60: public Object getR() {
61: return R;
62: }
63:
64: }
65:
66: /*
67: (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
68: All rights reserved.
69:
70: Redistribution and use in source and binary forms, with or without
71: modification, are permitted provided that the following conditions
72: are met:
73:
74: 1. Redistributions of source code must retain the above copyright
75: notice, this list of conditions and the following disclaimer.
76:
77: 2. Redistributions in binary form must reproduce the above copyright
78: notice, this list of conditions and the following disclaimer in the
79: documentation and/or other materials provided with the distribution.
80:
81: 3. The name of the author may not be used to endorse or promote products
82: derived from this software without specific prior written permission.
83:
84: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
85: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
86: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
87: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
88: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
89: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
90: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
91: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
92: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
93: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
94: */
|