Skip to content

Commit fae104f

Browse files
committed
Just want to commit something
1 parent 154553a commit fae104f

File tree

5 files changed

+358
-10
lines changed

5 files changed

+358
-10
lines changed

Entities/Actor.java

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
package Entities;
2+
3+
import java.util.Date;
4+
5+
/**
6+
* Created by liuche on 5/4/17.
7+
*/
8+
public class Actor {
9+
String birthday;
10+
String birthplace;
11+
Integer deg;
12+
String name;
13+
String lastModified;
14+
String id;
15+
String biography;
16+
Integer version;
17+
String profileImageUrl;
18+
19+
public String getBirthday() {
20+
return birthday;
21+
}
22+
23+
public void setBirthday(String birthday) {
24+
this.birthday = birthday;
25+
}
26+
27+
public String getBirthplace() {
28+
return birthplace;
29+
}
30+
31+
public void setBirthplace(String birthplace) {
32+
this.birthplace = birthplace;
33+
}
34+
35+
public Integer getDeg() {
36+
return deg;
37+
}
38+
39+
public void setDeg(Integer deg) {
40+
this.deg = deg;
41+
}
42+
43+
public String getName() {
44+
return name;
45+
}
46+
47+
public void setName(String name) {
48+
this.name = name;
49+
}
50+
51+
public String getLastModified() {
52+
return lastModified;
53+
}
54+
55+
public void setLastModified(String lastModified) {
56+
this.lastModified = lastModified;
57+
}
58+
59+
public String getId() {
60+
return id;
61+
}
62+
63+
public void setId(String id) {
64+
this.id = id;
65+
}
66+
67+
public String getBiography() {
68+
return biography;
69+
}
70+
71+
public void setBiography(String biography) {
72+
this.biography = biography;
73+
}
74+
75+
public Integer getVersion() {
76+
return version;
77+
}
78+
79+
public void setVersion(Integer version) {
80+
this.version = version;
81+
}
82+
83+
public String getProfileImageUrl() {
84+
return profileImageUrl;
85+
}
86+
87+
public void setProfileImageUrl(String profileImageUrl) {
88+
this.profileImageUrl = profileImageUrl;
89+
}
90+
91+
@Override
92+
public boolean equals(Object o) {
93+
if (this == o) return true;
94+
if (o == null || getClass() != o.getClass()) return false;
95+
96+
Actor actor = (Actor) o;
97+
98+
if (birthday != null ? !birthday.equals(actor.birthday) : actor.birthday != null) return false;
99+
if (birthplace != null ? !birthplace.equals(actor.birthplace) : actor.birthplace != null) return false;
100+
if (deg != null ? !deg.equals(actor.deg) : actor.deg != null) return false;
101+
if (name != null ? !name.equals(actor.name) : actor.name != null) return false;
102+
if (lastModified != null ? !lastModified.equals(actor.lastModified) : actor.lastModified != null) return false;
103+
if (id != null ? !id.equals(actor.id) : actor.id != null) return false;
104+
if (biography != null ? !biography.equals(actor.biography) : actor.biography != null) return false;
105+
if (version != null ? !version.equals(actor.version) : actor.version != null) return false;
106+
return profileImageUrl != null ? profileImageUrl.equals(actor.profileImageUrl) : actor.profileImageUrl == null;
107+
108+
}
109+
110+
@Override
111+
public int hashCode() {
112+
int result = birthday != null ? birthday.hashCode() : 0;
113+
result = 31 * result + (birthplace != null ? birthplace.hashCode() : 0);
114+
result = 31 * result + (deg != null ? deg.hashCode() : 0);
115+
result = 31 * result + (name != null ? name.hashCode() : 0);
116+
result = 31 * result + (lastModified != null ? lastModified.hashCode() : 0);
117+
result = 31 * result + (id != null ? id.hashCode() : 0);
118+
result = 31 * result + (biography != null ? biography.hashCode() : 0);
119+
result = 31 * result + (version != null ? version.hashCode() : 0);
120+
result = 31 * result + (profileImageUrl != null ? profileImageUrl.hashCode() : 0);
121+
return result;
122+
}
123+
}

