SmartDataAnalytics / Sparqlify

Sparql -> SQL Rewriter enabling virtual RDB -> RDF mappings
http://aksw.org/Projects/Sparqlify
123 stars 13 forks source link

JdbcSQLException (Table not found) when using test database #17

Closed patrickwestphal closed 11 years ago

patrickwestphal commented 11 years ago

When using the built-in test database, e.g. via

DataSource dataSource = SparqlifyUtils.createTestDatabase();
Connection conn = dataSource.getConnection();

with a view definition lik this

ViewDefinition personView = vdf.create(
    "Prefix ex:<http://ex.org/> " +
    "Create View person As " +
    "Construct { ?s a ex:Person ; ex:name ?t } " +
    "With " +
        "?s = uri(concat('http://ex.org/person/', ?id) " +
        "?t = plainLiteral(?name)" +
    "From person"
);

I got this JdbcSQLException:

Exception in thread "main" java.lang.RuntimeException: org.h2.jdbc.JdbcSQLException: Tabelle "person" nicht gefunden
Table "person" not found; SQL statement:
SELECT * FROM "person" LIMIT 1 [42102-170]
    at org.aksw.sparqlify.config.v0_2.bridge.SchemaProviderImpl.createSchemaForQueryString(SchemaProviderImpl.java:74)
    at org.aksw.sparqlify.config.v0_2.bridge.SchemaProviderImpl.createSchemaForRelationName(SchemaProviderImpl.java:54)
    at org.aksw.sparqlify.config.v0_2.bridge.SyntaxBridge.create(SyntaxBridge.java:115)
    at org.aksw.sparqlify.util.ViewDefinitionFactory.create(ViewDefinitionFactory.java:37)
    at org.aksw.sparqlify.export.r2rml.Run.main(Run.java:53)

I'm sure, the table exists because when I use

ViewDefinition personView = vdf.create(
    "Prefix ex:<http://ex.org/> " +
    "Create View person As " +
    "Construct { ?s a ex:Person ; ex:name ?t } " +
    "With " +
        "?s = uri(concat('http://ex.org/person/', ?id) " +
        "?t = plainLiteral(?name)" +
    "From [[SELECT * FROM person]]"
);

instead, everything works fine.

Aklakan commented 11 years ago

I think this issue is related to a "feature" of H2: Either, you refer to database objects in all upper case or you have to put them into double quotes: TABLE or "table"

I am now using double quotes in all locations - this includes the generated SQL.

yakubbaev commented 6 years ago

@Aklakan did you also add ;DATABASE_TO_UPPER=false?