@Override public GraphCollection query(String query, String constructionPattern, GraphStatistics graphStatistics) { return query(query, constructionPattern, true, MatchStrategy.HOMOMORPHISM, MatchStrategy.ISOMORPHISM, graphStatistics); }
@Override public GraphCollection query(String query, boolean attachData, MatchStrategy vertexStrategy, MatchStrategy edgeStrategy, GraphStatistics graphStatistics) { return query(query, null, attachData, vertexStrategy, edgeStrategy, graphStatistics); }
/** * {@inheritDoc} */ @Override public GraphCollection query(String query, GraphStatistics graphStatistics) { return query(query, true, MatchStrategy.HOMOMORPHISM, MatchStrategy.ISOMORPHISM, graphStatistics); }
/** * {@inheritDoc} */ @Override public GraphCollection query(String query, String constructionPattern, GraphStatistics graphStatistics) { return query(query, constructionPattern, true, MatchStrategy.HOMOMORPHISM, MatchStrategy.ISOMORPHISM, graphStatistics); }
/** * {@inheritDoc} */ @Override public GraphCollection query(String query, boolean attachData, MatchStrategy vertexStrategy, MatchStrategy edgeStrategy, GraphStatistics graphStatistics) { return query(query, null, attachData, vertexStrategy, edgeStrategy, graphStatistics); }
@Override public GraphCollection query(String query, GraphStatistics graphStatistics) { return query(query, true, MatchStrategy.HOMOMORPHISM, MatchStrategy.ISOMORPHISM, graphStatistics); }
/** * {@inheritDoc} */ @Override public GraphCollection query(String query) { return query(query, new GraphStatistics(1, 1, 1, 1)); }
/** * {@inheritDoc} */ @Override public GraphCollection query(String query, String constructionPattern) { return query(query, constructionPattern, new GraphStatistics(1, 1, 1, 1)); }
@Override public GraphCollection query(String query) { return query(query, new GraphStatistics(1, 1, 1, 1)); }
@Override public GraphCollection query(String query, String constructionPattern) { return query(query, constructionPattern, new GraphStatistics(1, 1, 1, 1)); }
GraphCollection matches = socialNetwork.query( "MATCH (u1:Person)<-[:hasModerator]-(f:Forum)" + "(u2:Person)<-[:hasMember]-(f)" +
@Test public void testEdgeConstructionReducedPattern() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); LogicalGraph dbGraph = loader.getLogicalGraph(); loader.appendToDatabaseFromString("expected0[" + "(alice)-[:possible_friend]->(carol)" + "]," + "expected1[" + "(bob)-[:possible_friend]->(dave)" + "]"); GraphCollection result = dbGraph.query( "MATCH (a:Person)-[:knows]->(b:Person)-[:knows]->(c:Person) " + "WHERE a.city = 'Leipzig' AND a <> c", "(a)-[e_new:possible_friend]->(c)"); GraphCollection expectedCollection = loader .getGraphCollectionByVariables("expected0", "expected1"); collectAndAssertTrue(result.equalsByGraphElementData(expectedCollection)); }
@Test public void testEdgeConstructionExtendedPattern() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); LogicalGraph dbGraph = loader.getLogicalGraph(); loader.appendToDatabaseFromString("expected0[" + "(alice)-[:possible_friend]->(:possible_person)-[:possible_friend]->(carol)" + "]," + "expected1[" + "(bob)-[:possible_friend]->(:possible_person)-[:possible_friend]->(dave)" + "]"); GraphCollection result = dbGraph.query( "MATCH (a:Person)-[:knows]->(b:Person)-[:knows]->(c:Person) " + "WHERE a.city = 'Leipzig' AND a <> c", "(a)-[e_new:possible_friend]->(v_new:possible_person)-[e_new2:possible_friend]->(c)"); GraphCollection expectedCollection = loader .getGraphCollectionByVariables("expected0", "expected1"); collectAndAssertTrue(result.equalsByGraphElementData(expectedCollection)); } }
@Test public void testEdgeConstruction() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); LogicalGraph dbGraph = loader.getLogicalGraph(); loader.appendToDatabaseFromString("expected0[" + "(alice)-[akb]->(bob)-[bkc]->(carol)," + "(alice)-[:possible_friend]->(carol)" + "]," + "expected1[" + "(bob)-[bkc]->(carol)-[ckd]->(dave)," + "(bob)-[:possible_friend]->(dave)" + "]"); GraphCollection result = dbGraph.query( "MATCH (a:Person)-[e0:knows]->(b:Person)-[e1:knows]->(c:Person) " + "WHERE a.city = 'Leipzig' AND a <> c", "(b)<-[e0]-(a)-[e_new:possible_friend]->(c)<-[e1]-(b)"); GraphCollection expectedCollection = loader .getGraphCollectionByVariables("expected0", "expected1"); collectAndAssertTrue(result.equalsByGraphElementData(expectedCollection)); }