Entities/Movie.java

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
package Entities;
2+
3+
/**
4+
* Created by liuche on 5/4/17.
5+
*/
6+
public class Movie {
7+
String studio;
8+
String releaseDate;
9+
String imdbId;
10+
Integer runtime;
11+
String description;
12+
String language;
13+
String title;
14+
Integer version;
15+
String imageUrl;
16+
String genre;
17+
String tagline;
18+
String lastModified;
19+
String id;
20+
String homepage;
21+
22+
public String getStudio() {
23+
return studio;
24+
}
25+
26+
public String getReleaseDate() {
27+
return releaseDate;
28+
}
29+
30+
public String getImdbId() {
31+
return imdbId;
32+
}
33+
34+
public Integer getRuntime() {
35+
return runtime;
36+
}
37+
38+
public String getDescription() {
39+
return description;
40+
}
41+
42+
public String getLanguage() {
43+
return language;
44+
}
45+
46+
public String getTitle() {
47+
return title;
48+
}
49+
50+
public Integer getVersion() {
51+
return version;
52+
}
53+
54+
public String getImageUrl() {
55+
return imageUrl;
56+
}
57+
58+
public String getGenre() {
59+
return genre;
60+
}
61+
62+
public String getTagline() {
63+
return tagline;
64+
}
65+
66+
public String getLastModified() {
67+
return lastModified;
68+
}
69+
70+
public String getId() {
71+
return id;
72+
}
73+
74+
public String getHomepage() {
75+
return homepage;
76+
}
77+
78+
public void setStudio(String studio) {
79+
this.studio = studio;
80+
}
81+
82+
public void setReleaseDate(String releaseDate) {
83+
this.releaseDate = releaseDate;
84+
}
85+
86+
public void setImdbId(String imdbId) {
87+
this.imdbId = imdbId;
88+
}
89+
90+
public void setRuntime(Integer runtime) {
91+
this.runtime = runtime;
92+
}
93+
94+
public void setDescription(String description) {
95+
this.description = description;
96+
}
97+
98+
public void setLanguage(String language) {
99+
this.language = language;
100+
}
101+
102+
public void setTitle(String title) {
103+
this.title = title;
104+
}
105+
106+
public void setVersion(Integer version) {
107+
this.version = version;
108+
}
109+
110+
public void setImageUrl(String imageUrl) {
111+
this.imageUrl = imageUrl;
112+
}
113+
114+
public void setGenre(String genre) {
115+
this.genre = genre;
116+
}
117+
118+
public void setTagline(String tagline) {
119+
this.tagline = tagline;
120+
}
121+
122+
public void setLastModified(String lastModified) {
123+
this.lastModified = lastModified;
124+
}
125+
126+
public void setId(String id) {
127+
this.id = id;
128+
}
129+
130+
public void setHomepage(String homepage) {
131+
this.homepage = homepage;
132+
}
133+
134+
@Override
135+
public boolean equals(Object o) {
136+
if (this == o) return true;
137+
if (o == null || getClass() != o.getClass()) return false;
138+
139+
Movie movie = (Movie) o;
140+
141+
if (studio != null ? !studio.equals(movie.studio) : movie.studio != null) return false;
142+
if (releaseDate != null ? !releaseDate.equals(movie.releaseDate) : movie.releaseDate != null) return false;
143+
if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false;
144+
if (runtime != null ? !runtime.equals(movie.runtime) : movie.runtime != null) return false;
145+
if (description != null ? !description.equals(movie.description) : movie.description != null) return false;
146+
if (language != null ? !language.equals(movie.language) : movie.language != null) return false;
147+
if (title != null ? !title.equals(movie.title) : movie.title != null) return false;
148+
if (version != null ? !version.equals(movie.version) : movie.version != null) return false;
149+
if (imageUrl != null ? !imageUrl.equals(movie.imageUrl) : movie.imageUrl != null) return false;
150+
if (genre != null ? !genre.equals(movie.genre) : movie.genre != null) return false;
151+
if (tagline != null ? !tagline.equals(movie.tagline) : movie.tagline != null) return false;
152+
if (lastModified != null ? !lastModified.equals(movie.lastModified) : movie.lastModified != null) return false;
153+
if (id != null ? !id.equals(movie.id) : movie.id != null) return false;
154+
return homepage != null ? homepage.equals(movie.homepage) : movie.homepage == null;
155+
156+
}
157+
158+
@Override
159+
public int hashCode() {
160+
int result = studio != null ? studio.hashCode() : 0;
161+
result = 31 * result + (releaseDate != null ? releaseDate.hashCode() : 0);
162+
result = 31 * result + (imdbId != null ? imdbId.hashCode() : 0);
163+
result = 31 * result + (runtime != null ? runtime.hashCode() : 0);
164+
result = 31 * result + (description != null ? description.hashCode() : 0);
165+
result = 31 * result + (language != null ? language.hashCode() : 0);
166+
result = 31 * result + (title != null ? title.hashCode() : 0);
167+
result = 31 * result + (version != null ? version.hashCode() : 0);
168+
result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
169+
result = 31 * result + (genre != null ? genre.hashCode() : 0);
170+
result = 31 * result + (tagline != null ? tagline.hashCode() : 0);
171+
result = 31 * result + (lastModified != null ? lastModified.hashCode() : 0);
172+
result = 31 * result + (id != null ? id.hashCode() : 0);
173+
result = 31 * result + (homepage != null ? homepage.hashCode() : 0);
174+
return result;
175+
}
176+
}

