Questions tagged [sparqlwrapper]

SPARQL Wrapper is a SPARQL Endpoint interface to Python

SPARQLWrapper is a SPARQL Endpoint interface to Python

158 questions
1
vote
0 answers

constructing graph using rdflib for the outputs from sparql 'SELECT' query with sparqlWrapper

I am trying to construct a graph out of the results from SPARQL query. For the purpose of the query construction, I'm using SparqlWrapper and DBpedia as the knowledge base. from SPARQLWrapper import SPARQLWrapper, JSON from rdflib import Namespace,…
Betafish
  • 1,212
  • 3
  • 20
  • 45
1
vote
0 answers

SPARQLWrapper parse result set to QueryResult

I have a JSON object which is the result set of a SPARQL query. I would like to use it to create a QueryResult object in SPARQLWrapper. Is this possible?
D063520
  • 113
  • 6
1
vote
0 answers

wikidata SPARQL to get property:Label when using SAMPLE()

I'm having trouble getting the Label to pull through when using a DISTINCT and SAMPLE query. My query pulls companies and a sample of some basic attributes / properties. I would like to get the raw text label for ?state but no matter which way I…
BenP
  • 825
  • 1
  • 10
  • 30
1
vote
0 answers

How to add data in ontology using RDFlib and python

I am using rdflib, protege and python for creating ontology and accessing information from this ontology. so far so good as I can use SPARQL queries using rdflib under python to fetch the data. however now I need to insert the data such individuals…
Nhqazi
  • 732
  • 3
  • 12
  • 30
1
vote
0 answers

How to add a list as a parameter in sparql query in python

I am using SPARQLWrapper as follows to run my Wikidata query. from SPARQLWrapper import SPARQLWrapper, JSON import pandas as pd sparql = SPARQLWrapper("https://query.wikidata.org/sparql") sparql.setQuery(""" SELECT DISTINCT ?item { VALUES…
EmJ
  • 4,398
  • 9
  • 44
  • 105
1
vote
1 answer

Opening the connection and getting response takes too much time

I wrote a python script for querying this endpoint using SPARQL in order to get some information about genes. This is how the script works: Get genes Foreach gene: Get proteins Foreach proteins Get the protein function …
Bilal
  • 2,883
  • 5
  • 37
  • 60
1
vote
1 answer

how to resolve "urllib2.URLError: "

I found sample code at https://github.com/RDFLib/sparqlwrapper/blob/master/scripts/example.py which I modified slightly from SPARQLWrapper import SPARQLWrapper, JSON, XML, N3, RDF, CSV, TSV sparql =…
elbillaf
  • 1,952
  • 10
  • 37
  • 73
1
vote
1 answer

HTTP Error 500 in SPARQL Query

when I run a Python code of the form from SPARQLWrapper import SPARQLWrapper, JSON from urllib import request, error import time class SomeClass: ... def SomeFunction(self): EndPoint = …
lorenzo
  • 35
  • 1
  • 5
1
vote
1 answer

Executing sparql query from python to virtuoso server in linux?

I am having problem for running the following program (sparql_test.py). I am running it from Linux machine. I am installing Virtuoso server in the same Linux machine. In the Linux server, I don't have sudo permission nor browser access. But, I can…
1
vote
1 answer

Formatting Integer Values in SPARQL

I have a number of integer values in the object part of the RDF triples like following: subject predicate object :a1 :d1 2017 :a2 :d1 201601 :a3 :d1 20170510 I need to find whether subject :a1's object value is greater…
Beautiful Mind
  • 5,828
  • 4
  • 23
  • 42
1
vote
1 answer

SPARQL Transitive Query with Unique Predicates

I have a number of triples organized like following. :A :hasB :B :B :hasC :C :C :hasD :D :D :hasE :E ............ :X :hasY :Y :Y :hasZ :Z All the predicates are unique. I need to write two SPARQL queries. Query 1 will find all the predicates…
Beautiful Mind
  • 5,828
  • 4
  • 23
  • 42
1
vote
0 answers

Distance in linkedgeodata with sparql

I need to calculate distance between two points like this: Prefix rdfs: Prefix ogc: Prefix geom: Prefix lgdo:…
BADWOLF
  • 47
  • 9
1
vote
1 answer

SPARQLWrapper HTTP Error 401: Unauthorized

I secured my SPARQL endpoint via SQL Accounts according to VirtSPARQLProtectSQLDigestAuthentication. Before this operation, I can get the data through the code: from SPARQLWrapper import SPARQLWrapper, JSON, DIGEST sparql =…
YJ. Yang
  • 978
  • 2
  • 11
  • 19
1
vote
1 answer

Python code with SPARQL not working

I'm writing a python code to match the list of actors between DBPEDIA and WIKIDATA. First i'm retrieving the list of actors with some additional information such as birth date, birth place from Dbpedia using SPARQL and using the same list of actors…
karthick
  • 33
  • 4
1
vote
1 answer

How to search for rdfs:labels in dbpedia which are partial matches to a given term using SPARQL?

I am using this query to search for all labels that contains the word "Medi" select distinct ?label where { ?concept rdfs:label ?label filter contains(?label,"Medi") filter(langMatches(lang(?label),"en")) } However, as soon as I…