or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

entity-parsing.mdgeographic-data.mdindex.mdinput-format.mdtweet-model.mduser-model.md

user-model.mddocs/

0

# User Data Model

1

2

Twitter user profile information including demographics, account settings, follower metrics, and profile customization data.

3

4

## Capabilities

5

6

### Users Class

7

8

Complete Twitter user profile information representing a Twitter account with all associated metadata, settings, and metrics.

9

10

```java { .api }

11

/**

12

* Represents a complete Twitter user profile with all associated metadata.

13

* Contains demographic information, account settings, and social metrics.

14

*/

15

public class Users {

16

17

/**

18

* Default constructor that initializes and resets all fields.

19

*/

20

public Users();

21

22

/**

23

* Reset all fields for object reuse (Kryo serialization optimization).

24

*/

25

public void reset();

26

27

// User identification

28

/**

29

* Get the unique identifier of the user.

30

* @return User ID as long

31

*/

32

public long getId();

33

34

/**

35

* Set the unique identifier of the user.

36

* @param id User ID as long

37

*/

38

public void setId(long id);

39

40

/**

41

* Get the string representation of the user ID.

42

* @return User ID as string (computed from numeric ID)

43

*/

44

public String getId_str();

45

46

/**

47

* Set the string representation of the user ID.

48

* @param id_str User ID as string

49

*/

50

public void setId_str(String id_str);

51

52

/**

53

* Get the user's screen name (handle).

54

* @return Screen name without @ symbol

55

*/

56

public String getScreen_name();

57

58

/**

59

* Set the user's screen name (handle).

60

* @param screen_name Screen name without @ symbol

61

*/

62

public void setScreen_name(String screen_name);

63

64

/**

65

* Get the user's display name.

66

* @return Display name

67

*/

68

public String getName();

69

70

/**

71

* Set the user's display name.

72

* @param name Display name

73

*/

74

public void setName(String name);

75

76

// Profile information

77

/**

78

* Get the user's profile description/bio.

79

* @return Profile description

80

*/

81

public String getDescription();

82

83

/**

84

* Set the user's profile description/bio.

85

* @param description Profile description

86

*/

87

public void setDescription(String description);

88

89

/**

90

* Get the user's location information.

91

* @return Location string

92

*/

93

public String getLocation();

94

95

/**

96

* Set the user's location information.

97

* @param location Location string

98

*/

99

public void setLocation(String location);

100

101

/**

102

* Get the user's profile URL.

103

* @return Profile URL

104

*/

105

public String getUrl();

106

107

/**

108

* Set the user's profile URL.

109

* @param url Profile URL

110

*/

111

public void setUrl(String url);

112

113

/**

114

* Check if the user account is verified.

115

* @return true if verified

116

*/

117

public boolean isVerified();

118

119

/**

120

* Set whether the user account is verified.

121

* @param verified true if verified

122

*/

123

public void setVerified(boolean verified);

124

125

/**

126

* Check if the user's tweets are protected.

127

* @return true if protected

128

*/

129

public boolean isProtected_tweet();

130

131

/**

132

* Set whether the user's tweets are protected.

133

* @param protected_tweet true if protected

134

*/

135

public void setProtected_tweet(boolean protected_tweet);

136

137

/**

138

* Get the user's preferred language.

139

* @return ISO 639-1 language code

140

*/

141

public String getLang();

142

143

/**

144

* Set the user's preferred language.

145

* @param lang ISO 639-1 language code

146

*/

147

public void setLang(String lang);

148

149

// Account metrics

150

/**

151

* Get the number of followers this user has.

152

* @return Follower count

153

*/

154

public long getFollowers_count();

155

156

/**

157

* Set the number of followers this user has.

158

* @param followers_count Follower count

159

*/

160

public void setFollowers_count(long followers_count);

161

162

/**

163

* Get the number of users this user is following.

164

* @return Following count (friends)

165

*/

166

public long getFriends_count();

167

168

/**

169

* Set the number of users this user is following.

170

* @param friends_count Following count (friends)

171

*/

172

public void setFriends_count(long friends_count);

173

174

/**

175

* Get the number of public lists this user is a member of.

176

* @return Listed count

177

*/

178

public long getListed_count();

179

180

/**

181

* Set the number of public lists this user is a member of.

182

* @param listed_count Listed count

183

*/

184

public void setListed_count(long listed_count);

185

186

/**

187

* Get the number of tweets this user has liked.

188

* @return Favourites count

189

*/

190

public long getFavourites_count();

191

192

/**

193

* Set the number of tweets this user has liked.

194

* @param favourites_count Favourites count

195

*/

196

public void setFavourites_count(long favourites_count);

197

198

/**

199

* Get the number of tweets posted by this user.

200

* @return Status count

201

*/

202

public long getStatuses_count();

203

204

/**

205

* Set the number of tweets posted by this user.

206

* @param statuses_count Status count

207

*/

208

public void setStatuses_count(long statuses_count);

209

210

// Account timestamps and settings

211

/**

212

* Get the account creation timestamp.

213

* @return Creation timestamp in Twitter format

214

*/

215

public String getCreated_at();

216

217

/**

218

* Set the account creation timestamp.

219

* @param created_at Creation timestamp in Twitter format

220

*/

221

public void setCreated_at(String created_at);

222

223

/**

224

* Get the user's UTC offset in seconds.

225

* @return UTC offset in seconds

226

*/

227

public long getUtc_offset();

228

229

/**

230

* Set the user's UTC offset in seconds.

231

* @param utc_offset UTC offset in seconds

232

*/

233

public void setUtc_offset(long utc_offset);

234

235

/**

236

* Get the user's time zone name.

237

* @return Time zone name

238

*/

239

public String getTime_zone();

240

241

/**

242

* Set the user's time zone name.

243

* @param time_zone Time zone name

244

*/

245

public void setTime_zone(String time_zone);

246

247

/**

248

* Check if the user has enabled geotagging.

249

* @return true if geo-enabled

250

*/

251

public boolean isGeo_enabled();

252

253

/**

254

* Set whether the user has enabled geotagging.

255

* @param geo_enabled true if geo-enabled

256

*/

257

public void setGeo_enabled(boolean geo_enabled);

258

259

// Account capabilities and settings

260

/**

261

* Check if contributors are enabled for this account.

262

* @return true if contributors enabled

263

*/

264

public boolean isContributors_enabled();

265

266

/**

267

* Set whether contributors are enabled for this account.

268

* @param contributors_enabled true if contributors enabled

269

*/

270

public void setContributors_enabled(boolean contributors_enabled);

271

272

/**

273

* Check if the user is a translator.

274

* @return true if translator

275

*/

276

public boolean isIs_translator();

277

278

/**

279

* Set whether the user is a translator.

280

* @param is_translator true if translator

281

*/

282

public void setIs_translator(boolean is_translator);

283

284

// Profile appearance

285

/**

286

* Get the profile background color.

287

* @return Hex color code

288

*/

289

public String getProfile_background_color();

290

291

/**

292

* Set the profile background color.

293

* @param profile_background_color Hex color code

294

*/

295

public void setProfile_background_color(String profile_background_color);

296

297

/**

298

* Get the profile background image URL.

299

* @return Background image URL

300

*/

301

public String getProfile_background_image_url();

302

303

/**

304

* Set the profile background image URL.

305

* @param profile_background_image_url Background image URL

306

*/

307

public void setProfile_background_image_url(String profile_background_image_url);

308

309

/**

310

* Get the HTTPS profile background image URL.

311

* @return HTTPS background image URL

312

*/

313

public String getProfile_background_image_url_https();

314

315

/**

316

* Set the HTTPS profile background image URL.

317

* @param profile_background_image_url_https HTTPS background image URL

318

*/

319

public void setProfile_background_image_url_https(String profile_background_image_url_https);

320

321

/**

322

* Check if the background image should be tiled.

323

* @return true if background tiled

324

*/

325

public boolean isProfile_background_tile();

326

327

/**

328

* Set whether the background image should be tiled.

329

* @param profile_background_tile true if background tiled

330

*/

331

public void setProfile_background_tile(boolean profile_background_tile);

332

333

/**

334

* Get the profile link color.

335

* @return Hex color code

336

*/

337

public String getProfile_link_color();

338

339

/**

340

* Set the profile link color.

341

* @param profile_link_color Hex color code

342

*/

343

public void setProfile_link_color(String profile_link_color);

344

345

/**

346

* Get the profile sidebar border color.

347

* @return Hex color code

348

*/

349

public String getProfile_sidebar_border_color();

350

351

/**

352

* Set the profile sidebar border color.

353

* @param profile_sidebar_border_color Hex color code

354

*/

355

public void setProfile_sidebar_border_color(String profile_sidebar_border_color);

356

357

/**

358

* Get the profile sidebar fill color.

359

* @return Hex color code

360

*/

361

public String getProfile_sidebar_fill_color();

362

363

/**

364

* Set the profile sidebar fill color.

365

* @param profile_sidebar_fill_color Hex color code

366

*/

367

public void setProfile_sidebar_fill_color(String profile_sidebar_fill_color);

368

369

/**

370

* Get the profile text color.

371

* @return Hex color code

372

*/

373

public String getProfile_text_color();

374

375

/**

376

* Set the profile text color.

377

* @param profile_text_color Hex color code

378

*/

379

public void setProfile_text_color(String profile_text_color);

380

381

/**

382

* Check if the profile uses background image.

383

* @return true if using background image

384

*/

385

public boolean isProfile_use_background_image();

386

387

/**

388

* Set whether the profile uses background image.

389

* @param profile_use_background_image true if using background image

390

*/

391

public void setProfile_use_background_image(boolean profile_use_background_image);

392

393

/**

394

* Get the profile image URL.

395

* @return Profile image URL

396

*/

397

public String getProfile_image_url();

398

399

/**

400

* Set the profile image URL.

401

* @param profile_image_url Profile image URL

402

*/

403

public void setProfile_image_url(String profile_image_url);

404

405

/**

406

* Get the HTTPS profile image URL.

407

* @return HTTPS profile image URL

408

*/

409

public String getProfile_image_url_https();

410

411

/**

412

* Set the HTTPS profile image URL.

413

* @param profile_image_url_https HTTPS profile image URL

414

*/

415

public void setProfile_image_url_https(String profile_image_url_https);

416

417

/**

418

* Get the profile banner URL.

419

* @return Profile banner URL

420

*/

421

public String getProfile_banner_url();

422

423

/**

424

* Set the profile banner URL.

425

* @param profile_banner_url Profile banner URL

426

*/

427

public void setProfile_banner_url(String profile_banner_url);

428

429

/**

430

* Check if using the default profile theme.

431

* @return true if default profile

432

*/

433

public boolean isDefault_profile();

434

435

/**

436

* Set whether using the default profile theme.

437

* @param default_profile true if default profile

438

*/

439

public void setDefault_profile(boolean default_profile);

440

441

/**

442

* Check if using the default profile image.

443

* @return true if default profile image

444

*/

445

public boolean isDefault_profile_image();

446

447

/**

448

* Set whether using the default profile image.

449

* @param default_profile_image true if default profile image

450

*/

451

public void setDefault_profile_image(boolean default_profile_image);

452

453

// Relationship status (from authenticated user's perspective)

454

/**

455

* Check if the authenticated user is following this user.

456

* @return true if following

457

*/

458

public boolean isFollowing();

459

460

/**

461

* Set whether the authenticated user is following this user.

462

* @param following true if following

463

*/

464

public void setFollowing(boolean following);

465

466

/**

467

* Check if a follow request has been sent to this user.

468

* @return true if follow request sent

469

*/

470

public boolean isFollow_request_sent();

471

472

/**

473

* Set whether a follow request has been sent to this user.

474

* @param follow_request_sent true if follow request sent

475

*/

476

public void setFollow_request_sent(boolean follow_request_sent);

477

478

/**

479

* Check if notifications are enabled for this user.

480

* @return true if notifications enabled

481

*/

482

public boolean isNotifications();

483

484

/**

485

* Set whether notifications are enabled for this user.

486

* @param notifications true if notifications enabled

487

*/

488

public void setNotifications(boolean notifications);

489

490

/**

491

* Get the entities parsed from user profile fields.

492

* @return Entities object containing URLs from profile

493

*/

494

public Entities getEntities();

495

496

/**

497

* Set the entities parsed from user profile fields.

498

* @param entities Entities object containing URLs from profile

499

*/

500

public void setEntities(Entities entities);

501

}

502

```

