Package storm.trident

Examples of storm.trident.TridentState


        new Values("the man went to the store and bought some candy"), new Values("four score and seven years ago"),
        new Values("how many apples can you eat"), new Values("to be or not to be the person"));
    spout.setCycle(true);

    TridentTopology topology = new TridentTopology();
    TridentState wordCounts = topology.newStream("spout1", spout).parallelismHint(16).each(new Fields("sentence"),
        new Split(), new Fields("word")).groupBy(new Fields("word")).persistentAggregate(new MemoryMapState.Factory(),
        new Count(), new Fields("count")).parallelismHint(16);

    topology.newDRPCStream("words", drpc).each(new Fields("args"), new Split(), new Fields("word")).groupBy(new Fields(
        "word")).stateQuery(wordCounts, new Fields("word"), new MapGet(), new Fields("count")).each(new Fields("count"),
View Full Code Here


  }

  public static StormTopology buildTopology(LocalDRPC drpc) {
    TridentTopology topology = new TridentTopology();
    TridentState urlToTweeters = topology.newStaticState(new StaticSingleKeyMapState.Factory(TWEETERS_DB));
    TridentState tweetersToFollowers = topology.newStaticState(new StaticSingleKeyMapState.Factory(FOLLOWERS_DB));


    topology.newDRPCStream("reach", drpc).stateQuery(urlToTweeters, new Fields("args"), new MapGet(), new Fields(
        "tweeters")).each(new Fields("tweeters"), new ExpandList(), new Fields("tweeter")).shuffle().stateQuery(
        tweetersToFollowers, new Fields("tweeter"), new MapGet(), new Fields("followers")).each(new Fields("followers"),
View Full Code Here

    try {
      // Build topology
      TridentTopology toppology = new TridentTopology();

      // "Training" stream
      TridentState classifierState = toppology.newStream("reutersData", new ReutersBatchSpout())
      // Transform raw data to text instance
          .each(new Fields("label", "text"), new TextInstanceCreator<Integer>(), new Fields("instance"))

          // Update text classifier
          .partitionPersist(new MemoryMapState.Factory(), new Fields("instance"), new TextClassifierUpdater<Integer>("newsClassifier", new KLDClassifier(9)));
View Full Code Here

    try {
      // Build topology
      TridentTopology toppology = new TridentTopology();

      // Training stream
      TridentState kmeansState = toppology
        // Emit tuples with a instance containing an integer as label and 3
        // double features named (x0, x1 and x2)
        .newStream("samples", new RandomFeaturesForClusteringSpout())

        // Convert trident tuple to instance
View Full Code Here

    try {
      TridentTopology toppology = new TridentTopology();
      MemoryMapState.Factory evaluationStateFactory = new MemoryMapState.Factory();
      MemoryMapState.Factory perceptronModelStateFactory = new MemoryMapState.Factory();
      TridentState perceptronModel = toppology.newStaticState(perceptronModelStateFactory);
      TridentState perceptronEvaluation = toppology.newStaticState(evaluationStateFactory);

      // Predict
      Stream predictionStream = toppology.newStream("nandsamples", new NANDSpout()) //
          .stateQuery(perceptronModel, new Fields("instance"), new ClassifyQuery<Boolean>("perceptron"), new Fields("prediction"));
View Full Code Here

    try {

      // Build topology
      TridentTopology toppology = new TridentTopology();

      TridentState scaledStreamStatistics = toppology
      // emit tuples with random features
          .newStream("originalStream", new RandomFeaturesSpout(false, 2, 3.0))

          // Transform trident tupl to instance
          .each(new Fields("x0", "x1"), new InstanceCreator(false), new Fields("instance"))
View Full Code Here

    try {
      // Build topology
      TridentTopology toppology = new TridentTopology();

      // Training stream
      TridentState perceptronModel = toppology.newStream("nandsamples", new NANDSpout())
      // update classifier
          .partitionPersist(new MemoryMapState.Factory(), new Fields("instance"), new ClassifierUpdater<Boolean>("perceptron", new PerceptronClassifier()));

      // Classification stream
      toppology.newDRPCStream("predict", localDRPC)
View Full Code Here

                new Values("how many apples can you eat"),
                new Values("to be or not to be the person"));
        spout.setCycle(true);
       
        TridentTopology topology = new TridentTopology();       
        TridentState wordCounts =
              topology.newStream("spout1", spout)
                .parallelismHint(16)
                .each(new Fields("sentence"), new Split(), new Fields("word"))
                .groupBy(new Fields("word"))
                .persistentAggregate(new MemoryMapState.Factory(),
View Full Code Here

    }

    public static StormTopology buildTopology(LocalDRPC drpc) {
        TridentTopology topology = new TridentTopology();
        TridentState urlToTweeters =
                topology.newStaticState(
                    new StaticSingleKeyMapState.Factory(TWEETERS_DB));
        TridentState tweetersToFollowers =
                topology.newStaticState(
                    new StaticSingleKeyMapState.Factory(FOLLOWERS_DB));


        topology.newDRPCStream("reach", drpc)
View Full Code Here

public class GlobalTop20Hashtags {

    public static StormTopology buildTopology(TransactionalTridentKafkaSpout spout) throws IOException {

        TridentTopology topology = new TridentTopology();
        TridentState count =
        topology
                .newStream("tweets", spout)
                .each(new Fields("str"), new ParseTweet(), new Fields("text", "content", "user"))
                .project(new Fields("content", "user"))
                .each(new Fields("content"), new OnlyHashtags())
View Full Code Here

TOP

Related Classes of storm.trident.TridentState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.