Nested queries in sparql with limits

ぐ巨炮叔叔 提交于 2019-11-28 04:47:22

问题


I currently trying to create a sample of the dbpedia data for a use case i have to present. My main goal is to ask for 5 five paintings per european artist (and i want to present only two artists per country at the beginning).

The query without the limits is as follows.

    PREFIX dbpedia-owl:<http://dbpedia.org/ontology/>
    PREFIX category: <http://dbpedia.org/resource/Category:>
    PREFIX dcterms:<http://purl.org/dc/terms/>
    PREFIX prop:<http://dbpedia.org/property/>
    PREFIX geonames:<http://sws.geonames.org/>
    PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    PREFIX dbpedia:<http://dbpedia.org/resource/>
    PREFIX geo-ont:<http://www.geonames.org/ontology#>
    PREFIX ourvocab:<http://example.org/>
    prefix foaf:<http://xmlns.com/foaf/0.1/>

    SELECT DISTINCT ?painting_name ?artist_name ?european_country ?description ?artist_birthday_year
    WHERE {

    ?european_country dcterms:subject category:Countries_in_Europe.
    ?european_country rdf:type dbpedia-owl:Place.

    ?painting prop:artist ?artist.
    ?painting rdfs:label ?painting_name.
    ?painting prop:type dbpedia:Oil_painting.
    ?painting rdfs:comment ?description.

    ?artist foaf:name ?artist_name.
    ?artist rdf:type dbpedia-owl:Artist.
    ?artist prop:placeOfBirth ?european_country.
    ?artist dbpedia-owl:birthDate ?artist_birthday.


     FILTER (lang(?painting_name) = "" || lang(?painting_name) = "en")
     FILTER (lang(?description) = "" || lang(?description) = "en")
     BIND(year(?artist_birthday) AS ?artist_birthday_year)

    }

You can run the query here: http://dbpedia.org/sparql Now, I am stuck because I do not know how to apply the nested limits in my use case. Thank you very much in beforehand.

来源:https://stackoverflow.com/questions/21018518/nested-queries-in-sparql-with-limits

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!