Package org.openrdf.sail.rdbms.model

Examples of org.openrdf.sail.rdbms.model.RdbmsValue


  private void assignIds(List<RdbmsValue> values, Map<Long, Number> map)
    throws SQLException, InterruptedException
  {
    while (values.size() < getChunkSize()) {
      RdbmsValue taken = queue.poll();
      if (taken == closeSignal) {
        queue.add(taken);
        break;
      }
      if (taken == null)
        break;
      values.add(taken);
    }
    Map<Long, Number> existing = lookup(values, map);
    Iterator<RdbmsValue> iter = values.iterator();
    while (iter.hasNext()) {
      RdbmsValue value = iter.next();
      Long hash = idseq.hashOf(value);
      if (existing.get(hash) != null) {
        // already in database
        Number id = idseq.idOf(existing.get(hash));
        value.setInternalId(id);
        value.setVersion(getIdVersion(value));
        iter.remove();
      }
      else {
        synchronized (ids) {
          if (ids.containsKey(hash)) {
            // already inserting this value
            Number id = ids.get(hash);
            value.setInternalId(id);
            value.setVersion(getIdVersion(value));
            iter.remove();
          }
          else {
            // new id to be inserted
            Number id = idseq.nextId(value);
            value.setInternalId(id);
            value.setVersion(getIdVersion(value));
            ids.put(hash, id);
            // keep on list for later insert
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.openrdf.sail.rdbms.model.RdbmsValue

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.