@prefix g: <http://www.w3.org/2001/02pd/gv#>.
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix list: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix owl:  <http://www.w3.org/2002/07/owl#>.
@prefix :   <http://www.w3.org/2001/tag/fdesc54/classTreeOwl#>.
@prefix ct: <http://www.w3.org/2001/tag/fdesc54/classTreeOwl#>.

@prefix w: <http://www.w3.org/2001/tag/fdesc54/webarch#>.
@prefix mu: <modelling-utilities@@#> .

:InPreviousSlide a owl:Class.
#IJ chuckles at choice of color #DCDCDC ;)

{ ?C mu:components ?L } => { ?C :parts [] }.

{ ?C :parts ?N } =>
  { ?N g:shape "diamond";
       g:style "filled";
       g:label "".
    :theGraph g:hasNode ?N, ?C }.

# grumble... cwm won't bind to first/rest without something to
# get it started.
{ [] mu:components ?L } => { ?L :_tail ?L }.
{ [] mu:components ?L. ?L :_tail [ list:rest ?Z ] } => { ?L :_tail ?Z }.
{ [] mu:components ?L; :parts ?N. ?L :_tail [ list:first ?X ] }
   => { ?N :part ?X }.

:theGraph g:hasEdgeProperty mu:components, :part, :parts.


:theGraph g:hasEdgeProperty rdfs:subClassOf;
  g:color "blue".

owl:Class :classShape "box".

{ ?C a [ :classShape ?S]; rdfs:label ?STR }
  => { ?C g:label ?STR; g:shape ?S }.

{ ?C a [ :classShape []]; a :InPreviousSlide }
  => { ?C g:fontcolor "#DCDCDC"; g:color "#DCDCDC" }.

#@@ use the datatype label somehow?
{ ?C rdfs:label ?TXT; rdfs:subClassOf [ a rdfs:Datatype ] }
  => { ?C g:label ?TXT; g:shape "box"; g:style "bold" }.
#ugh... special case transitivity of subClassOf
# so that the arrows don't go wild.
{ ?C rdfs:subClassOf [ rdfs:subClassOf ?D ].
  ?D a rdfs:Datatype } => { ?C rdfs:subClassOf ?D }.

#######
# owl axioms
{ ?P rdfs:domain ?C;
     rdfs:range ?C2 }
=> { ?C rdfs:subClassOf [ owl:onProperty ?P; owl:allValuesFrom ?C2 ] }.

###


{ [] g:hasEdgeProperty ?E.
  ?E a owl:FunctionalProperty } => { ?E g:style "bold" }.
{ ?E :basis [ a owl:FunctionalProperty ] } => { ?E g:style "bold" }.

{
  ?G g:hasNode ?C.
  ?C rdfs:subClassOf [ owl:onProperty ?P; owl:allValuesFrom ?C2 ].
  ?P rdfs:label ?STR.
  }
  => { 
     ?C [ is g:hasEdgeProperty of ?G; g:label ?STR; g:color "red";
          :basis ?P ] ?C2.
	?G g:hasNode ?C2.
  }.
{
  ?G g:hasNode ?C2.
  ?C rdfs:subClassOf [ owl:onProperty ?P; owl:allValuesFrom ?C2 ].
  ?P rdfs:label ?STR.
  }
  => { 
	?G g:hasNode ?C.
  }.


<> g:digraph :theGraph.

:theGraph g:hasNode w:URI, w:Resource, w:Representation;
  g:label "$Id: classTreeOwl.n3,v 1.5 2003/11/24 10:22:29 connolly Exp $".

# include labelled, shaped classes that are related by subClassOf
# (i.e. not restrictions)
{ ?C rdfs:subClassOf ?C2.
  ?C rdfs:label []; a [ :classShape []] }
  => { :theGraph g:hasNode ?C }.
{ ?C rdfs:subClassOf ?C2.
  ?C2 rdfs:label []; a [ :classShape []] }
  => { :theGraph g:hasNode ?C2 }.

{ ?G g:hasEdgeProperty ?P.
  ?P rdfs:label ?STR } => { ?P g:label ?STR }.



