0

I'm trying to get list of Chinese universities and their adresses. The minimum being the City/Town name. I will use these addresses to populate a googlemap, fiddle here.

I saw interesting code such as:

SELECT ?resource ?value
WHERE { 
   ?resource a <http://dbpedia.org/class/yago/CitiesAndTownsInDenmark> .
   ?resource <http://dbpedia.org/property/populationTotal> ?value .
   FILTER (?value > 100000)
}
ORDER BY ?resource ?value

Since CitiesAndTownsInChina doesn't work,

1. Where to find the exact name of the class I'am targeting ? and

2. Where to find dbpedia's operators manual ?


Note: I'am a very active user on Wikipedia, I'am well aware of all the data available there, but the dbpedia ontology/syntaxe/keywords is quite hard to get.

Personal note: queries on http://dbpedia.org/snorql/ , http://dbpedia.org/sparql/ , http://querybuilder.dbpedia.org/

Hugolpz
  • 17,296
  • 26
  • 100
  • 187
  • Did you try to find interesting categories on Wikipedia (DBpedia's source)? Did you try to find Cities/Settlements in China - without a special class? – Ben Companjen Mar 26 '13 at 01:27
  • http://jens-lehmann.org/files/2009/dbpedia_jws.pdf is one of the original papers about DBpedia - not exactly a "manual". And did you search the [wiki](http://wiki.dbpedia.org/About)? – Ben Companjen Mar 26 '13 at 01:30

2 Answers2

3

(Expanding on my reply to How to find cities with more than X population in a certain country)

CitiesAndTownsInDenmark exists because people use the category http://en.wikipedia.org/wiki/Category:Cities_and_towns_in_Denmark in wikipedia. Wikipedia categories are pretty loose and as a result there's a lot of variation in style, so even if a useful category exists the name may not be guessable.

In addition categories are maintained manually, and may not be consistently applied.

A good place to start is looking at the data. Visiting http://dbpedia.org/page/Beijing I see yago:MetropolitanAreasOfChina which seems promising, but if you follow that link you'll see it's not well populated.

As a consequence avoid relying on the existence of such categories and directly querying for populated places in a country. This information comes from wikipedia infoboxes, and they're much more consistent than categories. Taking Beijing as an exemplar again I found:

select ?s { 
    ?s a <http://dbpedia.org/ontology/PopulatedPlace> ; 
       <http://dbpedia.org/ontology/country> <http://dbpedia.org/resource/China>
}

(The relevant properties and values for my query were found by copying link location in the Beijing page)

with the result:

"http://dbpedia.org/resource/Hulunbuir"
"http://dbpedia.org/resource/Guangzhou"
"http://dbpedia.org/resource/Chongqing"
"http://dbpedia.org/resource/Kuqa_County"
"http://dbpedia.org/resource/Changzhou"
... nearly 3000 results ...

You'll notice that position is encoded multiple times (geo:lat and long, georss:point, various dbpprop:latd longd things), and there seem to be two values excitingly. You can either simply deal with the multiple values in whichever format you prefer, or try picking just one using GROUP BY and SAMPLE.

As for a manual, almost everything I know of are academic papers, and not very useful. However the data is reasonably self documenting.

Community
  • 1
  • 1
user205512
  • 8,798
  • 29
  • 28
2

for your first question:
you can see possible classes by querying one member of your intended set of entities (ex: Shanghai).

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?type  WHERE {
    <http://dbpedia.org/resource/Shanghai> rdf:type ?type.
    FILTER regex(str(?type), ".*China", "i").
} LIMIT 100

which gives this result:

dbpedia:class/yago/MetropolitanAreasOfChina [http]
dbpedia:class/yago/PortCitiesAndTownsInChina [http]
dbpedia:class/yago/MunicipalitiesOfThePeople'sRepuBlicOfChina [http]
dbpedia:class/yago/PopulatedCoastalPlacesInChina [http]

they are CamelCase versions of the categories that you will find at the bottom of wikipedia pages. I was fooled for a while by the erroneous capitalization of RepuBlic and finally saw that it contains only 4 cities, so it is of limited use for you.

so I would propose to go with @user205512 answer and get the cities by linking 2 properties.

for your second question:
I would advice you to search/ask on http://answers.semanticweb.com

kr1
  • 7,225
  • 1
  • 26
  • 29