View Javadoc

1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3    Copyright (c) 2005, University of Innsbruck, Austria
4    This library is free software; you can redistribute it and/or modify it under
5    the terms of the GNU Lesser General Public License as published by the Free
6    Software Foundation; either version 2.1 of the License, or (at your option)
7    any later version.
8    This library is distributed in the hope that it will be useful, but WITHOUT
9    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11   details.
12   You should have received a copy of the GNU Lesser General Public License along
13   with this library; if not, write to the Free Software Foundation, Inc.,
14   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15   */
16  package org.deri.wsmo4j.io.parser.rdf;
17  
18  import org.openrdf.model.Graph;
19  import org.openrdf.model.Resource;
20  import org.openrdf.model.URI;
21  import org.openrdf.model.Value;
22  import org.openrdf.rio.StatementHandler;
23  import org.openrdf.rio.StatementHandlerException;
24  
25  /**
26   * Implementation of an interface defining methods 
27   * for receiving RDF statements from an RDF parser.
28   *
29   * <pre>
30   *  Created on May 02, 2006
31   *  Committed by $Author: nathaliest $
32   *  $Source$
33   * </pre>
34   *
35   * @see org.openrdf.rio#StatementHandler
36   * @author nathalie.steinmetz@deri.org
37   * @version $Revision: 1718 $ $Date: 2006-05-03 16:32:49 +0300 (Wed, 03 May 2006) $
38   */
39  public class RDFStatementHandler implements StatementHandler{
40      
41      private Graph graph = null;
42      
43      public RDFStatementHandler(Graph graph) {
44          this.graph = graph;
45      }
46      
47      /**
48       * The statement handler adds all the statements to a graph.
49       * 
50       * @see org.openrdf.rio.StatementHandler#handleStatement(org.openrdf.model.Resource, org.openrdf.model.URI, org.openrdf.model.Value)
51       */
52      public void handleStatement(Resource subject, URI predicate, Value object) 
53              throws StatementHandlerException {
54  //        System.out.println("---------------------------------------");
55  //        System.out.println(subject.toString());
56  //        System.out.println(predicate.toString());
57  //        System.out.println(object.toString());
58          graph.add(subject, predicate, object);      
59      }
60  
61  }
62  /*
63   * $log: $
64   * 
65   */