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

View File

@ -173,6 +173,8 @@ public class RDFConverter {
log.error("Identifier not found", e.getMessage()); log.error("Identifier not found", e.getMessage());
} }
mainTitles.add(" " + entry.getName() + " ");
dataciteProtein.setId(proteinId); dataciteProtein.setId(proteinId);
bioschemaProteins.put(entry.getId(), entry); bioschemaProteins.put(entry.getId(), entry);
dataciteProteins.add(dataciteProtein); dataciteProteins.add(dataciteProtein);
@ -211,8 +213,22 @@ public class RDFConverter {
.stream() .stream()
.filter(bioProtein -> Objects.nonNull(bioProtein.getValue().getHasSequenceAnnotation())) .filter(bioProtein -> Objects.nonNull(bioProtein.getValue().getHasSequenceAnnotation()))
.forEach(bioProtein -> { .forEach(bioProtein -> {
sequenceAnnotations List<String> seqAnnIds = bioProtein
.get(bioProtein.getValue().getHasSequenceAnnotation().getId()) .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() .stream()
.map(propertyId -> propertyValues.get(propertyId.getId())) .map(propertyId -> propertyValues.get(propertyId.getId()))
.filter(term -> Objects.nonNull(term)) .filter(term -> Objects.nonNull(term))