added subjects to disprot output

This commit is contained in:
Enrico Ottonello 2022-04-06 12:22:10 +02:00
parent 98178b3165
commit afb46d71f7
2 changed files with 21 additions and 5 deletions

View File

@ -57,7 +57,7 @@ public class BioSchemaProtein {
@JsonProperty("https://schema.org/sameAs")
private List<Link> sameAs;
@JsonProperty("https://schema.org/hasSequenceAnnotation")
private Link hasSequenceAnnotation;
private List<Link> hasSequenceAnnotation;
@JsonProperty("https://schema.org/additionalProperty")
private List<Link> sequenceAnnotation;
@JsonProperty("https://schema.org/value")
@ -202,11 +202,11 @@ public class BioSchemaProtein {
this.mainEntityOfPage = mainEntityOfPage;
}
public Link getHasSequenceAnnotation() {
public List<Link> getHasSequenceAnnotation() {
return hasSequenceAnnotation;
}
public void setHasSequenceAnnotation(Link hasSequenceAnnotation) {
public void setHasSequenceAnnotation(List<Link> hasSequenceAnnotation) {
this.hasSequenceAnnotation = hasSequenceAnnotation;
}

View File

@ -173,6 +173,8 @@ public class RDFConverter {
log.error("Identifier not found", e.getMessage());
}
mainTitles.add(" " + entry.getName() + " ");
dataciteProtein.setId(proteinId);
bioschemaProteins.put(entry.getId(), entry);
dataciteProteins.add(dataciteProtein);
@ -211,8 +213,22 @@ public class RDFConverter {
.stream()
.filter(bioProtein -> Objects.nonNull(bioProtein.getValue().getHasSequenceAnnotation()))
.forEach(bioProtein -> {
sequenceAnnotations
.get(bioProtein.getValue().getHasSequenceAnnotation().getId())
List<String> seqAnnIds = bioProtein
.getValue()
.getHasSequenceAnnotation()
.stream()
.map(s -> s.getId())
.collect(Collectors.toList());
List<BioSchemaProtein.Link> propertyIds = sequenceAnnotations
.entrySet()
.stream()
.filter(s -> seqAnnIds.contains(s.getKey()))
.flatMap(s -> {
return s.getValue().stream();
})
.collect(Collectors.toList());
propertyIds
.stream()
.map(propertyId -> propertyValues.get(propertyId.getId()))
.filter(term -> Objects.nonNull(term))