def test_get_props(): q = MQLQuery.make({ 'id': '/en/the_beatles', 'type': '/music/artist' }, ['*']) print MQLQuery.view_props(q.query_args)
def freebaseLookupProps(self, request, obj_url): ''' Given a fb query, looks up all of the properties associated with that object. These properties can become result_args fields. Format: /api/freebaselookupprops?args={arg1:val1,arg2:val1,...} tested: curl "http://127.0.0.1:8000/api/freebaselookupprops?args=id:/en/the_beatles" curl "http://127.0.0.1:8000/api/freebaselookupprops?args=id:/en/the_beatles,type:/music/artist" ''' query_args={} query_args_str = request.GET['args'] for a in query_args_str.split(','): query_args[a.split(':')[0]]=a.split(':')[1] return '{ The result set has the following properties: '+str(MQLQuery.view_props(query_args))+'}'
def freebaseLookupProps(self, request, obj_url): ''' Given a fb query, looks up all of the properties associated with that object. These properties can become result_args fields. Format: /api/freebaselookupprops?args={arg1:val1,arg2:val1,...} tested: curl "http://127.0.0.1:8000/api/freebaselookupprops?args=id:/en/the_beatles" curl "http://127.0.0.1:8000/api/freebaselookupprops?args=id:/en/the_beatles,type:/music/artist" ''' query_args = {} query_args_str = request.GET['args'] for a in query_args_str.split(','): query_args[a.split(':')[0]] = a.split(':')[1] return '{ The result set has the following properties: ' + str( MQLQuery.view_props(query_args)) + '}'
def test_get_props(): q = MQLQuery.make({'id':'/en/the_beatles','type':'/music/artist'}, ['*']) print MQLQuery.view_props(q.query_args)