/** * Returns the number of relations that match this query * * @return Number of relations that match this query */ public default long count() { return Iterables.size(relations()); }
public Iterable<TitanRelation> executeQuery(TitanVertexQuery query) { switch (this) { case EDGE: return (Iterable)query.edges(); case PROPERTY: return (Iterable)query.properties(); case RELATION: return query.relations(); default: throw new AssertionError(); } }
List<Entry> additions = new ArrayList<>(); for (TitanRelation relation : vertex.query().types(indexRelationTypeName).direction(Direction.OUT).relations()) { InternalRelation titanRelation = (InternalRelation)relation; for (int pos = 0; pos < titanRelation.getArity(); pos++) {
break; case RELATION: result = query.relations(); break; default:
/** * Very simple graph operation to ensure minimal functionality and cleanup */ @Test public void testBasic() { PropertyKey uid = makeVertexIndexedUniqueKey("name", String.class); finishSchema(); TitanVertex n1 = tx.addVertex(); uid = tx.getPropertyKey("name"); n1.property(uid.name(), "abcd"); clopen(); long nid = n1.longId(); uid = tx.getPropertyKey("name"); assertTrue(getV(tx, nid) != null); assertTrue(getV(tx, uid.longId()) != null); assertMissing(tx, nid + 64); uid = tx.getPropertyKey(uid.name()); n1 = getV(tx, nid); assertEquals(n1, getOnlyVertex(tx.query().has(uid.name(), "abcd"))); assertEquals(1, Iterables.size(n1.query().relations())); //TODO: how to expose relations? assertEquals("abcd", n1.value(uid.name())); assertCount(1, tx.query().vertices()); close(); TitanCleanup.clear(graph); open(config); assertEmpty(tx.query().vertices()); }
int numRels = 0; TitanVertex v = getV(txx, vs[vi].longId()); for (TitanRelation r : v.query().relations()) { numRels++; assertEquals(partition, getPartitionID(r));
/** * Returns the number of relations that match this query * * @return Number of relations that match this query */ public default long count() { return Iterables.size(relations()); }
public Iterable<TitanRelation> executeQuery(TitanVertexQuery query) { switch (this) { case EDGE: return (Iterable)query.edges(); case PROPERTY: return (Iterable)query.properties(); case RELATION: return query.relations(); default: throw new AssertionError(); } }
public Iterable<TitanRelation> executeQuery(TitanVertexQuery query) { switch (this) { case EDGE: return (Iterable)query.edges(); case PROPERTY: return (Iterable)query.properties(); case RELATION: return query.relations(); default: throw new AssertionError(); } }
Iterable<TitanRelation> relations = v.query().relations(); Iterator<TitanRelation> relationsIter = relations.iterator(); while (relationsIter.hasNext()) {
Iterable<TitanRelation> relations = ((TitanVertexQuery)tx.getVertex(parentVertex).query()).relations(); Iterator<TitanRelation> relationsIter = relations.iterator(); relations = ((TitanVertexQuery)tx.getVertex(parentVertex2).query()).relations(); Iterator<TitanRelation> relationsIter2 = relations.iterator();
List<Entry> additions = new ArrayList<>(); for (TitanRelation relation : vertex.query().types(indexRelationTypeName).direction(Direction.OUT).relations()) { InternalRelation titanRelation = (InternalRelation)relation; for (int pos = 0; pos < titanRelation.getArity(); pos++) {
assertEquals(knowsOff.length * 2, Iterables.size(n.getTitanEdges(BOTH, knows)), i); assertEquals(connectOff.length + knowsOff.length + 2, Iterables.size(n.query().direction(OUT).relations())); for (TitanEdge r : n.getTitanEdges(OUT, knows)) { TitanVertex n2 = r.getOtherVertex(n);
case PROPERTY: result = query.properties(); break; case EDGE: result = query.edges(); break; case RELATION: result = query.relations(); break; default: throw new AssertionError();
/** * Very simple graph operation to ensure minimal functionality and cleanup */ @Test public void testBasic() { PropertyKey uid = makeVertexIndexedUniqueKey("name",String.class); finishSchema(); TitanVertex n1 = tx.addVertex(); uid = tx.getPropertyKey("name"); n1.addProperty(uid.getName(), "abcd"); clopen(); long nid = n1.getLongId(); uid = tx.getPropertyKey("name"); assertTrue(tx.containsVertex(nid)); assertTrue(tx.containsVertex(uid.getLongId())); assertFalse(tx.containsVertex(nid + 64)); uid = tx.getPropertyKey(uid.getName()); n1 = tx.getVertex(nid); assertEquals(n1,Iterables.getOnlyElement(tx.getVertices(uid, "abcd"))); assertEquals(1, Iterables.size(n1.query().relations())); assertTrue(n1.getProperty(uid).equals("abcd")); assertEquals(1,Iterables.size(tx.getVertices())); close(); TitanCleanup.clear(graph); open(config); assertTrue(Iterables.isEmpty(tx.getVertices())); }
assertEquals(knowsOff.length * 2, Iterables.size(n.getTitanEdges(BOTH, knows)), i); assertEquals(connectOff.length + knowsOff.length + 2, Iterables.size(n.query().direction(OUT).relations())); for (TitanEdge r : n.getTitanEdges(OUT, knows)) { TitanVertex n2 = r.getOtherVertex(n);
int numRels = 0; TitanVertex v = txx.getVertex(vs[vi].getLongId()); for (TitanRelation r : v.query().relations()) { numRels++; assertEquals(partition,getPartitionID(r,idManager));
@Test public void testBasic() { TitanKey weight = makeWeightPropertyKey("weight"); TitanVertex n1 = tx.addVertex(); n1.addProperty(weight, 10.5); clopen(); long nid = n1.getID(); assertTrue(tx.containsVertex(nid)); assertTrue(tx.containsVertex(weight.getID())); assertFalse(tx.containsVertex(nid + 64)); assertFalse(tx.containsVertex(weight.getID() + 64)); assertTrue(tx.containsType("weight")); weight = tx.getPropertyKey("weight"); assertEquals(weight.getDataType(), Double.class); assertEquals(weight.getName(), "weight"); n1 = tx.getVertex(nid); for (TitanProperty prop : n1.getProperties()) { Object o = prop.getValue(); } n1.query().relations(); assertEquals(10.5, n1.getProperty(weight)); }