Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/MET-5110_fix_entity_status_when_no_entity_found_for_existing_vocabulary #611

Conversation

jeortizquan
Copy link
Contributor

No description provided.

@jeortizquan jeortizquan marked this pull request as ready for review May 16, 2023 12:14
@JoanaCMS JoanaCMS merged commit 8c106a3 into develop May 24, 2023
7 of 8 checks passed
dereferenceResult = new DereferenceResult(
result.values().stream().map(Pair::getLeft).collect(Collectors.toList()),
result.values().stream().map(Pair::getRight).filter(Objects::nonNull).findFirst()
.orElse(DereferenceResultStatus.UNKNOWN_EUROPEANA_ENTITY));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct. I think here you can't use UNKNOWN_EUROPEANA_ENTITY, as this condition should never trigger. In fact, for now it's probably best to always return DereferenceResultStatus.SUCCESS at this point (because you know that at least the top level entity was retrieved successfully). In a future ticket we will make it nicer and allow reporting on individual URLs.
Does this make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. This is the case when no status was found after doing all processing so I wanted to report UKNOWN or not DEFINED. As you mention looking it from the perspective of the whole process we can use DereferenceResultStatus.SUCCESS then.

}
try {
Map<ReferenceTerm, List<EnrichmentBase>> result = new HashMap<>();
entityResolver.resolveById(resourceIds).forEach((key, value) -> result.put(key, List.of(value)));
Copy link
Contributor

@jochen-vermeulen jochen-vermeulen Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you probably need to check against the europeana URL.
Instead of line 249, something like:

var ownEntities = resourceIds.stream()
    .filter(id -> EntityResolver.europeanaLinkPattern.matcher(id.getReference().toString()).matches())
    .collect(Collectors.toSet());
entityResolver.resolveById(ownEntities)
    .forEach((key, value) -> result.put(key, List.of(value)));
ownEntities.stream().filter(id -> result.get(id) == null || result.get(id).isEmpty())
    .forEach(notFoundOwnId -> {
        setDereferenceStatusInReport(notFoundOwnId.getReference().toString(),
            reports, DereferenceResultStatus.UNKNOWN_EUROPEANA_ENTITY);
        result.putIfAbsent(notFoundOwnId, Collections.emptyList());
    });

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand what this means now, because of the previous way the status was computed never thought to explicitly validate it. will proceed to update the code.

@stzanakis stzanakis deleted the bug/MET-5110_fix_entity_status_when_no_entity_found_for_existing_vocabulary branch October 30, 2023 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants