Package net.fortytwo.twitlogic.syntax.afterthought.impl.foaf

Source Code of net.fortytwo.twitlogic.syntax.afterthought.impl.foaf.SelfInterestMatcher

package net.fortytwo.twitlogic.syntax.afterthought.impl.foaf;

import net.fortytwo.twitlogic.model.Triple;
import net.fortytwo.twitlogic.model.URIReference;
import net.fortytwo.twitlogic.services.twitter.HandlerException;
import net.fortytwo.twitlogic.syntax.afterthought.AfterthoughtContext;
import net.fortytwo.twitlogic.syntax.afterthought.AfterthoughtMatcher;
import net.fortytwo.twitlogic.syntax.MatcherException;
import net.fortytwo.twitlogic.vocabs.FOAF;

/**
* Captures "+1" expression of own interest in a topic.
*
* @author Joshua Shinavier (http://fortytwo.net).
*/
public class SelfInterestMatcher extends AfterthoughtMatcher {
    public void matchNormalized(final String normed,
                                final AfterthoughtContext context) throws MatcherException {
        if (normed.equals("+1")) {
            Triple t = new Triple(
                    context.thisPerson(),
                    new URIReference(FOAF.INTEREST),
                    context.getSubject());

            try {
                context.handle(t);
            } catch (HandlerException e) {
                throw new MatcherException(e);
            }
        }
    }
}
TOP

Related Classes of net.fortytwo.twitlogic.syntax.afterthought.impl.foaf.SelfInterestMatcher

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.