Search in sources :

Example 56 with FluoClient

use of org.apache.fluo.api.client.FluoClient in project incubator-rya by apache.

the class AccumuloCreatePeriodicPCJ method updateFluoAppAndRegisterWithKafka.

private String updateFluoAppAndRegisterWithKafka(final String ryaInstance, final String fluoAppName, String sparql, String periodicTopic, String bootStrapServers) throws RepositoryException, MalformedQueryException, SailException, QueryEvaluationException, PcjException, RyaDAOException, UnsupportedQueryException, PeriodicQueryCreationException {
    requireNonNull(sparql);
    requireNonNull(periodicTopic);
    requireNonNull(bootStrapServers);
    final PeriodicQueryResultStorage periodicStorage = new AccumuloPeriodicQueryResultStorage(getConnector(), ryaInstance);
    // Connect to the Fluo application that is updating this instance's PCJs.
    final AccumuloConnectionDetails cd = super.getAccumuloConnectionDetails();
    try (final FluoClient fluoClient = new FluoClientFactory().connect(cd.getUsername(), new String(cd.getUserPass()), cd.getInstanceName(), cd.getZookeepers(), fluoAppName)) {
        // Initialize the PCJ within the Fluo application.
        final CreatePeriodicQuery periodicPcj = new CreatePeriodicQuery(fluoClient, periodicStorage);
        PeriodicNotificationClient periodicClient = new KafkaNotificationRegistrationClient(periodicTopic, createProducer(bootStrapServers));
        return periodicPcj.withRyaIntegration(sparql, periodicClient, getConnector(), ryaInstance).getQueryId();
    }
}
Also used : FluoClient(org.apache.fluo.api.client.FluoClient) AccumuloPeriodicQueryResultStorage(org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPeriodicQueryResultStorage) PeriodicNotificationClient(org.apache.rya.periodic.notification.api.PeriodicNotificationClient) CreatePeriodicQuery(org.apache.rya.indexing.pcj.fluo.api.CreatePeriodicQuery) AccumuloPeriodicQueryResultStorage(org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPeriodicQueryResultStorage) PeriodicQueryResultStorage(org.apache.rya.indexing.pcj.storage.PeriodicQueryResultStorage) KafkaNotificationRegistrationClient(org.apache.rya.periodic.notification.registration.KafkaNotificationRegistrationClient)

Example 57 with FluoClient

use of org.apache.fluo.api.client.FluoClient in project incubator-rya by apache.

the class AccumuloDeletePeriodicPCJ method stopUpdatingPCJ.

private void stopUpdatingPCJ(final String ryaInstance, final String fluoAppName, final String pcjId, final String topic, final String brokers) throws UnsupportedQueryException, MalformedQueryException, QueryDeletionException {
    requireNonNull(fluoAppName);
    requireNonNull(pcjId);
    // Connect to the Fluo application that is updating this instance's PCJs.
    final AccumuloConnectionDetails cd = super.getAccumuloConnectionDetails();
    try (final FluoClient fluoClient = new FluoClientFactory().connect(cd.getUsername(), new String(cd.getUserPass()), cd.getInstanceName(), cd.getZookeepers(), fluoAppName)) {
        // Delete the PCJ from the Fluo App.
        PeriodicQueryResultStorage periodic = new AccumuloPeriodicQueryResultStorage(getConnector(), ryaInstance);
        DeletePeriodicQuery deletePeriodic = new DeletePeriodicQuery(fluoClient, periodic);
        deletePeriodic.deletePeriodicQuery(pcjId, getPeriodicNotificationClient(topic, brokers));
    }
}
Also used : FluoClient(org.apache.fluo.api.client.FluoClient) AccumuloPeriodicQueryResultStorage(org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPeriodicQueryResultStorage) DeletePeriodicQuery(org.apache.rya.indexing.pcj.fluo.api.DeletePeriodicQuery) AccumuloPeriodicQueryResultStorage(org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPeriodicQueryResultStorage) PeriodicQueryResultStorage(org.apache.rya.indexing.pcj.storage.PeriodicQueryResultStorage)

Aggregations

FluoClient (org.apache.fluo.api.client.FluoClient)57 Test (org.junit.Test)44 CreateFluoPcj (org.apache.rya.indexing.pcj.fluo.api.CreateFluoPcj)22 PrecomputedJoinStorage (org.apache.rya.indexing.pcj.storage.PrecomputedJoinStorage)21 AccumuloPcjStorage (org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPcjStorage)21 Connector (org.apache.accumulo.core.client.Connector)19 HashSet (java.util.HashSet)16 BindingSet (org.openrdf.query.BindingSet)16 Transaction (org.apache.fluo.api.client.Transaction)15 RyaStatement (org.apache.rya.api.domain.RyaStatement)15 ValueFactory (org.openrdf.model.ValueFactory)15 ValueFactoryImpl (org.openrdf.model.impl.ValueFactoryImpl)15 Snapshot (org.apache.fluo.api.client.Snapshot)13 RyaURI (org.apache.rya.api.domain.RyaURI)13 InsertTriples (org.apache.rya.indexing.pcj.fluo.api.InsertTriples)13 VariableOrder (org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder)12 Statement (org.openrdf.model.Statement)12 MapBindingSet (org.openrdf.query.impl.MapBindingSet)12 FluoClientImpl (org.apache.fluo.core.client.FluoClientImpl)11 PeriodicQueryResultStorage (org.apache.rya.indexing.pcj.storage.PeriodicQueryResultStorage)9