W3C home > Mailing lists > Public > www-rdf-logic@w3.org > March 2003

Re: The Robber and the Speeder: an exciting inference

From: Richard H. McCullough <rhm@cdepot.net>
Date: Thu, 27 Mar 2003 06:48:08 -0800
Message-ID: <001701c2f470$d6255300$bd7ba8c0@rhm8200>
To: "Roger L. Costello" <costello@mitre.org>, <www-rdf-logic@w3.org>
Cc: "KR-language" <KR-language@YahooGroups.com>, <McCulluogh-only@webtv.net>

For your enjoyment.
Here is a complete implementation of this example
using MKR/MKE (http://rhm.cdepot.net/)

<HTML>
<XMP>
# KEHOME/knowledge/applications/SemanticWeb/OWL/RobberSpeeder.html
# Mar/27/2003

#=========#
# context #
#=========#
at view = Match Criminals;

  driversLicenseNumber,
  registeredGun,
  serial
 isa InverseFunctionalProperty;
  Person has
    driversLicenseNumber = Literal,
    registeredGun = Literal;
  Gun has serial = Literal;
  Gun License has
    registeredGun = Literal,
    holder = Person,
    driversLicenseNumber = Literal;

  Gun License DB isa relation with
    format = [registeredGun:1, Person:2, driversLicenseNumber:3],
    meaning = {
      $2 has registeredGun=$1;
      $2 has driversLicenseNumber=$3;
    };

  Robbery Event DB isa relation with
    format = [Date:1, Person:2, registeredGun:3],
    meaning = {
      at time = $1 {
        $2 do rob done;
        $2 has registeredGun = $3;
      };
    };

  Speeding Offense DB isa relation with
    format = [Date:1, Person:2, driversLicenseNumber:3],
    meaning = {
      at time = $1 {
        $2 do speed done;
        $2 has driversLicenseNumber = $3;
      };
    };

  Match Robber and Speeder isa method with
    label = [Gun License DB, Robbery Event DB, Speeding Offense DB],
    format = [relation:1, relation:2, relation:3],
    meaning = {
      do load od $1, $2, $3 done;
      every person isa Person {
        set . = $person;
        if $person isin $1; then
          if $registeredGun isin $2; then
            if $driversLicenseNumber isin $3; then
              do print od "<!-- matching Robber and Speeder -->"
done;
              do print od "Person:               $person"
done;
              do print od "registeredGun:        $registeredGun"
done;
              do print od "driversLicenseNumber: $driversLicenseNumber"
done;
            fi;
          fi;
        fi;
      }; # end every person
    }; # end meaning


#======#
# data #
#======#
begin relation Gun License DB;
  ABCD, Fred Bloggs, ZXYZXY;
end relation Gun License DB;

begin relation Robbery Event DB;
  date_123, an unknown person, ABCD;
end relation Robbery Event DB;

begin relation Speeding Offense DB;
  date_456, John Doe, ZXYZXY;
end relation Speeding Offense DB;


#=========#
# results #
#=========#
do print od "<!--  input data  -->" done;
Person              isc* ?;
Gun License DB      isc* ?;
Robbery Event DB    isc* ?;
Speeding Offense DB isc* ?;

do print od "<!--  output results  -->" done;
do Match Robber and Speeder
   od Gun License DB, Robbery Event DB, Speeding Offense DB
done;

! deletecomment RobberSpeeder.out >RobberSpeeder.save done;
! cat RobberSpeeder.save done;

exit;

</XMP>
</HTML>


----- Original Message -----
From: "Roger L. Costello" <costello@mitre.org>
To: <www-rdf-logic@w3.org>
Sent: Monday, March 24, 2003 3:10 AM
Subject: Re: The Robber and the Speeder: an exciting inference


>
> Outstanding!!!  This is exactly the thing I was looking for - a simple
> example with compelling inferences.  Thanks a lot Ian!  /Roger
>
> Ian Davis wrote:
> >
> > On Monday, 17 March 2003 at 17:00, Roger L. Costello wrote:
> > > Does anyone have ideas on how to enhance my solution to use
> > > more of OWL's capabilities, and use more inferencing?
> >
> > Here's my take on it...it's not as exciting as C.H.I.P.S. though...
> >
> > First of all a robbery takes place. The robber drops his gun while
> > fleeing. A report is filed by the investigating officers:
> >
> > <RobberyEvent>
> >   <date>...</date>
> >   <description>...</description>
> >   <evidence>
> >     <Gun>
> >       <serial>ABCD</serial>
> >     </Gun>
> >   </evidence>
> >   <robber>
> >     <Person /> <!-- an unknown person -->
> >   </robber>
> > </RobberyEvent>
> >
> > Subsequently a car is pulled over for speeding. The traffic officer
> > files a report electronically while issuing a ticket:
> >
> > <SpeedingOffence>
> >   <date>...</date>
> >   <description>...</description>
> >   <speeder>
> >     <Person>
> >       <name>John Doe</name>
> >       <driversLicenseNumber>ZXYZXY</driversLicenseNumber>
> >     </Person>
> >   </speeder>
> > </SpeedingOffence>
> >
> > At police HQ, the computer analyses each report as it is filed. The
> > following OWL rule tells the computer that a driversLicenseNumber is
> > unique to a Person:
> >
> > <owl:InverseFunctionalProperty rdf:ID="driversLicenseNumber">
> >   <rdfs:domain rdf:resource="Person" />
> >   <rdfs:range  rdf:resource="&rdf;Literal" />
> > </owl:FunctionalProperty>
> >
> > The computer uses this information to look up any other records it has
> > about that person and finds a gun license:
> >
> > <GunLicense>
> >   <registeredGun>
> >     <Gun>
> >       <serial>ABCD</serial>
> >     </Gun>
> >   </registeredGun>
> >   <holder>
> >     <Person>
> >       <name>Fred Bloggs</name>
> >       <driversLicenseNumber>ZXYZXY</driversLicenseNumber>
> >     </Person>
> >   </holder>
> > </GunLicense>
> >
> > The next OWL rule tells the computer that the registeredGun property
> > uniquely identifies a GunLicense. i.e. each gun is associated with
> > only a single GunLicense
> >
> > <owl:InverseFunctionalProperty rdf:ID="registeredGun">
> >   <rdfs:domain rdf:resource="GunLicense" />
> >   <rdfs:range  rdf:resource="Gun" />
> > </owl:FunctionalProperty>
> >
> > The computer now knows that the person stopped for speeding owns a
> > gun. The next rule tells the computer that each gun is uniquely
> > identified by its serial.
> >
> > <owl:InverseFunctionalProperty rdf:ID="serial">
> >   <rdfs:domain rdf:resource="Gun" />
> >   <rdfs:range  rdf:resource="&rdf;Literal" />
> > </owl:FunctionalProperty>
> >
> > The computer uses this to determine that the gun on the license is the
> > same gun used in the robbery. This final rule, seals the speeder's
> > fate. It tells the computer that each GunLicense applies to only one
> > gun and one person, so there is no doubt that the speeder is the person
> > who owns the gun:
> >
> > <owl:Class rdf:ID="GunLicense">
> >   <owl:intersectionOf rdf:parseType="Collection">
> >     <owl:Restriction>
> >       <owl:onProperty rdf:resource="#registeredGun"/>
> >       <owl:cardinality>1</owl:cardinality>
> >     </owl:Restriction>
> >     <owl:Restriction>
> >       <owl:onProperty rdf:resource="#holder"/>
> >       <owl:cardinality>1</owl:cardinality>
> >     </owl:Restriction>
> >   </owl:intersectionOf>
> > </Class>
> >
> > The computer reports back to the traffic cop who duly arrests the
> > speeder on suspicion of armed robbery.
> >
> > - Ian <iand@internetalchemy.org>
> > "The test of all knowledge is experiment."
>
Received on Thursday, 27 March 2003 09:54:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:52:43 GMT