Friday, July 30, 2010

All Simpson's Blackboard gags

Let's expand our second query and get all the blackboard gags from all the Simpson seasons and episodes.

THE QUERY DIAGRAM


THE SPARQL QUERY - ANY EPISODE ANY SEASON WITH A BLACKBOARD GAG

SELECT distinct ?episode,?chalkboard_gag
WHERE 
{
 ?episode
   <http://www.w3.org/2004/02/skos/core#subject>
     ?season
 .
 ?episode
   <http://dbpedia.org/property/blackboard>
     ?chalkboard_gag
 .
}
Show results.

GET ANY EPISODE - ANY SEASON

4) ?episode  
5)  <http://www.w3.org/2004/02/skos/core#subject>  
6)   ?season  
7) .
 
Note: I'll only discuss the newest items of interest instead of endlessly repeating that the select clause lists the variables you want to see.
  • Line 4) The subject we are talking about.
  • Line 5) We already learned that the skos:subject referred to the season this episode belonged to.
  • Line 6)Instead of limiting our results to The Simpsons season 12, we will put in ?season, meaning any season.
  • Line 7) The period marks the end of the first selection clause.
  • Recapping, lines 4-7 ask the SPARQL engine to search all off dbpedia to find the page(s) that I will call ?episode that have a skos:subject value of anything. We will call that anything a season. We will have to count on the 2nd clause to restrict our results to ?episodes that have a blackboard variable for the blackboard gag.

LETS CHECK OUR RESULTS

The results look like Simpson blackboard gags, but lets make sure.

No comments:

Post a Comment