-
Notifications
You must be signed in to change notification settings - Fork 6
feature : improve get/dataset/{id} methods #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feature : improve get/dataset/{id} methods #241
The head ref may contain hidden characters: "236-correction-sur-la-r\u00E9cup\u00E9ration-des-organismes-dans-getdatasetid"
Conversation
Correction of "Publisher" and "Creator" descriptions.
| } | ||
|
|
||
| protected IdLabel labelInformation(String id,String string1,String string2){ | ||
| List<LangContent> listOfLangContent = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Etre plus explicite dans le nom des paramètres, par exemple labelLg1 à la place de string1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifié en conséquence.
| reponse.setPublisher(publisher); | ||
| String id = organisations_result.getString("idPublisher"); | ||
| String string1 =organisations_result.getString("labelPublisherLg1"); | ||
| String string2 =organisations_result.getString("labelPublisherLg2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Etre plus explicite dans le nom des variables, par exemple labelLg1 au lieu de string1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifié en conséquence.
|
|
||
| private List<IdLabel> getCreator(List<String> creatorUris) throws RmesException { | ||
|
|
||
| List<String> stepOne = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indiquer dans le nom de la variable que c'est une liste
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifié en conséquence.
|
|
||
| @Test | ||
| void shouldReturnLabelInformationOne() { | ||
| IdLabel actual = dataSetsImpl.labelInformation("2025","elementLg1","elementLg2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expliciter davantage le nom de la méthode (au lieu de One/Two/Three/Four)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifié en conséquence ( shouldReturnIdLabelFromTwoStrings())
| } | ||
|
|
||
| @Test | ||
| void shouldReturnLabelInformationTwo() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifié en conséquence.
| } | ||
|
|
||
| @Test | ||
| void shouldReturnLabelInformationThree() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
je ne sais pas si ce test est très utile, ou indiquer la valeur attendue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supprimé en conséquence.
| } | ||
|
|
||
| @Test | ||
| void shouldReturnLabelInformationFour() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
je ne sais pas si ce test est très utile, ou indiquer la valeur attendue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supprimé en conséquence.
| @Test | ||
| void shouldConstructLangContent1() { | ||
| List<LangContent> actual = dataSetsImpl.constructLangContent1("elementLg1"); | ||
| List<LangContent> expected= List.of(LangContent.lg1("elementLg1")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je ne sais pas si ce test est très utile
ou indiquer la valeur attendue : [LangContent(lang=fr, content=elementLg1)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supprimé en conséquence.
| @Test | ||
| void shouldConstructLangContent2() { | ||
| List<LangContent> actual = dataSetsImpl.constructLangContent2("elementLg2"); | ||
| List<LangContent> expected= List.of(LangContent.lg2("elementLg2")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supprimé en conséquence.
| @Test | ||
| void shouldReturnStepsOfGetCreator() { | ||
| List<String> creatorUris = List.of(" Insee ","Ined ","Ine d","Ined"); | ||
| List<String> stepOne = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stepOne : utiliser un nom plus explicite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifié en conséquence ( creatorUrisWithoutExternalSpaces ).
| for (String s : creatorUris) { stepOne.add(s.trim());} | ||
| List<String> stepTwo = new ArrayList<>(new LinkedHashSet<>(stepOne)); | ||
| boolean responseOne = stepOne.equals(List.of("Insee", "Ined", "Ine d", "Ined")); | ||
| boolean responseTwo = stepTwo.toString().equals("[Insee, Ined, Ine d]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem pour responseOne et ResponseTwo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifié en conséquence :
- stepTwo devient deleteDuplicatesCreatorUris
- responseOne devient correctDeletionOfSpaces
- responseTwo devient goodDuplicateRemoval
| if(!identifiers.contains(id.trim())){ | ||
| String string1 = creator_result.getString("labelCreatorLg1"); | ||
| String string2 = creator_result.getString("labelCreatorLg2"); | ||
| creator.add(labelInformation(id.trim(),string1,string2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pourquoi .trim() ? tu as rencontré un souci avec un exemple en base ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Le problème rencontré avait de mémoire trait à la fonction getCreator de DataSetsImpl.java. En effet, les éléments de la liste passée en paramètre figurent initialement dans une même chaîne de caractères d'un JSON et sont séparés par une virgule et des espaces ( par exemple "A K, B, C"). Pour les stocker un à un dans une liste, le codeur identifie le séparateur virgule avec des espaces. Pour autant le nombre d'espaces inclus in fine dans le séparateur était erroné ( par exemple séparateur ", " ou ", " à la place de ","). Au lieu de supprimer les espaces préfixant et suffixant chaque élément pour ensuite interroger la base, le codeur a demandé la suppression de la totalité des espaces dans l'élément ( on obtient ainsi par exemple l'élément "AK" à chercher au lieu de "A K"). La requête ne trouvait subséquemment pas tous les éléments en interrogeant GraphDB. Pour éviter le moindre problème, on force la suppression des espaces en début et fin de l'élément ( qu'importe le nombre d'espaces dans le séparateur dès lors qu'il contient une virgule).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai modifié aussi d'autres string1 et string2 dans mon code pour le rendre plus explicite.
|
…ismes-dans-getdatasetid
…ismes-dans-getdatasetid
|


#236