org.apache.rya.api.domain.RyaStatement.setTimestamp()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.apache.rya.api.domain.RyaStatement.setTimestamp方法的一些代码示例,展示了RyaStatement.setTimestamp的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RyaStatement.setTimestamp方法的具体详情如下:
包路径:org.apache.rya.api.domain.RyaStatement
类名称:RyaStatement
方法名:setTimestamp

RyaStatement.setTimestamp介绍

暂无

代码示例

代码示例来源:origin: org.apache.rya/rya.api

public RyaStatementBuilder setTimestamp(final Long timestamp) {
  ryaStatement.setTimestamp(timestamp);
  return this;
}

代码示例来源:origin: apache/incubator-rya

public RyaStatementBuilder setTimestamp(final Long timestamp) {
  ryaStatement.setTimestamp(timestamp);
  return this;
}

代码示例来源:origin: org.apache.rya/rya.pcj.fluo.app

/**
 * Creates a construct query graph represented as a Set of {@link RyaStatement}s 
 * @param bs - VisiblityBindingSet used to build statement BindingSets
 * @return - Set of RyaStatements that represent a construct query graph.  
 */
public Set<RyaStatement> createGraphFromBindingSet(VisibilityBindingSet bs) {
  Set<RyaStatement> bSets = new HashSet<>();
  long ts = System.currentTimeMillis();
  Map<String, BNode> bNodes = getBNodeMap();
  for(ConstructProjection projection: projections) {
    RyaStatement statement = projection.projectBindingSet(bs, bNodes);
    //ensure that all RyaStatements in graph have the same timestamp
    statement.setTimestamp(ts);
    bSets.add(statement);
  }
  return bSets;
}

代码示例来源:origin: apache/incubator-rya

/**
 * Creates a construct query graph represented as a Set of {@link RyaStatement}s 
 * @param bs - VisibilityBindingSet used to build statement BindingSets
 * @return - Set of RyaStatements that represent a construct query graph.  
 */
public Set<RyaStatement> createGraphFromBindingSet(VisibilityBindingSet bs) {
  Set<RyaStatement> bSets = new HashSet<>();
  long ts = System.currentTimeMillis();
  Map<String, BNode> bNodes = getBNodeMap();
  for(ConstructProjection projection: projections) {
    RyaStatement statement = projection.projectBindingSet(bs, bNodes);
    //ensure that all RyaStatements in graph have the same timestamp
    statement.setTimestamp(ts);
    bSets.add(statement);
  }
  return bSets;
}

代码示例来源:origin: apache/incubator-rya

curTime = statement.getTimestamp();
if(!childStore.containsStatement(statement)) {
  statement.setTimestamp(statement.getTimestamp() - timeOffset);
  childStore.addStatement(statement);

代码示例来源:origin: org.apache.rya/rya.export.client

curTime = statement.getTimestamp();
if(!childStore.containsStatement(statement)) {
  statement.setTimestamp(statement.getTimestamp() - timeOffset);
  childStore.addStatement(statement);

代码示例来源:origin: org.apache.rya/rya.mapreduce

/**
   * Loads a RyaStatementWritable by reading data from an input stream.
   * Creates a new RyaStatement and assigns it to this RyaStatementWritable.
   * @param   dataInput   An stream containing serialized statement data.
   */
  @Override
  public void readFields(DataInput dataInput) throws IOException {
    byte[] row = read(dataInput);
    byte[] columnFamily = read(dataInput);
    byte[] columnQualifier = read(dataInput);
    byte[] columnVisibility = read(dataInput);
    byte[] value = read(dataInput);
    boolean b = dataInput.readBoolean();
    Long timestamp = null;
    if (b) {
      timestamp = dataInput.readLong();
    }
    try {
      ryaStatement = ryaContext.deserializeTriple(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO,
          new TripleRow(row, columnFamily, columnQualifier));
      ryaStatement.setColumnVisibility(columnVisibility);
      ryaStatement.setValue(value);
      ryaStatement.setTimestamp(timestamp);
    } catch (TripleRowResolverException e) {
      throw new IOException(e);
    }
  }
}

代码示例来源:origin: apache/incubator-rya

/**
   * Loads a RyaStatementWritable by reading data from an input stream.
   * Creates a new RyaStatement and assigns it to this RyaStatementWritable.
   * @param   dataInput   An stream containing serialized statement data.
   */
  @Override
  public void readFields(DataInput dataInput) throws IOException {
    byte[] row = read(dataInput);
    byte[] columnFamily = read(dataInput);
    byte[] columnQualifier = read(dataInput);
    byte[] columnVisibility = read(dataInput);
    byte[] value = read(dataInput);
    boolean b = dataInput.readBoolean();
    Long timestamp = null;
    if (b) {
      timestamp = dataInput.readLong();
    }
    try {
      ryaStatement = ryaContext.deserializeTriple(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO,
          new TripleRow(row, columnFamily, columnQualifier));
      ryaStatement.setColumnVisibility(columnVisibility);
      ryaStatement.setValue(value);
      ryaStatement.setTimestamp(timestamp);
    } catch (TripleRowResolverException e) {
      throw new IOException(e);
    }
  }
}

代码示例来源:origin: org.apache.rya/rya.export.accumulo

@Override
public void addStatement(final RyaStatement statement) throws AddStatementException {
  try {
    accumuloRyaDao.add(statement);
    accumuloRyaDao.flush();
    //This is a hack since a statement re-added with the same timestamp won't reappear since its been marked for deletion.
    //RYA-197 is the ticket for fixing this hack.
    if(!containsStatement(statement)) {
      statement.setTimestamp(statement.getTimestamp() + 1L);
      accumuloRyaDao.add(statement);
    }
  } catch (final RyaDAOException | ContainsStatementException e) {
    throw new AddStatementException("Unable to add the Rya Statement", e);
  }
}

