Import Queries
Post.csv
LOAD CSV WITH HEADERS FROM file:///E:/post.csv AS line
create (:post {id: toInteger(line.id),posttypeid: toInteger(line.PostTypeId),acceptedanswerid: toInteger(line.AcceptedAnswerId),creationdate: line.CreationDate,score: line.Score,viewcount: line.ViewCount,owneruserid: line.OwnerUserId,title: line.Title,tags: line.Tags,answercount: line.AnswerCount,commentcount: line.CommentCount,favouritecount: line.FavoriteCount,parentid: line.ParentId,closeddate: line.ClosedDate, ownerdisplayname: line.OwnerDisplayName})
Tags.csv
LOAD CSV WITH HEADERS FROM file:///E:/tags.csv AS line
create (:tags {id: toInteger(line.Id),tagname: (line.TagName),count: (line.Count),excerptpostid: (line.ExcerptPostId), wikipostid: (line.WikiPostId)})
User.csv
LOAD CSV WITH HEADERS FROM file:///E:/user.csv AS line
create (:user {id: line.Id,reputation: line.Reputation,creationdate: line.CreationDate,displayname: line.DisplayName,lastaccessdate: line.LastAccessDate,location: line.Location,views: line.Views,upvotes :line.UpVotes,downvotes :line.DownVotes,accountid :line.AccountId})
Votes.csv
LOAD CSV WITH HEADERS FROM file:///E:/votes.csv AS line
create (:votes {id: toInteger(line.Id),postid: toInteger(line.PostId),votetypeid: toInteger(line.VoteTypeId),creationdate: line.CreationDate,userid: toInteger(line.UserId),bountyamount: line.BountyAmount})
SQ1
match (u:user)-[r:PostedBy]-(p:post) return p.owneruserid , u.displayname , u.upvotes , u.downvotes
SQ2
match (p:post) return max(p.viewcount)
AQ4
match (p:post) wherep.tags = machine-learningORp.tags = reinforcement-learning ORp.tags = ai-designand p.acceptedanswerid >=4 and p.owneruserid = 4398return p.title , p.creationdate
AQ5
match(u:user)-[r:PostedBy]->(p:post) where p.acceptedanswerid < u.upvotes return p.id as question, p.acceptedanswerid as acceptedanswer, u.upvotes as upvotesAQ6match (p:post{posttypeid: 1}) return p.owneruserid , count(p.owneruserid) as numberofquestionsRelations Ship Code:PostType With Postcreate (:postedtype{id:1 , posttype:’Question’})create (:postedtype{id:2 , posttype:’Answer’})Match(p:post),(pt:postedtype) where p.posttypeid = 1 and pt.id = 1 create (p)-[r: PostType]->(pt) return p , pt
Match(p:post),(pt:postedtype) where p.posttypeid = 2 and pt.id = 2 create (p)-[r: PostType]->(pt) return p , pt
Vote ,VoteTypeRelationShip , Post relation ship
Code
create (:votetype{id:1, type:AcceptedByOriginator})
create (:votetype{id:2, type: UpMod})
create (:votetype{id:2, type:DownMod})
create (:votetype{id:2, type: Offensive})
create (:votetype{id:2, type:Favorite})
create (:votetype{id:2, type: Close})
create (:votetype{id:2, type: Reopen})
create (:votetype{id:2, type: BountyStart})
create (:votetype{id:2, type: BountyClose})
create (:votetype{id:2, type: Deletion})
create (:votetype{id:2, type:Un Deletion})
create (:votetype{id:2, type: Spam})
create (:votetype{id:2, type: InformModerator})
Relation With Post
match(p:post),(v:vote) where p.id = 5 andv.postid = 5 create (p)-[r: Post]->(v) return p , v
match(p:post),(v:vote) where p.id = 3 andv.postid = 3 create (p)-[r: Post]->(v) return p , v
match(p:post),(v:vote) where p.id = 2 andv.postid = 2 create (p)-[r: Post]->(v) return p , v
match(p:post),(v:vote) where p.id = 1 andv.postid = 1 create (p)-[r: Post]->(v) return p , v
Relation with VoteType:
match(v:vote),(vt:votetype) where v.votetypeid = 1 andv.id = 1 create (v)-[r: VoteType]->(vt) return v , vt
match(v:vote),(vt:votetype) where v.votetypeid = 3 andv.id = 3 create (v)-[r: VoteType]->(vt) return v , vt
match(v:vote),(vt:votetype) where v.votetypeid = 5 andv.id = 5 create (v)-[r: VoteType]->(vt) return v , vt
Relation Ship Between User and Post
match(p:post),(u:user) where u.id = 8 and p.owneruserid = 8 create (p)-[r: PostedBy]->(u) return p, u
match(p:post),(u:user) where u.id = 5 and p.owneruserid = 5 create (p)-[r: PostedBy]->(u) return p, u
match(p:post),(u:user) where u.id = 3 and p.owneruserid = 3 create (p)-[r: PostedBy]->(u) return p, u
Reviews
There are no reviews yet.