Package net.fortytwo.twitlogic.model

Examples of net.fortytwo.twitlogic.model.Triple


            if ((4 == maxRating || 5 == maxRating)
                    && rating >= 0
                    && rating <= maxRating) {
                Resource review = context.anonymousNode();
                try {
                    context.handle(new Triple(context.getSubject(), HASREVIEW, review));
                    context.handle(new Triple(review, TYPE, REVIEW));
                    context.handle(new Triple(review, RATING, new PlainLiteral("" + rating)));
                    context.handle(new Triple(review, MAXRATING, new PlainLiteral("" + maxRating)));
                    context.handle(new Triple(review, MINRATING, new PlainLiteral("" + minRating)));
                    context.handle(new Triple(review, TEXT, new PlainLiteral(context.thisTweet().getText())));
                } catch (HandlerException e) {
                    throw new MatcherException(e);
                }

                // FIXME: restore this.  Currently, it causes a transaction to hang.
View Full Code Here


*/
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 {
View Full Code Here

        handler.handle(t);
    }

    public void handleCompletedTriple(final Resource predicate,
                                      final Resource object) throws HandlerException {
        Triple t = new Triple(subject, predicate, object);
        handler.handle(t);
    }
View Full Code Here

                weight *= weightResource(subject, PartOfSpeech.SUBJECT);
                weight *= weightResource(predicate, PartOfSpeech.PREDICATE);
                weight *= weightResource(object, PartOfSpeech.OBJECT);

                Triple st = new Triple(subject, predicate, object, weight);
                try {
                    if (!resultHandler.isOpen()) {
                        break;
                    }

View Full Code Here

    public void tearDown() {
    }

    public void testPartsOfSpeech() throws Exception {
        assertExpected("@joshsh #knows @xixiluo",
                new Triple(JOSHSH, KNOWS, XIXILUO));
        assertExpected("#joshsh #knows @xixiluo",
                new Triple(new Hashtag("joshsh"), KNOWS, XIXILUO));
        assertExpected("\"josh\" #knows @xixiluo");
        assertExpected("http://example.org/joshsh #knows @xixiluo");

        assertExpected("@joshsh #knows @xixiluo",
                new Triple(JOSHSH, KNOWS, XIXILUO));
        assertExpected("@joshsh @knows @xixiluo");
        assertExpected("@joshsh \"knows\" @xixiluo");
        assertExpected("@joshsh http://example.org/knows @xixiluo");
       
        assertExpected("@joshsh #knows @xixiluo",
                new Triple(JOSHSH, KNOWS, XIXILUO));
        assertExpected("@joshsh #knows #xixiluo",
                new Triple(JOSHSH, KNOWS, new Hashtag("xixiluo")));
        assertExpected("@joshsh #knows \"xixiluo\"",
                new Triple(JOSHSH, KNOWS, new PlainLiteral("xixiluo")));
        assertExpected("@joshsh #knows http://example.org/xixiluo",
                new Triple(JOSHSH, KNOWS, new TypedLiteral("http://example.org/xixiluo", XMLSchema.NAMESPACE + "anyURI")));
    }
View Full Code Here

                new Triple(JOSHSH, KNOWS, new TypedLiteral("http://example.org/xixiluo", XMLSchema.NAMESPACE + "anyURI")));
    }

    public void testWhitespace() throws Exception {
        assertExpected("@joshsh #knows @xixiluo",
                new Triple(JOSHSH, KNOWS, XIXILUO));
        assertExpected(" and   \t\n@joshsh\t#knows \n\n@xixiluo  (I think...)  ",
                new Triple(JOSHSH, KNOWS, XIXILUO));
    }
View Full Code Here

        //...
    }

    public void testURILiterals() throws Exception {
        assertExpected("@joshsh #knows http://example.org/xixiluo",
                new Triple(JOSHSH, KNOWS, new TypedLiteral("http://example.org/xixiluo", XMLSchema.NAMESPACE + "anyURI")));
        //assertExpected("@joshsh #knows http://example.org/xixiluo.", "@joshsh #knows http://example.org/xixiluo");
    }
View Full Code Here

        //assertExpected("@joshsh #knows http://example.org/xixiluo.", "@joshsh #knows http://example.org/xixiluo");
    }

    public void testCruft() throws Exception {
        assertExpected("%@joshsh #knows @xixiluo",
                new Triple(JOSHSH, KNOWS, XIXILUO));
        assertExpected("@joshsh #knows @xixiluo...",
                new Triple(JOSHSH, KNOWS, XIXILUO));

// RESTORE ME
//        assertExpected("foo #twipleparser #status #readyToTest .", "#twipleparser #status #readyToTest");

        assertExpected("@joshsh (#knows) @xixiluo");
View Full Code Here

        assertExpected("@joshsh (#knows) @xixiluo");
    }

    public void testMultipleMatches() throws Exception {
        assertExpected("A #one, a #two, a #one #two #three #four!",
                new Triple(new Hashtag("one"), new Hashtag("two"), new Hashtag("three")),
                new Triple(new Hashtag("two"), new Hashtag("three"), new Hashtag("four")));
    }
View Full Code Here

        matcher = new DemoAfterthoughtMatcher();
    }

    public void testAll() throws Exception {
        assertExpected("@joshsh (who knows @xixiluo)",
                new Triple(JOSHSH_PERSON, KNOWS, XIXILUO_PERSON));
    }
View Full Code Here

TOP

Related Classes of net.fortytwo.twitlogic.model.Triple

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.