Advertisement
VladNitu

UML Diagram Draft 1

May 2nd, 2023
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. @startuml
  2. ' TODO: Discussion
  3. ' 1. Fingerprint: Pair<Int, Int>, or create a new Object of type Fingerprint and shinglesList: List<Fingerprint>
  4.  
  5.  
  6. ' Entities
  7. entity Document {
  8. 'key
  9. String url;
  10.  
  11. 'The rest are values
  12. ' <shingle_hash, shingle_pos>
  13. List<Integer, Integer> shinglesList;
  14. Date publishDate;
  15. }
  16.  
  17.  
  18. ' Controllers
  19. class FingerprintController {
  20.  
  21. CrawlerService crawlerService;
  22. FingerprintService fingerprintService;
  23.  
  24. ' Endpoints -> Double represents similarity ratio
  25. ResponseEntity<Double> checkURL(@PathVariable String url);
  26. ResponseEntity<Double> compareURLs(@PathVariable String url1, @PathVariable String url2);
  27. ResponseEntity<Double> checkText(@RequestBody String text);
  28. ResponseEntity<Double> compareTexts(@RequestBody String text1, @RequestBody String text2);
  29.  
  30.  
  31. }
  32.  
  33. ' Services
  34.  
  35. class CrawlerService {
  36. 'from news-please import NewsPlease
  37. NewsPlease newsPlease;
  38. NewsPlease.Article crawl(String url);
  39. }
  40.  
  41.  
  42. class SimilarityService {
  43.  
  44. ' Check to be in [0, 1]
  45. Double computeSimilarity(List<Integer, Integer> fp1, List<Integer, Integer> fp2);
  46. ' <URL, Similarity>
  47.  
  48. }
  49.  
  50.  
  51. class FingerprintService {
  52.  
  53. DocumentRepository documentRepository;
  54. SimilarityService similarityService;
  55.  
  56. Pair<String, Double> findMaxSim(String URL);
  57. List<Pair<String, Double>> findMaxKSims(String url, int k);
  58.  
  59.  
  60.  
  61.  
  62. }
  63.  
  64. class CrawlerService
  65.  
  66. ' Repositories -> what interacts with our database
  67.  
  68. interface DocumentRepository {
  69.  
  70. Document findById();
  71. List<Document> findAll();
  72. Document save(Document document);
  73. }
  74. @enduml
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement