Skip to content

Commit f6770aa

Browse files
committed
first commit
0 parents  commit f6770aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+7937
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
target/
3+
application.properties

Aztec-Digest.iml

+274
Large diffs are not rendered by default.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
****Aztec-Digest

pom.xml

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.aztec.digest</groupId>
8+
<artifactId>digest</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<name>Aztec Digest</name>
11+
<description>Aztec Digest v1</description>
12+
13+
<parent>
14+
<groupId>org.springframework.boot</groupId>
15+
<artifactId>spring-boot-starter-parent</artifactId>
16+
<version>1.5.7.RELEASE</version>
17+
<relativePath/> <!-- lookup parent from repository -->
18+
</parent>
19+
20+
<properties>
21+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
22+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
23+
<java.version>1.8</java.version>
24+
</properties>
25+
26+
27+
<dependencies>
28+
<dependency>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-starter-web</artifactId>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-test</artifactId>
41+
<scope>test</scope>
42+
</dependency>
43+
44+
<dependency>
45+
<groupId>org.json</groupId>
46+
<artifactId>json</artifactId>
47+
</dependency>
48+
<dependency>
49+
<groupId>com.google.code.gson</groupId>
50+
<artifactId>gson</artifactId>
51+
<version>2.8.2</version>
52+
</dependency>
53+
54+
<dependency>
55+
<groupId>org.jdom2</groupId>
56+
<artifactId>jdom2</artifactId>
57+
</dependency>
58+
59+
<dependency>
60+
<groupId>com.google.code.gson</groupId>
61+
<artifactId>gson</artifactId>
62+
<version>2.8.2</version>
63+
</dependency>
64+
<dependency>
65+
<groupId>javax.mail</groupId>
66+
<artifactId>mail</artifactId>
67+
<version>1.5.0-b01</version>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.apache.solr</groupId>
71+
<artifactId>solr-solrj</artifactId>
72+
<version>6.6.1</version>
73+
</dependency>
74+
<dependency>
75+
<groupId>com.github.BD2K-Aztec</groupId>
76+
<artifactId>Aztec-Cermine</artifactId>
77+
<version>v1.0.5</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.deeplearning4j</groupId>
81+
<artifactId>deeplearning4j-core</artifactId>
82+
<version>0.9.1</version>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.deeplearning4j</groupId>
86+
<artifactId>deeplearning4j-nlp</artifactId>
87+
<version>0.9.1</version>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.nd4j</groupId>
91+
<artifactId>nd4j-native</artifactId>
92+
<version>0.9.1</version>
93+
</dependency>
94+
</dependencies>
95+
96+
<repositories>
97+
<repository>
98+
<id>jitpack.io</id>
99+
<url>https://jitpack.io</url>
100+
</repository>
101+
</repositories>
102+
103+
104+
105+
106+
107+
108+
</project>

src/.DS_Store

6 KB
Binary file not shown.

src/main/.DS_Store

