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,…
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?
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…
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…
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…
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
…
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 =…
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 = …
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…
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…
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…
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 =…
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…
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…