On 12/13/11 5:22 PM, Liam Kirsher wrote:
Mohamed,

Thanks again! I ran that query, but unfortunately it timed out. Meanwhile, I just ran the previous query you sent for the different country/language combinations. Apparently, that will be satisfactory. However, there was one thing that perhaps you or someone else on this list might be able to shed some light on. The numbers of Articles about France seem unusually large in comparison to other countries for all languages except German. Since the request was identical for all combinations, I'm really wondering what could explain it. The pattern is especially suspicious for Articles in Spanish.

Anyone have an explanation for why there would be so many articles about France, or is their something wrong with the SPARQL request used to retrieve the data?

*Language / Country* *German* *French* *Italian* *English* *Dutch* *Spanish* *Total Per Country*
*Germany*       13,816  7,909   10,378  13,809  12,982  1,312   *60,206 *
*France*        8,504   37,232  36,903  37,324  36,888  36,802  *193,653 *
*Italy*         5,736   8,268   8,721   8,800   8,316   8,259   *48,100 *
*United Kingdom*        1,851   1,836   2,020   24,086  11,319  709     *41,821 
*
*Netherlands / Belgium* 1,458 3,179 1,142 4,031 3,993 469 *14,272 *
*Spain*         1,173   3,318   5,586   6,295   3,330   6,170   *25,872 *
*Total Per Language* *32,538 * *61,742 * *64,750 * *94,345 * *76,828 * *53,721 * *383,924 *


This is the SPARQL query I used for the various country/language parameters:
sparql.setQuery("""
    select  count(?place)
    where { ?place ?p ?region.
?place a <http://dbpedia.org/ontology/Place>. filter(?p = <http://dbpedia.org/ontology/country> && ?region = <http://dbpedia.org/resource/%s>) .
    ?place rdfs:label ?placeName. filter(
        langMatches( lang(?placeName), "%s"))
     }
    """ % (country, language))

Please repeat using the SPARQL endpoint at: http://lod.openlinksw.com/sparql. Also include <http://dbpedia.org> in the FROM clause of your SPARQL. This instance is based on a cluster edition of Virtuoso with more iron behind it. The main DBpedia endpoint is configured for mass use too, but it doesn't have the iron behind it, so we have restriction in place to ensure everyone has a good shot at usage etc..

Kingsley

Best,
~Liam

On 12/12/2011 02:36 AM, Mohamed Morsey wrote:
Hi Liam,

On 12/12/2011 04:26 AM, Liam Kirsher wrote:
It's the connection part that has me stumped. In SQL it might be done with a subquery. But in SPARQL? Don't know.

The subqueries are not a standardized part of SPARQL.

I ended up writing a script and querying the various combination of country and language using the query Mohamed supplied, but I'm sure there is a better way.

When I run that query, I only get 29 results, so something is not right there. Thanks, though, it is helping improve my understanding of SPARQL.

Please try the following query:

    select  ?place ?placeName ?country
    where { ?place ?p ?country.
    ?place a <http://dbpedia.org/ontology/Place>.
    ?country ?p2 ?continent.
    filter(?p2 = <http://purl.org/dc/terms/subject> && ?continent =
    <http://dbpedia.org/resource/Category:European_countries>)
    ?place rdfs:label ?placeName. filter(langMatches(
    lang(?placeName), "fr" )) }  limit 1000



On 12/11/2011 02:45 AM, Saeedeh Shekarpour wrote:
Hi

you should somehow connect the variable ?place to the variable ?country


there are some properties in DBpedia you can use like:

select count( distinct ?place)
where {
    ?place a <http://dbpedia.org/ontology/Place>.
    ?place rdfs:label ?placeName.

    ?country ?p ?o.
filter(?p = <http://purl.org/dc/terms/subject> && ?o = <http://dbpedia.org/resource/Category:European_countries>)
  ?place <http://dbpedia.org/ontology/locationCountry> ?country.
filter(langMatches( lang(?placeName), "fr" )).

}



You can find the list of possible properties by this query:

select distinct ?x
where {
    ?place a <http://dbpedia.org/ontology/Place>.

    ?country ?p ?o.
filter(?p = <http://purl.org/dc/terms/subject> && ?o = <http://dbpedia.org/resource/Category:European_countries>)
  ?place ?x ?country.


}


Select one you aim at your query.

Best Regards

On Sun, Dec 11, 2011 at 6:13 AM, Liam Kirsher <[email protected] <mailto:[email protected]>> wrote:

    I can get the list of the countries, but how to combine with
    the rest of the query?
    Okay, I tried this to get the count of all the articles about
places in Europe that are in French. However, it times out. Is this the correct query?

    select  ?country count(?place)
    where {
        ?place a <http://dbpedia.org/ontology/Place>.
        ?place rdfs:label ?placeName. filter(langMatches(
    lang(?placeName), "fr" )).
        ?country ?p ?o. filter(?p =
    <http://purl.org/dc/terms/subject> && ?o =
    <http://dbpedia.org/resource/Category:European_countries>)

    }

    On 12/10/2011 03:44 PM, Mohamed Morsey wrote:
    Hi Liam,

    On 12/09/2011 09:21 PM, Liam Kirsher wrote:
    Mohamed,

    Thanks so much!  That was very helpful, and I now have most
    of what I needed.

    Perfect, then good luck with your next step ;)

    The remaining thing is somewhat similar -- just to get
    entries in a particular language anywhere in Europe.
    Simply substituting Europe as the region does not work.  I
    imagine there might be some way to get the list of European
    countries and filter on membership in the list.

    You can use the following query to get a list of all European
    countries:

        SELECT ?country WHERE { ?country ?p ?o. filter(?p =
        <http://purl.org/dc/terms/subject> && ?o =
        <http://dbpedia.org/resource/Category:European_countries>) }



    Thanks again!
    Liam



--
Kind Regards
Mohamed Morsey
Department of Computer Science
University of Leipzig

--
Liam Kirsher
PGP:http://liam.numenet.com/pgp/


------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and
improve service delivery. Take 5 minutes to use this Systems Optimization
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/


_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion


--

Regards,

Kingsley Idehen 
Founder&  CEO
OpenLink Software
Company Web: http://www.openlinksw.com
Personal Weblog: http://www.openlinksw.com/blog/~kidehen
Twitter/Identi.ca handle: @kidehen
Google+ Profile: https://plus.google.com/112399767740508618350/about
LinkedIn Profile: http://www.linkedin.com/in/kidehen





Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and 
improve service delivery. Take 5 minutes to use this Systems Optimization 
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to