2

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
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
Marco Scarselli
  • 1,154
  • 2
  • 11
  • 27
  • 1
    Are you trying to add up all of the goals for each player? The data is modeled with `goal` as a literal, so there isn't a way to find which year the goals were scored in. – scotthenninger Apr 12 '16 at 13:43
  • 1
    @scotthenninger The players are also related to a bunch of "career station" entities, which do correspond to time periods, teams, and goals, so I think this information *is* accessible. I've added an answer. – Joshua Taylor Apr 12 '16 at 15:47

1 Answers1

3

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:

Community
  • 1
  • 1
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353