本文整理了Java中org.apache.rya.api.domain.RyaStatement.<init>
方法的一些代码示例,展示了RyaStatement.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RyaStatement.<init>
方法的具体详情如下:
包路径:org.apache.rya.api.domain.RyaStatement
类名称:RyaStatement
方法名:<init>
暂无
代码示例来源:origin: apache/incubator-rya
@Override
public RyaStatement next() throws RyaDAOException {
Map.Entry<RyaIRI, RyaType> subjObj = keys.nextElement();
return new RyaStatement(subjObj.getKey(), null, subjObj.getValue());
}
代码示例来源:origin: org.apache.rya/rya.api
@Override
public RyaStatement next() throws RyaDAOException {
Map.Entry<RyaURI, RyaType> subjObj = keys.nextElement();
return new RyaStatement(subjObj.getKey(), null, subjObj.getValue());
}
代码示例来源:origin: apache/incubator-rya
/**
* Gets the metadata key from the table.
* @param predicateRyaIri the predicate {@link RyaIRI}.
* @param dao the {@link AccumuloRyaDAO}.
* @return the string value of the object from the metadata key.
* @throws RyaDAOException
*/
private static String getMetadata(final RyaIRI predicateRyaIri, final AccumuloRyaDAO dao) throws RyaDAOException {
final RyaStatement ryaStatement = new RyaStatement(RTS_SUBJECT_RYA, predicateRyaIri, null);
return getMetadata(ryaStatement, dao);
}
代码示例来源:origin: org.apache.rya/rya.api
private boolean batchNext() throws RyaDAOException {
if (!iteration.hasNext()) {
return false;
}
Collection<Map.Entry<RyaStatement, BindingSet>> batchedResults = new ArrayList<Map.Entry<RyaStatement, BindingSet>>();
for (int i = 0; i < batch && iteration.hasNext(); i++) {
batchedResults.add(new RdfCloudTripleStoreUtils.CustomEntry<RyaStatement, BindingSet>(
new RyaStatement(iteration.next(), predObj.getKey(), predObj.getValue()), null));
}
query = ryaQueryEngine.queryWithBindingSet(batchedResults, null);
return query.hasNext();
}
代码示例来源:origin: apache/incubator-rya
private boolean batchNext() throws RyaDAOException {
if (!iteration.hasNext()) {
return false;
}
Collection<Map.Entry<RyaStatement, BindingSet>> batchedResults = new ArrayList<Map.Entry<RyaStatement, BindingSet>>();
for (int i = 0; i < batch && iteration.hasNext(); i++) {
batchedResults.add(new RdfCloudTripleStoreUtils.CustomEntry<RyaStatement, BindingSet>(
new RyaStatement(iteration.next(), predObj.getKey(), predObj.getValue()), null));
}
query = ryaQueryEngine.queryWithBindingSet(batchedResults, null);
return query.hasNext();
}
代码示例来源:origin: apache/incubator-rya
/**
* Creates a copy tool run time {@link RyaStatement} from the specified {@link Date}.
* @param date the copy tool run time {@link Date}.
* @return the {@link RyaStatement} for the copy tool run time.
*/
public static RyaStatement createCopyToolRunTimeRyaStatement(final Date date) {
final Literal literal = VALUE_FACTORY.createLiteral(date != null ? date : DEFAULT_DATE);
final RyaType timeObject = new RyaType(literal.getDatatype(), literal.stringValue());
return new RyaStatement(RTS_SUBJECT_RYA, RTS_COPY_TOOL_RUN_TIME_PREDICATE_RYA, timeObject);
}
代码示例来源:origin: apache/incubator-rya
@Override
public String getVersion() throws RyaDAOException {
String version = null;
final CloseableIteration<RyaStatement, RyaDAOException> versIter = queryEngine.query(new RyaStatement(RTS_SUBJECT_RYA, RTS_VERSION_PREDICATE_RYA, null), conf);
if (versIter.hasNext()) {
version = versIter.next().getObject().getData();
}
versIter.close();
return version;
}
代码示例来源:origin: org.apache.rya/accumulo.rya
@Override
public String getVersion() throws RyaDAOException {
String version = null;
final CloseableIteration<RyaStatement, RyaDAOException> versIter = queryEngine.query(new RyaStatement(RTS_SUBJECT_RYA, RTS_VERSION_PREDICATE_RYA, null), conf);
if (versIter.hasNext()) {
version = versIter.next().getObject().getData();
}
versIter.close();
return version;
}
代码示例来源:origin: apache/incubator-rya
public void testP() throws Exception {
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, uri, null, null, null);
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
new RyaStatement(uri, uri, uri, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
assertContains(entry.getValue(), tripleRow.getRow());
}
代码示例来源:origin: apache/incubator-rya
public void testSp() throws Exception {
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
new RyaStatement(uri, uri, uri, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, uri, null, null, null);
assertContains(entry.getValue(), tripleRow.getRow());
entry = strategy.defineRange(uri, uri2, null, null, null);
assertContainsFalse(entry.getValue(), tripleRow.getRow());
}
代码示例来源:origin: apache/incubator-rya
public void testPoRangeCustomType() throws Exception {
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
new RyaStatement(uri, uri, customType1, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, uri, customTypeRange1, null, null);
assertContains(entry.getValue(), tripleRow.getRow());
entry = strategy.defineRange(null, uri, customTypeRange2, null, null);
assertContainsFalse(entry.getValue(), tripleRow.getRow());
}
代码示例来源:origin: apache/incubator-rya
public void testSpoCustomType() throws Exception {
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
new RyaStatement(uri, uri, customType1, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, uri, customType1, null, null);
assertContains(entry.getValue(), tripleRow.getRow());
entry = strategy.defineRange(uri, uri, customType2, null, null);
assertContainsFalse(entry.getValue(), tripleRow.getRow());
}
代码示例来源:origin: apache/incubator-rya
public void testSpRange() throws Exception {
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
new RyaStatement(uri, uri, uri, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, rangeIRI, null, null, null);
assertContains(entry.getValue(), tripleRow.getRow());
entry = strategy.defineRange(uri, rangeIRI2, null, null, null);
assertContainsFalse(entry.getValue(), tripleRow.getRow());
}
代码示例来源:origin: apache/incubator-rya
public void testPoCustomType() throws Exception {
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
new RyaStatement(uri, uri, customType1, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, uri, customType1, null, null);
assertContains(entry.getValue(), tripleRow.getRow());
entry = strategy.defineRange(null, uri, customType2, null, null);
assertContainsFalse(entry.getValue(), tripleRow.getRow());
}
代码示例来源:origin: apache/incubator-rya
public void testPosRange() throws Exception {
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
new RyaStatement(uri, uri, uri, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(rangeIRI, uri, uri, null, null);
assertContains(entry.getValue(), tripleRow.getRow());
entry = strategy.defineRange(rangeIRI2, uri, uri, null, null);
assertContainsFalse(entry.getValue(), tripleRow.getRow());
}
代码示例来源:origin: apache/incubator-rya
public void testPoRange() throws Exception {
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
new RyaStatement(uri, uri, uri, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, uri, rangeIRI, null, null);
assertContains(entry.getValue(), tripleRow.getRow());
entry = strategy.defineRange(null, uri, rangeIRI2, null, null);
assertContainsFalse(entry.getValue(), tripleRow.getRow());
}
代码示例来源:origin: org.apache.rya/rya.api
public static RyaStatement convertStatement(Statement statement) {
if (statement == null) return null;
Resource subject = statement.getSubject();
URI predicate = statement.getPredicate();
Value object = statement.getObject();
Resource context = statement.getContext();
return new RyaStatement(
convertResource(subject),
convertURI(predicate),
convertValue(object),
convertResource(context));
}
代码示例来源:origin: apache/incubator-rya
public void testHashedTripleRowSerialization() throws Exception {
final RyaIRI subj = new RyaIRI("urn:test#subj");
final RyaIRI pred = new RyaIRI("urn:test#pred");
final RyaType obj = new RyaType("mydata");
final RyaStatement statement = new RyaStatement(subj, pred, obj);
final MockRdfConfiguration config = new MockRdfConfiguration();
config.set(MockRdfConfiguration.CONF_PREFIX_ROW_WITH_HASH, Boolean.TRUE.toString());
final RyaTripleContext instance = RyaTripleContext.getInstance(config);
final Map<TABLE_LAYOUT, TripleRow> map = instance.serializeTriple(statement);
final TripleRow tripleRow = map.get(TABLE_LAYOUT.SPO);
assertEquals(statement, instance.deserializeTriple(TABLE_LAYOUT.SPO, tripleRow));
}
代码示例来源:origin: apache/incubator-rya
public void testTripleRowSerialization() throws Exception {
final RyaIRI subj = new RyaIRI("urn:test#subj");
final RyaIRI pred = new RyaIRI("urn:test#pred");
final RyaType obj = new RyaType("mydata");
final RyaStatement statement = new RyaStatement(subj, pred, obj);
final RyaTripleContext instance = RyaTripleContext.getInstance(new MockRdfConfiguration());
final Map<TABLE_LAYOUT, TripleRow> map = instance.serializeTriple(statement);
final TripleRow tripleRow = map.get(TABLE_LAYOUT.SPO);
assertEquals(statement, instance.deserializeTriple(TABLE_LAYOUT.SPO, tripleRow));
}
代码示例来源:origin: apache/incubator-rya
@Test
public void serializationTestWithLiteral() {
RyaSubGraph bundle = new RyaSubGraph(UUID.randomUUID().toString());
bundle.addStatement(new RyaStatement(new RyaIRI("uri:123"), new RyaIRI("uri:234"), new RyaType(XMLSchema.INTEGER, "345")));
bundle.addStatement(new RyaStatement(new RyaIRI("uri:345"), new RyaIRI("uri:567"), new RyaType(XMLSchema.INTEGER, "789")));
byte[] bundleBytes = serializer.toBytes(bundle);
RyaSubGraph deserializedBundle = serializer.fromBytes(bundleBytes);
assertEquals(bundle, deserializedBundle);
}
内容来源于网络,如有侵权,请联系作者删除!