def execute(token):
        triplestore_host = configmanager.get_config("triplestore_host", 'localhost')
        endpoint = "http://{0}:3020/sparql/update".format(triplestore_host)

        # initialize sparql endpoint
        sparql = SPARQLWrapper(endpoint)

        # prepare sparql update
        sparql.setQuery(token.message.get_body())
        sparql.method = 'POST'
        sparql.returnFormat = 'rdf+xml'

        # return result un-altered
        result = sparql.query().convert()
        token.result = result.toxml()
예제 #2
0
from os import environ
from celery import Celery
from utilities import configmanager

taskqueue_host = configmanager.get_config("taskqueue_host", 'localhost')

celery = Celery('tasks', broker='redis://{0}'.format(taskqueue_host))
celery.conf.CELERY_RESULT_BACKEND = environ.get('CELERY_RESULT_BACKEND', 'redis://{0}'.format(taskqueue_host))
celery.conf.CELERY_EVENT_SERIALIZER = 'pickle'
celery.conf.CELERY_RESULT_SERIALIZER = 'pickle'
celery.conf.CELERY_TASK_SERIALIZER = 'pickle'

from processing.tasks import *