SPARQL
is an RDF query language, currently being prepared by the W3C’s
RDF Data Access Working Group. (Disambiguation:
Sparql
is also the name of
Danny Ayers’ cat.)
The language is still under development, but there are many implementations
of the various drafts. I chose
Rasqal,
with its
Roqet
front-end (available as rasqal-utils in Debian).

The intent should be apparent, if not the syntax: find any chain,
from season to episode, for both series. By requiring the same contributor,
?c, for both series, we will only get results where
the same person appeared in both series. The output will be the variables
that satisfied the match.

(You could also use inference to bring down an mvi:series
predicate for each episode. This would make the query far simpler,
at the expense of adding an extra processing step or requiring an
RDF store with inference.)

The version of Rasqal I was using had no support for multiple FROM
graphs, so I merged the RDF ahead of time
(cwm dapcentral/dr-katz.rdf epguides/the-larry-sanders-show.rdf extras/the-larry-sanders-show_guests.rdf >a.rdf).
SPARQL doesn’t appear to
support rdf:Seq, so the single-letter dummy variables (w, x, y, z)
are used as an approximation of rdf:_[0-9]+ to mean
any indexed member of a sequence.

Presentation

SPARQL queries can result in tabular data or RDF graphs. For this
query, and to present with XSLT, neither is perfect.
Fresnel
looks like it might be worth investigation but, for now, let’s go
with tabular XML output
(roqet -r xml-v1 multiple-appearances.sparql >contributors2.xml)
and a whole load of XSLT munging.

(Due to methodology, none of the principals were included:
both Jonathan Katz and Garry Shandling guested on each other’s shows,
and Janeane Garofalo and Sarah Silverman were Sanders cast members
who appeared on Katz.)

Conclusions

Jon Stewart and Steven Wright were the most significant cultural
figures of 1990s television comedy. (Both also appeared in
The Aristocrats; it’s no
They Rule,
but you might want to cross-reference that cast list.)

SPARQL is here and it works. Most RDF repositories had their own
proprietary query languages before, but standardisation should make it easier
to move between implementations.

The boundary between RDF and HTML still feels like an impedence mismatch
at the structural level.
I’m not sure which side needs to move, or if there’s simply a better
approach that I’ve missed. It’s always possible to write code to get
the presentation you need, but rarely desirable.