本文整理了Java中org.apache.rya.api.domain.RyaStatement.getTimestamp
方法的一些代码示例,展示了RyaStatement.getTimestamp
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RyaStatement.getTimestamp
方法的具体详情如下:
包路径:org.apache.rya.api.domain.RyaStatement
类名称:RyaStatement
方法名:getTimestamp
暂无
代码示例来源:origin: org.apache.rya/rya.export.client
if(statement.getTimestamp() > metadata.getTimestamp().getTime()) {
break;
curTime = statement.getTimestamp();
if(!childStore.containsStatement(statement)) {
statement.setTimestamp(statement.getTimestamp() - timeOffset);
childStore.addStatement(statement);
代码示例来源:origin: apache/incubator-rya
if(statement.getTimestamp() > metadata.getTimestamp().getTime()) {
break;
curTime = statement.getTimestamp();
if(!childStore.containsStatement(statement)) {
statement.setTimestamp(statement.getTimestamp() - timeOffset);
childStore.addStatement(statement);
代码示例来源:origin: org.apache.rya/rya.mapreduce
write(dataOutput, ryaStatement.getColumnVisibility());
write(dataOutput, ryaStatement.getValue());
Long timestamp = ryaStatement.getTimestamp();
boolean b = timestamp != null;
dataOutput.writeBoolean(b);
代码示例来源:origin: apache/incubator-rya
write(dataOutput, ryaStatement.getColumnVisibility());
write(dataOutput, ryaStatement.getValue());
Long timestamp = ryaStatement.getTimestamp();
boolean b = timestamp != null;
dataOutput.writeBoolean(b);
代码示例来源: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: org.apache.rya/rya.indexing
private static List<TripleRow> serializeStatement(final RyaStatement stmt) throws RyaTypeResolverException {
final RyaURI subject = stmt.getSubject();
final RyaURI predicate = stmt.getPredicate();
final RyaType object = stmt.getObject();
final RyaURI context = stmt.getContext();
final Long timestamp = stmt.getTimestamp();
final byte[] columnVisibility = stmt.getColumnVisibility();
final byte[] value = stmt.getValue();
assert subject != null && predicate != null && object != null;
final byte[] cf = (context == null) ? EMPTY_BYTES : context.getData().getBytes(StandardCharsets.UTF_8);
final byte[] subjBytes = subject.getData().getBytes(StandardCharsets.UTF_8);
final byte[] predBytes = predicate.getData().getBytes(StandardCharsets.UTF_8);
final byte[][] objBytes = RyaContext.getInstance().serializeType(object);
return Lists.newArrayList(new TripleRow(subjBytes,
predBytes,
Bytes.concat(cf, DELIM_BYTES,
OBJECT.getBytes(StandardCharsets.UTF_8), DELIM_BYTES,
objBytes[0], objBytes[1]),
timestamp,
columnVisibility,
value),
new TripleRow(objBytes[0],
predBytes,
Bytes.concat(cf, DELIM_BYTES,
SUBJECT.getBytes(StandardCharsets.UTF_8), DELIM_BYTES,
subjBytes, objBytes[1]),
timestamp,
columnVisibility,
value));
}
代码示例来源: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: apache/incubator-rya
private static List<TripleRow> serializeStatement(final RyaStatement stmt) throws RyaTypeResolverException {
final RyaIRI subject = stmt.getSubject();
final RyaIRI predicate = stmt.getPredicate();
final RyaType object = stmt.getObject();
final RyaIRI context = stmt.getContext();
final Long timestamp = stmt.getTimestamp();
final byte[] columnVisibility = stmt.getColumnVisibility();
final byte[] value = stmt.getValue();
assert subject != null && predicate != null && object != null;
final byte[] cf = (context == null) ? EMPTY_BYTES : context.getData().getBytes(StandardCharsets.UTF_8);
final byte[] subjBytes = subject.getData().getBytes(StandardCharsets.UTF_8);
final byte[] predBytes = predicate.getData().getBytes(StandardCharsets.UTF_8);
final byte[][] objBytes = RyaContext.getInstance().serializeType(object);
return Lists.newArrayList(new TripleRow(subjBytes,
predBytes,
Bytes.concat(cf, DELIM_BYTES,
OBJECT.getBytes(StandardCharsets.UTF_8), DELIM_BYTES,
objBytes[0], objBytes[1]),
timestamp,
columnVisibility,
value),
new TripleRow(objBytes[0],
predBytes,
Bytes.concat(cf, DELIM_BYTES,
SUBJECT.getBytes(StandardCharsets.UTF_8), DELIM_BYTES,
subjBytes, objBytes[1]),
timestamp,
columnVisibility,
value));
}
代码示例来源:origin: org.apache.rya/rya.api
final RyaType object = stmt.getObject();
final RyaURI context = stmt.getContext();
final Long timestamp = stmt.getTimestamp();
final byte[] columnVisibility = stmt.getColumnVisibility();
final String qualifer = stmt.getQualifer();
代码示例来源:origin: apache/incubator-rya
final RyaType object = stmt.getObject();
final RyaIRI context = stmt.getContext();
final Long timestamp = stmt.getTimestamp();
final byte[] columnVisibility = stmt.getColumnVisibility();
final String qualifer = stmt.getQualifer();
代码示例来源:origin: apache/incubator-rya
private static RyaStatement updateRyaStatementColumnVisibility(final RyaStatement ryaStatement, final ColumnVisibility newCv) {
final RyaStatement newCvRyaStatement = new RyaStatement(ryaStatement.getSubject(), ryaStatement.getPredicate(), ryaStatement.getObject(), ryaStatement.getContext(), ryaStatement.getQualifer(), newCv.getExpression(), ryaStatement.getValue(), ryaStatement.getTimestamp());
return newCvRyaStatement;
}
代码示例来源:origin: org.apache.rya/rya.api
output.writeString(object.getQualifer());
shouldWrite = object.getTimestamp() != null;
output.writeBoolean(shouldWrite);
if(shouldWrite){
output.writeLong(object.getTimestamp());
代码示例来源:origin: org.apache.rya/mongodb.rya
.append(STATEMENT_METADATA, statement.getMetadata().toString())
.append(DOCUMENT_VISIBILITY, dvObject.get(DOCUMENT_VISIBILITY))
.append(TIMESTAMP, statement.getTimestamp());
return doc;
代码示例来源:origin: apache/incubator-rya
output.writeString(object.getQualifer());
shouldWrite = object.getTimestamp() != null;
output.writeBoolean(shouldWrite);
if(shouldWrite){
output.writeLong(object.getTimestamp());
代码示例来源:origin: apache/incubator-rya
.append(STATEMENT_METADATA, statement.getMetadata().toString())
.append(DOCUMENT_VISIBILITY, dvObject.get(DOCUMENT_VISIBILITY))
.append(TIMESTAMP, statement.getTimestamp());
return doc;
代码示例来源:origin: org.apache.rya/rya.mapreduce
/**
* Comparison method for natural ordering. Compares based on the logical
* triple (the s/p/o/context information in the underlying RyaStatement)
* and then by the metadata contained in the RyaStatement if the triples are
* the same.
* @return Zero if both RyaStatementWritables contain equivalent statements
* or both have null statements; otherwise, an integer whose sign
* corresponds to a consistent ordering.
*/
@Override
public int compareTo(RyaStatementWritable other) {
CompareToBuilder builder = new CompareToBuilder();
RyaStatement rsThis = this.getRyaStatement();
RyaStatement rsOther = other.getRyaStatement(); // should throw NPE if other is null, as per Comparable contract
builder.append(rsThis == null, rsOther == null);
if (rsThis != null && rsOther != null) {
builder.append(rsThis.getSubject(), rsOther.getSubject());
builder.append(rsThis.getPredicate(), rsOther.getPredicate());
builder.append(rsThis.getObject(), rsOther.getObject());
builder.append(rsThis.getContext(), rsOther.getContext());
builder.append(rsThis.getQualifer(), rsOther.getQualifer());
builder.append(rsThis.getColumnVisibility(), rsOther.getColumnVisibility());
builder.append(rsThis.getValue(), rsOther.getValue());
builder.append(rsThis.getTimestamp(), rsOther.getTimestamp());
}
return builder.toComparison();
}
代码示例来源:origin: apache/incubator-rya
/**
* Comparison method for natural ordering. Compares based on the logical
* triple (the s/p/o/context information in the underlying RyaStatement)
* and then by the metadata contained in the RyaStatement if the triples are
* the same.
* @return Zero if both RyaStatementWritables contain equivalent statements
* or both have null statements; otherwise, an integer whose sign
* corresponds to a consistent ordering.
*/
@Override
public int compareTo(RyaStatementWritable other) {
CompareToBuilder builder = new CompareToBuilder();
RyaStatement rsThis = this.getRyaStatement();
RyaStatement rsOther = other.getRyaStatement(); // should throw NPE if other is null, as per Comparable contract
builder.append(rsThis == null, rsOther == null);
if (rsThis != null && rsOther != null) {
builder.append(rsThis.getSubject(), rsOther.getSubject());
builder.append(rsThis.getPredicate(), rsOther.getPredicate());
builder.append(rsThis.getObject(), rsOther.getObject());
builder.append(rsThis.getContext(), rsOther.getContext());
builder.append(rsThis.getQualifer(), rsOther.getQualifer());
builder.append(rsThis.getColumnVisibility(), rsOther.getColumnVisibility());
builder.append(rsThis.getValue(), rsOther.getValue());
builder.append(rsThis.getTimestamp(), rsOther.getTimestamp());
}
return builder.toComparison();
}
代码示例来源: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
@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);
}
内容来源于网络,如有侵权,请联系作者删除!