Package net.fortytwo.rdfagents.jade

Examples of net.fortytwo.rdfagents.jade.PubsubConsumerImpl


                new AgentId("urn:x-agent:twitlogic@twitlogic.fortytwo.net", "xmpp://patabot.2@jabber.org"));
        RDFAgent consumer = new RDFAgentImpl(p,
                new AgentId("urn:x-agent:agent1@twitlogic.fortytwo.net", "xmpp://patabot.2@jabber.org"));

        QueryConsumer<Value, Dataset> client = new QueryConsumerImpl(consumer);
        PubsubConsumer<Value, Dataset> subscriber = new PubsubConsumerImpl(consumer);

        ConsumerCallback<Dataset> callback = new ConsumerCallback<Dataset>() {
            public void success(final Dataset answer) {
                System.out.println("received a query result or subscription update.  Answer follows:");
                try {
                    datasetFactory.write(System.out, answer, RDFContentLanguage.RDF_TRIG);
                } catch (LocalFailure e) {
                    e.printStackTrace(System.err);
                }
            }

            public void agreed() {
                System.out.println("agreed!");
            }

            public void refused(final ErrorExplanation explanation) {
                System.out.println("refused!");
            }

            public void remoteFailure(final ErrorExplanation explanation) {
                System.out.println("remote failure: " + explanation);
            }

            public void localFailure(final LocalFailure e) {
                System.out.println("local failure: " + e + "\n" + RDFAgents.stackTraceToString(e));
            }
        };

        //client.submit(new URIImpl("http://rdfs.org/sioc/types#MicroblogPost"), twitlogic.getIdentity(), callback);

        subscriber.submit(new URIImpl("http://rdfs.org/sioc/types#MicroblogPost"), twitlogic.getIdentity(), callback);
        //subscriber.submit(new URIImpl("http://twitlogic.fortytwo.net/post/twitter/76748841705144320"), twitlogic.getIdentity(), callback);
    }
View Full Code Here

TOP

Related Classes of net.fortytwo.rdfagents.jade.PubsubConsumerImpl

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.