├── .github └── workflows │ ├── ci.yml │ └── release.yml ├── .gitignore ├── .idea └── codeStyles │ └── Project.xml ├── .run ├── metis-authentication (local).run.xml ├── metis-authentication-rest_Dockerfile.run.xml ├── metis-debias (local).run.xml ├── metis-dereference (local).run.xml ├── metis-dereference-rest_Dockerfile.run.xml ├── metis-repository (local).run.xml └── metis-repository-rest_Dockerfile.run.xml ├── CONTRIBUTING.MD ├── LICENSE.MD ├── README.MD ├── metis-authentication ├── metis-authentication-common │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── authentication │ │ │ └── user │ │ │ ├── AccountRole.java │ │ │ ├── Credentials.java │ │ │ ├── EmailParameter.java │ │ │ ├── MetisUser.java │ │ │ ├── MetisUserAccessToken.java │ │ │ ├── MetisUserView.java │ │ │ ├── OldNewPasswordParameters.java │ │ │ └── UserIdParameter.java │ │ └── test │ │ └── java │ │ └── eu │ │ └── europeana │ │ └── metis │ │ └── authentication │ │ └── user │ │ ├── AccountRoleTest.java │ │ ├── CredentialsTest.java │ │ ├── EmailParameterTest.java │ │ ├── MetisUserAccessTokenTest.java │ │ ├── MetisUserTest.java │ │ ├── MetisUserViewTest.java │ │ └── TestAccountRole.java ├── metis-authentication-rest-client │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── authentication │ │ │ └── rest │ │ │ └── client │ │ │ └── AuthenticationClient.java │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── authentication │ │ │ └── rest │ │ │ └── client │ │ │ └── TestAuthenticationClient.java │ │ └── resources │ │ └── __files │ │ └── MetisUser.json ├── metis-authentication-rest │ ├── .gitignore │ ├── Dockerfile │ ├── docker-compose.yml │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── eu │ │ │ │ └── europeana │ │ │ │ └── metis │ │ │ │ └── authentication │ │ │ │ └── rest │ │ │ │ ├── Application.java │ │ │ │ ├── config │ │ │ │ ├── ApplicationConfiguration.java │ │ │ │ └── properties │ │ │ │ │ └── MetisAuthenticationConfigurationProperties.java │ │ │ │ └── controller │ │ │ │ ├── AuthenticationController.java │ │ │ │ └── advice │ │ │ │ └── RestResponseExceptionHandler.java │ │ └── resources │ │ │ ├── application.properties.example │ │ │ ├── create_tables.sql │ │ │ └── log4j2.xml │ │ └── test │ │ └── java │ │ └── eu │ │ └── europeana │ │ └── metis │ │ └── authentication │ │ └── rest │ │ ├── AuthenticationControllerTest.java │ │ └── utils │ │ └── TestUtils.java ├── metis-authentication-service │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── authentication │ │ │ ├── dao │ │ │ └── PsqlMetisUserDao.java │ │ │ └── service │ │ │ └── AuthenticationService.java │ │ └── test │ │ └── java │ │ └── eu │ │ └── europeana │ │ └── metis │ │ └── authentication │ │ ├── dao │ │ └── TestPsqlMetisUserDao.java │ │ └── service │ │ └── AuthenticationServiceTest.java └── pom.xml ├── metis-debias ├── README.MD ├── metis-debias-detect-rest │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── eu │ │ │ │ └── europeana │ │ │ │ └── metis │ │ │ │ └── debias │ │ │ │ └── detect │ │ │ │ └── rest │ │ │ │ ├── Application.java │ │ │ │ ├── config │ │ │ │ ├── ApplicationConfiguration.java │ │ │ │ └── SwaggerConfig.java │ │ │ │ ├── controller │ │ │ │ └── DetectionController.java │ │ │ │ └── exceptions │ │ │ │ ├── ExceptionResponseHandler.java │ │ │ │ └── ServerError.java │ │ └── resources │ │ │ ├── application.properties.example │ │ │ └── log4j2.xml │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── debias │ │ │ └── detect │ │ │ └── rest │ │ │ └── controller │ │ │ ├── DetectionControllerTest.java │ │ │ └── DetectionControllerWiremockTest.java │ │ └── resources │ │ ├── sample_error_bad_gateway.html │ │ ├── sample_error_bad_gateway.json │ │ ├── sample_error_missing_body.json │ │ ├── sample_error_missing_language.json │ │ ├── sample_error_missing_values.json │ │ ├── sample_error_null_body.json │ │ ├── sample_error_null_language.json │ │ ├── sample_error_null_values.json │ │ └── sample_success_response.json ├── metis-debias-detect-service │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── debias │ │ │ └── detect │ │ │ ├── client │ │ │ └── DeBiasClient.java │ │ │ ├── exceptions │ │ │ ├── DeBiasBadRequestException.java │ │ │ └── DeBiasInternalServerException.java │ │ │ ├── model │ │ │ ├── DeBiasResult.java │ │ │ ├── error │ │ │ │ ├── Detail.java │ │ │ │ ├── ErrorDeBiasResult.java │ │ │ │ └── Input.java │ │ │ ├── request │ │ │ │ └── BiasInputLiterals.java │ │ │ └── response │ │ │ │ ├── DetectionDeBiasResult.java │ │ │ │ ├── Metadata.java │ │ │ │ ├── Tag.java │ │ │ │ └── ValueDetection.java │ │ │ └── service │ │ │ └── BiasDetectService.java │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── debias │ │ │ └── detect │ │ │ └── client │ │ │ └── DeBiasClientTest.java │ │ └── resources │ │ ├── sample_error_null_language.json │ │ └── sample_success_response.json └── pom.xml ├── metis-dereference ├── README.MD ├── metis-dereference-common │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── dereference │ │ │ ├── ContextualClass.java │ │ │ ├── DereferenceResult.java │ │ │ ├── IncomingRecordToEdmTransformer.java │ │ │ ├── ProcessedEntity.java │ │ │ ├── RdfRetriever.java │ │ │ └── Vocabulary.java │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── dereference │ │ │ └── IncomingRecordToEdmTransformerTest.java │ │ └── resources │ │ ├── copy_xml.xslt │ │ ├── invalid_xml.xml │ │ ├── produce_empty.xslt │ │ ├── produce_invalid_xml.xslt │ │ └── yso_p105069.xml ├── metis-dereference-import │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── dereference │ │ │ └── vocimport │ │ │ ├── VocabularyCollectionImporter.java │ │ │ ├── VocabularyCollectionImporterFactory.java │ │ │ ├── VocabularyCollectionImporterImpl.java │ │ │ ├── VocabularyCollectionMavenRule.java │ │ │ ├── VocabularyCollectionValidator.java │ │ │ ├── VocabularyCollectionValidatorImpl.java │ │ │ ├── exception │ │ │ └── VocabularyImportException.java │ │ │ ├── model │ │ │ ├── Location.java │ │ │ ├── Vocabulary.java │ │ │ ├── VocabularyDirectoryEntry.java │ │ │ ├── VocabularyLoader.java │ │ │ └── VocabularyMetadata.java │ │ │ └── utils │ │ │ └── NonCollidingPathVocabularyTrie.java │ │ └── test │ │ └── java │ │ └── eu │ │ └── europeana │ │ └── metis │ │ └── dereference │ │ └── vocimport │ │ └── utils │ │ └── NonCollidingPathVocabularyTrieTest.java ├── metis-dereference-rest │ ├── .gitignore │ ├── Dockerfile │ ├── docker-compose.yml │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── eu │ │ │ │ └── europeana │ │ │ │ └── metis │ │ │ │ └── dereference │ │ │ │ └── rest │ │ │ │ ├── Application.java │ │ │ │ ├── config │ │ │ │ ├── ApplicationConfiguration.java │ │ │ │ ├── ScheduledConfig.java │ │ │ │ ├── SwaggerConfig.java │ │ │ │ ├── WebMvcConfig.java │ │ │ │ └── properties │ │ │ │ │ └── MetisDereferenceConfigurationProperties.java │ │ │ │ ├── controller │ │ │ │ ├── DereferencingController.java │ │ │ │ └── DereferencingManagementController.java │ │ │ │ └── exceptions │ │ │ │ ├── DereferenceException.java │ │ │ │ └── RestResponseExceptionHandler.java │ │ └── resources │ │ │ ├── application.properties.example │ │ │ └── log4j2.xml │ │ └── test │ │ └── java │ │ └── eu │ │ └── europeana │ │ └── metis │ │ └── dereference │ │ └── rest │ │ ├── DereferencingControllerTest.java │ │ └── DereferencingManagementControllerTest.java ├── metis-dereference-service │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── dereference │ │ │ └── service │ │ │ ├── DereferenceService.java │ │ │ ├── DereferencingManagementService.java │ │ │ ├── MongoDereferenceService.java │ │ │ ├── MongoDereferencingManagementService.java │ │ │ ├── dao │ │ │ ├── ProcessedEntityDao.java │ │ │ └── VocabularyDao.java │ │ │ └── utils │ │ │ ├── GraphUtils.java │ │ │ └── VocabularyCandidates.java │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── dereference │ │ │ └── service │ │ │ ├── MongoDereferenceServiceTest.java │ │ │ ├── MongoDereferencingManagementServiceTest.java │ │ │ ├── dao │ │ │ ├── ProcessedEntityDaoTest.java │ │ │ └── VocabularyDaoTest.java │ │ │ └── utils │ │ │ ├── GraphUtilsTest.java │ │ │ └── VocabularyCandidatesTest.java │ │ └── resources │ │ ├── geonames.xsl │ │ ├── log4j.xml │ │ ├── place_entity.xsl │ │ ├── test.xml │ │ ├── vocabulary-fault.yml │ │ ├── vocabulary.yml │ │ └── vocabulary │ │ ├── voctest.xsl │ │ └── voctest.yml └── pom.xml ├── metis-enrichment ├── README.MD ├── metis-enrichment-client │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── eu │ │ │ │ └── europeana │ │ │ │ └── enrichment │ │ │ │ ├── rest │ │ │ │ └── client │ │ │ │ │ ├── ConnectionProvider.java │ │ │ │ │ ├── EnrichmentWorker.java │ │ │ │ │ ├── EnrichmentWorkerImpl.java │ │ │ │ │ ├── dereference │ │ │ │ │ ├── DereferenceClient.java │ │ │ │ │ ├── DereferencedEntities.java │ │ │ │ │ ├── Dereferencer.java │ │ │ │ │ ├── DereferencerImpl.java │ │ │ │ │ └── DereferencerProvider.java │ │ │ │ │ ├── enrichment │ │ │ │ │ ├── Enricher.java │ │ │ │ │ ├── EnricherImpl.java │ │ │ │ │ ├── EnricherProvider.java │ │ │ │ │ └── MetisRecordParser.java │ │ │ │ │ ├── exceptions │ │ │ │ │ ├── DereferenceException.java │ │ │ │ │ └── EnrichmentException.java │ │ │ │ │ └── report │ │ │ │ │ ├── ProcessedResult.java │ │ │ │ │ ├── Report.java │ │ │ │ │ └── Type.java │ │ │ │ └── utils │ │ │ │ ├── DereferenceUtils.java │ │ │ │ ├── EnrichmentUtils.java │ │ │ │ ├── EntityConverterUtils.java │ │ │ │ ├── EntityMergeEngine.java │ │ │ │ ├── ItemExtractorUtils.java │ │ │ │ ├── RdfEntityUtils.java │ │ │ │ └── YearParser.java │ │ └── resources │ │ │ ├── adList │ │ │ └── bcList │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── enrichment │ │ │ ├── rest │ │ │ └── client │ │ │ │ ├── EnrichmentWorkerImplTest.java │ │ │ │ ├── dereference │ │ │ │ ├── DereferenceClientTest.java │ │ │ │ ├── DereferencerImplTest.java │ │ │ │ └── DereferencerProviderTest.java │ │ │ │ └── enrichment │ │ │ │ ├── EnricherImplTest.java │ │ │ │ ├── EnricherProviderTest.java │ │ │ │ └── MetisRecordParserTest.java │ │ │ └── utils │ │ │ ├── DereferenceUtilsTest.java │ │ │ ├── EnrichmentUtilsTest.java │ │ │ ├── EntityMergeEngineTest.java │ │ │ ├── ItemExtractorUtilsTest.java │ │ │ ├── RdfEntityUtilsTest.java │ │ │ └── YearParserTest.java │ │ └── resources │ │ ├── dereference │ │ ├── dereference-failure.xml │ │ ├── dereference-geoname.xml │ │ ├── dereference-no-vocabulary.xml │ │ ├── dereference-normal-ii.xml │ │ ├── dereference-normal-redirect.xml │ │ ├── dereference-normal.xml │ │ ├── dereference-null.xml │ │ ├── dereference-unknown-europeana-entity.xml │ │ └── dereference-vocabulary.xml │ │ ├── enrichment │ │ ├── sample_dereference_not_found.rdf │ │ ├── sample_dereference_redirect.rdf │ │ ├── sample_enrichment_exception.rdf │ │ ├── sample_enrichment_failure.rdf │ │ ├── sample_enrichment_noentity.rdf │ │ └── sample_enrichment_success.rdf │ │ ├── entity-api │ │ ├── entity-api-response-agent-nomatch.json │ │ ├── entity-api-response-concept-ii.json │ │ ├── entity-api-response-concept-iii.json │ │ ├── entity-api-response-concept-iv.json │ │ ├── entity-api-response-concept-nomatch.json │ │ ├── entity-api-response-concept-notfound.json │ │ ├── entity-api-response-concept.json │ │ ├── entity-api-response-mgmt-concept-base-ii.json │ │ ├── entity-api-response-mgmt-concept-base.json │ │ ├── entity-api-response-mgmt-concept-ii-base.json │ │ ├── entity-api-response-mgmt-organization-base.json │ │ ├── entity-api-response-organization-ii.json │ │ ├── entity-api-response-organization-iii.json │ │ ├── entity-api-response-organization.json │ │ ├── entity-api-response-resolve-uri-concept-ii.json │ │ ├── entity-api-response-resolve-uri-concept.json │ │ ├── entity-api-response-resolve-uri-nomatch.json │ │ ├── entity-api-response-resolve-uri-place.json │ │ └── entity-api-response-timespan.json │ │ ├── log4j2.xml │ │ ├── sample_1.rdf │ │ ├── sample_2.rdf │ │ └── sample_completeness.rdf ├── metis-enrichment-common │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── eu │ │ │ └── europeana │ │ │ └── enrichment │ │ │ ├── api │ │ │ ├── exceptions │ │ │ │ └── UnknownException.java │ │ │ ├── external │ │ │ │ ├── DereferenceResultStatus.java │ │ │ │ ├── exceptions │ │ │ │ │ └── EntityApiException.java │ │ │ │ ├── impl │ │ │ │ │ └── ClientEntityResolver.java │ │ │ │ └── model │ │ │ │ │ ├── Agent.java │ │ │ │ │ ├── AgentBase.java │ │ │ │ │ ├── Concept.java │ │ │ │ │ ├── EnrichmentBase.java │ │ │ │ │ ├── EnrichmentResultBaseWrapper.java │ │ │ │ │ ├── EnrichmentResultList.java │ │ │ │ │ ├── Label.java │ │ │ │ │ ├── LabelResource.java │ │ │ │ │ ├── Organization.java │ │ │ │ │ ├── Part.java │ │ │ │ │ ├── Place.java │ │ │ │ │ ├── Resource.java │ │ │ │ │ ├── TimeSpan.java │ │ │ │ │ ├── VcardAddress.java │ │ │ │ │ ├── VcardAddresses.java │ │ │ │ │ ├── WebResource.java │ │ │ │ │ └── package-info.java │ │ │ └── internal │ │ │ │ ├── AbstractReferenceTerm.java │ │ │ │ ├── AbstractSearchTerm.java │ │ │ │ ├── AggregationFieldType.java │ │ │ │ ├── EntityResolver.java │ │ │ │ ├── FieldType.java │ │ │ │ ├── FieldValue.java │ │ │ │ ├── ProxyFieldType.java │ │ │ │ ├── RecordParser.java │ │ │ │ ├── ReferenceTerm.java │ │ │ │ ├── ReferenceTermContext.java │ │ │ │ ├── ReferenceTermImpl.java │ │ │ │ ├── SearchTerm.java │ │ │ │ ├── SearchTermContext.java │ │ │ │ ├── SearchTermImpl.java │ │ │ │ └── TermContext.java │ │ │ └── utils │ │ │ ├── EnrichmentBaseConverter.java │ │ │ ├── EntityType.java │ │ │ ├── EntityValuesConverter.java │ │ │ └── LanguageCodeConverter.java │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── enrichment │ │ │ ├── api │ │ │ ├── external │ │ │ │ └── impl │ │ │ │ │ └── ClientEntityResolverTest.java │ │ │ └── internal │ │ │ │ └── ReferenceTermContextTest.java │ │ │ └── utils │ │ │ ├── EnrichmentBaseConverterTest.java │ │ │ └── LanguageCodeConverterTest.java │ │ └── resources │ │ ├── entity-agent.xml │ │ ├── entity-concept.xml │ │ ├── entity-organization.xml │ │ └── entity-place.xml └── pom.xml ├── metis-harvesting ├── pom.xml └── src │ ├── main │ └── java │ │ └── eu │ │ └── europeana │ │ └── metis │ │ └── harvesting │ │ ├── FullRecord.java │ │ ├── FullRecordHarvestingIterator.java │ │ ├── HarvesterException.java │ │ ├── HarvesterFactory.java │ │ ├── HarvestingClientSettings.java │ │ ├── HarvestingIterator.java │ │ ├── ReportingIteration.java │ │ ├── http │ │ ├── AbstractHttpHarvestIterator.java │ │ ├── HttpHarvester.java │ │ ├── HttpHarvesterImpl.java │ │ └── PathIterator.java │ │ └── oaipmh │ │ ├── CloseableHttpOaiClient.java │ │ ├── CloseableOaiClient.java │ │ ├── OaiHarvest.java │ │ ├── OaiHarvester.java │ │ ├── OaiHarvesterImpl.java │ │ ├── OaiHarvestingIterator.java │ │ ├── OaiRecord.java │ │ ├── OaiRecordHeader.java │ │ ├── OaiRecordParser.java │ │ └── OaiRepository.java │ └── test │ ├── java │ └── eu │ │ └── europeana │ │ └── metis │ │ └── harvesting │ │ ├── CloseableHttpOaiClientTest.java │ │ ├── OaiHarvesterImplTest.java │ │ ├── OaiRecordParserTest.java │ │ ├── TestHelper.java │ │ └── WiremockHelper.java │ └── resources │ ├── deletedOaiRecord.xml │ ├── expectedOaiRecord.xml │ ├── oaiListIdentifiers.xml │ ├── oaiListIdentifiers2.xml │ ├── oaiListIdentifiersIncorrectCompleteListSize.xml │ ├── oaiListIdentifiersIncorrectMetadataPrefix.xml │ ├── oaiListIdentifiersNoCompleteListSize.xml │ ├── oaiListIdentifiersNoResumptionToken.xml │ └── sampleOaiRecord.xml ├── metis-indexing ├── pom.xml └── src │ ├── main │ └── java │ │ └── eu │ │ └── europeana │ │ └── indexing │ │ ├── AbstractConnectionProvider.java │ │ ├── ClientsConnectionProvider.java │ │ ├── FullBeanPublisher.java │ │ ├── IndexedRecordAccess.java │ │ ├── Indexer.java │ │ ├── IndexerFactory.java │ │ ├── IndexerImpl.java │ │ ├── IndexerPool.java │ │ ├── IndexerPreprocessor.java │ │ ├── IndexingProperties.java │ │ ├── IndexingSettings.java │ │ ├── RecordRedirectsUtil.java │ │ ├── SettingsConnectionProvider.java │ │ ├── SimpleIndexer.java │ │ ├── SimpleIndexerFactory.java │ │ ├── TombstoneUtil.java │ │ ├── exception │ │ ├── IndexerRelatedIndexingException.java │ │ ├── IndexingException.java │ │ ├── PublishToSolrIndexingException.java │ │ ├── RecordRelatedIndexingException.java │ │ ├── SetupRelatedIndexingException.java │ │ └── TierCalculationException.java │ │ ├── fullbean │ │ ├── AgentFieldInput.java │ │ ├── AggregationFieldInput.java │ │ ├── ConceptFieldInput.java │ │ ├── EuropeanaAggregationFieldInput.java │ │ ├── FieldInputUtils.java │ │ ├── LicenseFieldInput.java │ │ ├── OrganizationFieldInput.java │ │ ├── PlaceFieldInput.java │ │ ├── ProvidedCHOFieldInput.java │ │ ├── ProxyFieldInput.java │ │ ├── QualityAnnotationFieldInput.java │ │ ├── RdfToFullBeanConverter.java │ │ ├── ServiceFieldInput.java │ │ ├── StringToFullBeanConverter.java │ │ ├── TimespanFieldInput.java │ │ └── WebResourceFieldInput.java │ │ ├── mongo │ │ ├── AbstractEdmEntityUpdater.java │ │ ├── AbstractIsolatedEdmEntityUpdater.java │ │ ├── AbstractMongoObjectUpdater.java │ │ ├── AgentUpdater.java │ │ ├── AggregationUpdater.java │ │ ├── ConceptUpdater.java │ │ ├── EuropeanaAggregationUpdater.java │ │ ├── FullBeanUpdater.java │ │ ├── LicenseUpdater.java │ │ ├── MongoConnectionProvider.java │ │ ├── MongoIndexer.java │ │ ├── MongoIndexingSettings.java │ │ ├── OrganizationUpdater.java │ │ ├── PlaceUpdater.java │ │ ├── ProvidedChoUpdater.java │ │ ├── ProxyUpdater.java │ │ ├── ServiceUpdater.java │ │ ├── TimespanUpdater.java │ │ ├── WebResourceInformation.java │ │ ├── WebResourceMetaInfoUpdater.java │ │ ├── WebResourceUpdater.java │ │ └── property │ │ │ ├── MongoObjectManager.java │ │ │ ├── MongoObjectUpdater.java │ │ │ ├── MongoPropertyUpdater.java │ │ │ ├── MongoPropertyUpdaterFactory.java │ │ │ ├── MongoPropertyUpdaterImpl.java │ │ │ └── RootAboutWrapper.java │ │ ├── solr │ │ ├── EdmLabel.java │ │ ├── SolrConnectionProvider.java │ │ ├── SolrDocumentPopulator.java │ │ ├── SolrIndexer.java │ │ ├── SolrIndexingSettings.java │ │ ├── facet │ │ │ ├── EncodedFacet.java │ │ │ ├── EncodedFacetCollection.java │ │ │ ├── FacetEncoder.java │ │ │ └── value │ │ │ │ ├── AudioDuration.java │ │ │ │ ├── AudioQuality.java │ │ │ │ ├── FacetValue.java │ │ │ │ ├── ImageAspectRatio.java │ │ │ │ ├── ImageColorEncoding.java │ │ │ │ ├── ImageColorSpace.java │ │ │ │ ├── ImageSize.java │ │ │ │ ├── MediaTypeEncoding.java │ │ │ │ ├── MimeTypeEncoding.java │ │ │ │ ├── VideoDuration.java │ │ │ │ └── VideoQuality.java │ │ └── property │ │ │ ├── AgentSolrCreator.java │ │ │ ├── AggregationSolrCreator.java │ │ │ ├── ConceptSolrCreator.java │ │ │ ├── EuropeanaAggregationSolrCreator.java │ │ │ ├── FullBeanSolrProperties.java │ │ │ ├── LicenseSolrCreator.java │ │ │ ├── PlaceSolrCreator.java │ │ │ ├── PropertySolrCreator.java │ │ │ ├── ProvidedChoSolrCreator.java │ │ │ ├── ProxySolrCreator.java │ │ │ ├── QualityAnnotationSolrCreator.java │ │ │ ├── ServiceSolrCreator.java │ │ │ ├── SolrPropertyUtils.java │ │ │ ├── TimespanSolrCreator.java │ │ │ └── WebResourceSolrCreator.java │ │ ├── tiers │ │ ├── ClassifierFactory.java │ │ ├── RecordTierCalculationViewGenerator.java │ │ ├── TierCalculationMode.java │ │ ├── media │ │ │ ├── AbstractMediaClassifier.java │ │ │ ├── AudioClassifier.java │ │ │ ├── EmbeddableMedia.java │ │ │ ├── ImageClassifier.java │ │ │ ├── MediaClassifier.java │ │ │ ├── TextClassifier.java │ │ │ ├── ThreeDClassifier.java │ │ │ └── VideoClassifier.java │ │ ├── metadata │ │ │ ├── ClassifierMode.java │ │ │ ├── ContextualClassGroup.java │ │ │ ├── ContextualClassesClassifier.java │ │ │ ├── EnablingElement.java │ │ │ ├── EnablingElementsClassifier.java │ │ │ ├── LanguageClassifier.java │ │ │ ├── LanguageTagStatistics.java │ │ │ ├── PropertyType.java │ │ │ └── ResourceLinkFromProxy.java │ │ ├── model │ │ │ ├── MediaTier.java │ │ │ ├── MetadataClassifier.java │ │ │ ├── MetadataTier.java │ │ │ ├── Tier.java │ │ │ ├── TierClassifier.java │ │ │ ├── TierClassifierBreakdown.java │ │ │ ├── TierProvider.java │ │ │ └── TierResults.java │ │ └── view │ │ │ ├── ContentTierBreakdown.java │ │ │ ├── ContextualClassesBreakdown.java │ │ │ ├── EnablingElementsBreakdown.java │ │ │ ├── LanguageBreakdown.java │ │ │ ├── MediaResourceTechnicalMetadata.java │ │ │ ├── MetadataTierBreakdown.java │ │ │ ├── ProcessingError.java │ │ │ ├── RecordTierCalculationSummary.java │ │ │ ├── RecordTierCalculationView.java │ │ │ └── ResolutionTierMetadata.java │ │ └── utils │ │ ├── IndexingSettingsUtils.java │ │ ├── LicenseType.java │ │ ├── RdfTier.java │ │ ├── RdfTierUtils.java │ │ ├── RdfWrapper.java │ │ ├── SetUtils.java │ │ ├── TriConsumer.java │ │ ├── WebResourceLinkType.java │ │ └── WebResourceWrapper.java │ └── test │ ├── java │ └── eu │ │ └── europeana │ │ └── indexing │ │ ├── ClientsConnectionProviderTest.java │ │ ├── IndexerImplTest.java │ │ ├── IndexerPreprocessorTest.java │ │ ├── SimpleIndexerFactoryTest.java │ │ ├── TombstoneUtilTest.java │ │ ├── base │ │ ├── IndexingTestUtils.java │ │ ├── MongoDBContainerIT.java │ │ ├── SolrContainerIT.java │ │ ├── SolrMetisContainer.java │ │ ├── TestContainer.java │ │ ├── TestContainerFactoryIT.java │ │ └── TestContainerType.java │ │ ├── fullbean │ │ ├── AgentFieldInputTest.java │ │ ├── ConceptFieldInputTest.java │ │ ├── EuropeanaAggregationFieldInputTest.java │ │ ├── FieldInputUtilsTest.java │ │ ├── PlaceFieldInputTest.java │ │ ├── ProxyFieldInputTest.java │ │ ├── QualityAnnotationFieldInputTest.java │ │ ├── RdfToFullBeanConverterTest.java │ │ ├── TimespanFieldInputTest.java │ │ └── WebResourceFieldInputTest.java │ │ ├── mongo │ │ ├── AgentUpdaterTest.java │ │ ├── AggregationUpdaterTest.java │ │ ├── ConceptUpdaterTest.java │ │ ├── EuropeanaAggregationUpdaterTest.java │ │ ├── FullBeanUpdaterTest.java │ │ ├── LicenseUpdaterTest.java │ │ ├── MongoEntityUpdaterTest.java │ │ ├── MongoIndexerIT.java │ │ ├── PlaceUpdaterTest.java │ │ ├── ProvidedChoUpdaterTest.java │ │ ├── ProxyUpdaterTest.java │ │ ├── ServiceUpdaterTest.java │ │ ├── TimespanUpdaterTest.java │ │ ├── WebResourceMetaInfoUpdaterTest.java │ │ ├── WebResourceUpdaterTest.java │ │ └── property │ │ │ └── MongoPropertyUpdaterImplTest.java │ │ ├── solr │ │ ├── SolrDocumentPopulatorTest.java │ │ ├── SolrIndexerIT.java │ │ ├── facet │ │ │ ├── FacetEncoderTest.java │ │ │ └── value │ │ │ │ ├── TestImageColorEncoding.java │ │ │ │ └── TestMimeTypeEncoding.java │ │ └── property │ │ │ ├── AgentSolrCreatorTest.java │ │ │ ├── ConceptSolrCreatorTest.java │ │ │ ├── EuropeanaAggregationSolrCreatorTest.java │ │ │ ├── FullBeanSolrPropertiesTest.java │ │ │ ├── LicenseSolrCreatorTest.java │ │ │ ├── PlaceSolrCreatorTest.java │ │ │ ├── PropertySolrCreatorTest.java │ │ │ ├── ProvidedChoSolrCreatorTest.java │ │ │ ├── ProxySolrCreatorTest.java │ │ │ ├── QualityAnnotationSolrCreatorTest.java │ │ │ ├── ServiceSolrCreatorTest.java │ │ │ ├── SolrPropertyUtilsTest.java │ │ │ ├── TimespanSolrCreatorTest.java │ │ │ └── WebResourceSolrCreatorTest.java │ │ ├── tiers │ │ ├── RecordTierCalculationViewGeneratorTest.java │ │ ├── media │ │ │ ├── AbstractMediaClassifierTest.java │ │ │ ├── AudioClassifierTest.java │ │ │ ├── EmbeddableMediaTest.java │ │ │ ├── ImageClassifierTest.java │ │ │ ├── MediaClassifierTest.java │ │ │ ├── TextClassifierTest.java │ │ │ ├── ThreeDClassifierTest.java │ │ │ └── VideoClassifierTest.java │ │ ├── metadata │ │ │ ├── ContextualClassesBreakdownClassifierTest.java │ │ │ ├── EnablingElementTest.java │ │ │ ├── EnablingElementsBreakdownClassifierTest.java │ │ │ ├── LanguageClassifierTest.java │ │ │ ├── LanguageTagStatisticsTest.java │ │ │ ├── PropertyTypeTest.java │ │ │ └── ResourceLinkFromProxyTest.java │ │ ├── model │ │ │ ├── MediaTierTest.java │ │ │ ├── MetadataClassifierTest.java │ │ │ └── MetadataTierTest.java │ │ └── view │ │ │ ├── ContentTierBreakdownTest.java │ │ │ ├── ContextualClassesBreakdownTest.java │ │ │ ├── EnablingElementsBreakdownTest.java │ │ │ ├── LanguageBreakdownTest.java │ │ │ ├── MediaResourceTechnicalMetadataBuilderTest.java │ │ │ ├── MetadataTierBreakdownTest.java │ │ │ ├── ProcessingErrorTest.java │ │ │ ├── RecordTierCalculationSummaryTest.java │ │ │ ├── RecordTierCalculationViewTest.java │ │ │ └── ResolutionTierMetadataTest.java │ │ └── utils │ │ ├── LicenseTypeTest.java │ │ ├── RdfTierUtilsTest.java │ │ ├── RdfWrapperTest.java │ │ ├── SetUtilsTest.java │ │ └── TestUtils.java │ └── resources │ ├── europeana_record_rdf_conversion.xml │ ├── europeana_record_rdf_tier_for_overwrite.xml │ ├── europeana_record_rdf_with_tier_calculated.xml │ ├── europeana_record_tier_calculation_rdf.xml │ ├── europeana_record_to_sample_index_dup_rdf.xml │ ├── europeana_record_to_sample_index_rdf.xml │ ├── europeana_record_to_sample_index_string.xml │ ├── europeana_record_with_geospatial_data.xml │ ├── europeana_record_with_geospatial_data_wgs84.xml │ ├── europeana_record_with_normalized_date_timespan.xml │ ├── europeana_record_with_technical_metadata.xml │ ├── log4j2.xml │ └── solr │ ├── elevate.xml │ ├── enumsConfig.xml │ ├── query_aliases.xml │ ├── schema.xml │ └── solrconfig.xml ├── metis-media-service ├── pom.xml └── src │ ├── main │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── mediaprocessing │ │ │ ├── AbstractMediaProcessorPool.java │ │ │ ├── AbstractThreadSafeWrapper.java │ │ │ ├── LinkChecker.java │ │ │ ├── MediaExtractor.java │ │ │ ├── MediaProcessorFactory.java │ │ │ ├── PoolableProcessor.java │ │ │ ├── RdfConverterFactory.java │ │ │ ├── RdfDeserializer.java │ │ │ ├── RdfDeserializerImpl.java │ │ │ ├── RdfSerializer.java │ │ │ ├── RdfSerializerImpl.java │ │ │ ├── RdfXpathConstants.java │ │ │ ├── exception │ │ │ ├── LinkCheckingException.java │ │ │ ├── MediaExtractionException.java │ │ │ ├── MediaProcessorException.java │ │ │ ├── RdfDeserializationException.java │ │ │ └── RdfSerializationException.java │ │ │ ├── extraction │ │ │ ├── AudioVideoProcessor.java │ │ │ ├── ColorSpaceMapping.java │ │ │ ├── CommandExecutor.java │ │ │ ├── ImageMetadata.java │ │ │ ├── ImageProcessor.java │ │ │ ├── Media3dProcessor.java │ │ │ ├── MediaExtractorImpl.java │ │ │ ├── MediaProcessor.java │ │ │ ├── OEmbedProcessor.java │ │ │ ├── PdfToImageConverter.java │ │ │ ├── TextProcessor.java │ │ │ ├── ThumbnailGenerator.java │ │ │ └── oembed │ │ │ │ ├── OEmbedModel.java │ │ │ │ └── OEmbedValidation.java │ │ │ ├── http │ │ │ ├── LinkCheckClient.java │ │ │ ├── MimeTypeDetectHttpClient.java │ │ │ └── ResourceDownloadClient.java │ │ │ ├── linkchecking │ │ │ └── LinkCheckerImpl.java │ │ │ ├── model │ │ │ ├── AbstractInMemoryFile.java │ │ │ ├── AbstractResourceMetadata.java │ │ │ ├── AbstractTemporaryFile.java │ │ │ ├── AudioResourceMetadata.java │ │ │ ├── EnrichedRdf.java │ │ │ ├── EnrichedRdfImpl.java │ │ │ ├── GenericResourceMetadata.java │ │ │ ├── IResourceMetadata.java │ │ │ ├── ImageResourceMetadata.java │ │ │ ├── Media3dResourceMetadata.java │ │ │ ├── MediaExtractorInput.java │ │ │ ├── RdfResourceEntry.java │ │ │ ├── RdfWrapper.java │ │ │ ├── Resource.java │ │ │ ├── ResourceExtractionResult.java │ │ │ ├── ResourceExtractionResultImpl.java │ │ │ ├── ResourceImpl.java │ │ │ ├── ResourceMetadata.java │ │ │ ├── ResourceRelatedFile.java │ │ │ ├── TextResourceMetadata.java │ │ │ ├── Thumbnail.java │ │ │ ├── ThumbnailImpl.java │ │ │ ├── ThumbnailKind.java │ │ │ ├── UrlType.java │ │ │ ├── VideoResourceMetadata.java │ │ │ └── WebResource.java │ │ │ └── wrappers │ │ │ └── TikaWrapper.java │ └── resources │ │ ├── colormap.png │ │ └── org │ │ └── apache │ │ └── tika │ │ └── mime │ │ └── custom-mimetypes.xml │ └── test │ ├── java │ └── eu │ │ └── europeana │ │ └── metis │ │ └── mediaprocessing │ │ ├── RdfDeserializerImplTest.java │ │ ├── extraction │ │ ├── AudioVideoProcessorTest.java │ │ ├── CommandExecutorTest.java │ │ ├── ImageProcessorTest.java │ │ ├── MediaExtractorImplTest.java │ │ ├── OEmbedProcessorTest.java │ │ ├── PdfToImageConverterTest.java │ │ ├── TextProcessorTest.java │ │ ├── ThumbnailGeneratorTest.java │ │ └── oembed │ │ │ └── OEmbedModelTest.java │ │ ├── http │ │ └── MimeTypeDetectHttpClientTest.java │ │ └── model │ │ ├── EnrichedRdfImplTest.java │ │ ├── RdfWrapperTest.java │ │ ├── ResourceMetadataTest.java │ │ └── WebResourceTest.java │ └── resources │ └── __files │ ├── Cube_3d_printing_sample.stl │ ├── Duck.glb │ ├── adamHead.gltf │ ├── audio_test.mp3 │ ├── block100.stl │ ├── example.mpd │ ├── not_oembed.json │ ├── not_oembed.xml │ ├── oembed.json │ ├── oembed.xml │ ├── rdf_with_oembed_sample.xml │ ├── rdf_with_oembed_sample_II.xml │ └── test_oembed.json ├── metis-pattern-analysis ├── pom.xml └── src │ ├── main │ └── java │ │ └── eu │ │ └── europeana │ │ └── patternanalysis │ │ ├── PatternAnalysisService.java │ │ ├── ProblemPatternAnalyzer.java │ │ ├── exception │ │ └── PatternAnalysisException.java │ │ └── view │ │ ├── DatasetProblemPatternAnalysis.java │ │ ├── ProblemOccurrence.java │ │ ├── ProblemPattern.java │ │ ├── ProblemPatternAnalysis.java │ │ ├── ProblemPatternDescription.java │ │ └── RecordAnalysis.java │ └── test │ ├── java │ └── eu │ │ └── europeana │ │ └── patternanalysis │ │ ├── ProblemPatternAnalyzerTest.java │ │ └── view │ │ ├── DatasetProblemPatternAnalysisTest.java │ │ ├── ProblemOccurrenceTest.java │ │ ├── ProblemPatternAnalysisTest.java │ │ ├── ProblemPatternDescriptionTest.java │ │ ├── ProblemPatternTest.java │ │ └── RecordAnalysisTest.java │ └── resources │ ├── europeana_record_empty_proxy_choices.xml │ ├── europeana_record_no_problem_patterns.xml │ ├── europeana_record_with_P12.xml │ ├── europeana_record_with_P2.xml │ ├── europeana_record_with_P3.xml │ ├── europeana_record_with_P5.xml │ ├── europeana_record_with_P6.xml │ ├── europeana_record_with_P7.xml │ ├── europeana_record_with_P7_descriptions_empty.xml │ └── europeana_record_with_P9.xml ├── metis-repository ├── metis-repository-rest │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── docker-compose.yml │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── eu │ │ │ │ └── europeana │ │ │ │ └── metis │ │ │ │ └── repository │ │ │ │ └── rest │ │ │ │ ├── Application.java │ │ │ │ ├── config │ │ │ │ ├── ApplicationConfiguration.java │ │ │ │ ├── SwaggerConfig.java │ │ │ │ └── WebMvcConfig.java │ │ │ │ ├── controller │ │ │ │ ├── HttpHarvestController.java │ │ │ │ ├── OaiPmhController.java │ │ │ │ └── RecordController.java │ │ │ │ ├── dao │ │ │ │ ├── Record.java │ │ │ │ └── RecordDao.java │ │ │ │ └── view │ │ │ │ ├── InsertionResult.java │ │ │ │ ├── InstantSerializer.java │ │ │ │ └── RecordView.java │ │ └── resources │ │ │ ├── application.properties.example │ │ │ └── log4j2.xml │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── repository │ │ │ ├── dao │ │ │ ├── RecordDaoTest.java │ │ │ └── RecordTest.java │ │ │ └── rest │ │ │ ├── HttpHarvestControllerTest.java │ │ │ ├── InsertionResultTest.java │ │ │ ├── InstantSerializerTest.java │ │ │ ├── OaiPmhControllerTest.java │ │ │ ├── RecordControllerTest.java │ │ │ └── RecordViewTest.java │ │ └── resources │ │ ├── record-test.xml │ │ ├── repository-test-error.zip │ │ └── repository-test.zip └── pom.xml ├── metis-transformation ├── metis-transformation-service │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── transformation │ │ │ └── service │ │ │ ├── CacheItemWithExpirationTime.java │ │ │ ├── CacheValueSupplier.java │ │ │ ├── CacheWithExpirationTime.java │ │ │ ├── EuropeanaGeneratedIdsMap.java │ │ │ ├── EuropeanaIdCreator.java │ │ │ ├── EuropeanaIdException.java │ │ │ ├── TransformationException.java │ │ │ └── XsltTransformer.java │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── metis │ │ │ └── transformation │ │ │ └── service │ │ │ ├── CacheItemWithExpirationTimeTest.java │ │ │ ├── CacheWithExpirationTimeTest.java │ │ │ ├── EuropeanaIdCreatorTest.java │ │ │ └── XsltTransformerTest.java │ │ └── resources │ │ ├── inject_node.xslt │ │ ├── malformedFile.xml │ │ ├── sample_xslt.xslt │ │ ├── xmlForTesting.xml │ │ └── xmlForTestingParamInjection.xml └── pom.xml ├── metis-validation ├── README.md ├── metis-validation-common │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── validation │ │ │ └── model │ │ │ ├── Schema.java │ │ │ ├── ValidationResult.java │ │ │ └── ValidationResultList.java │ │ └── resources │ │ └── log4j2.xml ├── metis-validation-service │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── eu │ │ │ │ └── europeana │ │ │ │ └── validation │ │ │ │ └── service │ │ │ │ ├── ClasspathLSInput.java │ │ │ │ ├── ClasspathResourceResolver.java │ │ │ │ ├── EDMParser.java │ │ │ │ ├── PredefinedSchemas.java │ │ │ │ ├── PredefinedSchemasGenerator.java │ │ │ │ ├── SchemaProvider.java │ │ │ │ ├── SchemaProviderException.java │ │ │ │ ├── ValidationExecutionService.java │ │ │ │ ├── ValidationServiceConfig.java │ │ │ │ └── Validator.java │ │ └── resources │ │ │ └── xml.xsd │ │ └── test │ │ ├── java │ │ └── eu │ │ │ └── europeana │ │ │ └── validation │ │ │ └── service │ │ │ ├── PredefinedSchemasGeneratorTest.java │ │ │ ├── TestApplication.java │ │ │ ├── TestSchemaProvider.java │ │ │ └── TestValidationExecution.java │ │ └── resources │ │ ├── Item_35834473.xml │ │ ├── Item_35834473_test.xml │ │ ├── Item_35834473_wrong.xml │ │ ├── Item_schematron_invalid.xml │ │ ├── Item_schematron_invalid2.xml │ │ ├── __files │ │ └── test_schema.zip │ │ ├── custom-validation.properties │ │ ├── test_batch.zip │ │ └── test_wrong.zip └── pom.xml └── pom.xml /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: RELEASE 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | release-version: 7 | description: 'The version of the intended release, should be just a number' 8 | required: true 9 | new-snapshot-version: 10 | description: 'The version of the intended new snapshot' 11 | required: true 12 | commit-hash-branch: 13 | description: 'The commit hash or branch to use as a base for the merge and release(default: develop)' 14 | required: false 15 | default: develop 16 | 17 | jobs: 18 | ci-release: 19 | uses: europeana/metis-actions/.github/workflows/release.yml@main 20 | with: 21 | release-version: ${{ github.event.inputs.release-version }} 22 | commit-hash-branch: ${{ github.event.inputs.commit-hash-branch }} 23 | new-snapshot-version: ${{ github.event.inputs.new-snapshot-version }} 24 | target-merge-branch: master 25 | secrets: 26 | METIS_PERSONAL_ACCESS_TOKEN: ${{ secrets.METIS_PERSONAL_ACCESS_TOKEN }} 27 | -------------------------------------------------------------------------------- /.run/metis-authentication-rest_Dockerfile.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.run/metis-debias (local).run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | -------------------------------------------------------------------------------- /.run/metis-dereference-rest_Dockerfile.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.run/metis-repository-rest_Dockerfile.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-common/src/main/java/eu/europeana/metis/authentication/user/AccountRole.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.user; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import eu.europeana.metis.exception.BadContentException; 5 | 6 | /** 7 | * The Role of an account. 8 | */ 9 | public enum AccountRole { 10 | METIS_ADMIN, EUROPEANA_DATA_OFFICER, PROVIDER_VIEWER; 11 | 12 | /** 13 | * Maps the string representation in json to the enum value. 14 | * 15 | * @param name the string representation of the enum field 16 | * @return {@link AccountRole} 17 | * @throws BadContentException if the value does not match any of the enum fields 18 | */ 19 | @JsonCreator 20 | public static AccountRole getAccountRoleFromEnumName(String name) throws BadContentException { 21 | if (name == null) { 22 | throw new BadContentException("Account Role is not valid"); 23 | } 24 | 25 | for (AccountRole accountRole : AccountRole.values()) { 26 | if (accountRole.name().equalsIgnoreCase(name)) { 27 | return accountRole; 28 | } 29 | } 30 | throw new BadContentException("Account Role is not valid"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-common/src/main/java/eu/europeana/metis/authentication/user/Credentials.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.user; 2 | 3 | /** 4 | * Contains the email and password of a user temporarily. 5 | *

Used mostly after decoding the Authorization Header in an HTTP request.

6 | */ 7 | public class Credentials { 8 | 9 | private String email; 10 | private String password; 11 | 12 | /** 13 | * Constructor with required fields. 14 | * @param email the email of the user 15 | * @param password the passsword of the user 16 | */ 17 | public Credentials(String email, String password) { 18 | this.email = email; 19 | this.password = password; 20 | } 21 | 22 | public String getEmail() { 23 | return email; 24 | } 25 | 26 | public void setEmail(String email) { 27 | this.email = email; 28 | } 29 | 30 | public String getPassword() { 31 | return password; 32 | } 33 | 34 | public void setPassword(String password) { 35 | this.password = password; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-common/src/main/java/eu/europeana/metis/authentication/user/EmailParameter.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.user; 2 | 3 | /** 4 | * Contains the email parameter. 5 | *

This class is used for passing parameters as json to a http request body. It contains the 6 | * email parameter

7 | */ 8 | public class EmailParameter { 9 | 10 | private String email; 11 | 12 | public EmailParameter() { 13 | } 14 | 15 | /** 16 | * Constructor with all required parameters 17 | * 18 | * @param email the email parameter 19 | */ 20 | public EmailParameter(String email) { 21 | this.email = email; 22 | } 23 | 24 | public String getEmail() { 25 | return email; 26 | } 27 | 28 | public void setEmail(String email) { 29 | this.email = email; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-common/src/main/java/eu/europeana/metis/authentication/user/OldNewPasswordParameters.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.user; 2 | 3 | /** 4 | * Contains the old and new password parameters. 5 | *

This class is used for passing parameters as json to a http request body. It contains the old 6 | * password to be changed with the new provided password

7 | */ 8 | public class OldNewPasswordParameters { 9 | 10 | private String oldPassword; 11 | private String newPassword; 12 | 13 | public OldNewPasswordParameters() { 14 | } 15 | 16 | /** 17 | * Constructor with all required parameters 18 | * 19 | * @param oldPassword the old password 20 | * @param newPassword the new password 21 | */ 22 | public OldNewPasswordParameters(String oldPassword, String newPassword) { 23 | this.oldPassword = oldPassword; 24 | this.newPassword = newPassword; 25 | } 26 | 27 | public String getOldPassword() { 28 | return oldPassword; 29 | } 30 | 31 | public void setOldPassword(String oldPassword) { 32 | this.oldPassword = oldPassword; 33 | } 34 | 35 | public String getNewPassword() { 36 | return newPassword; 37 | } 38 | 39 | public void setNewPassword(String newPassword) { 40 | this.newPassword = newPassword; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-common/src/main/java/eu/europeana/metis/authentication/user/UserIdParameter.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.user; 2 | 3 | /** 4 | * Contains the userId parameter. 5 | *

This class is used for passing parameters as json to a http request body. It contains the 6 | * userId parameter

7 | * 8 | * @author Simon Tzanakis (Simon.Tzanakis@europeana.eu) 9 | * @since 2019-02-07 10 | */ 11 | public class UserIdParameter { 12 | 13 | private String userId; 14 | 15 | public UserIdParameter() { 16 | } 17 | 18 | /** 19 | * Constructor with all required parameters 20 | * 21 | * @param userId the user identifier 22 | */ 23 | public UserIdParameter(String userId) { 24 | this.userId = userId; 25 | } 26 | 27 | public String getUserId() { 28 | return userId; 29 | } 30 | 31 | public void setUserId(String userId) { 32 | this.userId = userId; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-common/src/test/java/eu/europeana/metis/authentication/user/CredentialsTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.user; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | class CredentialsTest { 8 | 9 | @Test 10 | void testCredentialsConstructor() { 11 | final String exampleEmail1 = "example1@email.com"; 12 | final String examplePassword1 = "password1"; 13 | final String exampleEmail2 = "example2@email.com"; 14 | final String examplePassword2 = "password2"; 15 | 16 | final Credentials credentials = new Credentials(exampleEmail1, examplePassword1); 17 | assertEquals(exampleEmail1, credentials.getEmail()); 18 | assertEquals(examplePassword1, credentials.getPassword()); 19 | 20 | credentials.setEmail(exampleEmail2); 21 | credentials.setPassword(examplePassword2); 22 | assertEquals(exampleEmail2, credentials.getEmail()); 23 | assertEquals(examplePassword2, credentials.getPassword()); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-common/src/test/java/eu/europeana/metis/authentication/user/EmailParameterTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.user; 2 | 3 | import static org.junit.jupiter.api.Assertions.*; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | class EmailParameterTest { 8 | 9 | @Test 10 | void testEmptyEmailParameterConstructor() { 11 | final EmailParameter emailParameter = new EmailParameter(); 12 | assertNull(emailParameter.getEmail()); 13 | } 14 | 15 | @Test 16 | void testEmailParameterConstructor() { 17 | final String exampleEmail1 = "example1@email.com"; 18 | final String exampleEmail2 = "example2@email.com"; 19 | final EmailParameter emailParameter = new EmailParameter(exampleEmail1); 20 | assertEquals(exampleEmail1, emailParameter.getEmail()); 21 | emailParameter.setEmail(exampleEmail2); 22 | assertEquals(exampleEmail2, emailParameter.getEmail()); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-common/src/test/java/eu/europeana/metis/authentication/user/TestAccountRole.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.user; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.junit.jupiter.api.Assertions.assertThrows; 5 | 6 | import eu.europeana.metis.exception.BadContentException; 7 | import org.junit.jupiter.api.Test; 8 | 9 | class TestAccountRole { 10 | 11 | @Test 12 | void accountRoleCreationFromStringValue() throws BadContentException { 13 | AccountRole metisAdmin = AccountRole.getAccountRoleFromEnumName("METIS_ADMIN"); 14 | assertEquals(AccountRole.METIS_ADMIN, metisAdmin); 15 | } 16 | 17 | @Test 18 | void accountRoleCreationFromStringValueFails() { 19 | assertThrows(BadContentException.class, 20 | () -> AccountRole.getAccountRoleFromEnumName("METIS_AD")); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest-client/src/test/resources/__files/MetisUser.json: -------------------------------------------------------------------------------- 1 | { 2 | "userId": "1482250000003948017", 3 | "email": "simon.metis@europeana.eu", 4 | "firstName": "Simon", 5 | "lastName": "Metis", 6 | "organizationId": "1482250000001617026", 7 | "organizationName": "Europeana Foundation", 8 | "accountRole": "METIS_ADMIN", 9 | "country": "Netherlands", 10 | "networkMember": false, 11 | "metisUserFlag": true, 12 | "createdDate": 1509694575000, 13 | "updatedDate": 1509695365000, 14 | "metisUserAccessToken": { 15 | "accessToken": "vq6V1YJIOfLC0pSTeb1plANiopyVlwrx" 16 | } 17 | } -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest/.gitignore: -------------------------------------------------------------------------------- 1 | /src/main/resources/application.properties 2 | /src/main/resources/authentication.properties 3 | /src/main/resources/hibernate.cfg.xml 4 | /src/main/resources/zcrm_configuration.properties 5 | /src/main/resources/oauth_configuration.properties 6 | /src/main/resources/oauthtokens.properties 7 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eclipse-temurin:21-jre 2 | COPY target/*.jar app.jar 3 | EXPOSE 8080 4 | ENTRYPOINT ["java", "-jar", "/app.jar"] -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | postgres: 5 | image: postgres:14-alpine 6 | container_name: metis-authentication-postgres 7 | environment: 8 | - POSTGRES_DB=metis-authentication_local 9 | - POSTGRES_USER=test 10 | - POSTGRES_PASSWORD=test 11 | ports: 12 | - '5432:5432' 13 | metis-authentication-local: 14 | image: europeana/metis-authentication:develop 15 | container_name: metis-authentication-local 16 | build: 17 | context: ./ 18 | dockerfile: Dockerfile 19 | ports: 20 | - '8080:8080' 21 | environment: 22 | HIBERNATE_CONNECTION_URL: jdbc:postgresql://metis-authentication-postgres:5432/metis-authentication_local 23 | volumes: 24 | - /data/metis-configuration/metis-framework/metis-authentication/metis-authentication-rest/k8s/overlays/local/resources/custom-truststore.jks:/data/certificates/custom-truststore.jks 25 | - /data/metis-configuration/metis-framework/metis-authentication/metis-authentication-rest/k8s/overlays/local/resources/application.properties:/application.properties 26 | - /data/metis-configuration/metis-framework/metis-authentication/metis-authentication-rest/k8s/overlays/local/resources/log4j2.xml:/data/logging/log4j2.xml 27 | depends_on: 28 | - postgres -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest/src/main/java/eu/europeana/metis/authentication/rest/Application.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.rest; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * The Spring boot application entry point. 8 | */ 9 | @SpringBootApplication 10 | public class Application { 11 | 12 | /** 13 | * The main spring boot method. 14 | * 15 | * @param args application arguments 16 | */ 17 | public static void main(String[] args) { 18 | SpringApplication.run(Application.class, args); 19 | } 20 | } 21 | 22 | 23 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest/src/main/java/eu/europeana/metis/authentication/rest/config/properties/MetisAuthenticationConfigurationProperties.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.rest.config.properties; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | /** 6 | * Class using {@link ConfigurationProperties} loading. 7 | */ 8 | @ConfigurationProperties(prefix = "metis-authentication") 9 | public class MetisAuthenticationConfigurationProperties { 10 | 11 | private int accessTokenExpireTimeInMinutes; 12 | private String[] allowedCorsHosts; 13 | 14 | public int getAccessTokenExpireTimeInMinutes() { 15 | return accessTokenExpireTimeInMinutes; 16 | } 17 | 18 | public void setAccessTokenExpireTimeInMinutes(int accessTokenExpireTimeInMinutes) { 19 | this.accessTokenExpireTimeInMinutes = accessTokenExpireTimeInMinutes; 20 | } 21 | 22 | public String[] getAllowedCorsHosts() { 23 | return allowedCorsHosts == null ? null : allowedCorsHosts.clone(); 24 | } 25 | 26 | public void setAllowedCorsHosts(String[] allowedCorsHosts) { 27 | this.allowedCorsHosts = allowedCorsHosts == null ? null : allowedCorsHosts.clone(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest/src/main/resources/application.properties.example: -------------------------------------------------------------------------------- 1 | #Spring 2 | logging.config=/data/logging/log4j2.xml 3 | #logging.config=log4j2.xml 4 | server.error.whitelabel.enabled=false 5 | 6 | #Truststore 7 | truststore.path=/data/certificates/custom-truststore.jks 8 | truststore.password= 9 | 10 | #Hibernate configuration 11 | hibernate.dialect=org.hibernate.dialect.PostgreSQL82Dialect 12 | hibernate.connection.driver_class=org.postgresql.Driver 13 | hibernate.connection.url=jdbc:postgresql:// 14 | hibernate.connection.username= 15 | hibernate.connection.password= 16 | hibernate.c3p0.min_size=5 17 | hibernate.c3p0.max_size=20 18 | hibernate.c3p0.timeout=1800 19 | hibernate.c3p0.max_statements=50 20 | 21 | #Miscellaneus 22 | metis-authentication.accessTokenExpireTimeInMinutes=10 23 | metis-authentication.allowedCorsHosts=* 24 | 25 | #Actuator 26 | management.endpoint.health.probes.enabled=true 27 | management.health.livenessState.enabled=true 28 | management.health.readinessState.enabled=true 29 | 30 | # Elastic APM 31 | elastic.apm.enabled=true 32 | elastic.apm.recording=true 33 | elastic.apm.instrument=true 34 | elastic.apm.service_name=metis-authentication 35 | elastic.apm.server_url= 36 | elastic.apm.environment=local 37 | elastic.apm.application_packages=eu.europeana 38 | elastic.apm.log_level=ERROR 39 | elastic.apm.capture_body=all 40 | elastic.apm.capture_headers=true 41 | elastic.apm.metrics_interval=5s 42 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest/src/main/resources/create_tables.sql: -------------------------------------------------------------------------------- 1 | /* 2 | e.g. account_role values 'METIS_ADMIN', 'EUROPEANA_DATA_OFFICER', 'PROVIDER_VIEWER'. 3 | The values are checked in the application. 4 | Creating the first admin requires a user to register through the application and then manually update the user role to METIS_ADMIN. 5 | */ 6 | CREATE TABLE IF NOT EXISTS metis_users ( 7 | user_id VARCHAR(100) DEFAULT NULL, 8 | email VARCHAR(40) PRIMARY KEY, 9 | last_name VARCHAR(40), 10 | first_name VARCHAR(40), 11 | password VARCHAR(255) DEFAULT NULL, 12 | organization_id VARCHAR(100), 13 | organization_name VARCHAR(100), 14 | account_role VARCHAR(40), 15 | country VARCHAR(40), 16 | network_member BOOLEAN, 17 | metis_user BOOLEAN, 18 | created_date TIMESTAMPTZ, 19 | updated_date TIMESTAMPTZ 20 | ); 21 | 22 | CREATE TABLE IF NOT EXISTS metis_user_access_tokens ( 23 | email VARCHAR(40) PRIMARY KEY REFERENCES metis_users (email), 24 | access_token VARCHAR(255) UNIQUE NOT NULL, 25 | timestamp TIMESTAMPTZ NOT NULL DEFAULT NOW() 26 | ); 27 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metis-authentication/metis-authentication-rest/src/test/java/eu/europeana/metis/authentication/rest/utils/TestUtils.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.authentication.rest.utils; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import java.io.IOException; 6 | 7 | /** 8 | * Utility class with helpful methods for tests 9 | */ 10 | public final class TestUtils { 11 | 12 | private TestUtils() { 13 | } 14 | 15 | /** 16 | * Convert a java {@link Object} to a byte array. 17 | * 18 | * @param object the object to convert 19 | * @return the byte array 20 | * @throws IOException if an exception occurred during the conversion 21 | */ 22 | public static byte[] convertObjectToJsonBytes(Object object) throws IOException { 23 | ObjectMapper mapper = new ObjectMapper(); 24 | mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); 25 | return mapper.writeValueAsBytes(object); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /metis-authentication/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | metis-framework 6 | eu.europeana.metis 7 | 15-SNAPSHOT 8 | 9 | metis-authentication 10 | pom 11 | 12 | 13 | metis-authentication-common 14 | metis-authentication-service 15 | metis-authentication-rest 16 | metis-authentication-rest-client 17 | 18 | 19 | -------------------------------------------------------------------------------- /metis-debias/README.MD: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | 5 | This module includes DeBias detection algorithm functionality for Metis services. 6 | The module includes the following submodels: 7 | 8 | | Module | Functionality | 9 | |--------------------------|-------------------------------------------| 10 | | metis-debias-detect-rest | REST client for debias detection REST API | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /src/main/resources/application.properties 3 | 4 | target/ 5 | !.mvn/wrapper/maven-wrapper.jar 6 | !**/src/main/**/target/ 7 | !**/src/test/**/target/ 8 | 9 | ### IntelliJ IDEA ### 10 | .idea 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | 16 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/main/java/eu/europeana/metis/debias/detect/rest/Application.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.debias.detect.rest; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * The type Application. 8 | */ 9 | @SpringBootApplication 10 | public class Application { 11 | 12 | /** 13 | * The entry point of application. 14 | * 15 | * @param args the input arguments 16 | */ 17 | public static void main(String[] args) { 18 | SpringApplication.run(Application.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/main/java/eu/europeana/metis/debias/detect/rest/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.debias.detect.rest.config; 2 | 3 | import io.swagger.v3.oas.models.OpenAPI; 4 | import io.swagger.v3.oas.models.info.Info; 5 | import io.swagger.v3.oas.models.info.License; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | /** 10 | * Config for Swagger documentation 11 | */ 12 | @Configuration 13 | public class SwaggerConfig { 14 | 15 | /** 16 | * The open api documentation docket. 17 | * 18 | * @return the docket configuration 19 | */ 20 | @Bean 21 | public OpenAPI openAPI() { 22 | return new OpenAPI() 23 | .info(new Info() 24 | .title("DeBias REST API") 25 | .description("DeBias REST API for Europeana") 26 | .version("v1") 27 | .license(new License() 28 | .name("EUPL License v1.2") 29 | .url("https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12"))); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/main/resources/application.properties.example: -------------------------------------------------------------------------------- 1 | # Spring 2 | spring.application.name=metis-debias-rest 3 | logging.config=/data/logging/log4j2.xml 4 | #logging.config=log4j2.xml 5 | spring.servlet.multipart.max-file-size=5MB 6 | spring.servlet.multipart.max-request-size=5MB 7 | spring.autoconfigure.exclude=\ 8 | org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration, \ 9 | org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration 10 | springdoc.packages-to-scan=eu.europeana.metis.debias.detect.rest 11 | springdoc.paths-to-match=/** 12 | 13 | # Truststore 14 | truststore.path= 15 | truststore.password= 16 | 17 | # DeBias detect 18 | debias.simple.client.detect-url = 19 | debias.simple.client.connect-timeout = 20 | debias.simple.client.request-timeout = 21 | 22 | #Actuator 23 | management.endpoint.health.probes.enabled=true 24 | management.health.livenessState.enabled=true 25 | management.health.readinessState.enabled=true 26 | 27 | # Elastic APM 28 | elastic.apm.enabled=false 29 | elastic.apm.recording=true 30 | elastic.apm.instrument=true 31 | elastic.apm.service_name=metis-debias 32 | elastic.apm.server_url=https://logstash-apm.eanadev.org:8200 33 | elastic.apm.environment=local 34 | elastic.apm.application_packages=eu.europeana 35 | elastic.apm.log_level=ERROR 36 | elastic.apm.capture_body=all 37 | elastic.apm.capture_headers=true 38 | elastic.apm.metrics_interval=5s 39 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/test/resources/sample_error_bad_gateway.html: -------------------------------------------------------------------------------- 1 | 2 | 502 Bad Gateway 3 | 4 |

502 Bad Gateway

5 |
nginx/1.18.0 (Ubuntu)
6 | 7 | 8 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/test/resources/sample_error_bad_gateway.json: -------------------------------------------------------------------------------- 1 | { 2 | "errorMessage": "I/O error on POST request for \"http://debias.host\": Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n at [Source: (String)\"\n502 Bad Gateway\n\n

502 Bad Gateway

\n
nginx/1.18.0 (Ubuntu)
\n\n\n\"; line: 1, column: 2]" 3 | } 4 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/test/resources/sample_error_missing_body.json: -------------------------------------------------------------------------------- 1 | {"errorMessage":"422 Unprocessable Entity"} 2 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/test/resources/sample_error_missing_language.json: -------------------------------------------------------------------------------- 1 | { 2 | "detail": [ 3 | { 4 | "type": "missing", 5 | "loc": [ 6 | "body", 7 | "language" 8 | ], 9 | "msg": "Field required", 10 | "input": { 11 | "values": [ 12 | "sample title of aboriginal and addict", 13 | "a second addict sample title", 14 | "this is a demo of master and slave branch" 15 | ] 16 | }, 17 | "url": "https://errors.pydantic.dev/2.5/v/missing" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/test/resources/sample_error_missing_values.json: -------------------------------------------------------------------------------- 1 | { 2 | "detail": [ 3 | { 4 | "type": "missing", 5 | "loc": [ 6 | "body", 7 | "values" 8 | ], 9 | "msg": "Field required", 10 | "input": { 11 | "language": "en" 12 | }, 13 | "url": "https://errors.pydantic.dev/2.5/v/missing" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/test/resources/sample_error_null_body.json: -------------------------------------------------------------------------------- 1 | { 2 | "detail": [ 3 | { 4 | "type": "missing", 5 | "loc": [ 6 | "body", 7 | "language" 8 | ], 9 | "msg": "Field required", 10 | "input": {}, 11 | "url": "https://errors.pydantic.dev/2.5/v/missing" 12 | }, 13 | { 14 | "type": "missing", 15 | "loc": [ 16 | "body", 17 | "values" 18 | ], 19 | "msg": "Field required", 20 | "input": {}, 21 | "url": "https://errors.pydantic.dev/2.5/v/missing" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/test/resources/sample_error_null_language.json: -------------------------------------------------------------------------------- 1 | { 2 | "detail": [ 3 | { 4 | "type": "string_type", 5 | "loc": [ 6 | "body", 7 | "language" 8 | ], 9 | "msg": "Input should be a valid string", 10 | "input": null, 11 | "url": "https://errors.pydantic.dev/2.5/v/string_type" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/test/resources/sample_error_null_values.json: -------------------------------------------------------------------------------- 1 | { 2 | "detail": [ 3 | { 4 | "type": "list_type", 5 | "loc": [ 6 | "body", 7 | "values" 8 | ], 9 | "msg": "Input should be a valid list", 10 | "input": null, 11 | "url": "https://errors.pydantic.dev/2.5/v/list_type" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-rest/src/test/resources/sample_success_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "annotator": "de-bias", 4 | "thesaurus": null, 5 | "date": "2024-08-27T12:04:17" 6 | }, 7 | "results": [ 8 | { 9 | "language": "en", 10 | "literal": "sample title of aboriginal and addict", 11 | "tags": [ 12 | { 13 | "uri": "http://www.example.org/debias#t_2_en", 14 | "start": 16, 15 | "end": 26, 16 | "length": 10 17 | }, 18 | { 19 | "uri": "http://www.example.org/debias#t_3_en", 20 | "start": 31, 21 | "end": 37, 22 | "length": 6 23 | } 24 | ] 25 | }, 26 | { 27 | "language": "en", 28 | "literal": "a second addict sample title", 29 | "tags": [ 30 | { 31 | "uri": "http://www.example.org/debias#t_3_en", 32 | "start": 9, 33 | "end": 15, 34 | "length": 6 35 | } 36 | ] 37 | }, 38 | { 39 | "language": "en", 40 | "literal": "this is a demo of master and slave branch", 41 | "tags": [ 42 | { 43 | "uri": "http://www.example.org/debias#t_198_en", 44 | "start": 29, 45 | "end": 34, 46 | "length": 5 47 | } 48 | ] 49 | } 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/src/main/java/eu/europeana/metis/debias/detect/exceptions/DeBiasBadRequestException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.debias.detect.exceptions; 2 | 3 | import java.io.Serial; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.web.bind.annotation.ResponseStatus; 6 | 7 | /** 8 | * The type DeBias bad request exception. 9 | */ 10 | @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "DeBias detection bad request") 11 | public class DeBiasBadRequestException extends RuntimeException { 12 | 13 | @Serial 14 | private static final long serialVersionUID = -5859207750420173804L; 15 | 16 | /** 17 | * Instantiates a new Debias bad request exception. 18 | * 19 | * @param message the message 20 | */ 21 | public DeBiasBadRequestException(String message) { 22 | super(message); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/src/main/java/eu/europeana/metis/debias/detect/exceptions/DeBiasInternalServerException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.debias.detect.exceptions; 2 | 3 | import java.io.Serial; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.web.bind.annotation.ResponseStatus; 6 | 7 | /** 8 | * The type DeBias exception. 9 | */ 10 | @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR, reason = "DeBias detection internal server error") 11 | public class DeBiasInternalServerException extends RuntimeException { 12 | 13 | @Serial 14 | private static final long serialVersionUID = -5671884493038169899L; 15 | 16 | /** 17 | * Constructs a new exception with the specified detail message. 18 | * 19 | * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. 20 | */ 21 | public DeBiasInternalServerException(String message) { 22 | super(message); 23 | } 24 | 25 | /** 26 | * Instantiates a new DeBias exception. 27 | * 28 | * @param message the message 29 | * @param cause the cause 30 | */ 31 | public DeBiasInternalServerException(String message, Throwable cause) { 32 | super(message, cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/src/main/java/eu/europeana/metis/debias/detect/model/DeBiasResult.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.debias.detect.model; 2 | 3 | /** 4 | * DeBias result interface 5 | */ 6 | public interface DeBiasResult { 7 | // common interface for De Bias API responses 8 | } 9 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/src/main/java/eu/europeana/metis/debias/detect/model/error/ErrorDeBiasResult.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.debias.detect.model.error; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import eu.europeana.metis.debias.detect.model.DeBiasResult; 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | /** 9 | * The type Error result. 10 | */ 11 | public class ErrorDeBiasResult implements DeBiasResult { 12 | 13 | @JsonProperty("detail") 14 | private List detailList; 15 | 16 | /** 17 | * Gets detail list. 18 | * 19 | * @return the detail list 20 | */ 21 | public List getDetailList() { 22 | return detailList; 23 | } 24 | 25 | /** 26 | * Sets detail list. 27 | * 28 | * @param detailList the detail list 29 | */ 30 | public void setDetailList(List detailList) { 31 | if (detailList != null) { 32 | this.detailList = Collections.unmodifiableList(detailList); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/src/main/java/eu/europeana/metis/debias/detect/model/error/Input.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.debias.detect.model.error; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | /** 7 | * The type Input. 8 | */ 9 | public class Input { 10 | 11 | /** 12 | * The Values. 13 | */ 14 | List values; 15 | 16 | /** 17 | * Gets values. 18 | * 19 | * @return the values 20 | */ 21 | public List getValues() { 22 | return values; 23 | } 24 | 25 | /** 26 | * Sets values. 27 | * 28 | * @param values the values 29 | */ 30 | public void setValues(List values) { 31 | if (values != null) { 32 | this.values = Collections.unmodifiableList(values); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/src/main/java/eu/europeana/metis/debias/detect/model/response/DetectionDeBiasResult.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.debias.detect.model.response; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import eu.europeana.metis.debias.detect.model.DeBiasResult; 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | /** 9 | * The type Detection result. 10 | */ 11 | public class DetectionDeBiasResult implements DeBiasResult { 12 | 13 | private Metadata metadata; 14 | @JsonProperty("results") 15 | private List detections; 16 | 17 | /** 18 | * Gets metadata. 19 | * 20 | * @return the metadata 21 | */ 22 | public Metadata getMetadata() { 23 | return metadata; 24 | } 25 | 26 | /** 27 | * Sets metadata. 28 | * 29 | * @param metadata the metadata 30 | */ 31 | public void setMetadata(Metadata metadata) { 32 | this.metadata = metadata; 33 | } 34 | 35 | /** 36 | * Gets detections. 37 | * 38 | * @return the detections 39 | */ 40 | public List getDetections() { 41 | return detections; 42 | } 43 | 44 | /** 45 | * Sets detections. 46 | * 47 | * @param detections the detections 48 | */ 49 | public void setDetections(List detections) { 50 | if (detections != null) { 51 | this.detections = Collections.unmodifiableList(detections); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/src/main/java/eu/europeana/metis/debias/detect/service/BiasDetectService.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.debias.detect.service; 2 | 3 | import eu.europeana.metis.debias.detect.model.DeBiasResult; 4 | import eu.europeana.metis.debias.detect.model.request.BiasInputLiterals; 5 | 6 | /** 7 | * Implementations of this interface are able to detect biased terms given the languages 8 | * and the terms to search, and it returns a report indicating the result of the terms. 9 | */ 10 | public interface BiasDetectService { 11 | 12 | /** 13 | * Method to detect biased terms according to the input values provided 14 | * 15 | * @param biasInputLiterals language and values 16 | * @return DeBiasResult containing metadata and values of the detection 17 | */ 18 | DeBiasResult detect(BiasInputLiterals biasInputLiterals); 19 | } 20 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/src/test/resources/sample_error_null_language.json: -------------------------------------------------------------------------------- 1 | { 2 | "detail": [ 3 | { 4 | "type": "string_type", 5 | "loc": [ 6 | "body", 7 | "language" 8 | ], 9 | "msg": "Input should be a valid string", 10 | "input": null, 11 | "url": "https://errors.pydantic.dev/2.5/v/string_type" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /metis-debias/metis-debias-detect-service/src/test/resources/sample_success_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "annotator": "de-bias", 4 | "thesaurus": null, 5 | "date": "2024-08-27T12:04:17" 6 | }, 7 | "results": [ 8 | { 9 | "language": "en", 10 | "literal": "sample title of aboriginal and addict", 11 | "tags": [ 12 | { 13 | "uri": "http://www.example.org/debias#t_2_en", 14 | "start": 16, 15 | "end": 26, 16 | "length": 10 17 | }, 18 | { 19 | "uri": "http://www.example.org/debias#t_3_en", 20 | "start": 31, 21 | "end": 37, 22 | "length": 6 23 | } 24 | ] 25 | }, 26 | { 27 | "language": "en", 28 | "literal": "a second addict sample title", 29 | "tags": [ 30 | { 31 | "uri": "http://www.example.org/debias#t_3_en", 32 | "start": 9, 33 | "end": 15, 34 | "length": 6 35 | } 36 | ] 37 | }, 38 | { 39 | "language": "en", 40 | "literal": "this is a demo of master and slave branch", 41 | "tags": [ 42 | { 43 | "uri": "http://www.example.org/debias#t_198_en", 44 | "start": 29, 45 | "end": 34, 46 | "length": 5 47 | } 48 | ] 49 | } 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /metis-debias/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | eu.europeana.metis 6 | 15-SNAPSHOT 7 | metis-framework 8 | 9 | 10 | metis-debias 11 | pom 12 | 13 | 14 | metis-debias-detect-service 15 | metis-debias-detect-rest 16 | 17 | 18 | -------------------------------------------------------------------------------- /metis-dereference/README.MD: -------------------------------------------------------------------------------- 1 | # Metis Dereference Service 2 | This module includes dereferencing functionality for Metis services. 3 | The module includes the following submodels: 4 | 5 | Module | Functionality 6 | ---|--- 7 | dereference-client | REST client for Dereferencing REST API 8 | dereference-common | Object model for dereferencing functioanlity 9 | dereference-service| Main functionality of dereferencing service 10 | dereference-rest | REST API for dereferencing service 11 | 12 | Dereferencing service allows the inclusion of external resources representing contextual classes in a Europeana record. 13 | This is achieved by means of providing XSLs that can convert the external resources to EDM contextual classes and the endpoint 14 | where the contextual resources can be accessible. The service allows for advanced functionality such as extracting different 15 | contextual classes from the same remote controlled vocabulary. The service functionality is exposed via a REST API. -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-common/src/main/java/eu/europeana/metis/dereference/ContextualClass.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference; 2 | 3 | /** 4 | * Enumeration holding the available contextual classes 5 | * Created by ymamakis on 2/11/16. 6 | */ 7 | public enum ContextualClass { 8 | AGENT,CONCEPT,PLACE,TIMESPAN 9 | } 10 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-common/src/test/resources/copy_xml.xslt: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-common/src/test/resources/invalid_xml.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-common/src/test/resources/produce_empty.xslt: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-common/src/test/resources/produce_invalid_xml.xslt: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-import/src/main/java/eu/europeana/metis/dereference/vocimport/VocabularyCollectionImporter.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference.vocimport; 2 | 3 | import eu.europeana.metis.dereference.vocimport.exception.VocabularyImportException; 4 | import eu.europeana.metis.dereference.vocimport.model.Location; 5 | import eu.europeana.metis.dereference.vocimport.model.VocabularyLoader; 6 | 7 | /** 8 | * Objects that implement this interface provide functionality that can perform the importing of 9 | * vocabularies. 10 | */ 11 | public interface VocabularyCollectionImporter { 12 | 13 | /** 14 | * Import all vocabularies. 15 | * 16 | * @return The vocabulary loaders (giving access to the vocabularies in a lazy manner). 17 | * @throws VocabularyImportException In case there was a problem loading the vocabularies. 18 | */ 19 | Iterable importVocabularies() throws VocabularyImportException; 20 | 21 | /** 22 | * @return The location of the vocabulary directory. 23 | */ 24 | Location getDirectoryLocation(); 25 | } 26 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-import/src/main/java/eu/europeana/metis/dereference/vocimport/exception/VocabularyImportException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference.vocimport.exception; 2 | 3 | /** 4 | * Indicates an issue with importing vocabularies or a specific vocabulary. 5 | */ 6 | public class VocabularyImportException extends Exception { 7 | 8 | private static final long serialVersionUID = 3492077867356670740L; 9 | 10 | /** 11 | * Constructor 12 | * 13 | * @param message The message. 14 | */ 15 | public VocabularyImportException(String message) { 16 | super(message); 17 | } 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param message The message. 23 | * @param cause The cause. 24 | */ 25 | public VocabularyImportException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-import/src/main/java/eu/europeana/metis/dereference/vocimport/model/Location.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference.vocimport.model; 2 | 3 | import eu.europeana.metis.exception.BadContentException; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | 7 | public interface Location { 8 | 9 | /** 10 | * Read a location to an input stream. 11 | * 12 | * @return An input stream. The caller is responsible for closing the stream. 13 | * @throws IOException In case the location could not be read. 14 | */ 15 | InputStream read() throws IOException; 16 | 17 | /** 18 | * Resolve a relative location against the given location. The given location can be assumed to be a file (as opposed to a 19 | * path/directory) so that essentially the relative location is resolved against the parent of the given location. 20 | * 21 | * @param relativeLocation The relative location to resolve. 22 | * @return The resolved location. 23 | * @throws BadContentException if the resolve did not succeed 24 | */ 25 | Location resolve(String relativeLocation) throws BadContentException; 26 | 27 | /** 28 | * @return A human-readable representation of the location. 29 | */ 30 | String toString(); 31 | } 32 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-import/src/main/java/eu/europeana/metis/dereference/vocimport/model/VocabularyDirectoryEntry.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference.vocimport.model; 2 | 3 | /** 4 | * This class represents an entry in the vocabulary directory. It is meant to reflect the structure 5 | * of the source of the data and changes should therefore not be made to this class without also 6 | * changing the format of the source. 7 | */ 8 | public class VocabularyDirectoryEntry { 9 | 10 | private String metadata; 11 | private String mapping; 12 | 13 | public String getMetadata() { 14 | return metadata; 15 | } 16 | 17 | public String getMapping() { 18 | return mapping; 19 | } 20 | 21 | void setMetadata(String metadata) { 22 | this.metadata = metadata; 23 | } 24 | 25 | void setMapping(String mapping) { 26 | this.mapping = mapping; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-import/src/main/java/eu/europeana/metis/dereference/vocimport/model/VocabularyLoader.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference.vocimport.model; 2 | 3 | import eu.europeana.metis.dereference.vocimport.exception.VocabularyImportException; 4 | 5 | /** 6 | * This class represents a vocabulary loader. It is used to achieve lazy loading (only when the load 7 | * method is called will the vocabulary be loaded). 8 | */ 9 | @FunctionalInterface 10 | public interface VocabularyLoader { 11 | 12 | /** 13 | * Trigger a loading of the vocabulary. Blocks until the vocabulary is loaded. This method can be 14 | * 15 | * @return The loaded vocabulary. 16 | * @throws VocabularyImportException In case there was a problem loading the vocabulary. 17 | */ 18 | Vocabulary load() throws VocabularyImportException; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-rest/.gitignore: -------------------------------------------------------------------------------- 1 | ##Add to ignore to not commit by mistake 2 | /src/main/resources/application.properties 3 | /src/main/resources/application.properties -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-rest/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eclipse-temurin:21-jre 2 | COPY target/*.jar app.jar 3 | EXPOSE 8080 4 | ENTRYPOINT ["java", "-jar", "/app.jar"] -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-rest/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | mongo: 5 | image: mongo:4.2.9 6 | container_name: metis-dereference-mongo 7 | environment: 8 | MONGO_INITDB_DATABASE: metis-dereference 9 | MONGO_INITDB_ROOT_USERNAME: guest 10 | MONGO_INITDB_ROOT_PASSWORD: guest 11 | ports: 12 | - '27017:27017' 13 | metis-dereference-local: 14 | image: europeana/metis-dereference:develop 15 | container_name: metis-dereference-local 16 | build: 17 | context: ./ 18 | dockerfile: Dockerfile 19 | ports: 20 | - '8080:8080' 21 | environment: 22 | MONGO_HOSTS: metis-dereference-mongo 23 | volumes: 24 | - /data/metis-configuration/metis-framework/metis-dereference/metis-dereference-rest/k8s/overlays/local/components/properties/application.properties:/application.properties 25 | - /data/metis-configuration/k8s/custom-truststore-jks/custom-truststore.jks:/data/certificates/custom-truststore.jks 26 | - /data/metis-configuration/k8s/log4j2-xml/log4j2.xml:/data/logging/log4j2.xml 27 | depends_on: 28 | - mongo 29 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-rest/src/main/java/eu/europeana/metis/dereference/rest/Application.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference.rest; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * The Spring boot application entry point. 8 | */ 9 | @SpringBootApplication 10 | public class Application { 11 | 12 | /** 13 | * The main spring boot method. 14 | * 15 | * @param args application arguments 16 | */ 17 | public static void main(String[] args) { 18 | SpringApplication.run(Application.class, args); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-rest/src/main/java/eu/europeana/metis/dereference/rest/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference.rest.config; 2 | 3 | import io.swagger.v3.oas.models.OpenAPI; 4 | import io.swagger.v3.oas.models.info.Info; 5 | import io.swagger.v3.oas.models.info.License; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | /** 10 | * Config for Swagger documentation 11 | */ 12 | @Configuration 13 | public class SwaggerConfig { 14 | 15 | /** 16 | * The open api documentation docket. 17 | * 18 | * @return the docket configuration 19 | */ 20 | @Bean 21 | public OpenAPI openAPI() { 22 | return new OpenAPI() 23 | .info(new Info() 24 | .title("Dereference REST API") 25 | .description("Dereference REST API for Europeana") 26 | .version("v1") 27 | .license(new License() 28 | .name("EUPL Licence v1.2") 29 | .url("https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12"))); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-rest/src/main/java/eu/europeana/metis/dereference/rest/config/properties/MetisDereferenceConfigurationProperties.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference.rest.config.properties; 2 | 3 | import java.util.List; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | /** 7 | * Class using {@link ConfigurationProperties} loading. 8 | */ 9 | @ConfigurationProperties(prefix = "metis-dereference") 10 | public record MetisDereferenceConfigurationProperties( 11 | String allowedUrlDomains, 12 | String purgeAllFrequency, 13 | String purgeEmptyXmlFrequency, 14 | List allowedCorsHosts 15 | ) {} 16 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-rest/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-service/src/main/java/eu/europeana/metis/dereference/service/DereferenceService.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.dereference.service; 2 | 3 | import eu.europeana.metis.dereference.DereferenceResult; 4 | 5 | /** 6 | * Implementations of this interface are able to dereference resource IDs. If the resource's 7 | * vocabulary specifies a positive iteration count, this method also repeatedly retrieves the 8 | * 'broader' resources and returns those as well. 9 | */ 10 | public interface DereferenceService { 11 | 12 | /** 13 | *

14 | * This method dereferences a resource. If the resource's vocabulary specifies a positive 15 | * iteration count, this method also repeatedly retrieves the 'broader' resources and returns 16 | * those as well. 17 | *

18 | *

19 | * A resource may have references to its 'broader' resources. these resources form a directed 20 | * graph and the iteration count is the distance from the requested resource. This method performs 21 | * a breadth-first search through this graph to retrieve all resources within a certain distance 22 | * from the requested resource. The distance depends on the vocabulary of the main resource. 23 | *

24 | * 25 | * @param resourceId The resource to dereference. 26 | * @return An object containing the dereferenced resources and the result status of the process. 27 | */ 28 | DereferenceResult dereference(String resourceId); 29 | } 30 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-service/src/test/resources/log4j.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-service/src/test/resources/vocabulary-fault.yml: -------------------------------------------------------------------------------- 1 | # test 2 | - metadata: vocabulary/voctest1.yml 3 | mapping: vocabulary/voctest1.xsl 4 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-service/src/test/resources/vocabulary.yml: -------------------------------------------------------------------------------- 1 | # test 2 | - metadata: vocabulary/voctest.yml 3 | mapping: vocabulary/voctest.xsl 4 | -------------------------------------------------------------------------------- /metis-dereference/metis-dereference-service/src/test/resources/vocabulary/voctest.yml: -------------------------------------------------------------------------------- 1 | name: TestWikidata 2 | types: 3 | - AGENT 4 | - CONCEPT 5 | - PLACE 6 | - TIMESTAMP 7 | paths: 8 | - http://www.wikidata.org/entity/ 9 | examples: 10 | - http://www.wikidata.org/entity/Q3930 11 | - http://www.wikidata.org/entity/Q604667 12 | - http://www.wikidata.org/entity/Q79007 13 | - http://www.wikidata.org/entity/Q1261026 14 | - http://www.wikidata.org/entity/Q36422 15 | - http://www.wikidata.org/entity/Q6927 16 | - http://www.wikidata.org/entity/Q90 17 | - http://www.wikidata.org/entity/Q187843 18 | - http://www.wikidata.org/entity/Q145 19 | -------------------------------------------------------------------------------- /metis-dereference/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | eu.europeana.metis 7 | 15-SNAPSHOT 8 | metis-framework 9 | 10 | 11 | metis-dereference 12 | pom 13 | 14 | 15 | metis-dereference-common 16 | metis-dereference-service 17 | metis-dereference-rest 18 | metis-dereference-import 19 | 20 | -------------------------------------------------------------------------------- /metis-enrichment/README.MD: -------------------------------------------------------------------------------- 1 | # Metis Enrichment service 2 | This module includes the enrichment services and functionality of Metis. 3 | This is based on Annocultor semantic enrichment toolkit, heavily modified with 4 | scalability in mind. 5 | The module is organized as follows: 6 | 7 | Module | Functionality 8 | ---|--- 9 | enrichment-framework-client | Java REST API client for enrichment 10 | enrichment-framework-common | Object model for the REST API of enrichment 11 | enrichment-framework-gui | GUI for enrichment 12 | enrichment-framework-knowledgebase | Harvester and transformation utils for enrichment 13 | enrichment-framework-rest | REST API for enrichment 14 | enrichment-framework-service | Enrichment functionality 15 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/main/java/eu/europeana/enrichment/rest/client/exceptions/DereferenceException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.rest.client.exceptions; 2 | 3 | /** 4 | * Exception indicating a problem arising during dereferencing. 5 | */ 6 | public class DereferenceException extends Exception { 7 | 8 | private static final long serialVersionUID = -4429750421981318176L; 9 | 10 | /** 11 | * Constructor. 12 | * 13 | * @param message The message. 14 | * @param cause The cause. 15 | */ 16 | public DereferenceException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/main/java/eu/europeana/enrichment/rest/client/exceptions/EnrichmentException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.rest.client.exceptions; 2 | 3 | /** 4 | * Exception indicating a problem arising during enrichment. 5 | */ 6 | public class EnrichmentException extends Exception { 7 | 8 | private static final long serialVersionUID = 1205297107575299710L; 9 | 10 | /** 11 | * Constructor. 12 | * 13 | * @param message The message. 14 | * @param cause The cause. 15 | */ 16 | public EnrichmentException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/main/java/eu/europeana/enrichment/rest/client/report/Type.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.rest.client.report; 2 | 3 | /** 4 | * Type of notification 5 | * This indicates the type of notification in a {@link Report} 6 | * ERROR, IGNORE or WARN 7 | */ 8 | public enum Type { 9 | ERROR, 10 | IGNORE, 11 | WARN 12 | } 13 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/main/resources/adList: -------------------------------------------------------------------------------- 1 | ad 2 | a.d. 3 | after christ 4 | nC 5 | na Christus 6 | n.C. 7 | ná Christus 8 | n. Chr. 9 | n.Chr 10 | après Jésus-Christ 11 | après le Christ 12 | après JC 13 | après Jésus Christ 14 | nach Christus 15 | nach Christi 16 | nach Christi Geburt 17 | nach Christo 18 | después de Cristo 19 | después de Jesucristo -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/java/eu/europeana/enrichment/rest/client/dereference/DereferencerProviderTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.rest.client.dereference; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertThrows; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | public class DereferencerProviderTest { 8 | 9 | @Test 10 | void testIllegalArgumentException() { 11 | assertThrows(IllegalStateException.class, () -> new DereferencerProvider().create()); 12 | assertThrows(IllegalStateException.class, 13 | () -> { 14 | DereferencerProvider provider = new DereferencerProvider(); 15 | provider.setDereferenceUrl(""); 16 | provider.setEnrichmentPropertiesValues("", "", "", ""); 17 | provider.create(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/java/eu/europeana/enrichment/rest/client/enrichment/EnricherProviderTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.rest.client.enrichment; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertThrows; 4 | 5 | import eu.europeana.enrichment.rest.client.exceptions.EnrichmentException; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class EnricherProviderTest { 9 | 10 | @Test 11 | void testIllegalArgumentException() { 12 | assertThrows(EnrichmentException.class, () -> new EnricherProvider().create()); 13 | assertThrows(EnrichmentException.class, 14 | () -> { 15 | EnricherProvider provider = new EnricherProvider(); 16 | provider.setEnrichmentPropertiesValues("", "", "", ""); 17 | provider.create(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/dereference/dereference-failure.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FAILURE 5 | 6 | 7 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/dereference/dereference-no-vocabulary.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NO_VOCABULARY_MATCHING 5 | 6 | 7 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/dereference/dereference-normal-redirect.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Flowers 6 | Άνθη 7 | 8 | 9 | 10 | SUCCESS 11 | 12 | 13 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/dereference/dereference-null.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/dereference/dereference-unknown-europeana-entity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UNKNOWN_EUROPEANA_ENTITY 5 | 6 | 7 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/entity-api/entity-api-response-agent-nomatch.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "http://www.europeana.eu/schemas/context/entity.jsonld", 3 | "id": "http://entity-api.mock/entity/search?wskey=api2demo&text=Piotras%20Kalabuchovas&type=agent&page=0&pageSize=10", 4 | "type": "ResultPage", 5 | "total": 0, 6 | "partOf": { 7 | "id": "http://entity-api.mock/entity/search?wskey=api2demo&text=Piotras%20Kalabuchovas&type=agent", 8 | "type": "ResultList", 9 | "total": 0 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/entity-api/entity-api-response-concept-iii.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "http://www.europeana.eu/schemas/context/entity.jsonld", 3 | "id": "https://entity-api-v2-production.eanadev.org/entity/search?wskey=api2demo&text=G%C3%BCiro&lang=es&type=concept&page=0&pageSize=10", 4 | "type": "ResultPage", 5 | "total": 0, 6 | "partOf": { 7 | "id": "https://entity-api-v2-production.eanadev.org/entity/search?wskey=api2demo&text=G%C3%BCiro&lang=es&type=concept", 8 | "type": "ResultList", 9 | "total": 0 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/entity-api/entity-api-response-concept-nomatch.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "http://www.europeana.eu/schemas/context/entity.jsonld", 3 | "id": "http://entity-api.mock/entity/search?wskey=api2demo&text=Paranguaricutirimicuaro&type=concept&page=0&pageSize=10", 4 | "type": "ResultPage", 5 | "total": 0, 6 | "partOf": { 7 | "id": "http://entity-api.mock/entity/search?wskey=api2demo&text=Paranguaricutirimicuaro&type=concept", 8 | "type": "ResultList", 9 | "total": 0 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/entity-api/entity-api-response-concept-notfound.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "http://www.europeana.eu/schemas/context/entity.jsonld", 3 | "id": "https://api.europeana.eu/entity/search?wskey=api2demo&text=XXXXXXXXX&lang=nl&type=concept&query=XXXXXXXXX&page=0&pageSize=10", 4 | "type": "ResultPage", 5 | "total": 0, 6 | "partOf": { 7 | "id": "https://api.europeana.eu/entity/search?wskey=api2demo&text=XXXXXXXXX&lang=nl&type=concept&query=XXXXXXXXX", 8 | "type": "ResultList", 9 | "total": 0 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/entity-api/entity-api-response-resolve-uri-concept-ii.json: -------------------------------------------------------------------------------- 1 | { 2 | "apikey": "api2demo", 3 | "action": "/entity/resolve", 4 | "success": false, 5 | "error": "No entity found for sameAs/exactMatch URI : {{request.query}}" 6 | } 7 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/entity-api/entity-api-response-resolve-uri-nomatch.json: -------------------------------------------------------------------------------- 1 | { 2 | "apikey": "api2demo", 3 | "action": "/entity/resolve", 4 | "success": false, 5 | "error": "No entity found for sameAs/exactMatch URI : http://dbpedia.org/resource/Lithuanian_Soviet_Socialist_Republic_%281918%E2%80%931919%29" 6 | } 7 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/entity-api/entity-api-response-timespan.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "http://www.europeana.eu/schemas/context/entity.jsonld", 3 | "id": "https://entity-api-v2-production.eanadev.org/entity/search?wskey=api2demo&text=1957&lang=en&type=timespan&page=0&pageSize=10", 4 | "type": "ResultPage", 5 | "total": 0, 6 | "partOf": { 7 | "id": "https://entity-api-v2-production.eanadev.org/entity/search?wskey=api2demo&text=1957&lang=en&type=timespan", 8 | "type": "ResultList", 9 | "total": 0 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-client/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/exceptions/UnknownException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.exceptions; 2 | 3 | /** 4 | * Generic Exception not covered by the standard Jackson Exceptions 5 | * 6 | * @author Yorgos.Mamakis@ europeana.eu 7 | */ 8 | public class UnknownException extends RuntimeException { 9 | private static final long serialVersionUID = -7418853794840766813L; 10 | 11 | /** 12 | * A generic non-standard Exception 13 | * 14 | * @param message The message caused by the original exception 15 | */ 16 | public UnknownException(String message) { 17 | super(message); 18 | } 19 | 20 | /** 21 | * Constructs a new exception with the specified detail message and 22 | * cause. 23 | * 24 | * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method). 25 | * @param cause the cause (which is saved for later retrieval by the 26 | * {@link #getCause()} method). (A null value is 27 | * permitted, and indicates that the cause is nonexistent or 28 | * unknown.) 29 | */ 30 | public UnknownException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/external/exceptions/EntityApiException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.external.exceptions; 2 | 3 | import java.io.Serial; 4 | 5 | /** 6 | * The type Entity API client exception. 7 | */ 8 | public class EntityApiException extends RuntimeException { 9 | 10 | @Serial 11 | private static final long serialVersionUID = -272263706753226938L; 12 | 13 | /** 14 | * Instantiates a new Entity API client exception. 15 | * 16 | * @param message the message 17 | * @param cause the cause 18 | */ 19 | public EntityApiException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/external/model/Agent.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.external.model; 2 | 3 | import jakarta.xml.bind.annotation.XmlAccessType; 4 | import jakarta.xml.bind.annotation.XmlAccessorType; 5 | import jakarta.xml.bind.annotation.XmlRootElement; 6 | 7 | /** 8 | * Model class that holds an Agent(for example a person) 9 | */ 10 | @XmlRootElement(namespace = "http://www.europeana.eu/schemas/edm/", name = "Agent") 11 | @XmlAccessorType(XmlAccessType.FIELD) 12 | public class Agent extends AgentBase { 13 | 14 | public Agent() { 15 | } 16 | 17 | public Agent(eu.europeana.entitymanagement.definitions.model.Agent entity) { 18 | super(entity); 19 | } 20 | 21 | public Agent(eu.europeana.entitymanagement.definitions.model.Organization entity) { 22 | super(entity); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/external/model/Part.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.external.model; 2 | 3 | import jakarta.xml.bind.annotation.XmlAccessType; 4 | import jakarta.xml.bind.annotation.XmlAccessorType; 5 | import jakarta.xml.bind.annotation.XmlAttribute; 6 | 7 | /** 8 | * Part model class. Basically encapsulating a resource field. 9 | *

10 | * TODO the definition is identical to that of Resource. This object (and the super interface) 11 | * should be decommissioned. 12 | */ 13 | @XmlAccessorType(XmlAccessType.FIELD) 14 | public class Part implements WebResource { 15 | 16 | @XmlAttribute(name = "resource", namespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#") 17 | private String resource; 18 | 19 | /** 20 | * Constructor with initial field value. 21 | * 22 | * @param resource the initial resource value 23 | */ 24 | public Part(String resource) { 25 | this.resource = resource; 26 | } 27 | 28 | public Part() { 29 | } 30 | 31 | public String getResource() { 32 | return resource; 33 | } 34 | 35 | public void setResource(String resource) { 36 | this.resource = resource; 37 | } 38 | 39 | @Override 40 | public String getResourceUri() { 41 | return getResource(); 42 | } 43 | 44 | @Override 45 | public void setResourceUri(String resource) { 46 | setResource(resource); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/external/model/Resource.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.external.model; 2 | 3 | import jakarta.xml.bind.annotation.XmlAccessType; 4 | import jakarta.xml.bind.annotation.XmlAccessorType; 5 | import jakarta.xml.bind.annotation.XmlAttribute; 6 | 7 | /** 8 | * Resource model class. Basically encapsulating a resource field. 9 | */ 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Resource implements WebResource { 12 | 13 | @XmlAttribute(name = "resource", namespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#") 14 | private String resource; 15 | 16 | /** 17 | * Constructor with initial field value. 18 | * 19 | * @param resource the initial resource value 20 | */ 21 | public Resource(String resource) { 22 | this.resource = resource; 23 | } 24 | 25 | public Resource() { 26 | } 27 | 28 | public String getResource() { 29 | return resource; 30 | } 31 | 32 | public void setResource(String resource) { 33 | this.resource = resource; 34 | } 35 | 36 | @Override 37 | public String getResourceUri() { 38 | return getResource(); 39 | } 40 | 41 | @Override 42 | public void setResourceUri(String resource) { 43 | setResource(resource); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/external/model/VcardAddresses.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.external.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import jakarta.xml.bind.annotation.XmlAccessType; 6 | import jakarta.xml.bind.annotation.XmlAccessorType; 7 | import jakarta.xml.bind.annotation.XmlElement; 8 | import jakarta.xml.bind.annotation.XmlRootElement; 9 | 10 | /** 11 | * This class stores result of the parsing of XSLT/XML Wikidata content for the list of addresses. 12 | * 13 | * @author GrafR 14 | */ 15 | @XmlRootElement(namespace = "http://www.w3.org/2006/vcard/ns#", name = "hasAddress") 16 | @XmlAccessorType(XmlAccessType.FIELD) 17 | public class VcardAddresses { 18 | 19 | @XmlElement(name = "Address", namespace = "http://www.w3.org/2006/vcard/ns#") 20 | private List vcardAddressesList = new ArrayList<>(); 21 | 22 | public List getVcardAddressesList() { 23 | return vcardAddressesList == null ? null : new ArrayList<>(vcardAddressesList); 24 | } 25 | 26 | public void setVcardAddressesList(List vcardAddressesList) { 27 | this.vcardAddressesList = 28 | vcardAddressesList == null ? null : new ArrayList<>(vcardAddressesList); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/external/model/WebResource.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.external.model; 2 | 3 | /** 4 | * This interface supports implementation of common methods for conversion of different organization resource fields to different 5 | * organization objects. 6 | */ 7 | public interface WebResource { 8 | 9 | String getResourceUri(); 10 | 11 | void setResourceUri(String resource); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/internal/AbstractReferenceTerm.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.internal; 2 | 3 | import java.net.URL; 4 | import java.util.Optional; 5 | 6 | /** 7 | * This class is a basic implementation of {@link ReferenceTerm} that leaves the details of the 8 | * candidate types unimplemented. 9 | */ 10 | public abstract class AbstractReferenceTerm implements ReferenceTerm { 11 | 12 | private final URL reference; 13 | 14 | protected AbstractReferenceTerm(URL reference) { 15 | this.reference = reference; 16 | } 17 | 18 | @Override 19 | public URL getReference() { 20 | return reference; 21 | } 22 | 23 | public String getReferenceAsString() { 24 | return urlToString(reference); 25 | } 26 | 27 | protected static String urlToString (URL url) { 28 | return Optional.ofNullable(url).map(URL::toString).orElse(null); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/internal/AbstractSearchTerm.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.internal; 2 | 3 | /** 4 | * This class is a basic implementation of {@link SearchTerm} that leaves the details of the 5 | * candidate types unimplemented. 6 | */ 7 | public abstract class AbstractSearchTerm implements SearchTerm { 8 | 9 | private final String textValue; 10 | private final String language; 11 | 12 | protected AbstractSearchTerm(String textValue, String language) { 13 | this.textValue = textValue; 14 | this.language = language; 15 | } 16 | 17 | public String getTextValue() { 18 | return textValue; 19 | } 20 | 21 | public String getLanguage() { 22 | return language; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/internal/FieldValue.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.internal; 2 | 3 | public record FieldValue(String value, String language) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/internal/RecordParser.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.internal; 2 | 3 | import eu.europeana.metis.schema.jibx.RDF; 4 | import java.util.Set; 5 | 6 | /** 7 | * Implementations of this interface provide functionality to parse records and extract search terms 8 | * and references for enrichment. 9 | */ 10 | public interface RecordParser { 11 | 12 | /** 13 | * This method parses records to obtain search terms for enrichment. 14 | * 15 | * @param rdf The record. 16 | * @return The search terms. It is recommended to return one object per term-language combination. 17 | */ 18 | Set parseSearchTerms(RDF rdf); 19 | 20 | /** 21 | * This method parses records to obtain references for enrichment. 22 | * 23 | * @param rdf The record. 24 | * @return The references. It is recommended to return one object per reference. 25 | */ 26 | Set parseReferences(RDF rdf); 27 | } 28 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/internal/ReferenceTerm.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.internal; 2 | 3 | import eu.europeana.enrichment.utils.EntityType; 4 | import java.net.URL; 5 | import java.util.Set; 6 | 7 | /** 8 | * Represents a reference term: a URL reference in a record with a list of candidate reference 9 | * types. 10 | */ 11 | public interface ReferenceTerm { 12 | 13 | Set getCandidateTypes(); 14 | 15 | URL getReference(); 16 | } 17 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/internal/SearchTerm.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.internal; 2 | 3 | import eu.europeana.enrichment.utils.EntityType; 4 | import java.util.Set; 5 | 6 | /** 7 | * Represents a search term: a text reference (with an optional language) in a record with a list of 8 | * candidate reference types. 9 | */ 10 | public interface SearchTerm { 11 | 12 | Set getCandidateTypes(); 13 | 14 | String getTextValue(); 15 | 16 | String getLanguage(); 17 | } 18 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/api/internal/TermContext.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.api.internal; 2 | 3 | import eu.europeana.metis.schema.jibx.AboutType; 4 | import eu.europeana.metis.schema.jibx.ResourceOrLiteralType; 5 | import java.util.Set; 6 | 7 | /** 8 | * Implementations of this interface capture the content of a term (to be enriched). 9 | */ 10 | public interface TermContext { 11 | 12 | /** 13 | * Return the field types in which this term occurs. 14 | * 15 | * @return The field types. 16 | */ 17 | Set> getFieldTypes(); 18 | 19 | /** 20 | * Returns whether the term value is equal to the given value (literal or reference). 21 | * @param resourceOrLiteralType The value to compare with. 22 | * @return Whether this term's value is equal to that of the given value. 23 | */ 24 | boolean valueEquals(ResourceOrLiteralType resourceOrLiteralType); 25 | } 26 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/main/java/eu/europeana/enrichment/utils/EntityType.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.utils; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import jakarta.xml.bind.annotation.XmlRootElement; 5 | 6 | /** 7 | * Enumeration that holds the different vocabularies supported for enrichment 8 | */ 9 | @XmlRootElement 10 | @JsonInclude 11 | public enum EntityType { 12 | CONCEPT, TIMESPAN, AGENT, PLACE, ORGANIZATION 13 | } 14 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/test/java/eu/europeana/enrichment/utils/LanguageCodeConverterTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.enrichment.utils; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.junit.jupiter.api.Assertions.assertNull; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | class LanguageCodeConverterTest { 9 | 10 | @Test 11 | void convertLanguageCode() { 12 | final LanguageCodeConverter languageCodeConverter = new LanguageCodeConverter(); 13 | assertEquals("en", languageCodeConverter.convertLanguageCode("eng")); 14 | assertEquals("en", languageCodeConverter.convertLanguageCode("en")); 15 | assertNull(languageCodeConverter.convertLanguageCode("english")); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /metis-enrichment/metis-enrichment-common/src/test/resources/entity-organization.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Malopolska Digital Library 7 | Małopolska Biblioteka Cyfrowa 8 | 9 | -------------------------------------------------------------------------------- /metis-enrichment/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | metis-framework 6 | eu.europeana.metis 7 | 15-SNAPSHOT 8 | 9 | metis-enrichment 10 | pom 11 | 12 | 13 | metis-enrichment-common 14 | metis-enrichment-client 15 | 16 | 17 | 18 | 19 | org.junit.jupiter 20 | junit-jupiter-api 21 | 22 | 23 | org.junit.jupiter 24 | junit-jupiter-engine 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /metis-harvesting/src/main/java/eu/europeana/metis/harvesting/FullRecordHarvestingIterator.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.harvesting; 2 | 3 | /** 4 | * Implementations of this interface allow iterative access to records as they are being harvested. 5 | * The iterator needs to be closed after use. 6 | * 7 | * @param The type of the record to harvest. 8 | * @param The type of the object on which filtering is to be applied. 9 | */ 10 | public interface FullRecordHarvestingIterator extends 11 | HarvestingIterator { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /metis-harvesting/src/main/java/eu/europeana/metis/harvesting/HarvesterException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.harvesting; 2 | 3 | /** 4 | * Exception that can be thrown as the result of a harvesting issue. 5 | */ 6 | public class HarvesterException extends Exception { 7 | 8 | private static final long serialVersionUID = 3937292609814351251L; 9 | 10 | /** 11 | * Constructor. 12 | * 13 | * @param message The message of the exception. 14 | * @param cause The cause of the exception. 15 | */ 16 | public HarvesterException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param message The message of the exception. 24 | */ 25 | public HarvesterException(String message) { 26 | super(message); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /metis-harvesting/src/main/java/eu/europeana/metis/harvesting/ReportingIteration.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.harvesting; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Implementations of this interface represent an iteration of a data iterator that also reports on 7 | * whether to continue. 8 | * 9 | * @param The type of the data to iterate over. 10 | */ 11 | @FunctionalInterface 12 | public interface ReportingIteration { 13 | 14 | /** 15 | * The result of an iteration, indicating whether to proceed. 16 | */ 17 | enum IterationResult {TERMINATE, CONTINUE} 18 | 19 | /** 20 | * Perform one iteration for the given data. 21 | * 22 | * @param data The data to process. 23 | * @return Whether to continue processing. 24 | * @throws IOException in case there was a harvesting related issue. This will cause the remaining 25 | * records not to be processed (as if {@link IterationResult#TERMINATE} was 26 | * passed). 27 | */ 28 | IterationResult process(T data) throws IOException; 29 | } 30 | -------------------------------------------------------------------------------- /metis-harvesting/src/main/java/eu/europeana/metis/harvesting/oaipmh/CloseableOaiClient.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.harvesting.oaipmh; 2 | 3 | import io.gdcc.xoai.serviceprovider.client.OAIClient; 4 | 5 | import java.io.Closeable; 6 | 7 | /** 8 | * Implementations of this interface provide OAI access and need to be closed. 9 | */ 10 | public abstract class CloseableOaiClient extends OAIClient implements Closeable { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /metis-harvesting/src/main/java/eu/europeana/metis/harvesting/oaipmh/OaiRepository.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.harvesting.oaipmh; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Immutable object representing an OAI-PMH repository. 7 | */ 8 | public class OaiRepository implements Serializable { 9 | 10 | private static final long serialVersionUID = -7857963246782477550L; 11 | 12 | private final String repositoryUrl; 13 | private final String metadataPrefix; 14 | 15 | /** 16 | * Constructor. 17 | * 18 | * @param repositoryUrl The base url of the repository. 19 | * @param metadataPrefix The metadata prefix (optional). 20 | */ 21 | public OaiRepository(String repositoryUrl, String metadataPrefix) { 22 | this.repositoryUrl = repositoryUrl; 23 | this.metadataPrefix = metadataPrefix; 24 | } 25 | 26 | public String getRepositoryUrl() { 27 | return repositoryUrl; 28 | } 29 | 30 | public String getMetadataPrefix() { 31 | return metadataPrefix; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return "OaiRepository{" + 37 | "repositoryUrl='" + repositoryUrl + '\'' + 38 | ", metadataPrefix='" + metadataPrefix + '\'' + 39 | '}'; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /metis-harvesting/src/test/resources/deletedOaiRecord.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 2017-08-22T09:18:28Z 5 | 6 | http://www.mediateka.centrumzamenhofa.pl/oai-phm/ 7 | 8 | 9 | 10 |

11 | oai:mediateka.centrumzamenhofa.pl:20 12 | 2020-02-02T12:21:00Z 13 | mediateka:PL_2004_1 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /metis-harvesting/src/test/resources/expectedOaiRecord.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Fotografowie z zakładu przy ul. Kocha, Białystok,ok. 1942 r. 7 | Dawdo Danuta 8 | Mediateka Centrum im. Ludwika Zamenhofa w Białymstoku 9 | 1942 10 | dokument obrazowy 11 | video/mp4 12 | http://www.mediateka.centrumzamenhofa.pl/photos/?show_image=19 13 | 14 | http://www.mediateka.centrumzamenhofa.pl/files/PL_2004_1/PL_2004_1_1/PL_2004_1_1_2/large/PL_2004_1_1_2_002-large.jpg 15 | 16 | Creative Commons Uznanie Autorstwa - Użycie Niekomercyjne - Na Tych Samych Warunkach 17 | (CC-BY-NC-SA) 18 | 19 | 20 | -------------------------------------------------------------------------------- /metis-harvesting/src/test/resources/oaiListIdentifiers.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 2017-11-15T12:30:02Z 5 | 6 | http://kulturarvsdata.se/oaicat-europeana/OAIHandler/default 7 | 8 | 9 |
10 | http://kulturarvsdata.se/SMVK-MM/Islam/3300001 11 | 2017-11-12 12 | smvk-mm 13 |
14 | 15 | edm:smvk-mm:*:*:50:2932 16 | 17 |
18 |
-------------------------------------------------------------------------------- /metis-harvesting/src/test/resources/oaiListIdentifiers2.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 2017-11-15T12:30:02Z 5 | 6 | http://kulturarvsdata.se/oaicat-europeana/OAIHandler/default 7 | 8 | 9 |
10 | http://kulturarvsdata.se/SMVK-MM/Islam/3300001 11 | 2017-11-12 12 | smvk-mm 13 |
14 | 15 | edm:smvk-mm:*:*:50:2932 16 | 17 |
18 |
-------------------------------------------------------------------------------- /metis-harvesting/src/test/resources/oaiListIdentifiersIncorrectCompleteListSize.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 2017-11-15T12:30:02Z 5 | 6 | http://kulturarvsdata.se/oaicat-europeana/OAIHandler/default 7 | 8 | 9 |
10 | http://kulturarvsdata.se/SMVK-MM/Islam/3300001 11 | 2017-11-12 12 | smvk-mm 13 |
14 | 15 | edm:smvk-mm:*:*:50:2932 16 | 17 |
18 |
-------------------------------------------------------------------------------- /metis-harvesting/src/test/resources/oaiListIdentifiersIncorrectMetadataPrefix.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 2017-11-20T12:18:58Z 9 | 10 | http://lib.psnc.pl/oai-pmh-repository.xml 11 | Wrong metadata prefix. 12 | 13 | -------------------------------------------------------------------------------- /metis-harvesting/src/test/resources/oaiListIdentifiersNoCompleteListSize.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 2017-11-15T12:30:02Z 5 | 6 | http://kulturarvsdata.se/oaicat-europeana/OAIHandler/default 7 | 8 | 9 |
10 | http://kulturarvsdata.se/SMVK-MM/Islam/3300001 11 | 2017-11-12 12 | smvk-mm 13 |
14 | 15 | edm:smvk-mm:*:*:50:2932 16 | 17 |
18 |
-------------------------------------------------------------------------------- /metis-harvesting/src/test/resources/oaiListIdentifiersNoResumptionToken.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 2017-11-15T12:30:02Z 5 | 6 | http://kulturarvsdata.se/oaicat-europeana/OAIHandler/default 7 | 8 | 9 |
10 | http://kulturarvsdata.se/SMVK-MM/Islam/3300001 11 | 2017-11-12 12 | smvk-mm 13 |
14 |
15 |
-------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/SimpleIndexer.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing; 2 | 3 | import eu.europeana.indexing.exception.IndexingException; 4 | import eu.europeana.metis.schema.jibx.RDF; 5 | 6 | /** 7 | * The interface Simple indexer. 8 | */ 9 | public interface SimpleIndexer { 10 | 11 | /** 12 | * Index record. 13 | * 14 | * @param record the record 15 | * @throws IndexingException the indexing exception 16 | */ 17 | void indexRecord(RDF record) throws IndexingException; 18 | 19 | /** 20 | * Index record. 21 | * 22 | * @param record the record 23 | * @throws IndexingException the indexing exception 24 | */ 25 | void indexRecord(String record) throws IndexingException; 26 | } 27 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/SimpleIndexerFactory.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing; 2 | 3 | import eu.europeana.indexing.exception.SetupRelatedIndexingException; 4 | import eu.europeana.indexing.mongo.MongoIndexer; 5 | import eu.europeana.indexing.mongo.MongoIndexingSettings; 6 | import eu.europeana.indexing.solr.SolrIndexer; 7 | import eu.europeana.indexing.solr.SolrIndexingSettings; 8 | import eu.europeana.metis.common.SettingsHolder; 9 | 10 | /** 11 | * The type Simple indexer factory. 12 | */ 13 | public class SimpleIndexerFactory { 14 | 15 | /** 16 | * Gets an indexer. 17 | * @param settings the settings can be either a SolrProperties or MongoProperties object. 18 | * @return the indexer {@link SimpleIndexer} pointing to mongo or solr. 19 | * @throws SetupRelatedIndexingException the setup related indexing exception 20 | */ 21 | public SimpleIndexer getIndexer(SettingsHolder settings) throws SetupRelatedIndexingException { 22 | if (settings instanceof SolrIndexingSettings solrIndexingSettings) { 23 | return new SolrIndexer(solrIndexingSettings); 24 | } else if (settings instanceof MongoIndexingSettings mongoIndexingSettings) { 25 | return new MongoIndexer(mongoIndexingSettings); 26 | } else { 27 | throw new IllegalArgumentException("Invalid property configuration"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/exception/IndexerRelatedIndexingException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.exception; 2 | 3 | /** 4 | * This exception is one thrown by the indexer if there is a problem related with saving/indexing a 5 | * given record. This signifies that the problem is likely not with the local setup or the 6 | * individual record submitted for indexing, but rather with the connection setup or the 7 | * connection/communication to the target data storage itself. This exception would result in the 8 | * indexer being invalidated and another indexer being tried. 9 | */ 10 | public class IndexerRelatedIndexingException extends IndexingException { 11 | 12 | /** 13 | * Required for implementations of {@link java.io.Serializable}. 14 | **/ 15 | private static final long serialVersionUID = 486509140109072537L; 16 | 17 | /** 18 | * Constructor. 19 | * 20 | * @param message The message. Can be null. 21 | */ 22 | public IndexerRelatedIndexingException(String message) { 23 | super(message); 24 | } 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param message The message. Can be null. 30 | * @param cause The cause. Can be null. 31 | */ 32 | public IndexerRelatedIndexingException(String message, Exception cause) { 33 | super(message, cause); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/exception/IndexingException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.exception; 2 | 3 | /** 4 | * Exception that may occur during indexing. 5 | * 6 | * @author jochen 7 | * 8 | */ 9 | public abstract class IndexingException extends Exception { 10 | 11 | /** Required for implementations of {@link java.io.Serializable}. **/ 12 | private static final long serialVersionUID = 2323679119224398983L; 13 | 14 | /** 15 | * Constructor. 16 | * 17 | * @param message The message. Can be null. 18 | * @param cause The cause. Can be null. 19 | */ 20 | public IndexingException(String message, Exception cause) { 21 | super(message, cause); 22 | } 23 | 24 | /** 25 | * Constructor. 26 | * 27 | * @param message The message. Can be null. 28 | */ 29 | public IndexingException(String message) { 30 | super(message); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/exception/PublishToSolrIndexingException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.exception; 2 | 3 | public class PublishToSolrIndexingException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = -276105897439704602L; 6 | 7 | public PublishToSolrIndexingException(String message, Exception cause) { super(message, cause);} 8 | } 9 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/exception/RecordRelatedIndexingException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.exception; 2 | 3 | /** 4 | * This exception is one thrown by the indexer if there is a record related problem. This signifies 5 | * that the problem is likely not with the setup or the indexer, but rather is assumed to occur only 6 | * for the individual record that was submitted for indexing. 7 | */ 8 | public class RecordRelatedIndexingException extends IndexingException { 9 | 10 | /** Required for implementations of {@link java.io.Serializable}. **/ 11 | private static final long serialVersionUID = -8887552792600523436L; 12 | 13 | /** 14 | * Constructor. 15 | * 16 | * @param message The message. Can be null. 17 | */ 18 | public RecordRelatedIndexingException(String message) { 19 | super(message); 20 | } 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param message The message. Can be null. 26 | * @param cause The cause. Can be null. 27 | */ 28 | public RecordRelatedIndexingException(String message, Exception cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/exception/SetupRelatedIndexingException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.exception; 2 | 3 | /** 4 | * This exception is one thrown by the indexer if there is a problem related to setting up the 5 | * indexer or setting up the connection to the target data storage. 6 | */ 7 | public class SetupRelatedIndexingException extends IndexingException { 8 | 9 | /** Required for implementations of {@link java.io.Serializable}. **/ 10 | private static final long serialVersionUID = -3730418093071300920L; 11 | 12 | /** 13 | * Constructor. 14 | * 15 | * @param message The message. Can be null. 16 | */ 17 | public SetupRelatedIndexingException(String message) { 18 | super(message); 19 | } 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param message The message. Can be null. 25 | * @param cause The cause. Can be null. 26 | */ 27 | public SetupRelatedIndexingException(String message, Exception cause) { 28 | super(message, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/exception/TierCalculationException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.exception; 2 | 3 | /** 4 | * Exception that may occur during indexing. 5 | * 6 | * @author jochen 7 | */ 8 | public class TierCalculationException extends RuntimeException { 9 | 10 | /** 11 | * Required for implementations of {@link java.io.Serializable}. 12 | **/ 13 | private static final long serialVersionUID = 6021595467219232390L; 14 | 15 | /** 16 | * Constructor. 17 | * 18 | * @param message The message. Can be null. 19 | * @param cause The cause. Can be null. 20 | */ 21 | public TierCalculationException(String message, Exception cause) { 22 | super(message, cause); 23 | } 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param message The message. Can be null. 29 | */ 30 | public TierCalculationException(String message) { 31 | super(message); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/fullbean/LicenseFieldInput.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.fullbean; 2 | 3 | import java.util.function.Function; 4 | import eu.europeana.metis.schema.jibx.License; 5 | import eu.europeana.corelib.solr.entity.LicenseImpl; 6 | 7 | /** 8 | * Converts a {@link License} from an {@link eu.europeana.metis.schema.jibx.RDF} to a 9 | * {@link LicenseImpl} for a {@link eu.europeana.metis.schema.edm.beans.FullBean}. 10 | */ 11 | class LicenseFieldInput implements Function { 12 | 13 | @Override 14 | public LicenseImpl apply(License jibxLicense) { 15 | LicenseImpl mongoLicense = new LicenseImpl(); 16 | mongoLicense.setAbout(jibxLicense.getAbout()); 17 | if (jibxLicense.getDeprecatedOn() != null) { 18 | mongoLicense.setCcDeprecatedOn(jibxLicense.getDeprecatedOn().getDate()); 19 | } 20 | mongoLicense.setOdrlInheritFrom(jibxLicense.getInheritFrom().getResource()); 21 | return mongoLicense; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/fullbean/OrganizationFieldInput.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.fullbean; 2 | 3 | import eu.europeana.corelib.solr.entity.OrganizationImpl; 4 | import eu.europeana.metis.schema.jibx.Organization; 5 | import java.util.function.Function; 6 | 7 | final class OrganizationFieldInput implements Function { 8 | 9 | @Override 10 | public OrganizationImpl apply(Organization organizationType) { 11 | OrganizationImpl organization = new OrganizationImpl(); 12 | organization.setAbout(organizationType.getAbout()); 13 | organization.setPrefLabel( 14 | FieldInputUtils.createLiteralMapFromList(organizationType.getPrefLabelList())); 15 | return organization; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/fullbean/ProvidedCHOFieldInput.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.fullbean; 2 | 3 | import java.util.function.Function; 4 | import eu.europeana.metis.schema.jibx.ProvidedCHOType; 5 | import eu.europeana.corelib.solr.entity.ProvidedCHOImpl; 6 | 7 | /** 8 | * Converts a {@link ProvidedCHOType} from an {@link eu.europeana.metis.schema.jibx.RDF} to a 9 | * {@link ProvidedCHOImpl} for a {@link eu.europeana.metis.schema.edm.beans.FullBean}. 10 | */ 11 | final class ProvidedCHOFieldInput implements Function { 12 | 13 | @Override 14 | public ProvidedCHOImpl apply(ProvidedCHOType providedCHO) { 15 | ProvidedCHOImpl mongoProvidedCHO = new ProvidedCHOImpl(); 16 | mongoProvidedCHO.setAbout(providedCHO.getAbout()); 17 | 18 | mongoProvidedCHO.setOwlSameAs(FieldInputUtils.resourceListToArray(providedCHO.getSameAList())); 19 | return mongoProvidedCHO; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/fullbean/ServiceFieldInput.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.fullbean; 2 | 3 | import java.util.function.Function; 4 | import eu.europeana.metis.schema.jibx.Service; 5 | import eu.europeana.corelib.solr.entity.ServiceImpl; 6 | 7 | /** 8 | * Converts a {@link Service} from an {@link eu.europeana.metis.schema.jibx.RDF} to a 9 | * {@link ServiceImpl} for a {@link eu.europeana.metis.schema.edm.beans.FullBean}. 10 | */ 11 | class ServiceFieldInput implements Function { 12 | 13 | @Override 14 | public ServiceImpl apply(Service service) { 15 | ServiceImpl serv = new ServiceImpl(); 16 | serv.setAbout(service.getAbout()); 17 | if (service.getConformsToList() != null) { 18 | serv.setDcTermsConformsTo( 19 | FieldInputUtils.resourceOrLiteralListToArray(service.getConformsToList())); 20 | } 21 | 22 | if (service.getImplementList() != null) { 23 | serv.setDoapImplements(FieldInputUtils.resourceListToArray(service.getImplementList())); 24 | } 25 | return serv; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/AbstractEdmEntityUpdater.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo; 2 | 3 | import eu.europeana.corelib.definitions.edm.beans.FullBean; 4 | import eu.europeana.corelib.definitions.edm.entity.AbstractEdmEntity; 5 | import eu.europeana.indexing.mongo.property.MongoPropertyUpdater; 6 | import eu.europeana.indexing.mongo.property.MongoPropertyUpdaterFactory; 7 | import eu.europeana.metis.mongo.dao.RecordDao; 8 | import java.util.Date; 9 | 10 | /** 11 | * Updater of EDM entities (properties of {@link FullBean}). 12 | * 13 | * @param The type of the record to update. 14 | * @param The type of the ancestor information (information from parents). 15 | */ 16 | public abstract class AbstractEdmEntityUpdater 17 | extends AbstractMongoObjectUpdater { 18 | 19 | @Override 20 | protected final MongoPropertyUpdater createPropertyUpdater(R newEntity, A ancestorInformation, 21 | Date recordDate, Date recordCreationDate, RecordDao mongoServer) { 22 | return MongoPropertyUpdaterFactory.createForObjectWithAbout(newEntity, mongoServer, 23 | getObjectClass(), AbstractEdmEntity::getAbout, null, null, null); 24 | } 25 | 26 | /** 27 | * @return The class object reflecting this updater's contextual class. 28 | */ 29 | protected abstract Class getObjectClass(); 30 | } 31 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/AbstractIsolatedEdmEntityUpdater.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo; 2 | 3 | import eu.europeana.corelib.definitions.edm.beans.FullBean; 4 | import eu.europeana.corelib.definitions.edm.entity.AbstractEdmEntity; 5 | import eu.europeana.indexing.mongo.property.MongoPropertyUpdater; 6 | 7 | /** 8 | * Updater of isolated EDM entities (properties of {@link FullBean} that are not accompanied by 9 | * ancestor information). 10 | * 11 | * @param The type of the record to update. 12 | */ 13 | public abstract class AbstractIsolatedEdmEntityUpdater 14 | extends AbstractEdmEntityUpdater { 15 | 16 | 17 | @Override 18 | protected final void update(MongoPropertyUpdater propertyUpdater, Void ancestorInformation) { 19 | update(propertyUpdater); 20 | } 21 | 22 | /** 23 | * This method performs the actual updates on the property updater. 24 | * 25 | * @param propertyUpdater The updater to update. 26 | */ 27 | protected abstract void update(MongoPropertyUpdater propertyUpdater); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/OrganizationUpdater.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo; 2 | 3 | import eu.europeana.corelib.solr.entity.OrganizationImpl; 4 | import eu.europeana.indexing.mongo.property.MongoPropertyUpdater; 5 | import eu.europeana.indexing.mongo.property.RootAboutWrapper; 6 | 7 | /** 8 | * Field updater for instances of {@link eu.europeana.corelib.solr.entity.OrganizationImpl}. 9 | */ 10 | public class OrganizationUpdater extends AbstractEdmEntityUpdater { 11 | 12 | @Override 13 | protected Class getObjectClass() { 14 | return OrganizationImpl.class; 15 | } 16 | 17 | @Override 18 | protected void update(MongoPropertyUpdater propertyUpdater, 19 | RootAboutWrapper ancestorInformation) { 20 | propertyUpdater.updateMap("prefLabel", OrganizationImpl::getPrefLabel); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/PlaceUpdater.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo; 2 | 3 | import eu.europeana.corelib.solr.entity.PlaceImpl; 4 | import eu.europeana.indexing.mongo.property.MongoPropertyUpdater; 5 | 6 | /** 7 | * Field updater for instances of {@link PlaceImpl}. 8 | */ 9 | public class PlaceUpdater extends AbstractIsolatedEdmEntityUpdater { 10 | 11 | @Override 12 | protected Class getObjectClass() { 13 | return PlaceImpl.class; 14 | } 15 | 16 | @Override 17 | protected void update(MongoPropertyUpdater propertyUpdater) { 18 | propertyUpdater.updateMap("note", PlaceImpl::getNote); 19 | propertyUpdater.updateMap("altLabel", PlaceImpl::getAltLabel); 20 | propertyUpdater.updateMap("prefLabel", PlaceImpl::getPrefLabel); 21 | propertyUpdater.updateMap("isPartOf", PlaceImpl::getIsPartOf); 22 | propertyUpdater.updateMap("dcTermsHasPart", PlaceImpl::getDcTermsHasPart); 23 | propertyUpdater.updateArray("owlSameAs", PlaceImpl::getOwlSameAs); 24 | propertyUpdater.updateObject("latitude", PlaceImpl::getLatitude); 25 | propertyUpdater.updateObject("longitude", PlaceImpl::getLongitude); 26 | propertyUpdater.updateObject("altitude", PlaceImpl::getAltitude); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/ProvidedChoUpdater.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo; 2 | 3 | import eu.europeana.corelib.solr.entity.ProvidedCHOImpl; 4 | import eu.europeana.indexing.mongo.property.MongoPropertyUpdater; 5 | 6 | /** 7 | * Field updater for instances of {@link ProvidedCHOImpl}. 8 | */ 9 | public class ProvidedChoUpdater extends AbstractIsolatedEdmEntityUpdater { 10 | 11 | @Override 12 | protected Class getObjectClass() { 13 | return ProvidedCHOImpl.class; 14 | } 15 | 16 | @Override 17 | protected void update(MongoPropertyUpdater propertyUpdater) { 18 | propertyUpdater.updateArray("owlSameAs", ProvidedCHOImpl::getOwlSameAs); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/ServiceUpdater.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo; 2 | 3 | import eu.europeana.corelib.solr.entity.ServiceImpl; 4 | import eu.europeana.indexing.mongo.property.MongoPropertyUpdater; 5 | 6 | /** 7 | * Field updater for instances of {@link ServiceImpl}. 8 | */ 9 | public class ServiceUpdater extends AbstractIsolatedEdmEntityUpdater { 10 | 11 | @Override 12 | protected Class getObjectClass() { 13 | return ServiceImpl.class; 14 | } 15 | 16 | @Override 17 | protected void update(MongoPropertyUpdater propertyUpdater) { 18 | propertyUpdater.updateArray("dctermsConformsTo", ServiceImpl::getDctermsConformsTo); 19 | propertyUpdater.updateArray("doapImplements", ServiceImpl::getDoapImplements); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/TimespanUpdater.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo; 2 | 3 | import eu.europeana.corelib.solr.entity.TimespanImpl; 4 | import eu.europeana.indexing.mongo.property.MongoPropertyUpdater; 5 | 6 | /** 7 | * Field updater for instances of {@link TimespanImpl}. 8 | */ 9 | public class TimespanUpdater extends AbstractIsolatedEdmEntityUpdater { 10 | 11 | @Override 12 | protected Class getObjectClass() { 13 | return TimespanImpl.class; 14 | } 15 | 16 | @Override 17 | protected void update(MongoPropertyUpdater propertyUpdater) { 18 | propertyUpdater.updateMap("begin", TimespanImpl::getBegin); 19 | propertyUpdater.updateMap("end", TimespanImpl::getEnd); 20 | propertyUpdater.updateMap("note", TimespanImpl::getNote); 21 | propertyUpdater.updateMap("altLabel", TimespanImpl::getAltLabel); 22 | propertyUpdater.updateMap("prefLabel", TimespanImpl::getPrefLabel); 23 | propertyUpdater.updateMap("isPartOf", TimespanImpl::getIsPartOf); 24 | propertyUpdater.updateMap("dctermsHasPart", TimespanImpl::getDctermsHasPart); 25 | propertyUpdater.updateArray("owlSameAs", TimespanImpl::getOwlSameAs); 26 | propertyUpdater.updateMap("skosNotation", TimespanImpl::getSkosNotation); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/WebResourceInformation.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo; 2 | 3 | import eu.europeana.corelib.edm.model.metainfo.WebResourceMetaInfoImpl; 4 | import eu.europeana.indexing.mongo.property.RootAboutWrapper; 5 | 6 | /** 7 | * Ancestor information for {@link WebResourceMetaInfoImpl}, that contains the about values of the 8 | * root (i.e. full bean) and the web resource the meta info belongs to. 9 | */ 10 | public class WebResourceInformation extends RootAboutWrapper { 11 | 12 | private final String webResourceAbout; 13 | 14 | /** 15 | * Constructor. 16 | * 17 | * @param rootAbout The about of the full bean. 18 | * @param webResourceAbout The about of the parent web resource. 19 | */ 20 | public WebResourceInformation(String rootAbout, String webResourceAbout) { 21 | super(rootAbout); 22 | this.webResourceAbout = webResourceAbout; 23 | } 24 | 25 | public String getWebResourceAbout() { 26 | return webResourceAbout; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/property/MongoObjectManager.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo.property; 2 | 3 | import eu.europeana.metis.mongo.dao.RecordDao; 4 | 5 | /** 6 | * Manager of mongo objects. 7 | * 8 | * @param The type of the object to manage. 9 | * @param The type of the ancestor information (information from parents). 10 | */ 11 | public interface MongoObjectManager extends MongoObjectUpdater { 12 | 13 | /** 14 | * Delete object. 15 | * 16 | * @param ancestorInformation The ancestor information for this object, which should be enough to 17 | * locate the object. 18 | * @param mongoServer The mongo server. 19 | */ 20 | void delete(A ancestorInformation, RecordDao mongoServer); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/property/MongoObjectUpdater.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo.property; 2 | 3 | import eu.europeana.metis.mongo.dao.RecordDao; 4 | import java.util.Date; 5 | 6 | /** 7 | * Updater of mongo objects. 8 | * 9 | * @param The type of the object to update. 10 | * @param The type of the ancestor information (information from parents). 11 | */ 12 | public interface MongoObjectUpdater { 13 | 14 | /** 15 | * Update a mongo object. 16 | * 17 | * @param newObject The new object (to take the new values from). 18 | * @param ancestorInformation The ancestor information for this object. 19 | * @param recordDate The date that would represent the created/updated date of a record 20 | * @param recordCreationDate The date that would represent the created date if it already existed, 21 | * @param mongoServer The mongo server. 22 | * @return The updated entity. 23 | */ 24 | R update(R newObject, A ancestorInformation, Date recordDate, Date recordCreationDate, 25 | RecordDao mongoServer); 26 | } 27 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/mongo/property/RootAboutWrapper.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo.property; 2 | 3 | /** 4 | * Ancestor information consisting of the about value of the root (i.e. the full bean). 5 | */ 6 | public class RootAboutWrapper { 7 | 8 | private final String rootAbout; 9 | 10 | /** 11 | * Constructor. 12 | * 13 | * @param rootAbout The about of the full bean. 14 | */ 15 | public RootAboutWrapper(String rootAbout) { 16 | this.rootAbout = rootAbout; 17 | } 18 | 19 | public String getRootAbout() { 20 | return rootAbout; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/solr/facet/value/FacetValue.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.solr.facet.value; 2 | 3 | /** 4 | * This interface is implemented by all facet values with an encoding. 5 | */ 6 | public interface FacetValue { 7 | 8 | /** 9 | * Codify the facet value. 10 | * 11 | * @return The (non-shifted) value. 12 | */ 13 | int getCode(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/solr/property/ConceptSolrCreator.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.solr.property; 2 | 3 | import org.apache.solr.common.SolrInputDocument; 4 | import eu.europeana.corelib.definitions.edm.entity.Concept; 5 | import eu.europeana.indexing.solr.EdmLabel; 6 | 7 | /** 8 | * Property Solr Creator for 'skos:Concept' tags. 9 | * 10 | * @author Yorgos.Mamakis@ europeana.eu 11 | * 12 | */ 13 | public class ConceptSolrCreator implements PropertySolrCreator { 14 | 15 | @Override 16 | public void addToDocument(SolrInputDocument doc, Concept concept) { 17 | SolrPropertyUtils.addValue(doc, EdmLabel.SKOS_CONCEPT, concept.getAbout()); 18 | SolrPropertyUtils.addValues(doc, EdmLabel.CC_SKOS_PREF_LABEL, concept.getPrefLabel()); 19 | SolrPropertyUtils.addValues(doc, EdmLabel.CC_SKOS_ALT_LABEL, concept.getAltLabel()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/solr/property/PlaceSolrCreator.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.solr.property; 2 | 3 | import org.apache.solr.common.SolrInputDocument; 4 | import eu.europeana.corelib.definitions.edm.entity.Place; 5 | import eu.europeana.indexing.solr.EdmLabel; 6 | 7 | /** 8 | * Property Solr Creator for 'edm:Place' tags. 9 | * 10 | * @author Yorgos.Mamakis@ europeana.eu 11 | * 12 | */ 13 | public class PlaceSolrCreator implements PropertySolrCreator { 14 | 15 | @Override 16 | public void addToDocument(SolrInputDocument doc, Place place) { 17 | 18 | SolrPropertyUtils.addValue(doc, EdmLabel.EDM_PLACE, place.getAbout()); 19 | SolrPropertyUtils.addValues(doc, EdmLabel.PL_SKOS_PREF_LABEL, place.getPrefLabel()); 20 | SolrPropertyUtils.addValues(doc, EdmLabel.PL_SKOS_ALT_LABEL, place.getAltLabel()); 21 | 22 | if (place.getLatitude() != null && place.getLatitude() != 0) { 23 | SolrPropertyUtils.addValue(doc, EdmLabel.PL_WGS84_POS_LAT, place.getLatitude()); 24 | } 25 | if (place.getLongitude() != null && place.getLongitude() != 0) { 26 | SolrPropertyUtils.addValue(doc, EdmLabel.PL_WGS84_POS_LONG, place.getLongitude()); 27 | } 28 | if (place.getAltitude() != null && place.getAltitude() != 0) { 29 | SolrPropertyUtils.addValue(doc, EdmLabel.PL_WGS84_POS_ALT, place.getAltitude()); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/solr/property/ProvidedChoSolrCreator.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.solr.property; 2 | 3 | import eu.europeana.corelib.definitions.edm.entity.ProvidedCHO; 4 | import eu.europeana.indexing.solr.EdmLabel; 5 | import org.apache.solr.common.SolrInputDocument; 6 | 7 | /** 8 | * Property Solr Creator for 'edm:providedCHO' tags. 9 | * 10 | * @author gmamakis 11 | */ 12 | public class ProvidedChoSolrCreator implements PropertySolrCreator { 13 | 14 | @Override 15 | public void addToDocument(SolrInputDocument doc, ProvidedCHO pCho) { 16 | SolrPropertyUtils.addValue(doc, EdmLabel.EUROPEANA_ID, pCho.getAbout()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/solr/property/QualityAnnotationSolrCreator.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.solr.property; 2 | 3 | import eu.europeana.corelib.definitions.edm.entity.QualityAnnotation; 4 | import eu.europeana.indexing.utils.RdfTierUtils; 5 | import java.util.Optional; 6 | import org.apache.solr.common.SolrInputDocument; 7 | 8 | /** 9 | * Property Solr Creator for 'dqv:QualityAnnotation' tags. 10 | * 11 | * @author Simon Tzanakis (Simon.Tzanakis@europeana.eu) 12 | * @since 2019-06-13 13 | */ 14 | public class QualityAnnotationSolrCreator implements PropertySolrCreator { 15 | 16 | @Override 17 | public void addToDocument(SolrInputDocument doc, QualityAnnotation qualityAnnotation) { 18 | Optional.of(qualityAnnotation).map(RdfTierUtils::getTier).ifPresent( 19 | tier -> SolrPropertyUtils.addValue(doc, tier.getEdmLabel(), tier.getTier().toString()) 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/solr/property/ServiceSolrCreator.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.solr.property; 2 | 3 | import org.apache.solr.common.SolrInputDocument; 4 | import eu.europeana.corelib.definitions.edm.entity.Service; 5 | import eu.europeana.indexing.solr.EdmLabel; 6 | 7 | /** 8 | * Property Solr Creator for 'svcs:Service' tags. 9 | */ 10 | public class ServiceSolrCreator implements PropertySolrCreator { 11 | 12 | @Override 13 | public void addToDocument(SolrInputDocument doc, Service service) { 14 | SolrPropertyUtils.addValue(doc, EdmLabel.SV_SERVICE, service.getAbout()); 15 | SolrPropertyUtils.addValues(doc, EdmLabel.SV_DCTERMS_CONFORMS_TO, service.getDctermsConformsTo()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/solr/property/TimespanSolrCreator.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.solr.property; 2 | 3 | import org.apache.solr.common.SolrInputDocument; 4 | import eu.europeana.corelib.definitions.edm.entity.Timespan; 5 | import eu.europeana.indexing.solr.EdmLabel; 6 | 7 | /** 8 | * Property Solr Creator for 'edm:TimeSpan' tags. 9 | * 10 | * @author Yorgos.Mamakis@ europeana.eu 11 | * 12 | */ 13 | public class TimespanSolrCreator implements PropertySolrCreator { 14 | 15 | @Override 16 | public void addToDocument(SolrInputDocument doc, Timespan ts) { 17 | SolrPropertyUtils.addValue(doc, EdmLabel.EDM_TIMESPAN, ts.getAbout()); 18 | SolrPropertyUtils.addValues(doc, EdmLabel.TS_SKOS_PREF_LABEL, ts.getPrefLabel()); 19 | SolrPropertyUtils.addValues(doc, EdmLabel.TS_SKOS_ALT_LABEL, ts.getAltLabel()); 20 | SolrPropertyUtils.addValues(doc, EdmLabel.TS_SKOS_PREF_LABEL, ts.getOwlSameAs()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/TierCalculationMode.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers; 2 | 3 | /** 4 | * The enum Tier calculation mode. 5 | */ 6 | public enum TierCalculationMode { 7 | /** 8 | * Overwrite tier calculation mode. Always perform tier calculation, overwriting any existing tiers 9 | */ 10 | OVERWRITE, 11 | /** 12 | * Skip tier calculation mode. Do not perform any tier calculation 13 | */ 14 | SKIP, 15 | /** 16 | * The Initialise. Perform tier calculation only if no tiers exist 17 | */ 18 | INITIALISE 19 | } 20 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/metadata/ClassifierMode.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.metadata; 2 | 3 | /** 4 | * The enum Classifier mode. 5 | */ 6 | public enum ClassifierMode { 7 | /** 8 | * Provider proxies classifier mode. 9 | */ 10 | PROVIDER_PROXIES, 11 | /** 12 | * All proxies classifier mode. 13 | */ 14 | ALL_PROXIES 15 | } 16 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/metadata/ContextualClassGroup.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.metadata; 2 | 3 | import eu.europeana.metis.schema.jibx.AboutType; 4 | import eu.europeana.metis.schema.jibx.AgentType; 5 | import eu.europeana.metis.schema.jibx.Concept; 6 | import eu.europeana.metis.schema.jibx.PlaceType; 7 | import eu.europeana.metis.schema.jibx.TimeSpanType; 8 | 9 | /** 10 | * This enum contains all the groups of enabling elements, including the contextual class with which this group is associated. 11 | */ 12 | public enum ContextualClassGroup { 13 | 14 | TEMPORAL(TimeSpanType.class), 15 | CONCEPTUAL(Concept.class), 16 | PERSONAL(AgentType.class), 17 | GEOGRAPHICAL(PlaceType.class); 18 | 19 | private final Class contextualClass; 20 | 21 | ContextualClassGroup(Class contextualClass) { 22 | this.contextualClass = contextualClass; 23 | } 24 | 25 | Class getContextualClass() { 26 | return contextualClass; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/model/MediaTier.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonValue; 4 | 5 | /** 6 | * This enum contains the different values of the media tier. 7 | */ 8 | public enum MediaTier implements Tier { 9 | 10 | T0(0, "0"), T1(1, "1"), T2(2, "2"), T3(3, "3"), T4(4, "4"); 11 | 12 | private final int level; 13 | private final String stringRepresentation; 14 | 15 | MediaTier(int level, String stringRepresentation) { 16 | this.level = level; 17 | this.stringRepresentation = stringRepresentation; 18 | } 19 | 20 | @Override 21 | public int getLevel() { 22 | return level; 23 | } 24 | 25 | @Override 26 | @JsonValue 27 | public String toString() { 28 | return stringRepresentation; 29 | } 30 | 31 | /** 32 | * Get the Enum representation given a string value 33 | * @param value the string value 34 | * @return the enum representation 35 | */ 36 | public static MediaTier getEnum(String value){ 37 | MediaTier result = null; 38 | for(MediaTier tier: MediaTier.values()) { 39 | if(tier.stringRepresentation.equals(value)) { 40 | result = tier; 41 | break; 42 | } 43 | } 44 | 45 | if(result == null){ 46 | throw new IllegalArgumentException("Nu such value " + value + " exists"); 47 | } else { 48 | return result; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/model/MetadataTier.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonValue; 4 | 5 | /** 6 | * This enum contains the different values of the metadata tier. 7 | */ 8 | public enum MetadataTier implements Tier { 9 | 10 | T0(0, "0"), TA(1, "A"), TB(2, "B"), TC(3, "C"); 11 | 12 | private final int level; 13 | private final String stringRepresentation; 14 | 15 | MetadataTier(int level, String stringRepresentation) { 16 | this.level = level; 17 | this.stringRepresentation = stringRepresentation; 18 | } 19 | 20 | @Override 21 | public int getLevel() { 22 | return level; 23 | } 24 | 25 | @Override 26 | @JsonValue 27 | public String toString() { 28 | return stringRepresentation; 29 | } 30 | 31 | public static MetadataTier getEnum(String value){ 32 | MetadataTier result = null; 33 | for(MetadataTier tier: MetadataTier.values()) { 34 | if(tier.stringRepresentation.equals(value)) { 35 | result = tier; 36 | break; 37 | } 38 | } 39 | 40 | if(result == null){ 41 | throw new IllegalArgumentException("Nu such value " + value + " exists"); 42 | } else { 43 | return result; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/model/TierClassifier.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.model; 2 | 3 | import eu.europeana.indexing.utils.RdfWrapper; 4 | 5 | /** 6 | * Implementations of this class can classify RDF entities and award them a tier with a breakdown. 7 | * 8 | * @param The type of the tier for which this classifier can be used 9 | * @param The breakdown of the tier classification 10 | */ 11 | public interface TierClassifier { 12 | 13 | /** 14 | * Analyzes and classifies an entity to a tier providing a breakdown. 15 | * 16 | * @param entity the entity to classify 17 | * @return the tier classification with its breakdown 18 | */ 19 | TierClassification classify(RdfWrapper entity); 20 | 21 | /** 22 | * A class to package the Tier and an object representing the tier calculation. 23 | * 24 | * @param the type of the tier 25 | * @param the tier calculation details 26 | */ 27 | class TierClassification { 28 | 29 | private final T tier; 30 | private final S classification; 31 | 32 | public TierClassification(T tier, S classification) { 33 | this.tier = tier; 34 | this.classification = classification; 35 | } 36 | 37 | public T getTier() { 38 | return tier; 39 | } 40 | 41 | public S getClassification() { 42 | return classification; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/model/TierClassifierBreakdown.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.model; 2 | 3 | import eu.europeana.indexing.utils.RdfWrapper; 4 | 5 | /** 6 | * Implementations of this class can classify RDF entities breakdowns that may contain a tier value. 7 | * 8 | * @param The breakdown of the tier classification 9 | */ 10 | public interface TierClassifierBreakdown> { 11 | 12 | /** 13 | * Analyze an entity to get the breakdown that may contain a tier value 14 | * 15 | * @param entity the entity to analyze 16 | * @return the breakdown of the analysis 17 | */ 18 | S classifyBreakdown(RdfWrapper entity); 19 | } 20 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/model/TierProvider.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.model; 2 | 3 | /** 4 | * Implementations of this interface contain a tier that can be retrieved. 5 | * 6 | * @param The type of the tier 7 | */ 8 | public interface TierProvider { 9 | 10 | /** 11 | * Get the tier for object. 12 | * 13 | * @return the tier value 14 | */ 15 | T getMetadataTier(); 16 | } 17 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/view/MetadataTierBreakdown.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.view; 2 | 3 | /** 4 | * The metadata tier breakdown 5 | */ 6 | public class MetadataTierBreakdown { 7 | 8 | private final LanguageBreakdown languageBreakdown; 9 | private final EnablingElementsBreakdown enablingElementsBreakdown; 10 | private final ContextualClassesBreakdown contextualClassesBreakdown; 11 | 12 | /** 13 | * Constructor with required parameters. 14 | * 15 | * @param languageBreakdown the language breakdown 16 | * @param enablingElementsBreakdown the enabling elements breakdown 17 | * @param contextualClassesBreakdown teh contextual classes breakdown 18 | */ 19 | public MetadataTierBreakdown(LanguageBreakdown languageBreakdown, 20 | EnablingElementsBreakdown enablingElementsBreakdown, 21 | ContextualClassesBreakdown contextualClassesBreakdown) { 22 | this.languageBreakdown = languageBreakdown; 23 | this.enablingElementsBreakdown = enablingElementsBreakdown; 24 | this.contextualClassesBreakdown = contextualClassesBreakdown; 25 | } 26 | 27 | public LanguageBreakdown getLanguageBreakdown() { 28 | return languageBreakdown; 29 | } 30 | 31 | public EnablingElementsBreakdown getEnablingElements() { 32 | return enablingElementsBreakdown; 33 | } 34 | 35 | public ContextualClassesBreakdown getContextualClasses() { 36 | return contextualClassesBreakdown; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/tiers/view/ProcessingError.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.view; 2 | 3 | /** 4 | * Class containing information about an error. 5 | */ 6 | public class ProcessingError { 7 | 8 | private final String errorMessage; 9 | private final String stackTrace; 10 | 11 | /** 12 | * Constructor with required parameters. 13 | * 14 | * @param errorMessage the error message 15 | * @param stackTrace the stack trace 16 | */ 17 | public ProcessingError(String errorMessage, String stackTrace) { 18 | this.errorMessage = errorMessage; 19 | this.stackTrace = stackTrace; 20 | } 21 | 22 | public String getErrorMessage() { 23 | return errorMessage; 24 | } 25 | 26 | public String getStackTrace() { 27 | return stackTrace; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /metis-indexing/src/main/java/eu/europeana/indexing/utils/TriConsumer.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.utils; 2 | 3 | /** 4 | * An operation that accepts three input arguments and returns no result. 5 | * 6 | * @param type of the first argument 7 | * @param type of the second argument 8 | * @param type of the third argument 9 | */ 10 | public interface TriConsumer { 11 | 12 | /** 13 | * Performs the operation given the specified arguments. 14 | * 15 | * @param k the first input argument 16 | * @param v the second input argument 17 | * @param s the third input argument 18 | */ 19 | void accept(K k, V v, S s); 20 | } 21 | -------------------------------------------------------------------------------- /metis-indexing/src/test/java/eu/europeana/indexing/base/TestContainer.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.base; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | import java.util.List; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.test.context.DynamicPropertyRegistry; 8 | 9 | /** 10 | * The type Test container. 11 | */ 12 | public abstract class TestContainer { 13 | private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); 14 | 15 | /** 16 | * Log configuration. 17 | */ 18 | abstract public void logConfiguration(); 19 | 20 | /** 21 | * Dynamic properties. 22 | * 23 | * @param registry the registry 24 | */ 25 | abstract public void dynamicProperties(DynamicPropertyRegistry registry); 26 | 27 | /** 28 | * Run scripts. 29 | * 30 | * @param scripts the scripts 31 | */ 32 | abstract public void runScripts(List scripts); 33 | } 34 | -------------------------------------------------------------------------------- /metis-indexing/src/test/java/eu/europeana/indexing/base/TestContainerFactoryIT.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.base; 2 | 3 | /** 4 | * The type Test container factory it. 5 | */ 6 | public class TestContainerFactoryIT { 7 | 8 | /** 9 | * Gets container. 10 | * 11 | * @param type the type 12 | * @return the container 13 | */ 14 | public static TestContainer getContainer(TestContainerType type) { 15 | return switch (type) { 16 | case MONGO -> new MongoDBContainerIT(); 17 | case SOLR -> new SolrContainerIT(); 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /metis-indexing/src/test/java/eu/europeana/indexing/base/TestContainerType.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.base; 2 | 3 | /** 4 | * The enum Test container type. 5 | */ 6 | public enum TestContainerType { 7 | /** 8 | * Mongo test container type. 9 | */ 10 | MONGO, 11 | /** 12 | * Solr test container type. 13 | */ 14 | SOLR 15 | } 16 | -------------------------------------------------------------------------------- /metis-indexing/src/test/java/eu/europeana/indexing/mongo/ProvidedChoUpdaterTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.mongo; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.mockito.Mockito.mock; 5 | import static org.mockito.Mockito.verifyNoMoreInteractions; 6 | 7 | import eu.europeana.corelib.solr.entity.ProvidedCHOImpl; 8 | import eu.europeana.indexing.mongo.property.MongoPropertyUpdater; 9 | import org.junit.jupiter.api.Test; 10 | 11 | class ProvidedChoUpdaterTest extends MongoEntityUpdaterTest { 12 | 13 | @Override 14 | ProvidedCHOImpl createEmptyMongoEntity() { 15 | return new ProvidedCHOImpl(); 16 | } 17 | 18 | @Test 19 | void testGetObjectClass() { 20 | assertEquals(ProvidedCHOImpl.class, new ProvidedChoUpdater().getObjectClass()); 21 | } 22 | 23 | @Test 24 | void testUpdate() { 25 | 26 | // Craete objects for execution 27 | final ProvidedChoUpdater updater = new ProvidedChoUpdater(); 28 | @SuppressWarnings("unchecked") final MongoPropertyUpdater propertyUpdater = mock( 29 | MongoPropertyUpdater.class); 30 | 31 | // Make the call 32 | updater.update(propertyUpdater); 33 | 34 | // Test all the values 35 | testArrayPropertyUpdate(propertyUpdater, "owlSameAs", ProvidedCHOImpl::setOwlSameAs); 36 | 37 | // And that should be it. 38 | verifyNoMoreInteractions(propertyUpdater); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /metis-indexing/src/test/java/eu/europeana/indexing/tiers/view/ProcessingErrorTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.indexing.tiers.view; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | class ProcessingErrorTest { 8 | 9 | @Test 10 | void objectCreationTest() { 11 | final String errorMessage = "errorMessage"; 12 | final String stackTrace = "stackTrace\nAnother line"; 13 | final ProcessingError processingError = new ProcessingError(errorMessage, stackTrace); 14 | assertEquals(errorMessage, processingError.getErrorMessage()); 15 | assertEquals(stackTrace, processingError.getStackTrace()); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /metis-indexing/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metis-indexing/src/test/resources/solr/enumsConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0 5 | 1 6 | 2 7 | 3 8 | 4 9 | 10 | 11 | 0 12 | A 13 | B 14 | C 15 | 16 | 17 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/LinkChecker.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing; 2 | 3 | import eu.europeana.metis.mediaprocessing.exception.LinkCheckingException; 4 | 5 | /** 6 | * Implementations of this interface provide the link checking functionality. This object can be 7 | * reused multiple times, as the construction of it incurs overhead. Please note that this object is 8 | * not guaranteed to be thread-safe. Access to this object should be from one thread only, or 9 | * synchronized/locked. 10 | */ 11 | public interface LinkChecker extends PoolableProcessor { 12 | 13 | /** 14 | * Perform link checking on the given resource link. 15 | * 16 | * @param resourceEntry The resource entry (obtained from an RDF) 17 | * @throws LinkCheckingException In case of issues occurring during link checking. 18 | */ 19 | void performLinkChecking(String resourceEntry) throws LinkCheckingException; 20 | 21 | @Override 22 | default Void processTask(String input) throws LinkCheckingException { 23 | performLinkChecking(input); 24 | return null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/PoolableProcessor.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing; 2 | 3 | import java.io.Closeable; 4 | 5 | /** 6 | * This is the interface for processors that can be subject to the pooling as implemented in {@link 7 | * AbstractMediaProcessorPool}. 8 | * 9 | * @param The input type of the processor. 10 | * @param The output type of the processor. 11 | * @param The exception type thrown by processing tasks. 12 | */ 13 | public interface PoolableProcessor extends Closeable { 14 | 15 | /** 16 | * Processes the task that this processor provides. 17 | * 18 | * @param input The input to process. 19 | * @return The result of processing the given input. 20 | * @throws E In case a problem occurred while processing the input. 21 | */ 22 | O processTask(I input) throws E; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/RdfConverterFactory.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing; 2 | 3 | /** 4 | * This factory creates objects for (de)serializing RDF files. 5 | *

Used by external code such as scripts or ECloud.

6 | */ 7 | public class RdfConverterFactory { 8 | 9 | /** 10 | * Create an RDF file serializer. 11 | * 12 | * @return An RDF file serializer. 13 | */ 14 | public RdfSerializer createRdfSerializer() { 15 | return new RdfSerializerImpl(); 16 | } 17 | 18 | /** 19 | * Create an RDF file deserializer. 20 | * 21 | * @return An RDF file deserializer. 22 | */ 23 | public RdfDeserializer createRdfDeserializer() { 24 | return new RdfDeserializerImpl(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/RdfSerializer.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing; 2 | 3 | import eu.europeana.metis.mediaprocessing.exception.RdfSerializationException; 4 | import eu.europeana.metis.mediaprocessing.model.EnrichedRdf; 5 | 6 | /** 7 | * Implementations of this interface provide a variety of serialization options for RDF files. This 8 | * object can be reused multiple times, as the construction of it incurs overhead. Please note that 9 | * this object is thread-safe, but currently it achieves this by synchronization, meaning that it is 10 | * not designed for many threads to access the object simultaneously. 11 | */ 12 | public interface RdfSerializer { 13 | 14 | /** 15 | * Serialize an RDF into a file. This method should call the {@link EnrichedRdf#finalizeRdf()} 16 | * method before serialization. 17 | * 18 | * @param rdf The RDF to serialize. 19 | * @return The serialized RDF file. 20 | * @throws RdfSerializationException In case there was a problem serializing this RDF. 21 | */ 22 | byte[] serialize(EnrichedRdf rdf) throws RdfSerializationException; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/RdfSerializerImpl.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing; 2 | 3 | import eu.europeana.metis.mediaprocessing.exception.RdfSerializationException; 4 | import eu.europeana.metis.mediaprocessing.model.EnrichedRdf; 5 | import eu.europeana.metis.schema.convert.RdfConversionUtils; 6 | import eu.europeana.metis.schema.convert.SerializationException; 7 | 8 | /** 9 | * This object implements RDF serialization functionality. 10 | */ 11 | class RdfSerializerImpl implements RdfSerializer { 12 | 13 | private final RdfConversionUtils rdfConversionUtils = new RdfConversionUtils(); 14 | 15 | @Override 16 | public byte[] serialize(EnrichedRdf rdf) throws RdfSerializationException { 17 | try { 18 | return rdfConversionUtils.convertRdfToBytes(rdf.finalizeRdf()); 19 | } catch (SerializationException e) { 20 | throw new RdfSerializationException("Problem with serializing RDF.", e); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/RdfXpathConstants.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing; 2 | 3 | /** 4 | * Rdf xpath string constants. 5 | */ 6 | public final class RdfXpathConstants { 7 | 8 | public static final String RDF_NAMESPACE = "/rdf:RDF"; 9 | public static final String ORE_AGGREGATION = RDF_NAMESPACE + "/ore:Aggregation"; 10 | public static final String EDM_OBJECT = ORE_AGGREGATION + "/edm:object/@rdf:resource"; 11 | public static final String EDM_IS_SHOWN_BY = ORE_AGGREGATION + "/edm:isShownBy/@rdf:resource"; 12 | public static final String EDM_HAS_VIEW = ORE_AGGREGATION + "/edm:hasView/@rdf:resource"; 13 | public static final String EDM_IS_SHOWN_AT = ORE_AGGREGATION + "/edm:isShownAt/@rdf:resource"; 14 | public static final String SVCS_SERVICE = RDF_NAMESPACE + "/svcs:Service"; 15 | public static final String EDM_WEBRESOURCE = RDF_NAMESPACE + "/edm:WebResource"; 16 | 17 | private RdfXpathConstants() {} 18 | 19 | } 20 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/exception/LinkCheckingException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.exception; 2 | 3 | /** 4 | * This exception represents a problem that occurred during link checking. 5 | */ 6 | public class LinkCheckingException extends Exception { 7 | 8 | /** This class implements {@link java.io.Serializable}. **/ 9 | private static final long serialVersionUID = 3926174673354061384L; 10 | 11 | /** 12 | * Constructor. 13 | * 14 | * @param cause The cause. 15 | */ 16 | public LinkCheckingException(Throwable cause) { 17 | super(cause); 18 | } 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param message The exception message. 24 | * @param cause The cause. 25 | */ 26 | public LinkCheckingException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/exception/MediaExtractionException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.exception; 2 | 3 | /** 4 | * This exception represents a problem that occurred during media extraction. 5 | */ 6 | public class MediaExtractionException extends Exception { 7 | 8 | /** This class implements {@link java.io.Serializable}. **/ 9 | private static final long serialVersionUID = -5753149269891298793L; 10 | 11 | /** 12 | * Constructor. 13 | * 14 | * @param message The exception message. 15 | */ 16 | public MediaExtractionException(String message) { 17 | super(message); 18 | } 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param message The exception message. 24 | * @param cause The cause. 25 | */ 26 | public MediaExtractionException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/exception/MediaProcessorException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.exception; 2 | 3 | /** 4 | * This exception represents a problem that occurred during setting up one of the worker objects in 5 | * the media processing library. 6 | */ 7 | public class MediaProcessorException extends Exception { 8 | 9 | /** This class implements {@link java.io.Serializable}. **/ 10 | private static final long serialVersionUID = 8090383001647258984L; 11 | 12 | /** 13 | * Constructor. 14 | * 15 | * @param message The exception message. 16 | */ 17 | public MediaProcessorException(String message) { 18 | super(message); 19 | } 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param message The exception message. 25 | * @param cause The cause. 26 | */ 27 | public MediaProcessorException(String message, Exception cause) { 28 | super(message, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/exception/RdfDeserializationException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.exception; 2 | 3 | /** 4 | * This exception represents a problem that occurred during deserialization of an RDF object. 5 | */ 6 | public class RdfDeserializationException extends Exception { 7 | 8 | /** This class implements {@link java.io.Serializable}. **/ 9 | private static final long serialVersionUID = -789223924131348847L; 10 | 11 | /** 12 | * Constructor. 13 | * 14 | * @param message The exception message. 15 | * @param cause The cause. 16 | */ 17 | public RdfDeserializationException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/exception/RdfSerializationException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.exception; 2 | 3 | /** 4 | * This exception represents a problem that occurred during serialization of an RDF object. 5 | */ 6 | public class RdfSerializationException extends Exception { 7 | 8 | /** This class implements {@link java.io.Serializable}. **/ 9 | private static final long serialVersionUID = 1031549407979593963L; 10 | 11 | /** 12 | * Constructor. 13 | * 14 | * @param message The exception message. 15 | * @param cause The cause. 16 | */ 17 | public RdfSerializationException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/extraction/ImageMetadata.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.extraction; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | /** 8 | * Objects of this type represent image information obtained while creating the thumbnails. 9 | * 10 | * @author jochen 11 | */ 12 | public class ImageMetadata { 13 | 14 | private final int width; 15 | private final int height; 16 | private final String colorSpace; 17 | private final List dominantColors; 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param width The width of the image. 23 | * @param height The height of the image. 24 | * @param colorSpace The color space. 25 | * @param dominantColors The dominant colors. 26 | */ 27 | ImageMetadata(int width, int height, String colorSpace, List dominantColors) { 28 | this.width = width; 29 | this.height = height; 30 | this.colorSpace = colorSpace; 31 | this.dominantColors = new ArrayList<>(dominantColors); 32 | } 33 | 34 | int getWidth() { 35 | return width; 36 | } 37 | 38 | int getHeight() { 39 | return height; 40 | } 41 | 42 | String getColorSpace() { 43 | return colorSpace; 44 | } 45 | 46 | List getDominantColors() { 47 | return Collections.unmodifiableList(dominantColors); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/EnrichedRdf.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | import eu.europeana.metis.schema.jibx.RDF; 4 | 5 | /** 6 | * Objects implementing this class represent RDF files that can be enriched with extracted resource 7 | * metadata. There is also a method for post-processing the RDF file, which should be called before 8 | * using the RDF in this object. 9 | */ 10 | public interface EnrichedRdf { 11 | 12 | /** 13 | * Enrich the RDF with extracted resource metadata. 14 | * 15 | * @param resource The resource metadata. 16 | */ 17 | void enrichResource(ResourceMetadata resource); 18 | 19 | /** 20 | * Finalizes (post-processes) the RDF before giving it out. 21 | * 22 | * @return The RDF. 23 | */ 24 | RDF finalizeRdf(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/IResourceMetadata.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Set; 5 | 6 | /** 7 | * This interface represents resource metadata. 8 | */ 9 | interface IResourceMetadata extends Serializable { 10 | 11 | String getResourceUrl(); 12 | 13 | String getMimeType(); 14 | 15 | /** 16 | * @return The target names of the thumbnails. This list is not null, but could be empty. 17 | */ 18 | Set getThumbnailTargetNames(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/Media3dResourceMetadata.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | import eu.europeana.metis.schema.jibx.EdmType; 4 | 5 | public class Media3dResourceMetadata extends AbstractResourceMetadata{ 6 | 7 | /** 8 | * Implements {@link java.io.Serializable}. 9 | */ 10 | private static final long serialVersionUID = -2887423565606864723L; 11 | 12 | /** 13 | * Constructor. 14 | * 15 | * @param mimeType The resource mime type. 16 | * @param resourceUrl The resource URL. 17 | * @param contentSize The file content size. 18 | */ 19 | public Media3dResourceMetadata(String mimeType, String resourceUrl, Long contentSize) { 20 | super(mimeType, resourceUrl, contentSize, null); 21 | } 22 | 23 | @Override 24 | protected ResourceMetadata prepareForSerialization() { 25 | return new ResourceMetadata(this); 26 | } 27 | 28 | @Override 29 | protected void updateResource(WebResource resource) { 30 | super.updateResource(resource); 31 | resource.setEdmType(EdmType._3_D); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/MediaExtractorInput.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | /** 4 | * This class defines the input for media extraction. 5 | */ 6 | public class MediaExtractorInput { 7 | 8 | private final RdfResourceEntry resourceEntry; 9 | private final boolean mainThumbnailAvailable; 10 | 11 | /** 12 | * Constructor. 13 | * 14 | * @param resourceEntry The resource entry to perform extraction on. 15 | * @param mainThumbnailAvailable Whether the main thumbnail for this record is available. This may 16 | * influence the decision on whether to generate a thumbnail for this resource. 17 | */ 18 | public MediaExtractorInput(RdfResourceEntry resourceEntry, boolean mainThumbnailAvailable) { 19 | this.resourceEntry = resourceEntry; 20 | this.mainThumbnailAvailable = mainThumbnailAvailable; 21 | } 22 | 23 | public RdfResourceEntry getResourceEntry() { 24 | return resourceEntry; 25 | } 26 | 27 | public boolean isMainThumbnailAvailable() { 28 | return mainThumbnailAvailable; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/Resource.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | import java.io.File; 4 | import java.net.URI; 5 | import java.nio.file.Path; 6 | import java.util.Set; 7 | 8 | /** 9 | * This interface represents the binary content of a resource. Please see {@link ResourceRelatedFile} for 10 | * more information. 11 | */ 12 | public interface Resource extends ResourceRelatedFile { 13 | 14 | /** 15 | * @return The resource URL types with which this resource is referenced. 16 | */ 17 | Set getUrlTypes(); 18 | 19 | /** 20 | * @return The mime type that has been provided for this resource by the source server. If none is 21 | * provided, or a default type, null is returned. 22 | */ 23 | String getProvidedMimeType(); 24 | 25 | /** 26 | * @return The file size that has been provided for this resource by the source server. If none is 27 | * provided, the value 0 is returned. 28 | */ 29 | Long getProvidedFileSize(); 30 | 31 | /** 32 | * @return The actual location where this resource has been found. 33 | */ 34 | URI getActualLocation(); 35 | 36 | /** 37 | * @return A reference to the file containing this resource. Can be null. 38 | */ 39 | Path getContentPath(); 40 | 41 | /** 42 | * @return A reference to the file containing this resource. Can be null. 43 | */ 44 | File getContentFile(); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/ResourceExtractionResult.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | import java.io.Closeable; 4 | import java.util.List; 5 | 6 | /** 7 | * This interface represents the result of a resource extraction, consisting of metadata and 8 | * thumbnails. It is closable, which will have the effect of closing the thumbnails. 9 | */ 10 | public interface ResourceExtractionResult extends Closeable { 11 | 12 | /** 13 | * @return The serializable metadata of this resource. Can be null. 14 | */ 15 | ResourceMetadata getMetadata(); 16 | 17 | /** 18 | * @return The thumbnails generated for this resource. Can be null or empty. 19 | */ 20 | List getThumbnails(); 21 | } 22 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/Thumbnail.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | /** 4 | * This interface contains a representation of a thumbnail generated for a given resource. Please 5 | * see {@link ResourceRelatedFile} for more information. 6 | */ 7 | public interface Thumbnail extends ResourceRelatedFile { 8 | 9 | /** 10 | * @return The mime type of the thumbnail. 11 | */ 12 | String getMimeType(); 13 | 14 | /** 15 | * @return The unique (target) name of the thumbnail by which it is known. 16 | */ 17 | String getTargetName(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/ThumbnailImpl.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | /** 4 | * This class implements {@link Thumbnail}. 5 | */ 6 | public class ThumbnailImpl extends AbstractInMemoryFile implements Thumbnail { 7 | 8 | private final String mimeType; 9 | private final String targetName; 10 | 11 | /** 12 | * Constructor. 13 | * 14 | * @param resourceUrl The URL of the resource for which this thumbnail is generated. 15 | * @param mimeType The mime type of the thumbnail. 16 | * @param targetName The unique (target) name by which this thumbnail is known. 17 | */ 18 | public ThumbnailImpl(String resourceUrl, String mimeType, String targetName) { 19 | super(resourceUrl); 20 | this.mimeType = mimeType; 21 | this.targetName = targetName; 22 | } 23 | 24 | @Override 25 | public String getTargetName() { 26 | return targetName; 27 | } 28 | 29 | @Override 30 | public String getMimeType() { 31 | return mimeType; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/ThumbnailKind.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | /** 4 | * The various thumbnail kinds we generate. 5 | */ 6 | public enum ThumbnailKind { 7 | 8 | /** 9 | * The medium sized thumbnail. 10 | **/ 11 | MEDIUM(200, "-MEDIUM"), 12 | 13 | /** 14 | * The large sized thumbnail. 15 | **/ 16 | LARGE(400, "-LARGE"); 17 | 18 | private final int imageSize; 19 | private final String nameSuffix; 20 | 21 | ThumbnailKind(int imageSize, String nameSuffix) { 22 | this.imageSize = imageSize; 23 | this.nameSuffix = nameSuffix; 24 | } 25 | 26 | /** 27 | * @return The image size. 28 | */ 29 | public int getImageSize() { 30 | return imageSize; 31 | } 32 | 33 | /** 34 | * @return The name suffix. Thumbnails of this kind must contain (end with) this suffix. 35 | */ 36 | public String getNameSuffix() { 37 | return nameSuffix; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/model/UrlType.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.model; 2 | 3 | import java.util.Collections; 4 | import java.util.EnumSet; 5 | import java.util.Set; 6 | 7 | /** 8 | * The resource reference types that are used in RDF files to reference resources. This list is not 9 | * complete: it only contains those types that are considered for media processing. 10 | */ 11 | public enum UrlType { 12 | 13 | OBJECT, HAS_VIEW, IS_SHOWN_BY, IS_SHOWN_AT; 14 | 15 | /** 16 | * The resource URL types that are subject to link checking. 17 | **/ 18 | public static final Set URL_TYPES_FOR_LINK_CHECKING = Collections 19 | .unmodifiableSet(EnumSet.allOf(UrlType.class)); 20 | 21 | /** 22 | * The resource URL types that are subject to media extraction. 23 | **/ 24 | public static final Set URL_TYPES_FOR_MEDIA_EXTRACTION = Collections 25 | .unmodifiableSet(EnumSet.allOf(UrlType.class)); 26 | 27 | /** 28 | * The resource URL type that is subject to media extraction and provide the main thumbnail. 29 | * This is a member of {@link #URL_TYPES_FOR_MEDIA_EXTRACTION}. 30 | */ 31 | public static final UrlType URL_TYPE_FOR_MAIN_THUMBNAIL_RESOURCE = UrlType.OBJECT; 32 | } 33 | -------------------------------------------------------------------------------- /metis-media-service/src/main/java/eu/europeana/metis/mediaprocessing/wrappers/TikaWrapper.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.mediaprocessing.wrappers; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import org.apache.tika.Tika; 6 | import org.apache.tika.metadata.Metadata; 7 | 8 | /** 9 | * Wrapper class of Tika 10 | */ 11 | public class TikaWrapper { 12 | 13 | private final Tika tika; 14 | 15 | /** 16 | * It creates a new instance of Tika 17 | */ 18 | public TikaWrapper() { 19 | this.tika = new Tika(); 20 | } 21 | 22 | /** 23 | * It uses tika's own detect method 24 | * 25 | * @param inputStream The input stream to detect from 26 | * @param metadata The metadata associated with the input stream 27 | * @return The mime type detected from the input stream 28 | * @throws IOException 29 | */ 30 | public String detect(InputStream inputStream, Metadata metadata) throws IOException { 31 | 32 | // Do the detection. Create a markable input stream for tika to use, so that the marking it does 33 | // will not interfere with our mark above. 34 | String detectedMimeType = tika.detect(inputStream, metadata); 35 | 36 | // Normalize STL files (a 3D format). 37 | if (detectedMimeType.equals("application/vnd.ms-pki.stl")) { 38 | return "model/x.stl-binary"; 39 | } 40 | 41 | // Done 42 | return detectedMimeType; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /metis-media-service/src/main/resources/colormap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/europeana/metis-framework/68d316c859f08410472dfd8ec5fbd9eec197cdb3/metis-media-service/src/main/resources/colormap.png -------------------------------------------------------------------------------- /metis-media-service/src/main/resources/org/apache/tika/mime/custom-mimetypes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /metis-media-service/src/test/resources/__files/Cube_3d_printing_sample.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/europeana/metis-framework/68d316c859f08410472dfd8ec5fbd9eec197cdb3/metis-media-service/src/test/resources/__files/Cube_3d_printing_sample.stl -------------------------------------------------------------------------------- /metis-media-service/src/test/resources/__files/Duck.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/europeana/metis-framework/68d316c859f08410472dfd8ec5fbd9eec197cdb3/metis-media-service/src/test/resources/__files/Duck.glb -------------------------------------------------------------------------------- /metis-media-service/src/test/resources/__files/audio_test.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/europeana/metis-framework/68d316c859f08410472dfd8ec5fbd9eec197cdb3/metis-media-service/src/test/resources/__files/audio_test.mp3 -------------------------------------------------------------------------------- /metis-media-service/src/test/resources/__files/not_oembed.json: -------------------------------------------------------------------------------- 1 | { 2 | "glossary": { 3 | "title": "example glossary", 4 | "GlossDiv": { 5 | "title": "S", 6 | "GlossList": { 7 | "GlossEntry": { 8 | "ID": "SGML", 9 | "SortAs": "SGML", 10 | "GlossTerm": "Standard Generalized Markup Language", 11 | "Acronym": "SGML", 12 | "Abbrev": "ISO 8879:1986", 13 | "GlossDef": { 14 | "para": "A meta-markup language, used to create markup languages such as DocBook.", 15 | "GlossSeeAlso": [ 16 | "GML", 17 | "XML" 18 | ] 19 | }, 20 | "GlossSee": "markup" 21 | } 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /metis-media-service/src/test/resources/__files/not_oembed.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Oxford 8 | Oxfordshire 9 | Wikipedia 10 | 10000 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /metis-media-service/src/test/resources/__files/oembed.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "video", 3 | "version": "1.0", 4 | "provider_name": "Vimeo", 5 | "provider_url": "https://vimeo.com/", 6 | "title": "Europeana promo", 7 | "author_name": "Europeana", 8 | "author_url": "https://vimeo.com/europeana", 9 | "is_plus": "1", 10 | "account_type": "plus", 11 | "html": "", 12 | "width": 480, 13 | "height": 270, 14 | "duration": 31, 15 | "description": "", 16 | "thumbnail_url": "https://i.vimeocdn.com/video/223856359-d86332b534f4edd01355ee14c50b32473f746e4f56454128df8a8ca8228fffb8-d_295x166", 17 | "thumbnail_width": 295, 18 | "thumbnail_height": 166, 19 | "thumbnail_url_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F223856359-d86332b534f4edd01355ee14c50b32473f746e4f56454128df8a8ca8228fffb8-d_295x166&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png", 20 | "upload_date": "2011-05-30 09:03:39", 21 | "video_id": 24416915, 22 | "uri": "/videos/24416915" 23 | } 24 | -------------------------------------------------------------------------------- /metis-pattern-analysis/src/main/java/eu/europeana/patternanalysis/exception/PatternAnalysisException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.patternanalysis.exception; 2 | 3 | /** 4 | * Exception used for a pattern analysis error. 5 | */ 6 | public class PatternAnalysisException extends Exception { 7 | 8 | /** 9 | * Constructs a new exception with the specified detail message and cause. 10 | * 11 | * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method). 12 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A null value is 13 | * permitted, and indicates that the cause is nonexistent or unknown.) 14 | */ 15 | public PatternAnalysisException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /metis-pattern-analysis/src/main/java/eu/europeana/patternanalysis/view/ProblemPatternAnalysis.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.patternanalysis.view; 2 | 3 | import static java.util.Objects.requireNonNull; 4 | import static java.util.Objects.requireNonNullElseGet; 5 | 6 | import java.util.ArrayList; 7 | import java.util.HashSet; 8 | import java.util.List; 9 | import java.util.Set; 10 | 11 | /** 12 | * Class containing the problem pattern analysis for a record. 13 | */ 14 | public class ProblemPatternAnalysis { 15 | 16 | private final String rdfAbout; 17 | private final List problemPatterns; 18 | private final Set titles; 19 | 20 | /** 21 | * Constructor with required parameters. 22 | * 23 | * @param rdfAbout the rdf about 24 | * @param problemPatterns the problem patterns 25 | * @param titles the record titles 26 | */ 27 | public ProblemPatternAnalysis(String rdfAbout, List problemPatterns, Set titles) { 28 | this.rdfAbout = requireNonNull(rdfAbout); 29 | this.problemPatterns = requireNonNullElseGet(problemPatterns, ArrayList::new); 30 | this.titles = requireNonNullElseGet(titles, HashSet::new); 31 | } 32 | 33 | public String getRdfAbout() { 34 | return rdfAbout; 35 | } 36 | 37 | public List getProblemPatterns() { 38 | return new ArrayList<>(problemPatterns); 39 | } 40 | 41 | public Set getTitles() { 42 | return new HashSet<>(titles); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /metis-pattern-analysis/src/main/java/eu/europeana/patternanalysis/view/RecordAnalysis.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.patternanalysis.view; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * Class containing the record analysis. 8 | */ 9 | public class RecordAnalysis { 10 | 11 | private final String recordId; 12 | private final List problemOccurrenceList; 13 | 14 | /** 15 | * Constructor with required parameters. 16 | * 17 | * @param recordId the record id 18 | * @param problemOccurrenceList the problem occurrences list 19 | */ 20 | public RecordAnalysis(String recordId, List problemOccurrenceList) { 21 | this.recordId = recordId; 22 | this.problemOccurrenceList = problemOccurrenceList == null ? new ArrayList<>() : new ArrayList<>(problemOccurrenceList); 23 | } 24 | 25 | public String getRecordId() { 26 | return recordId; 27 | } 28 | 29 | public List getProblemOccurrenceList() { 30 | return new ArrayList<>(problemOccurrenceList); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /metis-pattern-analysis/src/test/java/eu/europeana/patternanalysis/view/ProblemOccurrenceTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.patternanalysis.view; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.junit.jupiter.api.Assertions.assertNotNull; 5 | import static org.junit.jupiter.api.Assertions.assertTrue; 6 | 7 | import java.util.List; 8 | import org.apache.commons.collections4.CollectionUtils; 9 | import org.junit.jupiter.api.Test; 10 | 11 | class ProblemOccurrenceTest { 12 | 13 | @Test 14 | void objectCreationTest() { 15 | final ProblemOccurrence problemOccurrence1 = new ProblemOccurrence("Duplicate titleA", List.of("recordId1", "recordId2")); 16 | assertEquals("Duplicate titleA", problemOccurrence1.getMessageReport()); 17 | assertTrue(CollectionUtils.isEqualCollection(List.of("recordId2", "recordId1"), problemOccurrence1.getAffectedRecordIds())); 18 | 19 | final ProblemOccurrence problemOccurrence2 = new ProblemOccurrence("Duplicate titleA", null); 20 | assertEquals("Duplicate titleA", problemOccurrence2.getMessageReport()); 21 | assertEquals(0, problemOccurrence2.getAffectedRecordIds().size()); 22 | 23 | final ProblemOccurrence problemOccurrence3 = new ProblemOccurrence("Duplicate titleB"); 24 | assertNotNull(problemOccurrence3.getAffectedRecordIds()); 25 | assertEquals(0, problemOccurrence3.getAffectedRecordIds().size()); 26 | } 27 | } -------------------------------------------------------------------------------- /metis-pattern-analysis/src/test/java/eu/europeana/patternanalysis/view/ProblemPatternAnalysisTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.patternanalysis.view; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.junit.jupiter.api.Assertions.assertThrows; 5 | 6 | import java.util.List; 7 | import java.util.Set; 8 | import org.junit.jupiter.api.Test; 9 | 10 | class ProblemPatternAnalysisTest { 11 | 12 | @Test 13 | void objectCreationTest() { 14 | final List problemPatterns = List.of(new ProblemPattern(ProblemPatternDescription.P2, 1, 15 | List.of(new RecordAnalysis("recordId", List.of(new ProblemOccurrence("message")))))); 16 | final Set titles = Set.of("titleA"); 17 | final ProblemPatternAnalysis problemPatternAnalysis = new ProblemPatternAnalysis("rdfAbout", problemPatterns, titles); 18 | 19 | assertEquals("rdfAbout", problemPatternAnalysis.getRdfAbout()); 20 | assertEquals(problemPatternAnalysis.getProblemPatterns().size(), problemPatterns.size()); 21 | assertEquals(problemPatternAnalysis.getTitles().size(), titles.size()); 22 | 23 | assertThrows(NullPointerException.class, () -> new ProblemPatternAnalysis(null, problemPatterns, titles)); 24 | assertEquals(0, new ProblemPatternAnalysis("rdfAbout", null, titles).getProblemPatterns().size()); 25 | assertEquals(0, new ProblemPatternAnalysis("rdfAbout", problemPatterns, null).getTitles().size()); 26 | } 27 | } -------------------------------------------------------------------------------- /metis-pattern-analysis/src/test/java/eu/europeana/patternanalysis/view/RecordAnalysisTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.patternanalysis.view; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.junit.jupiter.api.Assertions.assertNotNull; 5 | import static org.junit.jupiter.api.Assertions.assertTrue; 6 | 7 | import java.util.List; 8 | import org.apache.commons.collections4.CollectionUtils; 9 | import org.junit.jupiter.api.Test; 10 | 11 | class RecordAnalysisTest { 12 | 13 | @Test 14 | void objectCreationTest() { 15 | final ProblemOccurrence problemOccurrence1 = new ProblemOccurrence("Duplicate titleA", List.of("recordId1", "recordId2")); 16 | final ProblemOccurrence problemOccurrence2 = new ProblemOccurrence("Duplicate titleB"); 17 | final RecordAnalysis recordAnalysis1 = new RecordAnalysis("recordId1", List.of(problemOccurrence1, problemOccurrence2)); 18 | 19 | assertEquals("recordId1", recordAnalysis1.getRecordId()); 20 | assertTrue(CollectionUtils.isEqualCollection(List.of(problemOccurrence1, problemOccurrence2), 21 | recordAnalysis1.getProblemOccurrenceList())); 22 | 23 | final RecordAnalysis recordAnalysis2 = new RecordAnalysis("recordId1", null); 24 | assertNotNull(recordAnalysis2.getProblemOccurrenceList()); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/.gitignore: -------------------------------------------------------------------------------- 1 | /src/main/resources/application.properties 2 | !/src/test/resources/repository-test.zip 3 | !/src/test/resources/repository-test-error.zip -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eclipse-temurin:21-jre 2 | COPY target/*.jar app.jar 3 | EXPOSE 8080 4 | ENTRYPOINT ["java", "-jar", "/app.jar"] 5 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/README.md: -------------------------------------------------------------------------------- 1 | #Metis Repository 2 | This module contains a simple record repository that 3 | can be deployed and used for testing harvesting. Currently 4 | it only supports OAI-PMH harvesting. Note that it doesn't 5 | completely implement the OAI standard; deviations are 6 | as follows: 7 | 8 | 1. It confines itself to the requests that are actually 9 | executed by Metis. That means it only supports 10 | the `ListIdentifiers` and `GetRecord` requests. 11 | 2. Pagination is not guaranteed to work when there are 12 | changes to the data. Specifically, if the data is changed 13 | while a user is harvesting, discrepancies (omissions of 14 | duplications of records) can occur. This is because 15 | pagination is executed directly on the database and the 16 | state of a previous request is not preserved. -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | services: 3 | mongo: 4 | image: mongo:4.2.9 5 | container_name: metis-repository-mongo 6 | environment: 7 | MONGO_INITDB_DATABASE: metis-repository 8 | MONGO_INITDB_ROOT_USERNAME: guest 9 | MONGO_INITDB_ROOT_PASSWORD: guest 10 | ports: 11 | - '27017:27017' 12 | metis-repository-local: 13 | image: europeana/metis-repository:develop 14 | container_name: metis-repository-local 15 | build: 16 | context: ./ 17 | dockerfile: Dockerfile 18 | ports: 19 | - '8080:8080' 20 | environment: 21 | MONGO_HOSTS: metis-repository-mongo 22 | volumes: 23 | - /data/metis-configuration/metis-framework/metis-repository/metis-repository-rest/k8s/overlays/local/components/properties/application.properties:/application.properties 24 | - /data/metis-configuration/k8s/common-components/log4j2-xml/log4j2.xml:/data/logging/log4j2.xml 25 | depends_on: 26 | - mongo 27 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/main/java/eu/europeana/metis/repository/rest/Application.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.repository.rest; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * The Spring boot application entry point 8 | */ 9 | @SpringBootApplication 10 | public class Application { 11 | 12 | /** 13 | * The main spring boot method 14 | * 15 | * @param args application arguments 16 | */ 17 | public static void main(String[] args){ 18 | SpringApplication.run(Application.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/main/java/eu/europeana/metis/repository/rest/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.repository.rest.config; 2 | 3 | import io.swagger.v3.oas.models.OpenAPI; 4 | import io.swagger.v3.oas.models.info.Info; 5 | import io.swagger.v3.oas.models.info.License; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | /** 10 | * Config for Swagger documentation 11 | */ 12 | @Configuration 13 | public class SwaggerConfig { 14 | 15 | /** 16 | * The open api documentation docket 17 | * 18 | * @return the docket configuration 19 | */ 20 | @Bean 21 | public OpenAPI openAPI(){ 22 | return new OpenAPI() 23 | .info(new Info() 24 | .title("Metis Repository REST API") 25 | .description("Metis Repository REST API for Europeana") 26 | .version("v1") 27 | .license(new License() 28 | .name("EUPL Licence v1.2") 29 | .url("https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12"))); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/main/java/eu/europeana/metis/repository/rest/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.repository.rest.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * Web MVC configuration 9 | */ 10 | @Configuration 11 | public class WebMvcConfig implements WebMvcConfigurer { 12 | 13 | @Override 14 | public void addViewControllers(ViewControllerRegistry registry) { 15 | registry.addRedirectViewController("/", "/swagger-ui/index.html"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/main/java/eu/europeana/metis/repository/rest/view/InstantSerializer.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.repository.rest.view; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.databind.JsonSerializer; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | import java.io.IOException; 7 | import java.time.Instant; 8 | import java.time.format.DateTimeFormatter; 9 | 10 | public class InstantSerializer extends JsonSerializer { 11 | 12 | final DateTimeFormatter formatter = DateTimeFormatter.ISO_INSTANT; 13 | 14 | @Override 15 | public void serialize(Instant instant, JsonGenerator jsonGenerator, 16 | SerializerProvider serializerProvider) throws IOException { 17 | jsonGenerator.writeString(formatter.format(instant)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/main/java/eu/europeana/metis/repository/rest/view/RecordView.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.repository.rest.view; 2 | 3 | import com.fasterxml.jackson.annotation.JsonRawValue; 4 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 5 | import java.time.Instant; 6 | 7 | public class RecordView { 8 | 9 | private final String recordId; 10 | private final String datasetId; 11 | @JsonSerialize(using = InstantSerializer.class) 12 | private final Instant dateStamp; 13 | private final boolean markedAsDeleted; 14 | @JsonRawValue 15 | private final String edmRecord; 16 | 17 | public RecordView(String recordId, String datasetId, Instant dateStamp, boolean markedAsDeleted, 18 | String edmRecord) { 19 | this.recordId = recordId; 20 | this.datasetId = datasetId; 21 | this.dateStamp = dateStamp; 22 | this.edmRecord = edmRecord; 23 | this.markedAsDeleted = markedAsDeleted; 24 | } 25 | 26 | public String getRecordId() { 27 | return recordId; 28 | } 29 | 30 | public String getDatasetId() { 31 | return datasetId; 32 | } 33 | 34 | public Instant getDateStamp() { 35 | return dateStamp; 36 | } 37 | 38 | public boolean isMarkedAsDeleted() { 39 | return markedAsDeleted; 40 | } 41 | 42 | public String getEdmRecord() { 43 | return edmRecord; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/test/java/eu/europeana/metis/repository/rest/InstantSerializerTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.repository.rest; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | 5 | import com.fasterxml.jackson.core.JsonFactory; 6 | import com.fasterxml.jackson.core.JsonGenerator; 7 | import com.fasterxml.jackson.databind.ObjectMapper; 8 | import com.fasterxml.jackson.databind.SerializerProvider; 9 | import eu.europeana.metis.repository.rest.view.InstantSerializer; 10 | import java.io.IOException; 11 | import java.io.StringWriter; 12 | import java.io.Writer; 13 | import java.time.Instant; 14 | import org.junit.jupiter.api.Test; 15 | 16 | /** 17 | * Unit test for {@link InstantSerializer} class 18 | */ 19 | class InstantSerializerTest { 20 | private InstantSerializer instantSerializer = new InstantSerializer(); 21 | 22 | @Test 23 | void serialize() throws IOException { 24 | final Instant instant = Instant.parse("2020-05-20T17:58:55.00Z"); 25 | final Writer jsonWriter = new StringWriter(); 26 | final JsonGenerator jsonGenerator = new JsonFactory().createGenerator(jsonWriter); 27 | final SerializerProvider serializerProvider = new ObjectMapper().getSerializerProvider(); 28 | 29 | instantSerializer.serialize(instant, jsonGenerator, serializerProvider); 30 | jsonGenerator.flush(); 31 | 32 | assertEquals("\"2020-05-20T17:58:55Z\"", jsonWriter.toString()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/test/java/eu/europeana/metis/repository/rest/RecordViewTest.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.repository.rest; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.junit.jupiter.api.Assertions.assertFalse; 5 | 6 | import eu.europeana.metis.repository.rest.view.RecordView; 7 | import java.time.Instant; 8 | import org.junit.jupiter.api.BeforeEach; 9 | import org.junit.jupiter.api.Test; 10 | 11 | /** 12 | * Unit test for {@link RecordView} class 13 | */ 14 | class RecordViewTest { 15 | 16 | private RecordView recordView; 17 | 18 | @BeforeEach 19 | void setup() { 20 | final Instant instant = Instant.parse("2022-05-19T08:28:00.823118Z"); 21 | recordView = new RecordView("recordId", "datasetId", instant, false, "edmRecord"); 22 | } 23 | 24 | @Test 25 | void getRecordId() { 26 | assertEquals("recordId", recordView.getRecordId()); 27 | } 28 | 29 | @Test 30 | void getDatasetId() { 31 | assertEquals("datasetId", recordView.getDatasetId()); 32 | } 33 | 34 | @Test 35 | void getDateStamp() { 36 | assertEquals("2022-05-19T08:28:00.823118Z", recordView.getDateStamp().toString()); 37 | } 38 | 39 | @Test 40 | void isMarkedAsDeleted() { 41 | assertFalse(recordView.isMarkedAsDeleted()); 42 | } 43 | 44 | @Test 45 | void getEdmRecord() { 46 | assertEquals("edmRecord", recordView.getEdmRecord()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/test/resources/repository-test-error.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/europeana/metis-framework/68d316c859f08410472dfd8ec5fbd9eec197cdb3/metis-repository/metis-repository-rest/src/test/resources/repository-test-error.zip -------------------------------------------------------------------------------- /metis-repository/metis-repository-rest/src/test/resources/repository-test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/europeana/metis-framework/68d316c859f08410472dfd8ec5fbd9eec197cdb3/metis-repository/metis-repository-rest/src/test/resources/repository-test.zip -------------------------------------------------------------------------------- /metis-repository/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | eu.europeana.metis 7 | 15-SNAPSHOT 8 | metis-framework 9 | 10 | 11 | metis-repository 12 | pom 13 | 14 | 15 | metis-repository-rest 16 | 17 | -------------------------------------------------------------------------------- /metis-transformation/metis-transformation-service/src/main/java/eu/europeana/metis/transformation/service/CacheValueSupplier.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.transformation.service; 2 | 3 | /** 4 | * Supplier for cache values that can throw a {@link CacheValueSupplierException}. 5 | * 6 | * @param The type of the value to be supplied. 7 | */ 8 | @FunctionalInterface 9 | public interface CacheValueSupplier { 10 | 11 | /** 12 | * Obtain the cache value. 13 | * 14 | * @return The cache value. 15 | * @throws CacheValueSupplierException In case the value could not be retrieved. 16 | */ 17 | V get() throws CacheValueSupplierException; 18 | 19 | /** 20 | * Exception indicated that the cache value could not be retrieved. 21 | */ 22 | class CacheValueSupplierException extends Exception { 23 | 24 | /** Implements {@link java.io.Serializable}. **/ 25 | private static final long serialVersionUID = 7580902638383421547L; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param cause The cause of the exception. 31 | */ 32 | public CacheValueSupplierException(Throwable cause) { 33 | super(cause); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /metis-transformation/metis-transformation-service/src/main/java/eu/europeana/metis/transformation/service/EuropeanaIdException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.transformation.service; 2 | 3 | /** 4 | * Exception indicating that something went wrong extracting the provider ID from the source or 5 | * converting it to a Europeana ID. 6 | * 7 | * @author jochen 8 | * 9 | */ 10 | public class EuropeanaIdException extends Exception { 11 | 12 | /** Implements {@link java.io.Serializable}. **/ 13 | private static final long serialVersionUID = -6596593096521279375L; 14 | 15 | /** 16 | * Constructor. 17 | * 18 | * @param message The exception message. 19 | */ 20 | public EuropeanaIdException(String message) { 21 | super(message); 22 | } 23 | 24 | /** 25 | * Constructor. 26 | * 27 | * @param message The exception message. 28 | * @param cause The causing exception. 29 | */ 30 | public EuropeanaIdException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /metis-transformation/metis-transformation-service/src/main/java/eu/europeana/metis/transformation/service/TransformationException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.metis.transformation.service; 2 | 3 | /** 4 | * Created by pwozniak on 3/21/18 5 | */ 6 | public class TransformationException extends Exception { 7 | 8 | private static final long serialVersionUID = -3627626649245559228L; 9 | 10 | /** 11 | * Constructor. 12 | * 13 | * @param cause The cause of this exception. 14 | */ 15 | public TransformationException(Throwable cause) { 16 | super(cause); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /metis-transformation/metis-transformation-service/src/test/resources/inject_node.xslt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /metis-transformation/metis-transformation-service/src/test/resources/sample_xslt.xslt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

My CD Collection

7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
TitleArtist
19 | 20 | 21 |
22 |
-------------------------------------------------------------------------------- /metis-transformation/metis-transformation-service/src/test/resources/xmlForTestingParamInjection.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 | Node1 value: 4 |
5 | -------------------------------------------------------------------------------- /metis-transformation/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | metis-framework 6 | eu.europeana.metis 7 | 15-SNAPSHOT 8 | 9 | metis-transformation 10 | pom 11 | 12 | metis-transformation-service 13 | 14 | -------------------------------------------------------------------------------- /metis-validation/README.md: -------------------------------------------------------------------------------- 1 | # Europeana EDM validation 2 | 3 | The EDM-validation repository provides REST endpoints for validating documents against the [Europeana Data Model](http://pro.europeana.eu/share-your-data/data-guidelines/edm-documentation) (EDM) 4 | 5 | This is organized as follows: 6 | 7 | Module | Functionality 8 | ---|--- 9 | validation-common | Object model for the validation service 10 | validation-service | Core validation service functionality -------------------------------------------------------------------------------- /metis-validation/metis-validation-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | metis-validation 6 | eu.europeana.metis 7 | 15-SNAPSHOT 8 | 9 | metis-validation-common 10 | 11 | 12 | 13 | jakarta.xml.bind 14 | jakarta.xml.bind-api 15 | 16 | 17 | io.swagger 18 | swagger-annotations 19 | ${version.swagger.annotations} 20 | 21 | 22 | com.fasterxml.jackson.core 23 | jackson-annotations 24 | ${version.jackson} 25 | 26 | 27 | -------------------------------------------------------------------------------- /metis-validation/metis-validation-common/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /metis-validation/metis-validation-service/.gitignore: -------------------------------------------------------------------------------- 1 | ##Add to ignore to not commit by mistake 2 | -------------------------------------------------------------------------------- /metis-validation/metis-validation-service/src/main/java/eu/europeana/validation/service/SchemaProviderException.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.validation.service; 2 | 3 | /** 4 | * Created by pwozniak on 12/22/17 5 | */ 6 | public class SchemaProviderException extends Exception { 7 | 8 | private static final long serialVersionUID = -6861990081785732650L; 9 | 10 | /** 11 | * Cretes {@link SchemaProviderException} from provided {@link Throwable} 12 | * 13 | * @param t the original cause 14 | */ 15 | public SchemaProviderException(Throwable t) { 16 | super(t); 17 | } 18 | 19 | /** 20 | * Cretes {@link SchemaProviderException} from provided message. 21 | * @param message the descriptive message 22 | */ 23 | public SchemaProviderException(String message) { 24 | super(message); 25 | } 26 | 27 | /** 28 | * Cretes {@link SchemaProviderException} from provided message and {@link Throwable} object. 29 | * @param message the descriptive message 30 | * @param t the original cause 31 | */ 32 | public SchemaProviderException(String message, Throwable t) { 33 | super(message, t); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /metis-validation/metis-validation-service/src/main/java/eu/europeana/validation/service/ValidationServiceConfig.java: -------------------------------------------------------------------------------- 1 | package eu.europeana.validation.service; 2 | 3 | /** 4 | * Created by erikkonijnenburg on 06/07/2017. 5 | */ 6 | public interface ValidationServiceConfig { 7 | 8 | /** 9 | * Retrieves threads count 10 | * 11 | * @return the thread count 12 | */ 13 | int getThreadCount(); 14 | } 15 | -------------------------------------------------------------------------------- /metis-validation/metis-validation-service/src/test/resources/__files/test_schema.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/europeana/metis-framework/68d316c859f08410472dfd8ec5fbd9eec197cdb3/metis-validation/metis-validation-service/src/test/resources/__files/test_schema.zip -------------------------------------------------------------------------------- /metis-validation/metis-validation-service/src/test/resources/custom-validation.properties: -------------------------------------------------------------------------------- 1 | predefinedSchemas=EDM-INTERNAL,EDM-EXTERNAL 2 | 3 | predefinedSchemas.EDM-INTERNAL.url=http://ftp.eanadev.org/schema_zips/europeana_schemas.zip 4 | predefinedSchemas.EDM-INTERNAL.rootLocation=EDM-INTERNAL.xsd 5 | 6 | predefinedSchemas.EDM-EXTERNAL.url=http://ftp.eanadev.org/schema_zips/europeana_schemas.zip 7 | predefinedSchemas.EDM-EXTERNAL.rootLocation=EDM.xsd -------------------------------------------------------------------------------- /metis-validation/metis-validation-service/src/test/resources/test_batch.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/europeana/metis-framework/68d316c859f08410472dfd8ec5fbd9eec197cdb3/metis-validation/metis-validation-service/src/test/resources/test_batch.zip -------------------------------------------------------------------------------- /metis-validation/metis-validation-service/src/test/resources/test_wrong.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/europeana/metis-framework/68d316c859f08410472dfd8ec5fbd9eec197cdb3/metis-validation/metis-validation-service/src/test/resources/test_wrong.zip -------------------------------------------------------------------------------- /metis-validation/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | metis-framework 6 | eu.europeana.metis 7 | 15-SNAPSHOT 8 | 9 | metis-validation 10 | pom 11 | 12 | metis-validation-common 13 | metis-validation-service 14 | 15 | 16 | 17 | UTF-8 18 | 19 | 20 | --------------------------------------------------------------------------------