001: /*****************************************************************************
002: * Source code information
003: * -----------------------
004: * Original author Ian Dickinson, HP Labs Bristol
005: * Author email ian.dickinson@hp.com
006: * Package Jena 2
007: * Web http://sourceforge.net/projects/jena/
008: * Created 04-Dec-2003
009: * Filename $RCSfile: TripleObjectFiller.java,v $
010: * Revision $Revision: 1.6 $
011: * Release status $State: Exp $
012: *
013: * Last modified on $Date: 2008/01/02 12:07:09 $
014: * by $Author: andy_seaborne $
015: *
016: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
017: * [See end of file]
018: *****************************************************************************/package com.hp.hpl.jena.reasoner.dig;
019:
020: // Imports
021: ///////////////
022: import com.hp.hpl.jena.graph.*;
023: import com.hp.hpl.jena.rdf.model.*;
024: import com.hp.hpl.jena.util.iterator.Map1;
025:
026: /**
027: * <p>
028: * Mapper to create triples from a given predicate and subject
029: * </p>
030: *
031: * @author Ian Dickinson, HP Labs (<a href="mailto:Ian.Dickinson@hp.com" >email</a>)
032: * @version CVS $Id: TripleObjectFiller.java,v 1.6 2008/01/02 12:07:09 andy_seaborne Exp $
033: */
034: public class TripleObjectFiller implements Map1 {
035: // Constants
036: //////////////////////////////////
037:
038: // Static variables
039: //////////////////////////////////
040:
041: // Instance variables
042: //////////////////////////////////
043:
044: private Node m_predicate;
045: private Node m_subject;
046:
047: // Constructors
048: //////////////////////////////////
049:
050: /**
051: * Construct a mapper to create triples from the given predicate and subject,
052: * with an object supplied by the iterator being mapped.
053: */
054: public TripleObjectFiller(Resource subject, Property predicate) {
055: this (subject.asNode(), predicate.asNode());
056: }
057:
058: /**
059: * Construct a mapper to create triples from the given predicate and subject,
060: * with an object supplied by the iterator being mapped.
061: */
062: public TripleObjectFiller(Node subject, Node predicate) {
063: m_predicate = predicate;
064: m_subject = subject;
065: }
066:
067: // External signature methods
068: //////////////////////////////////
069:
070: public Object map1(Object x) {
071: return new Triple(m_subject, m_predicate, (Node) x);
072: }
073:
074: // Internal implementation methods
075: //////////////////////////////////
076:
077: //==============================================================================
078: // Inner class definitions
079: //==============================================================================
080:
081: }
082:
083: /*
084: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
085: * All rights reserved.
086: *
087: * Redistribution and use in source and binary forms, with or without
088: * modification, are permitted provided that the following conditions
089: * are met:
090: * 1. Redistributions of source code must retain the above copyright
091: * notice, this list of conditions and the following disclaimer.
092: * 2. Redistributions in binary form must reproduce the above copyright
093: * notice, this list of conditions and the following disclaimer in the
094: * documentation and/or other materials provided with the distribution.
095: * 3. The name of the author may not be used to endorse or promote products
096: * derived from this software without specific prior written permission.
097: *
098: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
099: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
100: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
101: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
102: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
103: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
104: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
105: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
106: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
107: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
108: */
|