@prefix d: <http://www.w3.org/2003/g/data-view#>.
@prefix : <figMultiTxform#>.
@prefix s: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@keywords is, of, a.


@prefix log: <http://www.w3.org/2000/10/swap/log#>.

@prefix fn: <http://www.w3.org/2006/xpath-functions#>.

@prefix xslt: <http://www.w3.org/2003/g/data-view#_>.
@prefix rdfx: <http://www.w3.org/2003/g/data-view#_>.

# move to schema/namespace doc
d:txprop s:range TransformProperty.
TransformProperty s:subClassOf owl:FunctionalProperty,
  [ owl:onProperty s:domain; owl:hasValue Node ],
  [ owl:onProperty s:range; owl:hasValue Graph ].
rdfx:graph s:range Graph.

d:transformation s:range Transformation.
Transformation s:subClassOf [
  owl:onProperty d:txprop;
  owl:someValuesFrom TransformProperty
  ].


Transformation s:subClassOf InformationResource.
d:transformation s:domain Node; s:range Transformation.
d:profileTransformation s:range Transformation.
d:namespaceTransformation s:range Transformation.
d:result s:domain InformationResource; s:range Graph.
profile s:domain InformationResource.
namespace s:domain InformationResource.

{ ?IR log:uri ?I; uridoc ?N } => { ?I fn:doc ?N }.

# this is in the spec, no?
{ ?IR log:uri [ fn:doc ?N ].
  ?N d:transformation ?TX. ?TX d:txprop ?TXP .
} => { ?IR d:result [ is ?TXP of ?N ] }.

# assume transformations are XSLT
{ ?TXDOC log:uri [ fn:doc ?TXNODE ]; d:txprop ?TXP.
  ?IR log:uri [ fn:doc ?N ]. ?N d:transformation ?TXDOC.
  ?N ?TXP ?G
} => { (?TXNODE ?N) xslt:resultTree [ rdfx:graph ?G ] }.

# assume transformations have XML representations
{ [] d:transformation ?TXDOC. ?TXDOC log:uri ?I } => { ?I fn:doc [] }.

# relationships to show in diagrams.
{ ?IR log:uri [ fn:doc [ d:transformation ?TX ]] }
 => { ?IR udoctrans ?TX }.
udoctrans s:domain SourceDocument.

{ ?IR log:uri [ fn:doc [ d:transformation [ d:txprop ?P ]]] }
  => { ?IR inputOf ?P }.
{
 ?TXDOC d:txprop ?P;
   log:uri [ fn:doc ?TXNODE ].
 ?IR log:uri [ fn:doc ?R ]. ?R d:transformation ?TXDOC.
 ( ?TXNODE ?R ) xslt:resultTree [ rdfx:graph ?G ]
} => { ?P output ?G }.
 
{ ?IR d:result ?F, ?G.
  [] output ?F.
  [] output ?G.
  ?F log:notEqualTo ?G.
} => { ?IR mergeresult [ ] }.
{ ?IR d:result ?G; mergeresult ?F. [] output ?G } => { ?G mergepart ?F }.

udoctrans s:subPropertyOf effectiveTransformation.
implicitTransformation s:subPropertyOf effectiveTransformation.

{ ?DOC namespace [ d:namespaceTransformation ?TX ] }
  => { ?DOC implicitTransformation ?TX }.
{ ?DOC profile [ d:profileTransformation ?TX ] }
  => { ?DOC implicitTransformation ?TX }.
{ ?DOC log:uri [ fn:doc ?N ];
    namespace [ d:namespaceTransformation ?TX ]
} => { ?N d:transformation ?TX }.
{ ?DOC log:uri [ fn:doc ?N ];
    profile [ d:profileTransformation ?TX ]
} => { ?N d:transformation ?TX }.

##########

{ ?S [ s:domain ?C ] [] } => { ?S a ?C }.
{ [] [ s:range ?C ] ?O } => { ?O a ?C }.

{ ?S a [ s:subClassOf ?C ] } => { ?S a ?C }.
{ ?S [ s:subPropertyOf ?P ] ?O } => { ?S ?P ?O. }.

{ ?S a [ owl:onProperty ?P; owl:hasValue ?V ] } => { ?S ?P ?V }.

{ ?S a [ owl:onProperty ?P; owl:someValuesFrom ?C ] } => { ?S ?P [ a ?C ] }.

##########

##########

@prefix g: <http://www.w3.org/2001/02pd/gv#>.

<> g:digraph :theGraph.
:theGraph g:rankdir "LR";
  g:ranksep "0.4"; g:nodesep "0.1"; g:fontsize "10".

{ ?X a [ classShape ?TXT ] }
 => { ?X g:shape ?TXT }.

{ ?X a [ classLabel ?TXT ] }
 => { ?X g:label ?TXT }.

