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

How can i get the Fuseki API via SPARQLWrapper to properly report a detailed error message?

As outlined:in https://github.com/WolfgangFahl/DgraphAndWeaviateTest/blob/master/storage/sparql.py and https://github.com/WolfgangFahl/DgraphAndWeaviateTest/blob/master/tests/testSPARQL.py I tried to allow for a "round trip" operation between python…
Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
0
votes
2 answers

listOfDict to RDF conversion in python targeting Apache Jena Fuseki

To store some data in Apache Jena from python I'd like to have a generic conversion from a list of Dicts to RDF and possibly back on query. For the list of Dict to RDF part I tried implementing "insertListofDicts" (see below) and tested it with…
Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
0
votes
1 answer

QueryBadFormed using Uniprot SPARQL endpoint

I am coding a SPARQL query from Python using SPARQLWrapper. The endpoint is Uniprot, but 50% of time, Iget an error when executing the code : def getReviewProt(accession): #print(accession) mystring = '(uniprot:' + ')…
sparkles
  • 3
  • 1
0
votes
1 answer

How to find out all the skos:broader relations from DBpedia in order to build the concept hierarchy (tree) by using SPARQL query

As I am using this query text to find out those skos:broader related concepts of the keyword: England. select ?ChildNodes where { skos:broader ?ChildNodes } and I've got the result like…
BBQ
  • 23
  • 4
0
votes
1 answer

Extract all rdfs:type from a specific DBPedia entry

all. I'm trying to write a simple SPARQL query generator to fetch all rdf:type relations of a specific DBPedia resource. query = """SELECT * WHERE {{ <""" + resource """> rdfs:type ?subject.}}""" This yields the Query SELECT * WHERE {{…
Vid Stropnik
  • 182
  • 10
0
votes
1 answer

SPARQLWrapper : problem in querying an ontology in a local file

I'm working with SPARQLWrapper and I'm following the documentation. Here is my code: queryString = "SELECT * WHERE { ?s ?p ?o. }" sparql = SPARQLWrapper("http://example.org/sparql")# I replaced this line with sparql =…
kamel berkani
  • 57
  • 1
  • 6
0
votes
0 answers

Sparql query on Arabic DBpedia Ontology

I'm trying to make a query to get the predicate or the relation between 2 entities already exist in Arabic DBpedia... I'm trying to do that in Python using the SPARQL Endpoint interface to Python (SPARQLWrapper), so I set the Data Set Name, with the…
Islam Kh
  • 55
  • 6
0
votes
0 answers

How to simplify JSON result for SPARQL queries

I'm querying Wikidata using SPARQLWrapper. The JSON result I'm receiving has this structure: "title":{"xml:lang":"en","type":"literal","value":"natural language processing"} I would like to get a simple JSON result with only the 'value'…
kambi
  • 3,291
  • 10
  • 37
  • 58
0
votes
0 answers

How to traverse graph to graph in sparql query?

How should I write SPARQL query to get the details from node2: URI for node2 is the same in both the graphs and URI for node 1 is different. Thank you in advance. as such, I need the below details. node2 def hasID ghi hasvertex jkl hasLastname mno
Manoj Deshpande
  • 311
  • 2
  • 18
0
votes
2 answers

How to write Sparql query for the following result?

[![SPARQL Query Details][2]][2] How should I write SPARQL query to get the details from node2 : URI for node2 is same in both the graphs and URI for node 1 is different. Thank you in advance. as such, I need below details. node2 def hasID…
Manoj Deshpande
  • 311
  • 2
  • 18
0
votes
2 answers

How to get all inverse properties using SPARQL?

I need a SPARQL query to get all available inverse properties. exp (before, after, spouse, ... etc) i tried this, on specific domain (Person) : SELECT DISTINCT ?predicate WHERE { ?subject a dbo:Person . ?object a dbo:Person . ?subject…
fetahokey
  • 185
  • 2
  • 16
0
votes
0 answers

Why the results are different in Virtuoso SPARQL Query Editor and SPARQLWrapper?

My query in Virtuoso SPARQL Query Editor is as follows which resuted it 74 SELECT (COUNT (*) AS ?count) WHERE {?s ?p .} I used the same query in SPARQLWrapper as follows which gave me the count as…
EmJ
  • 4,398
  • 9
  • 44
  • 105
0
votes
0 answers

i want to get the names of similar types using sparql queries from dbpedia

I need to find the names of similar types from DBpedia so I'm trying to figure out a query which can return me the names of entities which have same subject type in its dct:subject (example I want to find similar types of white house so i want to…
Anuj tyagi
  • 11
  • 3
0
votes
0 answers

transaction time out in sparql query

select distinct ?label ?resource count(distinct ?type) as ?score where { values ?type {
Anuj tyagi
  • 11
  • 3
0
votes
1 answer

How to add special categories 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) my_category =…
EmJ
  • 4,398
  • 9
  • 44
  • 105