Question

I am working on freebase API. I have a JSON query where I am trying to get information about places that contain in a town from freebase.

I had a problem with the input geolocation when I used the latitude and longitude from wikipedia. When I put the geolocation that I take from freebase.com is working correct but not for all the towns. Is there a problem with my query?

Code:

query = o("name",name,"type","/location/location","geolocation",a(o("latitude",latitude,
             "longitude",longitude)),"contains", a(o("name",null,"id",null,"optional","optional","type","/location/location",
             "geolocation",a(o("latitude",null,"longitude",null,"optional","optional")),"limit",800,"count",null)));

Error: java.lang.NullPointerException

Was it helpful?

Solution

It's kind of hard to tell since you aren't using JSON syntax and you've provided no context as to where the NPE is occurring, but one definite problem is that "optional" takes a True/False value, not the string "optional".

I'd recommend debugging your query using the Freebase query editor and only munging to be Java compatible at the last minute when you've got it all debugged.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top