TransformProperty s:subClassOf BlankLabel.
BlankLabel owl:onProperty g:label; owl:hasValue "".

##########

{ ?D a InformationResource } => { :theGraph g:hasNode ?D }.

{ :theGraph g:hasNode [ [ a g:EdgeProperty ] ?N2 ] }
 => { :theGraph g:hasNode ?N2 }.
{ :theGraph g:hasNode [ is [ a g:EdgeProperty ] of ?N2 ] }
 => { :theGraph g:hasNode ?N2 }.

{ :theGraph g:hasNode ?D.
  ?D effectiveTransformation ?T } => { :theGraph g:hasNode ?T }.
{ :theGraph g:hasNode ?D.
  ?D profile ?P } => { :theGraph g:hasNode ?P }.
{ :theGraph g:hasNode ?D.
  ?D namespace ?P } => { :theGraph g:hasNode ?P }.
{ :theGraph g:hasNode ?D.
  ?D dest ?F } => { :theGraph g:hasNode ?F }.
{ :theGraph g:hasNode ?F.
  ?D dest ?F } => { :theGraph g:hasNode ?D }.
{ ?X a Foreground } => { :theGraph g:hasNode ?X }.



{
{ ?G g:hasNode ?D.
  ?D mergeresult ?INFO }
 => { ?G g:subgraph [
           is cluster of ?INFO;
           g:hasNode ?INFO;
      ]
    }.

{ ?INFO cluster ?C; part ?FMLA } => { ?C g:hasNode ?FMLA }.
} a DeadCode. # relies on subgraph support in rdf2dot.py

{ [] g:hasNode ?N } => { ?N g:fontsize "12" }.
{ ?P a g:EdgeProperty } => { ?P g:fontsize "11" }.

d:txprop a g:EdgeProperty; g:label "tx. prop"; g:style "dotted".
inputOf a g:EdgeProperty; g:label ""; g:style "bold".
mergeresult s:range Graph.
mergeresult a g:EdgeProperty; g:label "result"; g:style "bold".
mergepart a g:EdgeProperty; g:label "subgraph".
output a g:EdgeProperty; g:label "result"; g:style "bold".
udoctrans a g:EdgeProperty; g:label "transformation".

profile a g:EdgeProperty; g:label "profile".
namespace a g:EdgeProperty; g:label "namespace".
#implicitTransformation a g:EdgeProperty; g:label "transformation"; g:style "dotted".
d:profileTransformation a g:EdgeProperty; g:label "profileTransformation".
d:namespaceTransformation a g:EdgeProperty; g:label "namespaceTransformation".

owl:FunctionalProperty classShape "point".
Transformation classShape "parallelogram".
SourceDocument classShape "Msquare".
Information classShape "point"; s:subClassOf BlankLabel.
Graph classShape "invtrapezium"; classLabel "RDF".

FunctionApplication classShape "point"; s:subClassOf BlankLabel.

<doc1.html> g:label "<html>\\n<meta\\n name='dc...'>"; g:fontname "Courier".
<doc.html> g:label "doc.html".
<home.html> g:label "home.html".
<http://www.w3.org/2003/12/rdf-in-xhtml-xslts/grokFOAF.xsl> g:label "grokFoaf.xsl".
<http://www.w3.org/2003/12/rdf-in-xhtml-xslts/grokCC.xsl> g:label "grokCC.xsl".
<http://www.w3.org/2003/12/rdf-in-xhtml-xslts/grokGeoURL.xsl> g:label "grokGeoURL.xsl".
</2000/06/dc-extract/dc-extract.xsl> g:label "dc-extract.xsl".
</2000/08/w3c-synd/home2rss.xsl> g:label "home2rss.xsl".

<http://www.w3.org/2003/g/td/friends> g:label "friends.html".
<http://www.w3.org/2003/g/td/xfn-workalike> g:label "xfn profile".

<http://gmpg.org/xfn/11> g:label "XFN profile".
<http://www.w3.org/2003/12/rdf-in-xhtml-xslts/grokXFN.xsl> g:label "grokXFN.xsl".

<policy.p3q> g:label "policy.p3q".
<http://www.w3.org/2004/01/rdxh/p3q-ns-example> g:label "p3q-ns-example".
 <http://www.w3.org/2004/01/rdxh/grokP3Q.xsl> g:label "grokP3Q.xsl".

<http://www.w3.org/2003/g/po-doc.xml> g:label "po-doc.xml".
<http://www.w3.org/2003/g/po-ex> g:label "po-ex".
<http://www.w3.org/2003/g/embeddedRDF.xsl> g:label "embeddedRDF.xsl".
<http://www.w3.org/2003/g/grokPO.xsl> g:label "grokPO.xsl".
<http://www.w3.org/2003/12/rdf-in-xhtml-xslts/grokRDDL.xsl> g:label "grokRDDL.xsl".

