Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
B
biotools-git-populous
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
INB
ELIXIR
tools-platform
biotools-git-populous
Commits
55790a3a
Commit
55790a3a
authored
Nov 07, 2019
by
redmitry@list.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse "metadata" for publications
parent
9e738d16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
4 deletions
+54
-4
src/main/java/es/bsc/inb/elixir/biotools/git/populous/BiotoolsConverter.java
...c/inb/elixir/biotools/git/populous/BiotoolsConverter.java
+54
-4
No files found.
src/main/java/es/bsc/inb/elixir/biotools/git/populous/BiotoolsConverter.java
View file @
55790a3a
...
...
@@ -58,12 +58,17 @@ import es.bsc.inb.elixir.openebench.model.Tool;
import
es.bsc.inb.elixir.openebench.model.ToolLinkType
;
import
es.bsc.inb.elixir.openebench.model.ToolType
;
import
es.bsc.inb.elixir.openebench.model.Topic
;
import
java.time.ZonedDateTime
;
import
java.time.format.DateTimeParseException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.json.JsonArray
;
import
javax.json.JsonNumber
;
import
javax.json.JsonObject
;
import
javax.json.JsonValue
;
import
javax.json.JsonValue.ValueType
;
/**
* @author Dmitry Repchevsky
...
...
@@ -383,10 +388,55 @@ public class BiotoolsConverter {
publication
.
setVersion
(
jpublication
.
getString
(
"version"
,
null
));
final
String
type
=
jpublication
.
getString
(
"type"
,
null
);
try
{
publication
.
setType
(
PublicationType
.
fromValue
(
type
));
}
catch
(
IllegalArgumentException
ex
)
{
Logger
.
getLogger
(
BiotoolsConverter
.
class
.
getName
()).
log
(
Level
.
INFO
,
"unrecognized publication type: {0}"
,
type
);
if
(
type
!=
null
)
{
try
{
publication
.
setType
(
PublicationType
.
fromValue
(
type
));
}
catch
(
IllegalArgumentException
ex
)
{
Logger
.
getLogger
(
BiotoolsConverter
.
class
.
getName
()).
log
(
Level
.
INFO
,
"unrecognized publication type: {0}"
,
type
);
}
}
final
JsonValue
jmetadata_value
=
jpublication
.
get
(
"metadata"
);
if
(
jmetadata_value
!=
null
&&
jmetadata_value
.
getValueType
()
==
ValueType
.
OBJECT
)
{
final
JsonObject
jmetadata
=
jmetadata_value
.
asJsonObject
();
final
String
title
=
jmetadata
.
getString
(
"title"
,
null
);
final
String
abridge
=
jmetadata
.
getString
(
"abstract"
,
null
);
final
String
journal
=
jmetadata
.
getString
(
"journal"
,
null
);
publication
.
setTitle
(
title
);
publication
.
setAbstract
(
abridge
);
publication
.
setJournal
(
journal
);
final
String
date
=
jmetadata
.
getString
(
"date"
,
null
);
if
(
date
!=
null
)
{
try
{
final
ZonedDateTime
date_time
=
ZonedDateTime
.
parse
(
date
);
publication
.
setYear
(
date_time
.
toLocalDate
().
toString
());
}
catch
(
DateTimeParseException
ex
)
{
Logger
.
getLogger
(
BiotoolsConverter
.
class
.
getName
()).
log
(
Level
.
INFO
,
"invalid date format: {0}"
,
date
);
}
}
final
JsonNumber
cit_count
=
jmetadata
.
getJsonNumber
(
"citationCount"
);
if
(
cit_count
!=
null
)
{
publication
.
setCitationsCount
(
cit_count
.
intValue
());
}
final
JsonArray
jauthors
=
jmetadata
.
getJsonArray
(
"authors"
);
if
(
jauthors
!=
null
&&
jauthors
.
size
()
>
0
)
{
final
List
<
String
>
authors
=
new
ArrayList
(
jauthors
.
size
());
publication
.
setAuthors
(
authors
);
for
(
int
j
=
0
,
m
=
jauthors
.
size
();
j
<
m
;
j
++)
{
final
JsonObject
jauthor
=
jauthors
.
getJsonObject
(
j
);
if
(
jauthor
!=
null
)
{
final
String
author
=
jauthor
.
getString
(
"name"
,
null
);
if
(
author
!=
null
)
{
authors
.
add
(
author
);
}
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment