-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Aleksandr Perevalov edited this page May 10, 2022
·
1 revision
Welcome to the qanary_helpers
wiki! Here are some useful guides related to the library
qanary_queries
has 3 methods that are intended to be called by a user of the library:
-
get_text_question_in_graph
-- fetches the text of the question that was asked by a user and its URI from a triplestore; -
select_from_triplestore
-- wraps the functionality related to execution of theSELECT
SPARQL queries on a triplestore; -
insert_into_triplestore
-- wraps the functionality related to execution of theINSERT
SPARQL queries on a triplestore.
# Get question text. `question_text` will be something like "Where was Angela Merkel born?"
question_text = get_text_question_in_graph(triplestore_endpoint_url, triplestore_ingraph_uuid)[0]['text']
# Get question URI. `question_uri` will be something like "http://demos.swe.htwk-leipzig.de:40111/question/stored-question__text_46128b0a-f17b-4d95-a705-623ecd47444f"
question_uri = get_text_question_in_graph(triplestore_endpoint_url, triplestore_ingraph_uuid)[0]['uri']
# Execute a SPARQL SELECT query on the given triplestore
sparql_result = select_from_triplestore(triplestore_endpoint_url, sparql_query)
# Execute a SPARQL INSERT query on the given triplestore
execution_result = insert_into_triplestore(triplestore_endpoint_url, sparql_query)