Problem with choosing SPARQL query on dbpedia

I am trying to get some city data using the Sparql query on DBpedia. The problem is that I cannot get the request to work.

I am currently doing something like this:

SELECT ?title,?name,?abs WHERE {
  ?title skos:subject 
    <http://dbpedia.org/resource/Category:Cities%2C_towns_and_villages_in_Slovenia>.
  ?title dbpprop:officialName ?name.
  ?title dbpprop:abstract ?abs 
}

I get all the cities, villages from Slovenia with all the data. The problem is that I would like to receive data (officialName and / or abstract) for only one city, for example Ljubljana. So I tried things like this:

SELECT ?name WHERE {
  ?name dbpprop:officialName 
    <http://dbpedia.org/resource/Ljubljana>.
}

Of course, this will not work. I don’t know exactly why, though :), but I experimented a bit and noticed some things, as if I put

?name skos:subject <http://dbpedia.org/resource/Category:Ljubljana>.

I get some results (which are not relevant to me, but in any case), but if I put

?name skos:subject <http://dbpedia.org/resource/Ljubljana>.

-, skos: subject http://dbpedia.org/resource/Ljubljana.

- , , ?

, Ablak

+3
1

<http://dbpedia.org/resource/Ljubljana> , ; ?title SPARQL, :

SELECT ?name, ?abs WHERE {
   <http://dbpedia.org/resource/Ljubljana>
     skos:subject <http://dbpedia.org/resource/Category:Cities%2C_towns_and_villages_in_Slovenia> ;
     dbpprop:officialName ?name ;
     dbpprop:abstract ?abs .
}

?name skos:subject <http://dbpedia.org/resource/Ljubljana> ; URI (), .

+4

Source: https://habr.com/ru/post/1710110/


All Articles