Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: nl/aidministrator/rdf/ral/rdbms/SQLLiteralIterator.java


1   /*  Sesame - Storage and Querying architecture for RDF and RDF Schema
2    *  Copyright (C) 2002 Aidministrator Nederland b.v.
3    *
4    *  Contact: 
5    *  Aidministrator Nederland b.v.
6    *  Julianaplein 14b 
7    *  3817 CS Amersfoort
8    *  The Netherlands
9    *  tel. +31(0)33 4659987
10   *  fax. +31(0)33 4659987
11   *  sesame@aidministrator.nl
12   *
13   *   http://www.aidministrator.nl/
14   *  
15   *  This library is free software; you can redistribute it and/or
16   *  modify it under the terms of the GNU Lesser General Public
17   *  License as published by the Free Software Foundation; either
18   *  version 2.1 of the License, or (at your option) any later version.
19   *
20   *  This library is distributed in the hope that it will be useful,
21   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23   *  Lesser General Public License for more details.
24   *
25   *  You should have received a copy of the GNU Lesser General Public
26   *  License along with this library; if not, write to the Free Software
27   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28   */
29  
30  package nl.aidministrator.rdf.ral.rdbms;
31  
32  import nl.aidministrator.rdf.sail.model.*;
33  import java.sql.*;
34  
35  /**
36   * An implementation of SQLValueIterator that iterates rdfs:Literals. It
37   * implements getResult() which creates a new Literal. The ResultSet should
38   * contain the following columns: id (int), language (String) and value
39   * (String).
40   *
41   * @author Peter van 't Hof
42   * @version 1.2, 12/13/01
43   */
44  public class SQLLiteralIterator extends SQLValueIterator {
45    /**
46     * Constructor.
47     *
48     * @param databaseCon connection with the repository
49     * @param query query to execute
50     */
51    public SQLLiteralIterator(Connection databaseCon, String query) {
52      super(databaseCon, query);
53    }
54    
55    /**
56     * Gets the next result from the ResultSet and returns it as a Literal.
57     *
58     * @return result from ResultSet of type Literal
59     */
60    protected Value getResult()
61      throws SQLException {
62      return new Literal(_resultSet.getString(3), _resultSet.getString(2));
63    }
64  }