Пример #1
0
 def get_resource_by_class(self, class_name, params=None):
     if len(params) > 0:
         self.client.backend._append_slash = False
         response = self.client.backend.classes(class_name).resources.GET(
             dict_to_url_params(params))
     else:
         self.client.backend._append_slash = True
         response = self.client.backend.classes(class_name).resources.GET()
     return OrkgResponse(response)
Пример #2
0
 def get_by_object(self, object_id, params=None):
     if len(params) > 0:
         self.client.backend._append_slash = False
         response = self.client.backend.statements.object(object_id).GET(
             dict_to_url_params(params))
     else:
         self.client.backend._append_slash = True
         response = self.client.backend.statements.object(object_id).GET()
     return OrkgResponse(response)
Пример #3
0
 def get(self, params=None):
     if len(params) > 0:
         self.client.backend._append_slash = False
         response = self.client.backend.classes.GET(
             dict_to_url_params(params))
     else:
         self.client.backend._append_slash = True
         response = self.client.backend.classes.GET()
     return OrkgResponse(response)
Пример #4
0
 def get(self, params=None):
     """
     Fetch a list of resources, with the possibility to paginate the results and filter them out based on label
     :param q: search term of the label of the resource (optional)
     :param exact: whether to check for the exact search term or not (optional) -> bool
     :param page: the page number (optional)
     :param items: number of items per page (optional)
     :param sortBy: key to sort on (optional)
     :param desc: true/false to sort desc (optional)
     :param exclude: classes to be excluded in search (optional)
     :return: an OrkgResponse object contains the list of resources
     """
     if len(params) > 0:
         self.client.backend._append_slash = False
         response = self.client.backend.resources.GET(
             dict_to_url_params(params))
     else:
         self.client.backend._append_slash = True
         response = self.client.backend.resources.GET()
     return OrkgResponse(response)