Questions tagged [sparqlwrapper]

SPARQL Wrapper is a SPARQL Endpoint interface to Python

SPARQLWrapper is a SPARQL Endpoint interface to Python

158 questions
0
votes
0 answers

QueryBadFormed: QueryBadFormed: SPARQLWrapper

I am trying to insert triples into blazegraph using below sparql query. for index, row in df_omim.iterrows(): omim = row['mim_number'] omim_label = row['preferred_title_symbol'] rel = row['skos_rel'] meddra = row['MDR_code'] …
rshar
  • 1,381
  • 10
  • 28
0
votes
1 answer

Malformed SPARQL query in python because of bad encoding of terms with "é" letter or spaces

I want to perform an insert query with python using sparqlwrapper. But when I perform my query, I get an error message telling me that my query is malformed. I suspect the error to be some special accent character in French. Here is what I did : db…
0
votes
1 answer

Different results between construct query in GraphDB workbench vs SPARQLWrapper

I am trying to download a number of named graphs from my GraphDB repository using the API. Simply put, I want to retrieve the entire content of a named graph, in a serialization of choice (Turtle and JSON-LD). My first approach is using a construct…
Robin
  • 135
  • 10
0
votes
0 answers

Insert triples in a graph using SPARQLWrapper

I am trying to insert triples in a graph using below SPARQL query: for s, p, o in g: id = s rel = p med = o queryString = """ PREFIX skos:
rshar
  • 1,381
  • 10
  • 28
0
votes
0 answers

How to remove & reason for pseudo duplicate entries in govdata.de SPARQL-Query

I have the following very simple query. The query can be testet at: https://www.govdata.de/web/guest/sparql-assistent After looking at the data I saw that there are pseudo duplicate entries which I don´t understand. PREFIX dcat:…
Matteo
  • 1
0
votes
0 answers

How to set credentials for federated query with SPARQLWrapper in Python? (i.e. 2nd SPARQL endpoint)

Python's SPARQLWrapper has setCredentials to specify credentials for SPARQL query, but it is meant for the current SPARQL endpoint. So, I wonder how to specify credentials for 2nd endpoint in the context of federated query, using SERVICE. I tried…
user7665853
  • 195
  • 1
  • 15
0
votes
0 answers

RuntimeWarning: unknown response content type 'text/html; charset=UTF-8' returning raw response

I am trying to fetch details using the SPARQLWrapper and JSON format from the dbpedia database. This is my code: from SPARQLWrapper import SPARQLWrapper, JSON sparql =…
0
votes
0 answers

Insert statement using sparql query not working

I am trying to insert the statement into graphdb using sparqlwrapper but it says query is badly formed, what am I doing wrong ?. I couln't able to figure it out from SPARQLWrapper import SPARQLWrapper, POST, DIGEST sparql =…
0
votes
0 answers

SPARQLWrapper query error with an f-string : QueryBadFormed

I am trying to lookup the names of Italian Senators in a public SPARQL endpoint. Starting sample data is the following set: longnames = ['Lars Danielsson', 'Giorgia Meloni', 'Ursula von der Leyen', 'Filippo Mannino', 'Matteo Piantedosi', 'Lamberto…
Robert Alexander
  • 875
  • 9
  • 24
0
votes
0 answers

SPARQL query limited results

I have this function: `def get_author_books(): sparql = SPARQLWrapper('https://dbpedia.org/sparql') sparql.setQuery(""" SELECT distinct ?s ?author WHERE{ ?s rdf:type dbo:Book . ?s rdfs:label ?bookLabel . …
0
votes
0 answers

How to read json file which have DBpedia labels stored in a list to extract the abstract for each label by using SPARQL in python

I have a json file in which I have stored upto 300 DBpedia labels in a list. now I want to make a SPARQL query in python in a way that all of the labels are read through that file and print the abstract for each specific label present in the file…
A.gul
  • 1
  • 3
0
votes
0 answers

SPARQL to Get the coordinates of any city using wikidata api

Hey in my Django project i have a list of Algerian cities in my database, i recently added the latitude and longitude fields to the city table, What i want to do is to use wikidata API to feed my database with the coordinates of each city i have in…
0
votes
0 answers

python - SPARQLWrapper QueryBadFormed

I am making queries to DBpedia to obtain and filter data, for this, I made the following script: from rdflib import Graph from SPARQLWrapper import SPARQLWrapper, JSON, N3 from pprint import pprint import pandas as pd import pyvis from…
XDarkestX
  • 1
  • 3
0
votes
0 answers

How to authenticate the sparql connectivity to fuseki

I am using fuseki 2.4 and have set a basic authentication in shiro.ini, sharing the contents of the current shiro.ini file below. Once after setting the credentials and restart fuseki service, when I try to make a connection to fuseki using direct…
Bhavya
  • 45
  • 5
0
votes
1 answer

How to insert a variable in a SPARQL query with triple-quotation (""") in SPARQLWrapper (Jupyter notebook)

Very simple question about inserting a varaible in a SPARQL query in the Wrapper library. Example below in a Jupyter notebook, I defined a variable 'q' outside SPARQL query, and would like to use it within a SPARQL query. I could not find out how to…