Search in sources :

Example 11 with Statement

use of com.google.api.ads.admanager.jaxws.v202205.Statement in project sunbird-rc-core by Sunbird-RC.

the class Neo4jGraphProvider method createCompositeIndex.

@Override
public void createCompositeIndex(Graph graph, String label, List<String> propertyNames) {
    Neo4JGraph neo4jGraph = (Neo4JGraph) graph;
    if (propertyNames.size() > 0) {
        StringBuilder properties = new StringBuilder(String.join(",", propertyNames));
        logger.info("composite key properties values " + properties);
        Objects.requireNonNull(label, "label cannot be null");
        Objects.requireNonNull(properties, "properties cannot be null");
        neo4jGraph.execute(new Statement("CREATE INDEX ON :`" + label + "`(" + properties + ")"));
    } else {
        logger.info("Could not create composite index for empty properties");
    }
}
Also used : Statement(org.neo4j.driver.v1.Statement) Neo4JGraph(com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph)

Example 12 with Statement

use of com.google.api.ads.admanager.jaxws.v202205.Statement in project eol-globi-data by jhpoelen.

the class CypherQueryExecutorIT method executeBoltQuery.

@Test
public void executeBoltQuery() {
    Driver driver = GraphDatabase.driver("bolt://preston:7687", AuthTokens.none());
    Session session = driver.session(AccessMode.READ);
    try (Transaction transaction = session.beginTransaction()) {
        String s = "CYPHER 2.3 START dataset = node:datasets({namespace}) RETURN dataset.namespace LIMIT 1";
        Statement statement = new Statement(s, new TreeMap<String, Object>() {

            {
                put("namespace", "namespace:\"globalbioticinteractions/template-dataset\"");
            }
        });
        StatementResult run = transaction.run(statement);
        run.stream().map(r -> r.asMap()).forEach(System.out::println);
        transaction.success();
    }
}
Also used : Driver(org.neo4j.driver.v1.Driver) CypherUtil(org.eol.globi.util.CypherUtil) AccessMode(org.neo4j.driver.v1.AccessMode) Assert.assertNotNull(org.junit.Assert.assertNotNull) AuthTokens(org.neo4j.driver.v1.AuthTokens) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test) IOException(java.io.IOException) Transaction(org.neo4j.driver.v1.Transaction) CypherQuery(org.eol.globi.util.CypherQuery) Is(org.hamcrest.core.Is) Statement(org.neo4j.driver.v1.Statement) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Session(org.neo4j.driver.v1.Session) TreeMap(java.util.TreeMap) StatementResult(org.neo4j.driver.v1.StatementResult) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) GraphDatabase(org.neo4j.driver.v1.GraphDatabase) Collections(java.util.Collections) StatementResult(org.neo4j.driver.v1.StatementResult) Transaction(org.neo4j.driver.v1.Transaction) Statement(org.neo4j.driver.v1.Statement) Driver(org.neo4j.driver.v1.Driver) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Session(org.neo4j.driver.v1.Session) Test(org.junit.Test)

Example 13 with Statement

use of com.google.api.ads.admanager.jaxws.v202205.Statement in project googleads-java-lib by googleads.

the class StatementBuilder method toStatement.

/**
 * Gets the {@link Statement} representing the state of this statement builder.
 *
 * @return the {@link Statement}
 */
public Statement toStatement() {
    Statement statement = new Statement();
    statement.setQuery(queryBuilder.buildQuery());
    statement.getValues().addAll(Maps.toList(queryBuilder.getBindVariableMap(), StringValueMapEntry.class));
    return statement;
}
Also used : Statement(com.google.api.ads.admanager.jaxws.v202111.Statement) StringValueMapEntry(com.google.api.ads.admanager.jaxws.v202111.StringValueMapEntry)

Example 14 with Statement

use of com.google.api.ads.admanager.jaxws.v202205.Statement in project googleads-java-lib by googleads.

the class StatementBuilder method toStatement.

/**
 * Gets the {@link Statement} representing the state of this statement builder.
 *
 * @return the {@link Statement}
 */
public Statement toStatement() {
    Statement statement = new Statement();
    statement.setQuery(queryBuilder.buildQuery());
    statement.getValues().addAll(Maps.toList(queryBuilder.getBindVariableMap(), StringValueMapEntry.class));
    return statement;
}
Also used : Statement(com.google.api.ads.admanager.jaxws.v202202.Statement) StringValueMapEntry(com.google.api.ads.admanager.jaxws.v202202.StringValueMapEntry)

Example 15 with Statement

use of com.google.api.ads.admanager.jaxws.v202205.Statement in project googleads-java-lib by googleads.

the class StatementBuilder method toStatement.

/**
 * Gets the {@link Statement} representing the state of this statement builder.
 *
 * @return the {@link Statement}
 */
public Statement toStatement() {
    Statement statement = new Statement();
    statement.setQuery(queryBuilder.buildQuery());
    statement.getValues().addAll(Maps.toList(queryBuilder.getBindVariableMap(), StringValueMapEntry.class));
    return statement;
}
Also used : Statement(com.google.api.ads.admanager.jaxws.v202205.Statement) StringValueMapEntry(com.google.api.ads.admanager.jaxws.v202205.StringValueMapEntry)

Aggregations

Test (org.junit.Test)77 Statement (com.google.api.ads.admanager.axis.v202105.Statement)16 Statement (com.google.api.ads.admanager.axis.v202108.Statement)16 Statement (com.google.api.ads.admanager.axis.v202111.Statement)16 Statement (com.google.api.ads.admanager.axis.v202202.Statement)16 Statement (com.google.api.ads.admanager.axis.v202205.Statement)16 Statement (org.neo4j.driver.v1.Statement)5 String_ValueMapEntry (com.google.api.ads.admanager.axis.v202105.String_ValueMapEntry)4 String_ValueMapEntry (com.google.api.ads.admanager.axis.v202108.String_ValueMapEntry)4 String_ValueMapEntry (com.google.api.ads.admanager.axis.v202111.String_ValueMapEntry)4 String_ValueMapEntry (com.google.api.ads.admanager.axis.v202202.String_ValueMapEntry)4 String_ValueMapEntry (com.google.api.ads.admanager.axis.v202205.String_ValueMapEntry)4 Session (org.neo4j.driver.v1.Session)3 StatementResult (org.neo4j.driver.v1.StatementResult)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Neo4JGraph (com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph)2 IOException (java.io.IOException)2 Collections (java.util.Collections)2 TreeMap (java.util.TreeMap)2 CypherQuery (org.eol.globi.util.CypherQuery)2