Skip to content
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

Cannot load commit files with values of type xsd:time, xsd:dateTime, xsd:date #584

Closed
mpoffald opened this issue Sep 28, 2023 · 0 comments · Fixed by #585
Closed

Cannot load commit files with values of type xsd:time, xsd:dateTime, xsd:date #584

mpoffald opened this issue Sep 28, 2023 · 0 comments · Fixed by #585
Assignees
Labels
bug Something isn't working as expected

Comments

@mpoffald
Copy link
Contributor

Similar to https://github.com/fluree/core/issues/31, we are writing out time values incorrectly, creating unparseable commit files

(do
    (def conn @(fluree/connect {:method :file
                                :storage-path "dev/data" 
                                :defaults
                                {:context (merge test-utils/default-str-context {"ex" "http://example.org/ns/"})}}))
    (def    ledger @(fluree/create conn "user/test"))
    (def    db @(fluree/stage
                  (fluree/db ledger)
                  [{"@id" "ex:Foo",
                    "@type" "ex:Bar",
                    "ex:offsetDateTime" {"@type" "xsd:dateTime"
                                         "@value" "2023-04-01T00:00:00.000Z"}
                    "ex:localDateTime" {"@type" "xsd:dateTime"
                                        "@value" "2021-09-24T11:14:32.833"}
                    "ex:offsetDateTime2" {"@type" "xsd:date"
                                          "@value" "2022-01-05Z"}
                    "ex:localDate" {"@type" "xsd:date"
                                        "@value" "2024-02-02"}
                   "ex:localTime" {"@type" "xsd:time"
                                    "@value" "12:42:00"}
                    "ex:offsetTime" {"@type" "xsd:time"
                                     "@value" "12:42:00Z"}}]))
    (def    db-commit @(fluree/commit! ledger db)))  

  (def    loaded @(fluree/load conn (:alias ledger)))  

;;=> Exception in thread "async-dispatch-5" com.fasterxml.jackson.core.JsonParseException: Unexpected character ('#' (code 35)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')

In the commit file:

[{"@id":"http://example.org/ns/Foo","@type":"http://example.org/ns/Bar",
"http://example.org/ns/localDate":{"@value":#object[java.time.LocalDate 0x7b1cb6fd "2024-02-02"]},
"http://example.org/ns/localDateTime":{"@value":#object[java.time.LocalDateTime 0x321437aa "2021-09-24T11:14:32.833"]},
"http://example.org/ns/localTime":{"@value":#object[java.time.LocalTime 0x757a6c8e "12:42"]},
"http://example.org/ns/offsetDateTime":{"@value":#object[java.time.OffsetDateTime 0x2ca1c44b "2023-04-01T00:00Z"]},
"http://example.org/ns/offsetDateTime2":{"@value":#object[java.time.OffsetDateTime 0x3d3ec897 "2022-01-05T00:00Z"]},
"http://example.org/ns/offsetTime":{"@value":#object[java.time.OffsetTime 0x6710cb38 "12:42Z"]}}]
@mpoffald mpoffald added the bug Something isn't working as expected label Sep 28, 2023
@mpoffald mpoffald self-assigned this Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant