# $Id: N3TestGenReport.n3,v 1.1 2002/12/11 13:53:45 graham Exp $ # # Test report data for N3GenReport.py # Also uses N3GenProtocolMatrixTest.n3 # #--------+---------+---------+---------+---------+---------+---------+---------+ # # Copyright (c) 2002, G. KLYNE # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # #--------+---------+---------+---------+---------+---------+---------+---------+ # $Source: /file/cvsdev/PythonN3/N3TestGenReport.n3,v $ # $Author: graham $ # $Date: 2002/12/11 13:53:45 $ # $Id: N3TestGenReport.n3,v 1.1 2002/12/11 13:53:45 graham Exp $ #--------+---------+---------+---------+---------+---------+---------+---------+ # @prefix rdf: . @prefix rdfs: . @prefix foaf: . @prefix rep: . @prefix dc: . @prefix protocol: . @prefix prep: . rep:GenReport a rep:Report ; :- ( [ rep:cmd rep:if ; rep:defined "Output" ; rep:do prep:HTMLReport ] ) . prep:HTMLReport a rep:Report ; :- ( [ rep:cmd rep:open ; rep:chan "t" ; rep:file ( [ rep:var "Output" ] ".html" ) ] [ rep:cmd rep:if ; rep:pattern prep:ThisPattern ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:ThisHead ] [ rep:do prep:GenProtoReport ] [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:ThisFoot ] ) ; rep:else ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:NoReport ] ) ] [ rep:cmd rep:close ; rep:chan "t" ] ) . prep:GenProtoReport :- ( [ rep:cmd rep:for ; rep:pattern prep:ProtoPattern ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto1 ] [ rep:cmd rep:for ; rep:pattern prep:ProtoTypePattern ; rep:first ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto2first ] ) ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto2 ] ) ; rep:sep ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto2sep ] ) ; rep:last ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto2last ] ) ] [ rep:cmd rep:for ; rep:pattern prep:ProtoSpecPattern ; rep:first ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto3first ] ) ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto3 ] ) ; rep:sep ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto3sep ] ) ; rep:last ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto3last ] ) ] [ rep:cmd rep:for ; rep:pattern prep:ProtoUsesPattern ; rep:first ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto4first ] ) ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto4 ] ) ; rep:sep ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto4sep ] ) ; rep:last ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto4last ] ) ] [ rep:cmd rep:for ; rep:pattern prep:ProtoCanUsePattern ; rep:first ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto5first ] ) ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto5 ] ) ; rep:sep ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto5sep ] ) ; rep:last ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto5last ] ) ] [ rep:cmd rep:for ; rep:pattern prep:ProtoUsedByPattern ; rep:first ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:UsedByFirst ] ) ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:UsedByItem ] ) ; rep:sep ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:UsedBySep ] ) ; rep:last ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:UsedByLast ] ) ] [ rep:cmd rep:for ; rep:pattern prep:ProtoContainsPattern ; rep:first ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto6first ] ) ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto6 ] ) ; rep:sep ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto6sep ] ) ; rep:last ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto6last ] ) ] [ rep:cmd rep:for ; rep:pattern prep:ProtoCanContainPattern ; rep:first ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto7first ] ) ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto7 ] ) ; rep:sep ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto7sep ] ) ; rep:last ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto7last ] ) ] [ rep:cmd rep:for ; rep:pattern prep:ProtoCannotContainPattern ; rep:first ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto8first ] ) ; rep:do ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto8 ] ) ; rep:sep ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto8sep ] ) ; rep:last ( [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto8last ] ) ] [ rep:cmd rep:write ; rep:chan "t" ; rep:data prep:Proto9 ] ) ] ) . #### query patterns #### # About the current document prep:ThisPattern :- ( [ rep:var "thisinfo" ] [ rep:and ( [ rep:uri rdfs:label ] [ rep:var "ThisLabel" ] ), ( [ rep:uri dc:author ] [ rep:var "ThisAuthor" ] ), ( [ rep:uri dc:date ] [ rep:var "ThisDate" ] ), ( [ rep:uri rdfs:comment ] [ rep:var "ThisComment" ] ) ] ) . # Protocol info pattern prep:ProtoPattern :- ( [ rep:var "protoinfo" ] [ rep:and ( [ rep:uri rdf:type ] [ rep:uri protocol:Protocol ] ), ( [ rep:uri rdfs:label ] [ rep:var "ProtoLabel" ] ), ( [ rep:uri rdfs:comment ] [ rep:var "ProtoDescr" ] ) ] ) . # Protocol type pattern prep:ProtoTypePattern :- ( [ rep:var "protoinfo" ] [ rep:uri protocol:type ] [ rep:var "ProtoType" ] [ rep:uri rdfs:label ] [ rep:var "ProtoTypeLabel" ] ) . # Protocol specification pattern prep:ProtoSpecPattern :- ( [ rep:var "protoinfo" ] [ rep:uri protocol:specification ] [ rep:var "ProtoSpec" ] ) . # Protocol uses pattern prep:ProtoUsesPattern :- ( [ rep:var "protoinfo" ] [ rep:uri protocol:uses ] [ rep:var "ProtoUses" ] [ rep:uri rdfs:label ] [ rep:var "ProtoUsesLabel" ] ) . # Protocol can-use pattern prep:ProtoCanUsePattern :- ( [ rep:var "protoinfo" ] [ rep:uri protocol:canUse ] [ rep:var "ProtoCanUse" ] [ rep:uri rdfs:label ] [ rep:var "ProtoCanUseLabel" ] ) . # Protocol used-by pattern prep:ProtoUsedByPattern :- ( [ rep:var "ProtoUsedBy" ] [ rep:and ( [ rep:uri protocol:uses ] [ rep:var "protoinfo" ] ), ( [ rep:uri rdfs:label ] [ rep:var "ProtoUsedByLabel" ] ) ] ) . # Protocol contains pattern prep:ProtoContainsPattern :- ( [ rep:var "protoinfo" ] [ rep:uri protocol:contains ] [ rep:var "ProtoContains" ] [ rep:uri rdfs:label ] [ rep:var "ProtoContainsLabel" ] ) . # Protocol can-contain pattern prep:ProtoCanContainPattern :- ( [ rep:var "protoinfo" ] [ rep:uri protocol:canContain ] [ rep:var "ProtoCanContain" ] [ rep:uri rdfs:label ] [ rep:var "ProtoCanContainLabel" ] ) . # Protocol cannot-contain pattern prep:ProtoCannotContainPattern :- ( [ rep:var "protoinfo" ] [ rep:uri protocol:cannotContain ] [ rep:var "ProtoCannotContain" ] [ rep:uri rdfs:label ] [ rep:var "ProtoCannotContainLabel" ] ) . #### output templates #### prep:ThisHead :- ( "" rep:nl "" "" rep:nl "" rep:nl "" [rep:var "ThisLabel"] "" rep:nl "" rep:nl "" rep:nl rep:nl "

" [rep:var "ThisLabel"] "

" rep:nl "
" rep:nl "
Prepared by:
" [rep:var "ThisAuthor"] "
" rep:nl "
Date:
" [rep:var "ThisDate"] "
" rep:nl "
" rep:nl "

" [rep:var "ThisComment"] "

" rep:nl "
" rep:nl ) . prep:ThisFoot :- ( "" rep:nl "" rep:nl ) . prep:NoReport :- ( "" rep:nl "" "" rep:nl "" rep:nl "Empty report" rep:nl "" rep:nl "" rep:nl "

Nothing found to report.

" rep:nl "" rep:nl "" rep:nl ) . # Protocol table and name prep:Proto1 :- ( "

" [ rep:var "ProtoLabel" ] "

" rep:nl "" rep:nl ) . # Protocol type info prep:Proto2first :- ( "" ) . # Specification prep:Proto3first :- ( "" rep:nl ) . # Uses prep:Proto4first :- ( "" rep:nl ) . # Can-use prep:Proto5first :- ( "" rep:nl ) . # Used-by prep:UsedByFirst :- ( "" rep:nl ) . # Contains prep:Proto6first :- ( "" rep:nl ) . # Can-contain prep:Proto7first :- ( "" rep:nl ) . # Cannot-contain prep:Proto8first :- ( "" rep:nl ) . # Protocol description end table prep:Proto9 :- ( "" rep:nl "
Specification type: " rep:nl ) . prep:Proto2 :- ( [ rep:var "ProtoTypeLabel" ] ) . prep:Proto2sep :- ( ", " ) . prep:Proto2last :- ( "
Specification(s): " rep:nl ) . prep:Proto3 :- ( "" [ rep:var "ProtoSpec" ] "" ) . prep:Proto3sep :- ( "
" rep:nl ) . prep:Proto3last :- ( "
Uses: " rep:nl ) . prep:Proto4 :- ( "" [ rep:var "ProtoUsesLabel" ] "" ) . prep:Proto4sep :- ( "
" rep:nl ) . prep:Proto4last :- ( "
Can use: " rep:nl ) . prep:Proto5 :- ( "" [ rep:var "ProtoCanUseLabel" ] "" ) . prep:Proto5sep :- ( "
" rep:nl ) . prep:Proto5last :- ( "
Used by: " rep:nl ) . prep:UsedByItem :- ( "" [ rep:var "ProtoUsedByLabel" ] "" ) . prep:UsedBySep :- ( "
" rep:nl ) . prep:UsedByLast :- ( "
Contains or carries: " rep:nl ) . prep:Proto6 :- ( "" [ rep:var "ProtoContainsLabel" ] "" ) . prep:Proto6sep :- ( "
" rep:nl ) . prep:Proto6last :- ( "
Can contain or carry: " rep:nl ) . prep:Proto7 :- ( "" [ rep:var "ProtoCanContainLabel" ] "" ) . prep:Proto7sep :- ( "
" rep:nl ) . prep:Proto7last :- ( "
Cannot contain or carry: " rep:nl ) . prep:Proto8 :- ( "" [ rep:var "ProtoCannotContainLabel" ] "" ) . prep:Proto8sep :- ( "
" rep:nl ) . prep:Proto8last :- ( "
" [ rep:var "ProtoDescr" ] "
" ) . # #--------+---------+---------+---------+---------+---------+---------+---------+ # $Log: N3TestGenReport.n3,v $ # Revision 1.1 2002/12/11 13:53:45 graham # Add new generic reportgenerator module and test data. # Test output should be identical to N3GenProtocolMatrix test output. #