503

504

**Usage Examples:**

505

506

```java

507

import org.apache.flink.contrib.tweetinputformat.model.User.Users;

508

509

// Basic user information

510

Users user = tweet.getUser();

511

System.out.println("User: @" + user.getScreen_name() + " (" + user.getName() + ")");

512

System.out.println("Bio: " + user.getDescription());

513

System.out.println("Location: " + user.getLocation());

514

System.out.println("Followers: " + user.getFollowers_count());

515

System.out.println("Following: " + user.getFriends_count());

516

517

// Account verification and protection

518

if (user.isVerified()) {

519

System.out.println("βœ“ Verified account");

520

}

521

if (user.isProtected_tweet()) {

522

System.out.println("πŸ”’ Protected tweets");

523

}

524

525

// Account age and activity

526

System.out.println("Member since: " + user.getCreated_at());

527

System.out.println("Total tweets: " + user.getStatuses_count());

528

System.out.println("Total likes: " + user.getFavourites_count());

529

530

// Profile customization

531

if (!user.isDefault_profile()) {

532

System.out.println("Custom profile theme");

533

System.out.println("Background color: #" + user.getProfile_background_color());

534

System.out.println("Link color: #" + user.getProfile_link_color());

535

}

536

537

// Profile images

538

System.out.println("Profile image: " + user.getProfile_image_url_https());

539

if (!user.getProfile_banner_url().isEmpty()) {

540

System.out.println("Banner image: " + user.getProfile_banner_url());

541

}

542

543

// Geographic and language settings

544

if (user.isGeo_enabled()) {

545

System.out.println("Geotagging enabled");

546

}

547

System.out.println("Language: " + user.getLang());

548

if (!user.getTime_zone().isEmpty()) {

549

System.out.println("Time zone: " + user.getTime_zone());

550

}

551

```

552

553

## User Analysis Patterns

554

555

Common patterns for analyzing user data in stream processing:

556

557

```java

558

// High-influence users

559

tweets.filter(tweet -> {

560

Users user = tweet.getUser();

561

return user.isVerified() && user.getFollowers_count() > 100000;

562

});

563

564

// Active users

565

tweets.filter(tweet -> {

566

Users user = tweet.getUser();

567

return user.getStatuses_count() > 1000 &&

568

user.getFriends_count() > 100;

569

});

570

571

// Geographic analysis

572

tweets.filter(tweet -> {

573

Users user = tweet.getUser();

574

return user.isGeo_enabled() &&

575

!user.getLocation().isEmpty();

576

});

577

578

// Account age analysis

579

tweets.map(tweet -> {

580

Users user = tweet.getUser();

581

// Parse created_at and calculate account age

582

return new UserMetrics(

583

user.getScreen_name(),

584

parseTwitterDate(user.getCreated_at()),

585

user.getFollowers_count(),

586

user.getStatuses_count()

587

);

588

});

589

```