-1

I need to create OWL class from the first table name if cardinality 1:1 and OWL class from the second table name. If cardinality 1:* and one of tables describes object properties, create OWL object property from the first table name, than create OWL class from the second table name. The first of all how can I create class from column names? I have OWL API installed in Eclipse.

public class Snippet {

public static void main(String[] args) {


    //  SQL Server DB with JDBC
     String url = "jdbc:sqlserver://isd.ktu.lt:1433";
     String databaseName= "xxxx";
     String userName = "xxx";
     String password = "xxx";

    try {
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        Connection con = DriverManager.getConnection (url, userName, password);
        Statement smt = con.createStatement();
        smt.executeQuery("SELECT * from table_references");
        ResultSet rs = smt.getResultSet();

        while (rs.next()) { 
            String column1 = rs.getString("referenced_object_id");
            String column2 = rs.getString("name");
            String column3 = rs.getString("parent_column_id");
            String column4 = rs.getString("referenced_column_id");

            System.out.println(column1 + " | " + column2 + " | " + column3 + " | " + column4);
        }
    catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    //  Protege API

}

}

4

1 回答 1

0

你可以使用 while (rs.next()) { rs.getString("columnName"); }

于 2013-05-22T10:14:52.183 回答