query.py 886 B

123456789101112131415161718192021222324252627282930313233
  1. from flask import Blueprint, request
  2. # Query endpoint. raw SPARQL queries exposing the underlying layout can be made
  3. # available. Also convenience methods that allow simple lookups based on simple
  4. # binary comparisons should be added. Binary lookups—maybe?
  5. # N.B All data sources are read-only for this endpoint.
  6. query = Blueprint('query', __name__)
  7. @query.route('/find', methods=['GET'])
  8. def find():
  9. '''
  10. Search by entering a search term and optional property and comparison term.
  11. '''
  12. valid_operands = ('=', '>', '<', '<>')
  13. term = request.args.get('term')
  14. prop = request.args.get('prop', default=1)
  15. cmp = request.args.get('cmp', default='=')
  16. # @TODO
  17. @query.route('/sparql', methods=['POST'])
  18. def sparql(q):
  19. '''
  20. Perform a direct SPARQL query on the underlying triplestore.
  21. @param q SPARQL query string.
  22. '''
  23. # @TODO
  24. pass