Query for banks in DBpedia

255 views Asked by At

Using http://dbpedia.org/sparql, I want to receive the geographic coordinates of all bank buildings. The list of classes tells me that I should query for Bank.

Yet, the following code yields nothing:

SELECT DISTINCT ?label ?lat ?long
WHERE {
[]
 rdf:type dbpedia-owl:Bank ;
 geo:lat ?lat ;
 geo:long ?long ;
 rdfs:label ?label.
      FILTER (LANGMATCHES(LANG(?label), 'en')) 
}

If instead I query for any sibling to Bank, (e.g. Brewery or LawFirm), I see at least some results. What's wrong with above code?

1

There are 1 answers

6
Artemis On BEST ANSWER

If you look into a dbpedia page for a bank, you can see that instead on rdf:type, banks have a property dbpedia-owl:industry that has dbpedia:Bank (Refah bank) or dbpedia:Financial_services (Cyprus bank) as a value. So if you rewrite your query as the following, you will get some results:

SELECT DISTINCT ?label ?lat ?long
WHERE {
    [] dbpedia-owl:industry dbpedia:Bank ;
    geo:lat ?lat ;
    geo:long ?long ;
    rdfs:label ?label.
    FILTER (LANGMATCHES(LANG(?label), 'en')) 
}

If you add dbpedia:Financial_services, other organisations such as London stock exchange will also appear:

SELECT DISTINCT ?bank
WHERE {
    ?bank dbpedia-owl:industry ?place ;
    geo:lat ?lat ;
    geo:long ?long ;
    rdfs:label ?label.
    FILTER (?place in (dbpedia:Financial_services, dbpedia:Bank) &&
    LANGMATCHES(LANG(?label), 'en')) 
}

Again, by examining the London stock exchange, you can see that there is a product property that separates these financial institutions. So this will give you banks, but it might not cover all the banks available:

SELECT DISTINCT ?label ?lat ?long
WHERE {
    [] dbpedia-owl:industry ?place ;
    geo:lat ?lat ;
    geo:long ?long ;
    rdfs:label ?label;
    dbpedia-owl:product ?product.
    FILTER ( ?place in (dbpedia:Financial_services, dbpedia:Bank) 
    && ?product in (dbpedia:Bank, dbpedia:Private_banking, dbpedia:Professional_Banking, dbpedia:Retail_banking, dbpedia:Investment_banking, dbpedia:Commercial_bank)
    && LANGMATCHES(LANG(?label), "en")) 
} ORDER BY DESC(COUNT(DISTINCT ?product))