Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DBS-project
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hlm
DBS-project
Commits
f12113e8
Commit
f12113e8
authored
8 years ago
by
Maria Hartmann
Browse files
Options
Downloads
Patches
Plain Diff
modified
parent
54773273
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Clean_commented(1).java
+31
-30
31 additions, 30 deletions
Clean_commented(1).java
with
31 additions
and
30 deletions
Clean_commented.java
→
Clean_commented
(1)
.java
+
31
−
30
View file @
f12113e8
...
...
@@ -318,7 +318,7 @@ public class Clean {
for
(
int
i
=
0
;
i
<
str
.
length
();
i
++){
char
sign
=
str
.
charAt
(
i
);
if
(
sign
==
';'
){
str
=
str
.
substring
(
0
,
i
-
1
)+
"
,
"
+
str
.
substring
(
i
+
1
);
str
=
str
.
substring
(
0
,
i
-
1
)+
"
ß
"
+
str
.
substring
(
i
+
1
);
}
}
return
str
;
...
...
@@ -400,6 +400,7 @@ public class Clean {
}
String
tweet_text
=
values
[
1
];
//set remaining variables
String
tweet_time
=
values
[
4
];
tweet_text
=
tweet_text
.
replace
(
"ß"
,
";"
);
int
ID
=
counter
;
int
retweet_count
=
Integer
.
parseInt
(
values
[
7
]);
int
favorite_count
=
Integer
.
parseInt
(
values
[
8
]);
...
...
@@ -547,33 +548,33 @@ public class Clean {
//------------CREATE the Table-----------------------------tweeter_user---------
//
String creat_user="CREATE TABLE tweeter_user (id serial NOT NULL," +
//
"handle text NOT NULL, " +
//
"PRIMARY KEY (id))";
//
stmt2.executeUpdate(creat_user);
String
creat_user
=
"CREATE TABLE tweeter_user (id serial NOT NULL,"
+
"handle text NOT NULL, "
+
"PRIMARY KEY (id))"
;
stmt2
.
executeUpdate
(
creat_user
);
////------------CREATE the Table-----------------------------tweeter_hashtag---------
//
String creat_hashtags="CREATE TABLE hashtags (id serial NOT NULL," +
//
"hashtag_text text NOT NULL," +
//
"PRIMARY KEY (id))";
//
stmt3.executeUpdate(creat_hashtags);
//
String
creat_hashtags
=
"CREATE TABLE hashtags (id serial NOT NULL,"
+
"hashtag_text text NOT NULL,"
+
"PRIMARY KEY (id))"
;
stmt3
.
executeUpdate
(
creat_hashtags
);
//------------Transfer the Table-----------------------------hashTag---------
//
for(int i=0; i<size_hashtagList;i++){
//
Hashtag tmpHash=hashtagList.get(i);
//
//
String ID=Integer.toString(tmpHash.get_hashtag_ID());
//
String hashtag_text=tmpHash.get_hashtag_text();
//
//
//
String hashtag_SQL="INSERT INTO hashtags(id, hashtag_text)" +
//
"VALUES("+ID+",'"+hashtag_text+"')";
//
stmt4.executeUpdate(hashtag_SQL);
//
}
for
(
int
i
=
0
;
i
<
size_hashtagList
;
i
++){
Hashtag
tmpHash
=
hashtagList
.
get
(
i
);
String
ID
=
Integer
.
toString
(
tmpHash
.
get_hashtag_ID
());
String
hashtag_text
=
tmpHash
.
get_hashtag_text
();
String
hashtag_SQL
=
"INSERT INTO hashtags(id, hashtag_text)"
+
"VALUES("
+
ID
+
",'"
+
hashtag_text
+
"')"
;
stmt4
.
executeUpdate
(
hashtag_SQL
);
}
//------------Transfer the Table-----------------------------Tweet---------
for
(
int
i
=
0
;
i
<
size_tweetList
;
i
++){
...
...
@@ -613,15 +614,15 @@ public class Clean {
}
//------------Transfer the Table-----------------------------USER---------
//
for(int i=0; i<size_userList;i++){
//
User tmpUser=userList.get(i);
//
String user_id=Integer.toString(tmpUser.user_id);
//
String handle=tmpUser.handle;
//
//
String user_SQL="INSERT INTO tweeter_user(id, handle)" +
//
"VALUES("+user_id+",'"+handle+"')";
//
stmt6.executeUpdate(user_SQL);
//
for
(
int
i
=
0
;
i
<
size_userList
;
i
++){
User
tmpUser
=
userList
.
get
(
i
);
String
user_id
=
Integer
.
toString
(
tmpUser
.
user_id
);
String
handle
=
tmpUser
.
handle
;
String
user_SQL
=
"INSERT INTO tweeter_user(id, handle)"
+
"VALUES("
+
user_id
+
",'"
+
handle
+
"')"
;
stmt6
.
executeUpdate
(
user_SQL
);
//
//
// }
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment