forked from community-graph/graphql-community
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommunity-graph.schema
165 lines (150 loc) · 4.33 KB
/
community-graph.schema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
interface Content {
id: ID!
title: String
created: Int
tags: [Tag] @relation(name:"TAGGED")
}
type Link {
url: ID!
referrer: [Content] @relation(name:"LINKED", direction:"IN")
score(daysAgo: Int = 7): Int @cypher(statement:"WITH {this} AS link MATCH (link)<--(t:Tweet:Content) WHERE not(t:Retweet) AND coalesce(toInteger(t.created),0) > (timestamp()/1000 - 7 * 24 * 60 * 60) WITH collect(t) as tweets RETURN REDUCE(acc = 0, tweet IN tweets | acc + tweet.favorites + size((tweet)<-[:RETWEETED]-())) AS score")
}
type Tag {
name: ID!
tagged: [Content] @relation(name:"TAGGED", direction:"IN")
related: [Tag] @cypher(statement:"WITH {this} as this MATCH (this)<-[:TAGGED]-(:Content)-[:TAGGED]->(tag) WITH tag, count(*) as freq ORDER BY freq DESC LIMIT 10 RETURN tag")
}
type Tweet implements Content {
id: ID!
title: String
text: String
created: Int
favorites: Int
reply: Tweet @relation(name:"REPLIED_TO")
retweeted: Tweet @relation(name:"RETWEETED")
postedBy: User @relation(name:"POSTED", direction:"IN")
mentioned: [User] @relation(name:"MENTIONED")
tags: [Tag] @relation(name:"TAGGED")
links: [Link] @relation(name:"LINKED")
}
type User {
id: ID!
type: String
repositories: [Repository] @relation(name:"CREATED")
questions: [Question] @relation(name:"POSTED")
answers: [Answer] @relation(name:"POSTED")
reputation: Int
screen_name: String!
name: String
location: String
followers: Int
following: Int
statuses: Int
profile_image_url: String
posted: [Tweet] @relation(name:"POSTED")
tagged: [Tag] @relation(name:"TAGGED")
}
type Repository implements Content {
id: ID!
title: String!
full_name: String
url: String
created: Int
homepage: String
favorites: Int
updated: Int
pushed: Int
size: Int
score: Float
watchers: Int
language: String
forks: Int
open_issues: Int
branch: String
description: String
owner: User @relation(name:"CREATED", direction: "IN")
tags: [Tag] @relation(name:"TAGGED")
}
type Question implements Content {
id: ID!
title: String
link: String
score: Int
text: String
closed_date: Int
closed_reason: String
comment_count: Int
favorites: Int
view_count: Int
comment_count: Int
is_answered: Boolean
created: Int
updated: Int
answers: [Answer] @relation(name:"ANSWERED", direction:"IN")
author: User @relation(name:"POSTED", direction:"IN")
tags: [Tag] @relation(name:"TAGGED")
}
type Answer implements Content {
id: ID!
title: String @cypher(statement:"WITH {this} as this MATCH (this)-[:ANSWERED]->(q) RETURN q.title")
text: String
comment_count: Int
is_accepted: Boolean
created: Int
score: Int
question: Question @relation(name:"ANSWERED")
author: User @relation(name:"POSTED", direction:"IN")
tags: [Tag] @relation(name:"TAGGED")
}
type Group implements Content {
id: ID!
title: String!
created: Int
tags: [Tag] @relation(name:"TAGGED")
country: String
city: String
latitude: Float
longitude: Float
link: String
text: String
memberCount: Int @cypher(statement:"RETURN ({this}).members")
score: Float @cypher(statement:"RETURN ({this}).rating")
members: [User] @relation(name:"JOINED",direction:"IN")
key: String
events: [Event] @relation(name:"CONTAINED")
owners: [User] @relation(name:"CREATED", direction:"IN")
}
type Event implements Content {
id: ID!
title: String!
created: Int
tags: [Tag] @relation(name:"TAGGED")
past: Boolean @cypher(statement:"WITH {this} as event RETURN event:Past")
status: String
rsvp_limit: Int
yes_rsvp_count: Int
maybe_rsvp_count : Int
score: Float @cypher(statement:"return {this).ratings")
headcount: Int,
text: String,
link: String,
utc_offset: Int
time: Int
updated: Int
waitlist_count: Int
attendees: [User] @relation(name:"ATTENDED",direction:"IN")
owner: [User] @relation(name:"CREATED",direction:"IN")
venue: [Venue] @relation(name:"HOSTED",direction:"IN")
group: Group @relation(name:"CONTAINED",direction:"IN")
}
type Venue {
id:ID!
name:String
address: String
city:String
country:String
country_name:String
latitude: Float
longitude:Float
events: [Event] @relation(name:"HOSTED")
}