@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix list: <http://www.daml.org/2001/03/daml+oil#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix subwayont: <http://www.daml.org/2003/05/subway/subway-ont#> .
@prefix : <#> .

<> owl:versionInfo "$Id: expand.n3,v 1.4 2003/05/24 10:13:37 mdean Exp $";
   rdfs:comment "rules to expand subway line lists".

:linehack a log:Chaff.

{
  ?line subwayont:stations ?list.
}
=>
{
  ?list :linehack ?line.
}.

{
  ?list1 list:first ?station1.
  ?list1 list:rest ?list2.
  ?list1 :linehack ?line.
# :station1 a subwayont:Station.
}
=>
{
  ?station1 subwayont:line ?line.
  ?list2 :linehack ?line.
}.

{
  ?list1 list:first ?station1.
  ?list1 list:rest ?list2.
  ?list2 list:first ?station2.
#   :station1 a subwayont:Station.
#   :station2 a subwayont:Station.
}
=>
{
  ?station1 subwayont:adjacentTo ?station2.
  ?station2 subwayont:adjacentTo ?station1.
}.
