Pattern Schema FAQ

Version 2002/07

 Ian Harrison, SRI International

 

 

1.   Introduction

 

This document covers frequently asked questions about particular representation issues using PatternML.

 

2.   Example PatternML Files

 

 

1) Pattern is a query about all contract killings in Moscow. It shows the use of cardinality and a instantiated variable (location).

 

<?xml version = "1.0" encoding = "UTF-8"?>

<pattern xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "http://www.ai.sri.com/~law/schemas/2002/07/pattern" label="moscow contract murder query" id="moscow_contract_murder_query1">

 <body>

  <node id="contract_murder.x" label="murder">

   <instanceOf classid="MurderForHire"/>

   <properties><cardinality min="1" max="unbounded"/></properties>

  </node>

  <node id="eventOccursAt.contract_murder.x" label="eventOccursAt">

   <instanceOf classid="Relation"/>

  </node> 

  <node id="location.contract_murder.x" label="location">

    <value>Moscow</value>

  </node> 

  <edge from="contract_murder.x" to="eventOccursAt.contract_murder.x" id="contract_murder.x.eventOccursAt" label="location"/> 

  <edge from="eventOccursAt.contract_murder.x" to="location.contract_murder.x" id="eventOccursAt.contract_murder.x.location" label="location"/> 

  </body>

</pattern>

 

2) General pattern for a contract killing (simplified), which contains no sub-patterns. This would be used to match against e.g. murder evidence to see whether the murder was a contract killing, or instead was of a different type (e.g. first degree murder, second degree murder etc.)

 

<?xml version = "1.0" encoding = "UTF-8"?>

