@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 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); } }