https://github.com/jexp/sdn-twitter-boot
Spring Boot Application with Spring Data Neo4j REST, SD-REST and Spring Social for Twitter import
https://github.com/jexp/sdn-twitter-boot
Last synced: about 1 year ago
JSON representation
Spring Boot Application with Spring Data Neo4j REST, SD-REST and Spring Social for Twitter import
- Host: GitHub
- URL: https://github.com/jexp/sdn-twitter-boot
- Owner: jexp
- Created: 2014-05-19T00:46:10.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-05-19T23:04:08.000Z (about 12 years ago)
- Last Synced: 2025-05-07T15:07:39.443Z (about 1 year ago)
- Language: Java
- Size: 141 KB
- Stars: 10
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: readme.adoc
Awesome Lists containing this project
README
=== Simple Twitter example with Spring Boot with Spring Data Neo4j, SD-REST and Spring Social
=== Installation
Make sure to have a Neo4j Server running, http://neo4j.com/download[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
[source]
----
~/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
[source,cypher]
----
MATCH (me:User {user:{name}})-[:POSTED]->(tweet)-[:MENTIONS]->(user) RETURN distinct user
----