MCPcopy Create free account
hub / github.com/alephdata/aleph / suggest_entity

Function suggest_entity

aleph/views/reconcile_api.py:178–200  ·  view source on GitHub ↗

Suggest API, emulates Google Refine API.

()

Source from the content-addressed store, hash-verified

176@blueprint.route("/api/freebase/suggest", methods=["GET", "POST"])
177@talisman(content_security_policy=CSP)
178def suggest_entity():
179 """Suggest API, emulates Google Refine API."""
180 require(request.authz.can_browse_anonymous)
181 prefix = request.args.get("prefix", "")
182 tag_request(prefix=prefix)
183 types = request.args.getlist("type") or Entity.THING
184 args = {
185 "prefix": prefix,
186 "filter:schemata": types,
187 "filter:collection_id": request.args.getlist("filter:collection_id"),
188 }
189 parser = SearchQueryParser(args, request.authz)
190 query = EntitiesQuery(parser)
191 result = query.search()
192 matches = list(entity_matches(result))
193 return jsonify(
194 {
195 "code": "/api/status/ok",
196 "status": "200 OK",
197 "prefix": prefix,
198 "result": matches,
199 }
200 )
201
202
203@blueprint.route("/api/freebase/property", methods=["GET", "POST"])

Callers

nothing calls this directly

Calls 9

requireFunction · 0.90
tag_requestFunction · 0.90
SearchQueryParserClass · 0.90
EntitiesQueryClass · 0.90
jsonifyFunction · 0.90
entity_matchesFunction · 0.85
getlistMethod · 0.80
searchMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected