Inconsistent use of set* and add*, especially in FileEntityBuilder
Maintainer thường phản hồi trong vòng 12 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java
- Lĩnh vực
- documentation
Hướng nghiên cứu
Bắt đầu bằng cách đọc các phương thức của FileEntityBuilder được nêu trong issue, sau đó so sánh hành vi của add* và set* trong các entity builder khác. Ghi lại các mục đích và khác biệt đã quan sát được, bao gồm các ví dụ cho setId, addProperty, addType, setLicense và setLocation; issue không nêu tên tệp tài liệu hoặc test nào.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Java
- Star
- 5
- Fork
- 4
- Merge trung bình
- 12 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của kit-data-manager/ro-crate-java
-
Tell us about your use cases!Đang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
kit-data-manager/ro-crate-java#377 ·
Maintainer thường phản hồi trong vòng 12 ngày
-
Support Jackson 3Có thể làm lại được @Pfeil đã nhận 59 ngày trước và không có pull request nào đang mở. Đang mởmaintenance
kit-data-manager/ro-crate-java#349 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 12 ngày
-
Adapt codemeta.jsonCó thể làm lại được @Pfeil đã nhận 119 ngày trước và không có pull request nào đang mở. Đang mởmaintenance
kit-data-manager/ro-crate-java#342 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 12 ngày
-
Dependency DashboardĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
kit-data-manager/ro-crate-java#310 ·
Maintainer thường phản hồi trong vòng 12 ngày
-
Fully support v1.2.0 features and cratesCó thể làm lại được @Pfeil đã nhận 403 ngày trước và không có pull request nào đang mở. Đang mởdocumentation enhancement maintenance specification-compliance
kit-data-manager/ro-crate-java#282 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 12 ngày
Tất cả issue của kit-data-manager/ro-crate-java
Issue tương tự
-
Shaded google-api-client trust stores still include AAA Certificate Services (eMudhra CA compromise)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
snowflakedb/snowflake-jdbc#2763 ·
-
MacFileUtils: FSPathMakeRef passes an int where the C function takes its FSRef output pointerĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 79/100
java-native-access/jna#1746 ·
-
Pooled clients leak a connection per call: pipelines and transactions taken from UnifiedJedis are never closedCó thể đã có người làm @ali-jawad đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
-
[BUG] spark: Iceberg REST catalog symlinks collide when multiple catalogs share one REST URIĐang mởkind:bug state:needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
OpenLineage/OpenLineage#5100 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
adorsys/keycloak-config-cli#1709 ·
Maintainer thường phản hồi trong vòng 1 ngày