I like hockey, but haven’t followed it in years; it seems that the Sabres are doing pretty well, and the Rangers stink. Frick – looks like the Flyers beat Buffalo out of the first round. Ugh.

Point being, I’m certainly not a subject matter expert in hockey. Fortunately, the internet is pretty smart about such things, so I can ask it for a definition of Enforcer:

An enforcer’s job is to deter and respond to dirty or violent play by the opposition. When such play occurs, the enforcer is expected to respond aggressively, by fighting or checking the offender. Enforcers are expected to react particularly harshly to violence against star players or goalies. (wikipedia)

So what I’d like to do is figure out a good way to measure how much enforcement a player is bringing to his team at any point in the season.  Apparently, I’m looking for people who pick fights with or hit people who do violent things to their teammates.

Although I could take this as grounds for a definition of the class of enforcers in an ontology, I’m not sure a class would do me much good.  There’s nothing in the expert definition that looks like either a necessary or sufficient condition.  What we have instead is a behavior to help us look for enforcers – a detection rule.

Looking at the NHL dataset parsed in the last post, and running it through a script to generate RDF, the skeleton of the data model looks like this:

  • game
    • play
      • hit
      • shot
      • penalty
      • goal
      • fight

As a first stab at a detection rule, then, this Sparql query might do the trick:

select ?p1 ?name (sum(?minutes) as ?score)
where {	?e a nhl:EnforcerPenalty . ?e nhl:agent1 ?p1 .
        ?e nhl:agent2 ?p2 . ?e2 nhl:agent1 ?p2 . 
        ?e2 a nhl:ViolentPenalty . ?p1 rdfs:label ?name .
        ?e a ?class . ?class nhl:penaltyMinutes ?minutes .}
group by ?p1 ?name

Essentially, somebody is acting like an enforcer when they commit an enforcer penalty against a player who committed a violent penalty against one of the enforcer’s teammates.  The quantitative aspect of the measure is conveyed by the minutes assessed by the enforcer’s penalty, so a guy who gets into a fight to stand up for a teammate is more of an enforcer than a guy who just gets called for roughing.

Yeah, it could use some work, but it’d be interesting to see what gets pulled out of the model by this query.  A bit of ontology will also be needed to define what enforcer and violent penalties are, as well as assign penalty minutes to each penalty class (since they don’t appear in the data set).

I’ll throw up the NHL project on Github tomorrow if you want to follow along, and run through some of the preliminary results from this definition of enforcement.  After that, I want to take a good look at the basis for calling this a measure at all.