6 KB
Binary file not shown.
+269
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
package attributes;
2+
3+
import attributes.abstrakt.Abstract;
4+
import attributes.affiliations.Affiliations;
5+
import attributes.authors.Authors;
6+
import attributes.contact.ContactInfo;
7+
import attributes.date.PublicationDate;
8+
import attributes.doi.DOI;
9+
import attributes.language.Language;
10+
import attributes.title.Title;
11+
import attributes.url.Url;
12+
import org.json.JSONObject;
13+
import org.json.XML;
14+
15+
import java.util.ArrayList;
16+
import java.util.Calendar;
17+
import java.util.List;
18+
19+
public class Attributes implements Runnable {
20+
private final String title;
21+
private final String name;
22+
private final String abstrakt;
23+
private final String summary="";
24+
private final List<String> authors;
25+
private final List<String> affiliations;
26+
private final List<String> contact;
27+
private final String doi;
28+
private final String date;
29+
private final String status;
30+
private final List<String> URLs;
31+
private final List<String> tags=new ArrayList<>();
32+
private List<String> funding;
33+
private String language;
34+
private CodeStats cs;
35+
36+
private final JSONObject xmlJSONObj;
37+
private final String m_nlm;
38+
// private List<FundingInfo> funding_list;
39+
40+
private JSONObject final_object;
41+
42+
// ------------------------------------------------------------- //
43+
44+
public Attributes(String nlm, String filename, boolean fromPMC) throws Exception {
45+
m_nlm = nlm;
46+
xmlJSONObj = XML.toJSONObject(nlm);
47+
funding = null;
48+
language = null;
49+
cs = null;
50+
51+
run();
52+
53+
Calendar title_start = Calendar.getInstance();
54+
Title t = new Title(xmlJSONObj);
55+
title = t.getTitle();
56+
Calendar title_end = Calendar.getInstance();
57+
58+
Calendar author_start = Calendar.getInstance();
59+
Authors au = new Authors(xmlJSONObj,fromPMC);
60+
authors = au.getAuthors();
61+
for (int i = 0; i < authors.size(); i++) {
62+
authors.set(i, authors.get(i).trim());
63+
}
64+
Calendar author_end = Calendar.getInstance();
65+
Calendar aff_start = Calendar.getInstance();
66+
Affiliations aff = new Affiliations(xmlJSONObj,fromPMC);
67+
affiliations = aff.getAffiliations();
68+
for (int i = 0; i < affiliations.size(); i++) {
69+
affiliations.set(i, affiliations.get(i).trim());
70+
}
71+
Calendar aff_end = Calendar.getInstance();
72+
Calendar contact_start = Calendar.getInstance();
73+
ContactInfo con = new ContactInfo(nlm, fromPMC);
74+
contact = con.getContact();
75+
for (int i = 0; i < contact.size(); i++) {
76+
contact.set(i, contact.get(i).trim());
77+
}
78+
Calendar contact_end = Calendar.getInstance();
79+
Calendar doi_start = Calendar.getInstance();
80+
DOI d2 = new DOI(xmlJSONObj, fromPMC);
81+
doi = d2.getDoi();
82+
Calendar doi_end = Calendar.getInstance();
83+
Calendar date_start = Calendar.getInstance();
84+
PublicationDate d = new PublicationDate(xmlJSONObj, fromPMC);
85+
date = d.getDate();
86+
Calendar date_end = Calendar.getInstance();
87+
88+
89+
Calendar url_start = Calendar.getInstance();
90+
Url url_link = new Url(xmlJSONObj, filename);
91+
URLs = url_link.getUrl();
92+
for (int i = 0; i < URLs.size(); i++) {
93+
URLs.set(i, URLs.get(i).trim());
94+
}
95+
96+
if(URLs.isEmpty()){
97+
status = "URL links are no longer valid";
98+
}else{
99+
status = "Success";
100+
}
101+
Calendar url_end = Calendar.getInstance();
102+
103+
104+
Calendar abstract_start = Calendar.getInstance();
105+
Abstract a = new Abstract(nlm,fromPMC);
106+
abstrakt = a.getAbstract().trim();
107+
Calendar abstract_end = Calendar.getInstance();
108+
109+
Calendar name_start = Calendar.getInstance();
110+
ToolName tool_name = new ToolName(title, URLs);
111+
112+
if(tool_name.getName()==null){
113+
name = "";
114+
}else{
115+
name = tool_name.getName();
116+
}
117+
Calendar name_end = Calendar.getInstance();
118+
119+
120+
121+
Calendar lang_start = Calendar.getInstance();
122+
String code_url = "";
123+
for(String url: URLs){
124+
if(url.contains("github")){
125+
code_url = url;
126+
cs = new CodeStats(code_url, name);
127+
if(cs.hasStats()){
128+
break;
129+
}
130+
}
131+
if(url.contains("sourceforge") || url.contains("bitbucket")){
132+
code_url = url;
133+
}
134+
}
135+
if(cs==null){
136+
cs = new CodeStats(code_url, name);
137+
}
138+
139+
140+
final_object = new JSONObject();
141+
final_object.put("publicationTitle", title);
142+
final_object.put("publicationAbstract", abstrakt);
143+
final_object.put("title", title);
144+
final_object.put("authors", authors.toArray());
145+
final_object.put("institutions", affiliations.toArray());
146+
final_object.put("contactInfo", contact.toArray());
147+
final_object.put("publicationDOI", doi);
148+
final_object.put("publicationDate", date);
149+
final_object.put("URLs", URLs.toArray());
150+
final_object.put("status", status);
151+
final_object.put("toolName", name);
152+
final_object.put("fulltext", this.m_nlm.replaceAll("<.*?>", " "));
153+
154+
if(cs.hasStats()) {
155+
final_object.put("programmingLanguage", cs.getLanguage());
156+
final_object.put("forks", cs.getForks());
157+
final_object.put("shortDescription", cs.getDescription());
158+
final_object.put("license", cs.getLicense());
159+
final_object.put("sourceCodeLink", cs.getRepo_link());
160+
final_object.put("dateCreated", cs.getDate_created());
161+
final_object.put("dateUpdated", cs.getDate_updated());
162+
final_object.put("downloads", cs.getDownloads());
163+
final_object.put("codeSize", cs.getSize());
164+
final_object.put("sourceCodeLink", cs.getRepo_link());
165+
final_object.put("numIssues", cs.getIssues());
166+
final_object.put("subscribers", cs.getSubscribers());
167+
if(!cs.getHomepage().isEmpty()) {
168+
final_object.put("homepage", cs.getHomepage());
169+
}
170+
if(cs.getRepo_name()!=null && !cs.getRepo_name().isEmpty()){
171+
final_object.put("toolName", cs.getRepo_name());
172+
}
173+
174+
Calendar lang_end = Calendar.getInstance();
175+
}
176+
}
177+
178+
// ------------------------------------------------------------ //
179+
180+
public void run() {
181+
try {
182+
Calendar funding_start = Calendar.getInstance();
183+
// Funding f = new Funding(m_nlm, 0);
184+
// funding_list = f.getFunding();
185+
Calendar funding_end = Calendar.getInstance();
186+
// System.out.println("Time funding: ");
187+
// System.out.println(funding_end.getTimeInMillis() - funding_start.getTimeInMillis());
188+
} catch (Exception e) {
189+
e.printStackTrace();
190+
}
191+
}
192+
193+
public void setID(int id){
194+
final_object.put("id", id);
195+
}
196+
197+
public String getTitle(){
198+
return title;
199+
}
200+
201+
public String getName() {
202+
return name;
203+
}
204+
205+
public String getSummary() {
206+
return summary;
207+
}
208+
209+
public List<String> getAuthor(){
210+
return authors;
211+
}
212+
213+
public List<String> getAffiliation(){
214+
return affiliations;
215+
}
216+
217+
public String getAbstrakt(){
218+
return abstrakt;
219+
}
220+
221+
public List<String> getContact(){
222+
return contact;
223+
}
224+
225+
public String getDOI(){
226+
return doi;
227+
}
228+
229+
public String getDate() {
230+
return date;
231+
}
232+
233+
public String getStatus() {
234+
return status;
235+
}
236+
237+
public List<String> getURL(){
238+
return URLs;
239+
}
240+
241+
// private List<FundingInfo> getFundingList() {
242+
// return funding_list;
243+
// }
244+
245+
public List<String> getFundingStr() {
246+
// List<String> fa = new ArrayList<>();
247+
// for (FundingInfo fi : getFundingList()) {
248+
// fa.add(fi.toString());
249+
// }
250+
// funding = fa;
251+
return this.funding;
252+
}
253+
254+
public String getLanguage(){
255+
return language;
256+
}
257+
258+
public List<String> getTags(){
259+
return tags;
260+
}
261+
262+
public JSONObject getFinalJSONObject(){
263+
return final_object;
264+
}
265+
266+
public CodeStats getCodeStats() {
267+
return cs;
268+
}
269+
}

0 commit comments

Comments
 (0)