Package org.openrdf.sail.rdbms.schema

Examples of org.openrdf.sail.rdbms.schema.TripleTable


      return tables.get(OTHER_PRED);
    String tableName = getNewTableName(pred);
    if (tables.size() >= maxTables) {
      tableName = OTHER_TRIPLES_TABLE;
    }
    TripleTable table = factory.createTripleTable(conn, tableName);
    table.setIdSequence(ids);
    if (tables.size() >= maxTables) {
      table.setPredColumnPresent(true);
      initTable(table);
      tables.put(OTHER_PRED, table);
    }
    else {
      initTable(table);
View Full Code Here


    throws SQLException
  {
    Map<Number, TripleTable> tables = new HashMap<Number, TripleTable>();
    Set<String> names = findPredicateTableNames();
    for (String tableName : names) {
      TripleTable table = factory.createTripleTable(conn, tableName);
      table.setIdSequence(ids);
      if (tableName.equalsIgnoreCase(OTHER_TRIPLES_TABLE)) {
        table.setPredColumnPresent(true);
      }
      if (indexingTriples && !table.isIndexed()) {
        table.createIndex();
      }
      table.reload();
      tables.put(key(tableName), table);
    }
    return tables;
  }
View Full Code Here

  void initThread()
    throws SQLException, InterruptedException
  {
    logger.debug("Starting helper thread {}", initThread.getName());
    while (!closed) {
      TripleTable table = null;
      synchronized (queue) {
        if (queue.isEmpty()) {
          queue.wait();
        }
        if (!queue.isEmpty()) {
          table = queue.removeFirst();
        }
      }
      if (table != null) {
        table.initTable();
        table = null;
      }
    }
    logger.debug("Closing helper thread {}", initThread.getName());
  }
View Full Code Here

  public String getCombinedTableName(Number subj, Number obj, Number[] ctxs) throws SQLException {
    String union = " UNION ALL ";
    StringBuilder sb = new StringBuilder(1024);
    sb.append("(");
    for (Number pred : triples.getPredicateIds()) {
      TripleTable predicate;
      try {
        predicate = triples.getPredicateTable(pred);
      }
      catch (SQLException e) {
        throw new AssertionError(e);
      }
      TransactionTable table = findTable(pred);
      if ((table == null || table.isEmpty()) && predicate.isEmpty())
        continue;
      sb.append("SELECT ctx, subj, ");
      if (predicate.isPredColumnPresent()) {
        sb.append(" pred,");
      }
      else {
        sb.append(pred).append(" AS pred,");
      }
      sb.append(" obj,");
      sb.append(" expl");
      sb.append("\nFROM ");
      sb.append(predicate.getNameWhenReady());
      sb.append("\nWHERE 1 ");
     
      if (ctxs != null && ctxs.length > 0) {
        sb.append(" AND ctx IN(");
        for (Number ctx : ctxs) {
          sb.append(ctx);
          sb.append(",");
        }
        sb.delete(sb.length() - 1, sb.length());       
        sb.append(")");
      }
      if (subj != null) {
        sb.append(" AND subj = " + subj);
      }
      if (obj != null) {
        sb.append(" AND obj = " + obj);
      }
      sb.append(union);
      predicate.blockUntilReady();
    }
    if (sb.length() < union.length())
      return getEmptyTableName();
    sb.delete(sb.length() - union.length(), sb.length());
    sb.append(")");
View Full Code Here

      return true;
    return triples.getPredicateTable(id).isPredColumnPresent();
  }

  public ValueTypes getObjTypes(Number pred) {
    TripleTable table = triples.getExistingTable(pred);
    if (table == null)
      return ValueTypes.UNKNOWN;
    return table.getObjTypes();
  }
View Full Code Here

      return ValueTypes.UNKNOWN;
    return table.getObjTypes();
  }

  public ValueTypes getSubjTypes(Number pred) {
    TripleTable table = triples.getExistingTable(pred);
    if (table == null)
      return ValueTypes.RESOURCE;
    return table.getSubjTypes();
  }
View Full Code Here

  public boolean isEmpty()
    throws SQLException
  {
    for (Number pred : triples.getPredicateIds()) {
      TripleTable predicate;
      try {
        predicate = triples.getPredicateTable(pred);
      }
      catch (SQLException e) {
        throw new AssertionError(e);
      }
      TransactionTable table = findTable(pred);
      if (table != null && !table.isEmpty() || !predicate.isEmpty())
        return false;
    }
    return true;
  }
View Full Code Here

    throws SQLException
  {
    synchronized (tables) {
      TransactionTable table = tables.get(pred);
      if (table == null) {
        TripleTable predicate = triples.getPredicateTable(pred);
        Number key = pred;
        if (predicate.isPredColumnPresent()) {
          key = ids.idOf(-1);
          table = tables.get(key);
          if (table != null)
            return table;
        }
View Full Code Here

TOP

Related Classes of org.openrdf.sail.rdbms.schema.TripleTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.