Skip to content

jexp/sdn-twitter-boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple Twitter example with Spring Boot with Spring Data Neo4j, SD-REST and Spring Social

Installation

Make sure to have a Neo4j Server running, download and start with bin/neo4j start.

Run mvn spring-boot:run

The application will start to import tweets automatically on a scheduled basis, based on a java system property twitter.search

It defaults to: "#neo4j OR "graph OR database" OR "graph OR databases" OR graphdb OR graphconnect OR @neoquestions OR @Neo4jDE OR @Neo4jFr OR neotechnology OR springsource OR @SpringData OR pivotal OR @starbuxman OR @mesirii OR @springcentral"

You need to have a Twitter Bearer Token for the search, generate one here: https://dev.twitter.com/docs/api/1.1/post/oauth2/token

~/Downloads/neo4j-community-2.0.3/bin/neo4j start
export TWITTER_BEARER='AAAAA....MkE'
mvn spring-boot:run [-Dtwitter.search="springsource"]

To access the Spring Data REST repository-endpoints try:

curl http://localhost:8080/users
curl http://localhost:8080/tweets
curl http://localhost:8080/tags

#to see additional search methods on the repository
curl http://localhost:8080/users/search/
{
  "_links" : {
    "findByUser" : {
      "href" : "http://localhost:8080/users/search/findByUser{?0}",
      "templated" : true
    },
    "suggestFriends" : {
      "href" : "http://localhost:8080/users/search/suggestFriends{?name}",
      "templated" : true
    }
  }
}

curl http://localhost:8080/users/search/findByUser?0=starbuxman
{
  "_embedded" : {
    "users" : [ {
      "userId" : 4324751,
      "user" : "starbuxman",
      "name" : "Josh Long",
      "createdDate" : null,
      "followers" : 0,
      "friends" : 0,
      "url" : null,
      "image" : null,
      "language" : null,
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/users/1202977"
        }
      }
    } ]
  }
}

curl http://localhost:8080/users/searchsuggestFriends?name=starbuxman
{
  "_embedded" : {
    "users" : [ ...
     {
      "userId" : 7596542,
      "user" : "mesirii",
      "name" : "Michael Hunger",
      "createdDate" : null,
      "followers" : 0,
      "friends" : 0,
      "url" : null,
      "image" : null,
      "language" : null,
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/users/1203254"
        }
      }
    }, {
      "userId" : 22467617,
      "user" : "neo4j",
      "name" : "Neo4j",
      "createdDate" : null,
      "followers" : 0,
      "friends" : 0,
      "url" : null,
      "image" : null,
      "language" : null,
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/users/1203253"
        }
      }
    } ... ]
  }
}

Entities:

  • Tweet

  • User

  • Tag

Relationships

  • POSTED

  • TAGGED

  • MENTIONS

  • SOURCE

Example Use-Case: Recommend new people to follow

MATCH (me:User {user:{name}})-[:POSTED]->(tweet)-[:MENTIONS]->(user) RETURN distinct user

About

Spring Boot Application with Spring Data Neo4j REST, SD-REST and Spring Social for Twitter import

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages