예제 #1
0
def api(request):

    concept_pk = request.GET["pk"]
    relation_name = request.GET["relation"]
    label = request.GET["label"]

    concept = Concept.objects.get(pk=concept_pk)

    if relation_name == 'altLabel':
        alternate = Alternate()
        alternate.altLabel = label
        alternate.concept = concept
        alternate.save()

    if relation_name == 'hiddenLabel':
        hidden = Hidden()
        hidden.hiddenLabel = label
        hidden.concept = concept
        hidden.save()

    # todo:
    # find pk of concept else add concept if not yet there

    #if relation_name == 'broader':
    #if relation_name == 'narrower':
    #if relation_name == 'related':

    return redirect(concept)
예제 #2
0
def api(request):

    concept_id = request.GET["id"]

    relation_name = request.GET["relation"]
    label = request.GET["label"]

    concept = Concept.objects.get(pk=concept_id)

    if relation_name == 'altLabel':
        alternate = Alternate()
        alternate.altLabel = label
        alternate.concept = concept
        alternate.save()

    if relation_name == 'hiddenLabel':
        hidden = Hidden()
        hidden.hiddenLabel = label
        hidden.concept = concept
        hidden.save()

    # todo:
    # find pk of concept else add concept if not yet there

    #if relation_name == 'broader':
    #if relation_name == 'narrower':
    #if relation_name == 'related':

    # export to Open Semantic Entity Search API config
    export_entity(concept=concept)

    # tag all docs containing concept or one of its aliases
    tag_concept_and_message_stats(request=request, concept=concept)

    return redirect(concept)