Questions tagged [sparqlwrapper]

SPARQL Wrapper is a SPARQL Endpoint interface to Python

SPARQLWrapper is a SPARQL Endpoint interface to Python

158 questions
1
vote
2 answers

How can I tell Stardog to use inference when querying it through SPARQLwrapper?

I have a SPARQL query that returns results in the Stardog query panel when inference is enabled, but not when it's disabled. When I try the query through python with SPARQLwrapper, I get no results. I tried with a different query, which doesn't rely…
1
vote
0 answers

How can I properly serialize wikidata SPARQL queries answers?

I have the following example of querying wikidata via Python's SPARQLWrapper: import rdflib, urllib from SPARQLWrapper import SPARQLWrapper, JSON, XML, TURTLE, RDF, N3 from rdflib import Graph, Namespace, URIRef, RDF#, RDFS, Literal def…
paxRoman
  • 2,064
  • 3
  • 19
  • 32
1
vote
2 answers

Use same URL for both query and update

I know that by default fuseki provides different urls for both query and update, allowing some elegant management. Now, i want to get a single URL for both update and query. The rationale behind this need is to avoid the propagation of two urls in…
aluriak
  • 5,559
  • 2
  • 26
  • 39
1
vote
1 answer

Virtuoso ISQL Result Dump Format

I am running following query on Virtuoso isql. SPARQL CONSTRUCT { ?infectee ?getInfectedBy ?infector } FROM WHERE { ?s
Beautiful Mind
  • 5,828
  • 4
  • 23
  • 42
1
vote
1 answer

SPARQL zick-zack pattern query

I have an SPARQL query that mimics a zick-zack pattern like following. ?p1 :infector ?p. ?p2 :infector ?p1. ?p3 :infector ?p2. ?p4 :infector ?p3. ?p5 :infector ?p4 ................. Basically, in the pattern subject of one triple using as an object…
Beautiful Mind
  • 5,828
  • 4
  • 23
  • 42
1
vote
1 answer

How to auto increment a variable in sparql?

I want to crawl 100 pages of wikipedia , so I want to increment the wikiPageID by 1, each time. How can i do it? PREFIX rdfs: SELECT * WHERE { ?saket dbo:wikiPageID 57570. ?saket foaf:isPrimaryTopicOf…
MachoMan
  • 63
  • 1
  • 8
1
vote
0 answers

How to Extract text from Wikipedia Article using sparql in json format?

I want to extract some text of Wikipedia as JSON, using SPARQL. The following query retrieves the text, but in HTML format. How can I get the JSON output? # -*- coding: utf-8 -*- from SPARQLWrapper import SPARQLWrapper, JSON from pprint import…
Nitin
  • 11
  • 3
1
vote
1 answer

sparql query: URL as a parameter, using with Python and Sesame-Workbench

I am trying to send a URL as a parameter to the sesame workbench, using sparql. How can I do that? More specifically, A working sample from my code is; p="OSPF" queryString = (""" PREFIX rdf: PREFIX…
Aravind
  • 15
  • 4
1
vote
1 answer

SPARQL: How to combine two subjects to use in CONSTRUCT?

I am writing an SPARQL query where I am creating an RDF graph. I am using SPARQL CONSTRUCT. As a requirement of my work, I have to concatenate two subject values and used it with CONSTRUCT statement. I have tried to do following (my RDF graph is in…
Beautiful Mind
  • 5,828
  • 4
  • 23
  • 42
1
vote
0 answers

sparql with python - INSERT triple with apostrophe

I'm having some trouble on execute a sparql update. As the title say the problem is the apostrophe in the 2nd triple of the query. This is the error: Response: Error 400: Lexical error at line 20,column 229. Encountered " " (32) after: "s" Here is…
1
vote
1 answer

SUM function in SPARQL

This SUM aggregate function is not working. It gives no result. select (SUM(?p) as ?prcc) ?sune where { ?inl Sp:hasp ?p. ?inl Sp:hassuid ?supid. ?supid Sp:hassune ?sune. } GROUP BY ?sune The data in "p" is in double format. So when i…
Rashmi Dubey
  • 11
  • 1
  • 2
1
vote
2 answers

SPARQL combine - concatenate two columns into one

I'm a newbie to SPARQL, and I would like to combine two columns into one initial table a|b|1 c|d|2 wanted table a|b c|d b|1 d|2 its like creating two different tables and putting them one on the other. I need that to make a visualisation using…
Oussama L.
  • 1,842
  • 6
  • 25
  • 31
1
vote
2 answers

INSERT DATA to Fuseki via Python SPARQLWrapper

I am developing an application which uses a common Fuseki dataset with other developers. A Javascript function calls AJAX (jQuery $.ajax()) and sends to the Python script three variables via POST request. Javascript: $.ajax({ url:…
TheOldMe
  • 21
  • 1
  • 6
1
vote
2 answers

Sparql Insert Exception : SPARQLWrapper.SPARQLExceptions.QueryBadFormed

I have been having this weird issue, I am trying to insert into a virtuoso graph using SPARQLWrapper library in python. I am able to insert a triple via the browser based endpoint at localhost:8890\sparql , but when I try the same query via my…
Ankit Solanki
  • 670
  • 2
  • 9
  • 23
1
vote
1 answer

Asking federated SPARQL queries with SPARQLWrapper

How can we ask federated queries using SPARQLWrapper? If it is not possible, is there any alternate library available for making such queries for Python?
imran
  • 199
  • 3
  • 11