<pattern xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "http://www.ai.sri.com/~law/schemas/2002/07/pattern" label="contract murder" id="contract_murder1">

 <ontology id="eeld_ontology">

   <class id="contract_murder" label="contract murder">

     <subClassOf classid="murder"/>

   </class>

 </ontology>

 <body>

  <node id="contract_murder.x" label="contract murder">

   <instanceOf classid="MurderForHire"/>

  </node>

  <node id="murder.motive.x" label="murder motive">

   <instanceOf classid="Relation"/>

  </node>

  <node id="motive.x" label="motive">

   <instanceOf classid="motive"/>

  </node>

  <node id="subevent.a" label="subevent">

   <instanceOf classid="Relation"/>

  </node> 

  <node id="subevent.b" label="subevent">

   <instanceOf classid="Relation"/>

  </node> 

  <node id="contractor.x" label="contractor">

   <instanceOf classid="Person"/>

  </node> 

  <node id="nameString.contractor.x" label="nameString">

   <instanceOf classid="Relation"/>

  </node> 

  <node id="name.contractor.x" label="contractor name">

   <instanceOf classid="nameString"/>

  </node>

  <node id="directingAgent.contract_murder.x" label="directingAgent">

   <instanceOf classid="Relation"/>

  </node>

  <node id="murder.x" label="murder">

   <instanceOf classid="Murder"/>

  </node>

  <node id="payment.x" label="payment of first installment">

   <instanceOf classid="Paying"/>

  </node>

  <node id="payment.source.x" label="source">

   <instanceOf classid="Relation"/>

  </node>

  <node id="payment.recipient.x" label="recipient">

   <instanceOf classid="Relation"/>

  </node>

  <node id="temporal.sequence.x" label="before">

   <instanceOf classid="Relation"/>

  </node>

  <node id="dateOfEvent.murder.x" label="dateOfEvent">

   <instanceOf classid="Relation"/>

  </node> 

  <node id="date.murder.x" label="date">

   <instanceOf classid="Date"/>

  </node> 

  <node id="eventOccursAt.murder.x" label="eventOccursAt">

   <instanceOf classid="Relation"/>

  </node> 

  <node id="location.murder.x" label="location">

   <instanceOf classid="SpatialThing"/>

  </node> 

  <node id="killer.x" label="killer">

   <instanceOf classid="Person"/>

  </node> 

  <node id="intermediary.x" label="middleman">

   <instanceOf classid="Person"/>

  </node> 

  <node id="nameString.intermediary.x" label="nameString">

   <instanceOf classid="Relation"/>

  </node> 

  <node id="name.intermediary.x" label="intermediary name">

   <instanceOf classid="nameString"/>

  </node> 

  <node id="victim.x" label="victim">

   <instanceOf classid="Person"/>

   <properties><cardinality min="1" max="unbounded"/></properties>

  </node> 

  <node id="nameString.killer.x" label="nameString">

   <instanceOf classid="Relation"/>

  </node>

  <node id="name.killer.x" label="killer name">

   <instanceOf classid="nameString"/>

  </node> 

  <node id="nameString.victim.x" label="nameString">

   <instanceOf classid="Relation"/>

  </node>

  <node id="name.victim.x" label="victim name">

   <instanceOf classid="nameString"/>

  </node> 

  <node id="perpetrator.murder.x" label="perpetrator">

   <instanceOf classid="Relation"/>

  </node> 

  <node id="victim.murder.x" label="victim">

   <instanceOf classid="Relation"/>

  </node> 

  <edge from="contractor.x" to="nameString.contractor.x" id="contractor.x.nameString" label="name"/>

  <edge from="nameString.contractor.x" to="name.contractor.x" id="nameString.contractor.x.name" label="name"/>

  <edge from="contract_murder.x" to="murder.motive.x" id="murder.motive.x.motive" label="motive"/>

  <edge from="murder.motive.x" to="motive.x" id="motive.x.murder.motive" label="motive"/>

  <edge from="contract_murder.x" to="directingAgent.contract_murder.x" id="contract_murder.x.directingAgent" label="directingAgent"/>

  <edge from="directingAgent.contract_murder.x" to="contractor.x" id="directingAgent.contractor.x" label="directingAgent"/>

  <edge from="contract_murder.x" to="subevent.a" id="subevent.a.contract_murder.x" label="subevent"/> 

  <edge from="subevent.a" to="murder.x" id="murder.x.subevent.a" label="subevent"/> 

  <edge from="contract_murder.x" to="subevent.b" id="subevent.b.contract_murder.x" label="subevent"/> 

  <edge from="payment.x" to="temporal.sequence.x" id="payment.x.sequence.x" label="before"/> 

  <edge from="payment.x" to="payment.source.x" id="payment.x.source.x" label="source"/> 

  <edge from="payment.source.x" to="contractor.x" id="payment.source.x.contractor.x" label="source"/> 

  <edge from="payment.x" to="payment.recipient.x" id="payment.x.payment.recipient.x" label="recipient"/> 

  <edge from="payment.recipient.x" to="intermediary.x" id="payment.recipient.x.intermediary.x" label="recipient"/> 

  <edge from="intermediary.x" to="nameString.intermediary.x" id="intermediary.x.nameString" label="name"/>

  <edge from="nameString.intermediary.x" to="name.intermediary.x" id="nameString.intermediary.x.name" label="name"/>

  <edge from="temporal.sequence.x" to="murder.x" id="temporal.sequence.x.murder.x" label="before"/> 

  <edge from="subevent.b" to="payment.x" id="payment.x.subevent.b" label="subevent"/> 

  <edge from="murder.x" to="dateOfEvent.murder.x" id="murder.x.dateOfEvent" label="date"/> 

  <edge from="dateOfEvent.murder.x" to="date.murder.x" id="dateOfEvent.murder.x.date" label="date"/> 

  <edge from="murder.x" to="eventOccursAt.murder.x" id="murder.x.eventOccursAt" label="location"/> 

  <edge from="eventOccursAt.murder.x" to="location.murder.x" id="eventOccursAt.murder.x.location" label="location"/> 

  <edge from="killer.x" to="nameString.killer.x" id="killer.x.nameString" label="name"/>

  <edge from="nameString.killer.x" to="name.killer.x" id="nameString.killer.x.name" label="name"/>

  <edge from="murder.x" to="perpetrator.murder.x" id="murder.x.perpetrator" label="perpetrator"/> 

  <edge from="perpetrator.murder.x" to="killer.x" id="perpetrator.killer.x" label="perpetrator"/> 

  <edge from="victim.x" to="nameString.victim.x" id="victim.x.nameString" label="name"/>

  <edge from="nameString.victim.x" to="name.victim.x" id="nameString.victim.x.name" label="name"/>

  <edge from="murder.x" to="victim.murder.x" id="murder.x.victim" label="victim"/> 

  <edge from="victim.murder.x" to="victim.x" id="victim.victim.x" label="victim"/>

  </body>

