Package com.datasift.client

Examples of com.datasift.client.DataSiftClient.compile()


        //or all at once
        source.setParams(true, true, true);
        ManagedSource managedSource = datasift.managedSource().create("My managed source", source).sync();
        if (managedSource.isSuccessful()) {
            //and now we can do filtering on this page e.g.
            Stream stream = datasift
                    .compile(String.format("interaction.content contains \"news\" AND source.id == \"%s\"",
                            managedSource.getId())).sync();

            System.out.println(managedSource);
        }
View Full Code Here


        //both sync and async processing are supported by calling "sync" on any FutureDate object

//        Usage u = datasift.usage().sync();
//        System.out.println(u);
        //all response objects extend DataSiftResult which present these utility methods
        DataSiftResult result = datasift.compile(csdl).sync();
        //is successful returns true if a response hasn't explicitly been marked as failed,
        //there is a valid response, no exceptions are set and the response status is between 200 - 399
        if (!result.isSuccessful()) {
            //if true an exception may have caused the request to fail, inspect the cause if available
            if (result.failureCause() != null) { //may not be an exception
View Full Code Here

            return;
        }
        System.out.println(validation);
        if (validation.isSuccessful()) {
            //we now know it's valid so asynchronously compile the CSDL and obtain a stream
            FutureData<Stream> compiledStream = datasift.compile(csdl);
            compiledStream.onData(new FutureResponse<Stream>() {
                public void apply(Stream data) {
                    System.out.println(data);
                }
            });
View Full Code Here

    }

    public static void main(String... args) throws InterruptedException {
        DataSiftConfig config = new DataSiftConfig("zcourts", "a9641ee0770d05ff3d83225c9fafe4bb");
        final DataSiftClient datasift = new DataSiftClient(config);
        Stream result = datasift.compile("interaction.content contains \"music\" ").sync();
        //handle exceptions that can't necessarily be linked to a specific stream
        datasift.liveStream().onError(new ErrorHandler());

        //handle delete message
        datasift.liveStream().onStreamEvent(new ExampleStreamEventHandler());
View Full Code Here

        DataSiftDynamicList dynamiclist = new DataSiftDynamicList(config);

        DynamicList list = dynamiclist.create(DataSiftDynamicList.ListType.STRING, "example list").sync();
        if (list.isSuccessful()) {
            // create a stream that references the dynamic list, using the list_any operator
            Stream stream = datasift
                    .compile(String.format("interaction.content list_any \"%s\"", list.getId())).sync();

            // even after the stream was created, we can manipulate the list, even if the stream is running
            List<String> items = new ArrayList<>();
            items.add("keyword1");
View Full Code Here

        final DataSiftClient datasift = new DataSiftClient(config);
        String csdl = "interaction.content contains \"some string\"";
        //both sync and async processing are supported by calling "sync" on any FutureDate object

        //all response objects extend DataSiftResult which present these utility methods
        DataSiftResult result = datasift.compile(csdl).sync();
        //is successful returns true if a response hasn't explicitly been marked as failed,
        //there is a valid response, no exceptions are set and the response status is between 200 - 399
        if (!result.isSuccessful()) {
            //if true an exception may have caused the request to fail, inspect the cause if available
            if (result.failureCause() != null) { //may not be an exception
View Full Code Here

            return;
        }
        System.out.println(validation);
        if (validation.isSuccessful()) {
            //we now know it's valid so asynchronously compile the CSDL and obtain a stream
            FutureData<Stream> compiledStream = datasift.compile(csdl);
            compiledStream.onData(new FutureResponse<Stream>() {
                public void apply(Stream data) {
                    System.out.println(data);
                }
            });
View Full Code Here

    }

    public static void main(String... args) throws InterruptedException {
        DataSiftConfig config = new DataSiftConfig("zcourts", "130894088ba71db4e793585e40528bc1");
        final DataSiftClient datasift = new DataSiftClient(config);
        Stream result = datasift.compile("interaction.content contains \"music\"").sync();
        //handle exceptions that can't necessarily be linked to a specific stream
        datasift.liveStream().onError(new ErrorHandler());

        //handle delete message
        datasift.liveStream().onStreamEvent(new DeleteHandler());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.