dbpedia

Writing SPARQL queries with Jena to query for IRIs like: http://pt.dbpedia.org/

我是研究僧i 提交于 2019-12-02 12:16:14
I'm using Jena to write a SPARQL query to get the rdfs:label property from a URI received as a method parameter. That method only receives URIs like: http://pt.dbpedia.org/.. It should return me the rdfs:label , but it doesn't return me anything. I checked and it doesn't enter the while block supposed to iterate the results. I even made a test with the URI: <http://pt.dbpedia.org/resource/Brasil> , but it didn't work. What may be the problem? public String getLabel(String uri, String label) { Model model = ModelFactory.createDefaultModel().read( uri ); RDFNode node; String queryString =

How to check prefix of variables in SPARQL?

☆樱花仙子☆ 提交于 2019-12-02 09:43:48
问题 I want to find how many resource is there in an RDF but I can't find any tutorial to explain how can I check the prefix of variables in my SPARQL. I have tried this: select count(?x) where { res:?x ?p ?v } but it has syntax error. I am using virtuoso for DBPedia 回答1: You can use strstarts(string,prefix) to check whether string begins with prefix . You can use the str function to get the string representation of a IRI, including IRIs generated from prefixes. E.g., if you have prefix ex: <http:

Querying Dbpedia by DBO - SPARQL

こ雲淡風輕ζ 提交于 2019-12-02 08:21:10
I am trying to extract the manufacturer section of this dbpedia page http://dbpedia.org/page/Diageo . However my SPARQL query returns nothing. Yet I can return most other values on the page, such as keyPersons which has the exact same layout. PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> SELECT ?label WHERE { <http://dbpedia.org/resource/Diageo> dbpedia-owl:keyPerson ?label } PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> SELECT ?label WHERE { <http://dbpedia.org/resource/Diageo> dbpedia-owl:manufacturer ?label } Any ideas? In DBpedia, an entity page displays statements in which an

I am trying to get list of all the authors who have had more than 3 piece of work - DBpedia Sparql

家住魔仙堡 提交于 2019-12-02 07:13:40
问题 I am trying to get list of all the authors who have had 3 or more piece of work done (in DBpedia). my example can be run on : http://dbpedia.org/sparql base code select (count(?work) as ?totalWork), ?author Where { ?work dbo:author ?author. } GROUP BY ?author I get each authors total amount of piece of work done. But when I try to filter to show only list of author that have more than 3 piece of work. I get error: I tried HAVING keyword or using FILTER keyword. Using Filter select (count(

How to check prefix of variables in SPARQL?

若如初见. 提交于 2019-12-02 06:18:38
I want to find how many resource is there in an RDF but I can't find any tutorial to explain how can I check the prefix of variables in my SPARQL. I have tried this: select count(?x) where { res:?x ?p ?v } but it has syntax error. I am using virtuoso for DBPedia You can use strstarts(string,prefix) to check whether string begins with prefix . You can use the str function to get the string representation of a IRI, including IRIs generated from prefixes. E.g., if you have prefix ex: <http://example.org/> , then ex: by itself is a legal IRI, and str(ex:) produces "http://example.org/" . That

sparql queries with round brackets throw exception

℡╲_俬逩灬. 提交于 2019-12-01 17:38:17
I am trying to extract labels from DBpedia for some persons. I am partially successful now, but I got stuck in the following problem. The following code works. public class DbPediaQueryExtractor { public static void main(String [] args) { String entity = "Aharon_Barak"; String queryString ="PREFIX dbres: <http://dbpedia.org/resource/> SELECT * WHERE {dbres:"+ entity+ "<http://www.w3.org/2000/01/rdf-schema#label> ?o FILTER (langMatches(lang(?o),\"en\"))}"; //String queryString="select * where { ?instance <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>; <http

Fetching a list of books adapted into films from dbpedia

送分小仙女□ 提交于 2019-12-01 14:44:42
I am trying to fetch a list of American movies adapted from books from dbpedia. This is what I have so far: PREFIX onto: <http://dbpedia.org/ontology/> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT * WHERE { ?movie dcterms:subject <http://dbpedia.org/resource/Category:American_films> . ?movie dcterms:subject <http://dbpedia.org/resource/Category:Films_based_on_novels> . ?movie onto:basedOn ?book . ?book a onto:Book . } I get only 4 results back. Is there another property I can use to get more results? First thing, try removing the second line of your pattern -- ?movie dcterms:subject

SPARQL query help needed for DBpedia all programming language details

独自空忆成欢 提交于 2019-12-01 14:23:16
This is the query I am running to get these details of All programming languages.Every programming language has some influenced other languages or influenced by other language. So there may be many languages in influenced or influenced by. Now the prob is when it is printing all the values of it prints every values separately in rows. You can look into the picture. I want all its influenced or influencedBy programming languages in a single row. Query is below. SELECT ?pl ?abstract ?influenced ?influencedBy WHERE { ?pl dbo:abstract ?abstract . ?pl dbo:influenced ?influenced . ?pl dbo

SPARQL query help needed for DBpedia all programming language details

瘦欲@ 提交于 2019-12-01 13:18:04
问题 This is the query I am running to get these details of All programming languages.Every programming language has some influenced other languages or influenced by other language. So there may be many languages in influenced or influenced by. Now the prob is when it is printing all the values of it prints every values separately in rows. You can look into the picture. I want all its influenced or influencedBy programming languages in a single row. Query is below. SELECT ?pl ?abstract ?influenced

How to form dbPedia iSPARQL query (for wikipedia content)

最后都变了- 提交于 2019-12-01 13:02:39
Say I need to fetch content from wikipedia about all mountains. My target is to show initial paragraph, and an image from respective article (eg. Monte Rosa and Vincent Pyramid . I came to know about dbpedia, and with some research got to find that it provides live queries into wiki database directly. I have 2 questions: 1 - I am finding it difficult how could I formulate my queries. I can't play around iSPARQL . I tried following query but it throws error saying invalid xml. SELECT DISTINCT ?Mountain FROM <http://dbpedia.org> WHERE { [] rdf:type ?Mountain } 2 - My requirement is to show only