</pattern>

 

3) Small pattern that contains a sub-pattern, with a link from a node in the main pattern to the sub-pattern

 

<?xml version = "1.0" encoding = "UTF-8"?>

<pattern xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "http://www.ai.sri.com/~law/schemas/2002/07/pattern" label="pattern 1" id="pattern1">

 <body>

  <node id="nodeA" label="A"/>

  <edge from="nodeA" to="pattern2" id="nodeA.pattern2" label="link"/> 

  <pattern xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "http://www.ai.sri.com/~law/schemas/2002/07/pattern" label="pattern 2" id="pattern2">

    <body>

      <node id="nodeB" label="B"/>

      <node id="nodeC" label="C"/>

      <edge from="nodeB" to="nodeC" id="nodeB.nodeC" label="link"/> 

    </body>

   </pattern>

  </body>

</pattern>

 

 

4) Pattern showing handling of multivalues


<pattern id="pattern1">
<body>
<node id="murder.x" label="murder">
    <instanceOf classid="Murder"/>
</node>
<node id="victim.x" label="victim">
  <instanceOf classid="Person"/>
   <properties><cardinality min="1" max="unbounded"/></properties>
</node>
<node id="victimIntended" label="victimIntended">
  <instanceOf classid="victimIntended"/>
</node>
<node id="nameString" label="nameString">
  <instanceOf classid="nameString"/>
</node>
<node id="hasAlias" label="hasAlias">
  <instanceOf classid="hasAlias"/>
</node>
<node id="victim.x.name" label="victim name">
  <instanceOf classid="xsd:string"/>
</node>
<node id="victim.x.alias" label="victim alias">
  <instanceOf classid="xsd:string"/>
  <properties><cardinality min="1" max="unbounded"/></properties>
</node>
</body>
</pattern>



 Then a valid match might contain

<pattern id="pattern1">
<body>
<node id="victim.x.1" label="victim">
  <origin patternid="pattern1" referenceid="victim.x">
  <value>UID672911</value>
</node>
<node id="victim.x.2" label="victim">
  <origin patternid="pattern1" referenceid="victim.x">
  <value>UID672944</value>
</node>
<node id="victim.x.name.1" label="victim name">
  <origin patternid="pattern1" referenceid="victim.x.name">
  <value>"Alexei Khabibulin"</value>
</node>
<node id="victim.x.name.2" label="victim">
  <origin patternid="pattern1" referenceid="victim.x.name">
  <value>"Taslo Renko"</value>
</node>
<node id="victim.x.alias.1" label="victim alias">
  <origin patternid="pattern1" referenceid="victim.x.alias">
  <value><listOfStrings>"Bad Alexei" "Alexei Khabib"</listOfStrings></value>
</node>
</body>
</pattern>


The pattern contains the cardinality short-hand saying there can be 1 or more victims (of class Person) and your hypothesesis generator will generate new objects for e.g. victim.x.1 and victim.x.2 etc, but these will reference an object in the pattern (victim.x). For the aliases, the victim.x.alias is of class xsd:string, so a pattern matcher might have the rule to allow <listOfStrings> as the value of an object of this class (and <listOfIntegers> for value of objects of class xsd:number)

 

5) Handling disjunction - -saying that the node can be matched by 1 of several sub-patterns.

 

<pattern id="patt1">
<body>
<node id="contractorPrepSubeventUID" label="contractor preparation">
   <instanceOf classid="contractorPrepSubevent_general"/>
   <origin patternid="patt2" referenceId="contractorPreparation_directUID"
   <origin patternid="patt3" referenceId="contractorPreparation_one_mediatorUID">
</node>
</body>
</pattern>

 

where contractorPreparation_directUID and contractorPreparation_one_mediatorUID are root nodes of the specific sub-patterns Origins can reference objects (e.g. nodes) in the current pattern, as well as external patterns -- however the definition of origin does require that a patternid is given.