KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jena > dbcreate


1 /*
2  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

5
6 package jena;
7
8 import com.hp.hpl.jena.rdf.model.* ;
9 //import com.hp.hpl.jena.db.* ;
10
//import com.hp.hpl.jena.util.iterator.* ;
11
//import java.util.* ;
12

13  /** Create one Jena RDF model in a database.
14   * <p>
15   * Usage:<pre>
16   * jena.dbcreate [db spec]
17   * where [db spec] is:
18   * --spec file Contains an RDF description of the model
19   * --db JDBC_url --dbUser userId --dbPassword password --dbType [--model modelName]
20   * </pre>
21   * </p>
22   *
23   * @author Andy Seaborne
24   * @version $Id: dbcreate.java,v 1.5 2005/02/21 11:49:11 andy_seaborne Exp $
25   */

26  
27 public class dbcreate extends DBcmd
28 {
29     public static final String JavaDoc[] usage = new String JavaDoc[]
30     {
31         "dbcreate [--spec spec] | [db_description] [--model name]" ,
32         " where db_description is" ,
33         " --db JDBC URL --dbType type" ,
34         " --dbUser user --dbPassword password"
35      } ;
36
37     public static void main(String JavaDoc[] args)
38     {
39         dbcreate db = new dbcreate();
40         db.setUsage(usage) ;
41         db.init(args);
42         db.exec();
43     }
44
45     public dbcreate()
46     {
47         super("dbcreate", false);
48     }
49
50     protected void exec0()
51     {
52         Model m = null;
53
54         if (super.argModelName == null)
55         {
56             System.out.println("Create default model");
57             m = ModelFactory.createModelRDBMaker(getConnection()).createModel();
58         }
59         else
60         {
61             System.out.println("Create named model: " + argModelName);
62             m = ModelFactory.createModelRDBMaker(getConnection()).createModel(argModelName);
63         }
64         
65     }
66     
67     protected boolean exec1(String JavaDoc arg) { return false ; }
68 }
69  
70
71
72 /*
73  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
74  * All rights reserved.
75  *
76  * Redistribution and use in source and binary forms, with or without
77  * modification, are permitted provided that the following conditions
78  * are met:
79  * 1. Redistributions of source code must retain the above copyright
80  * notice, this list of conditions and the following disclaimer.
81  * 2. Redistributions in binary form must reproduce the above copyright
82  * notice, this list of conditions and the following disclaimer in the
83  * documentation and/or other materials provided with the distribution.
84  * 3. The name of the author may not be used to endorse or promote products
85  * derived from this software without specific prior written permission.
86  *
87  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
88  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
89  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
90  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
91  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
92  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
93  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
94  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
95  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
96  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
97  */

98
Popular Tags