Hi Guys. I cannot understand how can I query dbpedia.org 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 list churches in Paris. In SPARQL language it will look like:
PREFIX p: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/resource/>
PREFIX category: <http://dbpedia.org/resource/Category:>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.georss.org/georss/>
SELECT DISTINCT ?m ?n ?p ?d
WHERE {
?m rdfs:label ?n.
?m skos:subject ?c.
?c skos:broader category:Churches_in_Paris.
?m p:abstract ?d.
?m geo:point ?p
FILTER ( lang(?n) = "fr" )
FILTER ( lang(?d) = "fr" )
}
source is here.
How this query will look in Java. Particularly I'm interested how model object is initialization.
Thanks in advance.