i'm trying to select any active players of an soccer Team.
for example i have selected the football team for Austria
SELECT * WHERE
{
?club a dbo:SoccerClub ;
dbo:ground ?grounds .
?grounds dbo:location ?country.
FILTER(?country = <http://dbpedia.org/resource/Austria>)
}
The
result of the query
seems very well
Now I'm trying to get all active players for one soccer team/club.
for example:http://dbpedia.org/resource/FC_Red_Bull_Salzburg
so I have tried the following query
PREFIX dbpedia: <http://dbpedia.org/property/>
SELECT *
WHERE {
?player dbpedia:currentclub ?teamName.
OPTIONAL {?teamName dbpedia:ground ?ground}.
OPTIONAL {?grounds dbo:location ?country}.
OPTIONAL {?player dbpedia:cityofbirth ?city}.
OPTIONAL {?player dbpedia:dateOfBirth ?dob}.
Filter(?country = <http://dbpedia.org/resource/Austria>)
Filter(?teamName = <http://dbpedia.org/resource/FC_Red_Bull_Salzburg>)
}
but unfortuality the query returns no results.
I would be grateful for any help.
Related
I tried to extract the following informations (soccerplayer name, team, team number, number of matches, number of goals) about soccer players from dbpedia using this query:
PREFIX dbo: <http://dbpedia.org/ontology/>
select distinct ?soccerplayer ?team ?number ?caps ?goals Where
{
?soccerplayer a dbo:SoccerPlayer ;
dbo:team ?team;
dbo:number ?number;
dbo:numberOfMatches ?caps;
dbo:numberOfGoals ?goals.
}
ORDER BY ?soccerplayer
I'm trying to extract all persons that won a (Gold) medal at the Olympics and ideally their birth location using the dbpedia SPARQL query. Basically it's this list I'm aiming at: https://de.wikipedia.org/wiki/Liste_der_olympischen_Medaillengewinner_aus_Spanien
I guess it must somehow work with this piece of code:
yago-res:wikicategory_Olympic_bronze_medalists_for_Spain
This doesn't work:
SELECT ?res
WHERE {
?res yago-res:wikicategory_Olympic_bronze_medalists_for_Spain .
}
any ideas?
To get all the spanish persons that have won the gold medal in olympic
select ?person where
{
?person a <http://dbpedia.org/class/yago/OlympicGoldMedalistsForSpain>
}
If you look at what dbpedia has, there is no class:
http://dbpedia.org/class/yago/OlympicGoldMedalists
but there is
http://dbpedia.org/class/yago/OlympicGoldMedalistsForItaly
and
http://dbpedia.org/class/yago/OlympicGoldMedalistsForFrance
and
http://dbpedia.org/class/yago/OlympicGoldMedalistsForGermany
so a work around could be:
select distinct ?person ?birthPlace where
{
?goldForCountry rdfs:subClassOf yago:Medalist110305062 .
?person a ?goldForCountry .
optional{
?person dbo:birthPlace ?birthPlace
}
filter (contains(str(?goldForCountry), "http://dbpedia.org/class/yago/OlympicGoldMedalistsFor"))
}
The birthPlace should be optional because there are 3994 persons that dbpedia doesn't have their birth place
Let's say I want a list of actors that were never directed by Tim Burton among a list of popular movies.
I tried to do it with this steps:
Select all actors that Tim Burton ever directed (sub select)
Select a list of actors from a list of popular movies (by imdb ids)
Exclude all actors from the first selection in the second selection (NOT IN)
Here is a code I tried that do not works (the NOT IN fail, I don't know why):
SELECT DISTINCT ?actor ?actorLabel
WHERE {
?film wdt:P31 wd:Q11424
;wdt:P161 ?actor
;wdt:P345 ?imdbId .
{
SELECT ?excludeActors
WHERE {
?film wdt:P31 wd:Q11424
; wdt:P57 wd:Q56008
; wdt:P161 ?excludeActors .
}
} .
FILTER(?actor NOT IN (?excludeActors)) .
FILTER(?imdbId = "tt1077368" || ?imdbId = "tt0167260") .
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" }
}
Or follow this link
(there is a filter on Christopher Lee that you can remove [last one], it is used to highlight what I explain here:)
In this code I have two movies: Dark Shadows (directed by Tim Burton) and The Lord of the Rings 3. In this example Christopher Lee is present in both movies, which means he should be excluded since Tim Burton directed him in Dark Shadows.
You can see that he his in the list.
I really don't understand why the NOT IN fail with the sub select. I tried the sub Select request and I found Christopher Lee inside which means he should be excluded.
If I understood correctly, you want all actors that acted in the given movies, but have never acted in any movie directed by Tim Burton. I would use FILTER NOT EXISTS:
SELECT DISTINCT ?actor ?actorLabel
WHERE {
VALUES ?imdbId { "tt1077368" "tt0167260" }
?film wdt:P31 wd:Q11424
;wdt:P161 ?actor
;wdt:P345 ?imdbId .
FILTER NOT EXISTS {
[] wdt:P31 wd:Q11424
; wdt:P57 wd:Q56008
; wdt:P161 ?actor .
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" }
}
LIMIT 100
Is there some way to obtain only goals that soccer players scored in Fiorentina with dbpedia.org SPARQL endpoint? I tried the following query, but unfortunately I obtain goals for each season.
select * where {
?player a dbo:SoccerPlayer.
?player dbo:team <http://dbpedia.org/resource/ACF_Fiorentina>.
?player dbp:position <http://dbpedia.org/resource/Forward_(association_football)>.
?player dbp:goals ?goal.
}
limit 10000
I think you can do this. If you browse the data for Silva, you'll see a number of career stations, e.g., station 12, each of which has a number of goals. That means you can do:
select * where {
?player a dbo:SoccerPlayer ;
dbp:position <http://dbpedia.org/resource/Forward_(association_football)> ;
dbo:careerStation ?station .
?station dbo:numberOfGoals ?goals ;
dbo:team dbr:ACF_Fiorentina .
}
SPARQL results
Of course, a player might have multiple stations on the same team, so you'd still want to aggregate over each player and sum the goals:
select ?player (sum(?goals) as ?totalGoals) where {
?player a dbo:SoccerPlayer ;
dbp:position <http://dbpedia.org/resource/Forward_(association_football)> ;
dbo:careerStation ?station .
?station dbo:numberOfGoals ?goals ;
dbo:team dbr:ACF_Fiorentina .
}
group by ?player
SPARQL results
Related
There are some other questions that involve querying career stations that might be useful:
SPARQL - query a property and return results for a related property (This is about getting goals, too. Does this happen to be a class assignment or something?)
Obtaining start and end date from a DBPedia CareerStation
How to build correct SPARQL Query
I need to query dbpedia using sparql:
input: name of a person
output:
the surname, sex , age, occupation
input: an organization name
output:
the founder, if it is public or private
input: a date
output:
if it is an important date for Example: christians, or Easter
input: a city name
output:
the state, region of the city.
Here is an example for #4
First you need to look at the Ontology Class of City in DbPedia.
city is described as city
Select distinct ?city ?location
Where
{
?city a dbo:City.
?city dbo:location ?location.
}
LIMIT 100
Then you can the filter clause to get the city you want.
i think i need to know the resource first but for example
for the 1. i can do ...
SELECT *
where
{
<http://dbpedia.org/resource/Name_x> dc:description ?p.
<http://dbpedia.org/resource/Name_x> foaf:surname ?y
<http://dbpedia.org/resource/Name_x> foaf:name ?y
<http://dbpedia.org/resource/Name_x> foaf:office ?y
}
im checking the others