01: /*
02: * (c) Copyright 2003, 2004, Hewlett-Packard Development Company, LP
03: * All rights reserved.
04: * [See end of file]
05: * $Id: Tutorial05.java,v 1.4 2006/04/27 09:30:07 der Exp $
06: */
07: package jena.examples.rdf;
08:
09: import com.hp.hpl.jena.rdf.model.*;
10: import com.hp.hpl.jena.util.FileManager;
11:
12: import java.io.*;
13:
14: /** Tutorial 5 - read RDF XML from a file and write it to standard out
15: *
16: * @author bwm - updated by kers/Daniel
17: * @version Release='$Name: $' Revision='$Revision: 1.4 $' Date='$Date: 2006/04/27 09:30:07 $'
18: */
19: public class Tutorial05 extends Object {
20:
21: /**
22: NOTE that the file is loaded from the class-path and so requires that
23: the data-directory, as well as the directory containing the compiled
24: class, must be added to the class-path when running this and
25: subsequent examples.
26: */
27: static final String inputFileName = "vc-db-1.rdf";
28:
29: public static void main(String args[]) {
30: // create an empty model
31: Model model = ModelFactory.createDefaultModel();
32:
33: InputStream in = FileManager.get().open(inputFileName);
34: if (in == null) {
35: throw new IllegalArgumentException("File: " + inputFileName
36: + " not found");
37: }
38:
39: // read the RDF/XML file
40: model.read(in, "");
41:
42: // write it to standard out
43: model.write(System.out);
44: }
45: }
46:
47: /*
48: * (c) Copyright 2003, 2004 Hewlett-Packard Development Company, LP
49: * All rights reserved.
50: *
51: * Redistribution and use in source and binary forms, with or without
52: * modification, are permitted provided that the following conditions
53: * are met:
54: * 1. Redistributions of source code must retain the above copyright
55: * notice, this list of conditions and the following disclaimer.
56: * 2. Redistributions in binary form must reproduce the above copyright
57: * notice, this list of conditions and the following disclaimer in the
58: * documentation and/or other materials provided with the distribution.
59: * 3. The name of the author may not be used to endorse or promote products
60: * derived from this software without specific prior written permission.
61: *
62: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
63: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
64: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
65: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
66: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
67: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
68: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
69: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
70: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
71: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
72: */
|