[SPARQL][WIKIDATA] How Wikidata stores date data

How Wikidata stores date data

How did I encounter this?

While adding game data from Wikidata into game_db, I encountered an issue where some games' release dates are not specific, the logic to decide whether the game is released or not is not working properly. For example, The release date of Crimson Desert is marked as 2025 in the page of Wikidata, but when querying this, the retrieved value is 2025-01-01T00:00:00Z.

Cause

This is because Wikidata stores dates by converting them in xsd:dateTime format(YYYY-MM-DDTHH:MM:SSZ). So this make the 2025 for Crimson Desert as 2025-01-01. This is when the date is retrieved via SPARQL query. When Wikimedia's action API, the missing values such as months or days, are filled with 0s for example the data for Crimson Desert is 2025-00-00.

Comments