Mohamed,

Thanks so much! That was very helpful, and I now have most of what I needed. 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.

Thanks again!
Liam



On 12/09/2011 06:45 AM, Mohamed Morsey wrote:
Hi Liam,

On 12/09/2011 06:54 AM, Liam Kirsher wrote:
Hi --

I'm new to RDF and dbpedia. I'm trying to determine if I will be able to use dbpedia in a project I am involved with. The question I need a quick answer to is how many Places there are, organized by language and location, as that has a bearing on whether we may use dbpedia. It seems like a SPARQL query should almost give me this, but I'm not sure if I can get the count -- it looks like it's not possible, or only possible with certain SPARQL extensions? (Also, I'm not sure how to formulate the query even without the count issue.)

Can anyone point me in the right direction for getting the following statistics on dbpedia content?

    * How many Places are there for a given language?


The following query lists all places for the English language (en) as an example:

    select  ?place ?placeName
    where {?place a <http://dbpedia.org/ontology/Place>.
                 ?place rdfs:label ?placeName. filter(langMatches(
    lang(?placeName), "en" ))}  limit 1000


In order to get the count please use the following one:

    select  count(?place)
    where {?place a <http://dbpedia.org/ontology/Place>.
                ?place rdfs:label ?placeName. filter(langMatches(
    lang(?placeName), "en" ))}


You can replace the English language code (en) with the code you want e.g. "de" for German and "it" for Italian.

    * How many Places are there for a given region?


The following query lists all places in Germany as an example:

    select  ?place ?placeName
    where { ?place ?p ?region.
                ?place a <http://dbpedia.org/ontology/Place>.
    filter(?p = <http://dbpedia.org/ontology/country> && ?region =
    <http://dbpedia.org/resource/Germany>) .
                ?place rdfs:label ?placeName. }  limit 1000

In order to get the count please use the following one:

    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/Germany>) .
                ?place rdfs:label ?placeName. }


You can replace Germany with another country of interest, e.g. <http://dbpedia.org/resource/Italy> for Italy.

    * And the combination of the above two queries: how many Places
      are there for a given region in a given language?


The following query lists all places in Germany for the English language (en) as an example:

    select  ?place ?placeName
    where { ?place ?p ?region.
    ?place a <http://dbpedia.org/ontology/Place>. filter(?p =
    <http://dbpedia.org/ontology/country> && ?region =
    <http://dbpedia.org/resource/Germany>) .
    ?place rdfs:label ?placeName. filter(langMatches(
    lang(?placeName), "en" )) }  limit 1000

In order to get the count please use the following one:

    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/Germany>) .
    ?place rdfs:label ?placeName. filter(langMatches(
    lang(?placeName), "en" )) }

And one last important note, please note that the queries containing count may timeout, as the function count is somewhat heavy.


The languages and regions of interest are
German in Germany
French in France
Italian in Italy
English in the UK
Dutch in the Netherlands and Belgium
Spanish in Spain

You can try out those combinations yourself :)

Hope that constitutes a nice guide for you.


Thanks in advance for any help!

~Liam

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


------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of
discussion for anyone considering optimizing the pricing and packaging model
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/


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


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

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

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to