代码示例来源:origin: apache/incubator-rya

@Override
public void addStatement(final RyaStatement statement) throws AddStatementException {
  try {
    accumuloRyaDao.add(statement);
    accumuloRyaDao.flush();
    //This is a hack since a statement re-added with the same timestamp won't reappear since its been marked for deletion.
    //RYA-197 is the ticket for fixing this hack.
    if(!containsStatement(statement)) {
      statement.setTimestamp(statement.getTimestamp() + 1L);
      accumuloRyaDao.add(statement);
    }
  } catch (final RyaDAOException | ContainsStatementException e) {
    throw new AddStatementException("Unable to add the Rya Statement", e);
  }
}

代码示例来源:origin: org.apache.rya/mongodb.rya

statement.setTimestamp(timestamp);

代码示例来源:origin: apache/incubator-rya

@Test
  public void testDeSerializeStatementToDBO() throws RyaDAOException, MongoException, IOException {
    RyaStatement statement = storageStrategy.deserializeDBObject(testDBO);
    /*
     * Since RyaStatement creates a timestamp using JVM time if the timestamp is null, we want to re-null it
     * for this test.  Timestamp is created at insert time by the Server, this test
     * can be found in the RyaDAO.
     */
    statement.setTimestamp(null);
    assertEquals(testStatement, statement);

    statement = storageStrategy.deserializeDBObject(testDBO2);
    /*
     * Since RyaStatement creates a timestamp using JVM time if the timestamp is null, we want to re-null it
     * for this test.  Timestamp is created at insert time by the Server, this test
     * can be found in the RyaDAO.
     */
    statement.setTimestamp(null);
    assertEquals(testStatement2, statement);
  }
}

代码示例来源:origin: apache/incubator-rya

statement.setTimestamp(timestamp);

代码示例来源:origin: apache/incubator-rya

@Test
public void testConstructProjectionProjectSubj() throws MalformedQueryException, UnsupportedEncodingException {
  String query = "select ?x where { ?x <uri:talksTo> <uri:Bob> }";
  
  SPARQLParser parser = new SPARQLParser();
  ParsedQuery pq = parser.parseQuery(query, null);
  List<StatementPattern> patterns = StatementPatternCollector.process(pq.getTupleExpr());
  ConstructProjection projection = new ConstructProjection(patterns.get(0));
  
  QueryBindingSet bs = new QueryBindingSet();
  bs.addBinding("x", VF.createIRI("uri:Joe"));
  VisibilityBindingSet vBs = new VisibilityBindingSet(bs, "FOUO");
  RyaStatement statement = projection.projectBindingSet(vBs, new HashMap<>());
  
  RyaStatement expected = new RyaStatement(new RyaIRI("uri:Joe"), new RyaIRI("uri:talksTo"), new RyaIRI("uri:Bob"));
  expected.setColumnVisibility("FOUO".getBytes("UTF-8"));
  expected.setTimestamp(statement.getTimestamp());
  
  assertEquals(expected, statement);
}

代码示例来源:origin: apache/incubator-rya

@Test
public void testConstructProjectionBNodes() throws MalformedQueryException {
  String query = "select ?o where { _:b <uri:talksTo> ?o }";
  
  SPARQLParser parser = new SPARQLParser();
  ParsedQuery pq = parser.parseQuery(query, null);
  List<StatementPattern> patterns = StatementPatternCollector.process(pq.getTupleExpr());
  ConstructProjection projection = new ConstructProjection(patterns.get(0));
  
  QueryBindingSet bs = new QueryBindingSet();
  bs.addBinding("o", VF.createIRI("uri:Bob"));
  VisibilityBindingSet vBs = new VisibilityBindingSet(bs);
  BNode bNode = VF.createBNode();
  Map<String, BNode> bNodeMap = new HashMap<>();
  bNodeMap.put(VarNameUtils.prependAnonymous("1"), bNode);
  RyaStatement statement = projection.projectBindingSet(vBs,bNodeMap);
  
  RyaStatement expected = new RyaStatement(RdfToRyaConversions.convertResource(bNode), new RyaIRI("uri:talksTo"), new RyaIRI("uri:Bob"));
  expected.setTimestamp(statement.getTimestamp());
  expected.setColumnVisibility(new byte[0]);
  
  assertEquals(expected, statement);
}

代码示例来源:origin: apache/incubator-rya

statement.setTimestamp(input.readLong());

代码示例来源:origin: org.apache.rya/rya.api

statement.setTimestamp(input.readLong());

代码示例来源:origin: apache/incubator-rya

@Test
public void testConstructProjectionProjPred() throws MalformedQueryException {
  String query = "select ?p where { <uri:Joe> ?p <uri:Bob> }";
  
  SPARQLParser parser = new SPARQLParser();
  ParsedQuery pq = parser.parseQuery(query, null);
  List<StatementPattern> patterns = StatementPatternCollector.process(pq.getTupleExpr());
  ConstructProjection projection = new ConstructProjection(patterns.get(0));
  
  QueryBindingSet bs = new QueryBindingSet();
  bs.addBinding("p", VF.createIRI("uri:worksWith"));
  VisibilityBindingSet vBs = new VisibilityBindingSet(bs);
  RyaStatement statement = projection.projectBindingSet(vBs, new HashMap<>());
  
  RyaStatement expected = new RyaStatement(new RyaIRI("uri:Joe"), new RyaIRI("uri:worksWith"), new RyaIRI("uri:Bob"));
  expected.setTimestamp(statement.getTimestamp());
  expected.setColumnVisibility(new byte[0]);
  
  assertEquals(expected, statement);
}

相关文章