Package net.fortytwo.twitlogic.model

Examples of net.fortytwo.twitlogic.model.Hashtag


        if (l.startsWith("a ") | l.startsWith("an ")) {
            String rest = normed.substring(normed.indexOf(" ") + 1);

            if (TweetSyntax.HASHTAG_PATTERN.matcher(rest).matches()) {
                try {
                    context.handleCompletedTriple(new URIReference(RDF.TYPE), new Hashtag(rest.substring(1)));
                } catch (HandlerException e) {
                    throw new MatcherException(e);
                }
            } else {
                String rl = rest.toLowerCase();
View Full Code Here


    private TokenizedObjectPropertyClause forHashtagObject(final String normed) {
        ThreeParts t = divide(normed, TweetSyntax.HASHTAG_PATTERN);
        return null == t
                ? null
                : new TokenizedObjectPropertyClause(t.first, new Hashtag(t.second.substring(1)), t.third);
    }
View Full Code Here

            text = text.substring(ASPIRATIONAL_SCREENNAME.length()).trim();
        }*/

        String link = null;
        if (TweetSyntax.HASHTAG_PATTERN.matcher(text).matches()) {
            link = PersistenceContext.uriOf(new Hashtag(text.substring(1)));
        } else if (TweetSyntax.USERNAME_PATTERN.matcher(text).matches()) {
            link = PersistenceContext.uriOf(new User(text.substring(1)).getHeldBy());
        }

        if (null == link) {
View Full Code Here

        if (null == tweet.getEntities() && null != tweet.getText()) {
            Entities entities = new Entities();

            Collection<Resource> topics = entities.getTopics();
            for (String tag : TweetSyntax.findHashtags(tweet.getText())) {
                topics.add(new Hashtag(tag));
            }

            // Note: dollar tags are not "sniffed" here.

            Collection<URIReference> links = entities.getLinks();
View Full Code Here

    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

        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

TOP

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

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.