sparqlwrapper

How to get the movies which are based on english novels using SPARQL in DBPEDIA

a 夏天 提交于 2019-12-13 08:14:56
问题 Using SPARQL, I am trying the get the list of all english novels and their properties. I would also like to find if a movie was taken based on that novel and get the movie name and its director, If a movie relationship exists. Code: SELECT ?movie ?director ?book ?author ?publisher ?illustrator WHERE { ?movie dcterms:subject <http://dbpedia.org/resource/Category:films> ; dbpedia-owl:basedOn ?book . ?movie dbp:director ?director . ?book a dbpedia-owl:Book . ?book dbp:author ?author . ?book dbp

How to add special categories in sparqlwrapper in python

你离开我真会死。 提交于 2019-12-13 04:28:16
问题 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 = 'dbc:Meteorological_concepts' sparql.setQuery(f" ASK {{ {my_category} skos:broader{{1,3}} dbc:Medicine }} ") results = sparql.query().convert() print(results['boolean']) As mentioned above it works fine with categories that do not have brackets (e.g., dbc:Meteorological_concepts )

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

社会主义新天地 提交于 2019-12-13 03:51:59
问题 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 ?searchTerm { "word2vec" "fasttext" "natural language processing" "deep learning" "support vector machine" } SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "EntitySearch". bd:serviceParam wikibase:endpoint "www.wikidata.org". bd:serviceParam wikibase

Sparql Insert Exception : SPARQLWrapper.SPARQLExceptions.QueryBadFormed

房东的猫 提交于 2019-12-11 22:07:46
问题 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 python SparqlWrapper it throws the below error: SPARQLWrapper.SPARQLExceptions.QueryBadFormed: QueryBadFormed: a bad request has been sent to the endpoint, probably the sparql query is bad formed. I feel there is something wrong at configuration end,

SPARQLWrapper HTTP Error 401: Unauthorized

旧巷老猫 提交于 2019-12-11 09:44:14
问题 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 = SPARQLWrapper("http://example.org/sparql") sparql.setQuery("...") sparql.setReturnFormat(JSON) results = sparql.query().convert() And after that, I use the DIGEST way to get the data, from SPARQLWrapper import SPARQLWrapper, JSON, DIGEST sparql = SPARQLWrapper("http:/

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

江枫思渺然 提交于 2019-12-11 04:31:35
问题 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 on inference, and got the same results through the Stardog query panel without inference and through SPARQLwrapper. So I suspect reasoning is not being applied when I query through python, and that this is why there's no results. So my question is

Sparql endpoint for SAIL object

限于喜欢 提交于 2019-12-07 22:09:12
问题 I have created a SAIL object using tinkerpop blueprints to load RDF data into a Graph database. Ive successfully managed to load the data. The Graph database in question does not have a sparql endpoint to run my query mix test driver. Does anyone know if it possible and if so then how to make a sparql endpoint accessible to my test driver java code over an HTTP server? I am aware 4store, BigData and some other stores have their own built in sparql servers for querying. I am wondering if it is