You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/04/24 14:13:42 UTC
[08/18] jena git commit: Remove old src-dev
Remove old src-dev
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/4cfcafe8
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/4cfcafe8
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/4cfcafe8
Branch: refs/heads/jena3
Commit: 4cfcafe8d8089bfd7d65f956ec146cc197a6e9b3
Parents: ff7fda4
Author: Andy Seaborne <an...@apache.org>
Authored: Fri Apr 24 10:26:27 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Fri Apr 24 10:26:27 2015 +0100
----------------------------------------------------------------------
jena-sdb/src-dev/java/dbtest/DB.java | 59 -
jena-sdb/src-dev/java/dbtest/Params.java | 46 -
jena-sdb/src-dev/java/dbtest/ParamsVocab.java | 43 -
jena-sdb/src-dev/java/dbtest/Setup.java | 192 ---
jena-sdb/src-dev/java/dbtest/TestBinary.java | 123 --
jena-sdb/src-dev/java/dbtest/TestDB.java | 86 --
jena-sdb/src-dev/java/dbtest/TestLongText.java | 89 --
jena-sdb/src-dev/java/dbtest/TestShortText.java | 105 --
jena-sdb/src-dev/java/dbtest/dbsetuptest.java | 124 --
jena-sdb/src-dev/java/dev/Main.java | 54 -
.../src-dev/java/dev/ReportSparqlUpdate.java | 61 -
jena-sdb/src-dev/java/dev/RunTests.java | 50 -
.../java/dev/TestStores2Connections1.java | 97 --
jena-sdb/src-dev/java/dev/db/DBSyntax.java | 94 --
jena-sdb/src-dev/java/dev/db/FmtStdHash.java | 131 --
.../src-dev/java/dev/db/StoreFormatterStd.java | 101 --
jena-sdb/src-dev/java/dev/inf/TransGraph.java | 158 ---
.../src-dev/java/dev/inf/TransGraphNode.java | 88 --
.../src-dev/java/dev/inf/sdbRDFSexpand.java | 66 -
jena-sdb/src-dev/java/dev/inf/sdbRDFSload.java | 100 --
jena-sdb/src-dev/java/dev/pldms/Scratch.java | 111 --
.../java/dev/reports/OpenCurosrOracle.java | 87 --
.../dev/reports/Report_ReifiedStatements.java | 63 -
jena-sdb/src-dev/resources/etc/daml-micro.rules | 99 --
.../src-dev/resources/etc/dig-daml-axioms.rdf | 370 ------
.../src-dev/resources/etc/dig-owl-axioms.rdf | 344 ------
.../src-dev/resources/etc/location-mapping.ex | 63 -
.../src-dev/resources/etc/ont-policy-test.rdf | 75 --
jena-sdb/src-dev/resources/etc/ont-policy.rdf | 81 --
jena-sdb/src-dev/resources/etc/owl-b.rules | 322 -----
.../src-dev/resources/etc/owl-fb-micro.rules | 582 ---------
.../src-dev/resources/etc/owl-fb-mini.rules | 748 ------------
jena-sdb/src-dev/resources/etc/owl-fb-old.rules | 407 -------
jena-sdb/src-dev/resources/etc/owl-fb.rules | 786 ------------
jena-sdb/src-dev/resources/etc/owl.rules | 305 -----
.../src-dev/resources/etc/rdfs-b-tuned.rules | 111 --
jena-sdb/src-dev/resources/etc/rdfs-b.rules | 90 --
.../src-dev/resources/etc/rdfs-fb-lp-expt.rules | 91 --
.../resources/etc/rdfs-fb-tgc-noresource.rules | 100 --
.../resources/etc/rdfs-fb-tgc-simple.rules | 49 -
.../src-dev/resources/etc/rdfs-fb-tgc.rules | 220 ----
jena-sdb/src-dev/resources/etc/rdfs-fb.rules | 95 --
.../src-dev/resources/etc/rdfs-noresource.rules | 84 --
jena-sdb/src-dev/resources/etc/rdfs.rules | 83 --
.../src-dev/resources/etc/schemagen_example.rdf | 135 --
.../src-dev/resources/vocabularies/assembler.n3 | 590 ---------
.../vocabularies/daml+oil-2000-12.daml | 440 -------
.../resources/vocabularies/daml+oil.daml | 494 --------
.../resources/vocabularies/dublin-core_11.xml | 236 ----
.../vocabularies/dublin-core_terms.xml | 1151 ------------------
.../vocabularies/dublin-core_types.xml | 163 ---
.../resources/vocabularies/jena-model-spec.n3 | 105 --
.../resources/vocabularies/jenavocab.rdf | 98 --
.../vocabularies/location-mapping-rdfs.n3 | 33 -
.../resources/vocabularies/ont-event.rdf | 284 -----
.../resources/vocabularies/ont-manager.rdf | 102 --
jena-sdb/src-dev/resources/vocabularies/owl.owl | 279 -----
.../resources/vocabularies/rdf-schema.rdf | 235 ----
.../resources/vocabularies/result-set.n3 | 90 --
.../resources/vocabularies/test-manifest-x.n3 | 64 -
.../resources/vocabularies/test-manifest.n3 | 106 --
.../resources/vocabularies/test-query.n3 | 40 -
62 files changed, 11878 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dbtest/DB.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dbtest/DB.java b/jena-sdb/src-dev/java/dbtest/DB.java
deleted file mode 100644
index f442c09..0000000
--- a/jena-sdb/src-dev/java/dbtest/DB.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dbtest;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-
-public class DB
-{
- static boolean verbose = false ;
-
- static public void setVerbose(boolean newValue) { verbose = newValue ; }
-
- static void execNoFail(Connection jdbc, String sql)
- {
- try { exec(jdbc, sql) ;
- } catch (SQLException ex) {}
- }
-
- static void exec(Connection jdbc, String sql) throws SQLException
- {
- Statement stmt = null ;
- try {
- stmt = jdbc.createStatement() ;
- if ( verbose )
- System.out.println(sql) ;
- stmt.execute(sql) ;
- } finally {
- if ( stmt != null ) stmt.close() ;
- }
- }
-
- static ResultSet execQuery(Connection jdbc, String sql) throws SQLException
- {
- if ( verbose )
- System.out.println(sql) ;
- Statement stmt = jdbc.createStatement() ;
- return stmt.executeQuery(sql) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dbtest/Params.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dbtest/Params.java b/jena-sdb/src-dev/java/dbtest/Params.java
deleted file mode 100644
index e48ae56..0000000
--- a/jena-sdb/src-dev/java/dbtest/Params.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dbtest;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
-public class Params
-{
- Map<String, String> params = new TreeMap<String, String>() ;
-
- public String get(String key) { return params.get(key.toLowerCase()) ; }
-
- public void put(String key, String value) { params.put(key.toLowerCase(), value) ; }
-
- public void putDft(String key, String value)
- {
- key = key.toLowerCase() ;
- if ( !params.containsKey(key) )
- params.put(key.toLowerCase(), value) ;
- }
-
- public Iterator<String> iterator()
- {
- return params.keySet().iterator() ;
- }
-
- public Map<String, String> getBackingMap() { return params ; }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dbtest/ParamsVocab.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dbtest/ParamsVocab.java b/jena-sdb/src-dev/java/dbtest/ParamsVocab.java
deleted file mode 100644
index 4af4819..0000000
--- a/jena-sdb/src-dev/java/dbtest/ParamsVocab.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dbtest;
-
-public class ParamsVocab
-{
- static public final String TempTableName = "TempTable" ;
-
- static public final String VarcharType = "typeVarchar" ;
- static public final String VarcharCol = "colVarchar" ;
-
- static public final String TestLongBinary = "testLongBinary" ;
- static public final String LongBinaryType = "typeLongBinary" ;
- static public final String LongBinaryCol = "colLongBinary" ;
-
- public static final String TestLongText = "testLongText" ;
- public static final String LongTextType = "typeLongtext" ;
- public static final String LongTextCol = "colLongText" ;
-
- static public final String User = "user" ;
- static public final String Password = "password" ;
- static public final String JDBC = "jdbc" ;
- public static final String Driver = "driver" ;
-
- public static final String DBType = "db" ;
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dbtest/Setup.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dbtest/Setup.java b/jena-sdb/src-dev/java/dbtest/Setup.java
deleted file mode 100644
index 2045975..0000000
--- a/jena-sdb/src-dev/java/dbtest/Setup.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dbtest;
-
-
-/** Deafult settings for various databases */
-
-public class Setup
-{
- public static void setParams(Params params, String dbtype)
- {
- params.putDft( ParamsVocab.User, "USER") ;
- params.putDft( ParamsVocab.Password, "PASSWORD") ;
- params.putDft( ParamsVocab.TempTableName, "JenaJdbcTempTable") ;
- params.putDft( ParamsVocab.TestLongBinary, "false") ;
- params.putDft( ParamsVocab.TestLongText, "false") ;
-
- params.putDft( ParamsVocab.VarcharCol, "colVarchar") ;
- params.putDft( ParamsVocab.LongTextCol, "colLongText") ;
- params.putDft( ParamsVocab.LongBinaryCol, "colLongBinary") ;
-
- dbtype = dbtype.toLowerCase() ;
-
- if ( dbtype.equalsIgnoreCase("HSQLDB") ||
- dbtype.equalsIgnoreCase("HSQL") )
- {
- setup_HSQL(params) ;
- return ;
- }
-
- if ( dbtype.equalsIgnoreCase("MySQL") )
- {
- setup_MySQL(params) ;
- return ;
- }
-
- if ( dbtype.equalsIgnoreCase("PostgreSQL") ||
- dbtype.equalsIgnoreCase("Postgres") ||
- dbtype.equalsIgnoreCase("PSQL") )
- {
- setup_PSQL(params) ;
- return ;
- }
-
- if ( dbtype.equalsIgnoreCase("MSSQLServer") ||
- dbtype.equalsIgnoreCase("SQLServer") ||
- dbtype.equalsIgnoreCase("MSSQL") )
- {
- setup_MSSQL(params) ;
- return ;
- }
-
- if ( dbtype.equalsIgnoreCase("Oracle") )
- {
- setup_Oracle(params) ;
- return ;
- }
-
- if ( dbtype.equalsIgnoreCase("Derby") )
- {
- setup_Derby(params) ;
- return ;
- }
-
- if ( dbtype.equalsIgnoreCase("SAP") )
- {
- setup_SAP(params) ;
- return ;
- }
-
- System.err.println("Unknown DB type: "+dbtype) ;
- System.exit(2) ;
-
- dbtype = dbtype.toLowerCase() ;
- }
-
- private static void setup_HSQL(Params params)
- {
- params.putDft( ParamsVocab.Driver, "org.hsqldb.jdbcDriver") ;
- params.put( ParamsVocab.TestLongBinary, "true") ;
- params.put( ParamsVocab.TestLongText, "true") ;
-
- params.putDft( ParamsVocab.VarcharType, "VARCHAR(200)") ;
- params.putDft( ParamsVocab.LongBinaryType, "VARBINARY") ;
- params.putDft( ParamsVocab.LongTextType, "LONGVARCHAR") ;
-
- params.put( ParamsVocab.User, "sa") ;
- params.put( ParamsVocab.Password, "") ;
-
- params.putDft( ParamsVocab.JDBC, "jdbc:hsqldb:mem:TEST") ;
- return ;
- }
-
- private static void setup_MySQL(Params params)
- {
- // Jena uses long binary
- params.putDft( ParamsVocab.Driver, "com.mysql.jdbc.Driver") ;
- params.put( ParamsVocab.TestLongBinary, "true") ;
- params.put( ParamsVocab.TestLongText, "true") ;
-
- params.putDft( ParamsVocab.VarcharType, "VARCHAR(200)") ;
- params.putDft( ParamsVocab.LongBinaryType, "MEDIUMBLOB") ;
- params.putDft( ParamsVocab.LongTextType, "MEDIUMTEXT") ;
- return ;
- }
-
- private static void setup_PSQL(Params params)
- {
- // Jena uses long text
- params.putDft( ParamsVocab.Driver, "org.postgresql.Driver") ;
- params.put( ParamsVocab.TestLongBinary, "true") ;
- params.put( ParamsVocab.TestLongText, "true") ;
-
- params.putDft( ParamsVocab.VarcharType, "VARCHAR(200)") ;
- params.putDft( ParamsVocab.LongBinaryType, "BYTEA") ;
- params.putDft( ParamsVocab.LongTextType, "TEXT") ;
- return ;
- }
-
- private static void setup_Derby(Params params)
- {
- params.putDft( ParamsVocab.Driver, "org.apache.derby.jdbc.EmbeddedDriver") ;
- params.put( ParamsVocab.TestLongBinary, "false") ;
- params.put( ParamsVocab.TestLongText, "true") ;
-
- params.putDft( ParamsVocab.VarcharType, "VARCHAR(200)") ;
-// params.putDft( ParamsVocab.LongBinaryType, "LONGVARBINARY") ;?????
- params.putDft( ParamsVocab.LongTextType, "VARCHAR(32672)") ;
-
- //params.putDft( ParamsVocab.Driver, "org.apache.derby.jdbc.ClientDriver") ;
- return ;
- }
-
- private static void setup_MSSQL(Params params)
- {
- // Jena used long text
- params.putDft( ParamsVocab.Driver, "com.microsoft.sqlserver.jdbc.SQLServerDriver") ;
- params.put( ParamsVocab.TestLongBinary, "true") ;
- params.put( ParamsVocab.TestLongText, "true") ;
-
- params.putDft( ParamsVocab.VarcharType, "NVARCHAR(200)") ;
- params.putDft( ParamsVocab.LongBinaryType, "VARBINARY(max)") ;
- params.putDft( ParamsVocab.LongTextType, "NTEXT") ;
-
- params.putDft( ParamsVocab.VarcharCol, "colVarchar") ;
- return ;
- }
-
- private static void setup_Oracle(Params params)
- {
- // Jena used long binary
- params.putDft( ParamsVocab.Driver, "oracle.jdbc.driver.OracleDriver") ;
- params.put( ParamsVocab.TestLongBinary, "true") ;
- params.put( ParamsVocab.TestLongText, "true") ;
-
- params.putDft( ParamsVocab.VarcharType, "VARCHAR(200)") ; // NVARCHAR2 would be better.
- params.putDft( ParamsVocab.LongBinaryType, "BLOB") ;
- params.putDft( ParamsVocab.LongTextType, "CLOB") ;
-// params.putDft( ParamsVocab.LongBinaryType, "LONG VARBINARY") ;
-// params.putDft( ParamsVocab.LongTextType, "LONG VARCHAR") ;
- return ;
- }
-
- private static void setup_SAP(Params params)
- {
- // Jena uses long text
- params.putDft( ParamsVocab.Driver, "com.sap.db.jdbc.Driver") ;
- params.put( ParamsVocab.TestLongBinary, "true") ;
- params.put( ParamsVocab.TestLongText, "true") ;
-
- params.putDft( ParamsVocab.VarcharType, "NVARCHAR(200)") ;
- params.putDft( ParamsVocab.LongBinaryType, "VARBINARY(5000)") ;
- params.putDft( ParamsVocab.LongTextType, "NVARCHAR(5000)") ;
- return ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dbtest/TestBinary.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dbtest/TestBinary.java b/jena-sdb/src-dev/java/dbtest/TestBinary.java
deleted file mode 100644
index b932618..0000000
--- a/jena-sdb/src-dev/java/dbtest/TestBinary.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dbtest;
-
-import java.io.UnsupportedEncodingException;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import junit.framework.TestCase;
-
-public class TestBinary extends TestCase
-{
- private String tempTableName = null ;
- private String content ;
- private Params params ;
- private Connection jdbc ;
-
- public TestBinary(Connection jdbc, String name, String content, Params params)
- {
- super(name+"/Binary") ;
- this.content = content ;
- this.params = params ;
- tempTableName = params.get(ParamsVocab.TempTableName) ;
- this.jdbc = jdbc ;
- }
-
- @Override
- public void setUp()
- {
- DB.execNoFail(jdbc, "DROP TABLE "+tempTableName) ;
- }
-
- @Override
- public void runTest() throws Exception
- {
- runBytesTest(content,
- params.get(ParamsVocab.LongBinaryCol),
- params.get(ParamsVocab.LongBinaryType));
- }
-
- private void runBytesTest(String testString, String colName, String colType) throws Exception
- {
- String tempTableName = params.get(ParamsVocab.TempTableName) ;
- //testString = ":"+testString+":" ;
- if ( testString == null )
- fail("Test broken - null input") ;
-
- DB.exec(jdbc, "CREATE TABLE "+tempTableName+" ("+colName+" "+colType+")") ;
-
- String $str = "INSERT INTO "+tempTableName+" values (?)" ;
- PreparedStatement ps = jdbc.prepareStatement($str) ;
- ps.setBytes(1, stringToBytes(testString)) ;
- try { ps.execute() ; } // Idiom for debugging
- catch (SQLException ex)
- { throw ex ; }
- ps.close() ;
-
- ResultSet rs = DB.execQuery(jdbc, "SELECT "+colName+" FROM "+tempTableName) ;
- rs.next() ;
- byte[]b = rs.getBytes(1) ;
-
-// boolean wasNull = rs.wasNull() ;
-// if ( testString != null && wasNull )
-// fail(testLabel+": got an SQL null back") ;
-
- // In Oracle, an empty binary is a NULL. This is not ANSI compliant.
- String s = "" ;
- if ( b != null )
- s = bytesToString(b) ;
- rs.close() ;
- if ( ! testString.equals(s) ) // Debug point
- {
- String $ = s ; // Pointless
- }
- assertEquals("Binary different", testString, s) ;
- //System.out.println("Passed: "+label) ;
- }
-
- String bytesToString(byte[] b)
- {
- if ( b == null )
- fail("bytesToString(null)") ;
-
- try { return new String(b, "UTF-8") ; }
- catch (UnsupportedEncodingException ex)
- {
- ex.printStackTrace();
- throw new RuntimeException("No UTF-8 - should not happen") ;
- }
- }
-
- byte[] stringToBytes(String s)
- {
- if ( s == null )
- fail("stringToByte(null)") ;
- try { return s.getBytes("UTF-8") ; }
- catch (UnsupportedEncodingException ex)
- {
- ex.printStackTrace();
- throw new RuntimeException("No UTF-8 - should not happen") ;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dbtest/TestDB.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dbtest/TestDB.java b/jena-sdb/src-dev/java/dbtest/TestDB.java
deleted file mode 100644
index 3d9a5b5..0000000
--- a/jena-sdb/src-dev/java/dbtest/TestDB.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dbtest;
-
-import java.sql.Connection;
-
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class TestDB extends TestCase
-{
- static private final String asciiBase = "abc" ;
- static private final String latinBase = "Àéíÿ" ;
- static private final String latinExtraBase = "ỹfifl" ; // fi-ligature, fl-ligature
- static private final String greekBase = "αβγ" ;
- static private final String hewbrewBase = "אבג" ;
- static private final String arabicBase = "ءآأ";
- static private final String symbolsBase = "☺☻♪♫" ;
- static private final String chineseBase = "孫子兵法" ; // The Art of War
- static private final String japaneseBase = "日本" ; // Japanese
-
- static public TestSuite suite(Connection jdbc, Params params)
- {
- TestSuite ts = new TestSuite() ;
-
- ts.addTest(new TestShortText(jdbc, "ASCII", asciiBase, params)) ;
- ts.addTest(new TestShortText(jdbc, "Accented Latin", latinBase, params)) ;
- ts.addTest(new TestShortText(jdbc, "Extra Latin", latinExtraBase, params)) ;
- ts.addTest(new TestShortText(jdbc, "Greek", greekBase, params)) ;
- ts.addTest(new TestShortText(jdbc, "Arabic", arabicBase, params)) ;
- ts.addTest(new TestShortText(jdbc, "Hewbrew", hewbrewBase, params)) ;
- ts.addTest(new TestShortText(jdbc, "Symbols", symbolsBase, params)) ;
- ts.addTest(new TestShortText(jdbc, "Chinese", chineseBase, params)) ;
- ts.addTest(new TestShortText(jdbc, "Japanese", japaneseBase, params)) ;
-
- boolean longBinary = params.get(ParamsVocab.TestLongBinary).equalsIgnoreCase("true") ;
- boolean longText = params.get(ParamsVocab.TestLongText).equalsIgnoreCase("true") ;
-
- if ( longBinary )
- {
- ts.addTest(new TestBinary(jdbc, "ASCII", asciiBase, params)) ;
- ts.addTest(new TestBinary(jdbc, "Accented Latin", latinBase, params)) ;
- ts.addTest(new TestBinary(jdbc, "Extra Latin", latinExtraBase, params)) ;
- ts.addTest(new TestBinary(jdbc, "Greek", greekBase, params)) ;
- ts.addTest(new TestBinary(jdbc, "Arabic", arabicBase, params)) ;
- ts.addTest(new TestBinary(jdbc, "Hewbrew", hewbrewBase, params)) ;
- ts.addTest(new TestBinary(jdbc, "Symbols", symbolsBase, params)) ;
- ts.addTest(new TestBinary(jdbc, "Chinese", chineseBase, params)) ;
- ts.addTest(new TestBinary(jdbc, "Japanese", japaneseBase, params)) ;
- }
-
- if ( longText )
- {
- ts.addTest(new TestLongText(jdbc, "ASCII", asciiBase, params)) ;
- ts.addTest(new TestLongText(jdbc, "Accented Latin", latinBase, params)) ;
- ts.addTest(new TestLongText(jdbc, "Extra Latin", latinExtraBase, params)) ;
- ts.addTest(new TestLongText(jdbc, "Greek", greekBase, params)) ;
- ts.addTest(new TestLongText(jdbc, "Arabic", arabicBase, params)) ;
- ts.addTest(new TestLongText(jdbc, "Hewbrew", hewbrewBase, params)) ;
- ts.addTest(new TestLongText(jdbc, "Symbols", symbolsBase, params)) ;
- ts.addTest(new TestLongText(jdbc, "Chinese", chineseBase, params)) ;
- ts.addTest(new TestLongText(jdbc, "Japanese", japaneseBase, params)) ;
- }
-
- if ( ! longBinary && ! longText )
- System.err.println("Warning: not testing long binary nor long text fields") ;
-
- return ts ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dbtest/TestLongText.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dbtest/TestLongText.java b/jena-sdb/src-dev/java/dbtest/TestLongText.java
deleted file mode 100644
index f704333..0000000
--- a/jena-sdb/src-dev/java/dbtest/TestLongText.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dbtest;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import junit.framework.TestCase;
-
-public class TestLongText extends TestCase
-{
- private String tempTableName = null ;
- private String content ;
- private Params params ;
- private Connection jdbc ;
-
- public TestLongText(Connection jdbc, String name, String content, Params params)
- {
- super(name+"/Long text") ;
- this.content = content ;
- this.params = params ;
- tempTableName = params.get(ParamsVocab.TempTableName) ;
- this.jdbc = jdbc ;
- }
-
- @Override
- public void setUp()
- {
- DB.execNoFail(jdbc, "DROP TABLE "+tempTableName) ;
- }
-
- @Override
- public void runTest() throws Exception
- {
- runTextTest(content,
- params.get(ParamsVocab.LongTextCol),
- params.get(ParamsVocab.LongTextType));
- }
-
- private void runTextTest(String testString, String colName, String colType)
- throws Exception
- {
- //testString = ":"+testString+":" ;
- if ( testString == null )
- fail("Test broken - null input") ;
- DB.exec(jdbc, "CREATE TABLE "+tempTableName+"("+colName+" "+colType+")") ;
-
- String $str = "INSERT INTO "+tempTableName+" values (?)" ;
- if ( DB.verbose )
- System.out.println($str) ;
-
- PreparedStatement ps = jdbc.prepareStatement($str) ;
- ps.setString(1, testString) ;
- try { ps.execute() ; } // Idiom for debugging - can breakpoint the throw
- catch (SQLException ex)
- { throw ex ; }
- ps.close() ;
-
- ResultSet rs = DB.execQuery(jdbc, "SELECT "+colName+" FROM "+tempTableName ) ;
- rs.next() ;
-
- // In Oracle an empty string is a NULL. This is not ANSI compliant.
- String s = rs.getString(1) ;
- if ( s == null )
- s = "" ;
- rs.close() ;
-
- assertEquals("Text different", testString, s) ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dbtest/TestShortText.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dbtest/TestShortText.java b/jena-sdb/src-dev/java/dbtest/TestShortText.java
deleted file mode 100644
index f9b9291..0000000
--- a/jena-sdb/src-dev/java/dbtest/TestShortText.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dbtest;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import junit.framework.TestCase;
-
-public class TestShortText extends TestCase
-{
- private String tempTableName = null ;
- private String content ;
- private Params params ;
- private Connection jdbc ;
-
- public TestShortText(Connection jdbc, String name, String content, Params params)
- {
- super(name+"/Text") ;
- this.content = content ;
- this.params = params ;
- tempTableName = params.get(ParamsVocab.TempTableName) ;
- this.jdbc = jdbc ;
- }
-
- @Override
- public void setUp()
- {
- DB.execNoFail(jdbc, "DROP TABLE "+tempTableName) ;
- }
-
- @Override
- public void runTest() throws Exception
- {
- runTextTest(content,
- params.get(ParamsVocab.VarcharCol),
- params.get(ParamsVocab.VarcharType));
- }
-
- private void runTextTest(String testString, String colName, String colType)
- throws Exception
- {
- //testString = ":"+testString+":" ;
- if ( testString == null )
- fail("Test broken - null input") ;
- DB.exec(jdbc, "CREATE TABLE "+tempTableName+"("+colName+" "+colType+")") ;
-
- String $str = "INSERT INTO "+tempTableName+" values (?)" ;
- if ( DB.verbose )
- System.out.println($str) ;
-
- PreparedStatement ps = jdbc.prepareStatement($str) ;
- ps.setString(1, testString) ;
- try { ps.execute() ; } // Idiom for debugging - can breakpoint the throw
- catch (SQLException ex)
- { throw ex ; }
- ps.close() ;
-
- ResultSet rs = DB.execQuery(jdbc, "SELECT "+colName+" FROM "+tempTableName ) ;
- rs.next() ;
- // In Oracle an empty string is a NULL. This is not ANSI compliant.
-
- String s = rs.getString(1) ;
- if ( s == null )
- s = "" ;
- byte[] b = rs.getBytes(1) ;
-
-// boolean wasNull = rs.wasNull() ;
-// if ( testString != null && wasNull )
-// fail(testLabel+" : Got null back") ;
-
- rs.close() ;
-
-// if ( ! testString.equals(s) ) // Debug point
-// {
-// for ( int i = 0 ; i < s.length() ; i++ )
-// {
-// System.out.printf("%x:%x ", (int)testString.charAt(i), (int)s.charAt(i)) ;
-// }
-// System.out.println() ;
-// String $ = s ; // Pointless
-// }
-
- assertEquals("Text different", testString, s) ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dbtest/dbsetuptest.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dbtest/dbsetuptest.java b/jena-sdb/src-dev/java/dbtest/dbsetuptest.java
deleted file mode 100644
index 8d9c5cf..0000000
--- a/jena-sdb/src-dev/java/dbtest/dbsetuptest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dbtest;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Iterator;
-
-/** This program tests a database setup for use with Jena - it tests the JDBC
- * connection and the databse setup for internationalized usage by Jena.
- * It does notrun the RDF tests.
- */
-
-public class dbsetuptest
-{
- //Yet to do: Tests for text type long literals (e.g. PostgreSQL)
- static Params params = new Params() ;
- static Connection jdbc ;
-
- public static void main(String[] argv)
- {
- if ( argv.length > 0 )
- {
- String s = argv[0] ;
- if ( s.startsWith("-") ) s = s.substring(1) ;
- if ( s.startsWith("-") ) s = s.substring(1) ;
- if ( s.equalsIgnoreCase("h") || s.equalsIgnoreCase("help") )
- {
- usage() ;
- return ;
- }
- }
- setParams(argv) ;
-
- System.out.println("JDBC and DB config tests for Jena") ;
- System.out.println("(low-level test of DB and its JDBC configuration - not RDF tests)") ;
- System.out.println() ;
-
- for ( Iterator<String> iter = params.iterator() ; iter.hasNext() ; )
- {
- String k = iter.next() ;
- String v = params.get(k) ;
- System.out.println(k+" = "+v) ;
- }
-
- makeConnection() ;
- System.out.println() ;
- junit.textui.TestRunner.run(TestDB.suite(jdbc, params)) ;
-
- DB.execNoFail(jdbc, "DROP TABLE "+params.get(ParamsVocab.TempTableName)) ;
- }
-
- private static void setParams(String[] args)
- {
- //for ( Iterator iter = args.iterator() ; iter.hasNext() ; )
- for ( int i = 0 ; i < args.length ; i++ )
- {
- //String s = (String)iter.next() ;
- String s = args[i] ;
- String[] frags = s.split("=", 2) ;
- if ( frags.length != 2)
- throw new RuntimeException("Can't split '"+s+"'") ;
- params.put(frags[0], frags[1] ) ;
- }
-
- if ( params.get(ParamsVocab.DBType) == null )
- {
- System.err.println("No DB type given") ;
- System.exit(1) ;
- }
-
- Setup.setParams(params, params.get(ParamsVocab.DBType)) ;
-
- }
-
- private static void makeConnection()
- {
- try {
- Class.forName(params.get(ParamsVocab.Driver)) ;
- } catch (Exception ex)
- {
- ex.printStackTrace(System.err) ;
- System.exit(9) ;
- }
- String url = params.get(ParamsVocab.JDBC) ;
- String user = params.get(ParamsVocab.User) ;
- String password = params.get(ParamsVocab.Password) ;
- try
- {
- jdbc = DriverManager.getConnection(url, user, password) ;
- } catch (SQLException ex)
- {
- ex.printStackTrace();
- System.exit(8) ;
- }
- }
-
- public static void usage()
- {
- System.out.println("Usage: db=TYPE jdbc=URL user=USER password=PASSWORD") ;
- System.out.println(" where TYPE is the database type") ;
- System.out.println(" one of HSQL, MySQL, PostgreSQL, Derby, Oracle, MS-SQL, SAP") ;
- System.out.println(" URL is the JDBC URL to connect to the database") ;
- System.out.println(" USER and PASSWORD are the access details.") ;
- System.out.println("Requires table ceration rights on the database") ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/Main.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/Main.java b/jena-sdb/src-dev/java/dev/Main.java
deleted file mode 100644
index 05d1f84..0000000
--- a/jena-sdb/src-dev/java/dev/Main.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev;
-
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.sdb.SDBFactory ;
-import com.hp.hpl.jena.sdb.Store ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-import com.hp.hpl.jena.sparql.sse.SSE ;
-
-public class Main
-{
-
- public static void main(String[] args)
- {
- Store store = SDBFactory.connectStore("Store/sdb-hsqldb-mem.ttl") ;
- store.getTableFormatter().format() ;
- store.getTableFormatter().addIndexes() ;
-
- Dataset ds = SDBFactory.connectDataset(store) ;
- DatasetGraph dsg = ds.asDatasetGraph() ;
- Quad quad = SSE.parseQuad("(<g> <s> <p> <o>)") ;
- dsg.add(quad) ;
- System.out.println("DONE") ;
- System.exit(0) ;
- }
-
- public static void main2(String[] args)
- {
- sdb.sdbquery.main("--sdb=sdb.ttl", "--set", "sdb:unionDefaultGraph=true", "SELECT * { ?s ?p ?o }") ;
- //sdbquery.main("--sdb=sdb.ttl", "--set", "http://jena.hpl.hp.com/SDB/symbol#unionDefaultGraph=true", "SELECT * { ?s ?p ?o }") ;
- }
-
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/ReportSparqlUpdate.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/ReportSparqlUpdate.java b/jena-sdb/src-dev/java/dev/ReportSparqlUpdate.java
deleted file mode 100644
index 8ef9085..0000000
--- a/jena-sdb/src-dev/java/dev/ReportSparqlUpdate.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev;
-
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.rdf.listeners.StatementListener ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.ModelChangedListener ;
-import com.hp.hpl.jena.rdf.model.Property ;
-import com.hp.hpl.jena.rdf.model.Resource ;
-import com.hp.hpl.jena.rdf.model.Statement ;
-import com.hp.hpl.jena.sdb.SDBFactory ;
-import com.hp.hpl.jena.sdb.Store ;
-import com.hp.hpl.jena.sdb.test.junit.SDBTestUtils ;
-
-
-public class ReportSparqlUpdate
-{
- public static void main(String ...args)
- {
- Store store = SDBTestUtils.createInMemoryStore() ;
- Dataset ds = SDBFactory.connectDataset(store) ;
-
- Model m = ds.getDefaultModel() ;
- ModelChangedListener listener = new StatementListener()
- {
- @Override
- public void addedStatement( Statement s )
- {
- System.out.println("Add: "+s) ;
- }
- @Override
- public void removedStatement( Statement s )
- {
- System.out.println("Remove: "+s) ;
- }
- } ;
-
- m.register(listener) ;
-
- Resource s = m.createResource("http://example/s") ;
- Property p = m.createProperty("http://example/o") ;
- m.add(s, p, "123") ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/RunTests.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/RunTests.java b/jena-sdb/src-dev/java/dev/RunTests.java
deleted file mode 100644
index d9b7f07..0000000
--- a/jena-sdb/src-dev/java/dev/RunTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev;
-
-import junit.framework.TestSuite;
-
-import com.hp.hpl.jena.sdb.test.graph.TestDerbyGraph;
-import com.hp.hpl.jena.sdb.test.graph.TestDerbyGraph.TestDerbyIndexGraph;
-import com.hp.hpl.jena.sdb.test.model.TestDerbyModel;
-import com.hp.hpl.jena.sdb.test.model.TestDerbyModel.TestDerbyIndexModel;
-import com.hp.hpl.jena.sparql.junit.SimpleTestRunner;
-
-public class RunTests
-{
- public static junit.framework.Test suite() {
- TestSuite ts = new TestSuite();
-
- ts.addTest(TestDerbyGraph.suite());
- ts.addTest(TestDerbyModel.suite());
- return ts;
- }
-
-
- public static void main(String ... argv)
- {
- TestSuite ts = new TestSuite();
- ts.addTestSuite(TestDerbyIndexGraph.class) ;
- SimpleTestRunner.runAndReport(ts) ;
-
- ts = new TestSuite();
- ts.addTestSuite(TestDerbyIndexModel.class) ;
- SimpleTestRunner.runAndReport(ts) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/TestStores2Connections1.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/TestStores2Connections1.java b/jena-sdb/src-dev/java/dev/TestStores2Connections1.java
deleted file mode 100644
index cb090e8..0000000
--- a/jena-sdb/src-dev/java/dev/TestStores2Connections1.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev;
-
-import java.sql.SQLException;
-
-import com.hp.hpl.jena.graph.Graph;
-import com.hp.hpl.jena.graph.Triple;
-import com.hp.hpl.jena.sdb.SDBFactory;
-import com.hp.hpl.jena.sdb.Store;
-import com.hp.hpl.jena.sdb.StoreDesc;
-import com.hp.hpl.jena.sdb.sql.SDBConnection;
-import com.hp.hpl.jena.sdb.sql.SDBConnectionFactory;
-import com.hp.hpl.jena.sdb.sql.TableUtils;
-import com.hp.hpl.jena.sdb.store.StoreFactory;
-import com.hp.hpl.jena.sparql.sse.SSE;
-
-/**
- * Imitate connection pooling.
- * Create an SQL/JDBC connection, create a store around it, do something
- * then remove the store (forget it, close it).
- * Create another store on the JDBC conenction.
- */
-public class TestStores2Connections1
-{
- public static void main(String ... argv) throws SQLException
- {
- Triple t1 = SSE.parseTriple("(:x1 :p :z)") ;
- Triple t2 = SSE.parseTriple("(:x2 :p :z)") ;
-
- StoreDesc desc = StoreDesc.read("sdb.ttl") ;
- java.sql.Connection conn = SDBFactory.createSqlConnection("sdb.ttl") ;
-
-
- boolean explicitTransactions = false ;
- {
- SDBConnection sConn1 = SDBConnectionFactory.create(conn) ;
- Store store1 = StoreFactory.create(desc, sConn1) ;
-
- if ( explicitTransactions )
- store1.getConnection().getTransactionHandler().begin() ;
-
- Graph graph1 = SDBFactory.connectDefaultGraph(store1) ;
- graph1.clear() ;
- SSE.write(graph1) ; System.out.println();
- graph1.add(t1) ;
- SSE.write(graph1) ; System.out.println();
-
- // Look for temporary tables.
- TableUtils.hasTable(sConn1.getSqlConnection(), "#NNodeTriples", new String[0]) ;
-
- if ( explicitTransactions )
- store1.getConnection().getTransactionHandler().commit() ;
-
- //store1.close() ;
-
- }
-
- // Mythically return conn to the pool.
- // Get from pool
- // i.e. same connection. Make a store around it
-
- {
- SDBConnection sConn2 = SDBConnectionFactory.create(conn) ;
- Store store2 = StoreFactory.create(desc, sConn2) ;
-
- if ( explicitTransactions )
- store2.getConnection().getTransactionHandler().begin() ;
-
- Graph graph2 = SDBFactory.connectDefaultGraph(store2) ;
- graph2.add(t2) ;
- SSE.write(graph2) ; System.out.println();
-
- if ( explicitTransactions )
- store2.getConnection().getTransactionHandler().commit() ;
-
- store2.close() ;
- }
- System.exit(0) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/db/DBSyntax.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/db/DBSyntax.java b/jena-sdb/src-dev/java/dev/db/DBSyntax.java
deleted file mode 100644
index 748a6e6..0000000
--- a/jena-sdb/src-dev/java/dev/db/DBSyntax.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.db;
-
-import static java.lang.String.format ;
-import static org.apache.jena.atlas.lib.StrUtils.strjoin ;
-
-import java.util.List;
-
-/** Database column descriptions. This calls contains the SQL (or common) standard forms,
- * to be overrided by each database type.
- */
-public class DBSyntax
-{
- // -----------------
-
- // Column type names.
- public String integer32() { return "int" ; }
- public String integer64() { return "bigint" ; }
-
- // national character set (UTF-8)
-
- public String varchar(int n) { return varchar(Integer.toString(n)) ; }
-
- public String varchar(String str) { return "nvarchar("+str+")" ; }
-
-// public String varchar(String str, String dftValue)
-// { return defaultValue(varchar(str), SQLUtils.quoteStr(dftValue)) ; }
-
- public String text() { return "ntext" ; }
-
- public String primaryKey(List<String> colNames)
- { return format("PRIMARY KEY(%s))", strjoin(", ", colNames)) ; }
-
- public String primaryKey(String... colNames)
- { return format("PRIMARY KEY(%s))", strjoin(", ", colNames)) ; }
-
- public String index(String indexName, String tableName, String... colNames)
- {
- return format("CREATE INDEX %s ON %s (%s)",
- indexName, tableName, strjoin(", ", colNames)) ;
- }
-
- public String dropIndex(String indexName, String tableName)
- {
- return format("DROP INDEX %s", indexName, tableName);
- }
-
- public String truncate(String tableName)
- { return "DELETE FROM "+tableName ; }
- // -----------------
-
- public static String notNull(String x)
- { return allowNull(x, false); }
-
- public static String allowNull(String x, boolean nullable)
- {
- if ( ! nullable )
- x = x+" NOT NULL" ;
- return x ;
- }
-
-
- public static String defaultValue(String x, String dftValue)
- {
- if ( dftValue != null )
- x = x+" DEFAULT "+dftValue ;
- return x ;
- }
-
- public static String col(String name, String type, boolean nullable)
- {
- String x = name+" "+type ;
- x = allowNull(x, nullable) ;
- return x ;
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/db/FmtStdHash.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/db/FmtStdHash.java b/jena-sdb/src-dev/java/dev/db/FmtStdHash.java
deleted file mode 100644
index 9635d7d..0000000
--- a/jena-sdb/src-dev/java/dev/db/FmtStdHash.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.db;
-
-import static com.hp.hpl.jena.sdb.sql.SQLUtils.sqlStr ;
-import static dev.db.DBSyntax.col ;
-
-import java.sql.SQLException ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.iterator.Transform ;
-
-import com.hp.hpl.jena.sdb.layout2.TableDescNodes ;
-import com.hp.hpl.jena.sdb.sql.SDBConnection ;
-import com.hp.hpl.jena.sdb.sql.SDBExceptionSQL ;
-import com.hp.hpl.jena.sdb.store.TableDesc ;
-
-public class FmtStdHash extends StoreFormatterStd
-{
- private DBSyntax syntax ;
- private static final boolean NOT_NULL = false ;
-
-
- public FmtStdHash(SDBConnection conn, DBSyntax syntax)
- {
- super(conn) ;
- this.syntax = syntax ;
- }
-
- @Override
- protected void formatTableNodes()
- {
- dropTable(TableDescNodes.name()) ;
- try {
- connection().exec(sqlStr ("CREATE TABLE "+TableDescNodes.name()+" (",
- " "+col("hash", syntax.integer64(), NOT_NULL),
- " "+col("lex", syntax.text(), NOT_NULL),
- " "+col("lang", syntax.varchar(20), NOT_NULL),
- " "+col("datatype", syntax.varchar(200), NOT_NULL),
- " "+col("type", syntax.integer32(), NOT_NULL),
- " "+syntax.primaryKey("hash"),
- ")"
- )) ;
- } catch (SQLException ex)
- {
- throw new SDBExceptionSQL("SQLException formatting table '"+TableDescNodes.name()+"'",ex) ;
- }
- }
-
- @Override
- protected void formatTablePrefixes()
- {}
-
- private static final String SEP = ",\n" ;
-
- protected Transform<String, String> getColDeclTransform()
- {
- return
- new Transform<String, String>() {
- @Override
- public String convert(String colName)
- { return col(colName, syntax.integer64(), NOT_NULL) ; }
- };
- }
-
- @Override
- protected void formatTupleTable(TableDesc tableDesc)
- {
- dropTable(tableDesc.getTableName()) ;
- try {
-
- String cols = Iter.iter(tableDesc.getColNames()).map(getColDeclTransform()).asString() ;
- cols = cols + SEP + syntax.primaryKey(tableDesc.getColNames()) ;
- String sql = String.format("CREATE TABLE %s (\n%s\n)", tableDesc.getTableName(), cols) ;
- connection().exec(sql) ;
- } catch (SQLException ex)
- {
- throw new SDBExceptionSQL("SQLException formatting table '"+tableDesc.getTableName()+"'",ex) ;
- }
- }
-
-
- @Override
- protected void addIndexesTableQuads()
- {}
-
- @Override
- protected void addIndexesTableTriples()
- {}
-
- @Override
- protected void dropIndexesTableQuads()
- {}
-
- @Override
- protected void dropIndexesTableTriples()
- {}
-
- @Override
- protected void truncateTableNodes()
- {}
-
- @Override
- protected void truncateTablePrefixes()
- {}
-
- @Override
- protected void truncateTableQuads()
- {}
-
- @Override
- protected void truncateTableTriples()
- {}
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/db/StoreFormatterStd.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/db/StoreFormatterStd.java b/jena-sdb/src-dev/java/dev/db/StoreFormatterStd.java
deleted file mode 100644
index 473e257..0000000
--- a/jena-sdb/src-dev/java/dev/db/StoreFormatterStd.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.db;
-
-import com.hp.hpl.jena.sdb.layout2.TableDescQuads;
-import com.hp.hpl.jena.sdb.layout2.TableDescTriples;
-import com.hp.hpl.jena.sdb.sql.SDBConnection;
-import com.hp.hpl.jena.sdb.sql.TableUtils;
-import com.hp.hpl.jena.sdb.store.StoreFormatterBase;
-import com.hp.hpl.jena.sdb.store.TableDesc;
-
-public abstract class StoreFormatterStd extends StoreFormatterBase
-{
- public StoreFormatterStd(SDBConnection conn)
- {
- super(conn) ;
- }
-
-// public void create()
-// {
-// format() ;
-// addIndexes() ;
-// }
-
- @Override
- public void format()
- {
- formatTablePrefixes() ;
- formatTableNodes() ;
- formatTableTriples() ;
- formatTableQuads() ;
- }
-
- @Override
- public void truncate()
- {
- truncateTablePrefixes() ;
- truncateTableNodes() ;
- truncateTableTriples() ;
- truncateTableQuads() ;
- }
-
- @Override
- public void addIndexes()
- {
- addIndexesTableTriples() ;
- addIndexesTableQuads() ;
- }
-
- @Override
- public void dropIndexes()
- {
- dropIndexesTableTriples() ;
- dropIndexesTableQuads() ;
- }
-
- public static TableDescQuads descQ = new TableDescQuads() ;
- public static TableDescTriples descT = new TableDescTriples() ;
-
-
-
- protected void formatTableTriples() { formatTupleTable(descT) ; }
- protected void formatTableQuads() { formatTupleTable(descQ) ; }
-
- abstract protected void formatTupleTable(TableDesc tableDesc) ;
-
- abstract protected void formatTableNodes() ;
- abstract protected void formatTablePrefixes() ;
-
- abstract protected void addIndexesTableTriples() ;
- abstract protected void addIndexesTableQuads() ;
-
- abstract protected void dropIndexesTableTriples() ;
- abstract protected void dropIndexesTableQuads() ;
-
- abstract protected void truncateTableTriples() ;
- abstract protected void truncateTableQuads() ;
- abstract protected void truncateTableNodes() ;
- abstract protected void truncateTablePrefixes() ;
-
- protected void dropTable(String tableName)
- {
- TableUtils.dropTable(connection(), tableName) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/inf/TransGraph.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/inf/TransGraph.java b/jena-sdb/src-dev/java/dev/inf/TransGraph.java
deleted file mode 100644
index f00f87b..0000000
--- a/jena-sdb/src-dev/java/dev/inf/TransGraph.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.inf;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import com.hp.hpl.jena.sdb.util.Pair;
-
-/** In-memory structure to create a transitive closure over GNodes */
-
-public class TransGraph<GNode> extends HashMap<GNode, HashSet<GNode>> implements Iterable<Pair<GNode, GNode>>
-{
- public interface LinkApply<T> { public void apply(T i, T j) ; }
- public interface NodeApply<T> { public void apply(T i) ; }
-
- public void add(GNode i, GNode j)
- {
- Set<GNode> x = ensure(i) ;
- x.add(j) ;
- ensure(j) ;
- }
-
- private Set<GNode> ensure(GNode i)
- {
- HashSet<GNode> x = get(i) ;
- if ( x != null )
- return x ;
- x = new HashSet<GNode>() ;
- put(i, x) ;
- return x ;
- }
-
- public boolean contains(GNode i, GNode j)
- {
- Set<GNode> x = get(i) ;
- if ( x == null ) return false ;
- return x.contains(j) ;
- }
-
- public boolean contains(GNode i)
- {
- return contains(i) ;
- }
-
- /*
- http://www.cs.duke.edu/~reynolds/149/warshall.c.html
- 15: void warshall(int size) {
- 16: register int i, j, k;
- 17: for (k=size-1; k>=0; k--)
- 18: for (i=size-1; i>=0; i--)
- 19: for (j=size-1; j>=0; j--) {
- 20: double dist = graph[i][k] + graph[k][j];
- 21: if (dist < graph[i][j]) graph[i][j] = dist;
- 22: }
- */
-
- // Walshall's algorithm
- // Adapted only in that it works on the sparse graph
- // representation used to record the links.
-
- public void expand()
- {
- // Iterator over all the nodes (whether they have links initially or not).
- // Because this is not updated by any new additions (they only link
- // existing nodes), it is safe to iterate over the set while adding
- // new links.
-
- Set<GNode> allNodes = keySet() ;
-
-// for ( Integer k : allNodes )
-// for ( Integer i : allNodes )
-// for ( Integer j : allNodes )
-// if ( pairs.contains(i, k) && pairs.contains(k,j) )
-// pairs.add(i, j) ;
-
- // Move test out one level.
- for ( GNode k : allNodes )
- for ( GNode i : allNodes )
- if ( contains(i, k) )
- for ( GNode j : allNodes )
- if ( contains(k,j) )
- add(i, j) ;
- }
-
- public void expandReflexive()
- {
- for ( GNode i : keySet() )
- add(i,i) ;
- }
-
- @Override
- public Iterator<Pair<GNode, GNode>>iterator()
- {
- List<Pair<GNode, GNode>> x = new ArrayList<Pair<GNode, GNode>>() ;
- for ( GNode k : keySet() )
- for ( GNode v : get(k) )
- x.add(new Pair<GNode, GNode>(k, v)) ;
- return x.iterator() ;
- }
-
-
-
- public void linkApply(LinkApply<GNode> a)
- {
- for ( GNode i : keySet() )
- for ( GNode j : get(i) )
- a.apply(i, j) ;
- }
-
- public void nodeApply(NodeApply<GNode> a)
- {
- for ( GNode i : keySet() )
- a.apply(i) ;
- }
-
- public void printLinks()
- {
- linkApply(new LinkApply<GNode>()
- {
- @Override
- public void apply(GNode i, GNode j)
- {
- System.out.printf("%s %s\n", i, j) ;
- }
- }) ;
- }
- public void print()
- {
- for ( GNode i : keySet() )
- {
- System.out.printf("%s :", i) ;
- for ( GNode j : get(i) )
- System.out.printf(" %s", j) ;
- System.out.println() ;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/inf/TransGraphNode.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/inf/TransGraphNode.java b/jena-sdb/src-dev/java/dev/inf/TransGraphNode.java
deleted file mode 100644
index ddf46ed..0000000
--- a/jena-sdb/src-dev/java/dev/inf/TransGraphNode.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.inf;
-
-import static com.hp.hpl.jena.sparql.sse.builders.BuilderLib.checkLength ;
-import static com.hp.hpl.jena.sparql.sse.builders.BuilderLib.checkList ;
-import static com.hp.hpl.jena.sparql.sse.builders.BuilderLib.checkNode ;
-import org.apache.jena.atlas.iterator.Iter ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.sse.Item ;
-import com.hp.hpl.jena.sparql.sse.ItemList ;
-
-class TransGraphNode extends TransGraph<Node>
-{
- public static TransGraphNode build(Item item)
- {
- TransGraphNode tg = new TransGraphNode() ;
- checkList(item) ;
- ItemList list = item.getList() ;
- list = list.cdr() ;
-
- Iter<Item> xIter = Iter.iter(list.iterator()) ;
-
- for ( Item x : xIter)
- {
- checkList(item) ;
- ItemList pair = x.getList() ;
- checkLength(2, pair, "Not a pair: "+pair.shortString()) ;
- Item a = pair.get(0) ;
- Item b = pair.get(1) ;
- checkNode(a) ;
- checkNode(b) ;
- tg.add(a.getNode(), b.getNode()) ;
- }
- return tg ;
- }
-
- public Item asItem(String tag)
- {
- final Item top = Item.createList() ;
- top.getList().add(Item.createSymbol(tag)) ;
-
- LinkApply<Node> x = new LinkApply<Node>() {
- @Override
- public void apply(Node i, Node j)
- {
- Item pair = pair(i,j) ;
- top.getList().add(pair) ;
-
- // Make if BuilderTable compatible.
-// item.getList().add(Item.createWord("row")) ;
-//
-// Item x = pair("sub", i) ;
-// Item y = pair("super", j) ;
-//
-// item.getList().add(x) ;
-// item.getList().add(y) ;
-// top.getList().add(item) ;
- }
-
- private Item pair(Node x, Node y)
- {
- Item item = Item.createList() ;
- item.getList().add(x) ;
- item.getList().add(y) ;
- return item ;
- } } ;
- super.linkApply(x) ;
- return top ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/inf/sdbRDFSexpand.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/inf/sdbRDFSexpand.java b/jena-sdb/src-dev/java/dev/inf/sdbRDFSexpand.java
deleted file mode 100644
index 9dabfff..0000000
--- a/jena-sdb/src-dev/java/dev/inf/sdbRDFSexpand.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.inf;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.sparql.sse.Item ;
-import com.hp.hpl.jena.sparql.sse.ItemWriter ;
-import com.hp.hpl.jena.util.FileManager ;
-import com.hp.hpl.jena.util.iterator.ExtendedIterator ;
-import com.hp.hpl.jena.vocabulary.RDFS ;
-
-public class sdbRDFSexpand
-{
- public static void main(String... args)
- {
- // Read model.
- Model m = FileManager.get().loadModel("D.ttl") ;
-
- // Need to worry about pure rdf:type stuff (unlinked classes
- Item itemC = make(TAG_CLASS, RDFS.subClassOf.asNode(), m.getGraph()) ;
-
- IndentedWriter out = new IndentedWriter(System.out) ;
- ItemWriter.write(out, itemC, null) ;
- out.flush() ;
- //Item itemP = make(TAG_PROP, RDFS.subPropertyOf.asNode(), m.getGraph()) ;
- }
-
- static public final String TAG_PROP = "trans-property" ;
- static public final String TAG_CLASS = "trans-class" ;
-
- static Item make(String tag, Node property, Graph graph)
- {
- TransGraphNode tg = new TransGraphNode() ;
- ExtendedIterator<Triple> iter = graph.find(null, property, null) ;
- for ( ; iter.hasNext() ; )
- {
- Triple t = iter.next() ;
- tg.add(t.getSubject(), t.getObject()) ;
- }
- tg.expandReflexive() ;
- //tg.expand() ;
- return tg.asItem(tag) ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/inf/sdbRDFSload.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/inf/sdbRDFSload.java b/jena-sdb/src-dev/java/dev/inf/sdbRDFSload.java
deleted file mode 100644
index eff5ca4..0000000
--- a/jena-sdb/src-dev/java/dev/inf/sdbRDFSload.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.inf;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.sql.SQLException;
-
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.sdb.SDBFactory;
-import com.hp.hpl.jena.sdb.Store;
-import com.hp.hpl.jena.sdb.layout2.hash.TupleLoaderOneHash;
-import com.hp.hpl.jena.sdb.sql.JDBC;
-import com.hp.hpl.jena.sdb.sql.SDBConnection;
-import com.hp.hpl.jena.sdb.sql.SDBExceptionSQL;
-import com.hp.hpl.jena.sdb.store.DatabaseType;
-import com.hp.hpl.jena.sdb.store.LayoutType;
-import com.hp.hpl.jena.sdb.store.StoreFactory;
-import com.hp.hpl.jena.sdb.store.TableDesc;
-import com.hp.hpl.jena.sdb.store.TupleLoader;
-import com.hp.hpl.jena.sdb.store.TupleTable;
-import com.hp.hpl.jena.sdb.util.Pair;
-import com.hp.hpl.jena.sparql.sse.Item;
-import com.hp.hpl.jena.sparql.sse.SSE;
-
-public class sdbRDFSload
-{
- public static void main(String... args) throws FileNotFoundException
- {
- // Read data.
- InputStream in = System.in ;
- in = new FileInputStream("T.sse") ;
- Item x = SSE.parse(in) ;
- TransGraphNode tg = TransGraphNode.build(x) ;
-
- Store store = makeMemHash() ;
- TupleLoader loader = new TupleLoaderOneHash(store.getConnection()) ;
-
- // ---- Config
- String tableName = "classes" ;
-
- // ---- Load auxillary table
- String subColName = "sub" ;
- String superColName = "super" ;
- TableDesc tableDesc = new TableDesc(tableName, subColName, superColName) ;
- TupleTable tuples = new TupleTable(store, tableDesc) ;
-
- // ---- Create auxillary table
-
- String colType = store.getNodeTableDesc().getNodeRefTypeString() ;
- try {
- String sqlCreateStr =
- String.format("CREATE TABLE %s ( sub %s not null, super %s not null )",
- tableName, colType, colType) ;
- store.getConnection().execUpdate(sqlCreateStr) ;
- } catch (SQLException ex) { throw new SDBExceptionSQL(ex) ; }
-
- loader.setTableDesc(tableDesc) ;
-
- loader.start() ;
- for (Pair<Node, Node> p : tg )
- loader.load(p.getLeft(), p.getRight()) ;
- loader.finish() ;
-
- // ---- Dump it.
- tuples.dump() ;
- store.close() ;
- }
-
- static public final String TAG_CLASS = "trans-class" ;
- static public final String TAG_PROP = "trans-property" ;
-
- static Store makeMemHash()
- {
- JDBC.loadDriverHSQL();
-
- SDBConnection sdb = SDBFactory.createConnection(
- "jdbc:hsqldb:mem:aname", "sa", "");
- Store store = StoreFactory.create(sdb, LayoutType.LayoutTripleNodesHash, DatabaseType.HSQLDB) ;
- store.getTableFormatter().format();
- return store ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/pldms/Scratch.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/pldms/Scratch.java b/jena-sdb/src-dev/java/dev/pldms/Scratch.java
deleted file mode 100644
index 8b7f8ad..0000000
--- a/jena-sdb/src-dev/java/dev/pldms/Scratch.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.pldms;
-
-import com.hp.hpl.jena.sdb.layout2.TableDescNodes;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import com.hp.hpl.jena.sdb.Store;
-import com.hp.hpl.jena.sdb.store.StoreFactory;
-import com.hp.hpl.jena.sdb.store.TableDesc;
-import java.util.Collection;
-import java.util.HashSet;
-
-public class Scratch {
-
- /**
- * @param args
- * @throws SQLException
- */
- public static void main(String[] args) throws SQLException {
- Store store = StoreFactory.create("Store/sdb-hsqldb-mem.ttl");
- System.err.println("Formatted? " + formatted(store));
- store.getTableFormatter().create();
- System.err.println("Formatted? " + formatted(store));
- }
-
- public static boolean formatted(Store store) throws SQLException {
- return checkNodes(store) && checkTuples(store);
- }
-
- private static boolean checkNodes(Store store) throws SQLException {
- Connection conn = store.getConnection().getSqlConnection();
- TableDescNodes nodeDesc = store.getNodeTableDesc();
- if (nodeDesc == null) {
- return true; // vacuous
- }
- return hasTableAndColumns(conn,
- nodeDesc.getTableName(),
- nodeDesc.getIdColName(),
- nodeDesc.getHashColName(),
- nodeDesc.getLexColName(),
- nodeDesc.getLangColName(),
- nodeDesc.getTypeColName());
- }
-
- private static boolean checkTuples(Store store) throws SQLException {
- Connection conn = store.getConnection().getSqlConnection();
- return isTupleTableFormatted(conn, store.getTripleTableDesc()) &&
- isTupleTableFormatted(conn, store.getQuadTableDesc());
- }
-
- private static boolean isTupleTableFormatted(Connection conn, TableDesc desc) throws SQLException {
- if (desc == null) {
- return true; // vacuous
- }
- return hasTableAndColumns(conn,
- desc.getTableName(),
- desc.getColNames().toArray(new String[]{}));
- }
-
- private static boolean hasTableAndColumns(Connection conn, String tableName, String... colNames) throws SQLException {
- Collection<String> cols = new HashSet<String>();
- for (String c : colNames) {
- if (c != null) {
- cols.add(c.toLowerCase());
- }
- }
- return (hasColumns(conn, tableName, cols) ||
- hasColumns(conn, tableName.toLowerCase(), cols) ||
- hasColumns(conn, tableName.toUpperCase(), cols));
- }
-
- private static boolean hasColumns(Connection conn, String tableName, Collection<String> colNames) throws SQLException {
- //System.err.println("Trying: " + tableName);
- ResultSet res = null;
- try {
- res = conn.getMetaData().getColumns(null, null, tableName, null);
- while (res.next()) {
- String colName = res.getString("COLUMN_NAME");
- //System.err.println("Looking at :" + colName + " " + colNames.contains(colName.toLowerCase()));
- colNames.remove(colName.toLowerCase());
- }
- //System.err.print("[");
- //for (String col: colNames) System.err.print(col + ",");
- //System.err.println("]");
- return colNames.isEmpty();
- } finally {
- if (res != null) {
- res.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/reports/OpenCurosrOracle.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/reports/OpenCurosrOracle.java b/jena-sdb/src-dev/java/dev/reports/OpenCurosrOracle.java
deleted file mode 100644
index f20003f..0000000
--- a/jena-sdb/src-dev/java/dev/reports/OpenCurosrOracle.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.reports;
-
-import java.sql.Connection;
-
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.sdb.SDBFactory;
-import com.hp.hpl.jena.sdb.Store;
-import com.hp.hpl.jena.sdb.StoreDesc;
-import com.hp.hpl.jena.sdb.sql.SDBConnection;
-import com.hp.hpl.jena.sdb.sql.SDBConnectionFactory;
-import com.hp.hpl.jena.sdb.store.StoreFactory;
-import com.hp.hpl.jena.util.FileManager;
-
-
-
-public class OpenCurosrOracle
-{
- public static void main(String[] argv) throws Exception {
- OpenCurosrOracle test = new OpenCurosrOracle();
- test.test();
- }
-
- public void test() throws Exception {
- System.out.print("\nOracle Open Cursor Test started ");
- // Get Store description
- String configFile = "sdb.ttl";
- StoreDesc desc = StoreDesc.read(configFile);
- Connection conn = SDBFactory.createSqlConnection(configFile);
-
- // Keep jdbc connection open to simulate pooled connection
- try {
- SDBConnection sdbConn = SDBConnectionFactory.create(conn);
- Model model = FileManager.get().loadModel("D.ttl");
-
- for (int i=0; i <= 150; i++)
- {
- Store store = null;
- try {
-// System.out.println("RUN " + i);
- System.out.println(". "+i);
-
- // create store
- store = StoreFactory.create(desc, sdbConn);
-
- // save model
- Model m = SDBFactory.connectDefaultModel(store) ;
- m.begin();
- m.removeAll();
- m.add(model);
- m.commit();
-
- } catch (Exception e) {
- System.out.println( "\nFailed on iteration " + i);
- e.printStackTrace();
- throw e;
- } finally {
- if (store != null) { store.close(); }
- }
- }
- } finally {
- if (conn != null) {
- conn.close();
- }
- }
-
- System.out.println("\nTest successful!");
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/4cfcafe8/jena-sdb/src-dev/java/dev/reports/Report_ReifiedStatements.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src-dev/java/dev/reports/Report_ReifiedStatements.java b/jena-sdb/src-dev/java/dev/reports/Report_ReifiedStatements.java
deleted file mode 100644
index d426fb1..0000000
--- a/jena-sdb/src-dev/java/dev/reports/Report_ReifiedStatements.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dev.reports;
-
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.ModelFactory ;
-import com.hp.hpl.jena.rdf.model.ReifiedStatement ;
-import com.hp.hpl.jena.rdf.model.ResourceFactory ;
-import com.hp.hpl.jena.rdf.model.Statement ;
-import com.hp.hpl.jena.sdb.SDBFactory ;
-import com.hp.hpl.jena.sdb.Store ;
-import com.hp.hpl.jena.vocabulary.RDFS ;
-
-public class Report_ReifiedStatements
-{
- public static void main(String...argv)
- {
- // Add stmt to in memory model and reify it:
- Model model = ModelFactory.createDefaultModel();
-
- Store store = SDBFactory.connectStore("sdb.ttl") ;
- store.getTableFormatter().create() ;
-
- Model sdbModel = SDBFactory.connectDefaultModel(store) ;
-
- Statement stmt = model.createStatement(ResourceFactory
- .createResource("urn:test:t1"), RDFS.label, "foo1");
-
- model.add(stmt);
- ReifiedStatement rs = stmt.createReifiedStatement();
- rs.addProperty(ResourceFactory.createProperty("urn:property:foo"),"Foo");
-
- System.out.println("Model:");
- model.write(System.out, "N-TRIPLES");
- System.out.println();
-
- // now add in memory model to SDB model
- sdbModel.add(model); // <------- CannotReifyException THROWN HERE!!!!!!!!!!!!!!!
-
- System.out.println("SDB Model:");
- sdbModel.write(System.out, "N-TRIPLES");
- System.out.println();
-
-
- System.out.println("DONE");
- }
-}