本文整理汇总了Java中com.buschmais.xo.api.Query.Result类的典型用法代码示例。如果您正苦于以下问题:Java Result类的具体用法?Java Result怎么用?Java Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Result类属于com.buschmais.xo.api.Query包,在下文中一共展示了Result类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reset
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Override
public void reset() {
LOGGER.info("Resetting store.");
long nodes;
long relations;
long totalNodes = 0;
long totalRelations = 0;
Map<String, Object> params = new HashMap<>();
params.put("limit", BATCH_LIMIT);
do {
beginTransaction();
Result.CompositeRowObject result = executeQuery(
"MATCH (n) OPTIONAL MATCH (n)-[r]-() WITH n, count(r) as rels LIMIT {limit} DETACH DELETE n RETURN count(n) as nodes, sum(rels) as relations",
params).getSingleResult();
nodes = result.get("nodes", Long.class);
relations = result.get("relations", Long.class);
commitTransaction();
totalNodes += nodes;
totalRelations += relations;
} while (nodes == BATCH_LIMIT);
LOGGER.info("Reset finished (removed " + totalNodes + " nodes, " + totalRelations + " relations).");
}
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:23,代码来源:AbstractGraphStore.java
示例2: getUsers
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Override
public Set<User> getUsers() {
xoManager.currentTransaction().begin();
try {
Set<User> users = new LinkedHashSet<>();
Result<UserVertex> results = xoManager
.createQuery("g.V().hasLabel('" + UserVertex.NAME + "')", UserVertex.class).execute();
for (UserVertex userVertex : results) {
RoleVertex roleVertex = userVertex.getRole();
Role role = new Role(roleVertex.getId(), roleVertex.getName());
User user = new User(new EmailAddress(userVertex.getEmail()), userVertex.getName(), role);
users.add(user);
}
return users;
} finally {
xoManager.currentTransaction().rollback();
}
}
开发者ID:PureSolTechnologies,项目名称:Purifinity,代码行数:19,代码来源:AccountManagerBean.java
示例3: findSkywalkerFamily
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void findSkywalkerFamily() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Query<Person> query = xoManager
.createQuery("g.V().has('" + StarWarsGraph.LAST_NAME_PROPERTY + "', 'Skywalker')", Person.class);
assertNotNull(query);
Result<Person> results = query.execute();
assertNotNull(results);
int count = 0;
for (Person person : results) {
count++;
assertEquals("Skywalker", person.getLastName());
}
assertEquals(1, count);
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:22,代码来源:GremlinIT.java
示例4: gremlinStringQuery
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void gremlinStringQuery() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<CompositeRowObject> result = xoManager.createQuery("g.V().hasLabel('A').has('value', {value})")
.withParameter("value", "A1").execute();
A a = result.getSingleResult().get("unknown", A.class);
assertThat(a.getValue(), equalTo("A1"));
result = xoManager.createQuery("g.V().hasLabel('A').has('value', {value})").withParameter("value", "A2")
.execute();
try {
result.getSingleResult().get("a", A.class);
fail("Expecting a " + XOException.class.getName());
} catch (XOException e) {
}
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:18,代码来源:QueryIT.java
示例5: compositeRowTypedQuery
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void compositeRowTypedQuery() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<InstanceByValue> result = xoManager.createQuery(InstanceByValue.class).withParameter("value", "A1")
.execute();
A a = result.getSingleResult().getA();
assertThat(a.getValue(), equalTo("A1"));
result = xoManager.createQuery(InstanceByValue.class).withParameter("value", "A2").execute();
try {
result.getSingleResult().getA();
fail("Expecting a " + XOException.class.getName());
} catch (XOException e) {
}
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:17,代码来源:QueryIT.java
示例6: testRelations
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
@Ignore("Queries are not implemented, yet.")
public void testRelations() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Query<Person> query = xoManager.createQuery("g.V().has('lastName', 'Skywalker').has('firstName','Luke')",
Person.class);
Result<Person> result = query.execute();
Person lukeSkywalker = result.getSingleResult();
assertEquals("Luke", lukeSkywalker.getFirstName());
assertEquals("Skywalker", lukeSkywalker.getLastName());
Person anakinSkywalker = lukeSkywalker.getFather();
assertNotNull(anakinSkywalker);
assertEquals("Anakin", anakinSkywalker.getFirstName());
assertEquals("Skywalker", anakinSkywalker.getLastName());
Person leaSkywalker = lukeSkywalker.getMother();
assertNotNull(leaSkywalker);
assertEquals("Padme", leaSkywalker.getFirstName());
assertEquals("Skywalker", leaSkywalker.getLastName());
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:26,代码来源:QueryIT.java
示例7: findSkywalkerFamily
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void findSkywalkerFamily() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Query<Person> query = xoManager.createQuery(
"_().has('lastName', 'Skywalker')", Person.class);
assertNotNull(query);
Result<Person> results = query.execute();
assertNotNull(results);
int count = 0;
for (Person person : results) {
count++;
assertEquals("Skywalker", person.getLastName());
}
assertEquals(4, count);
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:extended-objects-titan,代码行数:22,代码来源:GremlinIT.java
示例8: gremlinStringQuery
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void gremlinStringQuery() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<CompositeRowObject> result = xoManager
.createQuery(
"_().has('_xo_discriminator_A').has('value', {value})")
.withParameter("value", "A1").execute();
A a = result.getSingleResult().get("unknown", A.class);
assertThat(a.getValue(), equalTo("A1"));
result = xoManager
.createQuery(
"_().has('_xo_discriminator_A').has('value', {value})")
.withParameter("value", "A2").execute();
try {
result.getSingleResult().get("a", A.class);
fail("Expecting a " + XOException.class.getName());
} catch (XOException e) {
}
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:extended-objects-titan,代码行数:22,代码来源:QueryIT.java
示例9: compositeRowTypedQuery
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void compositeRowTypedQuery() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<InstanceByValue> result = xoManager
.createQuery(InstanceByValue.class)
.withParameter("value", "A1").execute();
A a = result.getSingleResult().getA();
assertThat(a.getValue(), equalTo("A1"));
result = xoManager.createQuery(InstanceByValue.class)
.withParameter("value", "A2").execute();
try {
result.getSingleResult().getA();
fail("Expecting a " + XOException.class.getName());
} catch (XOException e) {
}
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:extended-objects-titan,代码行数:19,代码来源:QueryIT.java
示例10: testRelations
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void testRelations() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Query<Person> query = xoManager.createQuery(
"_().has('lastName', 'Skywalker').has('firstName','Luke')",
Person.class);
Result<Person> result = query.execute();
Person lukeSkywalker = result.getSingleResult();
assertEquals("Luke", lukeSkywalker.getFirstName());
assertEquals("Skywalker", lukeSkywalker.getLastName());
Person anakinSkywalker = lukeSkywalker.getFather();
assertNotNull(anakinSkywalker);
assertEquals("Anakin", anakinSkywalker.getFirstName());
assertEquals("Skywalker", anakinSkywalker.getLastName());
Person leaSkywalker = lukeSkywalker.getMother();
assertNotNull(leaSkywalker);
assertEquals("Padme", leaSkywalker.getFirstName());
assertEquals("Skywalker", leaSkywalker.getLastName());
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:extended-objects-titan,代码行数:26,代码来源:QueryIT.java
示例11: relation
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void relation() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
A a = xoManager.create(A.class);
B b = xoManager.create(B.class);
xoManager.create(a, A2B.class, b);
Query<A2B> query = xoManager.createQuery("_().has('"
+ TitanStoreSession.XO_DISCRIMINATORS_PROPERTY + "A').outE",
A2B.class);
Result<A2B> result = query.execute();
A2B a2b = result.getSingleResult();
CompositeObject composite = (CompositeObject) a2b;
Edge edge = composite.getDelegate();
assertThat(edge.getLabel(), equalTo("RELATION"));
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:extended-objects-titan,代码行数:18,代码来源:DelegateIT.java
示例12: getRoles
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Override
public Set<Role> getRoles() {
xoManager.currentTransaction().begin();
try {
Set<Role> roles = new LinkedHashSet<>();
Result<RoleVertex> results = xoManager
.createQuery("g.V().hasLabel('" + RoleVertex.NAME + "')", RoleVertex.class).execute();
for (RoleVertex roleVertex : results) {
roles.add(new Role(roleVertex.getId(), roleVertex.getName()));
}
return roles;
} finally {
xoManager.currentTransaction().rollback();
}
}
开发者ID:PureSolTechnologies,项目名称:Purifinity,代码行数:16,代码来源:AccountManagerBean.java
示例13: resultUsingExplicitQuery
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void resultUsingExplicitQuery() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<E2F.ByValue> byValue = e2f1.getResultByValueUsingExplicitQuery("E2F1");
assertThat(byValue.getSingleResult().getF(), equalTo(f1));
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:9,代码来源:RelationResultOfIT.java
示例14: resultUsingReturnType
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void resultUsingReturnType() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<E2F.ByValue> byValue = e2f1.getResultByValueUsingReturnType("E2F1");
assertThat(byValue.getSingleResult().getF(), equalTo(f1));
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:9,代码来源:RelationResultOfIT.java
示例15: resultUsingGremlin
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void resultUsingGremlin() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<F> result = e2f1.getResultUsingGremlin("E2F1");
assertThat(result, hasItems(equalTo(f1)));
result = e2f1.getResultUsingGremlin("unknownF");
assertThat(result.iterator().hasNext(), equalTo(false));
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:11,代码来源:RelationResultOfIT.java
示例16: resultUsingExplicitQuery
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void resultUsingExplicitQuery() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<E.ByValue> byValue = e.getResultByValueUsingExplicitQuery("F1");
assertThat(byValue.getSingleResult().getF(), equalTo(f1));
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:9,代码来源:EntityResultOfIT.java
示例17: resultUsingReturnType
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void resultUsingReturnType() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<E.ByValue> byValue = e.getResultByValueUsingReturnType("F1");
assertThat(byValue.getSingleResult().getF(), equalTo(f1));
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:9,代码来源:EntityResultOfIT.java
示例18: resultUsingGremlin
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void resultUsingGremlin() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<F> result = e.getResultUsingGremlin("F1");
assertThat(result, hasItems(equalTo(f1)));
result = e.getResultUsingGremlin("unknownF");
assertThat(result.iterator().hasNext(), equalTo(false));
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:11,代码来源:EntityResultOfIT.java
示例19: gremlinWithPrimitiveReturnType
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void gremlinWithPrimitiveReturnType() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<String> result = xoManager.createQuery("g.V().hasLabel('A').values('value')", String.class).execute();
assertThat(result.getSingleResult(), equalTo("A"));
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:9,代码来源:QueryReturnTypesIT.java
示例20: gremlinWithEntityReturnType
import com.buschmais.xo.api.Query.Result; //导入依赖的package包/类
@Test
public void gremlinWithEntityReturnType() {
XOManager xoManager = getXOManager();
xoManager.currentTransaction().begin();
Result<A> result = xoManager.createQuery("g.V().hasLabel('A')", A.class).execute();
assertThat(result.getSingleResult(), equalTo(a));
xoManager.currentTransaction().commit();
}
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:9,代码来源:QueryReturnTypesIT.java
注:本文中的com.buschmais.xo.api.Query.Result类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论