01: /*
02: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * [See end of file]
04: */
05:
06: package jena;
07:
08: import jena.util.DBcmd;
09:
10: import com.hp.hpl.jena.rdf.model.*;
11:
12: //import com.hp.hpl.jena.db.* ;
13: //import com.hp.hpl.jena.util.iterator.* ;
14: //import java.util.* ;
15:
16: /** Create one Jena RDF model in a database.
17: * <p>
18: * Usage:<pre>
19: * jena.dbcreate [db spec]
20: * where [db spec] is:
21: * --spec file Contains an RDF description of the model
22: * --db JDBC_url --dbUser userId --dbPassword password --dbType [--model modelName]
23: * </pre>
24: * </p>
25: *
26: * @author Andy Seaborne
27: * @version $Id: dbcreate.java,v 1.10 2008/01/02 12:08:16 andy_seaborne Exp $
28: */
29:
30: public class dbcreate extends DBcmd {
31: public static final String[] usage = new String[] {
32: "dbcreate [--spec spec] | [db_description] [--model name]",
33: " where db_description is",
34: " --db JDBC URL --dbType type",
35: " --dbUser user --dbPassword password" };
36:
37: public static void main(String[] args) {
38: dbcreate db = new dbcreate();
39: db.setUsage(usage);
40: db.init(args);
41: db.exec();
42: }
43:
44: public dbcreate() {
45: super ("dbcreate", false);
46: }
47:
48: protected void exec0() {
49: Model m = null;
50:
51: ModelMaker maker = ModelFactory
52: .createModelRDBMaker(getConnection());
53: if (super .argModelName == null) {
54: System.out.println("Create default model");
55: m = maker.createDefaultModel();
56: } else {
57: System.out.println("Create named model: " + argModelName);
58: m = maker.createModel(argModelName);
59: }
60:
61: }
62:
63: protected boolean exec1(String arg) {
64: return false;
65: }
66: }
67:
68: /*
69: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
70: * All rights reserved.
71: *
72: * Redistribution and use in source and binary forms, with or without
73: * modification, are permitted provided that the following conditions
74: * are met:
75: * 1. Redistributions of source code must retain the above copyright
76: * notice, this list of conditions and the following disclaimer.
77: * 2. Redistributions in binary form must reproduce the above copyright
78: * notice, this list of conditions and the following disclaimer in the
79: * documentation and/or other materials provided with the distribution.
80: * 3. The name of the author may not be used to endorse or promote products
81: * derived from this software without specific prior written permission.
82: *
83: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
84: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
85: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
86: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
87: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
88: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
89: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
90: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
91: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
92: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
93: */
|