开发者

SPARQL query for DBPedia + CIA Factbook +data GOV

I have 开发者_运维技巧below 2 queries. The first query retrieves the literacy rate from CIA Factbook endpoint available at http://www4.wiwiss.fu-berlin.de/factbook/sparql. The second query is for the data gov endpoint available at http://data-gov.tw.rpi.edu/sparql.

PREFIX ns: <http://www4.wiwiss.fu-berlin.de/factbook/ns#>
SELECT ?country ?literacy_male WHERE {
?s ns:literacy_male ?literacy_male.
?s ns:name ?country.FILTER regex(?country, "", "i")}

PREFIX dgp32: <http://data-gov.tw.rpi.edu/vocab/p/32/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
SELECT ?magnitude ?region WHERE { GRAPH <http://data-gov.tw.rpi.edu/raw/33/data-33.rdf> 
{
?entry dgp32:magnitude ?magnitude .
?entry dgp32:region ?region.
filter (  xsd:float(?magnitude) > 5 )}}

I want to be able to retrieve the URL of each of the country's Wikipedia page retrieved from running each of these queries.How can i combine each query separately to a DBpedia query to retrieve Wikipedia page URL.I am unable to formulate a query

Can someone please help me


Definitely the SPARQL constructor SERVICE would be appropriate if the datasets that you try to join are somehow connected. This seems to not be the case.

Earthquake information from the RPI SPARQL endpoint refers only to US regions or US States. See the result of the following query:

PREFIX dgp32: <http://data-gov.tw.rpi.edu/vocab/p/32/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
SELECT DISTINCT ?region WHERE {
?entry dgp32:magnitude ?magnitude .
?entry dgp32:region ?region.
}

(results here)

Moreover, a SPARQL DESCRIBE on regions doesn't give you a link to a CIA FactBook URI (see here).

So I am afraid that you are trying to run a join for two datasets that:

  1. Are not linked together.
  2. Have geographical representation at different levels.

Answer to your comment

For getting literacy rates (CIA Factobook) and Countries' Wikipedia page (Dbpdia) you can use OpenLinkSw lod cache and the following query:

PREFIX ns: <http://www4.wiwiss.fu-berlin.de/factbook/ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbpedia: <http://dbpedia.org/ontology/>
SELECT DISTINCT ?s ?x ?wikiPage ?literacy_male WHERE {
    ?s ns:literacy_male ?literacy_male.
    ?x a dbpedia:Country .
    ?x owl:sameAs ?s .
    ?x foaf:page ?wikiPage . 
}

results here

Bear in mind that you can do the same by using http://sameAs.org. First run a query on CIA Factbook enpoint, second fetch the sameAs bundles from sameAs.org and; third, resolve those in order to get the foaf:page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