While we should never have invalid data in our database, we should still degrade somewhat gracefully if we do and provide something syntactically valid to the user if they request RDF or ttl data.
So if we have for example invalid data like the following (notice the strange precision):
{ "P625": [ { "mainsnak": { "snaktype": "value", "property": "P625", "datavalue": { "value": { "latitude": -90, "longitude": 0, "altitude": null, "precision": 146706019195900, "globe": "http://www.wikidata.org/entity/Q308" }, "type": "globecoordinate", "error": "$precision needs to be between -360 and 360" }, "datatype": "globe-coordinate" }, "type": "statement", "id": "Q3629997$469068A1-32BD-4D93-AF94-150EEC63BD2D", "rank": "normal", "references": [...] } ], }
Then the ttl (and RDF) could look somewhat like this:
wd:Q3629997 # no wdt:P625; p:P625 wds:Q3629997-469068A1-32BD-4D93-AF94-150EEC63BD2D. wds:Q3629997-469068A1-32BD-4D93-AF94-150EEC63BD2D # no ps:P625; psv:P625 _:someBlankNode. _:someBlankNode rdf:type wikibase:Error; # look for more appropriate class wikibase:errorMessage "$precision needs…". # TODO needed?
that way
- queries selecting wdt:P625 ?value silently skip the value
- queries counting p:P625 [] count the statement
- queries looking at p:P625/psv:P625 [ wikibase:geoLongitude ?lon; wikibase:geoLatitude ?lat ] skip the value