KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > reasoner > dig > TripleObjectFiller


1 /*****************************************************************************
2  * Source code information
3  * -----------------------
4  * Original author Ian Dickinson, HP Labs Bristol
5  * Author email ian.dickinson@hp.com
6  * Package Jena 2
7  * Web http://sourceforge.net/projects/jena/
8  * Created 04-Dec-2003
9  * Filename $RCSfile: TripleObjectFiller.java,v $
10  * Revision $Revision: 1.3 $
11  * Release status $State: Exp $
12  *
13  * Last modified on $Date: 2005/02/21 12:16:24 $
14  * by $Author: andy_seaborne $
15  *
16  * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
17  * [See end of file]
18  *****************************************************************************/

19
20 // Package
21
///////////////
22
package com.hp.hpl.jena.reasoner.dig;
23
24
25
26 // Imports
27
///////////////
28
import com.hp.hpl.jena.graph.*;
29 import com.hp.hpl.jena.rdf.model.*;
30 import com.hp.hpl.jena.util.iterator.Map1;
31
32
33
34 /**
35  * <p>
36  * Mapper to create triples from a given predicate and subject
37  * </p>
38  *
39  * @author Ian Dickinson, HP Labs (<a HREF="mailto:Ian.Dickinson@hp.com" >email</a>)
40  * @version CVS $Id: TripleObjectFiller.java,v 1.3 2005/02/21 12:16:24 andy_seaborne Exp $
41  */

42 public class TripleObjectFiller
43     implements Map1
44 {
45     // Constants
46
//////////////////////////////////
47

48     // Static variables
49
//////////////////////////////////
50

51     // Instance variables
52
//////////////////////////////////
53

54     private Node m_predicate;
55     private Node m_subject;
56     
57     // Constructors
58
//////////////////////////////////
59

60     /**
61      * Construct a mapper to create triples from the given predicate and subject,
62      * with an object supplied by the iterator being mapped.
63      */

64     public TripleObjectFiller( Resource subject, Property predicate ) {
65         this( subject.asNode(), predicate.asNode() );
66     }
67     
68
69     /**
70      * Construct a mapper to create triples from the given predicate and subject,
71      * with an object supplied by the iterator being mapped.
72      */

73     public TripleObjectFiller( Node subject, Node predicate ) {
74         m_predicate = predicate;
75         m_subject = subject;
76     }
77     
78     
79     // External signature methods
80
//////////////////////////////////
81

82     public Object JavaDoc map1( Object JavaDoc x ) {
83         return new Triple( m_subject, m_predicate, (Node) x );
84     }
85     
86     
87     
88     // Internal implementation methods
89
//////////////////////////////////
90

91     //==============================================================================
92
// Inner class definitions
93
//==============================================================================
94

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

124
Popular Tags