Open alastair opened 4 years ago
Another downside of updating the fields to type string
is that it isn't possible anymore to search nodes in the CE API within a date range.
For example:
query {
Person(
filter: {
birthDate_gte: {
year: 1800
},
AND: [{
birthDate_lte: {
year: 1899
}
}]
}
) {
identifier
name
}
}
I've been researching this topic some more and would like to discuss two possible solutions.
If we follow the date definition, the birthDate
property, for example, should be an ISO-8601 string. Because we are using Neo4j Graphql, it has been decided to use the _Neo4jDate
and _Neo4jDateTime
temporal types for date objects. Because of this, it is not possible to enter uncertain dates.
I was thinking to make all the schema.org Date and DateTime fields scalar types. For each corresponding field, there will be a "parsed" field in order to filter based on these dates.
For example:
type Person {
birthDate: string
birthDateParsed: _Neo4jDate
}
We could either;
1) Autogenerate the parsed
field automatically and populate this field with a parsed value of the scalar field and make the parsed
field read-only.
2) Add both fields to the schema and add the need to let users fill in both fields.
The downside of the first option is that we need to implement an ISO-8601-2 parser which allows dates like 1800?
. As for the second option, the downside is that we can't guarantee that the parsed
field will be set. This will make the search with dates unreliable.
What do you think @alastair @musicog ?
As discussed with @alastair this is not required for the Trompa project and the issue can be closed.
From https://github.com/trompamusic/trompa-ce-client/pull/21#issuecomment-591386127
gives a result of
Intuitively, this feels wrong, as in many cases we may only have partial date information. Two use-cases which we need to support immediately:
While we may loose semantic information by not using a specific Date object, I think that it makes sense to consider changing the type of these Date fields that could be partial. Two options come to mind: