Skip to content

Commit

Permalink
[UPD] Call process-annotation-service on ServiceController.importDocu…
Browse files Browse the repository at this point in the history
…ment

- add config parameter to set up the url for the process-annotation-service
  • Loading branch information
kostobog committed Jun 28, 2022
1 parent 7e28c52 commit 30943ab
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
public class AnnotatorConf {
private String listDocumentsAPI;
private String convertDocumentAPI;
private String processAnnotationAPI;
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void deleteComponent(@PathVariable(name = "systemFragment") String system
public void importDocument(@PathVariable(name = "systemFragment") String systemFragment, @RequestParam URI documentId) throws UnsupportedEncodingException {
URI systemURI = identifierService.composeIdentifier(Vocabulary.s_c_System, systemFragment);
log.info("> importing annotations from document <{}> into system <{}>", documentId, systemURI);
annotatorService.processAnnotations();
annotatorService.convertDocument(documentId.toString());
repositoryService.importDocument(systemURI, documentId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,13 @@ public void convertDocument(String docuementIri) throws UnsupportedEncodingExcep
// use document iri as the context in which to store converted annotations
rdfDao.persist(reader, docuementIri);
}

public void processAnnotations(){
log.info("calling external annotation processing service {}", conf.getProcessAnnotationAPI());
RestTemplate restTemplate = new RestTemplate();
String url = conf.getProcessAnnotationAPI();
ResponseEntity<String> response
= restTemplate.getForEntity(url, String.class);
}

}
1 change: 1 addition & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ logging:
annotator:
list-documents-api: ${LIST_DOCUMENT_API:http://localhost:8282/s-pipes/service?_pId=list-documents}
convert-document-api: ${CONVERT_DOCUMENT_API:http://localhost:8282/s-pipes/service?_pId=convert-document}
process-annotatoins-api: ${PROCESS_ANNOTATION_API:https://localhost:8090/annotator/process-annotation-service.sh}

0 comments on commit 30943ab

Please sign in to comment.