Entities/NodeRecord.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package Entities;
2+
3+
import java.util.ArrayList;
4+
5+
/**
6+
* Created by liuche on 5/5/17.
7+
*/
8+
public class NodeRecord {
9+
Actor Node1;
10+
Movie Node2;
11+
ArrayList<String> node1Label, node2Label;
12+
String rel_type;
13+
NodeRelation relationship;
14+
15+
}

Entities/NodeRelation.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package Entities;
2+
3+
/**
4+
* Created by liuche on 5/5/17.
5+
*/
6+
public class NodeRelation {
7+
String relationship;
8+
9+
public String getRelationship() {
10+
return relationship;
11+
}
12+
13+
public void setRelationship(String relationship) {
14+
this.relationship = relationship;
15+
}
16+
17+
@Override
18+
public boolean equals(Object o) {
19+
if (this == o) return true;
20+
if (o == null || getClass() != o.getClass()) return false;
21+
22+
NodeRelation that = (NodeRelation) o;
23+
24+
return relationship != null ? relationship.equals(that.relationship) : that.relationship == null;
25+
26+
}
27+
28+
@Override
29+
public int hashCode() {
30+
return relationship != null ? relationship.hashCode() : 0;
31+
}
32+
}

Main.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@
33
// Deployment:
44
// Maven add commons-csv-1.4, mongodb-driver-3.4.2
55

6-
import org.apache.commons.csv.CSVFormat;
7-
import org.apache.commons.csv.CSVRecord;
8-
6+
import java.io.BufferedReader;
97
import java.io.FileReader;
10-
import java.io.Reader;
8+
import javax.json.*;
119

1210
public class Main {
1311

1412
public static void main(String[] args){
1513
// Parsing this CSV file:
1614

17-
try {
18-
Reader in = new FileReader("src/sample.csv");
19-
Iterable<CSVRecord> records = CSVFormat.EXCEL.parse(in);
20-
for (CSVRecord record : records) {
21-
System.out.println(record.toString());
15+
try (BufferedReader br = new BufferedReader(new FileReader("src/sample.csv"))) {
16+
String line;
17+
while ((line = br.readLine()) != null) {
18+
String line2 = line.replaceAll("\"\"([A-Za-z0-9]+)\"\" ", "'$1'")
19+
.replaceAll("\"\"", "\"")
20+
.substring(1);
21+
line2 = line2.substring(0, line2.length() - 1);
22+
System.out.println(line2);
23+
2224
}
23-
}catch (Exception e){
25+
}catch(Exception e){
2426

2527
}
2628
}

0 commit comments

Comments
 (0)