Beispiel #1
0
def github_tpf_server(request):
    tpq = TriplePatternQuery(request.GET.get('page', '1'),
                             request.GET.get('subject'),
                             request.GET.get('predicate'),
                             request.GET.get('object'))
    fragment = Fragment()
    Odmtp(TrimmerXr2rmlGithub(), Tp2QueryGithub(),
          MapperGithubXr2rml()).match(tpq, fragment, request)
    response = HttpResponse(fragment.serialize(),
                            content_type='application/trig; charset=utf-8')
    response['Content-Disposition'] = 'attachment; filename="fragment.trig"'
    response['Access-Control-Allow-Origin'] = '*'
    return response
Beispiel #2
0
def extended_twitter_tpf_server(request):
    tpq = TriplePatternQuery(request.GET.get('page', '1'),
                             request.GET.get('subject'),
                             request.GET.get('predicate'),
                             request.GET.get('object'))
    fragment = Fragment()
    odmtp = request.session.get('extended_odmtp_twitter')
    if not odmtp:
        odmtp = Odmtp(TrimmerXr2rmlTwitter(True), Tp2QueryTwitter(),
                      MapperTwitterXr2rml())
        request.session['extended_odmtp_twitter'] = odmtp
    odmtp.match(tpq, fragment, request, extended=True)
    response = HttpResponse(fragment.serialize(),
                            content_type='application/trig; charset=utf-8')
    response[
        'Content-Disposition'] = 'attachment; filename="twitter_tpf_fragment.trig"'
    response['Access-Control-Allow-Origin'] = '*'
    response['Access-Control-Allow-Headers'] = 'Accept-Datetime,Accept'
    return response
Beispiel #3
0
def extended_linkedin_tpf_server(request):
    tpq = TriplePatternQuery(request.GET.get('page', '1'),
                             request.GET.get('subject'),
                             request.GET.get('predicate'),
                             request.GET.get('object'))
    fragment = Fragment()
    try:
        odmtp = request.session.get('extended_odmtp_linkedin')
        if not odmtp:
            odmtp = Odmtp(TrimmerXr2rmllinkedin(True), Tp2QueryLinkedin(),
                          MapperlinkedinXr2rml())
            request.session['extended_odmtp_linkedin'] = odmtp
        odmtp.match(tpq, fragment, request, extended=True)
        response = HttpResponse(fragment.serialize(),
                                content_type='application/trig; charset=utf-8')
        response[
            'Content-Disposition'] = 'attachment; filename="linkedin_tpf_fragment.trig"'
    except ValueError:
        response = HttpResponse(
            "You need to be authenticated first. Go to linkedin/authentification/"
        )
    response['Access-Control-Allow-Origin'] = '*'
    response['Access-Control-Allow-Headers'] = 'Accept-Datetime,Accept'
    return response