Dbpedia, попытка получить выборку так, чтобы самый релевантный вариант был сверху
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?label ?uri ?thumb ?wiki
WHERE
{
{
?uri dbo:wikiPageRedirects ?target.
?target rdfs:label ?label;
rdf:type dbo:Person;
dbo:thumbnail ?thumb;
foaf:isPrimaryTopicOf ?wiki
}
UNION
{
?uri rdfs:label ?label;
rdf:type dbo:Person;
dbo:thumbnail ?thumb;
foaf:isPrimaryTopicOf ?wiki
}
UNION
{
?uri dbo:wikiPageDisambiguates ?target.
?target rdfs:label ?label;
rdf:type dbo:Person;
dbo:thumbnail ?thumb;
foaf:isPrimaryTopicOf ?wiki
}
FILTER (SAMETERM(?uri, <http://dbpedia.org/resource/Rebecca_Allen>) && lang(?label) = "en" )
}
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?label ?uri ?thumb ?wiki
WHERE
{
{
?uri dbo:wikiPageRedirects ?target.
?target rdfs:label ?label;
rdf:type dbo:Place;
dbo:thumbnail ?thumb;
foaf:isPrimaryTopicOf ?wiki
}
UNION
{
?uri rdfs:label ?label;
rdf:type dbo:Place;
dbo:thumbnail ?thumb;
foaf:isPrimaryTopicOf ?wiki
}
FILTER (SAMETERM(?uri, <http://dbpedia.org/resource/U.S.>) && lang(?label) = "en" )
}
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT *
WHERE
{
{
?uri rdfs:label ?label .
?uri dbo:wikiPageRedirects ?target
}
UNION
{
?uri rdfs:label ?label .
}
FILTER (SAMETERM(?uri, <http://dbpedia.org/resource/U.S.>) && lang(?label) = "en" )
}
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT *
WHERE
{
{
?uri rdfs:label ?label .
}
UNION
{
[] dbo:wikiPageRedirects ?uri .
?uri rdfs:label ?label .
}
OPTIONAL
{
?uri geo:lat ?lat ;
geo:long ?long
}
OPTIONAL
{
?uri dbo:country ?dbpediaContry .
}
FILTER (SAMETERM(?uri, <http://dbpedia.org/resource/Valencia,_Spain>) && lang(?label) = "en" )
}
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dct: <http://purl.org/dc/terms/>
SELECT DISTINCT ?lbl ?location ?thumb ?wiki
WHERE {
?location rdfs:label ?lbl ;
rdf:type dbo:Place;
dbo:thumbnail ?thumb;
foaf:isPrimaryTopicOf ?wiki.
?lbl <bif:contains> "'U.S.'" OPTION(score ?score1) .
BIND (strlen(?lbl) AS ?len)
FILTER(langMatches(lang(?lbl), "EN") ) .
}
ORDER BY DESC(?score1), ASC(?len)