Inconsistent use of set* and add*, especially in FileEntityBuilder
I maintainer di solito rispondono entro 12 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- java
- Ambito
- documentation
Direzione di ricerca
Inizia leggendo i metodi di FileEntityBuilder menzionati nell'issue, quindi confronta il comportamento di add* e set* negli altri entity builder. Documenta gli scopi e le differenze osservati, inclusi gli esempi per setId, addProperty, addType, setLicense e setLocation; l'issue non indica né un file di documentazione né un test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
As mentioned in #216 there is the need to document purpose and differences of add* and set* in general. While the actual purpose seems to be clear on the semantic level, it's almost impossible to estimate the effect of a set* or add* call without deeper knowledge of the code. Let's take the following example:
FileEntity file = new FileEntity.FileEntityBuilder()
.setId("survey-responses-2019.csv")
.addProperty("name", "Survey responses")
.addType("rdfs:Property")
.setLicense(new ContextualEntity.ContextualEntityBuilder().setId("licenseId").addProperty("name", "LicenseName").build())
.addProperty("contentSize", "26452")
.addProperty("encodingFormat", jsonNode)
.setLocation("http://example.com")
.build()
- setId - Compared to other calls it should do the same as addProperty('@id', id), but holds id different than other properties, such that addProperty('@id', '123') would not work (and may even cause errors). Furthermore, if the id was already set, the call does nothing, such that overwriting an id is not foreseen (which is somehow fine).
- addProperty - Should be better called setProperty(key, value), as previously added properties with the same name are overwritten. Thus, array values can only be set via addProperty(String, JsonNode). Therefore, one could think of either renaming addProperty to setProperty or changing its behaviour (see next point)
- addType - Actually does what an add-method is supposed to do. At the first call it initializes a HashMap and adds the provided value, while subsequent calls add additional values to the HashMap. So basically the behaviour expected also for addProperty.
- setLicense - One of the most confusing calls. In both cases, it internally calls addIdProperty("license", id). If you call it with a string argument, the value is assumed to be the license id and is directly used. If called with a ContextualEntity argument, getId() is used as license id, while the rest is omitted. Thus, the ContextualEntity of the license has to be added separately to the crate afterwards.
- setLocation - Probably the most confusing call as there are more internal possibilities of what may happen. If called with an URI, the argument is set as id. If id was set before, the call is ignored. If called with a path and the id was not set before, the filename is used as id and path as location. If id was set before, path is only used as location without changing the id. If path is null, nothing is done (unless setLocationWithExceptions is used) and if path points to an non existing file, everything is fine until the crate is written and an exception is thrown.
For the moment, I just wanted to have these points documented for further discussions. I also have the impression, that for other entity builders the situation is much clearer (and mostly limited on the builder-level to set* for single values), but a consistent behaviour would be desirable.
- Lingua principale
- Java
- Stelle
- 5
- Fork
- 4
- Merge medio
- 12g 10h
- PR unite (30g)
- 8
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di kit-data-manager/ro-crate-java
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
kit-data-manager/ro-crate-java#377 ·
I maintainer di solito rispondono entro 12 giorni
-
Support Jackson 3Forse di nuovo libera @Pfeil l’ha presa 58 giorni fa e non c’è nessuna pull request aperta. Apertamaintenance
kit-data-manager/ro-crate-java#349 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 12 giorni
-
Adapt codemeta.jsonForse di nuovo libera @Pfeil l’ha presa 118 giorni fa e non c’è nessuna pull request aperta. Apertamaintenance
kit-data-manager/ro-crate-java#342 · 1 assegnatario ·
I maintainer di solito rispondono entro 12 giorni
-
Dependency DashboardAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
kit-data-manager/ro-crate-java#310 ·
I maintainer di solito rispondono entro 12 giorni
-
Fully support v1.2.0 features and cratesForse di nuovo libera @Pfeil l’ha presa 402 giorni fa e non c’è nessuna pull request aperta. Apertadocumentation enhancement maintenance specification-compliance
kit-data-manager/ro-crate-java#282 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 12 giorni
Tutte le issue di kit-data-manager/ro-crate-java
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ReChronoRain/HyperCeiler#1743 ·
I maintainer di solito rispondono entro 6 giorni
-
Create CONTRIBUTING.mdAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ControlSystemStudio/phoebus#3979 ·
I maintainer di solito rispondono entro 2 giorni
-
Cannot find symbol CTypedefForse già presa @pellico l’ha presa oggi. Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100