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

ArgumentException for WbGlobeCoordinate with precision = null #106

Open
j-bbr opened this issue Nov 7, 2023 · 1 comment
Open

ArgumentException for WbGlobeCoordinate with precision = null #106

j-bbr opened this issue Nov 7, 2023 · 1 comment

Comments

@j-bbr
Copy link

j-bbr commented Nov 7, 2023

During processing of a recent wikidata dump I noticed that WbGlobeCoordinate throws an ArgumentException if the precision field is null. Here is the relevant portion from an example entity (Berlin TV Tower) from the dump where that occurs:

"P625": [
            {
                "mainsnak": {
                    "snaktype": "value",
                    "property": "P625",
                    "datavalue": {
                        "value": {
                            "latitude": 52.520833333333,
                            "longitude": 13.409444444444,
                            "altitude": null,
                            "precision": null,
                            "globe": "http:\/\/www.wikidata.org\/entity\/Q2"
                        },
                        "type": "globecoordinate"
                    },
                    "datatype": "globe-coordinate"
                },
                "type": "statement",
                "id": "q151356$2200165A-750E-42AB-BC62-4F23EF25F202",
                "rank": "normal"
            }
        ]

Maybe the precision field could be made nullable in WbGlobeCoordinate?

@mormegil-cz
Copy link
Contributor

Just came here to report the same! I’m surprised this is allowed on Wikidata/Wikibase side, but it apparently occurs (for me, this was Q744598). In the Wikidata UI, the precision (shown when editing the claim) is shown as “unspecified”, but it cannot be set to unspecified after choosing anything else; strange.

For completeness, the exception callstack is

System.ArgumentException: Can not convert Null to Double.
   at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value)
   at WikiClientLibrary.Wikibase.DataTypes.BuiltInDataTypes.<>c.<.cctor>b__46_19(JToken e)
   at WikiClientLibrary.Wikibase.DataTypes.DelegatePropertyType`1.Parse(JToken expr)
   at WikiClientLibrary.Wikibase.Snak.get_DataValue()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants