Search in sources :

Example 31 with SDBException

use of org.apache.jena.sdb.SDBException in project jena by apache.

the class FormatterSimpleH2 method reformatDataWorker.

private void reformatDataWorker() {
    try {
        dropTable("Triples");
        connection().exec(sqlStr("CREATE TABLE Triples", "(", "  s " + colDecl + " ,", "  p " + colDecl + " ,", "  o " + colDecl + " ,", "  PRIMARY KEY (s,p,o)", ")"));
    } catch (SQLException ex) {
        log.warn("Exception resetting table 'Triples'");
        throw new SDBException("SQLException resetting table 'Triples'", ex);
    }
}
Also used : SQLException(java.sql.SQLException) SDBException(org.apache.jena.sdb.SDBException)

Example 32 with SDBException

use of org.apache.jena.sdb.SDBException in project jena by apache.

the class FormatterSimpleH2 method reformatPrefixesWorker.

private void reformatPrefixesWorker(boolean loadPrefixes) {
    try {
        dropTable("Prefixes");
        connection().exec(sqlStr("CREATE TABLE Prefixes (", "    prefix VARCHAR(" + TablePrefixes.prefixColWidth + ") NOT NULL ,", "    uri VARCHAR(" + TablePrefixes.uriColWidth + ") NOT NULL ,", "  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);
    }
}
Also used : SQLException(java.sql.SQLException) SDBException(org.apache.jena.sdb.SDBException)

Example 33 with SDBException

use of org.apache.jena.sdb.SDBException in project jena by apache.

the class FormatterSimpleHSQL method reformatPrefixesWorker.

private void reformatPrefixesWorker(boolean loadPrefixes) {
    try {
        // Assumed to be inside a transaction 
        connection().exec("DROP TABLE IF EXISTS Prefixes");
        connection().exec(sqlStr("CREATE CACHED TABLE Prefixes (", "    prefix VARCHAR  NOT NULL ,", "    uri    VARCHAR  NOT NULL ,", "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);
    }
}
Also used : SQLException(java.sql.SQLException) SDBException(org.apache.jena.sdb.SDBException)

Example 34 with SDBException

use of org.apache.jena.sdb.SDBException in project jena by apache.

the class FormatterSimpleMySQL method reformatDataWorker.

private void reformatDataWorker() {
    try {
        connection().exec("DROP TABLE IF EXISTS Triples");
        connection().exec(sqlStr("CREATE TABLE Triples", "(", "  s " + colDecl + " ,", "  p " + colDecl + " ,", "  o " + colDecl + " ,", "  PRIMARY KEY (s,p,o)", ")", "ENGINE=" + engineType.getEngineName() + " CHARSET=utf8"));
    } catch (SQLException ex) {
        log.warn("Exception resetting table 'Triples'");
        throw new SDBException("SQLException resetting table 'Triples'", ex);
    }
}
Also used : SQLException(java.sql.SQLException) SDBException(org.apache.jena.sdb.SDBException)

Example 35 with SDBException

use of org.apache.jena.sdb.SDBException in project jena by apache.

the class FormatterSimpleOracle method reformatDataWorker.

private void reformatDataWorker() {
    try {
        dropTable("Triples");
        connection().exec(sqlStr("CREATE TABLE Triples", "(", "  s " + colDecl + " ,", "  p " + colDecl + " ,", "  o " + colDecl + " ,", "  PRIMARY KEY (s,p,o)", ")"));
    } catch (SQLException ex) {
        log.warn("Exception resetting table 'Triples'");
        throw new SDBException("SQLException resetting table 'Triples'", ex);
    }
}
Also used : SQLException(java.sql.SQLException) SDBException(org.apache.jena.sdb.SDBException)

Aggregations

SDBException (org.apache.jena.sdb.SDBException)38 SQLException (java.sql.SQLException)30 Resource (org.apache.jena.rdf.model.Resource)2 ActionMatchString (org.apache.jena.sdb.exprmatch.ActionMatchString)2 ActionMatchVar (org.apache.jena.sdb.exprmatch.ActionMatchVar)2 MapResult (org.apache.jena.sdb.exprmatch.MapResult)2 Var (org.apache.jena.sparql.core.Var)2 ResultSet (java.sql.ResultSet)1 TerminationException (jena.cmd.TerminationException)1 StoreDesc (org.apache.jena.sdb.StoreDesc)1 SDBRequest (org.apache.jena.sdb.core.SDBRequest)1 ResultSetJDBC (org.apache.jena.sdb.sql.ResultSetJDBC)1 SDBConnectionDesc (org.apache.jena.sdb.sql.SDBConnectionDesc)1 SDBExceptionSQL (org.apache.jena.sdb.sql.SDBExceptionSQL)1 Feature (org.apache.jena.sdb.store.Feature)1 FeatureSet (org.apache.jena.sdb.store.FeatureSet)1 TupleLoader (org.apache.jena.sdb.store.TupleLoader)1 NotFoundException (org.apache.jena.shared.NotFoundException)1 Op (org.apache.jena.sparql.algebra.Op)1 TransformFilterEquality (org.apache.jena.sparql.algebra.optimize.TransformFilterEquality)1