Questions tagged [sparqlwrapper]

SPARQL Wrapper is a SPARQL Endpoint interface to Python

SPARQLWrapper is a SPARQL Endpoint interface to Python

158 questions
10
votes
1 answer

How to query Wikidata for "also known as"

I would like to know how to query Wikidata by using the alias ("also known as"). Right now I am trying SELECT ?item WHERE { ?item rdfs:aliases ?alias. FILTER(CONTAINS(?alias, "Angela Kasner"@en)) } LIMIT 5 This is simply a query that works if I…
Junge
  • 437
  • 6
  • 14
8
votes
1 answer

How to get property labels from Wikidata using SPARQL

I am using SPARQLWrapper to send SPARQL queries to Wikidata. At the moment I am trying to find all properties for an entity. Eg. with a simple tuple such as: wd:Q11663 ?a ?b. This in itself works, but I am trying to find human readable labels for…
winwaed
  • 7,645
  • 6
  • 36
  • 81
7
votes
2 answers

INSERT/DELETE/UPDATE query using SPARQLWrapper

Although I have gone through lot of examples on the web explaining the use of python SPARQLWrapper using SELECT statements for fetching data from sesame triple store, but not sure how can we INSERT/DELETE/UPDATE statements in sesame using it. Can…
imran
  • 199
  • 3
  • 11
4
votes
3 answers

How to create a parameterised query in SPARQLWrapper in python

I am using the following sparql query using SPARQLWrapper as follows. from SPARQLWrapper import SPARQLWrapper, JSON sparql = SPARQLWrapper("http://live.dbpedia.org/sparql") sparql.setReturnFormat(JSON) sparql.setQuery(" ASK {…
EmJ
  • 4,398
  • 9
  • 44
  • 105
4
votes
1 answer

Can't get INSERT to work in SPARQLWrapper

I've been trying to get SPARQLWrapper to insert a simple triple into GraphDB with no success. I have no trouble with select queries. Here's Python test code that fails: db = sparqlw.SPARQLWrapper(endpoint) query = ''' INSERT…
4
votes
2 answers

ValueError: Invalid \escape while running query

I am trying to query DBpedia using SPARQLWrapper in Python (v3.3). This is my query: PREFIX rdfs: SELECT ?slot WHERE { ?slot } It…
Ankit Solanki
  • 670
  • 2
  • 9
  • 23
3
votes
1 answer

Retrieve Wikidata ID candidates based on a partial name match

I have some entities in a specific language and I am trying to retrieve the possible IDs from Wikidata that match those names. For example, I have some German name, let's say "Ministerium für Auswärtige Angelegenheiten" and I can get the top N…
Porjaz
  • 771
  • 1
  • 8
  • 28
3
votes
1 answer

SPARQLWrapper QueryBadFormed error for long SELECT query

Is there a limit on the size of the query you can use with with a SELECT query? I have a long SELECT query (posted below) that keeps throwing a QueryBadFormed error. I have validated the query on sparql.org and I have ran the query on the triple…
Bill
  • 179
  • 8
3
votes
0 answers

10000 row DBpedia Query result set size limit

This is my first time playing with SPARQL. I have created a query below but only getting the first 10000 results. How can I get all results from DBpedia? from SPARQLWrapper import SPARQLWrapper, JSON sparql =…
joe borg
  • 133
  • 1
  • 1
  • 7
3
votes
1 answer

Virtuoso Large RDF Graph Removal Difficulty

I am using Virtuoso. It is installed on a server machine. I am trying to remove a large RDF graph from my Virtuoso. It contains 2,590,994,053 triples. I was trying to delete the graph with the following command. SPARQL DROP SILENT GRAPH…
Beautiful Mind
  • 5,828
  • 4
  • 23
  • 42
3
votes
1 answer

SPARQL CONCAT() and STR() with CONSTRUCT

I am creating an RDF graph by using SPARQL CONSTRUCT statement. Following is my query: prefix map: <#> prefix db: <> prefix vocab: prefix rdf: prefix rdfs:…
Beautiful Mind
  • 5,828
  • 4
  • 23
  • 42
3
votes
4 answers

Python : SpaqrlWrapper, Timeout?

I am new to python as well as new to the world of querying the semantic web. I am using SPARQLWrapper library to query dbpedia, I searched the library documentation but failed to find 'timeout' for a query fired to dbpedia from…
Ankit Solanki
  • 670
  • 2
  • 9
  • 23
2
votes
2 answers

How to add external variables to a SPARQL query?

I have the following codes: name = [str(s) for s, in graph.query(''' SELECT ?lbl WHERE { ?obj . ?obj rdfs:label ?lbl . } …
2
votes
1 answer

Read Turtle file and query the graph using SPARQL

I am in a learning phase of SPARQL so excuse if the question sounds basic. I am exploring SPARQLWrapper to connect to a SPARQL endpoint to fetch some data. Below is the query. sparql = SPARQLWrapper("http://patho.phenomebrowser.net/sparql/")…
rshar
  • 1,381
  • 10
  • 28
2
votes
2 answers

How can we use a python string variable in a SPARQL query?

I want to use python string variables in my SPARQL query without an IRI (for the sake of looping through a list of variables etc. I tried the code below but it doesn't seem to work. Please ignore the prefixes etc. I just changed them for the sake of…
shrimpini
  • 41
  • 3
1
2 3
10 11