You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2013/08/08 23:34:01 UTC
svn commit: r1512049 - in /jena/trunk/jena-sdb: ./ Store/
src-dev/java/dbtest/ src/main/java/com/hp/hpl/jena/sdb/
src/main/java/com/hp/hpl/jena/sdb/assembler/
src/main/java/com/hp/hpl/jena/sdb/compiler/
src/main/java/com/hp/hpl/jena/sdb/layout1/ src/ma...
Author: rvesse
Date: Thu Aug 8 21:34:00 2013
New Revision: 1512049
URL: http://svn.apache.org/r1512049
Log:
Apply SAP support patch from JENA-241
Added:
jena/trunk/jena-sdb/Store/sdb-sap-layout1.ttl
jena/trunk/jena-sdb/Store/sdb-sap.ttl
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/FormatterSimpleSAP.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/StoreSimpleSAP.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/FmtLayout2HashSAP.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/StoreTriplesNodesHashSAP.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/TupleLoaderHashSAP.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/FmtLayout2IndexSAP.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/StoreTriplesNodesIndexSAP.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/TupleLoaderIndexSAP.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/SAPStorageType.java
jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/graph/TestSAPGraph.java
jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/model/TestSAPModel.java
jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPHash.java
jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPIndex.java
jena/trunk/jena-sdb/testing/StoreDesc/sap-hash.ttl
jena/trunk/jena-sdb/testing/StoreDesc/sap-index.ttl
jena/trunk/jena-sdb/testing/StoreDescSimple/sap-layout1.ttl
Modified:
jena/trunk/jena-sdb/sdb.ttl
jena/trunk/jena-sdb/src-dev/java/dbtest/Setup.java
jena/trunk/jena-sdb/src-dev/java/dbtest/dbsetuptest.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/StoreDesc.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/AssemblerVocab.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/StoreDescAssembler.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/compiler/SDBCompile.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/JDBC.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/DatabaseType.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/StoreFactory.java
jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/util/StoreUtils.java
jena/trunk/jena-sdb/src/main/java/sdb/cmd/ModStore.java
jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/SDBModelGraphTestSuite.java
jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/StoreCreator.java
jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/misc/TestRegistry.java
jena/trunk/jena-sdb/testing/store-list-simple.ttl
jena/trunk/jena-sdb/testing/store-list.ttl
Added: jena/trunk/jena-sdb/Store/sdb-sap-layout1.ttl
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/Store/sdb-sap-layout1.ttl?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/Store/sdb-sap-layout1.ttl (added)
+++ jena/trunk/jena-sdb/Store/sdb-sap-layout1.ttl Thu Aug 8 21:34:00 2013
@@ -0,0 +1,20 @@
+@prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
+
+# SDB for SAP over the simple layout1.
+
+
+<#store> rdf:type sdb:Store ;
+ sdb:layout "layout1" ;
+ sdb:connection <#conn> ;
+ sdb:storage "column" ; # SAP specific
+.
+
+<#conn> rdf:type sdb:SDBConnection ;
+ sdb:sdbType "sap" ;
+ sdb:sdbHost "localhost" ;
+ sdb:sdbName "00" ;
+ sdb:driver "com.sap.db.jdbc.Driver" ;
+ .
Added: jena/trunk/jena-sdb/Store/sdb-sap.ttl
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/Store/sdb-sap.ttl?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/Store/sdb-sap.ttl (added)
+++ jena/trunk/jena-sdb/Store/sdb-sap.ttl Thu Aug 8 21:34:00 2013
@@ -0,0 +1,16 @@
+@prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
+
+<#store> rdf:type sdb:Store ;
+ sdb:layout "layout2" ;
+ sdb:connection <#conn> ;
+ sdb:storage "column" ; # SAP specific
+.
+<#conn> rdf:type sdb:SDBConnection ;
+ sdb:sdbType "sap" ;
+ sdb:sdbHost "localhost" ;
+ sdb:sdbName "00" ;
+ sdb:driver "com.sap.db.jdbc.Driver" ;
+ .
Modified: jena/trunk/jena-sdb/sdb.ttl
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/sdb.ttl?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/sdb.ttl (original)
+++ jena/trunk/jena-sdb/sdb.ttl Thu Aug 8 21:34:00 2013
@@ -51,4 +51,8 @@ sdb:DatasetStore rdfs:subClassOf ja:RD
## sdb:sdbUser "SDB" ;
## sdb:sdbPassword "password" ;
+## sdb:sdbType "sap" ;
+## sdb:sdbHost "localhost" ;
+## sdb:sdbName "00" ;
+
.
Modified: jena/trunk/jena-sdb/src-dev/java/dbtest/Setup.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src-dev/java/dbtest/Setup.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src-dev/java/dbtest/Setup.java (original)
+++ jena/trunk/jena-sdb/src-dev/java/dbtest/Setup.java Thu Aug 8 21:34:00 2013
@@ -78,6 +78,12 @@ public class Setup
return ;
}
+ if ( dbtype.equalsIgnoreCase("SAP") )
+ {
+ setup_SAP(params) ;
+ return ;
+ }
+
System.err.println("Unknown DB type: "+dbtype) ;
System.exit(2) ;
@@ -170,4 +176,17 @@ public class Setup
// 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 ;
+ }
}
Modified: jena/trunk/jena-sdb/src-dev/java/dbtest/dbsetuptest.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src-dev/java/dbtest/dbsetuptest.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src-dev/java/dbtest/dbsetuptest.java (original)
+++ jena/trunk/jena-sdb/src-dev/java/dbtest/dbsetuptest.java Thu Aug 8 21:34:00 2013
@@ -116,7 +116,7 @@ public class dbsetuptest
{
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") ;
+ 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") ;
Modified: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/StoreDesc.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/StoreDesc.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/StoreDesc.java (original)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/StoreDesc.java Thu Aug 8 21:34:00 2013
@@ -30,6 +30,7 @@ import com.hp.hpl.jena.sparql.util.graph
import com.hp.hpl.jena.sdb.assembler.AssemblerVocab;
import com.hp.hpl.jena.sdb.shared.Env;
import com.hp.hpl.jena.sdb.sql.MySQLEngineType;
+import com.hp.hpl.jena.sdb.sql.SAPStorageType;
import com.hp.hpl.jena.sdb.sql.SDBConnectionDesc;
import com.hp.hpl.jena.sdb.store.DatabaseType;
import com.hp.hpl.jena.sdb.store.FeatureSet;
@@ -48,6 +49,9 @@ public class StoreDesc
/** MySQL specific */
public MySQLEngineType engineType = null ;
+ /** SAP specific */
+ public SAPStorageType storageType = null ;
+
public static StoreDesc read(String filename)
{
Model m = Env.fileManager().loadModel(filename) ;
Modified: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/AssemblerVocab.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/AssemblerVocab.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/AssemblerVocab.java (original)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/AssemblerVocab.java Thu Aug 8 21:34:00 2013
@@ -93,6 +93,9 @@ public class AssemblerVocab
// MySQL engine type
public static final Property pMySQLEngine = Vocab.property(NS, "engine") ;
+ // SAP storage type
+ public static final Property pStorageType = Vocab.property(NS, "storage") ;
+
private static boolean initialized = false ;
static { init() ; }
Modified: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/StoreDescAssembler.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/StoreDescAssembler.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/StoreDescAssembler.java (original)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/assembler/StoreDescAssembler.java Thu Aug 8 21:34:00 2013
@@ -35,6 +35,7 @@ import com.hp.hpl.jena.sdb.SDB;
import com.hp.hpl.jena.sdb.SDBException;
import com.hp.hpl.jena.sdb.StoreDesc;
import com.hp.hpl.jena.sdb.sql.MySQLEngineType;
+import com.hp.hpl.jena.sdb.sql.SAPStorageType;
import com.hp.hpl.jena.sdb.sql.SDBConnectionDesc;
import com.hp.hpl.jena.sdb.store.Feature;
import com.hp.hpl.jena.sdb.store.FeatureSet;
@@ -76,6 +77,12 @@ public class StoreDescAssembler extends
if ( engineName != null )
try { storeDesc.engineType= MySQLEngineType.convert(engineName) ; }
catch (SDBException ex) {}
+
+ // SAP specials
+ String storageType = GraphUtils.getStringValue(root, AssemblerVocab.pStorageType) ;
+ if ( storageType != null )
+ try { storeDesc.storageType= SAPStorageType.convert(storageType) ; }
+ catch (SDBException ex) {}
return storeDesc ;
}
Modified: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/compiler/SDBCompile.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/compiler/SDBCompile.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/compiler/SDBCompile.java (original)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/compiler/SDBCompile.java Thu Aug 8 21:34:00 2013
@@ -18,6 +18,7 @@
package com.hp.hpl.jena.sdb.compiler;
/* H2 contribution from Martin HEIN (m#)/March 2008 */
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
import com.hp.hpl.jena.sdb.SDB;
import com.hp.hpl.jena.sdb.Store;
@@ -116,6 +117,13 @@ public class SDBCompile
request.DistinctTranslation = false ;
}
+ if ( StoreUtils.isSAP(store) )
+ {
+ request.LeftJoinTranslation = true ;
+ request.LimitOffsetTranslation = true ;
+ request.DistinctTranslation = true ;
+ }
+
QueryCompiler queryCompiler = store.getQueryCompilerFactory().createQueryCompiler(request) ;
Op op2 = queryCompiler.compile(op) ;
return op2 ;
Added: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/FormatterSimpleSAP.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/FormatterSimpleSAP.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/FormatterSimpleSAP.java (added)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/FormatterSimpleSAP.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,137 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.layout1;
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
+
+import static com.hp.hpl.jena.sdb.sql.SQLUtils.sqlStr;
+
+import java.sql.SQLException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hp.hpl.jena.sdb.SDBException;
+import com.hp.hpl.jena.sdb.layout2.TablePrefixes;
+import com.hp.hpl.jena.sdb.sql.SAPStorageType;
+import com.hp.hpl.jena.sdb.sql.SDBConnection;
+import com.hp.hpl.jena.sdb.sql.SDBExceptionSQL;
+import com.hp.hpl.jena.sdb.sql.TableUtils;
+
+
+public class FormatterSimpleSAP extends FormatterSimple
+{
+ private static Logger log = LoggerFactory.getLogger(FormatterSimpleSAP.class) ;
+
+ private static final String colDecl = "NVARCHAR("+UriWidth+") NOT NULL" ;
+
+ private SAPStorageType storageType;
+
+ public FormatterSimpleSAP(SDBConnection connection, SAPStorageType storageType)
+ {
+ super(connection) ;
+ this.storageType = storageType;
+ }
+
+ @Override
+ public void truncate()
+ {
+ try {
+ connection().exec("DELETE FROM Triples") ;
+ } catch (SQLException ex)
+ {
+ log.warn("Exception truncating tables") ;
+ throw new SDBException("SQLException truncating tables",ex) ;
+ }
+ }
+
+ @Override
+ public void format()
+ {
+ reformatPrefixesWorker(false) ;
+ reformatDataWorker() ;
+ }
+
+ private void reformatPrefixesWorker() { reformatPrefixesWorker(false) ; }
+ private void reformatPrefixesWorker(boolean loadPrefixes)
+ {
+ try {
+ dropTable("Prefixes") ;
+ connection().exec(sqlStr(
+ "CREATE " + storageType.getStorageName() + " TABLE Prefixes (",
+ " prefix NVARCHAR("+TablePrefixes.prefixColWidth+") NOT NULL ,",
+ " uri NVARCHAR("+TablePrefixes.uriColWidth+") NOT NULL",
+ ")"
+ )) ;
+ connection().exec(sqlStr("ALTER TABLE Prefixes ADD PRIMARY KEY (prefix)")) ;
+ if ( loadPrefixes )
+ {
+ connection().execUpdate("INSERT INTO Prefixes VALUES ('x', 'http://example/')") ;
+ connection().execUpdate("INSERT INTO Prefixes VALUES ('ex', 'http://example.org/')") ;
+ connection().execUpdate("INSERT INTO Prefixes VALUES ('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#')") ;
+ connection().execUpdate("INSERT INTO Prefixes VALUES ('rdfs', 'http://www.w3.org/2000/01/rdf-schema#')") ;
+ connection().execUpdate("INSERT INTO Prefixes VALUES ('xsd', 'http://www.w3.org/2001/XMLSchema#')") ;
+ connection().execUpdate("INSERT INTO Prefixes VALUES ('owl' , 'http://www.w3.org/2002/07/owl#')") ;
+ connection().execUpdate("INSERT INTO Prefixes VALUES ('foaf', 'http://xmlns.com/foaf/0.1/')") ;
+ connection().execUpdate("INSERT INTO Prefixes VALUES ('dc', 'http://purl.org/dc/elements/1.1/')") ;
+ connection().execUpdate("INSERT INTO Prefixes VALUES ('dcterms', 'http://purl.org/dc/terms/')") ;
+ }
+
+ } catch (SQLException ex)
+ {
+ log.warn("Exception resetting table 'Prefixes'") ;
+ throw new SDBException("SQLException resetting table 'Prefixes'",ex) ;
+ }
+ }
+
+ private void reformatDataWorker()
+ {
+
+ try {
+ dropTable("Triples") ;
+ connection().exec(sqlStr(
+ "CREATE " + storageType.getStorageName() + " TABLE Triples",
+ "(",
+ " s "+colDecl+" ,",
+ " p "+colDecl+" ,",
+ " o "+colDecl,
+ ")"
+ )) ;
+ connection().exec(sqlStr("ALTER TABLE Triples ADD PRIMARY KEY (s,p,o)")) ;
+ } catch (SQLException ex)
+ {
+ log.warn("Exception resetting table 'Triples'") ;
+ throw new SDBException("SQLException resetting table 'Triples'",ex) ;
+ }
+ }
+
+ protected void dropTable(String tableName)
+ {
+ TableUtils.dropTable(connection(), tableName) ;
+ }
+
+ @Override
+ public void dropIndexes()
+ {
+ try {
+ connection().exec("DROP INDEX IF EXISTS PredObj") ;
+ connection().exec("DROP INDEX IF EXISTS ObjSubj") ;
+ } catch (SQLException ex)
+ { throw new SDBExceptionSQL("SQLException dropping indexes for table 'Triples'",ex) ; }
+ }
+}
Added: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/StoreSimpleSAP.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/StoreSimpleSAP.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/StoreSimpleSAP.java (added)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout1/StoreSimpleSAP.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,54 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.layout1;
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
+import com.hp.hpl.jena.sdb.StoreDesc;
+import com.hp.hpl.jena.sdb.core.sqlnode.GenerateSQL;
+import com.hp.hpl.jena.sdb.layout2.TableDescTriples;
+import com.hp.hpl.jena.sdb.sql.SAPStorageType;
+import com.hp.hpl.jena.sdb.sql.SDBConnection;
+
+public class StoreSimpleSAP extends StoreBase1
+{
+
+ public StoreSimpleSAP(SDBConnection connection, StoreDesc desc)
+ {
+ this(connection, desc, SAPStorageType.row) ;
+ }
+
+ public StoreSimpleSAP(SDBConnection connection, StoreDesc desc, SAPStorageType storageType)
+ {
+ this(connection, desc, storageType, new TableDescSPO(), new CodecSimple()) ;
+ }
+
+ private StoreSimpleSAP(SDBConnection connection, StoreDesc desc,
+ SAPStorageType storageType,
+ TableDescTriples triples,
+ EncoderDecoder codec)
+ {
+ super(connection, desc,
+ new FormatterSimpleSAP(connection, storageType) ,
+ new TupleLoaderSimple(connection, triples, codec),
+ new QueryCompilerFactory1(codec),
+ new SQLBridgeFactory1(codec),
+ new GenerateSQL(),
+ triples) ;
+
+ }
+}
Added: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/FmtLayout2HashSAP.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/FmtLayout2HashSAP.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/FmtLayout2HashSAP.java (added)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/FmtLayout2HashSAP.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,129 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.layout2.hash;
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
+
+import static com.hp.hpl.jena.sdb.sql.SQLUtils.sqlStr;
+
+import java.sql.SQLException;
+
+import com.hp.hpl.jena.sdb.layout2.FmtLayout2;
+import com.hp.hpl.jena.sdb.layout2.TableDescNodes;
+import com.hp.hpl.jena.sdb.layout2.TableDescQuads;
+import com.hp.hpl.jena.sdb.layout2.TablePrefixes;
+import com.hp.hpl.jena.sdb.layout2.TableDescTriples;
+import com.hp.hpl.jena.sdb.sql.SAPStorageType;
+import com.hp.hpl.jena.sdb.sql.SDBConnection;
+import com.hp.hpl.jena.sdb.sql.SDBExceptionSQL;
+
+
+public class FmtLayout2HashSAP extends FmtLayout2
+{
+ //static private Logger log = LoggerFactory.getLogger(FormatterTriplesNodesSAP.class) ;
+ protected SAPStorageType storageType;
+
+ public FmtLayout2HashSAP(SDBConnection connection, SAPStorageType storageType)
+ {
+ super(connection) ;
+ this.storageType = storageType;
+ }
+
+ @Override
+ protected void formatTableTriples()
+ {
+ String tname = TableDescTriples.name() ;
+ dropTable(tname) ;
+ try {
+ connection().exec(sqlStr(
+ "CREATE " + storageType.getStorageName() + " TABLE "+tname+" (",
+ " s BIGINT NOT NULL,",
+ " p BIGINT NOT NULL,",
+ " o BIGINT NOT NULL",
+ ")"
+ )) ;
+ connection().exec(sqlStr("ALTER TABLE "+tname+" ADD PRIMARY KEY (s, p, o)")) ;
+ } catch (SQLException ex)
+ { throw new SDBExceptionSQL("SQLException formatting table '"+TableDescTriples.name()+"'",ex) ; }
+ }
+
+ @Override
+ protected void formatTableQuads()
+ {
+ String tname = TableDescQuads.name() ;
+ dropTable(tname) ;
+ try {
+ connection().exec(sqlStr(
+ "CREATE " + storageType.getStorageName() + " TABLE "+tname+" (",
+ " g BIGINT NOT NULL,",
+ " s BIGINT NOT NULL,",
+ " p BIGINT NOT NULL,",
+ " o BIGINT NOT NULL",
+ ")"
+ )) ;
+ connection().exec(sqlStr("ALTER TABLE "+tname+" ADD PRIMARY KEY (g, s, p, o)")) ;
+ } catch (SQLException ex)
+ { throw new SDBExceptionSQL("SQLException formatting table '"+TableDescTriples.name()+"'",ex) ; }
+ }
+
+ @Override
+ protected String syntaxDropIndex(String indexName, String table)
+ {
+ return String.format("DROP INDEX IF EXISTS %s", indexName) ;
+ }
+
+ @Override
+ protected void formatTableNodes()
+ {
+ String tname = TableDescNodes.name() ;
+ dropTable(tname) ;
+ try {
+ connection().exec(sqlStr ("CREATE " + storageType.getStorageName() + " TABLE "+tname+" (",
+ " hash BIGINT NOT NULL,",
+ " lex nvarchar(5000) NOT NULL,",
+ " lang nvarchar (10) NOT NULL default '',",
+ " datatype nvarchar("+TableDescNodes.DatatypeUriLength+") NOT NULL default '',",
+ " type integer NOT NULL default '0'",
+ ")"
+ )) ;
+ connection().exec(sqlStr ("ALTER TABLE "+tname+" ADD PRIMARY KEY (hash)")) ;
+ } catch (SQLException ex)
+ {
+ throw new SDBExceptionSQL("SQLException formatting table '"+TableDescNodes.name()+"'",ex) ;
+ }
+ }
+
+ @Override
+ protected void formatTablePrefixes()
+ {
+ String tname = TablePrefixes.name() ;
+ dropTable(tname) ;
+ try {
+ connection().exec(sqlStr(
+ "CREATE " + storageType.getStorageName() + " TABLE "+tname+" (",
+ " prefix NVARCHAR("+TablePrefixes.prefixColWidth+") NOT NULL ,",
+ " uri NVARCHAR("+TablePrefixes.uriColWidth+") NOT NULL",
+ ")"
+ )) ;
+ connection().exec(sqlStr("ALTER TABLE "+tname+" ADD CONSTRAINT "+tname+"_PK PRIMARY KEY (prefix)")) ;
+ } catch (SQLException ex)
+ {
+ throw new SDBExceptionSQL("SQLException resetting table '"+TablePrefixes.name()+"'",ex) ;
+ }
+ }
+}
Added: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/StoreTriplesNodesHashSAP.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/StoreTriplesNodesHashSAP.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/StoreTriplesNodesHashSAP.java (added)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/StoreTriplesNodesHashSAP.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,48 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.layout2.hash;
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
+import com.hp.hpl.jena.sdb.StoreDesc;
+import com.hp.hpl.jena.sdb.core.sqlnode.GenerateSQL;
+import com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes;
+import com.hp.hpl.jena.sdb.layout2.SQLBridgeFactory2;
+import com.hp.hpl.jena.sdb.sql.SAPStorageType;
+import com.hp.hpl.jena.sdb.sql.SDBConnection;
+
+public class StoreTriplesNodesHashSAP extends StoreBaseHash
+{
+ public StoreTriplesNodesHashSAP(SDBConnection connection, StoreDesc desc)
+ {
+ this(connection, desc, null);
+ }
+
+ public StoreTriplesNodesHashSAP(SDBConnection connection, StoreDesc desc, SAPStorageType storageType)
+ {
+ super(connection, desc,
+ new FmtLayout2HashSAP(connection,
+ (storageType!=null)? storageType : SAPStorageType.row),
+ //new LoaderHashSAP(connection),
+ new LoaderTuplesNodes(connection, TupleLoaderHashSAP.class),
+ new QueryCompilerFactoryHash(),
+ new SQLBridgeFactory2(),
+ new GenerateSQL()) ;
+
+ ((LoaderTuplesNodes) this.getLoader()).setStore(this);
+ }
+}
Added: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/TupleLoaderHashSAP.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/TupleLoaderHashSAP.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/TupleLoaderHashSAP.java (added)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/hash/TupleLoaderHashSAP.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,54 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.layout2.hash;
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
+import com.hp.hpl.jena.sdb.layout2.TableDescNodes;
+import com.hp.hpl.jena.sdb.sql.SDBConnection;
+import com.hp.hpl.jena.sdb.store.TableDesc;
+
+public class TupleLoaderHashSAP extends TupleLoaderHashBase {
+
+ public TupleLoaderHashSAP(SDBConnection connection, TableDesc tableDesc,
+ int chunkSize) {
+ super(connection, tableDesc, chunkSize);
+ }
+
+ @Override
+ public String[] getNodeColTypes() {
+ return new String[] {"BIGINT", "NVARCHAR(5000)", "NVARCHAR(10)", "NVARCHAR("+ TableDescNodes.DatatypeUriLength+ ")", "INT"};
+ }
+
+ @Override
+ public String getTupleColType() {
+ return "BIGINT";
+ }
+
+ @Override
+ public String[] getCreateTempTable() {
+ return new String[] { "CREATE GLOBAL TEMPORARY TABLE" , "" };
+ }
+
+ @Override
+ public boolean clearsOnCommit() { return true; }
+
+ @Override
+ public String getLoadNodes() {
+ return super.getLoadNodes();
+ }
+}
Added: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/FmtLayout2IndexSAP.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/FmtLayout2IndexSAP.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/FmtLayout2IndexSAP.java (added)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/FmtLayout2IndexSAP.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,106 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.layout2.index;
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
+import static com.hp.hpl.jena.sdb.sql.SQLUtils.sqlStr;
+
+import java.sql.SQLException;
+
+import com.hp.hpl.jena.sdb.layout2.TableDescNodes;
+import com.hp.hpl.jena.sdb.layout2.TableDescQuads;
+import com.hp.hpl.jena.sdb.layout2.TableDescTriples;
+import com.hp.hpl.jena.sdb.layout2.hash.FmtLayout2HashSAP;
+import com.hp.hpl.jena.sdb.sql.SAPStorageType;
+import com.hp.hpl.jena.sdb.sql.SDBConnection;
+import com.hp.hpl.jena.sdb.sql.SDBExceptionSQL;
+
+
+public class FmtLayout2IndexSAP extends FmtLayout2HashSAP
+{
+ public FmtLayout2IndexSAP(SDBConnection connection, SAPStorageType storageType)
+ {
+ super(connection, storageType) ;
+ }
+
+ @Override
+ protected void formatTableTriples()
+ {
+ dropTable(TableDescTriples.name()) ;
+ try {
+ connection().exec(sqlStr(
+ "CREATE " + storageType.getStorageName() + " TABLE "+TableDescTriples.name()+" (",
+ " s integer NOT NULL,",
+ " p integer NOT NULL,",
+ " o integer NOT NULL",
+ ")"
+ )) ;
+ connection().exec(sqlStr("ALTER TABLE "+TableDescTriples.name()+" ADD PRIMARY KEY (s, p, o)")) ;
+ } catch (SQLException ex)
+ { throw new SDBExceptionSQL("SQLException formatting table '"+TableDescTriples.name()+"'",ex) ; }
+ }
+
+ @Override
+ protected void formatTableQuads()
+ {
+ dropTable(TableDescQuads.name()) ;
+ try {
+ connection().exec(sqlStr(
+ "CREATE " + storageType.getStorageName() + " TABLE "+TableDescQuads.name()+" (",
+ " g integer NOT NULL,",
+ " s integer NOT NULL,",
+ " p integer NOT NULL,",
+ " o integer NOT NULL",
+ ")"
+ )) ;
+ connection().exec(sqlStr("ALTER TABLE "+TableDescQuads.name()+" ADD PRIMARY KEY (g, s, p, o)")) ;
+ } catch (SQLException ex)
+ { throw new SDBExceptionSQL("SQLException formatting table '"+TableDescTriples.name()+"'",ex) ; }
+ }
+
+ @Override
+ protected void formatTableNodes()
+ {
+ dropTable(TableDescNodes.name()) ;
+ try {
+ connection().exec(sqlStr ("CREATE " + storageType.getStorageName() + " TABLE "+TableDescNodes.name()+" (",
+ " id INTEGER NOT NULL,",
+ " hash BIGINT NOT NULL,",
+ " lex nvarchar(5000) NOT NULL,",
+ " lang nvarchar(10) NOT NULL default '',",
+ " datatype nvarchar("+TableDescNodes.DatatypeUriLength+") NOT NULL default '',",
+ " type integer NOT NULL default '0'",
+ ")"
+ )) ;
+ connection().exec(sqlStr ("ALTER TABLE "+TableDescNodes.name()+" ADD PRIMARY KEY (id)")) ;
+
+ // Urgh. How do we find out if a sequence exists?
+ connection().execSilent("DROP SEQUENCE nodeid");
+
+ connection().exec(sqlStr ("CREATE SEQUENCE nodeid",
+ "START WITH 1",
+ "INCREMENT BY 1",
+ "NO CYCLE"
+ ));
+ connection().exec("CREATE UNIQUE INDEX Hash ON " + TableDescNodes.name() + " (hash)");
+ } catch (SQLException ex)
+ {
+ throw new SDBExceptionSQL("SQLException formatting table '"+TableDescNodes.name()+"'",ex) ;
+ }
+ }
+}
Added: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/StoreTriplesNodesIndexSAP.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/StoreTriplesNodesIndexSAP.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/StoreTriplesNodesIndexSAP.java (added)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/StoreTriplesNodesIndexSAP.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,47 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.layout2.index;
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
+import com.hp.hpl.jena.sdb.StoreDesc;
+import com.hp.hpl.jena.sdb.core.sqlnode.GenerateSQL;
+import com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes;
+import com.hp.hpl.jena.sdb.layout2.SQLBridgeFactory2;
+import com.hp.hpl.jena.sdb.sql.SAPStorageType;
+import com.hp.hpl.jena.sdb.sql.SDBConnection;
+
+public class StoreTriplesNodesIndexSAP extends StoreBaseIndex
+{
+ public StoreTriplesNodesIndexSAP(SDBConnection connection, StoreDesc desc)
+ {
+ this(connection, desc, null);
+ }
+
+ public StoreTriplesNodesIndexSAP(SDBConnection connection, StoreDesc desc, SAPStorageType storageType)
+ {
+ super(connection, desc,
+ new FmtLayout2IndexSAP(connection,
+ (storageType!=null)? storageType : SAPStorageType.row),
+ new LoaderTuplesNodes(connection, TupleLoaderIndexSAP.class),
+ new QueryCompilerFactoryIndex(),
+ new SQLBridgeFactory2(),
+ new GenerateSQL()) ;
+
+ ((LoaderTuplesNodes) this.getLoader()).setStore(this);
+ }
+}
Added: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/TupleLoaderIndexSAP.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/TupleLoaderIndexSAP.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/TupleLoaderIndexSAP.java (added)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/layout2/index/TupleLoaderIndexSAP.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,62 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.layout2.index;
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
+import com.hp.hpl.jena.sdb.layout2.TableDescNodes;
+import com.hp.hpl.jena.sdb.sql.SDBConnection;
+import com.hp.hpl.jena.sdb.store.TableDesc;
+
+public class TupleLoaderIndexSAP extends TupleLoaderIndexBase {
+
+ public TupleLoaderIndexSAP(SDBConnection connection, TableDesc tableDesc,
+ int chunkSize) {
+ super(connection, tableDesc, chunkSize);
+ }
+
+ @Override
+ public String[] getNodeColTypes() {
+ return new String[] {"BIGINT", "NVARCHAR(5000)", "NVARCHAR(10)", "NVARCHAR("+ TableDescNodes.DatatypeUriLength+ ")", "INT"};
+ }
+
+ @Override
+ public String getTupleColType() {
+ return "BIGINT";
+ }
+
+ @Override
+ public String[] getCreateTempTable() {
+ return new String[] { "CREATE GLOBAL TEMPORARY TABLE" , "" };
+ }
+
+ @Override
+ public boolean clearsOnCommit() { return true; }
+
+ @Override
+ public String getLoadNodes() {
+ StringBuilder stmt = new StringBuilder();
+ stmt.append("INSERT INTO Nodes \nSELECT nodeid.nextval , "); // Autoindex thingy
+ for (int i = 0; i < getNodeColTypes().length; i++) {
+ if (i != 0) stmt.append(" , ");
+ stmt.append(getNodeLoader()).append(".").append("n").append(i);
+ }
+ stmt.append("\nFROM ").append(getNodeLoader()).append(" LEFT JOIN Nodes ON (");
+ stmt.append(getNodeLoader()).append(".n0=Nodes.hash) \nWHERE Nodes.hash IS NULL");
+ return stmt.toString();
+ }
+}
Modified: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/JDBC.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/JDBC.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/JDBC.java (original)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/JDBC.java Thu Aug 8 21:34:00 2013
@@ -18,6 +18,7 @@
package com.hp.hpl.jena.sdb.sql;
/* H2 contribution from Martin HEIN (m#)/March 2008 */
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
import java.sql.Connection;
import java.sql.DriverManager;
@@ -51,6 +52,7 @@ public class JDBC
driver.put(DatabaseType.SQLServer, "com.microsoft.sqlserver.jdbc.SQLServerDriver") ;
driver.put(DatabaseType.Oracle, "oracle.jdbc.driver.OracleDriver") ;
driver.put(DatabaseType.DB2, "com.ibm.db2.jcc.DB2Driver") ;
+ driver.put(DatabaseType.SAP, "com.sap.db.jdbc.Driver") ;
}
static public String getDriver(DatabaseType dbType) { return driver.get(dbType) ; }
@@ -71,6 +73,8 @@ public class JDBC
static public void loadDriverOracle() { loadDriver(driver.get(DatabaseType.Oracle)); }
/** Explicitly load the DB2 driver */
static public void loadDriverDB2() { loadDriver(driver.get(DatabaseType.DB2)); }
+ /** Explicitly load the SAP driver */
+ static public void loadDriverSAP() { loadDriver(driver.get(DatabaseType.SAP)); }
static public void loadDriver(String className) { loadClass(className) ; }
@@ -194,6 +198,12 @@ public class JDBC
return s;
}
+ if ( type.equals("sap") )
+ {
+ String s = String.format("jdbc:%s://%s:3%s15", type, host, dbName) ;
+ return s ;
+ }
+
if ( type.equals("none") )
return jdbcNone ;
Added: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/SAPStorageType.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/SAPStorageType.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/SAPStorageType.java (added)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/sql/SAPStorageType.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,39 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.sql;
+
+import com.hp.hpl.jena.sdb.SDBException;
+
+public enum SAPStorageType
+{
+ row { @Override public String getStorageName() { return "ROW" ; } } ,
+ column { @Override public String getStorageName() { return "COLUMN" ; } } ,
+ ;
+ abstract public String getStorageName() ;
+
+ public static SAPStorageType convert(String storageName)
+ {
+ if ( check(storageName, row) ) return row ;
+ if ( check(storageName, column) ) return column ;
+ throw new SDBException("Can't turn '"+storageName+"' into a storage type") ;
+ }
+
+ private static boolean check(String storageName, SAPStorageType t)
+ { return storageName.equalsIgnoreCase(t.getStorageName()) ; }
+}
Modified: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/DatabaseType.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/DatabaseType.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/DatabaseType.java (original)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/DatabaseType.java Thu Aug 8 21:34:00 2013
@@ -18,6 +18,7 @@
package com.hp.hpl.jena.sdb.store;
/* H2 contribution from Martin HEIN (m#)/March 2008 */
+/* SAP contribution from Fergal Monaghan (m#)/May 2012 */
import java.util.List;
@@ -39,6 +40,7 @@ public class DatabaseType extends Symbol
public static final DatabaseType SQLServer = new DatabaseType("SQLServer") ;
public static final DatabaseType Oracle = new DatabaseType("Oracle") ;
public static final DatabaseType DB2 = new DatabaseType("DB2") ;
+ public static final DatabaseType SAP = new DatabaseType("sap") ;
static SymbolRegistry<DatabaseType> registry = new SymbolRegistry<DatabaseType>() ;
static { init() ; }
@@ -92,6 +94,8 @@ public class DatabaseType extends Symbol
register(Oracle) ;
register(DB2) ;
+
+ register(SAP);
}
static public List<String> allNames() { return registry.allNames() ; }
Modified: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/StoreFactory.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/StoreFactory.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/StoreFactory.java (original)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/store/StoreFactory.java Thu Aug 8 21:34:00 2013
@@ -199,6 +199,13 @@ public class StoreFactory
public Store create(SDBConnection conn, StoreDesc desc)
{ return new StoreTriplesNodesHashDB2(conn, desc) ; } }) ;
+ /* SAP contribution from Fergal Monaghan (m#)/May 2012 */
+ register(SAP, LayoutTripleNodesHash,
+ new StoreMaker() {
+ @Override
+ public Store create(SDBConnection conn, StoreDesc desc)
+ { return new StoreTriplesNodesHashSAP(conn, desc, desc.storageType) ; } }) ;
+
// -- Index layout
register(Derby, LayoutTripleNodesIndex,
@@ -249,6 +256,13 @@ public class StoreFactory
@Override
public Store create(SDBConnection conn, StoreDesc desc)
{ return new StoreTriplesNodesIndexDB2(conn, desc) ; } }) ;
+
+ register(SAP, LayoutTripleNodesIndex,
+ new StoreMaker() {
+ @Override
+ public Store create(SDBConnection conn, StoreDesc desc)
+ { return new StoreTriplesNodesIndexSAP(conn, desc, desc.storageType) ; } }) ;
+
// -- Simple layout
@@ -300,11 +314,17 @@ public class StoreFactory
@Override
public Store create(SDBConnection conn, StoreDesc desc)
{ return new StoreSimpleDB2(conn, desc) ; } }) ;
+
+ register(SAP, LayoutSimple,
+ new StoreMaker() {
+ @Override
+ public Store create(SDBConnection conn, StoreDesc desc)
+ { return new StoreSimpleSAP(conn, desc, desc.storageType) ; } }) ;
}
static private void checkRegistry()
{
- DatabaseType[] dbTypes = {Derby, HSQLDB, H2, MySQL, PostgreSQL, SQLServer, Oracle} ;
+ DatabaseType[] dbTypes = {Derby, HSQLDB, H2, MySQL, PostgreSQL, SQLServer, Oracle, SAP} ;
LayoutType[] layoutTypes = {LayoutTripleNodesHash, LayoutTripleNodesIndex, LayoutSimple} ;
Set <StoreMaker> seen = new HashSet<StoreMaker>() ;
Modified: jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/util/StoreUtils.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/util/StoreUtils.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/util/StoreUtils.java (original)
+++ jena/trunk/jena-sdb/src/main/java/com/hp/hpl/jena/sdb/util/StoreUtils.java Thu Aug 8 21:34:00 2013
@@ -87,6 +87,11 @@ public class StoreUtils
{
return store.getDatabaseType().equals(DatabaseType.DB2) ;
}
+
+ public static boolean isSAP(Store store)
+ {
+ return store.getDatabaseType().equals(DatabaseType.SAP) ;
+ }
public static void load(Store store, String filename)
{
Modified: jena/trunk/jena-sdb/src/main/java/sdb/cmd/ModStore.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/main/java/sdb/cmd/ModStore.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/main/java/sdb/cmd/ModStore.java (original)
+++ jena/trunk/jena-sdb/src/main/java/sdb/cmd/ModStore.java Thu Aug 8 21:34:00 2013
@@ -34,6 +34,7 @@ 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.MySQLEngineType;
+import com.hp.hpl.jena.sdb.sql.SAPStorageType;
import com.hp.hpl.jena.sdb.sql.SDBConnection;
import com.hp.hpl.jena.sdb.sql.SDBExceptionSQL;
import com.hp.hpl.jena.sdb.store.DatasetStore;
@@ -67,6 +68,7 @@ public class ModStore extends ModBase
protected final ArgDecl argDeclLayout = new ArgDecl(true, "layout");
protected final ArgDecl argDeclMySQLEngine = new ArgDecl(true, "engine");
+ protected final ArgDecl argDeclSAPStorage = new ArgDecl(true, "storage");
// protected String driverName = null; // JDBC class name
@@ -190,6 +192,9 @@ public class ModStore extends ModBase
if (cmdLine.contains(argDeclMySQLEngine))
storeDesc.engineType = MySQLEngineType.convert(cmdLine.getArg(argDeclMySQLEngine).getValue());
+
+ if (cmdLine.contains(argDeclSAPStorage))
+ storeDesc.storageType = SAPStorageType.convert(cmdLine.getArg(argDeclSAPStorage).getValue());
if (cmdLine.contains(argDeclLayout))
{
Modified: jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/SDBModelGraphTestSuite.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/SDBModelGraphTestSuite.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/SDBModelGraphTestSuite.java (original)
+++ jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/SDBModelGraphTestSuite.java Thu Aug 8 21:34:00 2013
@@ -26,9 +26,11 @@ import org.junit.runners.AllTests;
import com.hp.hpl.jena.sdb.test.graph.TestHSQLGraph;
import com.hp.hpl.jena.sdb.test.graph.TestMySQLGraph;
import com.hp.hpl.jena.sdb.test.graph.TestPgSQLGraph;
+import com.hp.hpl.jena.sdb.test.graph.TestSAPGraph;
import com.hp.hpl.jena.sdb.test.model.TestHSQLModel;
import com.hp.hpl.jena.sdb.test.model.TestMySQLModel;
import com.hp.hpl.jena.sdb.test.model.TestPgSQLModel;
+import com.hp.hpl.jena.sdb.test.model.TestSAPModel;
@RunWith(AllTests.class)
public class SDBModelGraphTestSuite extends TestSuite
@@ -36,6 +38,7 @@ public class SDBModelGraphTestSuite exte
static boolean includeMySQL = true ;
static boolean includeHSQL = true ;
static boolean includePGSQL = true ;
+ static boolean includeSAP = true ;
public static junit.framework.Test suite() {
TestSuite ts = new TestSuite();
@@ -59,6 +62,12 @@ public class SDBModelGraphTestSuite exte
ts.addTestSuite(TestPgSQLGraph.TestPgSQLHashGraph.class);
}
+ if ( includeSAP )
+ {
+ ts.addTestSuite(TestSAPModel.TestSAPHashModel.class);
+ ts.addTestSuite(TestSAPGraph.TestSAPHashGraph.class);
+ }
+
return ts;
}
Modified: jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/StoreCreator.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/StoreCreator.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/StoreCreator.java (original)
+++ jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/StoreCreator.java Thu Aug 8 21:34:00 2013
@@ -27,6 +27,7 @@ import com.hp.hpl.jena.sdb.layout2.hash.
import com.hp.hpl.jena.sdb.layout2.hash.StoreTriplesNodesHashMySQL;
import com.hp.hpl.jena.sdb.layout2.hash.StoreTriplesNodesHashOracle;
import com.hp.hpl.jena.sdb.layout2.hash.StoreTriplesNodesHashPGSQL;
+import com.hp.hpl.jena.sdb.layout2.hash.StoreTriplesNodesHashSAP;
import com.hp.hpl.jena.sdb.layout2.hash.StoreTriplesNodesHashSQLServer;
import com.hp.hpl.jena.sdb.layout2.index.StoreTriplesNodesIndexDB2;
import com.hp.hpl.jena.sdb.layout2.index.StoreTriplesNodesIndexDerby;
@@ -34,6 +35,7 @@ import com.hp.hpl.jena.sdb.layout2.index
import com.hp.hpl.jena.sdb.layout2.index.StoreTriplesNodesIndexMySQL;
import com.hp.hpl.jena.sdb.layout2.index.StoreTriplesNodesIndexOracle;
import com.hp.hpl.jena.sdb.layout2.index.StoreTriplesNodesIndexPGSQL;
+import com.hp.hpl.jena.sdb.layout2.index.StoreTriplesNodesIndexSAP;
import com.hp.hpl.jena.sdb.layout2.index.StoreTriplesNodesIndexSQLServer;
import com.hp.hpl.jena.sdb.sql.JDBC;
import com.hp.hpl.jena.sdb.sql.SDBConnection;
@@ -60,6 +62,8 @@ public class StoreCreator {
private static StoreTriplesNodesIndexOracle sdboi;
private static StoreTriplesNodesIndexDB2 sdbdb2i;
private static StoreTriplesNodesHashDB2 sdbdb2h;
+ private static StoreTriplesNodesHashSAP sdbsaph;
+ private static StoreTriplesNodesIndexSAP sdbsapi;
public static Store getIndexMySQL() {
if (sdbmsi == null) {
@@ -313,4 +317,34 @@ public class StoreCreator {
return sdbdb2i;
}
+
+ public static Store getIndexSAP() {
+ if (sdbsapi == null) {
+ JDBC.loadDriverSAP();
+ SDBConnection sdb = SDBFactory.createConnection(
+ "jdbc:sap://localhost/test2-index", "user", "password");
+ StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesIndex, DatabaseType.SAP) ;
+ sdbsapi = new StoreTriplesNodesIndexSAP(sdb, desc);
+ sdbsapi.getTableFormatter().create() ;
+ }
+ else
+ sdbsapi.getTableFormatter().truncate();
+
+ return sdbsapi;
+ }
+
+ public static Store getHashSAP() {
+ if (sdbsaph == null) {
+ JDBC.loadDriverSAP();
+ SDBConnection sdb = SDBFactory.createConnection(
+ "jdbc:sap://localhost/test2-hash", "user", "password");
+ StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesHash, DatabaseType.SAP) ;
+ sdbsaph = new StoreTriplesNodesHashSAP(sdb, desc);
+ sdbsaph.getTableFormatter().create();
+ }
+ else
+ sdbsaph.getTableFormatter().truncate();
+
+ return sdbsaph;
+ }
}
Added: jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/graph/TestSAPGraph.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/graph/TestSAPGraph.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/graph/TestSAPGraph.java (added)
+++ jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/graph/TestSAPGraph.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,92 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.test.graph;
+
+import junit.framework.TestSuite;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.sdb.SDBFactory;
+import com.hp.hpl.jena.sdb.Store;
+import com.hp.hpl.jena.sdb.test.StoreCreator;
+
+public class TestSAPGraph {
+
+ public static junit.framework.Test suite() {
+ TestSuite ts = new TestSuite();
+
+ ts.addTestSuite(TestSAPIndexGraph.class);
+ ts.addTestSuite(TestSAPIndexQuadGraph.class);
+ ts.addTestSuite(TestSAPHashGraph.class);
+ ts.addTestSuite(TestSAPHashQuadGraph.class);
+
+ return ts;
+ }
+
+ public static class TestSAPIndexGraph extends AbstractTestGraphSDB {
+ public TestSAPIndexGraph(String arg0) {
+ super(arg0);
+ }
+
+ @Override
+ public Graph getGraph()
+ {
+ Store store = StoreCreator.getIndexSAP();
+ return SDBFactory.connectDefaultGraph(store);
+ }
+ }
+
+ public static class TestSAPIndexQuadGraph extends AbstractTestGraphSDB {
+ public TestSAPIndexQuadGraph(String arg0) {
+ super(arg0);
+ }
+
+ @Override
+ public Graph getGraph()
+ {
+ Store store = StoreCreator.getIndexSAP();
+ return SDBFactory.connectNamedGraph(store, "http://example.com/graph");
+ }
+ }
+
+ public static class TestSAPHashGraph extends AbstractTestGraphSDB {
+ public TestSAPHashGraph(String arg0) {
+ super(arg0);
+ }
+
+ @Override
+ public Graph getGraph()
+ {
+ Store store = StoreCreator.getHashSAP();
+ return SDBFactory.connectDefaultGraph(store);
+ }
+ }
+
+ public static class TestSAPHashQuadGraph extends AbstractTestGraphSDB {
+ public TestSAPHashQuadGraph(String arg0) {
+ super(arg0);
+ }
+
+ @Override
+ public Graph getGraph()
+ {
+ Store store = StoreCreator.getHashSAP();
+ return SDBFactory.connectNamedGraph(store, "http://example.com/graph");
+ }
+ }
+}
Modified: jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/misc/TestRegistry.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/misc/TestRegistry.java?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/misc/TestRegistry.java (original)
+++ jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/misc/TestRegistry.java Thu Aug 8 21:34:00 2013
@@ -28,7 +28,7 @@ public class TestRegistry
{
String[] databaseNames = { "derby", "HSQLDB",
"MySQL", "PostgreSQL",
- "SQLServer", "Oracle", "DB2" } ;
+ "SQLServer", "Oracle", "DB2", "SAP" } ;
String[] layoutNames = { "layout2/hash" , "layout2",
"layout2/index",
Added: jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/model/TestSAPModel.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/model/TestSAPModel.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/model/TestSAPModel.java (added)
+++ jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/model/TestSAPModel.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,97 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.test.model;
+
+import junit.framework.TestSuite;
+
+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.test.StoreCreator;
+
+public class TestSAPModel {
+
+ public static junit.framework.Test suite() {
+ TestSuite ts = new TestSuite();
+
+ ts.addTestSuite(TestSAPIndexModel.class);
+ ts.addTestSuite(TestSAPIndexQuadModel.class);
+ ts.addTestSuite(TestSAPHashModel.class);
+ ts.addTestSuite(TestSAPHashQuadModel.class);
+
+ return ts;
+ }
+
+ public static class TestSAPIndexModel extends AbstractTestModelSDB {
+
+ public TestSAPIndexModel(String name) {
+ super(name);
+ }
+
+ @Override
+ public Model getModel() {
+ Store store = StoreCreator.getIndexSAP();
+ return SDBFactory.connectDefaultModel(store);
+ }
+
+ }
+
+ public static class TestSAPIndexQuadModel extends AbstractTestModelSDB {
+
+ public TestSAPIndexQuadModel(String name) {
+ super(name);
+ }
+
+ @Override
+ public Model getModel() {
+ Store store = StoreCreator.getIndexSAP();
+ return SDBFactory.connectNamedModel(store, "http://example.com/graph");
+ }
+
+ }
+
+ public static class TestSAPHashModel extends AbstractTestModelSDB {
+
+ public TestSAPHashModel(String name) {
+ super(name);
+ }
+
+ @Override
+ public Model getModel() {
+ Store store = StoreCreator.getHashSAP();
+ return SDBFactory.connectDefaultModel(store);
+ }
+
+ }
+
+ public static class TestSAPHashQuadModel extends AbstractTestModelSDB {
+
+ public TestSAPHashQuadModel(String name) {
+ super(name);
+ }
+
+ @Override
+ public Model getModel() {
+ Store store = StoreCreator.getHashSAP();
+ return SDBFactory.connectNamedModel(store, "http://example.com/graph");
+ }
+
+ }
+
+}
Added: jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPHash.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPHash.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPHash.java (added)
+++ jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPHash.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,37 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.test.update;
+
+import junit.framework.JUnit4TestAdapter;
+
+import com.hp.hpl.jena.sdb.Store;
+import com.hp.hpl.jena.sdb.test.StoreCreator;
+
+public class TestStoreUpdateSAPHash extends TestStoreUpdateBase {
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(TestStoreUpdateSAPHash.class);
+ }
+
+ @Override
+ Store getStore() {
+ return StoreCreator.getHashSAP();
+ }
+
+}
Added: jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPIndex.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPIndex.java?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPIndex.java (added)
+++ jena/trunk/jena-sdb/src/test/java/com/hp/hpl/jena/sdb/test/update/TestStoreUpdateSAPIndex.java Thu Aug 8 21:34:00 2013
@@ -0,0 +1,37 @@
+/*
+ * 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 com.hp.hpl.jena.sdb.test.update;
+
+import junit.framework.JUnit4TestAdapter;
+
+import com.hp.hpl.jena.sdb.Store;
+import com.hp.hpl.jena.sdb.test.StoreCreator;
+
+public class TestStoreUpdateSAPIndex extends TestStoreUpdateBase {
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(TestStoreUpdateSAPIndex.class);
+ }
+
+ @Override
+ Store getStore() {
+ return StoreCreator.getIndexSAP();
+ }
+
+}
Added: jena/trunk/jena-sdb/testing/StoreDesc/sap-hash.ttl
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/testing/StoreDesc/sap-hash.ttl?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/testing/StoreDesc/sap-hash.ttl (added)
+++ jena/trunk/jena-sdb/testing/StoreDesc/sap-hash.ttl Thu Aug 8 21:34:00 2013
@@ -0,0 +1,17 @@
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
+@prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> .
+
+_:c rdf:type sdb:SDBConnection ;
+ sdb:sdbType "sap" ;
+ sdb:sdbHost "localhost" ;
+ sdb:sdbName "00" ;
+# sdb:driver "com.sap.db.jdbc.Driver" ;
+ .
+
+[] rdf:type sdb:Store ;
+ sdb:layout "layout2" ;
+ sdb:connection _:c ;
+ sdb:storage "column" ;
+.
Added: jena/trunk/jena-sdb/testing/StoreDesc/sap-index.ttl
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/testing/StoreDesc/sap-index.ttl?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/testing/StoreDesc/sap-index.ttl (added)
+++ jena/trunk/jena-sdb/testing/StoreDesc/sap-index.ttl Thu Aug 8 21:34:00 2013
@@ -0,0 +1,17 @@
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
+@prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> .
+
+_:c rdf:type sdb:SDBConnection ;
+ sdb:sdbType "sap" ;
+ sdb:sdbHost "localhost" ;
+ sdb:sdbName "00" ;
+# sdb:driver "com.sap.db.jdbc.Driver" ;
+ .
+
+[] rdf:type sdb:Store ;
+ sdb:layout "layout2/index" ;
+ sdb:connection _:c ;
+ sdb:storage "column" ;
+.
Added: jena/trunk/jena-sdb/testing/StoreDescSimple/sap-layout1.ttl
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/testing/StoreDescSimple/sap-layout1.ttl?rev=1512049&view=auto
==============================================================================
--- jena/trunk/jena-sdb/testing/StoreDescSimple/sap-layout1.ttl (added)
+++ jena/trunk/jena-sdb/testing/StoreDescSimple/sap-layout1.ttl Thu Aug 8 21:34:00 2013
@@ -0,0 +1,19 @@
+## Store description for the simple (non-performant) database layout
+
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
+@prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> .
+
+_:c rdf:type sdb:SDBConnection ;
+ sdb:sdbType "sap" ;
+ sdb:sdbHost "localhost" ;
+ sdb:sdbName "00" ;
+# sdb:driver "com.sap.db.jdbc.Driver" ;
+ .
+
+[] rdf:type sdb:Store ;
+ sdb:layout "layout1" ;
+ sdb:connection _:c ;
+ sdb:storage "column" ;
+.
Modified: jena/trunk/jena-sdb/testing/store-list-simple.ttl
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/testing/store-list-simple.ttl?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/testing/store-list-simple.ttl (original)
+++ jena/trunk/jena-sdb/testing/store-list-simple.ttl Thu Aug 8 21:34:00 2013
@@ -34,5 +34,8 @@ _:x rdf:type sdb:StoreList ;
##
## [ rdfs:label "DB2/Simple" ;
## sdb:description <StoreDescSimple/db2-layout1.ttl> ]
+##
+## [ rdfs:label "SAP/Simple" ;
+## sdb:description <StoreDescSimple/sap-layout1.ttl> ]
) .
Modified: jena/trunk/jena-sdb/testing/store-list.ttl
URL: http://svn.apache.org/viewvc/jena/trunk/jena-sdb/testing/store-list.ttl?rev=1512049&r1=1512048&r2=1512049&view=diff
==============================================================================
--- jena/trunk/jena-sdb/testing/store-list.ttl (original)
+++ jena/trunk/jena-sdb/testing/store-list.ttl Thu Aug 8 21:34:00 2013
@@ -59,6 +59,12 @@ _:x rdf:type sdb:StoreList ;
##
## [ rdfs:label "DB2/Index" ;
## sdb:description <StoreDesc/db2-index.ttl> ]
+##
+## [ rdfs:label "SAP/Hash" ;
+## sdb:description <StoreDesc/sap-hash.ttl> ]
+##
+## [ rdfs:label "SAP/Index" ;
+## sdb:description <StoreDesc/sap-index.ttl> ]
) .