01: /*
02: * (c) Copyright 2003, 2004, Hewlett-Packard Development Company, LP
03: * All rights reserved.
04: * [See end of file]
05: * $Id: Tutorial04.java,v 1.3 2005/10/06 17:49:05 andy_seaborne Exp $
06: */
07: package jena.examples.rdf;
08:
09: import com.hp.hpl.jena.rdf.model.*;
10: import com.hp.hpl.jena.vocabulary.*;
11:
12: /** Tutorial 4 - create a model and write it in XML form to standard out
13: *
14: * @author bwm - updated by Kers/Daniel
15: * @version Release='$Name: $' Revision='$Revision: 1.3 $' Date='$Date: 2005/10/06 17:49:05 $'
16: */
17: public class Tutorial04 extends Object {
18:
19: // some definitions
20: static String tutorialURI = "http://hostname/rdf/tutorial/";
21: static String briansName = "Brian McBride";
22: static String briansEmail1 = "brian_mcbride@hp.com";
23: static String briansEmail2 = "brian_mcbride@hpl.hp.com";
24: static String title = "An Introduction to RDF and the Jena API";
25: static String date = "23/01/2001";
26:
27: public static void main(String args[]) {
28:
29: // some definitions
30: String personURI = "http://somewhere/JohnSmith";
31: String givenName = "John";
32: String familyName = "Smith";
33: String fullName = givenName + " " + familyName;
34: // create an empty model
35: Model model = ModelFactory.createDefaultModel();
36:
37: // create the resource
38: // and add the properties cascading style
39: Resource johnSmith = model.createResource(personURI)
40: .addProperty(VCARD.FN, fullName).addProperty(
41: VCARD.N,
42: model.createResource().addProperty(VCARD.Given,
43: givenName).addProperty(VCARD.Family,
44: familyName));
45:
46: // now write the model in XML form to a file
47: model.write(System.out);
48: }
49: }
50:
51: /*
52: * (c) Copyright 2003, 2004 Hewlett-Packard Development Company, LP
53: * All rights reserved.
54: *
55: * Redistribution and use in source and binary forms, with or without
56: * modification, are permitted provided that the following conditions
57: * are met:
58: * 1. Redistributions of source code must retain the above copyright
59: * notice, this list of conditions and the following disclaimer.
60: * 2. Redistributions in binary form must reproduce the above copyright
61: * notice, this list of conditions and the following disclaimer in the
62: * documentation and/or other materials provided with the distribution.
63: * 3. The name of the author may not be used to endorse or promote products
64: * derived from this software without specific prior written permission.
65: *
66: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
67: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
68: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
69: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
70: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
71: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
72: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
73: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
74: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
75: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
76: */
|