示例#1
0
def build_class_schema_query(params):
    """
    Note: if params["lang"] is not False (e.g. "pt"), the following variables
    are filtered according to the lang provided:
    - rdfs:label
    - rdfs:comment (optional)
    """
    template_params = dict(**params)
    (params, language_tag) = add_language_support(template_params, "title")
    (params, language_tag) = add_language_support(template_params, "comment")
    return QUERY_CLASS_SCHEMA % template_params
示例#2
0
def build_class_schema_query(params):
    """
    Note: if params["lang"] is not False (e.g. "pt"), the following variables
    are filtered according to the lang provided:
    - rdfs:label
    - rdfs:comment (optional)
    """
    template_params = dict(**params)
    (params, language_tag) = add_language_support(template_params, "title")
    (params, language_tag) = add_language_support(template_params, "comment")
    return QUERY_CLASS_SCHEMA % template_params
示例#3
0
def list_classes(query_params):
    params = dict(**query_params)
    (params, language_tag) = add_language_support(query_params, "label")
    if not graph_exists(params):
        raise HTTPError(404, log_message=u"Graph {0} does not exist".format(query_params["graph_uri"]))

    query_result_dict = query_classes_list(params)
    if not query_result_dict or not query_result_dict['results']['bindings']:
        json = {
            "items": [],
            "warning": u"No classes found for graph {0} in page {1:d}".format(
                params["graph_uri"], int(params["page"]) + 1)
        }
        return json
    return assemble_list_json(params, query_result_dict)
示例#4
0
def _build_predicate_ranges_query(query_params, search_params):
    params = add_language_support(query_params, "range_label")[0]
    params.update(search_params)
    return QUERY_PREDICATE_RANGES % params
示例#5
0
def _build_predicate_ranges_query(query_params, search_params):
    params = add_language_support(query_params, "range_label")[0]
    params.update(search_params)
    return QUERY_PREDICATE_RANGES % params