dbpedia

sparql queries with round brackets throw exception

别来无恙 提交于 2019-12-04 03:20:41
问题 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

Counting in SPARQL

∥☆過路亽.° 提交于 2019-12-04 02:04:14
Ok so i have this query PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT (COUNT(?instance) AS ?count) WHERE { ?instance a <http://dbpedia.org/ontology/Ambassador> . } and the result is 286. Cool. Now I want to get the number of ambassadors that have http://dbpedia.org/property/name property. But PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT (COUNT(?instance) AS ?count) WHERE { ?instance a <http://dbpedia.org/ontology/Ambassador> . ?instance <http://dbpedia.org/property/name> ?name } results in 533 :(. So it is counting more because there are people

How get DBpedia data in a specific language?

跟風遠走 提交于 2019-12-03 19:57:34
问题 i tried this request http://lookup.dbpedia.org/api/search.asmx/KeywordSearch?QueryClass=film&QueryString=transformers&MaxHits=1 but if i want to retrieve info in italian language? it there another service (similar this) that can? 回答1: You could use dbpedia SPARQL endpoint to run query. For example: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?film ?description ?film_name WHERE {

How to setup neo4j with dBpedia ontop of ruby-on-rails application?

心已入冬 提交于 2019-12-03 06:21:40
I am trying to use dBpedia with neo4j ontop of ruby on rails . Assuming I have installed neo4j and downloaded one of the dBpedia datasets . How do I import the dbpedia dataset into neo4j ? espeed The simplest way to load dbpedia into Neo4j is to use the dbpedia4neo library. This is a Java library, but you don't need to know any Java because all you need to do is run the executable. You could rewrite this in JRuby if you want, but regular Ruby won't work because it relies on Blueprints , a Java library with no Ruby equivalent. Here are the two key files, which provide the loading procedure.

Querying DBpedia with SPARQL and Jena

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 05:17:36
问题 I cannot understand how can I query DBpedia using Jena. In the tutorials like here(Listing 4) model is initialized as follows: // Open the bloggers RDF graph from the filesystem InputStream in = new FileInputStream(new File("bloggers.rdf")); // Create an empty in-memory model and populate it from the graph Model model = ModelFactory.createMemModelMaker().createModel(); model.read(in,null); // null base URI, since model URIs are absolute in.close(); Let's say I want to write a query that will

Extract date/time based predicates from DBPedia

佐手、 提交于 2019-12-02 20:48:01
问题 I want to extract all statements from DBPedia's dump file. Is it possible to write a sparql query to extract the list of predicates which contains the date values (like releaseDate, deathDate, birthDate,...)? 回答1: You can write a SPARQL query (you tagged with SPARQL, so presumably that's how you want to query for these things) that finds these kind of properties. All you need to do is query for things which are owl:DatatypeProperties (since dates should be literals), and then filter based on

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

我与影子孤独终老i 提交于 2019-12-02 17:59:24
问题 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) {

dotnetrdf xml exception using QueryWithResultSet

余生颓废 提交于 2019-12-02 17:04:16
问题 I have an asp.net project in which, I would like to query DBPedia. Using the following code I am getting an error: public string testEndpoint() { //TEST02 SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri("http://dbpedia.org/sparql"), "http://dbpedia.org"); string res = ""; //Make a SELECT query against the Endpoint SparqlResultSet results = endpoint.QueryWithResultSet("SELECT ?year WHERE {dbpedia:Rihanna dbpedia-owl:birthYear ?year}"); foreach (SparqlResult result in results)

Querying Dbpedia by DBO - SPARQL

偶尔善良 提交于 2019-12-02 15:36:00
问题 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>

HttpException error when I call SPARQL query (on DBPedia) in Java Code

安稳与你 提交于 2019-12-02 13:21:38
I have a problem with SPARQL endpoint using Java Code. In particular, I have this Java Class: public class example { public static void main(String[] args) { String value = "http://dbpedia.org/resource/Fred_Guy"; example exam = example(); QueryExecution qe = exam.query(value); ResultSet results = ResultSetFactory.copyResults( qe.execSelect() ); } public QueryExecution query(String stringa){ ParameterizedSparqlString qs = new ParameterizedSparqlString( "" + "prefix dbpediaont: <http://dbpedia.org/ontology/>\n" + "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + "\n" + "select